Class: AWSCDK::CloudFront::ResponseHeadersPolicyProps

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

Overview

Properties for creating a Response Headers Policy.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(comment: nil, cors_behavior: nil, custom_headers_behavior: nil, remove_headers: nil, response_headers_policy_name: nil, security_headers_behavior: nil, server_timing_sampling_rate: nil) ⇒ ResponseHeadersPolicyProps

Returns a new instance of ResponseHeadersPolicyProps.

Parameters:

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

    A comment to describe the response headers policy.

  • cors_behavior (AWSCDK::CloudFront::ResponseHeadersCorsBehavior, nil) (defaults to: nil)

    A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).

  • custom_headers_behavior (AWSCDK::CloudFront::ResponseCustomHeadersBehavior, nil) (defaults to: nil)

    A configuration for a set of custom HTTP response headers.

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

    A list of HTTP response headers that CloudFront removes from HTTP responses that it sends to viewers.

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

    A unique name to identify the response headers policy.

  • security_headers_behavior (AWSCDK::CloudFront::ResponseSecurityHeadersBehavior, nil) (defaults to: nil)

    A configuration for a set of security-related HTTP response headers.

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

    The percentage of responses that you want CloudFront to add the Server-Timing header to.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'cloud_front/response_headers_policy_props.rb', line 14

def initialize(comment: nil, cors_behavior: nil, custom_headers_behavior: nil, remove_headers: nil, response_headers_policy_name: nil, security_headers_behavior: nil, server_timing_sampling_rate: nil)
  @comment = comment
  Jsii::Type.check_type(@comment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comment") unless @comment.nil?
  @cors_behavior = cors_behavior.is_a?(Hash) ? ::AWSCDK::CloudFront::ResponseHeadersCorsBehavior.new(**cors_behavior.transform_keys(&:to_sym)) : cors_behavior
  Jsii::Type.check_type(@cors_behavior, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5SZXNwb25zZUhlYWRlcnNDb3JzQmVoYXZpb3IifQ==")), "corsBehavior") unless @cors_behavior.nil?
  @custom_headers_behavior = custom_headers_behavior.is_a?(Hash) ? ::AWSCDK::CloudFront::ResponseCustomHeadersBehavior.new(**custom_headers_behavior.transform_keys(&:to_sym)) : custom_headers_behavior
  Jsii::Type.check_type(@custom_headers_behavior, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5SZXNwb25zZUN1c3RvbUhlYWRlcnNCZWhhdmlvciJ9")), "customHeadersBehavior") unless @custom_headers_behavior.nil?
  @remove_headers = remove_headers
  Jsii::Type.check_type(@remove_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "removeHeaders") unless @remove_headers.nil?
  @response_headers_policy_name = response_headers_policy_name
  Jsii::Type.check_type(@response_headers_policy_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "responseHeadersPolicyName") unless @response_headers_policy_name.nil?
  @security_headers_behavior = security_headers_behavior.is_a?(Hash) ? ::AWSCDK::CloudFront::ResponseSecurityHeadersBehavior.new(**security_headers_behavior.transform_keys(&:to_sym)) : security_headers_behavior
  Jsii::Type.check_type(@security_headers_behavior, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5SZXNwb25zZVNlY3VyaXR5SGVhZGVyc0JlaGF2aW9yIn0=")), "securityHeadersBehavior") unless @security_headers_behavior.nil?
  @server_timing_sampling_rate = server_timing_sampling_rate
  Jsii::Type.check_type(@server_timing_sampling_rate, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "serverTimingSamplingRate") unless @server_timing_sampling_rate.nil?
end

Instance Attribute Details

#commentString? (readonly)

Note:

Default: - no comment

A comment to describe the response headers policy.

Returns:

  • (String, nil)


35
36
37
# File 'cloud_front/response_headers_policy_props.rb', line 35

def comment
  @comment
end

#cors_behaviorAWSCDK::CloudFront::ResponseHeadersCorsBehavior? (readonly)

Note:

Default: - no cors behavior

A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).



40
41
42
# File 'cloud_front/response_headers_policy_props.rb', line 40

def cors_behavior
  @cors_behavior
end

#custom_headers_behaviorAWSCDK::CloudFront::ResponseCustomHeadersBehavior? (readonly)

Note:

Default: - no custom headers behavior

A configuration for a set of custom HTTP response headers.



45
46
47
# File 'cloud_front/response_headers_policy_props.rb', line 45

def custom_headers_behavior
  @custom_headers_behavior
end

#remove_headersArray<String>? (readonly)

Note:

Default: - no headers are removed

A list of HTTP response headers that CloudFront removes from HTTP responses that it sends to viewers.

Returns:

  • (Array<String>, nil)


50
51
52
# File 'cloud_front/response_headers_policy_props.rb', line 50

def remove_headers
  @remove_headers
end

#response_headers_policy_nameString? (readonly)

Note:

Default: - generated from the id

A unique name to identify the response headers policy.

Returns:

  • (String, nil)


55
56
57
# File 'cloud_front/response_headers_policy_props.rb', line 55

def response_headers_policy_name
  @response_headers_policy_name
end

#security_headers_behaviorAWSCDK::CloudFront::ResponseSecurityHeadersBehavior? (readonly)

Note:

Default: - no security headers behavior

A configuration for a set of security-related HTTP response headers.



60
61
62
# File 'cloud_front/response_headers_policy_props.rb', line 60

def security_headers_behavior
  @security_headers_behavior
end

#server_timing_sampling_rateNumeric? (readonly)

Note:

Default: - no Server-Timing header is added to HTTP responses

The percentage of responses that you want CloudFront to add the Server-Timing header to.

Returns:

  • (Numeric, nil)


65
66
67
# File 'cloud_front/response_headers_policy_props.rb', line 65

def server_timing_sampling_rate
  @server_timing_sampling_rate
end

Class Method Details

.jsii_propertiesObject



67
68
69
70
71
72
73
74
75
76
77
# File 'cloud_front/response_headers_policy_props.rb', line 67

def self.jsii_properties
  {
    :comment => "comment",
    :cors_behavior => "corsBehavior",
    :custom_headers_behavior => "customHeadersBehavior",
    :remove_headers => "removeHeaders",
    :response_headers_policy_name => "responseHeadersPolicyName",
    :security_headers_behavior => "securityHeadersBehavior",
    :server_timing_sampling_rate => "serverTimingSamplingRate",
  }
end

Instance Method Details

#to_jsiiObject



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'cloud_front/response_headers_policy_props.rb', line 79

def to_jsii
  result = {}
  result.merge!({
    "comment" => @comment,
    "corsBehavior" => @cors_behavior,
    "customHeadersBehavior" => @custom_headers_behavior,
    "removeHeaders" => @remove_headers,
    "responseHeadersPolicyName" => @response_headers_policy_name,
    "securityHeadersBehavior" => @security_headers_behavior,
    "serverTimingSamplingRate" => @server_timing_sampling_rate,
  })
  result.compact
end