Class: OCI::Opsi::Models::HostMemoryConfiguration

Inherits:
HostConfigurationMetricGroup show all
Defined in:
lib/oci/opsi/models/host_memory_configuration.rb

Overview

Memory Configuration metric for the host

Constant Summary

Constants inherited from HostConfigurationMetricGroup

OCI::Opsi::Models::HostConfigurationMetricGroup::METRIC_NAME_ENUM

Instance Attribute Summary collapse

Attributes inherited from HostConfigurationMetricGroup

#metric_name, #time_collected

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HostConfigurationMetricGroup

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ HostMemoryConfiguration

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 75

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

  attributes['metricName'] = 'HOST_MEMORY_CONFIGURATION'

  super(attributes)

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

  self.page_size_in_kb = attributes[:'pageSizeInKB'] if attributes[:'pageSizeInKB']

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

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

  self.page_tables_in_kb = attributes[:'pageTablesInKB'] if attributes[:'pageTablesInKB']

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

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

  self.swap_total_in_kb = attributes[:'swapTotalInKB'] if attributes[:'swapTotalInKB']

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

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

  self.huge_page_size_in_kb = attributes[:'hugePageSizeInKB'] if attributes[:'hugePageSizeInKB']

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

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

  self.huge_pages_total = attributes[:'hugePagesTotal'] if attributes[:'hugePagesTotal']

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

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

Instance Attribute Details

#huge_page_size_in_kbFloat

Size of huge pages in kilobytes

Returns:

  • (Float)


27
28
29
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 27

def huge_page_size_in_kb
  @huge_page_size_in_kb
end

#huge_pages_totalInteger

Total number of huge pages

Returns:

  • (Integer)


31
32
33
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 31

def huge_pages_total
  @huge_pages_total
end

#page_size_in_kbFloat

Page size in kilobytes

Returns:

  • (Float)


15
16
17
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 15

def page_size_in_kb
  @page_size_in_kb
end

#page_tables_in_kbFloat

Amount of memory used for page tables in kilobytes

Returns:

  • (Float)


19
20
21
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 19

def page_tables_in_kb
  @page_tables_in_kb
end

#swap_total_in_kbFloat

Amount of total swap space in kilobytes

Returns:

  • (Float)


23
24
25
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 23

def swap_total_in_kb
  @swap_total_in_kb
end

Class Method Details

.attribute_mapObject

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



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 34

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'metric_name': :'metricName',
    'time_collected': :'timeCollected',
    'page_size_in_kb': :'pageSizeInKB',
    'page_tables_in_kb': :'pageTablesInKB',
    'swap_total_in_kb': :'swapTotalInKB',
    'huge_page_size_in_kb': :'hugePageSizeInKB',
    'huge_pages_total': :'hugePagesTotal'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 49

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'metric_name': :'String',
    'time_collected': :'DateTime',
    'page_size_in_kb': :'Float',
    'page_tables_in_kb': :'Float',
    'swap_total_in_kb': :'Float',
    'huge_page_size_in_kb': :'Float',
    'huge_pages_total': :'Integer'
    # 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



123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 123

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

  self.class == other.class &&
    metric_name == other.metric_name &&
    time_collected == other.time_collected &&
    page_size_in_kb == other.page_size_in_kb &&
    page_tables_in_kb == other.page_tables_in_kb &&
    swap_total_in_kb == other.swap_total_in_kb &&
    huge_page_size_in_kb == other.huge_page_size_in_kb &&
    huge_pages_total == other.huge_pages_total
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



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 159

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


139
140
141
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 139

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



148
149
150
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 148

def hash
  [metric_name, time_collected, page_size_in_kb, page_tables_in_kb, swap_total_in_kb, huge_page_size_in_kb, huge_pages_total].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



192
193
194
195
196
197
198
199
200
201
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 192

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



186
187
188
# File 'lib/oci/opsi/models/host_memory_configuration.rb', line 186

def to_s
  to_hash.to_s
end