Returns a list of task definitions that are registered to your account. You can filter the results by family name with the familyPrefix parameter or by status with the status parameter.
Parameters:
-
family_prefix
(Optional[String], default:
None
)
–
The full family name to filter the ListTaskDefinitions results with. Specifying a familyPrefix limits the listed task definitions to task definition revisions that belong to that family.
-
status
(Optional[TaskDefinitionStatus], default:
None
)
–
The task definition status to filter the ListTaskDefinitions results with. By default, only ACTIVE task definitions are listed. By setting this parameter to INACTIVE, you can view task definitions that are INACTIVE as long as an active task or service still references them. If you paginate the resulting output, be sure to keep the status value constant in each subsequent request.
-
sort
(Optional[SortOrder], default:
None
)
–
The order to sort the results in. Valid values are ASC and DESC. By default, (ASC) task definitions are listed lexicographically by family name and in ascending numerical order by revision so that the newest task definitions in a family are listed last. Setting this parameter to DESC reverses the sort order on family name and revision. This is so that the newest task definitions in a family are listed first.
-
next_token
(Optional[String], default:
None
)
–
The nextToken value returned from a ListTaskDefinitions request indicating that more results are available to fulfill the request and further calls will be needed. If maxResults was provided, it is possible the number of results to be fewer than maxResults.
This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.
-
max_results
(Optional[BoxedInteger], default:
None
)
–
The maximum number of task definition results that ListTaskDefinitions returned in paginated output. When this parameter is used, ListTaskDefinitions 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 ListTaskDefinitions request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then ListTaskDefinitions returns up to 100 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.
-
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 list your registered task definitions
This example lists all of your registered task definitions.
>>> client.list_task_definitions()
To list the registered task definitions in a family
This example lists the task definition revisions of a specified family.
>>> client.list_task_definitions(family_prefix='wordpress')
Source code in docs_src/capo_ecs/_services/ecs.py
| def list_task_definitions(
self,
*,
config_overrides: Optional[ECSClientConfig] = None,
family_prefix: Optional["capo_ecs.types.string.String"] = None,
status: Optional[
"capo_ecs.types.task_definition_status.TaskDefinitionStatus"
] = None,
sort: Optional["capo_ecs.types.sort_order.SortOrder"] = None,
next_token: Optional["capo_ecs.types.string.String"] = None,
max_results: Optional["capo_ecs.types.boxed_integer.BoxedInteger"] = None,
) -> "capo_ecs.types.list_task_definitions_response.ListTaskDefinitionsResponse":
"""<p>Returns a list of task definitions that are registered to your account. You can filter the results by family name with the <code>familyPrefix</code> parameter or by status with the <code>status</code> parameter.</p>
Args:
family_prefix: <p>The full family name to filter the <code>ListTaskDefinitions</code> results with. Specifying a <code>familyPrefix</code> limits the listed task definitions to task definition revisions that belong to that family.</p>
status: <p>The task definition status to filter the <code>ListTaskDefinitions</code> results with. By default, only <code>ACTIVE</code> task definitions are listed. By setting this parameter to <code>INACTIVE</code>, you can view task definitions that are <code>INACTIVE</code> as long as an active task or service still references them. If you paginate the resulting output, be sure to keep the <code>status</code> value constant in each subsequent request.</p>
sort: <p>The order to sort the results in. Valid values are <code>ASC</code> and <code>DESC</code>. By default, (<code>ASC</code>) task definitions are listed lexicographically by family name and in ascending numerical order by revision so that the newest task definitions in a family are listed last. Setting this parameter to <code>DESC</code> reverses the sort order on family name and revision. This is so that the newest task definitions in a family are listed first.</p>
next_token: <p>The <code>nextToken</code> value returned from a <code>ListTaskDefinitions</code> request indicating that more results are available to fulfill the request and further calls will be needed. If <code>maxResults</code> was provided, it is possible the number of results to be fewer than <code>maxResults</code>.</p> <note> <p>This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.</p> </note>
max_results: <p>The maximum number of task definition results that <code>ListTaskDefinitions</code> returned in paginated output. When this parameter is used, <code>ListTaskDefinitions</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>ListTaskDefinitions</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>ListTaskDefinitions</code> returns up to 100 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.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 list your registered task definitions
This example lists all of your registered task definitions.
>>> client.list_task_definitions()
To list the registered task definitions in a family
This example lists the task definition revisions of a specified family.
>>> client.list_task_definitions(family_prefix='wordpress')
"""
def _handler(
req: "OperationRequest[capo_ecs.types.list_task_definitions_request.ListTaskDefinitionsRequest]",
) -> OperationResponse[
"capo_ecs.types.list_task_definitions_response.ListTaskDefinitionsResponse"
]:
import capo_ecs._operations.amazon_ec2_container_service_v20141113.list_task_definitions
output, http_response = (
capo_ecs._operations.amazon_ec2_container_service_v20141113.list_task_definitions.list_task_definitions(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ListTaskDefinitions")
)
input_: capo_ecs.types.list_task_definitions_request.ListTaskDefinitionsRequest = {}
if family_prefix is not None:
input_["family_prefix"] = family_prefix
if status is not None:
input_["status"] = status
if sort is not None:
input_["sort"] = sort
if next_token is not None:
input_["next_token"] = next_token
if max_results is not None:
input_["max_results"] = max_results
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|