Skip to content

tag_resource async

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

Tags a resource.

Parameters:

  • resource_arn (str) –

    The Amazon Resource Name (ARN) associated with the resource you want to tag.

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

    A map of key-value pairs, where each pair represents a tag present on the resource.

Raises:

Examples:

Adding tags to a deployment parameter The following example demonstrates adding two tags to a deployment parameter. There is no output from this API.

>>> await client.tag_resource(resource_arn='arn:aws:aws-marketplace:us-east-1:123456789012:DeploymentParameter:catalogs/AWSMarketplace/products/product-1234/dp-uniqueidentifier', tags={'FooKey': 'BarValue', 'HelloKey': 'WorldValue'})
Source code in docs_src/capo_marketplace_deployment/_services/async_marketplace_deployment.py
async def tag_resource(
    self,
    resource_arn: str,
    *,
    config_overrides: Optional[AsyncMarketplaceDeploymentClientConfig] = None,
    tags: Optional["capo_marketplace_deployment.types.tags.Tags"] = None,
) -> "capo_marketplace_deployment.types.tag_resource_response.TagResourceResponse":
    """<p>Tags a resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) associated with the resource you want to tag.</p>
        tags: <p>A map of key-value pairs, where each pair represents a tag present on the resource.</p>

    Raises:
        capo_marketplace_deployment.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_marketplace_deployment.errors.conflict_exception.ConflictException: <p>The request configuration has conflicts. For details, see the accompanying error message.</p>
        capo_marketplace_deployment.errors.internal_server_exception.InternalServerException: <p>There was an internal service exception.</p>
        capo_marketplace_deployment.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource wasn't found.</p>
        capo_marketplace_deployment.errors.throttling_exception.ThrottlingException: <p>Too many requests.</p>
        capo_marketplace_deployment.errors.validation_exception.ValidationException: <p>An error occurred during validation.</p>
        capo_marketplace_deployment.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Adding tags to a deployment parameter
        The following example demonstrates adding two tags to a deployment parameter. There is no output from this API.

        >>> await client.tag_resource(resource_arn='arn:aws:aws-marketplace:us-east-1:123456789012:DeploymentParameter:catalogs/AWSMarketplace/products/product-1234/dp-uniqueidentifier', tags={'FooKey': 'BarValue', 'HelloKey': 'WorldValue'})
    """

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

        (
            output,
            http_response,
        ) = await capo_marketplace_deployment._operations.awsmp_deployment_parameters_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_marketplace_deployment.types.tag_resource_request.TagResourceRequest = {
        "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