GET Bucket logging
API Description
You can use this API to obtain the access logging settings of a bucket.
Method Definition
func (obsClient ObsClient) GetBucketLoggingConfiguration(bucketName string) (output *GetBucketLoggingConfigurationOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) GetBucketLoggingConfigurationWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *GetBucketLoggingConfigurationOutput, err error)
Request Parameter
| Field | Type | Optional or Mandatory | Description |
|---|---|---|---|
| bucketName | string | Mandatory | Bucket name |
Returned Result
| Field | Type |
|---|---|
| output | |
| err | error |
Sample Code
func main() {
output, err := obsClient.GetBucketLoggingConfiguration("bucketname")
if err == nil {
fmt.Printf("RequestId:%s\n", output.RequestId)
fmt.Printf("TargetBucket:%s, TargetPrefix:%s\n", output.TargetBucket, output.TargetPrefix)
for index, grant := range output.TargetGrants {
fmt.Printf("Grant[%d]-Type:%s, ID:%s, URI:%s, Permission:%s\n", index, grant.Grantee.Type, grant.Grantee.ID, grant.Grantee.URI, grant.Permission)
}
} else {
if obsError, ok := err.(obs.ObsError); ok {
fmt.Println(obsError.Code)
fmt.Println(obsError.Message)
} else {
fmt.Println(err)
}
}
} Last Article: PUT Bucket logging
Next Article: PUT Bucket policy
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.