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.103.1 (build bef2dea)",
date="2024-10-04T00:39:33.342Z")
@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.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
ModifierConstructorDescriptionPrincipalWithConditions
(IPrincipal principal, Map<String, Object> conditions) protected
PrincipalWithConditions
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
PrincipalWithConditions
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCondition
(String key, Object value) Add a condition to the principal.void
addConditions
(Map<String, Object> conditions) Adds multiple conditions to the principal.void
Add the principal to the AssumeRolePolicyDocument.addToPolicy
(PolicyStatement statement) Add to the policy of this principal.addToPrincipalPolicy
(PolicyStatement statement) Add to the policy of this principal.protected String
appendDedupe
(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
getGrantPrincipal, 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
-
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.
-
addToAssumeRolePolicy
Add the principal to the AssumeRolePolicyDocument.Add the statements to the AssumeRolePolicyDocument necessary to give this principal permissions to assume the given role.
- Specified by:
addToAssumeRolePolicy
in interfaceIAssumeRolePrincipal
- Overrides:
addToAssumeRolePolicy
in classPrincipalBase
- Parameters:
doc
- This parameter is required.
-
addToPolicy
Add to the policy of this principal.- Overrides:
addToPolicy
in classPrincipalBase
- Parameters:
statement
- This parameter is required.
-
addToPrincipalPolicy
@Stability(Stable) @NotNull public AddToPrincipalPolicyResult addToPrincipalPolicy(@NotNull PolicyStatement statement) Add to the policy of this principal.- Specified by:
addToPrincipalPolicy
in interfaceIPrincipal
- Overrides:
addToPrincipalPolicy
in 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:
dedupeString
in interfaceIComparablePrincipal
- Specified by:
dedupeString
in classPrincipalBase
-
toJSON
JSON-ify the principal.Used when JSON.stringify() is called
- Overrides:
toJSON
in classPrincipalBase
-
toString
Returns a string representation of an object.- Overrides:
toString
in classPrincipalBase
-
getAssumeRoleAction
When this Principal is used in an AssumeRole policy, the action to use.- Specified by:
getAssumeRoleAction
in interfaceIPrincipal
- Overrides:
getAssumeRoleAction
in 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:
getPolicyFragment
in interfaceIPrincipal
- Specified by:
getPolicyFragment
in 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:
getPrincipalAccount
in interfaceIPrincipal
- Overrides:
getPrincipalAccount
in classPrincipalBase
-