Skip to content

tag_resource async

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

Adds the specified tags to the given resource.

Parameters:

  • resource_arn (str) –

    The Amazon Resource Name (ARN) of the resource.

  • tags (Tags) –

    One or more tags to attach to the resource.

Raises:

Examples:

Adding tags to a Launch Wizard deployment resource.

>>> await client.tag_resource(resource_arn='arn:aws:launchwizard:us-east-1:123456789012:deployment/11111111-1111-1111-1111-111111111111', tags={'key1': 'value1', 'key2': 'value2'})
Source code in docs_src/capo_launch_wizard/_services/async_launch_wizard.py
async def tag_resource(
    self,
    resource_arn: str,
    tags: "capo_launch_wizard.types.tags.Tags",
    *,
    config_overrides: Optional[AsyncLaunchWizardClientConfig] = None,
) -> "capo_launch_wizard.types.tag_resource_output.TagResourceOutput":
    """<p>Adds the specified tags to the given resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource.</p>
        tags: <p>One or more tags to attach to the resource.</p>

    Raises:
        capo_launch_wizard.errors.internal_server_exception.InternalServerException: <p>An internal error has occurred. Retry your request, but if the problem persists, contact us with details by posting a question on <a href="https://repost.aws/">re:Post</a>.</p>
        capo_launch_wizard.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified workload or deployment resource can't be found.</p>
        capo_launch_wizard.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_launch_wizard.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Adding tags to a Launch Wizard deployment resource.

        >>> await client.tag_resource(resource_arn='arn:aws:launchwizard:us-east-1:123456789012:deployment/11111111-1111-1111-1111-111111111111', tags={'key1': 'value1', 'key2': 'value2'})
    """

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

        (
            output,
            http_response,
        ) = await capo_launch_wizard._operations.launch_wizard.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_launch_wizard.types.tag_resource_input.TagResourceInput = {
        "resource_arn": resource_arn,
        "tags": tags,
    }

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