Set a Table Bucket policy

更新时间:
复制 MD 格式

Sets the resource policy for a Table Bucket.

Usage notes

  • A new resource policy overwrites any existing policy on the Table Bucket. To modify a policy, first retrieve the current policy using the get-table-bucket-policy command, make your changes, and then apply the updated policy.

Command syntax

ossutil tables-api put-table-bucket-policy --table-bucket-arn value --resource-policy value [flags]

Parameter

Type

Description

--table-bucket-arn

string

The ARN of the Table Bucket. The format is acs:osstables:{region}:{accountId}:bucket/{name}.

--resource-policy

string

A JSON-formatted string that defines access controls for the Table Bucket. The policy uses fields such as Version and Statement.

Note

--resource-policy

The --resource-policy option supports the following JSON syntax:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": "osstables:*",
      "Resource": "acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket"
    }
  ]
}

Examples

  • Allow all users to perform all operations on a Table Bucket using a JSON argument.

    ossutil tables-api put-table-bucket-policy --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --resource-policy '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":"*","Action":"osstables:*","Resource":"acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket"}]}'
  • Set a read-only access policy using a configuration file. The readonly-policy.json file contains the following content:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": "*",
          "Action": "osstables:GetTable",
          "Resource": "acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket"
        }
      ]
    }

    Example command:

    ossutil tables-api put-table-bucket-policy --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --resource-policy file://readonly-policy.json