Class GeoRestriction
Controls the countries in which content is distributed.
Inheritance
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
Constructors
GeoRestriction(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
GeoRestriction(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
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(String[]) | Allow specific countries which you want CloudFront to distribute your content. |
Denylist(String[]) | Deny specific countries which you don't want CloudFront to distribute your content. |
Constructors
GeoRestriction(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected GeoRestriction(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
GeoRestriction(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected GeoRestriction(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Locations
Two-letter, uppercase country code for a country that you want to allow/deny.
public virtual string[] Locations { get; }
Property Value
System.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
System.String
Methods
Allowlist(String[])
Allow specific countries which you want CloudFront to distribute your content.
public static GeoRestriction Allowlist(params string[] locations)
Parameters
- locations System.String[]
Two-letter, uppercase country code for a country that you want to allow.
Returns
Denylist(String[])
Deny specific countries which you don't want CloudFront to distribute your content.
public static GeoRestriction Denylist(params string[] locations)
Parameters
- locations System.String[]
Two-letter, uppercase country code for a country that you want to deny.
Returns