Skip to content

untag_resource

untag_resource(
    resource_arn: String,
    tag_keys: TagKeys,
    *,
    config_overrides: Optional[MigrationHubRefactorSpacesClientConfig] = None,
) -> UntagResourceResponse

Adds to or modifies the tags of the given resource. Tags are metadata which can be used to manage a resource. To untag a resource, the caller account must be the same as the resource’s OwnerAccountId. Untagging resources across accounts is not supported.

Parameters:

  • resource_arn (String) –

    The Amazon Resource Name (ARN) of the resource.

  • tag_keys (TagKeys) –

    The list of keys of the tags to be removed from the resource.

Raises:

Source code in docs_src/capo_migration_hub_refactor_spaces/_services/migration_hub_refactor_spaces.py
def untag_resource(
    self,
    resource_arn: "capo_migration_hub_refactor_spaces.types.string.String",
    tag_keys: "capo_migration_hub_refactor_spaces.types.tag_keys.TagKeys",
    *,
    config_overrides: Optional[MigrationHubRefactorSpacesClientConfig] = None,
) -> "capo_migration_hub_refactor_spaces.types.untag_resource_response.UntagResourceResponse":
    """<p>Adds to or modifies the tags of the given resource. Tags are metadata which can be used to manage a resource. To untag a resource, the caller account must be the same as the resource’s <code>OwnerAccountId</code>. Untagging resources across accounts is not supported. </p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource. </p>
        tag_keys: <p>The list of keys of the tags to be removed from the resource. </p>

    Raises:
        capo_migration_hub_refactor_spaces.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred while processing the request.</p>
        capo_migration_hub_refactor_spaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist. </p>
        capo_migration_hub_refactor_spaces.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by an Amazon Web Service. </p>
        capo_migration_hub_refactor_spaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_migration_hub_refactor_spaces.types.untag_resource_request.UntagResourceRequest]",
    ) -> OperationResponse[
        "capo_migration_hub_refactor_spaces.types.untag_resource_response.UntagResourceResponse"
    ]:
        import capo_migration_hub_refactor_spaces._operations.refactor_spaces.untag_resource

        output, http_response = (
            capo_migration_hub_refactor_spaces._operations.refactor_spaces.untag_resource.untag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_migration_hub_refactor_spaces.types.untag_resource_request.UntagResourceRequest",
    ) -> dict[str, Any]:
        import capo_migration_hub_refactor_spaces.types.untag_resource_request

        return capo_migration_hub_refactor_spaces.types.untag_resource_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UntagResource", redact_input=_redact_input),
    )
    input_: capo_migration_hub_refactor_spaces.types.untag_resource_request.UntagResourceRequest = {
        "resource_arn": resource_arn,
        "tag_keys": tag_keys,
    }

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