Class: Fog::Compute::Hyperv::Switch
- Inherits:
-
Hyperv::Model
- Object
- Model
- Hyperv::Model
- Fog::Compute::Hyperv::Switch
- Defined in:
- lib/fog/hyperv/models/compute/switch.rb
Instance Method Summary collapse
Methods inherited from Hyperv::Model
Methods included from Hyperv::ModelExtends
Methods included from Hyperv::ModelIncludes
#cluster, #computer, #dirty?, #lazy_attributes, #parent, #vm
Constructor Details
This class inherits a constructor from Fog::Hyperv::Model
Instance Method Details
#reload ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/fog/hyperv/models/compute/switch.rb', line 53 def reload data = collection.get( name, computer_name: computer_name ) merge_attributes(data.attributes) @old = data self end |
#save ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fog/hyperv/models/compute/switch.rb', line 16 def save requires :name data = \ if persisted? service.set_vm_switch( computer_name: old.computer_name, name: old.name, net_adapter_interface_description: old.net_adapter_interface_description, switch_type: !old.net_adapter_interface_description && old.switch_type, passthru: true, default_flow_minimum_bandwidth_absolute: changed!(default_flow_minimum_bandwidth_absolute), default_flow_minimum_bandwidth_weight: changed!(default_flow_minimum_bandwidth_weight), notes: changed!(notes), _return_fields: self.class.attributes, _json_depth: 1 ) else service.new_vm_switch( computer_name: computer_name, name: name, net_adapter_interface_description: net_adapter_interface_description, notes: notes, switch_type: !net_adapter_interface_description && switch_type, _return_fields: self.class.attributes, _json_depth: 1 ) end merge_attributes(data) @old = dup self end |