Class CompositePrincipal
Represents a principal that has multiple types of principals.
public class CompositePrincipal : PrincipalBase, IAssumeRolePrincipal, IComparablePrincipal, IPrincipal, IGrantable
- Inheritance
-
CompositePrincipal
- Implements
- Inherited Members
Examples
var role = new Role(this, "MyRole", new RoleProps {
AssumedBy = new CompositePrincipal(
new ServicePrincipal("ec2.amazonaws.com"),
new AccountPrincipal("1818188181818187272"))
});
Remarks
A composite principal cannot have conditions. i.e. multiple ServicePrincipals that form a composite principal
ExampleMetadata: infused
Constructors
CompositePrincipal(params IPrincipal[])
public CompositePrincipal(params IPrincipal[] principals)
Parameters
principals
IPrincipal[]
Properties
AssumeRoleAction
When this Principal is used in an AssumeRole policy, the action to use.
public override string AssumeRoleAction { get; }
Property Value
PolicyFragment
Return the policy fragment that identifies this principal in a Policy.
public override PrincipalPolicyFragment PolicyFragment { get; }
Property Value
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
Remarks
Composite principals cannot have conditions.
AddToAssumeRolePolicy(PolicyDocument)
Add the princpial to the AssumeRolePolicyDocument.
public override void AddToAssumeRolePolicy(PolicyDocument doc)
Parameters
doc
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
ToString()
Returns a string representation of an object.
public override string ToString()