Skip to content

create_delegate_mac_volume_ownership_task

create_delegate_mac_volume_ownership_task(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    client_token: Optional[String] = None,
    dry_run: Optional[Boolean] = None,
    instance_id: Optional[InstanceId] = None,
    mac_credentials: Optional[SensitiveMacCredentials] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
) -> CreateDelegateMacVolumeOwnershipTaskResult

Delegates ownership of the Amazon EBS root volume for an Apple silicon Mac instance to an administrative user.

Parameters:

  • client_token (Optional[String], default: None ) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • instance_id (Optional[InstanceId], default: None ) –

    The ID of the Amazon EC2 Mac instance.

  • mac_credentials (Optional[SensitiveMacCredentials], default: None ) –

    Specifies the following credentials:

    • Internal disk administrative user

      • Username - Only the default administrative user (aws-managed-user) is supported and it is used by default. You can't specify a different administrative user.

      • Password - If you did not change the default password for aws-managed-user, specify the default password, which is blank. Otherwise, specify your password.

    • Amazon EBS root volume administrative user

      • Username - If you did not change the default administrative user, specify ec2-user. Otherwise, specify the username for your administrative user.

      • Password - Specify the password for the administrative user.

    The credentials must be specified in the following JSON format:

    { "internalDiskPassword":"internal-disk-admin_password", "rootVolumeUsername":"root-volume-admin_username", "rootVolumepassword":"root-volume-admin_password" }

  • tag_specifications (Optional[TagSpecificationList], default: None ) –

    The tags to assign to the volume ownership delegation task.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def create_delegate_mac_volume_ownership_task(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    client_token: Optional["capo_ec2.types.string.String"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    instance_id: Optional["capo_ec2.types.instance_id.InstanceId"] = None,
    mac_credentials: Optional[
        "capo_ec2.types.sensitive_mac_credentials.SensitiveMacCredentials"
    ] = None,
    tag_specifications: Optional[
        "capo_ec2.types.tag_specification_list.TagSpecificationList"
    ] = None,
) -> "capo_ec2.types.create_delegate_mac_volume_ownership_task_result.CreateDelegateMacVolumeOwnershipTaskResult":
    """<p>Delegates ownership of the Amazon EBS root volume for an Apple silicon Mac instance to an administrative user.</p>

    Args:
        client_token: <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring Idempotency</a>.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        instance_id: <p>The ID of the Amazon EC2 Mac instance.</p>
        mac_credentials: <p>Specifies the following credentials:</p> <ul> <li> <p> <b>Internal disk administrative user</b> </p> <ul> <li> <p> <b>Username</b> - Only the default administrative user (<code>aws-managed-user</code>) is supported and it is used by default. You can't specify a different administrative user.</p> </li> <li> <p> <b>Password</b> - If you did not change the default password for <code>aws-managed-user</code>, specify the default password, which is <i>blank</i>. Otherwise, specify your password.</p> </li> </ul> </li> <li> <p> <b>Amazon EBS root volume administrative user</b> </p> <ul> <li> <p> <b>Username</b> - If you did not change the default administrative user, specify <code>ec2-user</code>. Otherwise, specify the username for your administrative user.</p> </li> <li> <p> <b>Password</b> - Specify the password for the administrative user.</p> </li> </ul> </li> </ul> <p>The credentials must be specified in the following JSON format:</p> <p> <code>{ "internalDiskPassword":"<i>internal-disk-admin_password</i>", "rootVolumeUsername":"<i>root-volume-admin_username</i>", "rootVolumepassword":"<i>root-volume-admin_password</i>" }</code> </p>
        tag_specifications: <p>The tags to assign to the volume ownership delegation task.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.create_delegate_mac_volume_ownership_task_request.CreateDelegateMacVolumeOwnershipTaskRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.create_delegate_mac_volume_ownership_task_result.CreateDelegateMacVolumeOwnershipTaskResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_delegate_mac_volume_ownership_task

        output, http_response = (
            capo_ec2._operations.amazon_ec2.create_delegate_mac_volume_ownership_task.create_delegate_mac_volume_ownership_task(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_ec2.types.create_delegate_mac_volume_ownership_task_request.CreateDelegateMacVolumeOwnershipTaskRequest",
    ) -> dict[str, Any]:
        import capo_ec2.types.create_delegate_mac_volume_ownership_task_request

        return capo_ec2.types.create_delegate_mac_volume_ownership_task_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateDelegateMacVolumeOwnershipTask", redact_input=_redact_input
        ),
    )
    input_: capo_ec2.types.create_delegate_mac_volume_ownership_task_request.CreateDelegateMacVolumeOwnershipTaskRequest = {}
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if mac_credentials is not None:
        input_["mac_credentials"] = mac_credentials
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output