Class: Hcloud::LoadBalancer

Inherits:
Object
  • Object
show all
Includes:
EntryLoader
Defined in:
lib/hcloud/load_balancer.rb

Instance Attribute Summary

Attributes included from EntryLoader

#response

Instance Method Summary collapse

Methods included from EntryLoader

#_attributes, #_load, #_run_callbacks, #_update_attribute, #client, #initialize, #inspect, #method_missing, #prepare_request, #resource_path, #resource_url, #respond_to_missing?, #rollback, #save, #update

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hcloud::EntryLoader

Instance Method Details

#add_service(protocol:, listen_port:, destination_port:, health_check:, proxyprotocol:, http: nil) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/hcloud/load_balancer.rb', line 61

def add_service(
  protocol:, listen_port:, destination_port:, health_check:, proxyprotocol:, http: nil
)
  validate_service_input(
    protocol: protocol,
    listen_port: listen_port,
    destination_port: destination_port,
    health_check: health_check,
    proxyprotocol: proxyprotocol
  )

  prepare_request('actions/add_service', j: COLLECT_ARGS.call(__method__, binding))
end

#add_target(type:, server: nil, label_selector: nil, ip: nil, use_private_ip: false) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/hcloud/load_balancer.rb', line 95

def add_target(type:, server: nil, label_selector: nil, ip: nil, use_private_ip: false)
  validate_target_input(
    type: type, server: server, label_selector: label_selector, ip: ip
  )

  prepare_request('actions/add_target', j: COLLECT_ARGS.call(__method__, binding))
end

#attach_to_network(network:, ip: nil) ⇒ Object



30
31
32
33
34
# File 'lib/hcloud/load_balancer.rb', line 30

def attach_to_network(network:, ip: nil)
  raise Hcloud::Error::InvalidInput, 'no network given' if network.nil?

  prepare_request('actions/attach_to_network', j: COLLECT_ARGS.call(__method__, binding))
end

#change_algorithm(type:) ⇒ Object



55
56
57
58
59
# File 'lib/hcloud/load_balancer.rb', line 55

def change_algorithm(type:)
  raise Hcloud::Error::InvalidInput, 'no type given' if type.blank?

  prepare_request('actions/change_algorithm', j: COLLECT_ARGS.call(__method__, binding))
end

#change_dns_ptr(ip:, dns_ptr:) ⇒ Object



42
43
44
45
46
47
# File 'lib/hcloud/load_balancer.rb', line 42

def change_dns_ptr(ip:, dns_ptr:)
  raise Hcloud::Error::InvalidInput, 'no IP given' if ip.blank?
  raise Hcloud::Error::InvalidInput, 'no dns_ptr given' if dns_ptr.blank?

  prepare_request('actions/change_dns_ptr', j: COLLECT_ARGS.call(__method__, binding))
end

#change_type(load_balancer_type:) ⇒ Object



49
50
51
52
53
# File 'lib/hcloud/load_balancer.rb', line 49

def change_type(load_balancer_type:)
  raise Hcloud::Error::InvalidInput, 'no type given' if load_balancer_type.blank?

  prepare_request('actions/change_type', j: COLLECT_ARGS.call(__method__, binding))
end

#delete_service(listen_port:) ⇒ Object



89
90
91
92
93
# File 'lib/hcloud/load_balancer.rb', line 89

def delete_service(listen_port:)
  raise Hcloud::Error::InvalidInput, 'no listen_port given' if listen_port.nil?

  prepare_request('actions/delete_service', j: COLLECT_ARGS.call(__method__, binding))
end

#detach_from_network(network:) ⇒ Object



36
37
38
39
40
# File 'lib/hcloud/load_balancer.rb', line 36

def detach_from_network(network:)
  raise Hcloud::Error::InvalidInput, 'no network given' if network.nil?

  prepare_request('actions/detach_from_network', j: COLLECT_ARGS.call(__method__, binding))
end

#remove_target(type:, server: nil, label_selector: nil, ip: nil) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/hcloud/load_balancer.rb', line 103

def remove_target(type:, server: nil, label_selector: nil, ip: nil)
  validate_target_input(
    type: type, server: server, label_selector: label_selector, ip: ip
  )

  prepare_request('actions/remove_target', j: COLLECT_ARGS.call(__method__, binding))
end

#update_service(protocol:, listen_port:, destination_port:, health_check:, proxyprotocol:, http: nil) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/hcloud/load_balancer.rb', line 75

def update_service(
  protocol:, listen_port:, destination_port:, health_check:, proxyprotocol:, http: nil
)
  validate_service_input(
    protocol: protocol,
    listen_port: listen_port,
    destination_port: destination_port,
    health_check: health_check,
    proxyprotocol: proxyprotocol
  )

  prepare_request('actions/update_service', j: COLLECT_ARGS.call(__method__, binding))
end