Class: Ubicloud::LoadBalancer

Inherits:
Model
  • Object
show all
Defined in:
lib/ubicloud/model/load_balancer.rb

Instance Attribute Summary

Attributes inherited from Model

#adapter, #values

Instance Method Summary collapse

Methods inherited from Model

[], #[], #check_exists, create, #destroy, #id, #info, #initialize, #inspect, list, #location, #name, resolve_associations, #to_h

Constructor Details

This class inherits a constructor from Ubicloud::Model

Instance Method Details

#attach_vm(vm) ⇒ Object

Attach the given virtual machine to the firewall. Accepts either a Vm instance or a virtual machine id string. Returns a Vm instance.



36
37
38
# File 'lib/ubicloud/model/load_balancer.rb', line 36

def attach_vm(vm)
  vm_action(vm, "/attach-vm")
end

#detach_vm(vm) ⇒ Object

Detach the given virtual machine from the firewall. Accepts either a Vm instance or a virtual machine id string. Returns a Vm instance.



42
43
44
# File 'lib/ubicloud/model/load_balancer.rb', line 42

def detach_vm(vm)
  vm_action(vm, "/detach-vm")
end

#update(algorithm:, src_port:, dst_port:, health_check_endpoint:, vms:) ⇒ Object

Update the receiver with new parameters. Returns self.

The vms argument should be an array of virtual machines attached to the load balancer. The method will attach and detach virtual machines to the load balancer as needed so that the list of attached virtual machines matches the array given.



30
31
32
# File 'lib/ubicloud/model/load_balancer.rb', line 30

def update(algorithm:, src_port:, dst_port:, health_check_endpoint:, vms:)
  merge_into_values(adapter.patch(_path, algorithm:, src_port:, dst_port:, health_check_endpoint:, vms:))
end