Class: OCI::ContainerInstances::Models::CreateContainerHealthCheckDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/container_instances/models/create_container_health_check_details.rb

Overview

Container Health Check is used to check and report the status of a container.

This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Constant Summary collapse

HEALTH_CHECK_TYPE_ENUM =
[
  HEALTH_CHECK_TYPE_HTTP = 'HTTP'.freeze,
  HEALTH_CHECK_TYPE_TCP = 'TCP'.freeze
].freeze
FAILURE_ACTION_ENUM =
[
  FAILURE_ACTION_KILL = 'KILL'.freeze,
  FAILURE_ACTION_NONE = 'NONE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateContainerHealthCheckDetails

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :name (String)

    The value to assign to the #name property

  • :health_check_type (String)

    The value to assign to the #health_check_type property

  • :initial_delay_in_seconds (Integer)

    The value to assign to the #initial_delay_in_seconds property

  • :interval_in_seconds (Integer)

    The value to assign to the #interval_in_seconds property

  • :failure_threshold (Integer)

    The value to assign to the #failure_threshold property

  • :success_threshold (Integer)

    The value to assign to the #success_threshold property

  • :timeout_in_seconds (Integer)

    The value to assign to the #timeout_in_seconds property

  • :failure_action (String)

    The value to assign to the #failure_action property



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 119

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.name = attributes[:'name'] if attributes[:'name']

  self.health_check_type = attributes[:'healthCheckType'] if attributes[:'healthCheckType']

  raise 'You cannot provide both :healthCheckType and :health_check_type' if attributes.key?(:'healthCheckType') && attributes.key?(:'health_check_type')

  self.health_check_type = attributes[:'health_check_type'] if attributes[:'health_check_type']

  self.initial_delay_in_seconds = attributes[:'initialDelayInSeconds'] if attributes[:'initialDelayInSeconds']

  raise 'You cannot provide both :initialDelayInSeconds and :initial_delay_in_seconds' if attributes.key?(:'initialDelayInSeconds') && attributes.key?(:'initial_delay_in_seconds')

  self.initial_delay_in_seconds = attributes[:'initial_delay_in_seconds'] if attributes[:'initial_delay_in_seconds']

  self.interval_in_seconds = attributes[:'intervalInSeconds'] if attributes[:'intervalInSeconds']

  raise 'You cannot provide both :intervalInSeconds and :interval_in_seconds' if attributes.key?(:'intervalInSeconds') && attributes.key?(:'interval_in_seconds')

  self.interval_in_seconds = attributes[:'interval_in_seconds'] if attributes[:'interval_in_seconds']

  self.failure_threshold = attributes[:'failureThreshold'] if attributes[:'failureThreshold']

  raise 'You cannot provide both :failureThreshold and :failure_threshold' if attributes.key?(:'failureThreshold') && attributes.key?(:'failure_threshold')

  self.failure_threshold = attributes[:'failure_threshold'] if attributes[:'failure_threshold']

  self.success_threshold = attributes[:'successThreshold'] if attributes[:'successThreshold']

  raise 'You cannot provide both :successThreshold and :success_threshold' if attributes.key?(:'successThreshold') && attributes.key?(:'success_threshold')

  self.success_threshold = attributes[:'success_threshold'] if attributes[:'success_threshold']

  self.timeout_in_seconds = attributes[:'timeoutInSeconds'] if attributes[:'timeoutInSeconds']

  raise 'You cannot provide both :timeoutInSeconds and :timeout_in_seconds' if attributes.key?(:'timeoutInSeconds') && attributes.key?(:'timeout_in_seconds')

  self.timeout_in_seconds = attributes[:'timeout_in_seconds'] if attributes[:'timeout_in_seconds']

  self.failure_action = attributes[:'failureAction'] if attributes[:'failureAction']
  self.failure_action = "KILL" if failure_action.nil? && !attributes.key?(:'failureAction') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :failureAction and :failure_action' if attributes.key?(:'failureAction') && attributes.key?(:'failure_action')

  self.failure_action = attributes[:'failure_action'] if attributes[:'failure_action']
  self.failure_action = "KILL" if failure_action.nil? && !attributes.key?(:'failureAction') && !attributes.key?(:'failure_action') # rubocop:disable Style/StringLiterals
end

Instance Attribute Details

#failure_actionString

The action will be triggered when the container health check fails. There are two types of action: KILL or NONE. The default action is KILL. If failure action is KILL, the container will be subject to the container restart policy.

Returns:

  • (String)


55
56
57
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 55

def failure_action
  @failure_action
end

#failure_thresholdInteger

Number of consecutive failures at which we consider the check failed.

Returns:

  • (Integer)


41
42
43
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 41

def failure_threshold
  @failure_threshold
end

#health_check_typeString

[Required] Container health check type.

Returns:

  • (String)


29
30
31
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 29

def health_check_type
  @health_check_type
end

#initial_delay_in_secondsInteger

The initial delay in seconds before start checking container health status.

Returns:

  • (Integer)


33
34
35
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 33

def initial_delay_in_seconds
  @initial_delay_in_seconds
end

#interval_in_secondsInteger

Number of seconds between two consecutive runs for checking container health.

Returns:

  • (Integer)


37
38
39
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 37

def interval_in_seconds
  @interval_in_seconds
end

#nameString

Health check name.

Returns:

  • (String)


25
26
27
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 25

def name
  @name
end

#success_thresholdInteger

Number of consecutive successes at which we consider the check succeeded again after it was in failure state.

Returns:

  • (Integer)


45
46
47
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 45

def success_threshold
  @success_threshold
end

#timeout_in_secondsInteger

Length of waiting time in seconds before marking health check failed.

Returns:

  • (Integer)


49
50
51
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 49

def timeout_in_seconds
  @timeout_in_seconds
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 58

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'health_check_type': :'healthCheckType',
    'initial_delay_in_seconds': :'initialDelayInSeconds',
    'interval_in_seconds': :'intervalInSeconds',
    'failure_threshold': :'failureThreshold',
    'success_threshold': :'successThreshold',
    'timeout_in_seconds': :'timeoutInSeconds',
    'failure_action': :'failureAction'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



94
95
96
97
98
99
100
101
102
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 94

def self.get_subtype(object_hash)
  type = object_hash[:'healthCheckType'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::ContainerInstances::Models::CreateContainerTcpHealthCheckDetails' if type == 'TCP'
  return 'OCI::ContainerInstances::Models::CreateContainerHttpHealthCheckDetails' if type == 'HTTP'

  # TODO: Log a warning when the subtype is not found.
  'OCI::ContainerInstances::Models::CreateContainerHealthCheckDetails'
end

.swagger_typesObject

Attribute type mapping.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 74

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'health_check_type': :'String',
    'initial_delay_in_seconds': :'Integer',
    'interval_in_seconds': :'Integer',
    'failure_threshold': :'Integer',
    'success_threshold': :'Integer',
    'timeout_in_seconds': :'Integer',
    'failure_action': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 195

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    name == other.name &&
    health_check_type == other.health_check_type &&
    initial_delay_in_seconds == other.initial_delay_in_seconds &&
    interval_in_seconds == other.interval_in_seconds &&
    failure_threshold == other.failure_threshold &&
    success_threshold == other.success_threshold &&
    timeout_in_seconds == other.timeout_in_seconds &&
    failure_action == other.failure_action
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 232

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


212
213
214
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 212

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



221
222
223
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 221

def hash
  [name, health_check_type, initial_delay_in_seconds, interval_in_seconds, failure_threshold, success_threshold, timeout_in_seconds, failure_action].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



265
266
267
268
269
270
271
272
273
274
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 265

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



259
260
261
# File 'lib/oci/container_instances/models/create_container_health_check_details.rb', line 259

def to_s
  to_hash.to_s
end