Class: OCI::Core::Models::CapacityBin

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

Overview

Total and remaining CPU and memory capacity for each capacity bucket.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CapacityBin

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



98
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
147
148
149
150
151
# File 'lib/oci/core/models/capacity_bin.rb', line 98

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

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

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

  self.total_ocpus = attributes[:'totalOcpus'] if attributes[:'totalOcpus']

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

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

  self.remaining_ocpus = attributes[:'remainingOcpus'] if attributes[:'remainingOcpus']

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

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

  self.total_memory_in_gbs = attributes[:'totalMemoryInGBs'] if attributes[:'totalMemoryInGBs']

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

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

  self.remaining_memory_in_gbs = attributes[:'remainingMemoryInGBs'] if attributes[:'remainingMemoryInGBs']

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

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

  self.total_local_volume_in_gbs = attributes[:'totalLocalVolumeInGBs'] if attributes[:'totalLocalVolumeInGBs']

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

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

  self.remaining_local_volume_in_gbs = attributes[:'remainingLocalVolumeInGBs'] if attributes[:'remainingLocalVolumeInGBs']

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

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

  self.supported_shapes = attributes[:'supportedShapes'] if attributes[:'supportedShapes']

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

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

Instance Attribute Details

#capacity_indexInteger

[Required] Zero-based index for the corresponding capacity bucket.

Returns:

  • (Integer)


15
16
17
# File 'lib/oci/core/models/capacity_bin.rb', line 15

def capacity_index
  @capacity_index
end

#remaining_local_volume_in_gbsFloat

The remaining local volume of the capacity bucket, in GBs.

Returns:

  • (Float)


45
46
47
# File 'lib/oci/core/models/capacity_bin.rb', line 45

def remaining_local_volume_in_gbs
  @remaining_local_volume_in_gbs
end

#remaining_memory_in_gbsFloat

[Required] The remaining memory of the capacity bucket, in GBs.

Returns:

  • (Float)


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

def remaining_memory_in_gbs
  @remaining_memory_in_gbs
end

#remaining_ocpusFloat

[Required] The available OCPUs of the capacity bucket.

Returns:

  • (Float)


25
26
27
# File 'lib/oci/core/models/capacity_bin.rb', line 25

def remaining_ocpus
  @remaining_ocpus
end

#supported_shapesArray<String>

[Required] List of VMI shapes supported on each capacity bucket.

Returns:

  • (Array<String>)


50
51
52
# File 'lib/oci/core/models/capacity_bin.rb', line 50

def supported_shapes
  @supported_shapes
end

#total_local_volume_in_gbsFloat

The total local volume of the capacity bucket, in GBs.

Returns:

  • (Float)


40
41
42
# File 'lib/oci/core/models/capacity_bin.rb', line 40

def total_local_volume_in_gbs
  @total_local_volume_in_gbs
end

#total_memory_in_gbsFloat

[Required] The total memory of the capacity bucket, in GBs.

Returns:

  • (Float)


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

def total_memory_in_gbs
  @total_memory_in_gbs
end

#total_ocpusFloat

[Required] The total OCPUs of the capacity bucket.

Returns:

  • (Float)


20
21
22
# File 'lib/oci/core/models/capacity_bin.rb', line 20

def total_ocpus
  @total_ocpus
end

Class Method Details

.attribute_mapObject

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



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/oci/core/models/capacity_bin.rb', line 53

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'capacity_index': :'capacityIndex',
    'total_ocpus': :'totalOcpus',
    'remaining_ocpus': :'remainingOcpus',
    'total_memory_in_gbs': :'totalMemoryInGBs',
    'remaining_memory_in_gbs': :'remainingMemoryInGBs',
    'total_local_volume_in_gbs': :'totalLocalVolumeInGBs',
    'remaining_local_volume_in_gbs': :'remainingLocalVolumeInGBs',
    'supported_shapes': :'supportedShapes'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'capacity_index': :'Integer',
    'total_ocpus': :'Float',
    'remaining_ocpus': :'Float',
    'total_memory_in_gbs': :'Float',
    'remaining_memory_in_gbs': :'Float',
    'total_local_volume_in_gbs': :'Float',
    'remaining_local_volume_in_gbs': :'Float',
    'supported_shapes': :'Array<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



160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/oci/core/models/capacity_bin.rb', line 160

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

  self.class == other.class &&
    capacity_index == other.capacity_index &&
    total_ocpus == other.total_ocpus &&
    remaining_ocpus == other.remaining_ocpus &&
    total_memory_in_gbs == other.total_memory_in_gbs &&
    remaining_memory_in_gbs == other.remaining_memory_in_gbs &&
    total_local_volume_in_gbs == other.total_local_volume_in_gbs &&
    remaining_local_volume_in_gbs == other.remaining_local_volume_in_gbs &&
    supported_shapes == other.supported_shapes
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



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

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


177
178
179
# File 'lib/oci/core/models/capacity_bin.rb', line 177

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



186
187
188
# File 'lib/oci/core/models/capacity_bin.rb', line 186

def hash
  [capacity_index, total_ocpus, remaining_ocpus, total_memory_in_gbs, remaining_memory_in_gbs, total_local_volume_in_gbs, remaining_local_volume_in_gbs, supported_shapes].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



230
231
232
233
234
235
236
237
238
239
# File 'lib/oci/core/models/capacity_bin.rb', line 230

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



224
225
226
# File 'lib/oci/core/models/capacity_bin.rb', line 224

def to_s
  to_hash.to_s
end