Class: Hcloud::Network

Inherits:
Object
  • Object
show all
Includes:
EntryLoader
Defined in:
lib/hcloud/network.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_route(destination:, gateway:) ⇒ Object



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

def add_route(destination:, gateway:)
  raise Hcloud::Error::InvalidInput, 'no destination given' if destination.blank?
  raise Hcloud::Error::InvalidInput, 'no gateway given' if gateway.blank?

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

#add_subnet(type:, network_zone:, ip_range: nil) ⇒ Object



17
18
19
20
21
22
# File 'lib/hcloud/network.rb', line 17

def add_subnet(type:, network_zone:, ip_range: nil)
  raise Hcloud::Error::InvalidInput, 'no type given' if type.blank?
  raise Hcloud::Error::InvalidInput, 'no network_zone given' if network_zone.blank?

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

#change_ip_range(ip_range:) ⇒ Object



44
45
46
47
48
# File 'lib/hcloud/network.rb', line 44

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

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

#del_route(destination:, gateway:) ⇒ Object



37
38
39
40
41
42
# File 'lib/hcloud/network.rb', line 37

def del_route(destination:, gateway:)
  raise Hcloud::Error::InvalidInput, 'no destination given' if destination.blank?
  raise Hcloud::Error::InvalidInput, 'no gateway given' if gateway.blank?

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

#del_subnet(ip_range:) ⇒ Object



24
25
26
27
28
# File 'lib/hcloud/network.rb', line 24

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

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