Class AnyPrincipal

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

@Generated(value="jsii-pacmak/1.99.0 (build 8f757e4)", date="2024-06-13T18:49:19.822Z") @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