Skip to content

associate_gateway_with_cluster

associate_gateway_with_cluster(
    gateway: String,
    cluster: String,
    *,
    config_overrides: Optional[ECSClientConfig] = None,
) -> AssociateGatewayWithClusterResponse

Associates a gateway with an Amazon ECS cluster. After a cluster is associated with a gateway, services in that cluster can use the gateway for ingress. No changes take effect until you update a service in the cluster to use the gateway. A single cluster can be associated with up to 5 gateways.

Parameters:

  • gateway (String) –

    The name or Amazon Resource Name (ARN) of the gateway to associate.

  • cluster (String) –

    The name or Amazon Resource Name (ARN) of the cluster to associate the gateway with.

Raises:

  • AccessDeniedException –

    You don't have authorization to perform the requested action.

  • ClientException –

    These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.

  • ClusterNotFoundException –

    The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.

  • GatewayNotFoundException –

    The specified gateway wasn't found. Check that the gateway name or ARN is correct and that the gateway exists in your account and Region.

  • InvalidParameterException –

    The specified parameter isn't valid. Review the available parameters for the API request.

    For more information about service event errors, see Amazon ECS service event messages.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnsupportedFeatureException –

    The specified task isn't supported in this Region.

  • UnknownServiceError –

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

Examples:

To associate a gateway with a cluster This example associates the gateway named my-gateway with the cluster named my-cluster so that services in the cluster can use the gateway for ingress.

>>> client.associate_gateway_with_cluster(gateway='my-gateway', cluster='my-cluster')
Source code in docs_src/capo_ecs/_services/ecs.py
def associate_gateway_with_cluster(
    self,
    gateway: "capo_ecs.types.string.String",
    cluster: "capo_ecs.types.string.String",
    *,
    config_overrides: Optional[ECSClientConfig] = None,
) -> "capo_ecs.types.associate_gateway_with_cluster_response.AssociateGatewayWithClusterResponse":
    """<p>Associates a gateway with an Amazon ECS cluster. After a cluster is associated with a gateway, services in that cluster can use the gateway for ingress. No changes take effect until you update a service in the cluster to use the gateway. A single cluster can be associated with up to 5 gateways.</p>

    Args:
        gateway: <p>The name or Amazon Resource Name (ARN) of the gateway to associate.</p>
        cluster: <p>The name or Amazon Resource Name (ARN) of the cluster to associate the gateway with.</p>

    Raises:
        capo_ecs.errors.access_denied_exception.AccessDeniedException: <p>You don't have authorization to perform the requested action.</p>
        capo_ecs.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.</p>
        capo_ecs.errors.cluster_not_found_exception.ClusterNotFoundException: <p>The specified cluster wasn't found. You can view your available clusters with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListClusters.html">ListClusters</a>. Amazon ECS clusters are Region specific.</p>
        capo_ecs.errors.gateway_not_found_exception.GatewayNotFoundException: <p>The specified gateway wasn't found. Check that the gateway name or ARN is correct and that the gateway exists in your account and Region.</p>
        capo_ecs.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter isn't valid. Review the available parameters for the API request.</p> <p>For more information about service event errors, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html">Amazon ECS service event messages</a>. </p>
        capo_ecs.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_ecs.errors.unsupported_feature_exception.UnsupportedFeatureException: <p>The specified task isn't supported in this Region.</p>
        capo_ecs.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To associate a gateway with a cluster
        This example associates the gateway named my-gateway with the cluster named my-cluster so that services in the cluster can use the gateway for ingress.

        >>> client.associate_gateway_with_cluster(gateway='my-gateway', cluster='my-cluster')
    """

    def _handler(
        req: "OperationRequest[capo_ecs.types.associate_gateway_with_cluster_request.AssociateGatewayWithClusterRequest]",
    ) -> OperationResponse[
        "capo_ecs.types.associate_gateway_with_cluster_response.AssociateGatewayWithClusterResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.associate_gateway_with_cluster

        output, http_response = (
            capo_ecs._operations.amazon_ec2_container_service_v20141113.associate_gateway_with_cluster.associate_gateway_with_cluster(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateGatewayWithCluster")
    )
    input_: capo_ecs.types.associate_gateway_with_cluster_request.AssociateGatewayWithClusterRequest = {
        "gateway": gateway,
        "cluster": cluster,
    }

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