Class: AWSCDK::CloudFront::CfnDistribution::GeoRestrictionProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_front/cfn_distribution.rb

Overview

A complex type that controls the countries in which your content is distributed.

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(restriction_type:, locations: nil) ⇒ GeoRestrictionProperty

Returns a new instance of GeoRestrictionProperty.

Parameters:

  • restriction_type (String)

    The method that you want to use to restrict distribution of your content by country:.

  • locations (Array<String>, nil) (defaults to: nil)

    A complex type that contains a Location element for each country in which you want CloudFront either to distribute your content ( whitelist ) or not distribute your content ( blacklist ).



2150
2151
2152
2153
2154
2155
# File 'cloud_front/cfn_distribution.rb', line 2150

def initialize(restriction_type:, locations: nil)
  @restriction_type = restriction_type
  Jsii::Type.check_type(@restriction_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "restrictionType")
  @locations = locations
  Jsii::Type.check_type(@locations, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "locations") unless @locations.nil?
end

Instance Attribute Details

#locationsArray<String>? (readonly)

A complex type that contains a Location element for each country in which you want CloudFront either to distribute your content ( whitelist ) or not distribute your content ( blacklist ).

The Location element is a two-letter, uppercase country code for a country that you want to include in your blacklist or whitelist . Include one Location element for each country.

CloudFront and MaxMind both use ISO 3166 country codes. For the current list of countries and the corresponding codes, see ISO 3166-1-alpha-2 code on the International Organization for Standardization website. You can also refer to the country list on the CloudFront console, which includes both country names and codes.



2174
2175
2176
# File 'cloud_front/cfn_distribution.rb', line 2174

def locations
  @locations
end

#restriction_typeString (readonly)

The method that you want to use to restrict distribution of your content by country:.

  • none : No geo restriction is enabled, meaning access to content is not restricted by client geo location.
  • blacklist : The Location elements specify the countries in which you don't want CloudFront to distribute your content.
  • whitelist : The Location elements specify the countries in which you want CloudFront to distribute your content.


2165
2166
2167
# File 'cloud_front/cfn_distribution.rb', line 2165

def restriction_type
  @restriction_type
end

Class Method Details

.jsii_propertiesObject



2176
2177
2178
2179
2180
2181
# File 'cloud_front/cfn_distribution.rb', line 2176

def self.jsii_properties
  {
    :restriction_type => "restrictionType",
    :locations => "locations",
  }
end

Instance Method Details

#to_jsiiObject



2183
2184
2185
2186
2187
2188
2189
2190
# File 'cloud_front/cfn_distribution.rb', line 2183

def to_jsii
  result = {}
  result.merge!({
    "restrictionType" => @restriction_type,
    "locations" => @locations,
  })
  result.compact
end