Skip to content

modify_cache_subnet_group

modify_cache_subnet_group(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    cache_subnet_group_name: Optional[String] = None,
    cache_subnet_group_description: Optional[String] = None,
    subnet_ids: Optional[SubnetIdentifierList] = None,
) -> ModifyCacheSubnetGroupResult

Modifies an existing cache subnet group.

Parameters:

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

    The name for the cache subnet group. This value is stored as a lowercase string.

    Constraints: Must contain no more than 255 alphanumeric characters or hyphens.

    Example: mysubnetgroup

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

    A description of the cache subnet group.

  • subnet_ids (Optional[SubnetIdentifierList], default: None ) –

    The EC2 subnet IDs for the cache subnet group.

Raises:

  • CacheSubnetGroupNotFoundFault –

    The requested cache subnet group name does not refer to an existing cache subnet group.

  • CacheSubnetQuotaExceededFault –

    The request cannot be processed because it would exceed the allowed number of subnets in a cache subnet group.

  • InvalidSubnet –

    An invalid subnet identifier was specified.

  • SubnetInUse –

    The requested subnet is being used by another cache subnet group.

  • SubnetNotAllowedFault –

    At least one subnet ID does not match the other subnet IDs. This mismatch typically occurs when a user sets one subnet ID to a regional Availability Zone and a different one to an outpost. Or when a user sets the subnet ID to an Outpost when not subscribed on this service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

ModifyCacheSubnetGroup Modifies an existing ElastiCache subnet group.

>>> client.modify_cache_subnet_group(cache_subnet_group_name='my-sn-grp', subnet_ids=['subnet-bcde2345'])
Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def modify_cache_subnet_group(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    cache_subnet_group_name: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
    cache_subnet_group_description: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
    subnet_ids: Optional[
        "capo_elasticache.types.subnet_identifier_list.SubnetIdentifierList"
    ] = None,
) -> "capo_elasticache.types.modify_cache_subnet_group_result.ModifyCacheSubnetGroupResult":
    """<p>Modifies an existing cache subnet group.</p>

    Args:
        cache_subnet_group_name: <p>The name for the cache subnet group. This value is stored as a lowercase string.</p> <p>Constraints: Must contain no more than 255 alphanumeric characters or hyphens.</p> <p>Example: <code>mysubnetgroup</code> </p>
        cache_subnet_group_description: <p>A description of the cache subnet group.</p>
        subnet_ids: <p>The EC2 subnet IDs for the cache subnet group.</p>

    Raises:
        capo_elasticache.errors.cache_subnet_group_not_found_fault.CacheSubnetGroupNotFoundFault: <p>The requested cache subnet group name does not refer to an existing cache subnet group.</p>
        capo_elasticache.errors.cache_subnet_quota_exceeded_fault.CacheSubnetQuotaExceededFault: <p>The request cannot be processed because it would exceed the allowed number of subnets in a cache subnet group.</p>
        capo_elasticache.errors.invalid_subnet.InvalidSubnet: <p>An invalid subnet identifier was specified.</p>
        capo_elasticache.errors.subnet_in_use.SubnetInUse: <p>The requested subnet is being used by another cache subnet group.</p>
        capo_elasticache.errors.subnet_not_allowed_fault.SubnetNotAllowedFault: <p>At least one subnet ID does not match the other subnet IDs. This mismatch typically occurs when a user sets one subnet ID to a regional Availability Zone and a different one to an outpost. Or when a user sets the subnet ID to an Outpost when not subscribed on this service.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        ModifyCacheSubnetGroup
        Modifies an existing ElastiCache subnet group.

        >>> client.modify_cache_subnet_group(cache_subnet_group_name='my-sn-grp', subnet_ids=['subnet-bcde2345'])
    """

    def _handler(
        req: "OperationRequest[capo_elasticache.types.modify_cache_subnet_group_message.ModifyCacheSubnetGroupMessage]",
    ) -> OperationResponse[
        "capo_elasticache.types.modify_cache_subnet_group_result.ModifyCacheSubnetGroupResult"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.modify_cache_subnet_group

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyCacheSubnetGroup")
    )
    input_: capo_elasticache.types.modify_cache_subnet_group_message.ModifyCacheSubnetGroupMessage = {}
    if cache_subnet_group_name is not None:
        input_["cache_subnet_group_name"] = cache_subnet_group_name
    if cache_subnet_group_description is not None:
        input_["cache_subnet_group_description"] = cache_subnet_group_description
    if subnet_ids is not None:
        input_["subnet_ids"] = subnet_ids

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