Class CompositePrincipal

All Implemented Interfaces:
IAssumeRolePrincipal, IComparablePrincipal, IGrantable, IPrincipal,

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-17T05:10:12.059Z") @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


 Vpc vpc;
 Role role = Role.Builder.create(this, "RDSDirectoryServicesRole")
         .assumedBy(new CompositePrincipal(
         new ServicePrincipal(""),
         new ServicePrincipal("")))
 DatabaseInstance instance = DatabaseInstance.Builder.create(this, "Instance")
         .domain("d-????????") // The ID of the domain for the instance to join.
  • Constructor Details

    • CompositePrincipal

      protected CompositePrincipal( objRef)
    • CompositePrincipal

      protected CompositePrincipal( initializationMode)
    • CompositePrincipal

      @Stability(Stable) public CompositePrincipal(@NotNull @NotNull IPrincipal... principals)
      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.

      principals - IAM principals that will be added to the composite principal. This parameter is required.
    • addToAssumeRolePolicy

      @Stability(Stable) public void addToAssumeRolePolicy(@NotNull PolicyDocument doc)
      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 interface IAssumeRolePrincipal
      addToAssumeRolePolicy in class PrincipalBase
      doc - This parameter is required.
    • dedupeString

      @Stability(Stable) @Nullable public String dedupeString()
      Return whether or not this principal is equal to the given principal.
      Specified by:
      dedupeString in interface IComparablePrincipal
      Specified by:
      dedupeString in class PrincipalBase
    • toString

      @Stability(Stable) @NotNull public String toString()
      Returns a string representation of an object.
      toString in class PrincipalBase
    • getAssumeRoleAction

      @Stability(Stable) @NotNull public String getAssumeRoleAction()
      When this Principal is used in an AssumeRole policy, the action to use.
      Specified by:
      getAssumeRoleAction in interface IPrincipal
      getAssumeRoleAction in class PrincipalBase
    • getPolicyFragment

      @Stability(Stable) @NotNull public PrincipalPolicyFragment getPolicyFragment()
      Return the policy fragment that identifies this principal in a Policy.
      Specified by:
      getPolicyFragment in interface IPrincipal
      Specified by:
      getPolicyFragment in class PrincipalBase
    • getPrincipals

      @Stability(Stable) @NotNull public List<IPrincipal> getPrincipals()
      Returns the principals that make up the CompositePrincipal.