Class: OCI::Core::Models::InstancePoolPreTerminationActionHandleTimeoutDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb

Overview

Options to handle timeout for pre-termination action.

Constant Summary collapse

PRESERVE_BLOCK_VOLUME_MODE_ENUM =
[
  PRESERVE_BLOCK_VOLUME_MODE_PRESERVE_ALWAYS = 'PRESERVE_ALWAYS'.freeze,
  PRESERVE_BLOCK_VOLUME_MODE_PRESERVE_ON_TIMEOUT = 'PRESERVE_ON_TIMEOUT'.freeze,
  PRESERVE_BLOCK_VOLUME_MODE_DELETE_ALWAYS = 'DELETE_ALWAYS'.freeze,
  PRESERVE_BLOCK_VOLUME_MODE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
PRESERVE_BOOT_VOLUME_MODE_ENUM =
[
  PRESERVE_BOOT_VOLUME_MODE_PRESERVE_ALWAYS = 'PRESERVE_ALWAYS'.freeze,
  PRESERVE_BOOT_VOLUME_MODE_PRESERVE_ON_TIMEOUT = 'PRESERVE_ON_TIMEOUT'.freeze,
  PRESERVE_BOOT_VOLUME_MODE_DELETE_ALWAYS = 'DELETE_ALWAYS'.freeze,
  PRESERVE_BOOT_VOLUME_MODE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InstancePoolPreTerminationActionHandleTimeoutDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 65

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.preserve_block_volume_mode = attributes[:'preserveBlockVolumeMode'] if attributes[:'preserveBlockVolumeMode']

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

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

  self.preserve_boot_volume_mode = attributes[:'preserveBootVolumeMode'] if attributes[:'preserveBootVolumeMode']

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

  self.preserve_boot_volume_mode = attributes[:'preserve_boot_volume_mode'] if attributes[:'preserve_boot_volume_mode']
end

Instance Attribute Details

#preserve_block_volume_modeString

[Required] Whether the block volume should be preserved after termination.

Returns:

  • (String)


30
31
32
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 30

def preserve_block_volume_mode
  @preserve_block_volume_mode
end

#preserve_boot_volume_modeString

[Required] Whether the boot volume should be preserved after termination.

Returns:

  • (String)


35
36
37
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 35

def preserve_boot_volume_mode
  @preserve_boot_volume_mode
end

Class Method Details

.attribute_mapObject

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



38
39
40
41
42
43
44
45
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 38

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'preserve_block_volume_mode': :'preserveBlockVolumeMode',
    'preserve_boot_volume_mode': :'preserveBootVolumeMode'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



48
49
50
51
52
53
54
55
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 48

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'preserve_block_volume_mode': :'String',
    'preserve_boot_volume_mode': :'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



117
118
119
120
121
122
123
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 117

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

  self.class == other.class &&
    preserve_block_volume_mode == other.preserve_block_volume_mode &&
    preserve_boot_volume_mode == other.preserve_boot_volume_mode
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



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/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 148

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


128
129
130
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 128

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



137
138
139
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 137

def hash
  [preserve_block_volume_mode, preserve_boot_volume_mode].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



181
182
183
184
185
186
187
188
189
190
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 181

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



175
176
177
# File 'lib/oci/core/models/instance_pool_pre_termination_action_handle_timeout_details.rb', line 175

def to_s
  to_hash.to_s
end