createTapePool method

Future<CreateTapePoolOutput> createTapePool({
  1. required String poolName,
  2. required TapeStorageClass storageClass,
  3. int? retentionLockTimeInDays,
  4. RetentionLockType? retentionLockType,
  5. List<Tag>? tags,
})

Creates a new custom tape pool. You can use custom tape pool to enable tape retention lock on tapes that are archived in the custom pool.

May throw InvalidGatewayRequestException. May throw InternalServerError.

Parameter poolName : The name of the new custom tape pool.

Parameter storageClass : The storage class that is associated with the new custom 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.

Parameter retentionLockTimeInDays : Tape retention lock time is set in days. Tape retention lock can be enabled for up to 100 years (36,500 days).

Parameter retentionLockType : Tape retention lock can be configured in two modes. When configured in governance mode, AWS accounts with specific IAM permissions are authorized to remove the tape retention lock from archived virtual tapes. When configured in compliance mode, the tape retention lock cannot be removed by any user, including the root AWS account.

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

Implementation

Future<CreateTapePoolOutput> createTapePool({
  required String poolName,
  required TapeStorageClass storageClass,
  int? retentionLockTimeInDays,
  RetentionLockType? retentionLockType,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(poolName, 'poolName');
  _s.validateStringLength(
    'poolName',
    poolName,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(storageClass, 'storageClass');
  _s.validateNumRange(
    'retentionLockTimeInDays',
    retentionLockTimeInDays,
    0,
    36500,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StorageGateway_20130630.CreateTapePool'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'PoolName': poolName,
      'StorageClass': storageClass.toValue(),
      if (retentionLockTimeInDays != null)
        'RetentionLockTimeInDays': retentionLockTimeInDays,
      if (retentionLockType != null)
        'RetentionLockType': retentionLockType.toValue(),
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateTapePoolOutput.fromJson(jsonResponse.body);
}