Class AccountPrincipal
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.iam.PrincipalBase
software.amazon.awscdk.services.iam.ArnPrincipal
software.amazon.awscdk.services.iam.AccountPrincipal
- All Implemented Interfaces:
IAssumeRolePrincipal
,IComparablePrincipal
,IGrantable
,IPrincipal
,software.amazon.jsii.JsiiSerializable
- Direct Known Subclasses:
AccountRootPrincipal
@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)",
date="2024-10-11T15:55:59.927Z")
@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");
-
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
ModifierConstructorDescriptionAccountPrincipal
(Object accountId) protected
AccountPrincipal
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
AccountPrincipal
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionAWS account ID (i.e.The AWS account ID of this principal.toString()
Returns a string representation of an object.Methods inherited from class software.amazon.awscdk.services.iam.ArnPrincipal
dedupeString, getArn, getPolicyFragment, inOrganization
Methods inherited from class software.amazon.awscdk.services.iam.PrincipalBase
addToAssumeRolePolicy, addToPolicy, addToPrincipalPolicy, getAssumeRoleAction, getGrantPrincipal, 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
-
AccountPrincipal
protected AccountPrincipal(software.amazon.jsii.JsiiObjectRef objRef) -
AccountPrincipal
protected AccountPrincipal(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
AccountPrincipal
- Parameters:
accountId
- AWS account ID (i.e. '123456789012'). This parameter is required.
-
-
Method Details
-
toString
Returns a string representation of an object.- Overrides:
toString
in classArnPrincipal
-
getAccountId
AWS account ID (i.e. '123456789012'). -
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 interfaceIPrincipal
- Overrides:
getPrincipalAccount
in classPrincipalBase
-