Class UnknownPrincipal

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.iam.UnknownPrincipal
All Implemented Interfaces:
IGrantable, IPrincipal, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-07-12T19:34:03.004Z") @Stability(Stable) public class UnknownPrincipal extends software.amazon.jsii.JsiiObject implements IPrincipal
A principal for use in resources that need to have a role but it's unknown.

Some resources have roles associated with them which they assume, such as Lambda Functions, CodeBuild projects, StepFunctions machines, etc.

When those resources are imported, their actual roles are not always imported with them. When that happens, we use an instance of this class instead, which will add user warnings when statements are attempted to be added to it.

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.*;
 import software.constructs.*;
 Construct construct;
 UnknownPrincipal unknownPrincipal = UnknownPrincipal.Builder.create()
         .resource(construct)
         .build();
 
  • Constructor Details

    • UnknownPrincipal

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

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

      @Stability(Stable) public UnknownPrincipal(@NotNull UnknownPrincipalProps props)
      Parameters:
      props - This parameter is required.
  • Method Details

    • addToPolicy

      @Stability(Stable) @NotNull public Boolean addToPolicy(@NotNull PolicyStatement statement)
      Add to the policy of this principal.

      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 interface IPrincipal
      Parameters:
      statement - This parameter is required.
    • getAssumeRoleAction

      @Stability(Stable) @NotNull public String getAssumeRoleAction()
      When this Principal is used in an AssumeRole policy, the action to use.
      Specified by:
      getAssumeRoleAction in interface IPrincipal
    • getGrantPrincipal

      @Stability(Stable) @NotNull public IPrincipal getGrantPrincipal()
      The principal to grant permissions to.
      Specified by:
      getGrantPrincipal in interface IGrantable
    • getPolicyFragment

      @Stability(Stable) @NotNull public PrincipalPolicyFragment getPolicyFragment()
      Return the policy fragment that identifies this principal in a Policy.
      Specified by:
      getPolicyFragment in interface IPrincipal