createTapeWithBarcode method

Future<CreateTapeWithBarcodeOutput> createTapeWithBarcode({
  1. required String gatewayARN,
  2. required String tapeBarcode,
  3. required int tapeSizeInBytes,
  4. bool? kMSEncrypted,
  5. String? kMSKey,
  6. String? poolId,
  7. List<Tag>? tags,
  8. bool? worm,
})

Creates a virtual tape by using your own barcode. You write data to the virtual tape and then archive the tape. A barcode is unique and cannot be reused if it has already been used on a tape. This applies to barcodes used on deleted tapes. This operation is only supported in the tape gateway type.

May throw InvalidGatewayRequestException. May throw InternalServerError.

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

Parameter tapeBarcode : The barcode that you want to assign to the tape.

Parameter tapeSizeInBytes : The size, in bytes, of the virtual tape 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 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 that has a barcode. 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<CreateTapeWithBarcodeOutput> createTapeWithBarcode({
  required String gatewayARN,
  required String tapeBarcode,
  required int tapeSizeInBytes,
  bool? kMSEncrypted,
  String? kMSKey,
  String? poolId,
  List<Tag>? tags,
  bool? worm,
}) async {
  ArgumentError.checkNotNull(gatewayARN, 'gatewayARN');
  _s.validateStringLength(
    'gatewayARN',
    gatewayARN,
    50,
    500,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tapeBarcode, 'tapeBarcode');
  _s.validateStringLength(
    'tapeBarcode',
    tapeBarcode,
    7,
    16,
    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.CreateTapeWithBarcode'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'GatewayARN': gatewayARN,
      'TapeBarcode': tapeBarcode,
      '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 CreateTapeWithBarcodeOutput.fromJson(jsonResponse.body);
}