Class: OCI::ContainerInstances::Models::ContainerHealthCheck
- Inherits:
-
Object
- Object
- OCI::ContainerInstances::Models::ContainerHealthCheck
- Defined in:
- lib/oci/container_instances/models/container_health_check.rb
Overview
Type of container health check which could be either HTTP, TCP, or Command. 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
Direct Known Subclasses
Constant Summary collapse
- HEALTH_CHECK_TYPE_ENUM =
[ HEALTH_CHECK_TYPE_HTTP = 'HTTP'.freeze, HEALTH_CHECK_TYPE_TCP = 'TCP'.freeze, HEALTH_CHECK_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- STATUS_ENUM =
[ STATUS_HEALTHY = 'HEALTHY'.freeze, STATUS_UNHEALTHY = 'UNHEALTHY'.freeze, STATUS_UNKNOWN = 'UNKNOWN'.freeze, STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- FAILURE_ACTION_ENUM =
[ FAILURE_ACTION_KILL = 'KILL'.freeze, FAILURE_ACTION_NONE = 'NONE'.freeze, FAILURE_ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#failure_action ⇒ String
The action will be triggered when the container health check fails.
-
#failure_threshold ⇒ Integer
Number of consecutive failures at which we consider the check failed.
-
#health_check_type ⇒ String
[Required] Container health check type.
-
#initial_delay_in_seconds ⇒ Integer
The initial delay in seconds before start checking container health status.
-
#interval_in_seconds ⇒ Integer
Number of seconds between two consecutive runs for checking container health.
-
#name ⇒ String
Health check name.
-
#status ⇒ String
Status of container.
-
#status_details ⇒ String
A message describing the current status in more details.
-
#success_threshold ⇒ Integer
Number of consecutive successes at which we consider the check succeeded again after it was in failure state.
-
#timeout_in_seconds ⇒ Integer
Length of waiting time in seconds before marking health check failed.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.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.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ContainerHealthCheck
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ ContainerHealthCheck
Initializes the object
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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 142 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.status = attributes[:'status'] if attributes[:'status'] self.status = "UNKNOWN" if status.nil? && !attributes.key?(:'status') # rubocop:disable Style/StringLiterals self.status_details = attributes[:'statusDetails'] if attributes[:'statusDetails'] raise 'You cannot provide both :statusDetails and :status_details' if attributes.key?(:'statusDetails') && attributes.key?(:'status_details') self.status_details = attributes[:'status_details'] if attributes[:'status_details'] 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_action ⇒ String
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.
72 73 74 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 72 def failure_action @failure_action end |
#failure_threshold ⇒ Integer
Number of consecutive failures at which we consider the check failed.
50 51 52 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 50 def failure_threshold @failure_threshold end |
#health_check_type ⇒ String
[Required] Container health check type.
38 39 40 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 38 def health_check_type @health_check_type end |
#initial_delay_in_seconds ⇒ Integer
The initial delay in seconds before start checking container health status.
42 43 44 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 42 def initial_delay_in_seconds @initial_delay_in_seconds end |
#interval_in_seconds ⇒ Integer
Number of seconds between two consecutive runs for checking container health.
46 47 48 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 46 def interval_in_seconds @interval_in_seconds end |
#name ⇒ String
Health check name.
34 35 36 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 34 def name @name end |
#status ⇒ String
Status of container
62 63 64 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 62 def status @status end |
#status_details ⇒ String
A message describing the current status in more details.
66 67 68 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 66 def status_details @status_details end |
#success_threshold ⇒ Integer
Number of consecutive successes at which we consider the check succeeded again after it was in failure state.
54 55 56 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 54 def success_threshold @success_threshold end |
#timeout_in_seconds ⇒ Integer
Length of waiting time in seconds before marking health check failed.
58 59 60 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 58 def timeout_in_seconds @timeout_in_seconds end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 75 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', 'status': :'status', 'status_details': :'statusDetails', '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.
115 116 117 118 119 120 121 122 123 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 115 def self.get_subtype(object_hash) type = object_hash[:'healthCheckType'] # rubocop:disable Style/SymbolLiteral return 'OCI::ContainerInstances::Models::ContainerTcpHealthCheck' if type == 'TCP' return 'OCI::ContainerInstances::Models::ContainerHttpHealthCheck' if type == 'HTTP' # TODO: Log a warning when the subtype is not found. 'OCI::ContainerInstances::Models::ContainerHealthCheck' end |
.swagger_types ⇒ Object
Attribute type mapping.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 93 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', 'status': :'String', 'status_details': :'String', 'failure_action': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 250 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 && status == other.status && status_details == other.status_details && failure_action == other.failure_action end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 289 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
269 270 271 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 269 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
278 279 280 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 278 def hash [name, health_check_type, initial_delay_in_seconds, interval_in_seconds, failure_threshold, success_threshold, timeout_in_seconds, status, status_details, failure_action].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
322 323 324 325 326 327 328 329 330 331 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 322 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_s ⇒ String
Returns the string representation of the object
316 317 318 |
# File 'lib/oci/container_instances/models/container_health_check.rb', line 316 def to_s to_hash.to_s end |