Show / Hide Table of Contents

Class CompositePrincipal

Represents a principal that has multiple types of principals.

Inheritance
object
PrincipalBase
CompositePrincipal
Implements
IAssumeRolePrincipal
IComparablePrincipal
IPrincipal
IGrantable
Inherited Members
PrincipalBase.AddToPolicy(PolicyStatement)
PrincipalBase.AddToPrincipalPolicy(PolicyStatement)
PrincipalBase.ToJSON()
PrincipalBase.WithConditions(IDictionary<string, object>)
PrincipalBase.WithSessionTags()
PrincipalBase.GrantPrincipal
PrincipalBase.PrincipalAccount
Namespace: Amazon.CDK.AWS.IAM
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CompositePrincipal : PrincipalBase, IAssumeRolePrincipal, IComparablePrincipal, IPrincipal, IGrantable
Syntax (vb)
Public Class CompositePrincipal Inherits PrincipalBase Implements IAssumeRolePrincipal, IComparablePrincipal, IPrincipal, IGrantable
Remarks

A composite principal cannot have conditions. i.e. multiple ServicePrincipals that form a composite principal

ExampleMetadata: infused

Examples
Vpc vpc;

             var role = new Role(this, "RDSDirectoryServicesRole", new RoleProps {
                 AssumedBy = new CompositePrincipal(
                 new ServicePrincipal("rds.amazonaws.com"),
                 new ServicePrincipal("directoryservice.rds.amazonaws.com")),
                 ManagedPolicies = new [] { ManagedPolicy.FromAwsManagedPolicyName("service-role/AmazonRDSDirectoryServiceAccess") }
             });
             var instance = new DatabaseInstance(this, "Instance", new DatabaseInstanceProps {
                 Engine = DatabaseInstanceEngine.Mysql(new MySqlInstanceEngineProps { Version = MysqlEngineVersion.VER_8_0_19 }),
                 Vpc = vpc,
                 Domain = "d-????????",  // The ID of the domain for the instance to join.
                 DomainRole = role
             });

Synopsis

Constructors

CompositePrincipal(params IPrincipal[])

Represents a principal that has multiple types of principals.

Properties

AssumeRoleAction

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

PolicyFragment

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

Principals

Returns the principals that make up the CompositePrincipal.

Methods

AddPrincipals(params IPrincipal[])

Adds IAM principals to the composite principal.

AddToAssumeRolePolicy(PolicyDocument)

Add the principal to the AssumeRolePolicyDocument.

DedupeString()

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

ToString()

Returns a string representation of an object.

Constructors

CompositePrincipal(params IPrincipal[])

Represents a principal that has multiple types of principals.

public CompositePrincipal(params IPrincipal[] principals)
Parameters
principals IPrincipal[]
Remarks

A composite principal cannot have conditions. i.e. multiple ServicePrincipals that form a composite principal

ExampleMetadata: infused

Examples
Vpc vpc;

             var role = new Role(this, "RDSDirectoryServicesRole", new RoleProps {
                 AssumedBy = new CompositePrincipal(
                 new ServicePrincipal("rds.amazonaws.com"),
                 new ServicePrincipal("directoryservice.rds.amazonaws.com")),
                 ManagedPolicies = new [] { ManagedPolicy.FromAwsManagedPolicyName("service-role/AmazonRDSDirectoryServiceAccess") }
             });
             var instance = new DatabaseInstance(this, "Instance", new DatabaseInstanceProps {
                 Engine = DatabaseInstanceEngine.Mysql(new MySqlInstanceEngineProps { Version = MysqlEngineVersion.VER_8_0_19 }),
                 Vpc = vpc,
                 Domain = "d-????????",  // The ID of the domain for the instance to join.
                 DomainRole = role
             });

Properties

AssumeRoleAction

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

public override string AssumeRoleAction { get; }
Property Value

string

Overrides
PrincipalBase.AssumeRoleAction
Remarks

A composite principal cannot have conditions. i.e. multiple ServicePrincipals that form a composite principal

ExampleMetadata: infused

PolicyFragment

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

public override PrincipalPolicyFragment PolicyFragment { get; }
Property Value

PrincipalPolicyFragment

Overrides
PrincipalBase.PolicyFragment
Remarks

A composite principal cannot have conditions. i.e. multiple ServicePrincipals that form a composite principal

ExampleMetadata: infused

Principals

Returns the principals that make up the CompositePrincipal.

public virtual IPrincipal[] Principals { get; }
Property Value

IPrincipal[]

Remarks

A composite principal cannot have conditions. i.e. multiple ServicePrincipals that form a composite principal

ExampleMetadata: infused

Methods

AddPrincipals(params IPrincipal[])

Adds IAM principals to the composite principal.

public virtual CompositePrincipal AddPrincipals(params IPrincipal[] principals)
Parameters
principals IPrincipal[]

IAM principals that will be added to the composite principal.

Returns

CompositePrincipal

Remarks

Composite principals cannot have conditions.

AddToAssumeRolePolicy(PolicyDocument)

Add the principal to the AssumeRolePolicyDocument.

public override void AddToAssumeRolePolicy(PolicyDocument doc)
Parameters
doc PolicyDocument
Overrides
PrincipalBase.AddToAssumeRolePolicy(PolicyDocument)
Remarks

Add the statements to the AssumeRolePolicyDocument necessary to give this principal permissions to assume the given role.

DedupeString()

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

public override string? DedupeString()
Returns

string

Overrides
PrincipalBase.DedupeString()
Remarks

A composite principal cannot have conditions. i.e. multiple ServicePrincipals that form a composite principal

ExampleMetadata: infused

ToString()

Returns a string representation of an object.

public override string ToString()
Returns

string

Overrides
PrincipalBase.ToString()
Remarks

A composite principal cannot have conditions. i.e. multiple ServicePrincipals that form a composite principal

ExampleMetadata: infused

Implements

IAssumeRolePrincipal
IComparablePrincipal
IPrincipal
IGrantable
Back to top Generated by DocFX