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
|
# File 'lib/fog/hyperv/models/compute/switch.rb', line 16
def save
requires :name
data = if persisted?
service.set_vm_switch(
computer_name: computer_name,
default_flow_minimum_bandwidth_absolute: default_flow_minimum_bandwidth_absolute,
default_flow_minimum_bandwidth_weight: default_flow_minimum_bandwidth_weight,
name: name,
net_adapter_interface_description: net_adapter_interface_description,
notes: notes,
switch_type: !net_adapter_interface_description && switch_type,
passthru: true,
_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)
self
end
|