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.
Parameters:
-
snapshot_copy_grant_name
(Optional[String], default:
None
)
–
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.
-
kms_key_id
(Optional[String], default:
None
)
–
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.
-
tags
(Optional[TagList], default:
None
)
–
Raises:
Source code in docs_src/capo_redshift/_services/redshift.py
| def create_snapshot_copy_grant(
self,
*,
config_overrides: Optional[RedshiftClientConfig] = None,
snapshot_copy_grant_name: Optional["capo_redshift.types.string.String"] = None,
kms_key_id: Optional["capo_redshift.types.string.String"] = None,
tags: Optional["capo_redshift.types.tag_list.TagList"] = None,
) -> "capo_redshift.types.create_snapshot_copy_grant_result.CreateSnapshotCopyGrantResult":
"""<p>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.</p> <p> For more information about managing snapshot copy grants, go to <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-db-encryption.html">Amazon Redshift Database Encryption</a> in the <i>Amazon Redshift Cluster Management Guide</i>. </p>
Args:
snapshot_copy_grant_name: <p>The name of the snapshot copy grant. This name must be unique in the region for the Amazon Web Services account.</p> <p>Constraints:</p> <ul> <li> <p>Must contain from 1 to 63 alphanumeric characters or hyphens.</p> </li> <li> <p>Alphabetic characters must be lowercase.</p> </li> <li> <p>First character must be a letter.</p> </li> <li> <p>Cannot end with a hyphen or contain two consecutive hyphens.</p> </li> <li> <p>Must be unique for all clusters within an Amazon Web Services account.</p> </li> </ul>
kms_key_id: <p>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.</p>
tags: <p>A list of tag instances.</p>
Raises:
capo_redshift.errors.dependent_service_request_throttling_fault.DependentServiceRequestThrottlingFault: <p>The request cannot be completed because a dependent service is throttling requests made by Amazon Redshift on your behalf. Wait and retry the request.</p>
capo_redshift.errors.invalid_tag_fault.InvalidTagFault: <p>The tag is invalid.</p>
capo_redshift.errors.limit_exceeded_fault.LimitExceededFault: <p>The encryption key has exceeded its grant limit in Amazon Web Services KMS.</p>
capo_redshift.errors.snapshot_copy_grant_already_exists_fault.SnapshotCopyGrantAlreadyExistsFault: <p>The snapshot copy grant can't be created because a grant with the same name already exists.</p>
capo_redshift.errors.snapshot_copy_grant_quota_exceeded_fault.SnapshotCopyGrantQuotaExceededFault: <p>The Amazon Web Services account has exceeded the maximum number of snapshot copy grants in this region.</p>
capo_redshift.errors.tag_limit_exceeded_fault.TagLimitExceededFault: <p>You have exceeded the number of tags allowed.</p>
capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_redshift.types.create_snapshot_copy_grant_message.CreateSnapshotCopyGrantMessage]",
) -> OperationResponse[
"capo_redshift.types.create_snapshot_copy_grant_result.CreateSnapshotCopyGrantResult"
]:
import capo_redshift._operations.redshift_service_version20121201.create_snapshot_copy_grant
output, http_response = (
capo_redshift._operations.redshift_service_version20121201.create_snapshot_copy_grant.create_snapshot_copy_grant(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateSnapshotCopyGrant")
)
input_: capo_redshift.types.create_snapshot_copy_grant_message.CreateSnapshotCopyGrantMessage = {}
if snapshot_copy_grant_name is not None:
input_["snapshot_copy_grant_name"] = snapshot_copy_grant_name
if kms_key_id is not None:
input_["kms_key_id"] = kms_key_id
if tags is not None:
input_["tags"] = tags
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|