Class: AWSCDK::CloudFront::CfnResponseHeadersPolicy::ServerTimingHeadersConfigProperty

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

Overview

A configuration for enabling the Server-Timing header in HTTP responses sent from CloudFront.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled:, sampling_rate: nil) ⇒ ServerTimingHeadersConfigProperty

Returns a new instance of ServerTimingHeadersConfigProperty.

Parameters:

  • enabled (Boolean, AWSCDK::IResolvable)

    A Boolean that determines whether CloudFront adds the Server-Timing header to HTTP responses that it sends in response to requests that match a cache behavior that's associated with this response headers policy.

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

    A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the Server-Timing header to.



1326
1327
1328
1329
1330
1331
# File 'cloud_front/cfn_response_headers_policy.rb', line 1326

def initialize(enabled:, sampling_rate: nil)
  @enabled = enabled
  Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "enabled")
  @sampling_rate = sampling_rate
  Jsii::Type.check_type(@sampling_rate, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "samplingRate") unless @sampling_rate.nil?
end

Instance Attribute Details

#enabledBoolean, AWSCDK::IResolvable (readonly)

A Boolean that determines whether CloudFront adds the Server-Timing header to HTTP responses that it sends in response to requests that match a cache behavior that's associated with this response headers policy.



1337
1338
1339
# File 'cloud_front/cfn_response_headers_policy.rb', line 1337

def enabled
  @enabled
end

#sampling_rateNumeric? (readonly)

A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the Server-Timing header to.

When you set the sampling rate to 100, CloudFront adds the Server-Timing header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.



1344
1345
1346
# File 'cloud_front/cfn_response_headers_policy.rb', line 1344

def sampling_rate
  @sampling_rate
end

Class Method Details

.jsii_propertiesObject



1346
1347
1348
1349
1350
1351
# File 'cloud_front/cfn_response_headers_policy.rb', line 1346

def self.jsii_properties
  {
    :enabled => "enabled",
    :sampling_rate => "samplingRate",
  }
end

Instance Method Details

#to_jsiiObject



1353
1354
1355
1356
1357
1358
1359
1360
# File 'cloud_front/cfn_response_headers_policy.rb', line 1353

def to_jsii
  result = {}
  result.merge!({
    "enabled" => @enabled,
    "samplingRate" => @sampling_rate,
  })
  result.compact
end