Class: Fog::Hyperv::Compute::ComPort

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/hyperv/compute/models/com_port.rb

Overview

The configuration of a virtual COM port on a VM

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#initialize

Methods included from ModelExtends

#collection

Methods included from ModelIncludes

#cluster, #computer, #dirty, #dirty?, #vm

Constructor Details

This class inherits a constructor from Fog::Hyperv::Model

Instance Attribute Details

#computer_nameString (readonly)

Returns the name of the computer running the VM that this COM port is attached to.

Returns:

  • (String)

    the name of the computer running the VM that this COM port is attached to



17
# File 'lib/fog/hyperv/compute/models/com_port.rb', line 17

attribute :computer_name, type: :string

#debugger_mode:On, :Off

Returns if a debugger enabled on this COM port.

Returns:

  • (:On, :Off)

    if a debugger enabled on this COM port



21
# File 'lib/fog/hyperv/compute/models/com_port.rb', line 21

attribute :debugger_mode, type: :hypervenum, values: Fog::Hyperv::ON_OFF_STATE_ENUM_VALUES

#idString (readonly)

Returns the combined GUID of this COM port.

Returns:

  • (String)

    the combined GUID of this COM port



10
# File 'lib/fog/hyperv/compute/models/com_port.rb', line 10

identity :id, type: :string

#nameString (readonly)

Returns the name of this COM port.

Returns:

  • (String)

    the name of this COM port



24
# File 'lib/fog/hyperv/compute/models/com_port.rb', line 24

attribute :name, type: :string

#pathString

Returns the path of the file/socket this COM port is attached to.

Returns:

  • (String)

    the path of the file/socket this COM port is attached to



27
# File 'lib/fog/hyperv/compute/models/com_port.rb', line 27

attribute :path

#vm_idString (readonly)

Returns the GUID of the VM this COM port is attached to.

Returns:

  • (String)

    the GUID of the VM this COM port is attached to



14
# File 'lib/fog/hyperv/compute/models/com_port.rb', line 14

attribute :vm_id, type: :string

Instance Method Details

#reloadObject

Reload attributes from Hyper-V



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fog/hyperv/compute/models/com_port.rb', line 55

def reload
  requires :vm_id, :id

  data = service.get_vm_com_port(
    computer_name:,
    vm_id:,
    id:,

    _return_fields: self.class.attributes
  )
  return unless data

  merge_attributes(data)
end

#updateObject

Save any modifications to Hyper-V



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fog/hyperv/compute/models/com_port.rb', line 30

def update
  requires :vm_id, :id

  changes = {
    debugger_mode: changed!(:debugger_mode)
  }.compact
  # Ensure path: nil is sent
  changes[:path] = path if changed? :path
  return self unless changes.any?

  merge_attributes(
    service.set_vm_com_port(
      computer_name:,
      vm_id:,
      id:,

      **changes,

      _always_include: changes.keys,
      _return_fields: self.class.attributes
    )
  )
end