class OCI::Database::Models::AutonomousPatch

AutonomousPatch model.

Constants

LIFECYCLE_STATE_ENUM
PATCH_MODEL_ENUM

Attributes

description[RW]

[Required] The text describing this patch package. @return [String]

id[RW]

[Required] The [OCID](docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the patch. @return [String]

lifecycle_details[RW]

A descriptive text associated with the lifecycleState. Typically can contain additional displayable text.

@return [String]

lifecycle_state[R]

The current state of the patch as a result of lastAction. @return [String]

patch_model[R]

Database patching model preference. See [My Oracle Support note 2285040.1](support.oracle.com/rs?type=doc&id=2285040.1) for information on the Release Update (RU) and Release Update Revision (RUR) patching models. @return [String]

quarter[RW]

First month of the quarter in which the patch was released. @return [String]

time_released[RW]

[Required] The date and time that the patch was released. @return [DateTime]

type[RW]

[Required] The type of patch. BUNDLE is one example. @return [String]

version[RW]

[Required] The version of this patch package. @return [String]

year[RW]

Year in which the patch was released. @return [String]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/database/models/autonomous_patch.rb, line 68
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'description': :'description',
    'type': :'type',
    'lifecycle_details': :'lifecycleDetails',
    'lifecycle_state': :'lifecycleState',
    'time_released': :'timeReleased',
    'version': :'version',
    'patch_model': :'patchModel',
    'quarter': :'quarter',
    'year': :'year'
    # rubocop:enable Style/SymbolLiteral
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [String] :id The value to assign to the {#id} property @option attributes [String] :description The value to assign to the {#description} property @option attributes [String] :type The value to assign to the {#type} property @option attributes [String] :lifecycle_details The value to assign to the {#lifecycle_details} property @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property @option attributes [DateTime] :time_released The value to assign to the {#time_released} property @option attributes [String] :version The value to assign to the {#version} property @option attributes [String] :patch_model The value to assign to the {#patch_model} property @option attributes [String] :quarter The value to assign to the {#quarter} property @option attributes [String] :year The value to assign to the {#year} property

# File lib/oci/database/models/autonomous_patch.rb, line 119
def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

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

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

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

  self.lifecycle_details = attributes[:'lifecycleDetails'] if attributes[:'lifecycleDetails']

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

  self.time_released = attributes[:'timeReleased'] if attributes[:'timeReleased']

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

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

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

  self.patch_model = attributes[:'patchModel'] if attributes[:'patchModel']

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

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

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

  self.year = attributes[:'year'] if attributes[:'year']
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/oci/database/models/autonomous_patch.rb, line 86
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'description': :'String',
    'type': :'String',
    'lifecycle_details': :'String',
    'lifecycle_state': :'String',
    'time_released': :'DateTime',
    'version': :'String',
    'patch_model': :'String',
    'quarter': :'String',
    'year': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Public Instance Methods

==(other) click to toggle source

Checks equality by comparing each attribute. @param [Object] other the other object to be compared

# File lib/oci/database/models/autonomous_patch.rb, line 192
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    id == other.id &&
    description == other.description &&
    type == other.type &&
    lifecycle_details == other.lifecycle_details &&
    lifecycle_state == other.lifecycle_state &&
    time_released == other.time_released &&
    version == other.version &&
    patch_model == other.patch_model &&
    quarter == other.quarter &&
    year == other.year
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/oci/database/models/autonomous_patch.rb, line 231
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) click to toggle source

@see the `==` method @param [Object] other the other object to be compared

# File lib/oci/database/models/autonomous_patch.rb, line 211
def eql?(other)
  self == other
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/oci/database/models/autonomous_patch.rb, line 220
def hash
  [id, description, type, lifecycle_details, lifecycle_state, time_released, version, patch_model, quarter, year].hash
end
lifecycle_state=(lifecycle_state) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] lifecycle_state Object to be assigned

# File lib/oci/database/models/autonomous_patch.rb, line 163
def lifecycle_state=(lifecycle_state)
  # rubocop:disable Style/ConditionalAssignment
  if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
    OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
  else
    @lifecycle_state = lifecycle_state
  end
  # rubocop:enable Style/ConditionalAssignment
end
patch_model=(patch_model) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] patch_model Object to be assigned

# File lib/oci/database/models/autonomous_patch.rb, line 176
def patch_model=(patch_model)
  # rubocop:disable Style/ConditionalAssignment
  if patch_model && !PATCH_MODEL_ENUM.include?(patch_model)
    OCI.logger.debug("Unknown value for 'patch_model' [" + patch_model + "]. Mapping to 'PATCH_MODEL_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @patch_model = PATCH_MODEL_UNKNOWN_ENUM_VALUE
  else
    @patch_model = patch_model
  end
  # rubocop:enable Style/ConditionalAssignment
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/oci/database/models/autonomous_patch.rb, line 264
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() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/oci/database/models/autonomous_patch.rb, line 258
def to_s
  to_hash.to_s
end

Private Instance Methods

_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/oci/database/models/autonomous_patch.rb, line 281
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end