Skip to content

authorize_cache_security_group_ingress async

authorize_cache_security_group_ingress(
    *,
    config_overrides: Optional[AsyncElastiCacheClientConfig] = None,
    cache_security_group_name: Optional[String] = None,
    ec2_security_group_name: Optional[String] = None,
    ec2_security_group_owner_id: Optional[String] = None,
) -> AuthorizeCacheSecurityGroupIngressResult

Allows network ingress to a cache security group. Applications using ElastiCache must be running on Amazon EC2, and Amazon EC2 security groups are used as the authorization mechanism.

You cannot authorize ingress from an Amazon EC2 security group in one region to an ElastiCache cluster in another region.

Parameters:

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

    The cache security group that allows network ingress.

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

    The Amazon EC2 security group to be authorized for ingress to the cache security group.

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

    The Amazon account number of the Amazon EC2 security group owner. Note that this is not the same thing as an Amazon access key ID - you must provide a valid Amazon account number for this parameter.

Raises:

Examples:

AuthorizeCacheCacheSecurityGroupIngress Allows network ingress to a cache security group. Applications using ElastiCache must be running on Amazon EC2. Amazon EC2 security groups are used as the authorization mechanism.

>>> await client.authorize_cache_security_group_ingress(cache_security_group_name='my-sec-grp', ec2_security_group_name='my-ec2-sec-grp', ec2_security_group_owner_id='1234567890')
Source code in docs_src/capo_elasticache/_services/async_elasti_cache.py
async def authorize_cache_security_group_ingress(
    self,
    *,
    config_overrides: Optional[AsyncElastiCacheClientConfig] = None,
    cache_security_group_name: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
    ec2_security_group_name: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
    ec2_security_group_owner_id: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
) -> "capo_elasticache.types.authorize_cache_security_group_ingress_result.AuthorizeCacheSecurityGroupIngressResult":
    """<p>Allows network ingress to a cache security group. Applications using ElastiCache must be running on Amazon EC2, and Amazon EC2 security groups are used as the authorization mechanism.</p> <note> <p>You cannot authorize ingress from an Amazon EC2 security group in one region to an ElastiCache cluster in another region.</p> </note>

    Args:
        cache_security_group_name: <p>The cache security group that allows network ingress.</p>
        ec2_security_group_name: <p>The Amazon EC2 security group to be authorized for ingress to the cache security group.</p>
        ec2_security_group_owner_id: <p>The Amazon account number of the Amazon EC2 security group owner. Note that this is not the same thing as an Amazon access key ID - you must provide a valid Amazon account number for this parameter.</p>

    Raises:
        capo_elasticache.errors.authorization_already_exists_fault.AuthorizationAlreadyExistsFault: <p>The specified Amazon EC2 security group is already authorized for the specified cache security group.</p>
        capo_elasticache.errors.cache_security_group_not_found_fault.CacheSecurityGroupNotFoundFault: <p>The requested cache security group name does not refer to an existing cache security group.</p>
        capo_elasticache.errors.invalid_cache_security_group_state_fault.InvalidCacheSecurityGroupStateFault: <p>The current state of the cache security group does not allow deletion.</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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        AuthorizeCacheCacheSecurityGroupIngress
        Allows network ingress to a cache security group. Applications using ElastiCache must be running on Amazon EC2. Amazon EC2 security groups are used as the authorization mechanism.

        >>> await client.authorize_cache_security_group_ingress(cache_security_group_name='my-sec-grp', ec2_security_group_name='my-ec2-sec-grp', ec2_security_group_owner_id='1234567890')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_elasticache.types.authorize_cache_security_group_ingress_message.AuthorizeCacheSecurityGroupIngressMessage]",
    ) -> AsyncOperationResponse[
        "capo_elasticache.types.authorize_cache_security_group_ingress_result.AuthorizeCacheSecurityGroupIngressResult"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.authorize_cache_security_group_ingress

        (
            output,
            http_response,
        ) = await capo_elasticache._operations.amazon_elasti_cache_v9.authorize_cache_security_group_ingress.async_authorize_cache_security_group_ingress(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AuthorizeCacheSecurityGroupIngress")
    )
    input_: capo_elasticache.types.authorize_cache_security_group_ingress_message.AuthorizeCacheSecurityGroupIngressMessage = {}
    if cache_security_group_name is not None:
        input_["cache_security_group_name"] = cache_security_group_name
    if ec2_security_group_name is not None:
        input_["ec2_security_group_name"] = ec2_security_group_name
    if ec2_security_group_owner_id is not None:
        input_["ec2_security_group_owner_id"] = ec2_security_group_owner_id

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