Class: AWSCDK::Lightsail::CfnDistribution::CacheSettingsProperty

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

Overview

CacheSettings is a property of the AWS::Lightsail::Distribution resource. It describes the cache settings of an Amazon Lightsail content delivery network (CDN) distribution.

These settings apply only to your distribution’s CacheBehaviors that have a Behavior of cache . This includes the DefaultCacheBehavior .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allowed_http_methods: nil, cached_http_methods: nil, default_ttl: nil, forwarded_cookies: nil, forwarded_headers: nil, forwarded_query_strings: nil, maximum_ttl: nil, minimum_ttl: nil) ⇒ CacheSettingsProperty

Returns a new instance of CacheSettingsProperty.

Parameters:

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

    The HTTP methods that are processed and forwarded to the distribution's origin.

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

    The HTTP method responses that are cached by your distribution.

  • default_ttl (Numeric, nil) (defaults to: nil)

    The default amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the content has been updated.

  • forwarded_cookies (AWSCDK::IResolvable, AWSCDK::Lightsail::CfnDistribution::CookieObjectProperty, nil) (defaults to: nil)

    An object that describes the cookies that are forwarded to the origin.

  • forwarded_headers (AWSCDK::IResolvable, AWSCDK::Lightsail::CfnDistribution::HeaderObjectProperty, nil) (defaults to: nil)

    An object that describes the headers that are forwarded to the origin.

  • forwarded_query_strings (AWSCDK::IResolvable, AWSCDK::Lightsail::CfnDistribution::QueryStringObjectProperty, nil) (defaults to: nil)

    An object that describes the query strings that are forwarded to the origin.

  • maximum_ttl (Numeric, nil) (defaults to: nil)

    The maximum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

  • minimum_ttl (Numeric, nil) (defaults to: nil)

    The minimum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.



782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
# File 'lightsail/cfn_distribution.rb', line 782

def initialize(allowed_http_methods: nil, cached_http_methods: nil, default_ttl: nil, forwarded_cookies: nil, forwarded_headers: nil, forwarded_query_strings: nil, maximum_ttl: nil, minimum_ttl: nil)
  @allowed_http_methods = allowed_http_methods
  Jsii::Type.check_type(@allowed_http_methods, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "allowedHttpMethods") unless @allowed_http_methods.nil?
  @cached_http_methods = cached_http_methods
  Jsii::Type.check_type(@cached_http_methods, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cachedHttpMethods") unless @cached_http_methods.nil?
  @default_ttl = default_ttl
  Jsii::Type.check_type(@default_ttl, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "defaultTtl") unless @default_ttl.nil?
  @forwarded_cookies = forwarded_cookies.is_a?(Hash) ? ::AWSCDK::Lightsail::CfnDistribution::CookieObjectProperty.new(**forwarded_cookies.transform_keys(&:to_sym)) : forwarded_cookies
  Jsii::Type.check_type(@forwarded_cookies, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19saWdodHNhaWwuQ2ZuRGlzdHJpYnV0aW9uLkNvb2tpZU9iamVjdFByb3BlcnR5In1dfX0=")), "forwardedCookies") unless @forwarded_cookies.nil?
  @forwarded_headers = forwarded_headers.is_a?(Hash) ? ::AWSCDK::Lightsail::CfnDistribution::HeaderObjectProperty.new(**forwarded_headers.transform_keys(&:to_sym)) : forwarded_headers
  Jsii::Type.check_type(@forwarded_headers, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19saWdodHNhaWwuQ2ZuRGlzdHJpYnV0aW9uLkhlYWRlck9iamVjdFByb3BlcnR5In1dfX0=")), "forwardedHeaders") unless @forwarded_headers.nil?
  @forwarded_query_strings = forwarded_query_strings.is_a?(Hash) ? ::AWSCDK::Lightsail::CfnDistribution::QueryStringObjectProperty.new(**forwarded_query_strings.transform_keys(&:to_sym)) : forwarded_query_strings
  Jsii::Type.check_type(@forwarded_query_strings, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19saWdodHNhaWwuQ2ZuRGlzdHJpYnV0aW9uLlF1ZXJ5U3RyaW5nT2JqZWN0UHJvcGVydHkifV19fQ==")), "forwardedQueryStrings") unless @forwarded_query_strings.nil?
  @maximum_ttl = maximum_ttl
  Jsii::Type.check_type(@maximum_ttl, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maximumTtl") unless @maximum_ttl.nil?
  @minimum_ttl = minimum_ttl
  Jsii::Type.check_type(@minimum_ttl, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minimumTtl") unless @minimum_ttl.nil?
end

Instance Attribute Details

#allowed_http_methodsString? (readonly)

The HTTP methods that are processed and forwarded to the distribution's origin.

You can specify the following options:

  • GET,HEAD - The distribution forwards the GET and HEAD methods.
  • GET,HEAD,OPTIONS - The distribution forwards the GET , HEAD , and OPTIONS methods.
  • GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE - The distribution forwards the GET , HEAD , OPTIONS , PUT , PATCH , POST , and DELETE methods.

If you specify GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE , you might need to restrict access to your distribution's origin so users can't perform operations that you don't want them to. For example, you might not want users to have permission to delete objects from your origin.



813
814
815
# File 'lightsail/cfn_distribution.rb', line 813

def allowed_http_methods
  @allowed_http_methods
end

#cached_http_methodsString? (readonly)

The HTTP method responses that are cached by your distribution.

You can specify the following options:

  • GET,HEAD - The distribution caches responses to the GET and HEAD methods.
  • GET,HEAD,OPTIONS - The distribution caches responses to the GET , HEAD , and OPTIONS methods.


823
824
825
# File 'lightsail/cfn_distribution.rb', line 823

def cached_http_methods
  @cached_http_methods
end

#default_ttlNumeric? (readonly)

The default amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the content has been updated.

The value specified applies only when the origin does not add HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.



830
831
832
# File 'lightsail/cfn_distribution.rb', line 830

def default_ttl
  @default_ttl
end

#forwarded_cookiesAWSCDK::IResolvable, ... (readonly)

An object that describes the cookies that are forwarded to the origin.

Your content is cached based on the cookies that are forwarded.



837
838
839
# File 'lightsail/cfn_distribution.rb', line 837

def forwarded_cookies
  @forwarded_cookies
end

#forwarded_headersAWSCDK::IResolvable, ... (readonly)

An object that describes the headers that are forwarded to the origin.

Your content is cached based on the headers that are forwarded.



844
845
846
# File 'lightsail/cfn_distribution.rb', line 844

def forwarded_headers
  @forwarded_headers
end

#forwarded_query_stringsAWSCDK::IResolvable, ... (readonly)

An object that describes the query strings that are forwarded to the origin.

Your content is cached based on the query strings that are forwarded.



851
852
853
# File 'lightsail/cfn_distribution.rb', line 851

def forwarded_query_strings
  @forwarded_query_strings
end

#maximum_ttlNumeric? (readonly)

The maximum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

The value specified applies only when the origin adds HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.



858
859
860
# File 'lightsail/cfn_distribution.rb', line 858

def maximum_ttl
  @maximum_ttl
end

#minimum_ttlNumeric? (readonly)

The minimum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

A value of 0 must be specified for minimum_ttl if the distribution is configured to forward all headers to the origin.



865
866
867
# File 'lightsail/cfn_distribution.rb', line 865

def minimum_ttl
  @minimum_ttl
end

Class Method Details

.jsii_propertiesObject



867
868
869
870
871
872
873
874
875
876
877
878
# File 'lightsail/cfn_distribution.rb', line 867

def self.jsii_properties
  {
    :allowed_http_methods => "allowedHttpMethods",
    :cached_http_methods => "cachedHttpMethods",
    :default_ttl => "defaultTtl",
    :forwarded_cookies => "forwardedCookies",
    :forwarded_headers => "forwardedHeaders",
    :forwarded_query_strings => "forwardedQueryStrings",
    :maximum_ttl => "maximumTtl",
    :minimum_ttl => "minimumTtl",
  }
end

Instance Method Details

#to_jsiiObject



880
881
882
883
884
885
886
887
888
889
890
891
892
893
# File 'lightsail/cfn_distribution.rb', line 880

def to_jsii
  result = {}
  result.merge!({
    "allowedHttpMethods" => @allowed_http_methods,
    "cachedHttpMethods" => @cached_http_methods,
    "defaultTtl" => @default_ttl,
    "forwardedCookies" => @forwarded_cookies,
    "forwardedHeaders" => @forwarded_headers,
    "forwardedQueryStrings" => @forwarded_query_strings,
    "maximumTtl" => @maximum_ttl,
    "minimumTtl" => @minimum_ttl,
  })
  result.compact
end