Skip to content

list_service_deployments async

list_service_deployments(
    service: String,
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    cluster: Optional[String] = None,
    status: Optional[ServiceDeploymentStatusList] = None,
    created_at: Optional[CreatedAt] = None,
    next_token: Optional[String] = None,
    max_results: Optional[BoxedInteger] = None,
) -> ListServiceDeploymentsResponse

This operation lists all the service deployments that meet the specified filter criteria.

A service deployment happens when you release a software update for the service. You route traffic from the running service revisions to the new service revison and control the number of running tasks.

This API returns the values that you use for the request parameters in DescribeServiceRevisions.

Parameters:

  • service (String) –

    The ARN or name of the service

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

    The cluster that hosts the service. This can either be the cluster name or ARN. Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. If you don't specify a cluster, default is used.

  • status (Optional[ServiceDeploymentStatusList], default: None ) –

    An optional filter you can use to narrow the results. If you do not specify a status, then all status values are included in the result.

  • created_at (Optional[CreatedAt], default: None ) –

    An optional filter you can use to narrow the results by the service creation date. If you do not specify a value, the result includes all services created before the current time. The format is yyyy-MM-dd HH:mm:ss.SSSSSS.

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

    The nextToken value returned from a ListServiceDeployments request indicating that more results are available to fulfill the request and further calls are needed. If you provided maxResults, it's possible the number of results is fewer than maxResults.

  • max_results (Optional[BoxedInteger], default: None ) –

    The maximum number of service deployment results that ListServiceDeployments returned in paginated output. When this parameter is used, ListServiceDeployments only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListServiceDeployments request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then ListServiceDeployments returns up to 20 results and a nextToken value if applicable.

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.

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

  • ServiceNotFoundException –

    The specified service wasn't found. You can view your available services with ListServices. Amazon ECS services are cluster specific and Region specific.

  • UnsupportedFeatureException –

    The specified task isn't supported in this Region.

  • UnknownServiceError –

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

Examples:

To list service deployments that meet the specified criteria This example lists all successful service deployments for the service "sd-example" in the cluster "example".

>>> await client.list_service_deployments(service='sd-example', cluster='example', status=['SUCCESSFUL'])
Source code in docs_src/capo_ecs/_services/async_ecs.py
async def list_service_deployments(
    self,
    service: "capo_ecs.types.string.String",
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    cluster: Optional["capo_ecs.types.string.String"] = None,
    status: Optional[
        "capo_ecs.types.service_deployment_status_list.ServiceDeploymentStatusList"
    ] = None,
    created_at: Optional["capo_ecs.types.created_at.CreatedAt"] = None,
    next_token: Optional["capo_ecs.types.string.String"] = None,
    max_results: Optional["capo_ecs.types.boxed_integer.BoxedInteger"] = None,
) -> "capo_ecs.types.list_service_deployments_response.ListServiceDeploymentsResponse":
    """<p>This operation lists all the service deployments that meet the specified filter criteria.</p> <p>A service deployment happens when you release a software update for the service. You route traffic from the running service revisions to the new service revison and control the number of running tasks. </p> <p>This API returns the values that you use for the request parameters in <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeServiceRevisions.html">DescribeServiceRevisions</a>.</p>

    Args:
        service: <p>The ARN or name of the service</p>
        cluster: <p>The cluster that hosts the service. This can either be the cluster name or ARN. Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. If you don't specify a cluster, <code>default</code> is used.</p>
        status: <p>An optional filter you can use to narrow the results. If you do not specify a status, then all status values are included in the result.</p>
        created_at: <p>An optional filter you can use to narrow the results by the service creation date. If you do not specify a value, the result includes all services created before the current time. The format is yyyy-MM-dd HH:mm:ss.SSSSSS.</p>
        next_token: <p>The <code>nextToken</code> value returned from a <code>ListServiceDeployments</code> request indicating that more results are available to fulfill the request and further calls are needed. If you provided <code>maxResults</code>, it's possible the number of results is fewer than <code>maxResults</code>.</p>
        max_results: <p>The maximum number of service deployment results that <code>ListServiceDeployments</code> returned in paginated output. When this parameter is used, <code>ListServiceDeployments</code> only returns <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>ListServiceDeployments</code> request with the returned <code>nextToken</code> value. This value can be between 1 and 100. If this parameter isn't used, then <code>ListServiceDeployments</code> returns up to 20 results and a <code>nextToken</code> value if applicable.</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.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.service_not_found_exception.ServiceNotFoundException: <p>The specified service wasn't found. You can view your available services with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListServices.html">ListServices</a>. Amazon ECS services are cluster specific and Region specific.</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 list service deployments that meet the specified criteria
        This example lists all successful service deployments for the service "sd-example" in the cluster "example".

        >>> await client.list_service_deployments(service='sd-example', cluster='example', status=['SUCCESSFUL'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecs.types.list_service_deployments_request.ListServiceDeploymentsRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecs.types.list_service_deployments_response.ListServiceDeploymentsResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.list_service_deployments

        (
            output,
            http_response,
        ) = await capo_ecs._operations.amazon_ec2_container_service_v20141113.list_service_deployments.async_list_service_deployments(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListServiceDeployments")
    )
    input_: capo_ecs.types.list_service_deployments_request.ListServiceDeploymentsRequest = {
        "service": service
    }
    if cluster is not None:
        input_["cluster"] = cluster
    if status is not None:
        input_["status"] = status
    if created_at is not None:
        input_["created_at"] = created_at
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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