Skip to content

modify_serverless_cache

modify_serverless_cache(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    serverless_cache_name: Optional[String] = None,
    description: Optional[String] = None,
    cache_usage_limits: Optional[CacheUsageLimits] = None,
    remove_user_group: Optional[BooleanOptional] = None,
    user_group_id: Optional[String] = None,
    security_group_ids: Optional[SecurityGroupIdsList] = None,
    snapshot_retention_limit: Optional[IntegerOptional] = None,
    daily_snapshot_time: Optional[String] = None,
    engine: Optional[String] = None,
    major_engine_version: Optional[String] = None,
) -> ModifyServerlessCacheResponse

This API modifies the attributes of a serverless cache.

Parameters:

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

    User-provided identifier for the serverless cache to be modified.

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

    User provided description for the serverless cache. Default = NULL, i.e. the existing description is not removed/modified. The description has a maximum length of 255 characters.

  • cache_usage_limits (Optional[CacheUsageLimits], default: None ) –

    Modify the cache usage limit for the serverless cache.

  • remove_user_group (Optional[BooleanOptional], default: None ) –

    The identifier of the UserGroup to be removed from association with the Valkey and Redis OSS serverless cache. Available for Valkey and Redis OSS only. Default is NULL.

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

    The identifier of the UserGroup to be associated with the serverless cache. Available for Valkey and Redis OSS only. Default is NULL - the existing UserGroup is not removed.

  • security_group_ids (Optional[SecurityGroupIdsList], default: None ) –

    The new list of VPC security groups to be associated with the serverless cache. Populating this list means the current VPC security groups will be removed. This security group is used to authorize traffic access for the VPC end-point (private-link). Default = NULL - the existing list of VPC security groups is not removed.

  • snapshot_retention_limit (Optional[IntegerOptional], default: None ) –

    The number of days for which Elasticache retains automatic snapshots before deleting them. Available for Valkey, Redis OSS and Serverless Memcached only. Default = NULL, i.e. the existing snapshot-retention-limit will not be removed or modified. The maximum value allowed is 35 days.

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

    The daily time during which Elasticache begins taking a daily snapshot of the serverless cache. Available for Valkey, Redis OSS and Serverless Memcached only. The default is NULL, i.e. the existing snapshot time configured for the cluster is not removed.

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

    Modifies the engine listed in a serverless cache request. The options are valkey, memcached or redis.

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

    Modifies the engine vesion listed in a serverless cache request.

Raises:

Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def modify_serverless_cache(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    serverless_cache_name: Optional["capo_elasticache.types.string.String"] = None,
    description: Optional["capo_elasticache.types.string.String"] = None,
    cache_usage_limits: Optional[
        "capo_elasticache.types.cache_usage_limits.CacheUsageLimits"
    ] = None,
    remove_user_group: Optional[
        "capo_elasticache.types.boolean_optional.BooleanOptional"
    ] = None,
    user_group_id: Optional["capo_elasticache.types.string.String"] = None,
    security_group_ids: Optional[
        "capo_elasticache.types.security_group_ids_list.SecurityGroupIdsList"
    ] = None,
    snapshot_retention_limit: Optional[
        "capo_elasticache.types.integer_optional.IntegerOptional"
    ] = None,
    daily_snapshot_time: Optional["capo_elasticache.types.string.String"] = None,
    engine: Optional["capo_elasticache.types.string.String"] = None,
    major_engine_version: Optional["capo_elasticache.types.string.String"] = None,
) -> "capo_elasticache.types.modify_serverless_cache_response.ModifyServerlessCacheResponse":
    """<p>This API modifies the attributes of a serverless cache.</p>

    Args:
        serverless_cache_name: <p>User-provided identifier for the serverless cache to be modified.</p>
        description: <p>User provided description for the serverless cache. Default = NULL, i.e. the existing description is not removed/modified. The description has a maximum length of 255 characters.</p>
        cache_usage_limits: <p>Modify the cache usage limit for the serverless cache.</p>
        remove_user_group: <p>The identifier of the UserGroup to be removed from association with the Valkey and Redis OSS serverless cache. Available for Valkey and Redis OSS only. Default is NULL.</p>
        user_group_id: <p>The identifier of the UserGroup to be associated with the serverless cache. Available for Valkey and Redis OSS only. Default is NULL - the existing UserGroup is not removed.</p>
        security_group_ids: <p>The new list of VPC security groups to be associated with the serverless cache. Populating this list means the current VPC security groups will be removed. This security group is used to authorize traffic access for the VPC end-point (private-link). Default = NULL - the existing list of VPC security groups is not removed.</p>
        snapshot_retention_limit: <p>The number of days for which Elasticache retains automatic snapshots before deleting them. Available for Valkey, Redis OSS and Serverless Memcached only. Default = NULL, i.e. the existing snapshot-retention-limit will not be removed or modified. The maximum value allowed is 35 days.</p>
        daily_snapshot_time: <p>The daily time during which Elasticache begins taking a daily snapshot of the serverless cache. Available for Valkey, Redis OSS and Serverless Memcached only. The default is NULL, i.e. the existing snapshot time configured for the cluster is not removed.</p>
        engine: <p>Modifies the engine listed in a serverless cache request. The options are valkey, memcached or redis.</p>
        major_engine_version: <p>Modifies the engine vesion listed in a serverless cache request. </p>

    Raises:
        capo_elasticache.errors.invalid_credentials_exception.InvalidCredentialsException: <p>You must enter valid credentials.</p>
        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_state_fault.InvalidServerlessCacheStateFault: <p>The account for these credentials is not currently active.</p>
        capo_elasticache.errors.invalid_user_group_state_fault.InvalidUserGroupStateFault: <p>The user group is not in an active state.</p>
        capo_elasticache.errors.serverless_cache_not_found_fault.ServerlessCacheNotFoundFault: <p>The serverless cache was not found or does not exist.</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.user_group_not_found_fault.UserGroupNotFoundFault: <p>The user group was not found or does not exist</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elasticache.types.modify_serverless_cache_request.ModifyServerlessCacheRequest]",
    ) -> OperationResponse[
        "capo_elasticache.types.modify_serverless_cache_response.ModifyServerlessCacheResponse"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.modify_serverless_cache

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyServerlessCache")
    )
    input_: capo_elasticache.types.modify_serverless_cache_request.ModifyServerlessCacheRequest = {}
    if serverless_cache_name is not None:
        input_["serverless_cache_name"] = serverless_cache_name
    if description is not None:
        input_["description"] = description
    if cache_usage_limits is not None:
        input_["cache_usage_limits"] = cache_usage_limits
    if remove_user_group is not None:
        input_["remove_user_group"] = remove_user_group
    if user_group_id is not None:
        input_["user_group_id"] = user_group_id
    if security_group_ids is not None:
        input_["security_group_ids"] = security_group_ids
    if snapshot_retention_limit is not None:
        input_["snapshot_retention_limit"] = snapshot_retention_limit
    if daily_snapshot_time is not None:
        input_["daily_snapshot_time"] = daily_snapshot_time
    if engine is not None:
        input_["engine"] = engine
    if major_engine_version is not None:
        input_["major_engine_version"] = major_engine_version

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