Skip to content

tag_resource

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

Adds tags to a resource.

Parameters:

  • resource_arn (ResourceArn) –

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

  • tags (Tags) –

    The tags to apply to the specified resource.

Raises:

Source code in docs_src/capo_license_manager_user_subscriptions/_services/license_manager_user_subscriptions.py
def tag_resource(
    self,
    resource_arn: "capo_license_manager_user_subscriptions.types.resource_arn.ResourceArn",
    tags: "capo_license_manager_user_subscriptions.types.tags.Tags",
    *,
    config_overrides: Optional[LicenseManagerUserSubscriptionsClientConfig] = None,
) -> "capo_license_manager_user_subscriptions.types.tag_resource_response.TagResourceResponse":
    """<p>Adds tags to a resource.</p>

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

    Raises:
        capo_license_manager_user_subscriptions.errors.internal_server_exception.InternalServerException: <p>An exception occurred with the service.</p>
        capo_license_manager_user_subscriptions.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource couldn't be found.</p>
        capo_license_manager_user_subscriptions.errors.validation_exception.ValidationException: <p>A parameter is not valid.</p>
        capo_license_manager_user_subscriptions.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_license_manager_user_subscriptions.types.tag_resource_request.TagResourceRequest]",
    ) -> OperationResponse[
        "capo_license_manager_user_subscriptions.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_license_manager_user_subscriptions._operations.license_manager_user_subscriptions.tag_resource

        output, http_response = (
            capo_license_manager_user_subscriptions._operations.license_manager_user_subscriptions.tag_resource.tag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_license_manager_user_subscriptions.types.tag_resource_request.TagResourceRequest",
    ) -> dict[str, Any]:
        import capo_license_manager_user_subscriptions.types.tag_resource_request

        return capo_license_manager_user_subscriptions.types.tag_resource_request.redact_sensitive(
            input_
        )

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

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output