此操作用来查看账户中的管理事件。用户可以查看近6个月内发生的管理事件。
支持查询以下属性:
- OOS访问密钥。
- 管理事件ID。
- 管理事件名称。
- 管理事件来源。
- 是否只读。
- 资源名称。
- 资源类型。
- 子用户名。
所有的属性都是可选项,默认返回50个查询结果,一次最多只能返回50个结果,如果想查看其他结果,可以通过设置MaxResults和NextToken来进行查看。
请求参数
名称 描述 是否必须 StartTime 指定返回管理事件的起始时间。如果同时指定了起始时间和结束时间,则起始时间必须早于结束时间,否则将返回错误信息。
类型:时间戳
取值:unix时间戳(UTC),精确到毫秒。默认起始时间为距当前时间往前数的第184天。
如果起始时间晚于结束时间,会报错。
如果起始时间是早于当前时间184天之前的时间,则返回数据的起始时间为距当前时间往前数的第184天。
否 EndTime 指定返回管理事件的结束时间。如果同时指定了起始时间和结束时间,则起始时间必须早于结束时间,否则将返回错误信息。
类型:时间戳
取值:unix时间戳(UTC),精确到毫秒。默认结束时间为目前时间。
如果StartTime和EndTime都为早于当前时间184天前的时间,则返回距当前时间往前数的第184天那天的数据。
否 LookupAttributes 指定管理事件的查询属性。
类型:数组
取值:Attributekey和AttributeValue成对出现。
否 AttributeKey 指定查询管理事件的属性Key。
注意如果指定AttributeKey,每次只能指定一个AttributeKey,且取值唯一。
类型:字符串
取值:
EventId。
EventName。
ReadOnly。
UserName。
ResourceType。
ResourceName。
EventSource。
AccessKeyId。
否 AttributeValue 指定AttributeKey对应的值。
类型:字符串
取值:根据AttributeKey确定。其中ResourceName根据前缀匹配查询,区分大小写;EventId、UserName、EventName、ResourceType、EventSource、AccessKeyId全字匹配查询,并且区分大小写。
否 MaxResults 设置响应中最多返回的条数。如果存在超出您指定的返回项,响应结果中会返回NextToken的值。
类型:整数类型
取值:1-50,默认值为50。
否 NextToken 分页标识。还有需要返回的管理事件时,上条响应结果中会返回该参数。查看未显示项时,请求参数中需要携带此参数。
类型:字符串
取值:与上条响应结果中的参数值一样。
否
响应结果
| 名称 | 描述 |
|---|---|
| Events | 根据查询条件,返回的管理事件。 |
| NextToken | 分页标识。如果没有返回该值,则说明已经返回所有的查询结果。 |
请求示例
查询账户中的只读事件。
POST / HTTP/1.1
Authorization: SignatureValue
x-amz-date: 20240725T092748Z
x-amz-content-sha256: UNSIGNED-PAYLOAD
X-Amz-Target: cn.ctyunapi.oos-cn-cloudtrail.v20131101.CloudTrail_20131101.LookupEvents
Content-Type: application/json
Content-Length: 153
Host: oos-cn-cloudtrail.ctyunapi.cn
{
"MaxResults": 2,
"LookupAttributes": [
{
"AttributeKey": "ReadOnly",
"AttributeValue": "true"
}
]
}
响应示例
HTTP/1.1 200 OK
x-amz-request-id: f7d150a0f43b4681
Date: Thu, 25 Jul 2024 09:27:50 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 1498
Server:CTYUN
{
"NextToken": "1817854200671071211|7501472477088833290",
"Events": [
{
"CloudTrailEvent": {
"eventId": "7501472382852511156",
"eventVersion": "1.06",
"eventSource": "oos-cn-cloudtrail.ctyunapi.cn",
"requestParameters": {
"MaxResults": 2,
"LookupAttributes": [
{
"AttributeKey": "ReadOnly",
"AttributeValue": "true"
}
]
},
"userAgent": "PostmanRuntime/7.6.0",
"readOnly": true,
"userIdentity": {
"accessKeyId": "6c1ceb071a848d7d14d5",
"accountId": "0dt7bj6yazfmz",
"principalId": "0dt7bj6yazfmz",
"type": "Root",
"arn": "arn:ctyun:iam::0dt7bj6yazfmz:root"
},
"eventType": "ApiCall",
"serviceName": "CloudTrail",
"sourceIp": "10.183.14.70",
"requestId": "40a279e6142e4a3f",
"requestURL": "http://oos-cn-cloudtrail.ctyunapi.cn/",
"eventTime": "2024-07-25T09:27:34Z",
"eventName": "LookupEvents",
"requestRegion": "cn",
"managementEvent": true
}
},
{
"CloudTrailEvent": {
"eventId": "7501472428925466693",
"eventVersion": "1.06",
"eventSource": "oos-cn-cloudtrail.ctyunapi.cn",
"requestParameters": {
"LookupAttributes": [
{
"AttributeKey": "ReadOnly",
"AttributeValue": "true",
"MaxResults": 2
}
]
},
"userAgent": "PostmanRuntime/7.6.0",
"readOnly": true,
"userIdentity": {
"accessKeyId": "6c1ceb071a848d7d14d5",
"accountId": "0dt7bj6yazfmz",
"principalId": "0dt7bj6yazfmz",
"type": "Root",
"arn": "arn:ctyun:iam::0dt7bj6yazfmz:root"
},
"eventType": "ApiCall",
"serviceName": "CloudTrail",
"sourceIp": "10.183.14.70",
"requestId": "5730fff074354dd9",
"requestURL": "http://oos-cn-cloudtrail.ctyunapi.cn/",
"eventTime": "2024-07-25T09:26:47Z",
"eventName": "LookupEvents",
"requestRegion": "cn",
"managementEvent": true
}
}
]
}