Class AnyPrincipal

java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IAssumeRolePrincipal, IComparablePrincipal, IGrantable, IPrincipal, software.amazon.jsii.JsiiSerializable
Direct Known Subclasses:
Anyone

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:29:57.222Z") @Stability(Stable) public class AnyPrincipal extends ArnPrincipal
A principal representing all AWS identities in all accounts.

Some services behave differently when you specify Principal: '*' or Principal: { AWS: "*" } in their resource policy.

AnyPrincipal renders to Principal: { AWS: "*" }. This is correct most of the time, but in cases where you need the other principal, use StarPrincipal instead.

Example:

 Topic topic = new Topic(this, "Topic");
 TopicPolicy topicPolicy = TopicPolicy.Builder.create(this, "TopicPolicy")
         .topics(List.of(topic))
         .build();
 topicPolicy.document.addStatements(PolicyStatement.Builder.create()
         .actions(List.of("sns:Subscribe"))
         .principals(List.of(new AnyPrincipal()))
         .resources(List.of(topic.getTopicArn()))
         .build());
 
  • Constructor Details

    • AnyPrincipal

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

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

      @Stability(Stable) public AnyPrincipal()
  • Method Details

    • toString

      @Stability(Stable) @NotNull public String toString()
      Returns a string representation of an object.
      Overrides:
      toString in class ArnPrincipal