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 an encrypted symmetric key from Key Management Service (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 DependentServiceRequestThrottlingFault. May throw InvalidTagFault. May throw LimitExceededFault. May throw SnapshotCopyGrantAlreadyExistsFault. May throw SnapshotCopyGrantQuotaExceededFault. May throw TagLimitExceededFault.

Parameter snapshotCopyGrantName : The name of the snapshot copy grant. This name must be unique in the region for the Amazon Web Services 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 Amazon Web Services account.

Parameter kmsKeyId : The unique identifier of the encrypted symmetric key 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 {
  final $request = <String, String>{
    'SnapshotCopyGrantName': snapshotCopyGrantName,
    if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
    if (tags != null)
      if (tags.isEmpty)
        'Tags': ''
      else
        for (var i1 = 0; i1 < tags.length; i1++)
          for (var e3 in tags[i1].toQueryMap().entries)
            'Tags.Tag.${i1 + 1}.${e3.key}': e3.value,
  };
  final $result = await _protocol.send(
    $request,
    action: 'CreateSnapshotCopyGrant',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateSnapshotCopyGrantResult',
  );
  return CreateSnapshotCopyGrantResult.fromXml($result);
}