Skip to content

describe_clusters

describe_clusters(
    *,
    config_overrides: Optional[ECSClientConfig] = None,
    clusters: Optional[StringList] = None,
    include: Optional[ClusterFieldList] = None,
) -> DescribeClustersResponse

Describes one or more of your clusters.

For CLI examples, see describe-clusters.rst on GitHub.

Parameters:

  • clusters (Optional[StringList], default: None ) –

    A list of up to 100 cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed.

  • include (Optional[ClusterFieldList], default: None ) –

    Determines whether to include additional information about the clusters in the response. If this field is omitted, this information isn't included.

    If ATTACHMENTS is specified, the attachments for the container instances or tasks within the cluster are included, for example the capacity providers.

    If SETTINGS is specified, the settings for the cluster are included.

    If CONFIGURATIONS is specified, the configuration for the cluster is included.

    If STATISTICS is specified, the task and service count is included, separated by launch type.

    If TAGS is specified, the metadata tags associated with the cluster are included.

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.

  • 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.

  • UnknownServiceError –

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

Examples:

To describe a cluster This example provides a description of the specified cluster in your default region.

>>> client.describe_clusters(clusters=['default'])
Source code in docs_src/capo_ecs/_services/ecs.py
def describe_clusters(
    self,
    *,
    config_overrides: Optional[ECSClientConfig] = None,
    clusters: Optional["capo_ecs.types.string_list.StringList"] = None,
    include: Optional["capo_ecs.types.cluster_field_list.ClusterFieldList"] = None,
) -> "capo_ecs.types.describe_clusters_response.DescribeClustersResponse":
    """<p>Describes one or more of your clusters.</p> <p> For CLI examples, see <a href="https://github.com/aws/aws-cli/blob/develop/awscli/examples/ecs/describe-clusters.rst">describe-clusters.rst</a> on GitHub.</p>

    Args:
        clusters: <p>A list of up to 100 cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed.</p>
        include: <p>Determines whether to include additional information about the clusters in the response. If this field is omitted, this information isn't included.</p> <p>If <code>ATTACHMENTS</code> is specified, the attachments for the container instances or tasks within the cluster are included, for example the capacity providers.</p> <p>If <code>SETTINGS</code> is specified, the settings for the cluster are included.</p> <p>If <code>CONFIGURATIONS</code> is specified, the configuration for the cluster is included.</p> <p>If <code>STATISTICS</code> is specified, the task and service count is included, separated by launch type.</p> <p>If <code>TAGS</code> is specified, the metadata tags associated with the cluster are included.</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.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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe a cluster
        This example provides a description of the specified cluster in your default region.

        >>> client.describe_clusters(clusters=['default'])
    """

    def _handler(
        req: "OperationRequest[capo_ecs.types.describe_clusters_request.DescribeClustersRequest]",
    ) -> OperationResponse[
        "capo_ecs.types.describe_clusters_response.DescribeClustersResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.describe_clusters

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeClusters")
    )
    input_: capo_ecs.types.describe_clusters_request.DescribeClustersRequest = {}
    if clusters is not None:
        input_["clusters"] = clusters
    if include is not None:
        input_["include"] = include

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