Table of Contents

Class PrincipalPolicyFragment

Namespace
Amazon.CDK.AWS.IAM
Assembly
Amazon.CDK.AWS.IAM.dll

A collection of the fields in a PolicyStatement that can be used to identify a principal.

public class PrincipalPolicyFragment : DeputyBase
Inheritance
PrincipalPolicyFragment

Examples

// The code below shows an example of how to instantiate this type.
             // The values are placeholders you should change.
             using Amazon.CDK.AWS.IAM;

             var conditions;

             var principalPolicyFragment = new PrincipalPolicyFragment(new Dictionary<string, string[]> {
                 { "principalJsonKey", new [] { "principalJson" } }
             }, new Dictionary<string, object> {
                 { "conditionsKey", conditions }
             });

Remarks

This consists of the JSON used in the "Principal" field, and optionally a set of "Condition"s that need to be applied to the policy.

Generally, a principal looks like:

{ '<TYPE>': ['ID', 'ID', ...] }

And this is also the type of the field principalJson. However, there is a special type of principal that is just the string '', which is treated differently by some services. To represent that principal, principalJson should contain { 'LiteralString': [''] }.

ExampleMetadata: fixture=_generated

Constructors

PrincipalPolicyFragment(IDictionary<string, string[]>, IDictionary<string, object>?)

public PrincipalPolicyFragment(IDictionary<string, string[]> principalJson, IDictionary<string, object>? conditions = null)

Parameters

principalJson IDictionary<string, string[]>

JSON of the "Principal" section in a policy statement.

conditions IDictionary<string, object>

The conditions under which the policy is in effect.

Properties

Conditions

The conditions under which the policy is in effect.

public virtual IDictionary<string, object> Conditions { get; }

Property Value

IDictionary<string, object>

Remarks

See the IAM documentation. conditions that need to be applied to this policy

PrincipalJson

JSON of the "Principal" section in a policy statement.

public virtual IDictionary<string, string[]> PrincipalJson { get; }

Property Value

IDictionary<string, string[]>