createLocationAzureBlob method

Future<CreateLocationAzureBlobResponse> createLocationAzureBlob({
  1. required AzureBlobAuthenticationType authenticationType,
  2. required String containerUrl,
  3. AzureAccessTier? accessTier,
  4. List<String>? agentArns,
  5. AzureBlobType? blobType,
  6. CmkSecretConfig? cmkSecretConfig,
  7. CustomSecretConfig? customSecretConfig,
  8. AzureBlobSasConfiguration? sasConfiguration,
  9. String? subdirectory,
  10. List<TagListEntry>? tags,
})

Creates a transfer location for a Microsoft Azure Blob Storage container. DataSync can use this location as a transfer source or destination. You can make transfers with or without a DataSync agent that connects to your container.

Before you begin, make sure you know how DataSync accesses Azure Blob Storage and works with access tiers and blob types.

May throw InternalException. May throw InvalidRequestException.

Parameter authenticationType : Specifies the authentication method DataSync uses to access your Azure Blob Storage. DataSync can access blob storage using a shared access signature (SAS).

Parameter containerUrl : Specifies the URL of the Azure Blob Storage container involved in your transfer.

Parameter accessTier : Specifies the access tier that you want your objects or files transferred into. This only applies when using the location as a transfer destination. For more information, see Access tiers.

Parameter agentArns : (Optional) Specifies the Amazon Resource Name (ARN) of the DataSync agent that can connect with your Azure Blob Storage container. If you are setting up an agentless cross-cloud transfer, you do not need to specify a value for this parameter.

You can specify more than one agent. For more information, see Using multiple agents for your transfer.

Parameter blobType : Specifies the type of blob that you want your objects or files to be when transferring them into Azure Blob Storage. Currently, DataSync only supports moving data into Azure Blob Storage as block blobs. For more information on blob types, see the Azure Blob Storage documentation.

Parameter cmkSecretConfig : Specifies configuration information for a DataSync-managed secret, which includes the authentication token that DataSync uses to access a specific AzureBlob storage location, with a customer-managed KMS key.

When you include this parameter as part of a CreateLocationAzureBlob request, you provide only the KMS key ARN. DataSync uses this KMS key together with the authentication token you specify for SasConfiguration 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.

Parameter customSecretConfig : Specifies configuration information for a customer-managed Secrets Manager secret where the authentication token for an AzureBlob 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.

Parameter sasConfiguration : Specifies the SAS configuration that allows DataSync to access your Azure Blob Storage.

Parameter subdirectory : Specifies path segments if you want to limit your transfer to a virtual directory in your container (for example, /my/images).

Parameter tags : Specifies labels that help you categorize, filter, and search for your Amazon Web Services resources. We recommend creating at least a name tag for your transfer location.

Implementation

Future<CreateLocationAzureBlobResponse> createLocationAzureBlob({
  required AzureBlobAuthenticationType authenticationType,
  required String containerUrl,
  AzureAccessTier? accessTier,
  List<String>? agentArns,
  AzureBlobType? blobType,
  CmkSecretConfig? cmkSecretConfig,
  CustomSecretConfig? customSecretConfig,
  AzureBlobSasConfiguration? sasConfiguration,
  String? subdirectory,
  List<TagListEntry>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'FmrsService.CreateLocationAzureBlob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AuthenticationType': authenticationType.value,
      'ContainerUrl': containerUrl,
      if (accessTier != null) 'AccessTier': accessTier.value,
      if (agentArns != null) 'AgentArns': agentArns,
      if (blobType != null) 'BlobType': blobType.value,
      if (cmkSecretConfig != null) 'CmkSecretConfig': cmkSecretConfig,
      if (customSecretConfig != null)
        'CustomSecretConfig': customSecretConfig,
      if (sasConfiguration != null) 'SasConfiguration': sasConfiguration,
      if (subdirectory != null) 'Subdirectory': subdirectory,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateLocationAzureBlobResponse.fromJson(jsonResponse.body);
}