Show / Hide Table of Contents

Enum AccessLevel

The level of permissions granted to the CloudFront Distribution when configuring OAC.

Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public enum AccessLevel
Syntax (vb)
Public Enum AccessLevel
Remarks

ExampleMetadata: infused

Examples
// Create the simple Origin
            var myBucket = new Bucket(this, "myBucket");
            var s3Origin = S3BucketOrigin.WithOriginAccessControl(myBucket, new S3BucketOriginWithOACProps {
                OriginAccessLevels = new [] { AccessLevel.READ, AccessLevel.LIST }
            });

            // Create the Distribution construct
            var myMultiTenantDistribution = new Distribution(this, "distribution", new DistributionProps {
                DefaultBehavior = new BehaviorOptions {
                    Origin = s3Origin
                },
                DefaultRootObject = "index.html"
            });

            // Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
            var cfnDistribution = (CfnDistribution)myMultiTenantDistribution.Node.DefaultChild;

            var defaultCacheBehavior = new DefaultCacheBehaviorProperty {
                TargetOriginId = myBucket.BucketArn,
                ViewerProtocolPolicy = "allow-all",
                Compress = false,
                AllowedMethods = new [] { "GET", "HEAD" },
                CachePolicyId = CachePolicy.CACHING_OPTIMIZED.CachePolicyId
            };
            // Create the updated distributionConfig
            var distributionConfig = new DistributionConfigProperty {
                DefaultCacheBehavior = defaultCacheBehavior,
                Enabled = true,
                // the properties below are optional
                ConnectionMode = "tenant-only",
                Origins = new [] { new OriginProperty {
                    Id = myBucket.BucketArn,
                    DomainName = myBucket.BucketDomainName,
                    S3OriginConfig = new S3OriginConfigProperty { },
                    OriginPath = "/{{tenantName}}"
                } },
                TenantConfig = new TenantConfigProperty {
                    ParameterDefinitions = new [] { new ParameterDefinitionProperty {
                        Definition = new DefinitionProperty {
                            StringSchema = new StringSchemaProperty {
                                Required = false,
                                // the properties below are optional
                                Comment = "tenantName",
                                DefaultValue = "root"
                            }
                        },
                        Name = "tenantName"
                    } }
                }
            };

            // Override the distribution configuration to enable multi-tenancy.
            cfnDistribution.DistributionConfig = distributionConfig;

            // Create a distribution tenant using an existing ACM certificate
            var cfnDistributionTenant = new CfnDistributionTenant(this, "distribution-tenant", new CfnDistributionTenantProps {
                DistributionId = myMultiTenantDistribution.DistributionId,
                Domains = new [] { "my-tenant.my.domain.com" },
                Name = "my-tenant",
                Enabled = true,
                Parameters = new [] { new ParameterProperty {
                    Name = "tenantName",
                    Value = "app"
                } },
                Customizations = new CustomizationsProperty {
                    Certificate = new CertificateProperty {
                        Arn = "REPLACE_WITH_ARN"
                    }
                }
            });

Synopsis

Fields

DELETE

Grants delete permission to CloudFront Distribution.

LIST

Grants list permissions to CloudFront Distribution.

READ

Grants read permissions to CloudFront Distribution.

READ_VERSIONED

Grants versioned read permissions to CloudFront Distribution.

WRITE

Grants write permission to CloudFront Distribution.

Fields

Name Description
DELETE

Grants delete permission to CloudFront Distribution.

LIST

Grants list permissions to CloudFront Distribution.

READ

Grants read permissions to CloudFront Distribution.

READ_VERSIONED

Grants versioned read permissions to CloudFront Distribution.

WRITE

Grants write permission to CloudFront Distribution.

Back to top Generated by DocFX