createTapes method

Future<CreateTapesOutput> createTapes({
  1. required String clientToken,
  2. required String gatewayARN,
  3. required int numTapesToCreate,
  4. required String tapeBarcodePrefix,
  5. required int tapeSizeInBytes,
  6. bool? kMSEncrypted,
  7. String? kMSKey,
  8. String? poolId,
  9. List<Tag>? tags,
  10. bool? worm,
})

Creates one or more virtual tapes. You write data to the virtual tapes and then archive the tapes. This operation is only supported in the tape gateway type.

May throw InvalidGatewayRequestException. May throw InternalServerError.

Parameter clientToken : A unique identifier that you use to retry a request. If you retry a request, use the same ClientToken you specified in the initial request.

Parameter gatewayARN : The unique Amazon Resource Name (ARN) that represents the gateway to associate the virtual tapes with. Use the ListGateways operation to return a list of gateways for your account and AWS Region.

Parameter numTapesToCreate : The number of virtual tapes that you want to create.

Parameter tapeBarcodePrefix : A prefix that you append to the barcode of the virtual tape you are creating. This prefix makes the barcode unique.

Parameter tapeSizeInBytes : The size, in bytes, of the virtual tapes that you want to create.

Parameter kMSEncrypted : Set to true to use Amazon S3 server-side encryption with your own AWS KMS key, or false to use a key managed by Amazon S3. Optional.

Valid Values: true | false

Parameter kMSKey : The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for Amazon S3 server-side encryption. Storage Gateway does not support asymmetric CMKs. This value can only be set when KMSEncrypted is true. Optional.

Parameter poolId : The ID of the pool that you want to add your tape to for archiving. The tape in this pool is archived in the S3 storage class that is associated with the pool. When you use your backup application to eject the tape, the tape is archived directly into the storage class (S3 Glacier or S3 Glacier Deep Archive) that corresponds to the pool.

Valid Values: GLACIER | DEEP_ARCHIVE

Parameter tags : A list of up to 50 tags that can be assigned to a virtual tape. Each tag is a key-value pair.

Parameter worm : Set to TRUE if the tape you are creating is to be configured as a write-once-read-many (WORM) tape.

Implementation

Future<CreateTapesOutput> createTapes({
  required String clientToken,
  required String gatewayARN,
  required int numTapesToCreate,
  required String tapeBarcodePrefix,
  required int tapeSizeInBytes,
  bool? kMSEncrypted,
  String? kMSKey,
  String? poolId,
  List<Tag>? tags,
  bool? worm,
}) async {
  ArgumentError.checkNotNull(clientToken, 'clientToken');
  _s.validateStringLength(
    'clientToken',
    clientToken,
    5,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(gatewayARN, 'gatewayARN');
  _s.validateStringLength(
    'gatewayARN',
    gatewayARN,
    50,
    500,
    isRequired: true,
  );
  ArgumentError.checkNotNull(numTapesToCreate, 'numTapesToCreate');
  _s.validateNumRange(
    'numTapesToCreate',
    numTapesToCreate,
    1,
    10,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tapeBarcodePrefix, 'tapeBarcodePrefix');
  _s.validateStringLength(
    'tapeBarcodePrefix',
    tapeBarcodePrefix,
    1,
    4,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tapeSizeInBytes, 'tapeSizeInBytes');
  _s.validateStringLength(
    'kMSKey',
    kMSKey,
    7,
    2048,
  );
  _s.validateStringLength(
    'poolId',
    poolId,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StorageGateway_20130630.CreateTapes'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClientToken': clientToken,
      'GatewayARN': gatewayARN,
      'NumTapesToCreate': numTapesToCreate,
      'TapeBarcodePrefix': tapeBarcodePrefix,
      'TapeSizeInBytes': tapeSizeInBytes,
      if (kMSEncrypted != null) 'KMSEncrypted': kMSEncrypted,
      if (kMSKey != null) 'KMSKey': kMSKey,
      if (poolId != null) 'PoolId': poolId,
      if (tags != null) 'Tags': tags,
      if (worm != null) 'Worm': worm,
    },
  );

  return CreateTapesOutput.fromJson(jsonResponse.body);
}