createSnapshotCopyGrant method

Future<CreateSnapshotCopyGrantResult> createSnapshotCopyGrant({
  1. required String snapshotCopyGrantName,
  2. String? kmsKeyId,
  3. List<Tag>? tags,
})

Creates a snapshot copy grant that permits Amazon Redshift to use a customer master key (CMK) from AWS Key Management Service (AWS KMS) to encrypt copied snapshots in a destination region.

For more information about managing snapshot copy grants, go to Amazon Redshift Database Encryption in the Amazon Redshift Cluster Management Guide.

May throw SnapshotCopyGrantAlreadyExistsFault. May throw SnapshotCopyGrantQuotaExceededFault. May throw LimitExceededFault. May throw TagLimitExceededFault. May throw InvalidTagFault. May throw DependentServiceRequestThrottlingFault.

Parameter snapshotCopyGrantName : The name of the snapshot copy grant. This name must be unique in the region for the AWS account.

Constraints:

  • Must contain from 1 to 63 alphanumeric characters or hyphens.
  • Alphabetic characters must be lowercase.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.
  • Must be unique for all clusters within an AWS account.

Parameter kmsKeyId : The unique identifier of the customer master key (CMK) to which to grant Amazon Redshift permission. If no key is specified, the default key is used.

Parameter tags : A list of tag instances.

Implementation

Future<CreateSnapshotCopyGrantResult> createSnapshotCopyGrant({
  required String snapshotCopyGrantName,
  String? kmsKeyId,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(snapshotCopyGrantName, 'snapshotCopyGrantName');
  _s.validateStringLength(
    'snapshotCopyGrantName',
    snapshotCopyGrantName,
    0,
    2147483647,
    isRequired: true,
  );
  _s.validateStringLength(
    'kmsKeyId',
    kmsKeyId,
    0,
    2147483647,
  );
  final $request = <String, dynamic>{};
  $request['SnapshotCopyGrantName'] = snapshotCopyGrantName;
  kmsKeyId?.also((arg) => $request['KmsKeyId'] = arg);
  tags?.also((arg) => $request['Tags'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'CreateSnapshotCopyGrant',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CreateSnapshotCopyGrantMessage'],
    shapes: shapes,
    resultWrapper: 'CreateSnapshotCopyGrantResult',
  );
  return CreateSnapshotCopyGrantResult.fromXml($result);
}