Class: Hcloud::Firewall

Inherits:
Object
  • Object
show all
Includes:
EntryLoader
Defined in:
lib/hcloud/firewall.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

#apply_to_resources(apply_to:) ⇒ Object



25
26
27
28
29
# File 'lib/hcloud/firewall.rb', line 25

def apply_to_resources(apply_to:)
  raise Hcloud::Error::InvalidInput, 'no apply_to resources given' if apply_to.nil?

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

#remove_from_resources(remove_from:) ⇒ Object



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

def remove_from_resources(remove_from:)
  raise Hcloud::Error::InvalidInput, 'no remove_from resources given' if remove_from.nil?

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

#set_rules(rules:) ⇒ Object



18
19
20
21
22
23
# File 'lib/hcloud/firewall.rb', line 18

def set_rules(rules:)
  # Set rules to empty when nil is passed
  rules = rules.to_a

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