Skip to content

tag_resource

tag_resource(
    workload_arn: WorkloadArn,
    *,
    config_overrides: Optional[WellArchitectedClientConfig] = None,
    tags: Optional[TagMap] = None,
) -> TagResourceOutput

Adds one or more tags to the specified resource.

The WorkloadArn parameter can be a workload ARN, a custom lens ARN, a profile ARN, or review template ARN.

Parameters:

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

    The tags for the resource.

Raises:

Source code in docs_src/capo_wellarchitected/_services/well_architected.py
def tag_resource(
    self,
    workload_arn: "capo_wellarchitected.types.workload_arn.WorkloadArn",
    *,
    config_overrides: Optional[WellArchitectedClientConfig] = None,
    tags: Optional["capo_wellarchitected.types.tag_map.TagMap"] = None,
) -> "capo_wellarchitected.types.tag_resource_output.TagResourceOutput":
    """<p>Adds one or more tags to the specified resource.</p> <note> <p>The WorkloadArn parameter can be a workload ARN, a custom lens ARN, a profile ARN, or review template ARN.</p> </note>

    Args:
        tags: <p>The tags for the resource.</p>

    Raises:
        capo_wellarchitected.errors.internal_server_exception.InternalServerException: <p>There is a problem with the Well-Architected Tool API service.</p>
        capo_wellarchitected.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_wellarchitected.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_wellarchitected.types.tag_resource_input.TagResourceInput]",
    ) -> OperationResponse[
        "capo_wellarchitected.types.tag_resource_output.TagResourceOutput"
    ]:
        import capo_wellarchitected._operations.well_architected_api_service_lambda.tag_resource

        output, http_response = (
            capo_wellarchitected._operations.well_architected_api_service_lambda.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_wellarchitected.types.tag_resource_input.TagResourceInput = {
        "workload_arn": workload_arn
    }
    if tags is not None:
        input_["tags"] = tags

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