Class AccountPrincipal

java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IAssumeRolePrincipal, IComparablePrincipal, IGrantable, IPrincipal, software.amazon.jsii.JsiiSerializable
Direct Known Subclasses:
AccountRootPrincipal

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:29:57.219Z") @Stability(Stable) public class AccountPrincipal extends ArnPrincipal
Specify AWS account ID as the principal entity in a policy to delegate authority to the account.

Example:

 DatabaseCluster cluster = DatabaseCluster.Builder.create(this, "Cluster")
         .vpc(vpc)
         .instanceType(InstanceType.R5_LARGE)
         .iamAuthentication(true)
         .build();
 Role role = Role.Builder.create(this, "DBRole").assumedBy(new AccountPrincipal(this.account)).build();
 cluster.grantConnect(role);
 
  • Constructor Details

    • AccountPrincipal

      protected AccountPrincipal(software.amazon.jsii.JsiiObjectRef objRef)
    • AccountPrincipal

      protected AccountPrincipal(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • AccountPrincipal

      @Stability(Stable) public AccountPrincipal(@NotNull Object accountId)
      Parameters:
      accountId - AWS account ID (i.e. 123456789012). This parameter is required.
  • Method Details

    • toString

      @Stability(Stable) @NotNull public String toString()
      Returns a string representation of an object.
      Overrides:
      toString in class ArnPrincipal
    • getAccountId

      @Stability(Stable) @NotNull public Object getAccountId()
      AWS account ID (i.e. 123456789012).
    • getPrincipalAccount

      @Stability(Stable) @Nullable public String getPrincipalAccount()
      The AWS account ID of this principal.

      Can be undefined when the account is not known (for example, for service principals). Can be a Token - in that case, it's assumed to be AWS::AccountId.

      Specified by:
      getPrincipalAccount in interface IPrincipal
      Overrides:
      getPrincipalAccount in class PrincipalBase