Skip to content

untag_resource

untag_resource(
    account_id: AccountId,
    resource_arn: S3ResourceArn,
    tag_keys: TagKeyList,
    *,
    config_overrides: Optional[S3ControlClientConfig] = None,
) -> UntagResourceResult

This operation removes the specified user-defined tags from an S3 resource. You can pass one or more tag keys.

This operation is only supported for the following Amazon S3 resources:

Permissions

For general purpose buckets, access points for general purpose buckets, Storage Lens groups, and S3 Access Grants, you must have the s3:UntagResource permission to use this operation.

Directory bucket permissions

For directory buckets, you must have the s3express:UntagResource permission to use this operation. For more information about directory buckets policies and permissions, see Identity and Access Management (IAM) for S3 Express One Zone in the Amazon S3 User Guide.

HTTP Host header syntax

Directory buckets - The HTTP Host header syntax is s3express-control.region.amazonaws.com.

For information about S3 Tagging errors, see List of Amazon S3 Tagging error codes.

Parameters:

  • account_id (AccountId) –

    The Amazon Web Services account ID that owns the resource that you're trying to remove the tags from.

  • resource_arn (S3ResourceArn) –

    The Amazon Resource Name (ARN) of the S3 resource that you're removing tags from. The tagged resource can be a directory bucket, S3 Storage Lens group or S3 Access Grants instance, registered location, or grant.

  • tag_keys (TagKeyList) –

    The array of tag key-value pairs that you're trying to remove from of the S3 resource.

Raises:

Source code in docs_src/capo_s3_control/_services/s3_control.py
def untag_resource(
    self,
    account_id: "capo_s3_control.types.account_id.AccountId",
    resource_arn: "capo_s3_control.types.s3_resource_arn.S3ResourceArn",
    tag_keys: "capo_s3_control.types.tag_key_list.TagKeyList",
    *,
    config_overrides: Optional[S3ControlClientConfig] = None,
) -> "capo_s3_control.types.untag_resource_result.UntagResourceResult":
    """<p>This operation removes the specified user-defined tags from an S3 resource. You can pass one or more tag keys. </p> <note> <p>This operation is only supported for the following Amazon S3 resources:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/buckets-tagging.html">General purpose buckets</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-db-tagging.html">Access Points for directory buckets</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-tagging.html">Access Points for general purpose buckets</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-tagging.html">Directory buckets</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-lens-groups.html">S3 Storage Lens groups</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-grants-tagging.html">S3 Access Grants instances, registered locations, and grants</a>.</p> </li> </ul> </note> <dl> <dt>Permissions</dt> <dd> <p>For general purpose buckets, access points for general purpose buckets, Storage Lens groups, and S3 Access Grants, you must have the <code>s3:UntagResource</code> permission to use this operation. </p> </dd> <dt>Directory bucket permissions</dt> <dd> <p>For directory buckets, you must have the <code>s3express:UntagResource</code> permission to use this operation. For more information about directory buckets policies and permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-permissions.html">Identity and Access Management (IAM) for S3 Express One Zone</a> in the <i>Amazon S3 User Guide</i>.</p> </dd> <dt>HTTP Host header syntax</dt> <dd> <p> <b>Directory buckets </b> - The HTTP Host header syntax is <code>s3express-control.<i>region</i>.amazonaws.com</code>.</p> </dd> </dl> <p>For information about S3 Tagging errors, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#S3TaggingErrorCodeList">List of Amazon S3 Tagging error codes</a>.</p>

    Args:
        account_id: <p> The Amazon Web Services account ID that owns the resource that you're trying to remove the tags from. </p>
        resource_arn: <p>The Amazon Resource Name (ARN) of the S3 resource that you're removing tags from. The tagged resource can be a directory bucket, S3 Storage Lens group or S3 Access Grants instance, registered location, or grant.</p>
        tag_keys: <p> The array of tag key-value pairs that you're trying to remove from of the S3 resource. </p>

    Raises:
        capo_s3_control.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_s3_control.types.untag_resource_request.UntagResourceRequest]",
    ) -> OperationResponse[
        "capo_s3_control.types.untag_resource_result.UntagResourceResult"
    ]:
        import capo_s3_control._operations.awss3_control_service_v20180820.untag_resource

        output, http_response = (
            capo_s3_control._operations.awss3_control_service_v20180820.untag_resource.untag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UntagResource")
    )
    input_: capo_s3_control.types.untag_resource_request.UntagResourceRequest = {
        "account_id": account_id,
        "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