putGroupPolicy
inline suspend fun IamClient.putGroupPolicy(crossinline block: PutGroupPolicyRequest.Builder.() -> Unit): PutGroupPolicyResponse
Adds or updates an inline policy document that is embedded in the specified IAM group.
A user can also have managed policies attached to it. To attach a managed policy to a group, use AttachGroupPolicy
. To create a new managed policy, use CreatePolicy
. For information about policies, see Managed policies and inline policies in the IAM User Guide.
For information about the maximum number of inline policies that you can embed in a group, see IAM and STS quotas in the IAM User Guide.
Because policy documents can be large, you should use POST rather than GET when calling PutGroupPolicy
. For general information about using the Query API with IAM, see Making query requests in the IAM User Guide.
Samples
fun main() {
//sampleStart
// The following command adds a policy named IAMReadAccess to the IAM group named PowerUsers.
iamClient.putGroupPolicy {
groupName = "PowerUsers"
policyName = "IAMReadAccess"
policyDocument = "{\"Version\":\"2012-10-17\",\"Statement\":{\"Effect\":\"Allow\",\"Action\":[\"iam:Get*\",\"iam:List*\",\"iam:Generate*\"],\"Resource\":\"*\"}}"
}
//sampleEnd
}