Obtaining a Bucket's Encryption Configurations
API Description
You can use this API to obtain a bucket's encryption configurations.
Method Definition
func (obsClient ObsClient) GetBucketEncryption(bucketName string) (output *GetBucketEncryptionOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) GetBucketEncryptionWithSignedURL(signedURL string, actualSignedRequestHeaders http.Header) (output *GetBucketEncryptionOutput, err error)
Request Parameters
| Field | Type | Optional or Mandatory | Description |
|---|---|---|---|
| bucketName | string | Mandatory | Bucket name |
Returned Result
| Field | Type |
|---|---|
| output | |
| err | error |
Sample Code
var obsClient, _ = obs.New(ak, sk, endpoint, obs.WithSignature(obs.SignatureObs)) func main() // Obtain the encryption configurations of the specified bucket. output, err := obsClient.GetBucketEncryption("bucketName") if err == nil { fmt.Printf("Encryption:%s\n", outputGet.SSEAlgorithm) fmt.Printf("KeyID:%s\n", outputGet.KMSMasterKeyID) } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Last Article: Configuring Bucket Encryption
Next Article: Deleting a Bucket's Encryption Configurations
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.