PutTableBucketPolicy

更新时间:
复制 MD 格式

Sets a resource policy for a specified Table Bucket.

Usage notes

  • Resource policies use JSON strings in IAM policy format.

  • Use resource policies to grant cross-account access to a Table Bucket.

  • This operation overwrites any existing resource policy on the Table Bucket.

Permissions

API

Action

Description

PutTableBucketPolicy

oss:PutTableBucketPolicy

Sets a resource policy for a Table Bucket.

Request syntax

PUT /buckets/{tableBucketARN}/policy HTTP/1.1
Content-type: application/json
Host: cn-hangzhou.oss-tables.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

{
   "resourcePolicy": "string"
}

Request parameters

Parameter

Type

Required

Example

Description

tableBucketARN

string

Yes

acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket

The ARN of the Table Bucket. Format: acs:osstables:{region}:{accountId}:bucket/{bucketName}.

resourcePolicy

string

Yes

-

The resource policy as a JSON-escaped string in IAM policy format.

Example

Set a resource policy for a Table Bucket.

Sample request

PUT /buckets/acs%3Aosstables%3Acn-hangzhou%3A1234567890%3Abucket%2Fmy-table-bucket/policy HTTP/1.1
Content-Type: application/json
Host: cn-hangzhou.oss-tables.aliyuncs.com
Date: GMT Date
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/osstables/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c****

{
   "resourcePolicy": "{\"Version\":\"1\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"oss:GetTableBucket\"],\"Principal\":[\"1234567890\"],\"Resource\":[\"acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket\"]}]}"
}

Sample response

HTTP/1.1 200 OK
Server: AliyunOSS
x-oss-request-id: 5C06A3B67B8B5A3DA422****
x-oss-server-time: 3

SDKs

The following SDKs support this operation:

Ossutil command-line tool

The ossutil command for this operation is put-table-bucket-policy.

Error codes

Error code

HTTP status code

Description

BadRequestException

400

The request is invalid or malformed.

ForbiddenException

403

The caller is not authorized to perform this operation.

NotFoundException

404

The specified resource does not exist.