class OCI::OsManagement::Models::WindowsUpdate

An update available for a Windows managed instance.

Constants

INSTALLATION_REQUIREMENTS_ENUM
IS_ELIGIBLE_FOR_INSTALLATION_ENUM
UPDATE_TYPE_ENUM

Attributes

description[RW]

Information about the Windows Update. @return [String]

display_name[RW]

[Required] Windows Update name. @return [String]

installation_requirements[R]

List of requirements forinstalling on a managed instances @return [Array<String>]

is_eligible_for_installation[R]

Indicates whether the update can be installed using OSMS. @return [String]

is_reboot_required_for_installation[RW]

Indicates whether a reboot may be required to complete installation of this update. @return [BOOLEAN]

kb_article_ids[RW]

List of the Microsoft Knowledge Base Article Ids related to this Windows Update. @return [Array<String>]

name[RW]

[Required] Unique identifier for the Windows update. NOTE - This is not an OCID, but is a unique identifier assigned by Microsoft. Example: `6981d463-cd91-4a26-b7c4-ea4ded9183ed`

@return [String]

size_in_bytes[RW]

size of the package in bytes @return [Integer]

update_type[R]

[Required] The purpose of this update. @return [String]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/os_management/models/windows_update.rb, line 73
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'displayName',
    'name': :'name',
    'description': :'description',
    'update_type': :'updateType',
    'size_in_bytes': :'sizeInBytes',
    'is_eligible_for_installation': :'isEligibleForInstallation',
    'installation_requirements': :'installationRequirements',
    'is_reboot_required_for_installation': :'isRebootRequiredForInstallation',
    'kb_article_ids': :'kbArticleIds'
    # 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] :display_name The value to assign to the {#display_name} property @option attributes [String] :name The value to assign to the {#name} property @option attributes [String] :description The value to assign to the {#description} property @option attributes [String] :update_type The value to assign to the {#update_type} property @option attributes [Integer] :size_in_bytes The value to assign to the {#size_in_bytes} property @option attributes [String] :is_eligible_for_installation The value to assign to the {#is_eligible_for_installation} property @option attributes [Array<String>] :installation_requirements The value to assign to the {#installation_requirements} property @option attributes [BOOLEAN] :is_reboot_required_for_installation The value to assign to the {#is_reboot_required_for_installation} property @option attributes [Array<String>] :kb_article_ids The value to assign to the {#kb_article_ids} property

# File lib/oci/os_management/models/windows_update.rb, line 121
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.display_name = attributes[:'displayName'] if attributes[:'displayName']

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

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

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

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

  self.update_type = attributes[:'updateType'] if attributes[:'updateType']

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

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

  self.size_in_bytes = attributes[:'sizeInBytes'] if attributes[:'sizeInBytes']

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

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

  self.is_eligible_for_installation = attributes[:'isEligibleForInstallation'] if attributes[:'isEligibleForInstallation']

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

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

  self.installation_requirements = attributes[:'installationRequirements'] if attributes[:'installationRequirements']

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

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

  self.is_reboot_required_for_installation = attributes[:'isRebootRequiredForInstallation'] unless attributes[:'isRebootRequiredForInstallation'].nil?

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

  self.is_reboot_required_for_installation = attributes[:'is_reboot_required_for_installation'] unless attributes[:'is_reboot_required_for_installation'].nil?

  self.kb_article_ids = attributes[:'kbArticleIds'] if attributes[:'kbArticleIds']

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

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

Attribute type mapping.

# File lib/oci/os_management/models/windows_update.rb, line 90
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'display_name': :'String',
    'name': :'String',
    'description': :'String',
    'update_type': :'String',
    'size_in_bytes': :'Integer',
    'is_eligible_for_installation': :'String',
    'installation_requirements': :'Array<String>',
    'is_reboot_required_for_installation': :'BOOLEAN',
    'kb_article_ids': :'Array<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/os_management/models/windows_update.rb, line 227
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    display_name == other.display_name &&
    name == other.name &&
    description == other.description &&
    update_type == other.update_type &&
    size_in_bytes == other.size_in_bytes &&
    is_eligible_for_installation == other.is_eligible_for_installation &&
    installation_requirements == other.installation_requirements &&
    is_reboot_required_for_installation == other.is_reboot_required_for_installation &&
    kb_article_ids == other.kb_article_ids
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/os_management/models/windows_update.rb, line 265
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/os_management/models/windows_update.rb, line 245
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/os_management/models/windows_update.rb, line 254
def hash
  [display_name, name, description, update_type, size_in_bytes, is_eligible_for_installation, installation_requirements, is_reboot_required_for_installation, kb_article_ids].hash
end
installation_requirements=(installation_requirements) click to toggle source

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

# File lib/oci/os_management/models/windows_update.rb, line 204
def installation_requirements=(installation_requirements)
  # rubocop:disable Style/ConditionalAssignment
  if installation_requirements.nil?
    @installation_requirements = nil
  else
    @installation_requirements =
      installation_requirements.collect do |item|
        if INSTALLATION_REQUIREMENTS_ENUM.include?(item)
          item
        else
          OCI.logger.debug("Unknown value for 'installation_requirements' [#{item}]. Mapping to 'INSTALLATION_REQUIREMENTS_UNKNOWN_ENUM_VALUE'") if OCI.logger
          INSTALLATION_REQUIREMENTS_UNKNOWN_ENUM_VALUE
        end
      end
  end
  # rubocop:enable Style/ConditionalAssignment
end
is_eligible_for_installation=(is_eligible_for_installation) click to toggle source

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

# File lib/oci/os_management/models/windows_update.rb, line 191
def is_eligible_for_installation=(is_eligible_for_installation)
  # rubocop:disable Style/ConditionalAssignment
  if is_eligible_for_installation && !IS_ELIGIBLE_FOR_INSTALLATION_ENUM.include?(is_eligible_for_installation)
    OCI.logger.debug("Unknown value for 'is_eligible_for_installation' [" + is_eligible_for_installation + "]. Mapping to 'IS_ELIGIBLE_FOR_INSTALLATION_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @is_eligible_for_installation = IS_ELIGIBLE_FOR_INSTALLATION_UNKNOWN_ENUM_VALUE
  else
    @is_eligible_for_installation = is_eligible_for_installation
  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/os_management/models/windows_update.rb, line 298
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/os_management/models/windows_update.rb, line 292
def to_s
  to_hash.to_s
end
update_type=(update_type) click to toggle source

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

# File lib/oci/os_management/models/windows_update.rb, line 178
def update_type=(update_type)
  # rubocop:disable Style/ConditionalAssignment
  if update_type && !UPDATE_TYPE_ENUM.include?(update_type)
    OCI.logger.debug("Unknown value for 'update_type' [" + update_type + "]. Mapping to 'UPDATE_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @update_type = UPDATE_TYPE_UNKNOWN_ENUM_VALUE
  else
    @update_type = update_type
  end
  # rubocop:enable Style/ConditionalAssignment
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/os_management/models/windows_update.rb, line 315
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