Class: OvirtSDK4::Cpu

Inherits:
Struct
  • Object
show all
Defined in:
lib/ovirtsdk4/types.rb,
lib/ovirtsdk4/types.rb

Instance Method Summary collapse

Methods included from Type

#dig, #href, #href=

Constructor Details

#initialize(opts = {}) ⇒ Cpu

Creates a new instance of the OvirtSDK4::Cpu class.

Parameters:

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

    A hash containing the attributes of the object. The keys of the hash should be symbols corresponding to the names of the attributes. The values of the hash should be the values of the attributes.

Options Hash (opts):

  • :architecture (Architecture)

    The value of attribute architecture.

  • :cores (Array<Core>, Array<Hash>)

    The values of attribute cores.

  • :cpu_tune (CpuTune, Hash)

    The value of attribute cpu_tune.

  • :level (Integer)

    The value of attribute level.

  • :mode (CpuMode)

    The value of attribute mode.

  • :name (String)

    The value of attribute name.

  • :speed (Float)

    The value of attribute speed.

  • :topology (CpuTopology, Hash)

    The value of attribute topology.

  • :type (String)

    The value of attribute type.


2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
# File 'lib/ovirtsdk4/types.rb', line 2406

def initialize(opts = {})
  super(opts)
  self.architecture = opts[:architecture]
  self.cores = opts[:cores]
  self.cpu_tune = opts[:cpu_tune]
  self.level = opts[:level]
  self.mode = opts[:mode]
  self.name = opts[:name]
  self.speed = opts[:speed]
  self.topology = opts[:topology]
  self.type = opts[:type]
end

Instance Method Details

#==(other) ⇒ Object

Returns true if self and other have the same attributes and values.


2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
# File 'lib/ovirtsdk4/types.rb', line 2422

def ==(other)
  super &&
  @architecture == other.architecture &&
  @cores == other.cores &&
  @cpu_tune == other.cpu_tune &&
  @level == other.level &&
  @mode == other.mode &&
  @name == other.name &&
  @speed == other.speed &&
  @topology == other.topology &&
  @type == other.type
end

#architectureArchitecture

Returns the value of the architecture attribute.

Returns:


2201
2202
2203
# File 'lib/ovirtsdk4/types.rb', line 2201

def architecture
  @architecture
end

#architecture=(value) ⇒ Object

Sets the value of the architecture attribute.

Parameters:


2210
2211
2212
# File 'lib/ovirtsdk4/types.rb', line 2210

def architecture=(value)
  @architecture = value
end

#coresArray<Core>

Returns the value of the cores attribute.

Returns:


2219
2220
2221
# File 'lib/ovirtsdk4/types.rb', line 2219

def cores
  @cores
end

#cores=(list) ⇒ Object

Sets the value of the cores attribute.

Parameters:

  • list (Array<Core>)

2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
# File 'lib/ovirtsdk4/types.rb', line 2228

def cores=(list)
  if list.class == Array
    list = List.new(list)
    list.each_with_index do |value, index|
      if value.is_a?(Hash)
        list[index] = Core.new(value)
      end
    end
  end
  @cores = list
end

#cpu_tuneCpuTune

Returns the value of the cpu_tune attribute.

Returns:


2245
2246
2247
# File 'lib/ovirtsdk4/types.rb', line 2245

def cpu_tune
  @cpu_tune
end

#cpu_tune=(value) ⇒ Object

Sets the value of the cpu_tune attribute.

The value parameter can be an instance of OvirtSDK4::CpuTune or a hash. If it is a hash then a new instance will be created passing the hash as the opts parameter to the constructor.

Parameters:


2258
2259
2260
2261
2262
2263
# File 'lib/ovirtsdk4/types.rb', line 2258

def cpu_tune=(value)
  if value.is_a?(Hash)
    value = CpuTune.new(value)
  end
  @cpu_tune = value
end

#hashObject

Generates a hash value for this object.


2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
# File 'lib/ovirtsdk4/types.rb', line 2438

def hash
  super +
  @architecture.hash +
  @cores.hash +
  @cpu_tune.hash +
  @level.hash +
  @mode.hash +
  @name.hash +
  @speed.hash +
  @topology.hash +
  @type.hash
end

#levelInteger

Returns the value of the level attribute.

Returns:

  • (Integer)

2270
2271
2272
# File 'lib/ovirtsdk4/types.rb', line 2270

def level
  @level
end

#level=(value) ⇒ Object

Sets the value of the level attribute.

Parameters:

  • value (Integer)

2279
2280
2281
# File 'lib/ovirtsdk4/types.rb', line 2279

def level=(value)
  @level = value
end

#modeCpuMode

Returns the value of the mode attribute.

Returns:


2288
2289
2290
# File 'lib/ovirtsdk4/types.rb', line 2288

def mode
  @mode
end

#mode=(value) ⇒ Object

Sets the value of the mode attribute.

Parameters:


2297
2298
2299
# File 'lib/ovirtsdk4/types.rb', line 2297

def mode=(value)
  @mode = value
end

#nameString

Returns the value of the name attribute.

Returns:

  • (String)

2306
2307
2308
# File 'lib/ovirtsdk4/types.rb', line 2306

def name
  @name
end

#name=(value) ⇒ Object

Sets the value of the name attribute.

Parameters:

  • value (String)

2315
2316
2317
# File 'lib/ovirtsdk4/types.rb', line 2315

def name=(value)
  @name = value
end

#speedFloat

Returns the value of the speed attribute.

Returns:

  • (Float)

2324
2325
2326
# File 'lib/ovirtsdk4/types.rb', line 2324

def speed
  @speed
end

#speed=(value) ⇒ Object

Sets the value of the speed attribute.

Parameters:

  • value (Float)

2333
2334
2335
# File 'lib/ovirtsdk4/types.rb', line 2333

def speed=(value)
  @speed = value
end

#topologyCpuTopology

Returns the value of the topology attribute.

Returns:


2342
2343
2344
# File 'lib/ovirtsdk4/types.rb', line 2342

def topology
  @topology
end

#topology=(value) ⇒ Object

Sets the value of the topology attribute.

The value parameter can be an instance of OvirtSDK4::CpuTopology or a hash. If it is a hash then a new instance will be created passing the hash as the opts parameter to the constructor.

Parameters:


2355
2356
2357
2358
2359
2360
# File 'lib/ovirtsdk4/types.rb', line 2355

def topology=(value)
  if value.is_a?(Hash)
    value = CpuTopology.new(value)
  end
  @topology = value
end

#typeString

Returns the value of the type attribute.

Returns:

  • (String)

2367
2368
2369
# File 'lib/ovirtsdk4/types.rb', line 2367

def type
  @type
end

#type=(value) ⇒ Object

Sets the value of the type attribute.

Parameters:

  • value (String)

2376
2377
2378
# File 'lib/ovirtsdk4/types.rb', line 2376

def type=(value)
  @type = value
end