Skip to content

copy_snapshot async

copy_snapshot(
    source_snapshot_name: String,
    target_snapshot_name: String,
    *,
    config_overrides: Optional[AsyncMemoryDBClientConfig] = None,
    target_bucket: Optional[TargetBucket] = None,
    kms_key_id: Optional[KmsKeyId] = None,
    tags: Optional[TagList] = None,
) -> CopySnapshotResponse

Makes a copy of an existing snapshot.

Parameters:

  • source_snapshot_name (String) –

    The name of an existing snapshot from which to make a copy.

  • target_snapshot_name (String) –

    A name for the snapshot copy. MemoryDB does not permit overwriting a snapshot, therefore this name must be unique within its context - MemoryDB or an Amazon S3 bucket if exporting.

  • target_bucket (Optional[TargetBucket], default: None ) –

    The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access. When using this parameter to export a snapshot, be sure MemoryDB has the needed permissions to this S3 bucket. For more information, see Step 2: Grant MemoryDB Access to Your Amazon S3 Bucket.

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

    The ID of the KMS key used to encrypt the target snapshot.

  • tags (Optional[TagList], default: None ) –

    A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.

Raises:

Source code in docs_src/capo_memorydb/_services/async_memory_db.py
async def copy_snapshot(
    self,
    source_snapshot_name: "capo_memorydb.types.string.String",
    target_snapshot_name: "capo_memorydb.types.string.String",
    *,
    config_overrides: Optional[AsyncMemoryDBClientConfig] = None,
    target_bucket: Optional[
        "capo_memorydb.types.target_bucket.TargetBucket"
    ] = None,
    kms_key_id: Optional["capo_memorydb.types.kms_key_id.KmsKeyId"] = None,
    tags: Optional["capo_memorydb.types.tag_list.TagList"] = None,
) -> "capo_memorydb.types.copy_snapshot_response.CopySnapshotResponse":
    """<p>Makes a copy of an existing snapshot.</p>

    Args:
        source_snapshot_name: <p>The name of an existing snapshot from which to make a copy.</p>
        target_snapshot_name: <p>A name for the snapshot copy. MemoryDB does not permit overwriting a snapshot, therefore this name must be unique within its context - MemoryDB or an Amazon S3 bucket if exporting.</p>
        target_bucket: <p>The Amazon S3 bucket to which the snapshot is exported. This parameter is used only when exporting a snapshot for external access. When using this parameter to export a snapshot, be sure MemoryDB has the needed permissions to this S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/MemoryDB/latest/devguide/snapshots-exporting.html">Step 2: Grant MemoryDB Access to Your Amazon S3 Bucket</a>. </p>
        kms_key_id: <p>The ID of the KMS key used to encrypt the target snapshot.</p>
        tags: <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>

    Raises:
        capo_memorydb.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>The specified parameter combination is not valid.</p>
        capo_memorydb.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The specified parameter value is not valid.</p>
        capo_memorydb.errors.invalid_snapshot_state_fault.InvalidSnapshotStateFault: <p>The snapshot is not in a valid state for the requested operation.</p>
        capo_memorydb.errors.service_linked_role_not_found_fault.ServiceLinkedRoleNotFoundFault: <p>The required service-linked role was not found.</p>
        capo_memorydb.errors.snapshot_already_exists_fault.SnapshotAlreadyExistsFault: <p>A snapshot with the specified name already exists.</p>
        capo_memorydb.errors.snapshot_not_found_fault.SnapshotNotFoundFault: <p>The specified snapshot does not exist.</p>
        capo_memorydb.errors.snapshot_quota_exceeded_fault.SnapshotQuotaExceededFault: <p>The request cannot be processed because it would exceed the maximum number of snapshots allowed.</p>
        capo_memorydb.errors.tag_quota_per_resource_exceeded.TagQuotaPerResourceExceeded: <p>The request cannot be processed because it would exceed the maximum number of tags allowed per resource.</p>
        capo_memorydb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_memorydb.types.copy_snapshot_request.CopySnapshotRequest]",
    ) -> AsyncOperationResponse[
        "capo_memorydb.types.copy_snapshot_response.CopySnapshotResponse"
    ]:
        import capo_memorydb._operations.amazon_memory_db.copy_snapshot

        (
            output,
            http_response,
        ) = await capo_memorydb._operations.amazon_memory_db.copy_snapshot.async_copy_snapshot(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CopySnapshot")
    )
    input_: capo_memorydb.types.copy_snapshot_request.CopySnapshotRequest = {
        "source_snapshot_name": source_snapshot_name,
        "target_snapshot_name": target_snapshot_name,
    }
    if target_bucket is not None:
        input_["target_bucket"] = target_bucket
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output