Class GeoRestriction
Controls the countries in which content is distributed.
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class GeoRestriction : DeputyBase
Syntax (vb)
Public Class GeoRestriction Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
// Adding restrictions to a Cloudfront Web Distribution.
Bucket sourceBucket;
new CloudFrontWebDistribution(this, "MyDistribution", new CloudFrontWebDistributionProps {
OriginConfigs = new [] { new SourceConfiguration {
S3OriginSource = new S3OriginConfig {
S3BucketSource = sourceBucket
},
Behaviors = new [] { new Behavior { IsDefaultBehavior = true } }
} },
GeoRestriction = GeoRestriction.Allowlist("US", "GB")
});
Synopsis
Properties
| Locations | Two-letter, uppercase country code for a country that you want to allow/deny. |
| RestrictionType | Specifies the restriction type to impose. |
Methods
| Allowlist(params string[]) | Allow specific countries which you want CloudFront to distribute your content. |
| Denylist(params string[]) | Deny specific countries which you don't want CloudFront to distribute your content. |
Properties
Locations
Two-letter, uppercase country code for a country that you want to allow/deny.
public virtual string[] Locations { get; }
Property Value
string[]
Remarks
Include one element for each country. See ISO 3166-1-alpha-2 code on the International Organization for Standardization website
RestrictionType
Specifies the restriction type to impose.
public virtual string RestrictionType { get; }
Property Value
Remarks
ExampleMetadata: infused
Methods
Allowlist(params string[])
Allow specific countries which you want CloudFront to distribute your content.
public static GeoRestriction Allowlist(params string[] locations)
Parameters
- locations string[]
Two-letter, uppercase country code for a country that you want to allow.
Returns
Remarks
ExampleMetadata: infused
Denylist(params string[])
Deny specific countries which you don't want CloudFront to distribute your content.
public static GeoRestriction Denylist(params string[] locations)
Parameters
- locations string[]
Two-letter, uppercase country code for a country that you want to deny.
Returns
Remarks
ExampleMetadata: infused