Skip to content

tag_resource async

tag_resource(
    resource_arn: str,
    *,
    config_overrides: Optional[AsyncResourceExplorer2ClientConfig] = None,
    tags: Optional[TagMap] = None,
) -> TagResourceOutput

Adds one or more tag key and value pairs to an Amazon Web Services Resource Explorer view or index.

Parameters:

  • resource_arn (str) –

    The Amazon Resource Name (ARN) of the view or index that you want to attach tags to.

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

    A list of tag key and value pairs that you want to attach to the specified view or index.

Raises:

  • AccessDeniedException –

    The credentials that you used to call this operation don't have the minimum required permissions.

  • ConflictException –

    If you attempted to create a view, then the request failed because either you specified parameters that didn’t match the original request, or you attempted to create a view with a name that already exists in this Amazon Web Services Region.

    If you attempted to create an index, then the request failed because either you specified parameters that didn't match the original request, or an index already exists in the current Amazon Web Services Region.

    If you attempted to update an index type to AGGREGATOR, then the request failed because you already have an AGGREGATOR index in a different Amazon Web Services Region.

  • InternalServerException –

    The request failed because of internal service error. Try your request again later.

  • ThrottlingException –

    The request failed because you exceeded a rate limit for this operation. For more information, see Quotas for Resource Explorer.

  • UnauthorizedException –

    The principal making the request isn't permitted to perform the operation.

  • ValidationException –

    You provided an invalid value for one of the operation's parameters. Check the syntax for the operation, and try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_resource_explorer_2/_services/async_resource_explorer2.py
async def tag_resource(
    self,
    resource_arn: str,
    *,
    config_overrides: Optional[AsyncResourceExplorer2ClientConfig] = None,
    tags: Optional["capo_resource_explorer_2.types.tag_map.TagMap"] = None,
) -> "capo_resource_explorer_2.types.tag_resource_output.TagResourceOutput":
    """<p>Adds one or more tag key and value pairs to an Amazon Web Services Resource Explorer view or index.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the view or index that you want to attach tags to.</p>
        tags: <p>A list of tag key and value pairs that you want to attach to the specified view or index.</p>

    Raises:
        capo_resource_explorer_2.errors.access_denied_exception.AccessDeniedException: <p>The credentials that you used to call this operation don't have the minimum required permissions.</p>
        capo_resource_explorer_2.errors.conflict_exception.ConflictException: <p>If you attempted to create a view, then the request failed because either you specified parameters that didn’t match the original request, or you attempted to create a view with a name that already exists in this Amazon Web Services Region.</p> <p>If you attempted to create an index, then the request failed because either you specified parameters that didn't match the original request, or an index already exists in the current Amazon Web Services Region.</p> <p>If you attempted to update an index type to <code>AGGREGATOR</code>, then the request failed because you already have an <code>AGGREGATOR</code> index in a different Amazon Web Services Region.</p>
        capo_resource_explorer_2.errors.internal_server_exception.InternalServerException: <p>The request failed because of internal service error. Try your request again later.</p>
        capo_resource_explorer_2.errors.throttling_exception.ThrottlingException: <p>The request failed because you exceeded a rate limit for this operation. For more information, see <a href="https://docs.aws.amazon.com/resource-explorer/latest/userguide/quotas.html">Quotas for Resource Explorer</a>.</p>
        capo_resource_explorer_2.errors.unauthorized_exception.UnauthorizedException: <p>The principal making the request isn't permitted to perform the operation.</p>
        capo_resource_explorer_2.errors.validation_exception.ValidationException: <p>You provided an invalid value for one of the operation's parameters. Check the syntax for the operation, and try again.</p>
        capo_resource_explorer_2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_resource_explorer_2.types.tag_resource_input.TagResourceInput]",
    ) -> AsyncOperationResponse[
        "capo_resource_explorer_2.types.tag_resource_output.TagResourceOutput"
    ]:
        import capo_resource_explorer_2._operations.resource_explorer.tag_resource

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

    def _redact_input(
        input_: "capo_resource_explorer_2.types.tag_resource_input.TagResourceInput",
    ) -> dict[str, Any]:
        import capo_resource_explorer_2.types.tag_resource_input

        return capo_resource_explorer_2.types.tag_resource_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("TagResource", redact_input=_redact_input),
    )
    input_: capo_resource_explorer_2.types.tag_resource_input.TagResourceInput = {
        "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