@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:39.783Z") @Stability(value=Stable) public abstract class PrincipalBase extends software.amazon.jsii.JsiiObject implements IAssumeRolePrincipal, IComparablePrincipal
Example:
// Example automatically generated from non-compiling source. May contain errors.
CfnParameter tagParam = new CfnParameter(this, "TagName");
CfnJson stringEquals = CfnJson.Builder.create(this, "ConditionJson")
.value(Map.of(
String.format("aws:PrincipalTag/%s", tagParam.getValueAsString()), true))
.build();
PrincipalBase principal = new AccountRootPrincipal().withConditions(Map.of(
"StringEquals", stringEquals));
Role.Builder.create(this, "MyRole").assumedBy(principal).build();
software.amazon.jsii.JsiiObject.InitializationModeIAssumeRolePrincipal.Jsii$DefaultIComparablePrincipal.Jsii$Default| Modifier | Constructor and Description |
|---|---|
protected |
PrincipalBase() |
protected |
PrincipalBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
PrincipalBase(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addToAssumeRolePolicy(PolicyDocument document)
Add the princpial to the AssumeRolePolicyDocument.
|
Boolean |
addToPolicy(PolicyStatement statement)
Add to the policy of this principal.
|
AddToPrincipalPolicyResult |
addToPrincipalPolicy(PolicyStatement _statement)
Add to the policy of this principal.
|
abstract String |
dedupeString()
Return whether or not this principal is equal to the given principal.
|
String |
getAssumeRoleAction()
When this Principal is used in an AssumeRole policy, the action to use.
|
IPrincipal |
getGrantPrincipal()
The principal to grant permissions to.
|
abstract PrincipalPolicyFragment |
getPolicyFragment()
Return the policy fragment that identifies this principal in a Policy.
|
String |
getPrincipalAccount()
The AWS account ID of this principal.
|
Map<String,List<String>> |
toJSON()
JSON-ify the principal.
|
String |
toString()
Returns a string representation of an object.
|
PrincipalBase |
withConditions(Map<String,Object> conditions)
Returns a new PrincipalWithConditions using this principal as the base, with the passed conditions added.
|
PrincipalBase |
withSessionTags()
Returns a new principal using this principal as the base, with session tags enabled.
|
protected PrincipalBase(software.amazon.jsii.JsiiObjectRef objRef)
protected PrincipalBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) protected PrincipalBase()
@Stability(value=Stable)
public void addToAssumeRolePolicy(@NotNull
PolicyDocument document)
Add the statements to the AssumeRolePolicyDocument necessary to give this principal permissions to assume the given role.
addToAssumeRolePolicy in interface IAssumeRolePrincipaldocument - This parameter is required.@Stability(value=Stable) @NotNull public Boolean addToPolicy(@NotNull PolicyStatement statement)
statement - This parameter is required.@Stability(value=Stable) @NotNull public AddToPrincipalPolicyResult addToPrincipalPolicy(@NotNull PolicyStatement _statement)
addToPrincipalPolicy in interface IPrincipal_statement - This parameter is required.@Stability(value=Stable) @Nullable public abstract String dedupeString()
dedupeString in interface IComparablePrincipal@Stability(value=Stable) @NotNull public Map<String,List<String>> toJSON()
Used when JSON.stringify() is called
@Stability(value=Stable) @NotNull public String toString()
@Stability(value=Stable) @NotNull public PrincipalBase withConditions(@NotNull Map<String,Object> conditions)
When there is a value for the same operator and key in both the principal and the conditions parameter, the value from the conditions parameter will be used.
conditions - This parameter is required.@Stability(value=Stable) @NotNull public PrincipalBase withSessionTags()
@Stability(value=Stable) @NotNull public String getAssumeRoleAction()
getAssumeRoleAction in interface IPrincipal@Stability(value=Stable) @NotNull public IPrincipal getGrantPrincipal()
getGrantPrincipal in interface IGrantable@Stability(value=Stable) @NotNull public abstract PrincipalPolicyFragment getPolicyFragment()
getPolicyFragment in interface IPrincipal@Stability(value=Stable) @Nullable public String getPrincipalAccount()
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.
getPrincipalAccount in interface IPrincipalCopyright © 2022. All rights reserved.