Enables or disables access tracking for a bucket.
Precautions
To enable or disable access tracking for a bucket, you must have the oss:PutBucketAccessMonitor
permission. For more information, see Attach a custom policy to a RAM user.
Request syntax
PUT /?accessmonitor HTTP/1.1
Host: BucketName.oss.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
<?xml version="1.0" encoding="UTF-8"?>
<AccessMonitorConfiguration>
<Status>Enabled</Status>
</AccessMonitorConfiguration>
Request headers
This request contains only common request headers. For more information, see Common request headers.
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
AccessMonitorConfiguration | Container | Yes | N/A | The access tracking configuration of the bucket.
Child nodes: Status |
Status | String | Yes | Enabled | Specifies whether to enable access tracking for the bucket. Default value: Disabled.
Valid values:
Parent nodes: AccessMonitorConfiguration |
Response headers
This request contains only common response headers. For more information, see Common response headers.
Examples
PUT /?accessmonitor HTTP/1.1
Host: oss-example.oss.aliyuncs.com
Date: Mon, 26 Jul 2021 13:08:38 GMT
Authorization: OSS qn6qrrqxo2oawuk53otf****:ceOEyZavKY4QcjoUWYSpYbJ3****
<?xml version="1.0" encoding="UTF-8"?>
<AccessMonitorConfiguration>
<Status>Enabled</Status>
</AccessMonitorConfiguration>
HTTP/1.1 200 OK
x-oss-request-id: 5C1B138A109F4E405B2D****
Date: Mon, 26 Jul 2021 13:08:38 GMT
Content-Length: 0
Connection: keep-alive
Server: AliyunOSS
Error codes
Error code | HTTP status code | Description |
---|---|---|
MalformedXML | 400 | The error message returned because the access tracking state of the bucket is invalid. |
AccessMonitorDisableNotAllowed | 400 | The error message returned because the bucket has lifecycle rules configured based on the last access time. In this case, you cannot set the Status parameter to Disabled. |
AccessDenied | 403 | The error message returned because you are not authorized to access the bucket. |
NoSuchBucket | 404 | The error message returned because the bucket does not exist. |