Class CompositePrincipal
Represents a principal that has multiple types of principals.
Inherited Members
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(IPrincipal[]) | |
CompositePrincipal(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CompositePrincipal(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
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(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(IPrincipal[])
CompositePrincipal(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CompositePrincipal(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CompositePrincipal(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CompositePrincipal(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
AssumeRoleAction
When this Principal is used in an AssumeRole policy, the action to use.
public override string AssumeRoleAction { get; }
Property Value
System.String
Overrides
PolicyFragment
Return the policy fragment that identifies this principal in a Policy.
public override PrincipalPolicyFragment PolicyFragment { get; }
Property Value
Overrides
Principals
Returns the principals that make up the CompositePrincipal.
public virtual IPrincipal[] Principals { get; }
Property Value
Methods
AddPrincipals(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
Remarks
Composite principals cannot have conditions.
AddToAssumeRolePolicy(PolicyDocument)
Add the principal to the AssumeRolePolicyDocument.
public override void AddToAssumeRolePolicy(PolicyDocument doc)
Parameters
- doc PolicyDocument
Overrides
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
System.String
Overrides
ToString()
Returns a string representation of an object.
public override string ToString()
Returns
System.String