Class PrincipalWithConditions
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.iam.PrincipalBase
software.amazon.awscdk.services.iam.PrincipalWithConditions
- All Implemented Interfaces:
IAssumeRolePrincipal,IComparablePrincipal,IGrantable,IPrincipal,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:29:57.365Z")
@Stability(Stable)
public class PrincipalWithConditions
extends PrincipalBase
An IAM principal with additional conditions specifying when the policy is in effect.
For more information about conditions, see: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.iam.*;
Object conditions;
IPrincipal principal;
PrincipalWithConditions principalWithConditions = new PrincipalWithConditions(principal, Map.of(
"conditionsKey", conditions));
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IAssumeRolePrincipal
IAssumeRolePrincipal.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IComparablePrincipal
IComparablePrincipal.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionPrincipalWithConditions(IPrincipal principal, Map<String, Object> conditions) protectedPrincipalWithConditions(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedPrincipalWithConditions(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCondition(String key, Object value) Add a condition to the principal.voidaddConditions(Map<String, Object> conditions) Adds multiple conditions to the principal.addToPolicy(PolicyStatement statement) Add to the policy of this principal.addToPrincipalPolicy(PolicyStatement statement) Add to the policy of this principal.protected StringappendDedupe(String append) Append the given string to the wrapped principal's dedupe string (if available).Return whether or not this principal is equal to the given principal.When this Principal is used in an AssumeRole policy, the action to use.The conditions under which the policy is in effect.Return the policy fragment that identifies this principal in a Policy.The AWS account ID of this principal.toJSON()JSON-ify the principal.toString()Returns a string representation of an object.Methods inherited from class software.amazon.awscdk.services.iam.PrincipalBase
addToAssumeRolePolicy, getGrantPrincipal, withConditions, withSessionTagsMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
PrincipalWithConditions
protected PrincipalWithConditions(software.amazon.jsii.JsiiObjectRef objRef) -
PrincipalWithConditions
protected PrincipalWithConditions(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
PrincipalWithConditions
@Stability(Stable) public PrincipalWithConditions(@NotNull IPrincipal principal, @NotNull Map<String, Object> conditions) - Parameters:
principal- This parameter is required.conditions- This parameter is required.
-
-
Method Details
-
addCondition
Add a condition to the principal.- Parameters:
key- This parameter is required.value- This parameter is required.
-
addConditions
Adds multiple conditions to the principal.Values from the conditions parameter will overwrite existing values with the same operator and key.
- Parameters:
conditions- This parameter is required.
-
addToPolicy
Add to the policy of this principal.- Specified by:
addToPolicyin interfaceIPrincipal- Overrides:
addToPolicyin classPrincipalBase- Parameters:
statement- This parameter is required.- Returns:
- true if the statement was added, false if the principal in question does not have a policy document to add the statement to.
-
addToPrincipalPolicy
@Stability(Stable) @NotNull public AddToPrincipalPolicyResult addToPrincipalPolicy(@NotNull PolicyStatement statement) Add to the policy of this principal.- Specified by:
addToPrincipalPolicyin interfaceIPrincipal- Overrides:
addToPrincipalPolicyin classPrincipalBase- Parameters:
statement- This parameter is required.
-
appendDedupe
Append the given string to the wrapped principal's dedupe string (if available).- Parameters:
append- This parameter is required.
-
dedupeString
Return whether or not this principal is equal to the given principal.- Specified by:
dedupeStringin interfaceIComparablePrincipal- Specified by:
dedupeStringin classPrincipalBase
-
toJSON
JSON-ify the principal.Used when JSON.stringify() is called
- Overrides:
toJSONin classPrincipalBase
-
toString
Returns a string representation of an object.- Overrides:
toStringin classPrincipalBase
-
getAssumeRoleAction
When this Principal is used in an AssumeRole policy, the action to use.- Specified by:
getAssumeRoleActionin interfaceIPrincipal- Overrides:
getAssumeRoleActionin classPrincipalBase
-
getConditions
The conditions under which the policy is in effect. -
getPolicyFragment
Return the policy fragment that identifies this principal in a Policy.- Specified by:
getPolicyFragmentin interfaceIPrincipal- Specified by:
getPolicyFragmentin classPrincipalBase
-
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:
getPrincipalAccountin interfaceIPrincipal- Overrides:
getPrincipalAccountin classPrincipalBase
-