Skip to content

create_location_object_storage async

create_location_object_storage(
    server_hostname: ServerHostname,
    bucket_name: ObjectStorageBucketName,
    *,
    config_overrides: Optional[AsyncDataSyncClientConfig] = None,
    server_port: Optional[ObjectStorageServerPort] = None,
    server_protocol: Optional[ObjectStorageServerProtocol] = None,
    subdirectory: Optional[S3Subdirectory] = None,
    access_key: Optional[ObjectStorageAccessKey] = None,
    secret_key: Optional[ObjectStorageSecretKey] = None,
    agent_arns: Optional[AgentArnList] = None,
    tags: Optional[InputTagList] = None,
    server_certificate: Optional[ObjectStorageCertificate] = None,
    cmk_secret_config: Optional[CmkSecretConfig] = None,
    custom_secret_config: Optional[CustomSecretConfig] = None,
) -> CreateLocationObjectStorageResponse

Creates a transfer location for an object storage system. DataSync can use this location as a source or destination for transferring data. You can make transfers with or without a DataSync agent.

Before you begin, make sure that you understand the prerequisites for DataSync to work with object storage systems.

Parameters:

  • server_hostname (ServerHostname) –

    Specifies the domain name or IP address (IPv4 or IPv6) of the object storage server that your DataSync agent connects to.

  • server_port (Optional[ObjectStorageServerPort], default: None ) –

    Specifies the port that your object storage server accepts inbound network traffic on (for example, port 443).

  • server_protocol (Optional[ObjectStorageServerProtocol], default: None ) –

    Specifies the protocol that your object storage server uses to communicate. If not specified, the default value is HTTPS.

  • subdirectory (Optional[S3Subdirectory], default: None ) –

    Specifies the object prefix for your object storage server. If this is a source location, DataSync only copies objects with this prefix. If this is a destination location, DataSync writes all objects with this prefix.

  • bucket_name (ObjectStorageBucketName) –

    Specifies the name of the object storage bucket involved in the transfer.

  • access_key (Optional[ObjectStorageAccessKey], default: None ) –

    Specifies the access key (for example, a user name) if credentials are required to authenticate with the object storage server.

  • secret_key (Optional[ObjectStorageSecretKey], default: None ) –

    Specifies the secret key (for example, a password) if credentials are required to authenticate with the object storage server.

    If you provide a secret using SecretKey, but do not provide secret configuration details using CmkSecretConfig or CustomSecretConfig, then DataSync stores the token using your Amazon Web Services account's Secrets Manager secret.

  • agent_arns (Optional[AgentArnList], default: None ) –

    (Optional) Specifies the Amazon Resource Names (ARNs) of the DataSync agents that can connect with your object storage system. If you are setting up an agentless cross-cloud transfer, you do not need to specify a value for this parameter.

    Make sure you configure this parameter correctly when you first create your storage location. You cannot add or remove agents from a storage location after you create it.

  • tags (Optional[InputTagList], default: None ) –

    Specifies the key-value pair that represents a tag that you want to add to the resource. Tags can help you manage, filter, and search for your resources. We recommend creating a name tag for your location.

  • server_certificate (Optional[ObjectStorageCertificate], default: None ) –

    Specifies a certificate chain for DataSync to authenticate with your object storage system if the system uses a private or self-signed certificate authority (CA). You must specify a single .pem file with a full certificate chain (for example, file:///home/user/.ssh/object_storage_certificates.pem).

    The certificate chain might include:

    • The object storage system's certificate

    • All intermediate certificates (if there are any)

    • The root certificate of the signing CA

    You can concatenate your certificates into a .pem file (which can be up to 32768 bytes before base64 encoding). The following example cat command creates an object_storage_certificates.pem file that includes three certificates:

    cat object_server_certificate.pem intermediate_certificate.pem ca_root_certificate.pem > object_storage_certificates.pem

    To use this parameter, configure ServerProtocol to HTTPS.

  • cmk_secret_config (Optional[CmkSecretConfig], default: None ) –

    Specifies configuration information for a DataSync-managed secret, which includes the SecretKey that DataSync uses to access a specific object storage location, with a customer-managed KMS key.

    When you include this parameter as part of a CreateLocationObjectStorage request, you provide only the KMS key ARN. DataSync uses this KMS key together with the value you specify for the SecretKey parameter to create a DataSync-managed secret to store the location access credentials.

    Make sure that DataSync has permission to access the KMS key that you specify. For more information, see Using a service-managed secret encrypted with a custom KMS key.

    You can use either CmkSecretConfig (with SecretKey) or CustomSecretConfig (without SecretKey) to provide credentials for a CreateLocationObjectStorage request. Do not provide both parameters for the same request.

  • custom_secret_config (Optional[CustomSecretConfig], default: None ) –

    Specifies configuration information for a customer-managed Secrets Manager secret where the secret key for a specific object storage location is stored in plain text, in Secrets Manager. This configuration includes the secret ARN, and the ARN for an IAM role that provides access to the secret. For more information, see Using a secret that you manage.

    You can use either CmkSecretConfig (with SecretKey) or CustomSecretConfig (without SecretKey) to provide credentials for a CreateLocationObjectStorage request. Do not provide both parameters for the same request.

Raises:

Source code in docs_src/capo_datasync/_services/async_data_sync.py
async def create_location_object_storage(
    self,
    server_hostname: "capo_datasync.types.server_hostname.ServerHostname",
    bucket_name: "capo_datasync.types.object_storage_bucket_name.ObjectStorageBucketName",
    *,
    config_overrides: Optional[AsyncDataSyncClientConfig] = None,
    server_port: Optional[
        "capo_datasync.types.object_storage_server_port.ObjectStorageServerPort"
    ] = None,
    server_protocol: Optional[
        "capo_datasync.types.object_storage_server_protocol.ObjectStorageServerProtocol"
    ] = None,
    subdirectory: Optional[
        "capo_datasync.types.s3_subdirectory.S3Subdirectory"
    ] = None,
    access_key: Optional[
        "capo_datasync.types.object_storage_access_key.ObjectStorageAccessKey"
    ] = None,
    secret_key: Optional[
        "capo_datasync.types.object_storage_secret_key.ObjectStorageSecretKey"
    ] = None,
    agent_arns: Optional["capo_datasync.types.agent_arn_list.AgentArnList"] = None,
    tags: Optional["capo_datasync.types.input_tag_list.InputTagList"] = None,
    server_certificate: Optional[
        "capo_datasync.types.object_storage_certificate.ObjectStorageCertificate"
    ] = None,
    cmk_secret_config: Optional[
        "capo_datasync.types.cmk_secret_config.CmkSecretConfig"
    ] = None,
    custom_secret_config: Optional[
        "capo_datasync.types.custom_secret_config.CustomSecretConfig"
    ] = None,
) -> "capo_datasync.types.create_location_object_storage_response.CreateLocationObjectStorageResponse":
    """<p>Creates a transfer <i>location</i> for an object storage system. DataSync can use this location as a source or destination for transferring data. You can make transfers with or without a <a href="https://docs.aws.amazon.com/datasync/latest/userguide/do-i-need-datasync-agent.html#when-agent-required">DataSync agent</a>.</p> <p>Before you begin, make sure that you understand the <a href="https://docs.aws.amazon.com/datasync/latest/userguide/create-object-location.html#create-object-location-prerequisites">prerequisites</a> for DataSync to work with object storage systems.</p>

    Args:
        server_hostname: <p>Specifies the domain name or IP address (IPv4 or IPv6) of the object storage server that your DataSync agent connects to.</p>
        server_port: <p>Specifies the port that your object storage server accepts inbound network traffic on (for example, port 443).</p>
        server_protocol: <p>Specifies the protocol that your object storage server uses to communicate. If not specified, the default value is <code>HTTPS</code>.</p>
        subdirectory: <p>Specifies the object prefix for your object storage server. If this is a source location, DataSync only copies objects with this prefix. If this is a destination location, DataSync writes all objects with this prefix. </p>
        bucket_name: <p>Specifies the name of the object storage bucket involved in the transfer.</p>
        access_key: <p>Specifies the access key (for example, a user name) if credentials are required to authenticate with the object storage server.</p>
        secret_key: <p>Specifies the secret key (for example, a password) if credentials are required to authenticate with the object storage server.</p> <note> <p>If you provide a secret using <code>SecretKey</code>, but do not provide secret configuration details using <code>CmkSecretConfig</code> or <code>CustomSecretConfig</code>, then DataSync stores the token using your Amazon Web Services account's Secrets Manager secret.</p> </note>
        agent_arns: <p>(Optional) Specifies the Amazon Resource Names (ARNs) of the DataSync agents that can connect with your object storage system. If you are setting up an agentless cross-cloud transfer, you do not need to specify a value for this parameter.</p> <note> <p>Make sure you configure this parameter correctly when you first create your storage location. You cannot add or remove agents from a storage location after you create it.</p> </note>
        tags: <p>Specifies the key-value pair that represents a tag that you want to add to the resource. Tags can help you manage, filter, and search for your resources. We recommend creating a name tag for your location.</p>
        server_certificate: <p>Specifies a certificate chain for DataSync to authenticate with your object storage system if the system uses a private or self-signed certificate authority (CA). You must specify a single <code>.pem</code> file with a full certificate chain (for example, <code>file:///home/user/.ssh/object_storage_certificates.pem</code>).</p> <p>The certificate chain might include:</p> <ul> <li> <p>The object storage system's certificate</p> </li> <li> <p>All intermediate certificates (if there are any)</p> </li> <li> <p>The root certificate of the signing CA</p> </li> </ul> <p>You can concatenate your certificates into a <code>.pem</code> file (which can be up to 32768 bytes before base64 encoding). The following example <code>cat</code> command creates an <code>object_storage_certificates.pem</code> file that includes three certificates:</p> <p> <code>cat object_server_certificate.pem intermediate_certificate.pem ca_root_certificate.pem > object_storage_certificates.pem</code> </p> <p>To use this parameter, configure <code>ServerProtocol</code> to <code>HTTPS</code>.</p>
        cmk_secret_config: <p>Specifies configuration information for a DataSync-managed secret, which includes the <code>SecretKey</code> that DataSync uses to access a specific object storage location, with a customer-managed KMS key.</p> <p>When you include this parameter as part of a <code>CreateLocationObjectStorage</code> request, you provide only the KMS key ARN. DataSync uses this KMS key together with the value you specify for the <code>SecretKey</code> parameter to create a DataSync-managed secret to store the location access credentials.</p> <p>Make sure that DataSync has permission to access the KMS key that you specify. For more information, see <a href="https://docs.aws.amazon.com/datasync/latest/userguide/location-credentials.html#service-secret-custom-key"> Using a service-managed secret encrypted with a custom KMS key</a>.</p> <note> <p>You can use either <code>CmkSecretConfig</code> (with <code>SecretKey</code>) or <code>CustomSecretConfig</code> (without <code>SecretKey</code>) to provide credentials for a <code>CreateLocationObjectStorage</code> request. Do not provide both parameters for the same request.</p> </note>
        custom_secret_config: <p>Specifies configuration information for a customer-managed Secrets Manager secret where the secret key for a specific object storage location is stored in plain text, in Secrets Manager. This configuration includes the secret ARN, and the ARN for an IAM role that provides access to the secret. For more information, see <a href="https://docs.aws.amazon.com/datasync/latest/userguide/location-credentials.html#custom-secret-custom-key"> Using a secret that you manage</a>.</p> <note> <p>You can use either <code>CmkSecretConfig</code> (with <code>SecretKey</code>) or <code>CustomSecretConfig</code> (without <code>SecretKey</code>) to provide credentials for a <code>CreateLocationObjectStorage</code> request. Do not provide both parameters for the same request.</p> </note>

    Raises:
        capo_datasync.errors.internal_exception.InternalException: <p>This exception is thrown when an error occurs in the DataSync service.</p>
        capo_datasync.errors.invalid_request_exception.InvalidRequestException: <p>This exception is thrown when the client submits a malformed request.</p>
        capo_datasync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_datasync.types.create_location_object_storage_request.CreateLocationObjectStorageRequest]",
    ) -> AsyncOperationResponse[
        "capo_datasync.types.create_location_object_storage_response.CreateLocationObjectStorageResponse"
    ]:
        import capo_datasync._operations.fmrs_service.create_location_object_storage

        (
            output,
            http_response,
        ) = await capo_datasync._operations.fmrs_service.create_location_object_storage.async_create_location_object_storage(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_datasync.types.create_location_object_storage_request.CreateLocationObjectStorageRequest",
    ) -> dict[str, Any]:
        import capo_datasync.types.create_location_object_storage_request

        return capo_datasync.types.create_location_object_storage_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateLocationObjectStorage", redact_input=_redact_input),
    )
    input_: capo_datasync.types.create_location_object_storage_request.CreateLocationObjectStorageRequest = {
        "server_hostname": server_hostname,
        "bucket_name": bucket_name,
    }
    if server_port is not None:
        input_["server_port"] = server_port
    if server_protocol is not None:
        input_["server_protocol"] = server_protocol
    if subdirectory is not None:
        input_["subdirectory"] = subdirectory
    if access_key is not None:
        input_["access_key"] = access_key
    if secret_key is not None:
        input_["secret_key"] = secret_key
    if agent_arns is not None:
        input_["agent_arns"] = agent_arns
    if tags is not None:
        input_["tags"] = tags
    if server_certificate is not None:
        input_["server_certificate"] = server_certificate
    if cmk_secret_config is not None:
        input_["cmk_secret_config"] = cmk_secret_config
    if custom_secret_config is not None:
        input_["custom_secret_config"] = custom_secret_config

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output