Class GeoRestriction

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.cloudfront.GeoRestriction
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:43.690Z") @Stability(Stable) public class GeoRestriction extends software.amazon.jsii.JsiiObject
Controls the countries in which content is distributed.

Example:

 // Adding restrictions to a Cloudfront Web Distribution.
 Bucket sourceBucket;
 CloudFrontWebDistribution.Builder.create(this, "MyDistribution")
         .originConfigs(List.of(SourceConfiguration.builder()
                 .s3OriginSource(S3OriginConfig.builder()
                         .s3BucketSource(sourceBucket)
                         .build())
                 .behaviors(List.of(Behavior.builder().isDefaultBehavior(true).build()))
                 .build()))
         .geoRestriction(GeoRestriction.allowlist("US", "GB"))
         .build();
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    GeoRestriction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    GeoRestriction(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    allowlist(@NotNull String... locations)
    Allow specific countries which you want CloudFront to distribute your content.
    blacklist(@NotNull String... locations)
    Deprecated.
    use denylist
    denylist(@NotNull String... locations)
    Deny specific countries which you don't want CloudFront to distribute your content.
    Two-letter, uppercase country code for a country that you want to allow/deny.
    Specifies the restriction type to impose.
    whitelist(@NotNull String... locations)
    Deprecated.
    use allowlist

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • GeoRestriction

      protected GeoRestriction(software.amazon.jsii.JsiiObjectRef objRef)
    • GeoRestriction

      protected GeoRestriction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • allowlist

      @Stability(Stable) @NotNull public static GeoRestriction allowlist(@NotNull @NotNull String... locations)
      Allow specific countries which you want CloudFront to distribute your content.

      Parameters:
      locations - Two-letter, uppercase country code for a country that you want to allow. This parameter is required.
    • blacklist

      @Stability(Deprecated) @Deprecated @NotNull public static GeoRestriction blacklist(@NotNull @NotNull String... locations)
      Deprecated.
      use denylist
      (deprecated) DEPRECATED.

      Parameters:
      locations - This parameter is required.
    • denylist

      @Stability(Stable) @NotNull public static GeoRestriction denylist(@NotNull @NotNull String... locations)
      Deny specific countries which you don't want CloudFront to distribute your content.

      Parameters:
      locations - Two-letter, uppercase country code for a country that you want to deny. This parameter is required.
    • whitelist

      @Stability(Deprecated) @Deprecated @NotNull public static GeoRestriction whitelist(@NotNull @NotNull String... locations)
      Deprecated.
      use allowlist
      (deprecated) DEPRECATED.

      Parameters:
      locations - This parameter is required.
    • getLocations

      @Stability(Stable) @NotNull public List<String> getLocations()
      Two-letter, uppercase country code for a country that you want to allow/deny.

      Include one element for each country. See ISO 3166-1-alpha-2 code on the International Organization for Standardization website

    • getRestrictionType

      @Stability(Stable) @NotNull public String getRestrictionType()
      Specifies the restriction type to impose.