Class: OCI::Opsi::Models::HostMemoryStatistics

Inherits:
HostResourceStatistics show all
Defined in:
lib/oci/opsi/models/host_memory_statistics.rb

Overview

Contains memory statistics.

Constant Summary

Constants inherited from HostResourceStatistics

OCI::Opsi::Models::HostResourceStatistics::RESOURCE_NAME_ENUM

Instance Attribute Summary collapse

Attributes inherited from HostResourceStatistics

#capacity, #resource_name, #usage, #usage_change_percent, #utilization_percent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HostResourceStatistics

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ HostMemoryStatistics

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 99

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

  attributes['resourceName'] = 'HOST_MEMORY_STATISTICS'

  super(attributes)

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

  self.free_memory = attributes[:'freeMemory'] if attributes[:'freeMemory']

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

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

  self.available_memory = attributes[:'availableMemory'] if attributes[:'availableMemory']

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

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

  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']

  self.huge_page_size_in_mb = attributes[:'hugePageSizeInMB'] if attributes[:'hugePageSizeInMB']

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

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

  self.huge_pages_free = attributes[:'hugePagesFree'] if attributes[:'hugePagesFree']

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

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

  self.huge_pages_reserved = attributes[:'hugePagesReserved'] if attributes[:'hugePagesReserved']

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

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

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

Instance Attribute Details

#available_memoryFloat

Returns:

  • (Float)


17
18
19
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 17

def available_memory
  @available_memory
end

#free_memoryFloat

Returns:

  • (Float)


14
15
16
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 14

def free_memory
  @free_memory
end

#huge_page_size_in_mbFloat

Size of huge pages in megabytes.

Returns:

  • (Float)


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

def huge_page_size_in_mb
  @huge_page_size_in_mb
end

#huge_pages_freeInteger

Total number of available huge pages.

Returns:

  • (Integer)


32
33
34
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 32

def huge_pages_free
  @huge_pages_free
end

#huge_pages_reservedInteger

Total number of huge pages which are used or reserved.

Returns:

  • (Integer)


37
38
39
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 37

def huge_pages_reserved
  @huge_pages_reserved
end

#huge_pages_totalInteger

Total number of huge pages.

Returns:

  • (Integer)


22
23
24
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 22

def huge_pages_total
  @huge_pages_total
end

#loadOCI::Opsi::Models::SummaryStatistics



40
41
42
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 40

def load
  @load
end

Class Method Details

.attribute_mapObject

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



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 43

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'usage': :'usage',
    'capacity': :'capacity',
    'utilization_percent': :'utilizationPercent',
    'usage_change_percent': :'usageChangePercent',
    'resource_name': :'resourceName',
    'free_memory': :'freeMemory',
    'available_memory': :'availableMemory',
    'huge_pages_total': :'hugePagesTotal',
    'huge_page_size_in_mb': :'hugePageSizeInMB',
    'huge_pages_free': :'hugePagesFree',
    'huge_pages_reserved': :'hugePagesReserved',
    'load': :'load'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 63

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'usage': :'Float',
    'capacity': :'Float',
    'utilization_percent': :'Float',
    'usage_change_percent': :'Float',
    'resource_name': :'String',
    'free_memory': :'Float',
    'available_memory': :'Float',
    'huge_pages_total': :'Integer',
    'huge_page_size_in_mb': :'Float',
    'huge_pages_free': :'Integer',
    'huge_pages_reserved': :'Integer',
    'load': :'OCI::Opsi::Models::SummaryStatistics'
    # 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



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 155

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

  self.class == other.class &&
    usage == other.usage &&
    capacity == other.capacity &&
    utilization_percent == other.utilization_percent &&
    usage_change_percent == other.usage_change_percent &&
    resource_name == other.resource_name &&
    free_memory == other.free_memory &&
    available_memory == other.available_memory &&
    huge_pages_total == other.huge_pages_total &&
    huge_page_size_in_mb == other.huge_page_size_in_mb &&
    huge_pages_free == other.huge_pages_free &&
    huge_pages_reserved == other.huge_pages_reserved &&
    load == other.load
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



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 196

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


176
177
178
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 176

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



185
186
187
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 185

def hash
  [usage, capacity, utilization_percent, usage_change_percent, resource_name, free_memory, available_memory, huge_pages_total, huge_page_size_in_mb, huge_pages_free, huge_pages_reserved, load].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



229
230
231
232
233
234
235
236
237
238
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 229

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



223
224
225
# File 'lib/oci/opsi/models/host_memory_statistics.rb', line 223

def to_s
  to_hash.to_s
end