本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/iam.IAM.GetGroupPolicy方法的典型用法代碼示例。如果您正苦於以下問題:Golang IAM.GetGroupPolicy方法的具體用法?Golang IAM.GetGroupPolicy怎麽用?Golang IAM.GetGroupPolicy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/aws/aws-sdk-go/service/iam.IAM
的用法示例。
在下文中一共展示了IAM.GetGroupPolicy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetGroupPolicy
func (g *Group) GetGroupPolicy(cli *iam.IAM, groupName, policyName string) {
//get-group-policy
req := &iam.GetGroupPolicyInput{
GroupName: aws.String(groupName),
PolicyName: aws.String(policyName),
}
resp, err := cli.GetGroupPolicy(req)
raiseError(err)
policyDocument := parsePolicyDocument(decodeUri(*resp.PolicyDocument))
if len(policyDocument.Statement) < 1 {
fmt.Printf("\"%s\", \"%s\", \"\"\n",
*resp.GroupName,
*resp.PolicyName,
)
}
for i := 0; i < len(policyDocument.Statement); i++ {
if len(policyDocument.Statement[i].Action) < 1 {
fmt.Printf("\"%s\", \"%s\", \"\"\n",
*resp.GroupName,
*resp.PolicyName,
)
}
for j := 0; j < len(policyDocument.Statement[i].Action); j++ {
fmt.Printf("\"%s\", \"%s\", \"%s\"\n",
*resp.GroupName,
*resp.PolicyName,
policyDocument.Statement[i].Action[j],
)
}
}
}