Updated on 2022-02-10 GMT+08:00
PUT Bucket policy
API Description
You can use this API to set a bucket policy. If the bucket already has a policy, the policy will be overwritten by the one specified in this request.
Method Definition
func (obsClient ObsClient) SetBucketPolicy(input *SetBucketPolicyInput) (output *BaseModel, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) SetBucketPolicyWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *BaseModel, err error)
Request Parameter
Field |
Type |
Optional or Mandatory |
---|---|---|
input |
Mandatory |
Returned Result
Field |
Type |
---|---|
output |
|
err |
error |
Sample Code
func main() { input := &obs.SetBucketPolicyInput{} input.Bucket = "bucketname" input.Policy = "your policy" output, err := obsClient.SetBucketPolicy(input) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Parent topic: Bucket-Related APIs
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot