Skip to content

create_container_association async

create_container_association(
    container_association_name: ResourceName,
    type: ContainerMonitoringType,
    container_monitoring_configurations: ContainerMonitoringConfigurations,
    *,
    config_overrides: Optional[AsyncNetworkFirewallClientConfig] = None,
    description: Optional[Description] = None,
    tags: Optional[TagList] = None,
) -> CreateContainerAssociationResponse

Creates a Network Firewall container association. The association monitors container lifecycle events in your Amazon ECS or Amazon EKS clusters and resolves running container addresses for use in firewall rules.

Parameters:

  • container_association_name (ResourceName) –

    The descriptive name of the container association. You can't change the name of a container association after you create it.

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

    A description of the container association.

  • type (ContainerMonitoringType) –

    The type of containers to monitor. You can't change the container type after creation. Valid values:

    • ECS - Amazon Elastic Container Service

    • EKS - Amazon Elastic Kubernetes Service

  • container_monitoring_configurations (ContainerMonitoringConfigurations) –

    The monitoring configurations for the container association. Each configuration specifies an Amazon ECS or Amazon EKS cluster to monitor and optional attribute filters to narrow which containers are tracked.

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

    The key:value pairs to associate with the resource.

Raises:

  • InsufficientCapacityException –

    Amazon Web Services doesn't currently have enough available capacity to fulfill your request. Try your request later.

  • InternalServerError –

    Your request is valid, but Network Firewall couldn't perform the operation because of a system problem. Retry your request.

  • InvalidRequestException –

    The operation failed because of a problem with your request. Examples include:

    • You specified an unsupported parameter name or value.

    • You tried to update a property with a value that isn't among the available types.

    • Your request references an ARN that is malformed, or corresponds to a resource that isn't valid in the context of the request.

  • LimitExceededException –

    Unable to perform the operation because doing so would violate a limit setting.

  • ThrottlingException –

    Unable to process the request due to throttling limitations.

  • UnknownServiceError –

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

Source code in docs_src/capo_network_firewall/_services/async_network_firewall.py
async def create_container_association(
    self,
    container_association_name: "capo_network_firewall.types.resource_name.ResourceName",
    type: "capo_network_firewall.types.container_monitoring_type.ContainerMonitoringType",
    container_monitoring_configurations: "capo_network_firewall.types.container_monitoring_configurations.ContainerMonitoringConfigurations",
    *,
    config_overrides: Optional[AsyncNetworkFirewallClientConfig] = None,
    description: Optional[
        "capo_network_firewall.types.description.Description"
    ] = None,
    tags: Optional["capo_network_firewall.types.tag_list.TagList"] = None,
) -> "capo_network_firewall.types.create_container_association_response.CreateContainerAssociationResponse":
    """<p>Creates a Network Firewall container association. The association monitors container lifecycle events in your Amazon ECS or Amazon EKS clusters and resolves running container addresses for use in firewall rules.</p>

    Args:
        container_association_name: <p>The descriptive name of the container association. You can't change the name of a container association after you create it.</p>
        description: <p>A description of the container association.</p>
        type: <p>The type of containers to monitor. You can't change the container type after creation. Valid values:</p> <ul> <li> <p> <code>ECS</code> - Amazon Elastic Container Service</p> </li> <li> <p> <code>EKS</code> - Amazon Elastic Kubernetes Service</p> </li> </ul>
        container_monitoring_configurations: <p>The monitoring configurations for the container association. Each configuration specifies an Amazon ECS or Amazon EKS cluster to monitor and optional attribute filters to narrow which containers are tracked.</p>
        tags: <p>The key:value pairs to associate with the resource.</p>

    Raises:
        capo_network_firewall.errors.insufficient_capacity_exception.InsufficientCapacityException: <p>Amazon Web Services doesn't currently have enough available capacity to fulfill your request. Try your request later. </p>
        capo_network_firewall.errors.internal_server_error.InternalServerError: <p>Your request is valid, but Network Firewall couldn't perform the operation because of a system problem. Retry your request. </p>
        capo_network_firewall.errors.invalid_request_exception.InvalidRequestException: <p>The operation failed because of a problem with your request. Examples include: </p> <ul> <li> <p>You specified an unsupported parameter name or value.</p> </li> <li> <p>You tried to update a property with a value that isn't among the available types.</p> </li> <li> <p>Your request references an ARN that is malformed, or corresponds to a resource that isn't valid in the context of the request.</p> </li> </ul>
        capo_network_firewall.errors.limit_exceeded_exception.LimitExceededException: <p>Unable to perform the operation because doing so would violate a limit setting. </p>
        capo_network_firewall.errors.throttling_exception.ThrottlingException: <p>Unable to process the request due to throttling limitations.</p>
        capo_network_firewall.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_network_firewall.types.create_container_association_request.CreateContainerAssociationRequest]",
    ) -> AsyncOperationResponse[
        "capo_network_firewall.types.create_container_association_response.CreateContainerAssociationResponse"
    ]:
        import capo_network_firewall._operations.network_firewall_20201112.create_container_association

        (
            output,
            http_response,
        ) = await capo_network_firewall._operations.network_firewall_20201112.create_container_association.async_create_container_association(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateContainerAssociation")
    )
    input_: capo_network_firewall.types.create_container_association_request.CreateContainerAssociationRequest = {
        "container_association_name": container_association_name,
        "type": type,
        "container_monitoring_configurations": container_monitoring_configurations,
    }
    if description is not None:
        input_["description"] = description
    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