Table of Contents

Class UnknownPrincipal

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

A principal for use in resources that need to have a role but it's unknown.

public class UnknownPrincipal : DeputyBase, IPrincipal, IGrantable
Inheritance
UnknownPrincipal
Implements

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;
             using Constructs;

             Construct construct;

             var unknownPrincipal = new UnknownPrincipal(new UnknownPrincipalProps {
                 Resource = construct
             });

Remarks

Some resources have roles associated with them which they assume, such as Lambda Functions, CodeBuild projects, StepFunctions machines, etc.

When those resources are imported, their actual roles are not always imported with them. When that happens, we use an instance of this class instead, which will add user warnings when statements are attempted to be added to it.

ExampleMetadata: fixture=_generated

Constructors

UnknownPrincipal(IUnknownPrincipalProps)

public UnknownPrincipal(IUnknownPrincipalProps props)

Parameters

props IUnknownPrincipalProps

Properties

AssumeRoleAction

When this Principal is used in an AssumeRole policy, the action to use.

public virtual string AssumeRoleAction { get; }

Property Value

string

GrantPrincipal

The principal to grant permissions to.

public virtual IPrincipal GrantPrincipal { get; }

Property Value

IPrincipal

PolicyFragment

Return the policy fragment that identifies this principal in a Policy.

public virtual PrincipalPolicyFragment PolicyFragment { get; }

Property Value

PrincipalPolicyFragment

Methods

AddToPolicy(PolicyStatement)

Add to the policy of this principal.

public virtual bool AddToPolicy(PolicyStatement statement)

Parameters

statement PolicyStatement

Returns

bool

AddToPrincipalPolicy(PolicyStatement)

Add to the policy of this principal.

public virtual IAddToPrincipalPolicyResult AddToPrincipalPolicy(PolicyStatement statement)

Parameters

statement PolicyStatement

Returns

IAddToPrincipalPolicyResult