Table of Contents

Class ArnPrincipal

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

Specify a principal by the Amazon Resource Name (ARN).

public class ArnPrincipal : PrincipalBase, IAssumeRolePrincipal, IComparablePrincipal, IPrincipal, IGrantable
Inheritance
ArnPrincipal
Implements
Derived
Inherited Members

Examples

NetworkLoadBalancer networkLoadBalancer1;
             NetworkLoadBalancer networkLoadBalancer2;


             new VpcEndpointService(this, "EndpointService", new VpcEndpointServiceProps {
                 VpcEndpointServiceLoadBalancers = new [] { networkLoadBalancer1, networkLoadBalancer2 },
                 AcceptanceRequired = true,
                 AllowedPrincipals = new [] { new ArnPrincipal("arn:aws:iam::123456789012:root") }
             });

Remarks

You can specify AWS accounts, IAM users, Federated SAML users, IAM roles, and specific assumed-role sessions. You cannot specify IAM groups or instance profiles as principals

See: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html

ExampleMetadata: infused

Constructors

ArnPrincipal(string)

public ArnPrincipal(string arn)

Parameters

arn string

Amazon Resource Name (ARN) of the principal entity (i.e. arn:aws:iam::123456789012:user/user-name).

Properties

Arn

Amazon Resource Name (ARN) of the principal entity (i.e. arn:aws:iam::123456789012:user/user-name).

public virtual string Arn { get; }

Property Value

string

PolicyFragment

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

public override PrincipalPolicyFragment PolicyFragment { get; }

Property Value

PrincipalPolicyFragment

Methods

DedupeString()

Return whether or not this principal is equal to the given principal.

public override string? DedupeString()

Returns

string

InOrganization(string)

A convenience method for adding a condition that the principal is part of the specified AWS Organization.

public virtual PrincipalBase InOrganization(string organizationId)

Parameters

organizationId string

Returns

PrincipalBase

ToString()

Returns a string representation of an object.

public override string ToString()

Returns

string