Skip to content

tag_resource

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

Tag a resource by specifying its Amazon Resource Name (ARN).

Parameters:

  • resource_arn (ResourceArn) –

    The Amazon Resource Name (ARN) of the resource to which you want to add tags.

  • tags (TagMap) –

    A collection of labels, in the form of key:value pairs, that apply to this resource.

Raises:

Source code in docs_src/capo_migrationhuborchestrator/_services/migration_hub_orchestrator.py
def tag_resource(
    self,
    resource_arn: "capo_migrationhuborchestrator.types.resource_arn.ResourceArn",
    tags: "capo_migrationhuborchestrator.types.tag_map.TagMap",
    *,
    config_overrides: Optional[MigrationHubOrchestratorClientConfig] = None,
) -> (
    "capo_migrationhuborchestrator.types.tag_resource_response.TagResourceResponse"
):
    """<p>Tag a resource by specifying its Amazon Resource Name (ARN).</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource to which you want to add tags.</p>
        tags: <p>A collection of labels, in the form of key:value pairs, that apply to this resource.</p>

    Raises:
        capo_migrationhuborchestrator.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource is not available.</p>
        capo_migrationhuborchestrator.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an AWS service.</p>
        capo_migrationhuborchestrator.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_migrationhuborchestrator._operations.aws_migration_hub_orchestrator.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_migrationhuborchestrator.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