Skip to content

restore_from_snapshot

restore_from_snapshot(
    namespace_name: NamespaceName,
    workgroup_name: WorkgroupName,
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
    snapshot_name: Optional[str] = None,
    snapshot_arn: Optional[str] = None,
    owner_account: Optional[str] = None,
    manage_admin_password: Optional[bool] = None,
    admin_password_secret_kms_key_id: Optional[KmsKeyId] = None,
    maintain_integration: Optional[bool] = None,
) -> RestoreFromSnapshotResponse

Restores a namespace from a snapshot.

Parameters:

  • namespace_name (NamespaceName) –

    The name of the namespace to restore the snapshot to.

  • workgroup_name (WorkgroupName) –

    The name of the workgroup used to restore the snapshot.

  • snapshot_name (Optional[str], default: None ) –

    The name of the snapshot to restore from. Must not be specified at the same time as snapshotArn.

  • snapshot_arn (Optional[str], default: None ) –

    The Amazon Resource Name (ARN) of the snapshot to restore from. Required if restoring from a provisioned cluster to Amazon Redshift Serverless. Must not be specified at the same time as snapshotName.

    The format of the ARN is arn:aws:redshift:<region>:<account_id>:snapshot:<cluster_identifier>/<snapshot_identifier>.

  • owner_account (Optional[str], default: None ) –

    The Amazon Web Services account that owns the snapshot.

  • manage_admin_password (Optional[bool], default: None ) –

    If true, Amazon Redshift uses Secrets Manager to manage the restored snapshot's admin credentials. If MmanageAdminPassword is false or not set, Amazon Redshift uses the admin credentials that the namespace or cluster had at the time the snapshot was taken.

  • admin_password_secret_kms_key_id (Optional[KmsKeyId], default: None ) –

    The ID of the Key Management Service (KMS) key used to encrypt and store the namespace's admin credentials secret.

  • maintain_integration (Optional[bool], default: None ) –

    If true, maintain existing data sharing, zero-ETL and S3 event integrations when restoring. Otherwise, integrations will not be maintained after the restore operation. Integrations are only maintained when restored to the same serverless namespace.

    Default: true

Raises:

Source code in docs_src/capo_redshift_serverless/_services/redshift_serverless.py
def restore_from_snapshot(
    self,
    namespace_name: "capo_redshift_serverless.types.namespace_name.NamespaceName",
    workgroup_name: "capo_redshift_serverless.types.workgroup_name.WorkgroupName",
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
    snapshot_name: Optional[str] = None,
    snapshot_arn: Optional[str] = None,
    owner_account: Optional[str] = None,
    manage_admin_password: Optional[bool] = None,
    admin_password_secret_kms_key_id: Optional[
        "capo_redshift_serverless.types.kms_key_id.KmsKeyId"
    ] = None,
    maintain_integration: Optional[bool] = None,
) -> "capo_redshift_serverless.types.restore_from_snapshot_response.RestoreFromSnapshotResponse":
    """<p>Restores a namespace from a snapshot.</p>

    Args:
        namespace_name: <p>The name of the namespace to restore the snapshot to.</p>
        workgroup_name: <p>The name of the workgroup used to restore the snapshot.</p>
        snapshot_name: <p>The name of the snapshot to restore from. Must not be specified at the same time as <code>snapshotArn</code>.</p>
        snapshot_arn: <p>The Amazon Resource Name (ARN) of the snapshot to restore from. Required if restoring from a provisioned cluster to Amazon Redshift Serverless. Must not be specified at the same time as <code>snapshotName</code>.</p> <p>The format of the ARN is arn:aws:redshift:&lt;region&gt;:&lt;account_id&gt;:snapshot:&lt;cluster_identifier&gt;/&lt;snapshot_identifier&gt;.</p>
        owner_account: <p>The Amazon Web Services account that owns the snapshot.</p>
        manage_admin_password: <p>If <code>true</code>, Amazon Redshift uses Secrets Manager to manage the restored snapshot's admin credentials. If <code>MmanageAdminPassword</code> is false or not set, Amazon Redshift uses the admin credentials that the namespace or cluster had at the time the snapshot was taken.</p>
        admin_password_secret_kms_key_id: <p>The ID of the Key Management Service (KMS) key used to encrypt and store the namespace's admin credentials secret.</p>
        maintain_integration: <p>If <code>true</code>, maintain existing data sharing, zero-ETL and S3 event integrations when restoring. Otherwise, integrations will not be maintained after the restore operation. Integrations are only maintained when restored to the same serverless namespace.</p> <p>Default: true</p>

    Raises:
        capo_redshift_serverless.errors.conflict_exception.ConflictException: <p>The submitted action has conflicts.</p>
        capo_redshift_serverless.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_redshift_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_redshift_serverless.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service limit was exceeded.</p>
        capo_redshift_serverless.errors.validation_exception.ValidationException: <p>The input failed to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_redshift_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_redshift_serverless.types.restore_from_snapshot_request.RestoreFromSnapshotRequest]",
    ) -> OperationResponse[
        "capo_redshift_serverless.types.restore_from_snapshot_response.RestoreFromSnapshotResponse"
    ]:
        import capo_redshift_serverless._operations.redshift_serverless.restore_from_snapshot

        output, http_response = (
            capo_redshift_serverless._operations.redshift_serverless.restore_from_snapshot.restore_from_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_redshift_serverless.types.restore_from_snapshot_response.RestoreFromSnapshotResponse",
    ) -> dict[str, Any]:
        import capo_redshift_serverless.types.restore_from_snapshot_response

        return capo_redshift_serverless.types.restore_from_snapshot_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("RestoreFromSnapshot", redact_output=_redact_output),
    )
    input_: capo_redshift_serverless.types.restore_from_snapshot_request.RestoreFromSnapshotRequest = {
        "namespace_name": namespace_name,
        "workgroup_name": workgroup_name,
    }
    if snapshot_name is not None:
        input_["snapshot_name"] = snapshot_name
    if snapshot_arn is not None:
        input_["snapshot_arn"] = snapshot_arn
    if owner_account is not None:
        input_["owner_account"] = owner_account
    if manage_admin_password is not None:
        input_["manage_admin_password"] = manage_admin_password
    if admin_password_secret_kms_key_id is not None:
        input_["admin_password_secret_kms_key_id"] = (
            admin_password_secret_kms_key_id
        )
    if maintain_integration is not None:
        input_["maintain_integration"] = maintain_integration

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output