Skip to content

copy_serverless_cache_snapshot

copy_serverless_cache_snapshot(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    source_serverless_cache_snapshot_name: Optional[String] = None,
    target_serverless_cache_snapshot_name: Optional[String] = None,
    kms_key_id: Optional[String] = None,
    tags: Optional[TagList] = None,
) -> CopyServerlessCacheSnapshotResponse

Creates a copy of an existing serverless cache’s snapshot. Available for Valkey, Redis OSS and Serverless Memcached only.

Parameters:

  • source_serverless_cache_snapshot_name (Optional[String], default: None ) –

    The identifier of the existing serverless cache’s snapshot to be copied. Available for Valkey, Redis OSS and Serverless Memcached only.

  • target_serverless_cache_snapshot_name (Optional[String], default: None ) –

    The identifier for the snapshot to be created. Available for Valkey, Redis OSS and Serverless Memcached only. This value is stored as a lowercase string.

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

    The identifier of the KMS key used to encrypt the target snapshot. Available for Valkey, Redis OSS and Serverless Memcached only.

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

    A list of tags to be added to the target snapshot resource. A tag is a key-value pair. Available for Valkey, Redis OSS and Serverless Memcached only. Default: NULL

Raises:

Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def copy_serverless_cache_snapshot(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    source_serverless_cache_snapshot_name: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
    target_serverless_cache_snapshot_name: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
    kms_key_id: Optional["capo_elasticache.types.string.String"] = None,
    tags: Optional["capo_elasticache.types.tag_list.TagList"] = None,
) -> "capo_elasticache.types.copy_serverless_cache_snapshot_response.CopyServerlessCacheSnapshotResponse":
    """<p>Creates a copy of an existing serverless cache’s snapshot. Available for Valkey, Redis OSS and Serverless Memcached only.</p>

    Args:
        source_serverless_cache_snapshot_name: <p>The identifier of the existing serverless cache’s snapshot to be copied. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        target_serverless_cache_snapshot_name: <p>The identifier for the snapshot to be created. Available for Valkey, Redis OSS and Serverless Memcached only. This value is stored as a lowercase string.</p>
        kms_key_id: <p>The identifier of the KMS key used to encrypt the target snapshot. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        tags: <p>A list of tags to be added to the target snapshot resource. A tag is a key-value pair. Available for Valkey, Redis OSS and Serverless Memcached only. Default: NULL</p>

    Raises:
        capo_elasticache.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Two or more incompatible parameters were specified.</p>
        capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
        capo_elasticache.errors.invalid_serverless_cache_snapshot_state_fault.InvalidServerlessCacheSnapshotStateFault: <p>The state of the serverless cache snapshot was not received. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        capo_elasticache.errors.serverless_cache_snapshot_already_exists_fault.ServerlessCacheSnapshotAlreadyExistsFault: <p>A serverless cache snapshot with this name already exists. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        capo_elasticache.errors.serverless_cache_snapshot_not_found_fault.ServerlessCacheSnapshotNotFoundFault: <p>This serverless cache snapshot could not be found or does not exist. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        capo_elasticache.errors.serverless_cache_snapshot_quota_exceeded_fault.ServerlessCacheSnapshotQuotaExceededFault: <p>The number of serverless cache snapshots exceeds the customer snapshot quota. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        capo_elasticache.errors.service_linked_role_not_found_fault.ServiceLinkedRoleNotFoundFault: <p>The specified service linked role (SLR) was not found.</p>
        capo_elasticache.errors.tag_quota_per_resource_exceeded.TagQuotaPerResourceExceeded: <p>The request cannot be processed because it would cause the resource to have more than the allowed number of tags. The maximum number of tags permitted on a resource is 50.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elasticache.types.copy_serverless_cache_snapshot_request.CopyServerlessCacheSnapshotRequest]",
    ) -> OperationResponse[
        "capo_elasticache.types.copy_serverless_cache_snapshot_response.CopyServerlessCacheSnapshotResponse"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.copy_serverless_cache_snapshot

        output, http_response = (
            capo_elasticache._operations.amazon_elasti_cache_v9.copy_serverless_cache_snapshot.copy_serverless_cache_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CopyServerlessCacheSnapshot")
    )
    input_: capo_elasticache.types.copy_serverless_cache_snapshot_request.CopyServerlessCacheSnapshotRequest = {}
    if source_serverless_cache_snapshot_name is not None:
        input_["source_serverless_cache_snapshot_name"] = (
            source_serverless_cache_snapshot_name
        )
    if target_serverless_cache_snapshot_name is not None:
        input_["target_serverless_cache_snapshot_name"] = (
            target_serverless_cache_snapshot_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