updatePolicy

Updates an existing policy with a new name, description, or content. If you don't supply any parameter, that value remains unchanged. You can't change a policy's type.

This operation can be called only from the organization's management account or by a member account that is a delegated administrator for an Amazon Web Services service.

Samples


fun main() { 
   //sampleStart 
   // The following example shows how to rename a policy and give it a new description and new content.
// The output confirms the new name and description text n n
val resp = organizationsClient.updatePolicy {
    policyId = "p-examplepolicyid111"
    name = "Renamed-Policy"
    description = "This description replaces the original."
} 
   //sampleEnd
}

fun main() { 
   //sampleStart 
   // The following example shows how to replace the JSON text of the SCP from the preceding example with
// a new JSON policy text string that allows S3 actions instead of EC2 actions n n
val resp = organizationsClient.updatePolicy {
    policyId = "p-examplepolicyid111"
    content = "{ \\\"Version\\\": \\\"2012-10-17\\\", \\\"Statement\\\": {\\\"Effect\\\": \\\"Allow\\\", \\\"Action\\\": \\\"s3:*\\\", \\\"Resource\\\": \\\"*\\\" } }"
} 
   //sampleEnd
}