Class CompositePrincipal
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.iam.PrincipalBase
software.amazon.awscdk.services.iam.CompositePrincipal
- All Implemented Interfaces:
IAssumeRolePrincipal,IComparablePrincipal,IGrantable,IPrincipal,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T22:26:37.882Z")
@Stability(Stable)
public class CompositePrincipal
extends PrincipalBase
Represents a principal that has multiple types of principals.
A composite principal cannot have conditions. i.e. multiple ServicePrincipals that form a composite principal
Example:
Vpc vpc;
Role role = Role.Builder.create(this, "RDSDirectoryServicesRole")
.assumedBy(new CompositePrincipal(
new ServicePrincipal("rds.amazonaws.com"),
new ServicePrincipal("directoryservice.rds.amazonaws.com")))
.managedPolicies(List.of(ManagedPolicy.fromAwsManagedPolicyName("service-role/AmazonRDSDirectoryServiceAccess")))
.build();
DatabaseInstance instance = DatabaseInstance.Builder.create(this, "Instance")
.engine(DatabaseInstanceEngine.mysql(MySqlInstanceEngineProps.builder().version(MysqlEngineVersion.VER_8_0_19).build()))
.vpc(vpc)
.domain("d-????????") // The ID of the domain for the instance to join.
.domainRole(role)
.build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IAssumeRolePrincipal
IAssumeRolePrincipal.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IComparablePrincipal
IComparablePrincipal.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionCompositePrincipal(IPrincipal... principals) protectedCompositePrincipal(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCompositePrincipal(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionaddPrincipals(IPrincipal... principals) Adds IAM principals to the composite principal.voidAdd the principal to the AssumeRolePolicyDocument.Return whether or not this principal is equal to the given principal.When this Principal is used in an AssumeRole policy, the action to use.Return the policy fragment that identifies this principal in a Policy.Returns the principals that make up the CompositePrincipal.toString()Returns a string representation of an object.Methods inherited from class software.amazon.awscdk.services.iam.PrincipalBase
addToPolicy, addToPrincipalPolicy, getGrantPrincipal, getPrincipalAccount, toJSON, withConditions, withSessionTagsMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
CompositePrincipal
protected CompositePrincipal(software.amazon.jsii.JsiiObjectRef objRef) -
CompositePrincipal
protected CompositePrincipal(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CompositePrincipal
- Parameters:
principals- This parameter is required.
-
-
Method Details
-
addPrincipals
@Stability(Stable) @NotNull public CompositePrincipal addPrincipals(@NotNull IPrincipal... principals) Adds IAM principals to the composite principal.Composite principals cannot have conditions.
- Parameters:
principals- IAM principals that will be added to the composite principal. This parameter is required.
-
addToAssumeRolePolicy
Add the principal to the AssumeRolePolicyDocument.Add the statements to the AssumeRolePolicyDocument necessary to give this principal permissions to assume the given role.
- Specified by:
addToAssumeRolePolicyin interfaceIAssumeRolePrincipal- Overrides:
addToAssumeRolePolicyin classPrincipalBase- Parameters:
doc- This parameter is required.
-
dedupeString
Return whether or not this principal is equal to the given principal.- Specified by:
dedupeStringin interfaceIComparablePrincipal- Specified by:
dedupeStringin classPrincipalBase
-
toString
Returns a string representation of an object.- Overrides:
toStringin classPrincipalBase
-
getAssumeRoleAction
When this Principal is used in an AssumeRole policy, the action to use.- Specified by:
getAssumeRoleActionin interfaceIPrincipal- Overrides:
getAssumeRoleActionin classPrincipalBase
-
getPolicyFragment
Return the policy fragment that identifies this principal in a Policy.- Specified by:
getPolicyFragmentin interfaceIPrincipal- Specified by:
getPolicyFragmentin classPrincipalBase
-
getPrincipals
Returns the principals that make up the CompositePrincipal.
-