Class: AWSCDK::Lightsail::CfnDistribution::CacheBehaviorPerPathProperty

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

Overview

CacheBehaviorPerPath is a property of the AWS::Lightsail::Distribution resource. It describes the per-path cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.

Use a per-path cache behavior to override the default cache behavior of a distribution, or to add an exception to it. For example, if you set the CacheBehavior to cache , you can use a per-path cache behavior to specify a directory, file, or file type that your distribution will cache. If you don’t want your distribution to cache a specified directory, file, or file type, set the per-path cache behavior to dont-cache .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(behavior: nil, path: nil) ⇒ CacheBehaviorPerPathProperty

Returns a new instance of CacheBehaviorPerPathProperty.

Parameters:

  • behavior (String, nil) (defaults to: nil)

    The cache behavior for the specified path.

  • path (String, nil) (defaults to: nil)

    The path to a directory or file to cache, or not cache.



660
661
662
663
664
665
# File 'lightsail/cfn_distribution.rb', line 660

def initialize(behavior: nil, path: nil)
  @behavior = behavior
  Jsii::Type.check_type(@behavior, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "behavior") unless @behavior.nil?
  @path = path
  Jsii::Type.check_type(@path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") unless @path.nil?
end

Instance Attribute Details

#behaviorString? (readonly)

The cache behavior for the specified path.

You can specify one of the following per-path cache behaviors:

  • cache - This behavior caches the specified path.
  • dont-cache - This behavior doesn't cache the specified path.


676
677
678
# File 'lightsail/cfn_distribution.rb', line 676

def behavior
  @behavior
end

#pathString? (readonly)

The path to a directory or file to cache, or not cache.

Use an asterisk symbol to specify wildcard directories ( path/to/assets/* ), and file types ( *.html , *jpg , *js ). Directories and file paths are case-sensitive.

Examples:

  • Specify the following to cache all files in the document root of an Apache web server running on a instance.

var/www/html/

  • Specify the following file to cache only the index page in the document root of an Apache web server.

var/www/html/index.html

  • Specify the following to cache only the .html files in the document root of an Apache web server.

var/www/html/*.html

  • Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document root of an Apache web server.

var/www/html/images/*.jpg

var/www/html/images/*.png

var/www/html/images/*.gif

Specify the following to cache all files in the images subdirectory of the document root of an Apache web server.

var/www/html/images/



709
710
711
# File 'lightsail/cfn_distribution.rb', line 709

def path
  @path
end

Class Method Details

.jsii_propertiesObject



711
712
713
714
715
716
# File 'lightsail/cfn_distribution.rb', line 711

def self.jsii_properties
  {
    :behavior => "behavior",
    :path => "path",
  }
end

Instance Method Details

#to_jsiiObject



718
719
720
721
722
723
724
725
# File 'lightsail/cfn_distribution.rb', line 718

def to_jsii
  result = {}
  result.merge!({
    "behavior" => @behavior,
    "path" => @path,
  })
  result.compact
end