Enum AccessLevel

java.lang.Object
java.lang.Enum<AccessLevel>
software.amazon.awscdk.services.cloudfront.AccessLevel
All Implemented Interfaces:
Serializable, Comparable<AccessLevel>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.112.0 (build de1bc80)", date="2025-08-06T18:14:33.740Z") @Stability(Stable) public enum AccessLevel extends Enum<AccessLevel>
The level of permissions granted to the CloudFront Distribution when configuring OAC.

Example:

 // Create the simple Origin
 Bucket myBucket = new Bucket(this, "myBucket");
 IOrigin s3Origin = S3BucketOrigin.withOriginAccessControl(myBucket, S3BucketOriginWithOACProps.builder()
         .originAccessLevels(List.of(AccessLevel.READ, AccessLevel.LIST))
         .build());
 // Create the Distribution construct
 Distribution myMultiTenantDistribution = Distribution.Builder.create(this, "distribution")
         .defaultBehavior(BehaviorOptions.builder()
                 .origin(s3Origin)
                 .build())
         .defaultRootObject("index.html")
         .build();
 // Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
 CfnDistribution cfnDistribution = (CfnDistribution)myMultiTenantDistribution.getNode().getDefaultChild();
 DefaultCacheBehaviorProperty defaultCacheBehavior = DefaultCacheBehaviorProperty.builder()
         .targetOriginId(myBucket.getBucketArn())
         .viewerProtocolPolicy("allow-all")
         .compress(false)
         .allowedMethods(List.of("GET", "HEAD"))
         .cachePolicyId(CachePolicy.CACHING_OPTIMIZED.getCachePolicyId())
         .build();
 // Create the updated distributionConfig
 DistributionConfigProperty distributionConfig = DistributionConfigProperty.builder()
         .defaultCacheBehavior(defaultCacheBehavior)
         .enabled(true)
         // the properties below are optional
         .connectionMode("tenant-only")
         .origins(List.of(OriginProperty.builder()
                 .id(myBucket.getBucketArn())
                 .domainName(myBucket.getBucketDomainName())
                 .s3OriginConfig(S3OriginConfigProperty.builder().build())
                 .originPath("/{{tenantName}}")
                 .build()))
         .tenantConfig(TenantConfigProperty.builder()
                 .parameterDefinitions(List.of(ParameterDefinitionProperty.builder()
                         .definition(DefinitionProperty.builder()
                                 .stringSchema(StringSchemaProperty.builder()
                                         .required(false)
                                         // the properties below are optional
                                         .comment("tenantName")
                                         .defaultValue("root")
                                         .build())
                                 .build())
                         .name("tenantName")
                         .build()))
                 .build())
         .build();
 // Override the distribution configuration to enable multi-tenancy.
 cfnDistribution.getDistributionConfig() = distributionConfig;
 // Create a distribution tenant using an existing ACM certificate
 CfnDistributionTenant cfnDistributionTenant = CfnDistributionTenant.Builder.create(this, "distribution-tenant")
         .distributionId(myMultiTenantDistribution.getDistributionId())
         .domains(List.of("my-tenant.my.domain.com"))
         .name("my-tenant")
         .enabled(true)
         .parameters(List.of(ParameterProperty.builder()
                 .name("tenantName")
                 .value("app")
                 .build()))
         .customizations(CustomizationsProperty.builder()
                 .certificate(CertificateProperty.builder()
                         .arn("REPLACE_WITH_ARN")
                         .build())
                 .build())
         .build();
 
  • Enum Constant Details

    • READ

      @Stability(Stable) public static final AccessLevel READ
      Grants read permissions to CloudFront Distribution.
    • READ_VERSIONED

      @Stability(Stable) public static final AccessLevel READ_VERSIONED
      Grants versioned read permissions to CloudFront Distribution.
    • LIST

      @Stability(Stable) public static final AccessLevel LIST
      Grants list permissions to CloudFront Distribution.
    • WRITE

      @Stability(Stable) public static final AccessLevel WRITE
      Grants write permission to CloudFront Distribution.
    • DELETE

      @Stability(Stable) public static final AccessLevel DELETE
      Grants delete permission to CloudFront Distribution.
  • Method Details

    • values

      public static AccessLevel[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static AccessLevel valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null