Class: OCI::CloudMigrations::Models::OlvmCpu

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/cloud_migrations/models/olvm_cpu.rb

Overview

CPU attributes in OLVM

Constant Summary collapse

ARCHITECTURE_ENUM =
[
  ARCHITECTURE_AARCH64 = 'AARCH64'.freeze,
  ARCHITECTURE_PPC64 = 'PPC64'.freeze,
  ARCHITECTURE_S390_X = 'S390X'.freeze,
  ARCHITECTURE_UNDEFINED = 'UNDEFINED'.freeze,
  ARCHITECTURE_X86_64 = 'X86_64'.freeze
].freeze
MODE_ENUM =
[
  MODE_CUSTOM = 'CUSTOM'.freeze,
  MODE_HOST_MODEL = 'HOST_MODEL'.freeze,
  MODE_HOST_PASSTHROUGH = 'HOST_PASSTHROUGH'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ OlvmCpu

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 108

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

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

  self.cpu_tune = attributes[:'cpuTune'] if attributes[:'cpuTune']

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

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

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

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

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

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

  self.cpu_topology = attributes[:'cpuTopology'] if attributes[:'cpuTopology']

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

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

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

Instance Attribute Details

#architectureString

CPU architecture

Returns:

  • (String)


27
28
29
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 27

def architecture
  @architecture
end

#coreArray<OCI::CloudMigrations::Models::OlvmCore>

List of cores of this CPU



31
32
33
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 31

def core
  @core
end

#cpu_topologyOCI::CloudMigrations::Models::OlvmCpuTopology



53
54
55
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 53

def cpu_topology
  @cpu_topology
end

#cpu_tuneOCI::CloudMigrations::Models::OlvmCpuTune



34
35
36
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 34

def cpu_tune
  @cpu_tune
end

#levelInteger

Level of this CPU

Returns:

  • (Integer)


38
39
40
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 38

def level
  @level
end

#modeString

CPU mode

Returns:

  • (String)


42
43
44
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 42

def mode
  @mode
end

#nameString

A human-readable name in plain text.

Returns:

  • (String)


46
47
48
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 46

def name
  @name
end

#speedFloat

Speed of this CPU

Returns:

  • (Float)


50
51
52
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 50

def speed
  @speed
end

#typeString

CPU type

Returns:

  • (String)


57
58
59
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 57

def type
  @type
end

Class Method Details

.attribute_mapObject

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



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 60

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'architecture': :'architecture',
    'core': :'core',
    'cpu_tune': :'cpuTune',
    'level': :'level',
    'mode': :'mode',
    'name': :'name',
    'speed': :'speed',
    'cpu_topology': :'cpuTopology',
    'type': :'type'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 77

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'architecture': :'String',
    'core': :'Array<OCI::CloudMigrations::Models::OlvmCore>',
    'cpu_tune': :'OCI::CloudMigrations::Models::OlvmCpuTune',
    'level': :'Integer',
    'mode': :'String',
    'name': :'String',
    'speed': :'Float',
    'cpu_topology': :'OCI::CloudMigrations::Models::OlvmCpuTopology',
    'type': :'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



164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 164

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

  self.class == other.class &&
    architecture == other.architecture &&
    core == other.core &&
    cpu_tune == other.cpu_tune &&
    level == other.level &&
    mode == other.mode &&
    name == other.name &&
    speed == other.speed &&
    cpu_topology == other.cpu_topology &&
    type == other.type
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



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 202

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


182
183
184
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 182

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



191
192
193
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 191

def hash
  [architecture, core, cpu_tune, level, mode, name, speed, cpu_topology, type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



235
236
237
238
239
240
241
242
243
244
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 235

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



229
230
231
# File 'lib/oci/cloud_migrations/models/olvm_cpu.rb', line 229

def to_s
  to_hash.to_s
end