Skip to content
v2.278.0

RestrictionsProperty Struct ​

A complex type that identifies ways in which you want to restrict distribution of your content.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
const restrictionsProperty: cloudfront.CfnDistribution.RestrictionsProperty = {
  geoRestriction: {
    restrictionType: 'restrictionType',

    // the properties below are optional
    locations: ['locations'],
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudfront as cloudfront

restrictions_property = cloudfront.CfnDistribution.RestrictionsProperty(
    geo_restriction=cloudfront.CfnDistribution.GeoRestrictionProperty(
        restriction_type="restrictionType",

        # the properties below are optional
        locations=["locations"]
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudfront.*;

RestrictionsProperty restrictionsProperty = RestrictionsProperty.builder()
        .geoRestriction(GeoRestrictionProperty.builder()
                .restrictionType("restrictionType")

                // the properties below are optional
                .locations(List.of("locations"))
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;

var restrictionsProperty = new RestrictionsProperty {
    GeoRestriction = new GeoRestrictionProperty {
        RestrictionType = "restrictionType",

        // the properties below are optional
        Locations = new [] { "locations" }
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

restrictionsProperty := &RestrictionsProperty{
	GeoRestriction: &GeoRestrictionProperty{
		RestrictionType: jsii.String("restrictionType"),

		// the properties below are optional
		Locations: []*string{
			jsii.String("locations"),
		},
	},
}

Properties ​

geoRestrictionIResolvable | CfnDistribution.GeoRestrictionPropertygeo_restrictiontyping.Union[IResolvable, GeoRestrictionProperty]geoRestrictionIResolvableGeoRestrictionIResolvableGeoRestrictioninterface{} required #
A complex type that controls the countries in which your content is distributed.
notes

CloudFront determines the location of your users using MaxMind GeoIP databases. To disable geo restriction, remove the Restrictions property from your stack template.