aws-cdk-lib.aws_iam.PrincipalPolicyFragment

class PrincipalPolicyFragment

LanguageType name
.NETAmazon.CDK.AWS.IAM.PrincipalPolicyFragment
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsiam#PrincipalPolicyFragment
Javasoftware.amazon.awscdk.services.iam.PrincipalPolicyFragment
Pythonaws_cdk.aws_iam.PrincipalPolicyFragment
TypeScript (source)aws-cdk-lib » aws_iam » PrincipalPolicyFragment

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

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': ['*'] }.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iam as iam } from 'aws-cdk-lib';

declare const conditions: any;
const principalPolicyFragment = new iam.PrincipalPolicyFragment({
  principalJsonKey: ['principalJson'],
}, /* all optional props */ {
  conditionsKey: conditions,
});

Initializer

new PrincipalPolicyFragment(principalJson: { [string]: string[] }, conditions?: { [string]: any })

Parameters

  • principalJson { [string]: string[] } — JSON of the "Principal" section in a policy statement.
  • conditions { [string]: any } — The conditions under which the policy is in effect.

Properties

NameTypeDescription
conditions{ [string]: any }The conditions under which the policy is in effect.
principalJson{ [string]: string[] }JSON of the "Principal" section in a policy statement.

conditions

Type: { [string]: any }

The conditions under which the policy is in effect.

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


principalJson

Type: { [string]: string[] }

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