Class CanonicalUserPrincipal

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.iam.PrincipalBase
software.amazon.awscdk.services.iam.CanonicalUserPrincipal
All Implemented Interfaces:
IAssumeRolePrincipal, IComparablePrincipal, IGrantable, IPrincipal, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-07-12T19:34:02.894Z") @Stability(Stable) public class CanonicalUserPrincipal extends PrincipalBase
A policy principal for canonicalUserIds - useful for S3 bucket policies that use Origin Access identities.

See https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html

and

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html

for more details.

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.*;
 CanonicalUserPrincipal canonicalUserPrincipal = new CanonicalUserPrincipal("canonicalUserId");
 
  • Constructor Details

    • CanonicalUserPrincipal

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

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

      @Stability(Stable) public CanonicalUserPrincipal(@NotNull String canonicalUserId)
      Parameters:
      canonicalUserId - unique identifier assigned by AWS for every account. This parameter is required.
  • Method Details

    • dedupeString

      @Stability(Stable) @Nullable public String dedupeString()
      Return whether or not this principal is equal to the given principal.
      Specified by:
      dedupeString in interface IComparablePrincipal
      Specified by:
      dedupeString in class PrincipalBase
    • toString

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

      @Stability(Stable) @NotNull public String getCanonicalUserId()
      unique identifier assigned by AWS for every account.

      root user and IAM users for an account all see the same ID. (i.e. 79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be)

    • getPolicyFragment

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