Skip to content

untag_resource async

untag_resource(
    resource_arn: String,
    tag_keys: TagKeys,
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
) -> UntagResourceResponse

Deletes specified tags from a resource.

Parameters:

  • resource_arn (String) –

    The Amazon Resource Name (ARN) of the resource to delete tags from. Currently, the supported resources are Amazon ECS capacity providers, tasks, services, task definitions, clusters, and container instances.

  • tag_keys (TagKeys) –

    The keys of the tags to be removed.

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.

  • ResourceNotFoundException –

    The specified resource wasn't found.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnknownServiceError –

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

Examples:

To untag a cluster. This example deletes the 'team' tag from the 'dev' cluster.

>>> await client.untag_resource(resource_arn='arn:aws:ecs:region:aws_account_id:cluster/dev', tag_keys=['team'])
Source code in docs_src/capo_ecs/_services/async_ecs.py
async def untag_resource(
    self,
    resource_arn: "capo_ecs.types.string.String",
    tag_keys: "capo_ecs.types.tag_keys.TagKeys",
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
) -> "capo_ecs.types.untag_resource_response.UntagResourceResponse":
    """<p>Deletes specified tags from a resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource to delete tags from. Currently, the supported resources are Amazon ECS capacity providers, tasks, services, task definitions, clusters, and container instances.</p>
        tag_keys: <p>The keys of the tags to be removed.</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.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource wasn't found.</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 untag a cluster.
        This example deletes the 'team' tag from the 'dev' cluster.

        >>> await client.untag_resource(resource_arn='arn:aws:ecs:region:aws_account_id:cluster/dev', tag_keys=['team'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecs.types.untag_resource_request.UntagResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecs.types.untag_resource_response.UntagResourceResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.untag_resource

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UntagResource")
    )
    input_: capo_ecs.types.untag_resource_request.UntagResourceRequest = {
        "resource_arn": resource_arn,
        "tag_keys": tag_keys,
    }

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