Class: Hetzner::Client
- Inherits:
-
Object
- Object
- Hetzner::Client
- Defined in:
- lib/hetzner/client.rb,
lib/hetzner/commands/ips.rb,
lib/hetzner/commands/ssh.rb,
lib/hetzner/commands/isos.rb,
lib/hetzner/commands/images.rb,
lib/hetzner/commands/actions.rb,
lib/hetzner/commands/pricing.rb,
lib/hetzner/commands/servers.rb,
lib/hetzner/commands/volumes.rb,
lib/hetzner/commands/networks.rb,
lib/hetzner/commands/firewalls.rb,
lib/hetzner/commands/locations.rb,
lib/hetzner/commands/datacenters.rb,
lib/hetzner/commands/certificates.rb,
lib/hetzner/commands/load_balancers.rb,
lib/hetzner/commands/placement_groups.rb
Constant Summary collapse
- API_ENDPOINT =
"https://api.hetzner.cloud".freeze
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
Instance Method Summary collapse
- #action(id) ⇒ Object
- #actions ⇒ Object
- #certificate(id) ⇒ Object
- #certificate_action(id, action) ⇒ Object
- #certificate_actions(id) ⇒ Object
- #certificates ⇒ Object
- #create_server(name, server_type, image) ⇒ Object
- #datacenter(id) ⇒ Object
- #datacenters ⇒ Object
- #firewall(id) ⇒ Object
- #firewall_action(id, action) ⇒ Object
- #firewall_actions(id) ⇒ Object
- #firewalls ⇒ Object
- #floating_ip(id) ⇒ Object
- #floating_ip_action(id, action) ⇒ Object
- #floating_ip_actions(id) ⇒ Object
- #floating_ips ⇒ Object
- #image(id) ⇒ Object
- #image_action(id, action) ⇒ Object
- #image_actions(id) ⇒ Object
- #images ⇒ Object
-
#initialize(api_token = nil) ⇒ Client
constructor
A new instance of Client.
- #iso(id) ⇒ Object
- #isos ⇒ Object
- #load_balancer(id) ⇒ Object
- #load_balancer_action(id, action) ⇒ Object
- #load_balancer_actions(id) ⇒ Object
- #load_balancer_metrics(id) ⇒ Object
- #load_balancer_type(id) ⇒ Object
- #load_balancer_types ⇒ Object
- #load_balancers ⇒ Object
- #location(id) ⇒ Object
- #locations ⇒ Object
- #network(id) ⇒ Object
- #network_action(id, action) ⇒ Object
- #network_actions(id) ⇒ Object
- #networks ⇒ Object
- #placement_group(id) ⇒ Object
- #placement_groups ⇒ Object
- #pricing ⇒ Object
- #server(id) ⇒ Object
- #server_action(id, action) ⇒ Object
- #server_actions(id) ⇒ Object
- #server_type(id) ⇒ Object
- #server_types ⇒ Object
- #servers ⇒ Object
- #ssh_key(id) ⇒ Object
- #ssh_keys ⇒ Object
- #volume(id) ⇒ Object
- #volume_action(id, action) ⇒ Object
- #volume_actions(id) ⇒ Object
- #volumes ⇒ Object
Constructor Details
#initialize(api_token = nil) ⇒ Client
Returns a new instance of Client.
12 13 14 |
# File 'lib/hetzner/client.rb', line 12 def initialize(api_token = nil) @api_token = api_token end |
Instance Attribute Details
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token.
10 11 12 |
# File 'lib/hetzner/client.rb', line 10 def api_token @api_token end |
Instance Method Details
#action(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/actions.rb', line 7 def action(id) get("/v1/actions/#{id}") end |
#actions ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/actions.rb', line 3 def actions get("/v1/actions") end |
#certificate(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/certificates.rb', line 7 def certificate(id) get("/v1/certificates/#{id}") end |
#certificate_action(id, action) ⇒ Object
15 16 17 |
# File 'lib/hetzner/commands/certificates.rb', line 15 def certificate_action(id, action) get("/v1/certificates/#{id}/actions/#{action}") end |
#certificate_actions(id) ⇒ Object
11 12 13 |
# File 'lib/hetzner/commands/certificates.rb', line 11 def certificate_actions(id) get("/v1/certificates/#{id}/actions") end |
#certificates ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/certificates.rb', line 3 def certificates get("/v1/certificates") end |
#create_server(name, server_type, image) ⇒ Object
27 28 29 |
# File 'lib/hetzner/commands/servers.rb', line 27 def create_server(name, server_type, image) post("/v1/servers", { name: name, server_type: server_type, image: image }) end |
#datacenter(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/datacenters.rb', line 7 def datacenter(id) get("/v1/datacenters/#{id}") end |
#datacenters ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/datacenters.rb', line 3 def datacenters get("/v1/datacenters") end |
#firewall(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/firewalls.rb', line 7 def firewall(id) get("/v1/firewalls/#{id}") end |
#firewall_action(id, action) ⇒ Object
15 16 17 |
# File 'lib/hetzner/commands/firewalls.rb', line 15 def firewall_action(id, action) get("/v1/firewalls/#{id}/actions/#{action}") end |
#firewall_actions(id) ⇒ Object
11 12 13 |
# File 'lib/hetzner/commands/firewalls.rb', line 11 def firewall_actions(id) get("/v1/firewalls/#{id}/actions") end |
#firewalls ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/firewalls.rb', line 3 def firewalls get("/v1/firewalls") end |
#floating_ip(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/ips.rb', line 7 def floating_ip(id) get("/v1/floating_ips/#{id}") end |
#floating_ip_action(id, action) ⇒ Object
15 16 17 |
# File 'lib/hetzner/commands/ips.rb', line 15 def floating_ip_action(id, action) get("/v1/floating_ips/#{id}/actions/#{action}") end |
#floating_ip_actions(id) ⇒ Object
11 12 13 |
# File 'lib/hetzner/commands/ips.rb', line 11 def floating_ip_actions(id) get("/v1/floating_ips/#{id}/actions") end |
#floating_ips ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/ips.rb', line 3 def floating_ips get("/v1/floating_ips") end |
#image(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/images.rb', line 7 def image(id) get("/v1/images/#{id}") end |
#image_action(id, action) ⇒ Object
15 16 17 |
# File 'lib/hetzner/commands/images.rb', line 15 def image_action(id, action) get("/v1/images/#{id}/actions/#{action}") end |
#image_actions(id) ⇒ Object
11 12 13 |
# File 'lib/hetzner/commands/images.rb', line 11 def image_actions(id) get("/v1/images/#{id}/actions") end |
#images ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/images.rb', line 3 def images get("/v1/images") end |
#iso(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/isos.rb', line 7 def iso(id) get("/v1/isos/#{id}") end |
#isos ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/isos.rb', line 3 def isos get("/v1/isos") end |
#load_balancer(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/load_balancers.rb', line 7 def load_balancer(id) get("/v1/load_balancers/#{id}") end |
#load_balancer_action(id, action) ⇒ Object
19 20 21 |
# File 'lib/hetzner/commands/load_balancers.rb', line 19 def load_balancer_action(id, action) get("/v1/load_balancers/#{id}/actions/#{action}") end |
#load_balancer_actions(id) ⇒ Object
15 16 17 |
# File 'lib/hetzner/commands/load_balancers.rb', line 15 def load_balancer_actions(id) get("/v1/load_balancers/#{id}/actions") end |
#load_balancer_metrics(id) ⇒ Object
11 12 13 |
# File 'lib/hetzner/commands/load_balancers.rb', line 11 def load_balancer_metrics(id) get("/v1/load_balancer/#{id}/metrics") end |
#load_balancer_type(id) ⇒ Object
27 28 29 |
# File 'lib/hetzner/commands/load_balancers.rb', line 27 def load_balancer_type(id) get("/v1/load_balancer_types/#{id}") end |
#load_balancer_types ⇒ Object
23 24 25 |
# File 'lib/hetzner/commands/load_balancers.rb', line 23 def load_balancer_types get("/v1/load_balancer_types") end |
#load_balancers ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/load_balancers.rb', line 3 def load_balancers get("/v1/load_balancers") end |
#location(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/locations.rb', line 7 def location(id) get("/v1/locations/#{id}") end |
#locations ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/locations.rb', line 3 def locations get("/v1/locations") end |
#network(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/networks.rb', line 7 def network(id) get("/v1/networks/#{id}") end |
#network_action(id, action) ⇒ Object
15 16 17 |
# File 'lib/hetzner/commands/networks.rb', line 15 def network_action(id, action) get("/v1/networks/#{id}/actions/#{action}") end |
#network_actions(id) ⇒ Object
11 12 13 |
# File 'lib/hetzner/commands/networks.rb', line 11 def network_actions(id) get("/v1/networks/#{id}/actions") end |
#networks ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/networks.rb', line 3 def networks get("/v1/networks") end |
#placement_group(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/placement_groups.rb', line 7 def placement_group(id) get("/v1/placement_groups/#{id}") end |
#placement_groups ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/placement_groups.rb', line 3 def placement_groups get("/v1/placement_groups") end |
#pricing ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/pricing.rb', line 3 def pricing get("/v1/pricing") end |
#server(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/servers.rb', line 7 def server(id) get("/v1/servers/#{id}") end |
#server_action(id, action) ⇒ Object
15 16 17 |
# File 'lib/hetzner/commands/servers.rb', line 15 def server_action(id, action) get("/v1/servers/#{id}/actions/#{action}") end |
#server_actions(id) ⇒ Object
11 12 13 |
# File 'lib/hetzner/commands/servers.rb', line 11 def server_actions(id) get("/v1/servers/#{id}/actions") end |
#server_type(id) ⇒ Object
23 24 25 |
# File 'lib/hetzner/commands/servers.rb', line 23 def server_type(id) get("/v1/server_types/#{id}") end |
#server_types ⇒ Object
19 20 21 |
# File 'lib/hetzner/commands/servers.rb', line 19 def server_types get("/v1/server_types") end |
#servers ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/servers.rb', line 3 def servers get("/v1/servers") end |
#ssh_key(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/ssh.rb', line 7 def ssh_key(id) get("/v1/ssh_keys/#{id}") end |
#ssh_keys ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/ssh.rb', line 3 def ssh_keys get("/v1/ssh_keys") end |
#volume(id) ⇒ Object
7 8 9 |
# File 'lib/hetzner/commands/volumes.rb', line 7 def volume(id) get("/v1/volumes/#{id}") end |
#volume_action(id, action) ⇒ Object
15 16 17 |
# File 'lib/hetzner/commands/volumes.rb', line 15 def volume_action(id, action) get("/v1/volumes/#{id}/actions/#{action}") end |
#volume_actions(id) ⇒ Object
11 12 13 |
# File 'lib/hetzner/commands/volumes.rb', line 11 def volume_actions(id) get("/v1/volumes/#{id}/actions") end |
#volumes ⇒ Object
3 4 5 |
# File 'lib/hetzner/commands/volumes.rb', line 3 def volumes get("/v1/volumes") end |