Help Center/ Object Storage Service/ API Reference/ APIs/ Advanced Bucket Settings/ Obtaining the Public Access Status of a Bucket Policy
Updated on 2026-03-06 GMT+08:00

Obtaining the Public Access Status of a Bucket Policy

Functions

This API obtains the public access status of an OBS bucket policy.

To perform this operation, you must have the GetBucketPolicyPublicStatus permission. The bucket owner can perform this operation by default and can grant this permission to others by using a bucket policy or a user policy.

Authorization Information

To call this API, you must be the bucket owner or have the permission to obtain the public access status of a bucket policy. You are advised to use IAM or bucket policies for authorization. For details about OBS authorization methods, see Differences Between OBS Permissions Control Methods.

  • If you use IAM for authorization, you need to use either role/policy-based authorization or identity policy-based authorization and configure the required permissions:
    • If you use role/policy-based authorization (IAM v3 APIs in the old IAM version), you need to grant the obs:bucket:GetBucketPolicyPublicStatus permission. For details, see Creating a Custom IAM Policy.
    • If you use identity policy-based authorization (IAM v5 APIs in the new IAM version), you need to grant the obs:bucket:getBucketPolicyPublicStatus permission, as shown in the following table. For details, see Creating a Custom IAM Identity Policy.

      Action

      Access Level

      Resource Type (*: Required)

      Condition Key

      Alias

      Dependencies

      obs:bucket:getBucketPolicyPublicStatus

      Read

      bucket *

      -

      -

      -

      • obs:EpochTime
      • obs:SourceIp
      • obs:TlsVersion
      • obs:CustomDomain
  • If you use bucket policies for authorization, you need to grant the obs:bucket:GetBucketPolicyPublicStatus permission. For details, see Creating a Custom Bucket Policy.

Request Syntax

GET /?policyStatus HTTP/1.1
Host: bucketname.obs.region.myhuaweicloud.com 
Date: date
Authorization: authorization
Content-Type: application/xml
Content-Length: length

Request Parameters

This request contains no parameters.

Request Headers

This request uses common headers. For details, see Table 3.

Request Elements

The request contains no elements.

Response Syntax

HTTP/1.1 status_code
Date: date
x-obs-request-id: 000001934E7A99E2530672D3A3903140
x-obs-id-2: 36AAAQAAEAABAAAQAAEAABAAAQAAEAABAAAaI=AAAAAAAAAAAAAAAAAAAAAAAAAA
Content-Length: length

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PolicyStatus xmlns="http://obs.myhwclouds.com/doc/2015-06-30/">
  <IsPublic>boolean</IsPublic>
</PolicyStatus>

Response Headers

This response uses common headers. For details, see Table 1.

Response Elements

This response contains elements to specify the public access status of the bucket policy. Table 1 describes the elements.

Table 1 Response Elements

Element

Type

Description

PolicyStatus

XML

Definition:

Public status of a bucket policy. It is the parent node of IsPublic.

IsPublic

Boolean

Definition:

Public access status of the bucket policy.

Range:

  • true: public
  • false: non-public

Error Responses

Table 2 describes possible special errors in this request.

Table 2 Error Responses

Error

Description

HTTP Status Code

NoSuchBucketPolicy

The bucket policy does not exist.

404

MethodNotAllowed

The involved method is not allowed (the corresponding feature is disabled).

405

For other errors, see Table 2.

Sample Request

GET /?policyStatus HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: Sat, 16 Nov 2024 08:59:07 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw=

Sample Response

HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: BF260000016435CE298386946AE4C482
x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUz
Date: Sat, 16 Nov 2024 08:59:08 GMT
Content-Length: 159

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PolicyStatus xmlns="http://obs.myhwclouds.com/doc/2015-06-30/">
  <IsPublic>false</IsPublic>
</NoSuchBucketPolicy>