在哪里可以找到 AWS 策略的类型(结构)定义?例如,对于这样的政策
firstly := "{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::amit",
"Condition": {
"StringLike": {
"s3:prefix": "Development/*"
}
}
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Resource": "arn:aws:s3:::amit/Development/*"
}
]
}
我目前正在执行以下操作来访问里面的字段:
var temp interface{}
json.Unmarshal([]byte(firstKey), &temp)
c := temp.(map[string]interface{})
fmt.Println(c)
#
map[Version:2012-10-17 Statement:[map[Resource:arn:aws:s3:::amit Condition:map[StringLike:map[s3:prefix:Development/*]] Sid:VisualEditor0 Effect:Allow Action:s3:ListBucket] map[Sid:VisualEditor1 Effect:Allow Action:[s3:PutObject s3:GetObject] Resource:arn:aws:s3:::amit/Development/*]]]
我想要一个像这样的结构
type Policy {
Version string,
Statement []blah
}
并且在解组时,能够像 Policy.Version 一样访问。