AWS SDK Version 3 for .NET
API Reference

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. Modifies a Cedar static policy in the specified policy store. You can change only certain elements of the UpdatePolicyDefinition parameter. You can directly update only static policies. To change a template-linked policy, you must update the template instead, using UpdatePolicyTemplate.

Verified Permissions is eventually consistent. It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.VerifiedPermissions.AmazonVerifiedPermissionsRequest
      Amazon.VerifiedPermissions.Model.UpdatePolicyRequest

Namespace: Amazon.VerifiedPermissions.Model
Assembly: AWSSDK.VerifiedPermissions.dll
Version: 3.x.y.z

Syntax

C#
public class UpdatePolicyRequest : AmazonVerifiedPermissionsRequest
         IAmazonWebServiceRequest

The UpdatePolicyRequest type exposes the following members

Constructors

NameDescription
Public Method UpdatePolicyRequest()

Properties

NameTypeDescription
Public Property Definition Amazon.VerifiedPermissions.Model.UpdatePolicyDefinition

Gets and sets the property Definition.

Specifies the updated policy content that you want to replace on the specified policy. The content must be valid Cedar policy language text.

If you don't specify this parameter, the existing policy definition remains unchanged.

You can change only the following elements from the policy definition:

  • The action referenced by the policy.

  • Any conditional clauses, such as when or unless clauses.

You can't change the following elements:

  • Changing from static to templateLinked.

  • Changing the effect of the policy from permit or forbid.

  • The principal referenced by the policy.

  • The resource referenced by the policy.

Public Property Name System.String

Gets and sets the property Name.

Specifies a name for the policy that is unique among all policies within the policy store. You can use the name in place of the policy ID in API operations that reference the policy. The name must be prefixed with name/.

If you don't include the name in an update request, the existing name is unchanged. To remove a name, set it to an empty string ("").

If you specify a name that is already associated with another policy in the policy store, you receive a ConflictException error.

Public Property PolicyId System.String

Gets and sets the property PolicyId.

Specifies the ID of the policy that you want to update. To find this value, you can use ListPolicies.

You can use the policy name in place of the policy ID. When using a name, prefix it with name/. For example:

  • ID: SPEXAMPLEabcdefg111111

  • Name: name/example-policy

Public Property PolicyStoreId System.String

Gets and sets the property PolicyStoreId.

Specifies the ID of the policy store that contains the policy that you want to update.

To specify a policy store, use its ID or alias name. When using an alias name, prefix it with policy-store-alias/. For example:

  • ID: PSEXAMPLEabcdefg111111

  • Alias name: policy-store-alias/example-policy-store

To view aliases, use ListPolicyStoreAliases.

Examples

The following example replaces the definition of the specified static policy with a new one.

UpdatePolicy


var client = new AmazonVerifiedPermissionsClient();
var response = client.BatchGetPolicy(new BatchGetPolicyRequest 
{
    Requests = new List<BatchGetPolicyInputItem> {
        new BatchGetPolicyInputItem {
            PolicyId = "PWv5M6d5HePx3gVVLKY1nK",
            PolicyStoreId = "ERZeDpRc34dkYZeb6FZRVC"
        },
        new BatchGetPolicyInputItem {
            PolicyId = "LzFn6KgLWvv4Mbegus35jn",
            PolicyStoreId = "ERZeDpRc34dkYZeb6FZRVC"
        },
        new BatchGetPolicyInputItem {
            PolicyId = "77gLjer8H5o3mvrnMGrSL5",
            PolicyStoreId = "ERZeDpRc34dkYZeb6FZRVC"
        }
    }
});

List<BatchGetPolicyErrorItem> errors = response.Errors;
List<BatchGetPolicyOutputItem> results = response.Results;

            

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5