Class AccountPrincipal

All Implemented Interfaces:
IAssumeRolePrincipal, IComparablePrincipal, IGrantable, IPrincipal,
Direct Known Subclasses:

@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.


 DatabaseCluster cluster = DatabaseCluster.Builder.create(this, "Cluster")
 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( objRef)
    • AccountPrincipal

      protected AccountPrincipal( initializationMode)
    • AccountPrincipal

      @Stability(Stable) public AccountPrincipal(@NotNull Object accountId)
      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.
      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
      getPrincipalAccount in class PrincipalBase