Skip to content

tag_resource async

tag_resource(
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = None,
    resource_arn: Optional[ResourceARN] = None,
    tags: Optional[Tags] = None,
) -> TagResourceResponse

Tags an Amazon FSx resource.

Parameters:

  • resource_arn (Optional[ResourceARN], default: None ) –

    The Amazon Resource Name (ARN) of the Amazon FSx resource that you want to tag.

  • tags (Optional[Tags], default: None ) –

    A list of tags for the resource. If a tag with a given key already exists, the value is replaced by the one specified in this parameter.

Raises:

  • BadRequest –

    A generic error indicating a failure with a client request.

  • InternalServerError –

    A generic error indicating a server-side failure.

  • NotServiceResourceError –

    The resource specified for the tagging operation is not a resource type owned by Amazon FSx. Use the API of the relevant service to perform the operation.

  • ResourceDoesNotSupportTagging –

    The resource specified does not support tagging.

  • ResourceNotFound –

    The resource specified by the Amazon Resource Name (ARN) can't be found.

  • UnknownServiceError –

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

Examples:

To tag a resource This operation tags an Amazon FSx resource.

>>> await client.tag_resource(resource_arn='arn:aws:fsx:us-east-1:012345678912:file-system/fs-0498eed5fe91001ec', tags=[{'Key': 'Name', 'Value': 'MyFileSystem'}])
Source code in docs_src/capo_fsx/_services/async_f_sx.py
async def tag_resource(
    self,
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = None,
    resource_arn: Optional["capo_fsx.types.resource_arn.ResourceARN"] = None,
    tags: Optional["capo_fsx.types.tags.Tags"] = None,
) -> "capo_fsx.types.tag_resource_response.TagResourceResponse":
    """<p>Tags an Amazon FSx resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the Amazon FSx resource that you want to tag.</p>
        tags: <p>A list of tags for the resource. If a tag with a given key already exists, the value is replaced by the one specified in this parameter.</p>

    Raises:
        capo_fsx.errors.bad_request.BadRequest: <p>A generic error indicating a failure with a client request.</p>
        capo_fsx.errors.internal_server_error.InternalServerError: <p>A generic error indicating a server-side failure.</p>
        capo_fsx.errors.not_service_resource_error.NotServiceResourceError: <p>The resource specified for the tagging operation is not a resource type owned by Amazon FSx. Use the API of the relevant service to perform the operation. </p>
        capo_fsx.errors.resource_does_not_support_tagging.ResourceDoesNotSupportTagging: <p>The resource specified does not support tagging. </p>
        capo_fsx.errors.resource_not_found.ResourceNotFound: <p>The resource specified by the Amazon Resource Name (ARN) can't be found.</p>
        capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To tag a resource
        This operation tags an Amazon FSx resource.

        >>> await client.tag_resource(resource_arn='arn:aws:fsx:us-east-1:012345678912:file-system/fs-0498eed5fe91001ec', tags=[{'Key': 'Name', 'Value': 'MyFileSystem'}])
    """

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

        (
            output,
            http_response,
        ) = await capo_fsx._operations.aws_simba_api_service_v20180301.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_fsx.types.tag_resource_request.TagResourceRequest = {}
    if resource_arn is not None:
        input_["resource_arn"] = resource_arn
    if tags is not None:
        input_["tags"] = tags

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