Class: Cumulus::CloudFront::CustomOriginConfig

Inherits:
Struct
  • Object
show all
Defined in:
lib/cloudfront/models/CustomOriginConfig.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#http_portObject

Returns the value of attribute http_port

Returns:

  • (Object)

    the current value of http_port



5
6
7
# File 'lib/cloudfront/models/CustomOriginConfig.rb', line 5

def http_port
  @http_port
end

#https_portObject

Returns the value of attribute https_port

Returns:

  • (Object)

    the current value of https_port



5
6
7
# File 'lib/cloudfront/models/CustomOriginConfig.rb', line 5

def https_port
  @https_port
end

#origin_keepalive_timeoutObject

Returns the value of attribute origin_keepalive_timeout

Returns:

  • (Object)

    the current value of origin_keepalive_timeout



5
6
7
# File 'lib/cloudfront/models/CustomOriginConfig.rb', line 5

def origin_keepalive_timeout
  @origin_keepalive_timeout
end

#origin_read_timeoutObject

Returns the value of attribute origin_read_timeout

Returns:

  • (Object)

    the current value of origin_read_timeout



5
6
7
# File 'lib/cloudfront/models/CustomOriginConfig.rb', line 5

def origin_read_timeout
  @origin_read_timeout
end

#origin_ssl_protocolsObject

Returns the value of attribute origin_ssl_protocols

Returns:

  • (Object)

    the current value of origin_ssl_protocols



5
6
7
# File 'lib/cloudfront/models/CustomOriginConfig.rb', line 5

def origin_ssl_protocols
  @origin_ssl_protocols
end

#protocol_policyObject

Returns the value of attribute protocol_policy

Returns:

  • (Object)

    the current value of protocol_policy



5
6
7
# File 'lib/cloudfront/models/CustomOriginConfig.rb', line 5

def protocol_policy
  @protocol_policy
end

Instance Method Details

#diff(aws) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/cloudfront/models/CustomOriginConfig.rb', line 8

def diff(aws)
  diffs = []

  aws_http_port = aws && aws.http_port
  if self.http_port != aws_http_port
    diffs << CustomOriginDiff.new(CustomOriginChange::HTTP, aws_http_port, self.http_port)
  end

  aws_https_port = aws && aws.https_port
  if self.https_port != aws_https_port
    diffs << CustomOriginDiff.new(CustomOriginChange::HTTPS, aws_https_port, self.https_port)
  end

  aws_protocol = aws && aws.origin_protocol_policy
  if self.protocol_policy != aws_protocol
    diffs << CustomOriginDiff.new(CustomOriginChange::POLICY, aws_protocol, self.protocol_policy)
  end

  aws_read_timeout = aws && aws.origin_read_timeout
  if self.origin_read_timeout != aws_read_timeout
    diffs << CustomOriginDiff.new(CustomOriginChange::READ_TIMEOUT, aws_read_timeout, self.origin_read_timeout)
  end

  aws_keepalive_timeout = aws && aws.origin_keepalive_timeout
  if self.origin_keepalive_timeout != aws_keepalive_timeout
    diffs << CustomOriginDiff.new(CustomOriginChange::KEEPALIVE_TIMEOUT, aws_keepalive_timeout, self.origin_keepalive_timeout)
  end

  if self.origin_ssl_protocols
    ssl_protocol_diffs = self.origin_ssl_protocols.diff(aws && aws.origin_ssl_protocols)
  else
    if aws.origin_ssl_protocols && aws.origin_protocol_policy != "http-only"
      ssl_protocol_diffs = OriginSslProtocols.new([]).diff(aws.origin_ssl_protocols)
    end
  end
  if ssl_protocol_diffs && ssl_protocol_diffs.length > 0
    diffs << CustomOriginDiff.ssl_protocols(ssl_protocol_diffs, aws, self)
  end

  diffs
end

#to_localObject



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/cloudfront/models/CustomOriginConfig.rb', line 50

def to_local
  {
    "http-port" => self.http_port,
    "https-port" => self.https_port,
    "protocol-policy" => self.protocol_policy,
    "origin_read_timeout" => self.origin_read_timeout,
    "origin_keepalive_timeout" => self.origin_keepalive_timeout,
    "origin-ssl-protocols" => if self.origin_ssl_protocols
      self.origin_ssl_protocols.to_local
    end
  }.reject { |k, v| v.nil? }
end