Class: AWSCDK::CloudFront::GeoRestriction

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

Overview

Controls the countries in which content is distributed.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ GeoRestriction

Returns a new instance of GeoRestriction.

Raises:

  • (NoMethodError)


8
9
10
# File 'cloud_front/geo_restriction.rb', line 8

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.aws_cloudfront.GeoRestriction does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.allowlist(*locations) ⇒ AWSCDK::CloudFront::GeoRestriction

Allow specific countries which you want CloudFront to distribute your content.

Parameters:

  • locations (Array<String>)

    Two-letter, uppercase country code for a country that you want to allow.

Returns:

  • (AWSCDK::CloudFront::GeoRestriction)


23
24
25
26
27
28
# File 'cloud_front/geo_restriction.rb', line 23

def self.allowlist(*locations)
  locations.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "locations[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_cloudfront.GeoRestriction", "allowlist", [*locations])
end

.denylist(*locations) ⇒ AWSCDK::CloudFront::GeoRestriction

Deny specific countries which you don't want CloudFront to distribute your content.

Parameters:

  • locations (Array<String>)

    Two-letter, uppercase country code for a country that you want to deny.

Returns:

  • (AWSCDK::CloudFront::GeoRestriction)


34
35
36
37
38
39
# File 'cloud_front/geo_restriction.rb', line 34

def self.denylist(*locations)
  locations.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "locations[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_cloudfront.GeoRestriction", "denylist", [*locations])
end

.jsii_overridable_methodsObject



12
13
14
15
16
17
# File 'cloud_front/geo_restriction.rb', line 12

def self.jsii_overridable_methods
  {
    :locations => { kind: :property, name: "locations", is_optional: false },
    :restriction_type => { kind: :property, name: "restrictionType", is_optional: false },
  }
end

Instance Method Details

#locationsArray<String>

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

Returns:

  • (Array<String>)


47
48
49
# File 'cloud_front/geo_restriction.rb', line 47

def locations()
  jsii_get_property("locations")
end

#restriction_typeString

Specifies the restriction type to impose.

Returns:

  • (String)


54
55
56
# File 'cloud_front/geo_restriction.rb', line 54

def restriction_type()
  jsii_get_property("restrictionType")
end