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.104.0 (build e79254c)",
date="2024-11-27T16:50:58.654Z")
@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.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IAssumeRolePrincipal
IAssumeRolePrincipal.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IComparablePrincipal
IComparablePrincipal.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionCompositePrincipal
(@NotNull IPrincipal... principals) protected
CompositePrincipal
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CompositePrincipal
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionaddPrincipals
(@NotNull IPrincipal... principals) Adds IAM principals to the composite principal.void
Add 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, withSessionTags
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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 @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:
addToAssumeRolePolicy
in interfaceIAssumeRolePrincipal
- Overrides:
addToAssumeRolePolicy
in classPrincipalBase
- Parameters:
doc
- This parameter is required.
-
dedupeString
Return whether or not this principal is equal to the given principal.- Specified by:
dedupeString
in interfaceIComparablePrincipal
- Specified by:
dedupeString
in classPrincipalBase
-
toString
Returns a string representation of an object.- Overrides:
toString
in classPrincipalBase
-
getAssumeRoleAction
When this Principal is used in an AssumeRole policy, the action to use.- Specified by:
getAssumeRoleAction
in interfaceIPrincipal
- Overrides:
getAssumeRoleAction
in classPrincipalBase
-
getPolicyFragment
Return the policy fragment that identifies this principal in a Policy.- Specified by:
getPolicyFragment
in interfaceIPrincipal
- Specified by:
getPolicyFragment
in classPrincipalBase
-
getPrincipals
Returns the principals that make up the CompositePrincipal.
-