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.99.0 (build 8f757e4)", date="2024-06-13T18:49:19.820Z") @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();
 // Use one of the following statements to grant the role the necessary permissions
 cluster.grantConnect(role); // Grant the role neptune-db:* access to the DB
 cluster.grant(role, "neptune-db:ReadDataViaQuery", "neptune-db:WriteDataViaQuery");
 
  • 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