Skip to content

tag_resource async

tag_resource(
    resource_arn: TaggableResourceArn,
    tags: InputTagList,
    *,
    config_overrides: Optional[AsyncDataSyncClientConfig] = None,
) -> TagResourceResponse

Applies a tag to an Amazon Web Services resource. Tags are key-value pairs that can help you manage, filter, and search for your resources.

These include DataSync resources, such as locations, tasks, and task executions.

Parameters:

  • resource_arn (TaggableResourceArn) –

    Specifies the Amazon Resource Name (ARN) of the resource to apply the tag to.

  • tags (InputTagList) –

    Specifies the tags that you want to apply to the resource.

Raises:

Source code in docs_src/capo_datasync/_services/async_data_sync.py
async def tag_resource(
    self,
    resource_arn: "capo_datasync.types.taggable_resource_arn.TaggableResourceArn",
    tags: "capo_datasync.types.input_tag_list.InputTagList",
    *,
    config_overrides: Optional[AsyncDataSyncClientConfig] = None,
) -> "capo_datasync.types.tag_resource_response.TagResourceResponse":
    """<p>Applies a <i>tag</i> to an Amazon Web Services resource. Tags are key-value pairs that can help you manage, filter, and search for your resources.</p> <p>These include DataSync resources, such as locations, tasks, and task executions.</p>

    Args:
        resource_arn: <p>Specifies the Amazon Resource Name (ARN) of the resource to apply the tag to.</p>
        tags: <p>Specifies the tags that you want to apply to the resource.</p>

    Raises:
        capo_datasync.errors.internal_exception.InternalException: <p>This exception is thrown when an error occurs in the DataSync service.</p>
        capo_datasync.errors.invalid_request_exception.InvalidRequestException: <p>This exception is thrown when the client submits a malformed request.</p>
        capo_datasync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_datasync.types.tag_resource_request.TagResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_datasync.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_datasync._operations.fmrs_service.tag_resource

        (
            output,
            http_response,
        ) = await capo_datasync._operations.fmrs_service.tag_resource.async_tag_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TagResource")
    )
    input_: capo_datasync.types.tag_resource_request.TagResourceRequest = {
        "resource_arn": resource_arn,
        "tags": tags,
    }

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