Class PrincipalPolicyFragment

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.iam.PrincipalPolicyFragment
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:02.815Z") @Stability(Stable) public class PrincipalPolicyFragment extends software.amazon.jsii.JsiiObject
A collection of the fields in a PolicyStatement that can be used to identify a principal.

This consists of the JSON used in the "Principal" field, and optionally a set of "Condition"s that need to be applied to the policy.

Generally, a principal looks like:

 { '<TYPE>': ['ID', 'ID', ...] }
 

And this is also the type of the field principalJson. However, there is a special type of principal that is just the string '*', which is treated differently by some services. To represent that principal, principalJson should contain { 'LiteralString': ['*'] }.

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;
 PrincipalPolicyFragment principalPolicyFragment = new PrincipalPolicyFragment(Map.of(
         "principalJsonKey", List.of("principalJson")), Map.of(
         "conditionsKey", conditions));
 
  • Constructor Details

    • PrincipalPolicyFragment

      protected PrincipalPolicyFragment(software.amazon.jsii.JsiiObjectRef objRef)
    • PrincipalPolicyFragment

      protected PrincipalPolicyFragment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • PrincipalPolicyFragment

      @Stability(Stable) public PrincipalPolicyFragment(@NotNull Map<String,List<String>> principalJson, @Nullable Map<String,Object> conditions)
      Parameters:
      principalJson - JSON of the "Principal" section in a policy statement. This parameter is required.
      conditions - The conditions under which the policy is in effect.
    • PrincipalPolicyFragment

      @Stability(Stable) public PrincipalPolicyFragment(@NotNull Map<String,List<String>> principalJson)
      Parameters:
      principalJson - JSON of the "Principal" section in a policy statement. This parameter is required.
  • Method Details

    • getConditions

      @Stability(Stable) @NotNull public Map<String,Object> getConditions()
      The conditions under which the policy is in effect.

      See the IAM documentation. conditions that need to be applied to this policy

    • getPrincipalJson

      @Stability(Stable) @NotNull public Map<String,List<String>> getPrincipalJson()
      JSON of the "Principal" section in a policy statement.