Class: AWSCDK::CloudFront::CustomOriginConfig

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

Overview

A custom origin configuration.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain_name:, allowed_origin_ssl_versions: nil, http_port: nil, https_port: nil, origin_headers: nil, origin_keepalive_timeout: nil, origin_path: nil, origin_protocol_policy: nil, origin_read_timeout: nil, origin_shield_region: nil) ⇒ CustomOriginConfig

Returns a new instance of CustomOriginConfig.

Parameters:

  • domain_name (String)

    The domain name of the custom origin.

  • allowed_origin_ssl_versions (Array<AWSCDK::CloudFront::OriginSSLPolicy>, nil) (defaults to: nil)

    The SSL versions to use when interacting with the origin.

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

    The origin HTTP port.

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

    The origin HTTPS port.

  • origin_headers (Hash{String => String}, nil) (defaults to: nil)

    Any additional headers to pass to the origin.

  • origin_keepalive_timeout (AWSCDK::Duration, nil) (defaults to: nil)

    The keep alive timeout when making calls in seconds.

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

    The relative path to the origin root to use for sources.

  • origin_protocol_policy (AWSCDK::CloudFront::OriginProtocolPolicy, nil) (defaults to: nil)

    The protocol (http or https) policy to use when interacting with the origin.

  • origin_read_timeout (AWSCDK::Duration, nil) (defaults to: nil)

    The read timeout when calling the origin in seconds.

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

    When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'cloud_front/custom_origin_config.rb', line 17

def initialize(domain_name:, allowed_origin_ssl_versions: nil, http_port: nil, https_port: nil, origin_headers: nil, origin_keepalive_timeout: nil, origin_path: nil, origin_protocol_policy: nil, origin_read_timeout: nil, origin_shield_region: nil)
  @domain_name = domain_name
  Jsii::Type.check_type(@domain_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "domainName")
  @allowed_origin_ssl_versions = allowed_origin_ssl_versions
  Jsii::Type.check_type(@allowed_origin_ssl_versions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250Lk9yaWdpblNzbFBvbGljeSJ9LCJraW5kIjoiYXJyYXkifX0=")), "allowedOriginSSLVersions") unless @allowed_origin_ssl_versions.nil?
  @http_port = http_port
  Jsii::Type.check_type(@http_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "httpPort") unless @http_port.nil?
  @https_port = https_port
  Jsii::Type.check_type(@https_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "httpsPort") unless @https_port.nil?
  @origin_headers = origin_headers
  Jsii::Type.check_type(@origin_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "originHeaders") unless @origin_headers.nil?
  @origin_keepalive_timeout = origin_keepalive_timeout
  Jsii::Type.check_type(@origin_keepalive_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "originKeepaliveTimeout") unless @origin_keepalive_timeout.nil?
  @origin_path = origin_path
  Jsii::Type.check_type(@origin_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "originPath") unless @origin_path.nil?
  @origin_protocol_policy = origin_protocol_policy
  Jsii::Type.check_type(@origin_protocol_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5PcmlnaW5Qcm90b2NvbFBvbGljeSJ9")), "originProtocolPolicy") unless @origin_protocol_policy.nil?
  @origin_read_timeout = origin_read_timeout
  Jsii::Type.check_type(@origin_read_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "originReadTimeout") unless @origin_read_timeout.nil?
  @origin_shield_region = origin_shield_region
  Jsii::Type.check_type(@origin_shield_region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "originShieldRegion") unless @origin_shield_region.nil?
end

Instance Attribute Details

#allowed_origin_ssl_versionsArray<AWSCDK::CloudFront::OriginSSLPolicy>? (readonly)

Note:

Default: OriginSslPolicy.TLS_V1_2

The SSL versions to use when interacting with the origin.

Returns:



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

def allowed_origin_ssl_versions
  @allowed_origin_ssl_versions
end

#domain_nameString (readonly)

The domain name of the custom origin.

Should not include the path - that should be in the parent SourceConfiguration

Returns:

  • (String)


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

def domain_name
  @domain_name
end

#http_portNumeric? (readonly)

Note:

Default: 80

The origin HTTP port.

Returns:

  • (Numeric, nil)


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

def http_port
  @http_port
end

#https_portNumeric? (readonly)

Note:

Default: 443

The origin HTTPS port.

Returns:

  • (Numeric, nil)


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

def https_port
  @https_port
end

#origin_headersHash{String => String}? (readonly)

Note:

Default: - No additional headers are passed.

Any additional headers to pass to the origin.

Returns:

  • (Hash{String => String}, nil)


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

def origin_headers
  @origin_headers
end

#origin_keepalive_timeoutAWSCDK::Duration? (readonly)

Note:

Default: Duration.seconds(5)

The keep alive timeout when making calls in seconds.

Returns:



70
71
72
# File 'cloud_front/custom_origin_config.rb', line 70

def origin_keepalive_timeout
  @origin_keepalive_timeout
end

#origin_pathString? (readonly)

Note:

Default: /

The relative path to the origin root to use for sources.

Returns:

  • (String, nil)


75
76
77
# File 'cloud_front/custom_origin_config.rb', line 75

def origin_path
  @origin_path
end

#origin_protocol_policyAWSCDK::CloudFront::OriginProtocolPolicy? (readonly)

Note:

Default: OriginProtocolPolicy.HttpsOnly

The protocol (http or https) policy to use when interacting with the origin.



80
81
82
# File 'cloud_front/custom_origin_config.rb', line 80

def origin_protocol_policy
  @origin_protocol_policy
end

#origin_read_timeoutAWSCDK::Duration? (readonly)

Note:

Default: Duration.seconds(30)

The read timeout when calling the origin in seconds.

Returns:



85
86
87
# File 'cloud_front/custom_origin_config.rb', line 85

def origin_read_timeout
  @origin_read_timeout
end

#origin_shield_regionString? (readonly)

Note:

Default: - origin shield not enabled

When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.

Returns:

  • (String, nil)


90
91
92
# File 'cloud_front/custom_origin_config.rb', line 90

def origin_shield_region
  @origin_shield_region
end

Class Method Details

.jsii_propertiesObject



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'cloud_front/custom_origin_config.rb', line 92

def self.jsii_properties
  {
    :domain_name => "domainName",
    :allowed_origin_ssl_versions => "allowedOriginSSLVersions",
    :http_port => "httpPort",
    :https_port => "httpsPort",
    :origin_headers => "originHeaders",
    :origin_keepalive_timeout => "originKeepaliveTimeout",
    :origin_path => "originPath",
    :origin_protocol_policy => "originProtocolPolicy",
    :origin_read_timeout => "originReadTimeout",
    :origin_shield_region => "originShieldRegion",
  }
end

Instance Method Details

#to_jsiiObject



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'cloud_front/custom_origin_config.rb', line 107

def to_jsii
  result = {}
  result.merge!({
    "domainName" => @domain_name,
    "allowedOriginSSLVersions" => @allowed_origin_ssl_versions,
    "httpPort" => @http_port,
    "httpsPort" => @https_port,
    "originHeaders" => @origin_headers,
    "originKeepaliveTimeout" => @origin_keepalive_timeout,
    "originPath" => @origin_path,
    "originProtocolPolicy" => @origin_protocol_policy,
    "originReadTimeout" => @origin_read_timeout,
    "originShieldRegion" => @origin_shield_region,
  })
  result.compact
end