Skip to content

tag_resource

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

Assigns one or more tags (key-value pairs) to the specified resource.

Each tag consists of a key and an optional value. If a tag with the same key is already associated with the resource, this action updates its value.

This operation returns an empty response if the call was successful.

Parameters:

  • resource_arn (Arn) –

    The Amazon resource name (ARN) that specifies the resource.

  • tags (Tags) –

    The new or modified tags for the resource.

Raises:

Source code in docs_src/capo_service_catalog_appregistry/_services/service_catalog_app_registry.py
def tag_resource(
    self,
    resource_arn: "capo_service_catalog_appregistry.types.arn.Arn",
    tags: "capo_service_catalog_appregistry.types.tags.Tags",
    *,
    config_overrides: Optional[ServiceCatalogAppRegistryClientConfig] = None,
) -> "capo_service_catalog_appregistry.types.tag_resource_response.TagResourceResponse":
    """<p>Assigns one or more tags (key-value pairs) to the specified resource.</p> <p>Each tag consists of a key and an optional value. If a tag with the same key is already associated with the resource, this action updates its value.</p> <p>This operation returns an empty response if the call was successful.</p>

    Args:
        resource_arn: <p>The Amazon resource name (ARN) that specifies the resource.</p>
        tags: <p>The new or modified tags for the resource.</p>

    Raises:
        capo_service_catalog_appregistry.errors.internal_server_exception.InternalServerException: <p>The service is experiencing internal problems.</p>
        capo_service_catalog_appregistry.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_service_catalog_appregistry.errors.validation_exception.ValidationException: <p>The request has invalid or missing parameters.</p>
        capo_service_catalog_appregistry.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_service_catalog_appregistry._operations.aws242_app_registry.tag_resource.tag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TagResource")
    )
    input_: capo_service_catalog_appregistry.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