AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Container for the parameters to the UpdatePolicy operation. 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.
Namespace: Amazon.Organizations.Model
Assembly: AWSSDK.Organizations.dll
Version: 3.x.y.z
public class UpdatePolicyRequest : AmazonOrganizationsRequest IAmazonWebServiceRequest
The UpdatePolicyRequest type exposes the following members
Name | Description | |
---|---|---|
UpdatePolicyRequest() |
Name | Type | Description | |
---|---|---|---|
Content | System.String |
Gets and sets the property Content. If provided, the new content for the policy. The text must be correctly formatted JSON that complies with the syntax for the policy's type. For more information, see SCP syntax in the Organizations User Guide. The maximum size of a policy document depends on the policy's type. For more information, see Maximum and minimum values in the Organizations User Guide. |
|
Description | System.String |
Gets and sets the property Description. If provided, the new description for the policy. |
|
Name | System.String |
Gets and sets the property Name. If provided, the new name for the policy. The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range. |
|
PolicyId | System.String |
Gets and sets the property PolicyId. The unique identifier (ID) of the policy that you want to update. The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lowercase or uppercase letters, digits, or the underscore character (_). |
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
var client = new AmazonOrganizationsClient(); var response = client.UpdatePolicy(new UpdatePolicyRequest { Description = "This description replaces the original.", Name = "Renamed-Policy", PolicyId = "p-examplepolicyid111" }); Policy policy = response.Policy;
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
var client = new AmazonOrganizationsClient(); var response = client.UpdatePolicy(new UpdatePolicyRequest { Content = "{ \\"Version\\": \\"2012-10-17\\", \\"Statement\\": {\\"Effect\\": \\"Allow\\", \\"Action\\": \\"s3:*\\", \\"Resource\\": \\"*\\" } }", PolicyId = "p-examplepolicyid111" }); Policy policy = response.Policy;
.NET Core App:
Supported in: 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5, 4.0, 3.5