Obtaining Logging Configuration of a Bucket
API Description
You can use this API to obtain the logging configuration of a bucket.
Method Definition
ObsClient.getBucketLogging(bucketName)
Request Parameters
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
bucketName |
str |
Mandatory |
Bucket name |
Returned Results
|
Type |
Description |
|---|---|
|
SDK common result object |
|
GetResult.body Type |
Description |
|---|---|
|
Logging configuration information |
Sample Code
try:
resp = obsClient.getBucketLogging('bucketname')
if resp.status < 300:
print('requestId:', resp.requestId)
print('targetBucket:', resp.body.targetBucket)
print('targetPrefix:', resp.body.targetPrefix)
index = 1
for grant in resp.body.targetGrants:
print('grant [' + str(index) + ']')
print('grant_id:', grant.grantee.grantee_id)
print('grant_name:', grant.grantee.grantee_name)
print('group:', grant.grantee.group)
print('permission:', grant.permission)
index += 1
else:
print('errorCode:', resp.errorCode)
print('errorMessage:', resp.errorMessage)
except:
import traceback
print(traceback.format_exc())
Last Article: Configuring Logging for a Bucket
Next Article: Configuring a Bucket Policy
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.