hetzner 0.0.1 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/lib/hetzner/client.rb +11 -11
- data/lib/hetzner/commands/actions.rb +11 -0
- data/lib/hetzner/commands/certificates.rb +19 -0
- data/lib/hetzner/commands/datacenters.rb +11 -0
- data/lib/hetzner/commands/firewalls.rb +19 -0
- data/lib/hetzner/commands/images.rb +19 -0
- data/lib/hetzner/commands/ips.rb +19 -0
- data/lib/hetzner/commands/isos.rb +11 -0
- data/lib/hetzner/commands/load_balancers.rb +31 -0
- data/lib/hetzner/commands/locations.rb +11 -0
- data/lib/hetzner/commands/networks.rb +19 -0
- data/lib/hetzner/commands/placement_groups.rb +11 -0
- data/lib/hetzner/commands/pricing.rb +7 -0
- data/lib/hetzner/commands/servers.rb +27 -0
- data/lib/hetzner/commands/ssh.rb +11 -0
- data/lib/hetzner/commands/volumes.rb +19 -0
- data/lib/hetzner/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8564112b50c1ebdc702892b47be85fcb7eb9b5c7cb58de764e9c727c7de0adc6
|
4
|
+
data.tar.gz: 1ee7d2a3f5e0f359255b30dc1692fe41e7c58af1c66a178493d3d612f1cbd3f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4a62122c785ab66045a1417c26812ab5a6090f522d971522f909330d270cc163bd51f6569ee579048cc3911ba84e56a7a0f20f99066d63cd09a6e2932ab6109
|
7
|
+
data.tar.gz: fa778bd705d95a67bfb532ceaf0cb0dfe2696ca1509dbcfd917466925a58325924af1196f9ba5adc7c82a7fda4e192fd471c1e0d88111414ad9e1283d4fd295f
|
data/.DS_Store
CHANGED
Binary file
|
data/lib/hetzner/client.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "faraday"
|
3
|
+
require "oj"
|
4
|
+
Dir["commands/*.rb"].each {|file| require file }
|
3
5
|
|
4
6
|
module Hetzner
|
5
7
|
class Client
|
6
|
-
API_ENDPOINT =
|
8
|
+
API_ENDPOINT = "https://api.hetzner.cloud".freeze
|
7
9
|
|
8
10
|
attr_reader :api_token
|
9
11
|
|
@@ -11,25 +13,23 @@ module Hetzner
|
|
11
13
|
@api_token = api_token
|
12
14
|
end
|
13
15
|
|
14
|
-
def list_server_types
|
15
|
-
request(
|
16
|
-
http_method: :get,
|
17
|
-
endpoint: "/server_types"
|
18
|
-
)
|
19
|
-
end
|
20
|
-
|
21
16
|
private
|
22
17
|
|
23
18
|
def client
|
24
19
|
@_client ||= Faraday.new(API_ENDPOINT) do |client|
|
25
20
|
client.request :url_encoded
|
26
21
|
client.adapter Faraday.default_adapter
|
27
|
-
client.headers['Authorization'] = "Bearer #{api_token}" if api_token.present?
|
22
|
+
client.headers['Authorization'] = "Bearer #{@api_token}" if @api_token.present?
|
28
23
|
end
|
29
24
|
end
|
30
25
|
|
31
|
-
def
|
32
|
-
response = client.public_send(
|
26
|
+
def get(endpoint, params = {})
|
27
|
+
response = client.public_send(:get, endpoint, params)
|
28
|
+
Oj.load(response.body)
|
29
|
+
end
|
30
|
+
|
31
|
+
def post(endpoint, params = {})
|
32
|
+
response = client.public_send(:post, endpoint, params)
|
33
33
|
Oj.load(response.body)
|
34
34
|
end
|
35
35
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hetzner
|
2
|
+
class Client
|
3
|
+
def certificates
|
4
|
+
get("/v1/certificates")
|
5
|
+
end
|
6
|
+
|
7
|
+
def certificate(id)
|
8
|
+
get("/v1/certificates/#{id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def certificate_actions(id)
|
12
|
+
get("/v1/certificates/#{id}/actions")
|
13
|
+
end
|
14
|
+
|
15
|
+
def certificate_action(id, action)
|
16
|
+
get("/v1/certificates/#{id}/actions/#{action}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hetzner
|
2
|
+
class Client
|
3
|
+
def firewalls
|
4
|
+
get("/v1/firewalls")
|
5
|
+
end
|
6
|
+
|
7
|
+
def firewall(id)
|
8
|
+
get("/v1/firewalls/#{id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def firewall_actions(id)
|
12
|
+
get("/v1/firewalls/#{id}/actions")
|
13
|
+
end
|
14
|
+
|
15
|
+
def firewall_action(id, action)
|
16
|
+
get("/v1/firewalls/#{id}/actions/#{action}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hetzner
|
2
|
+
class Client
|
3
|
+
def images
|
4
|
+
get("/v1/images")
|
5
|
+
end
|
6
|
+
|
7
|
+
def image(id)
|
8
|
+
get("/v1/images/#{id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def image_actions(id)
|
12
|
+
get("/v1/images/#{id}/actions")
|
13
|
+
end
|
14
|
+
|
15
|
+
def image_action(id, action)
|
16
|
+
get("/v1/images/#{id}/actions/#{action}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hetzner
|
2
|
+
class Client
|
3
|
+
def floating_ips
|
4
|
+
get("/v1/floating_ips")
|
5
|
+
end
|
6
|
+
|
7
|
+
def floating_ip(id)
|
8
|
+
get("/v1/floating_ips/#{id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def floating_ip_actions(id)
|
12
|
+
get("/v1/floating_ips/#{id}/actions")
|
13
|
+
end
|
14
|
+
|
15
|
+
def floating_ip_action(id, action)
|
16
|
+
get("/v1/floating_ips/#{id}/actions/#{action}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Hetzner
|
2
|
+
class Client
|
3
|
+
def load_balancers
|
4
|
+
get("/v1/load_balancers")
|
5
|
+
end
|
6
|
+
|
7
|
+
def load_balancer(id)
|
8
|
+
get("/v1/load_balancers/#{id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def load_balancer_metrics(id)
|
12
|
+
get("/v1/load_balancer/#{id}/metrics")
|
13
|
+
end
|
14
|
+
|
15
|
+
def load_balancer_actions(id)
|
16
|
+
get("/v1/load_balancers/#{id}/actions")
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_balancer_action(id, action)
|
20
|
+
get("/v1/load_balancers/#{id}/actions/#{action}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def load_balancer_types
|
24
|
+
get("/v1/load_balancer_types")
|
25
|
+
end
|
26
|
+
|
27
|
+
def load_balancer_type(id)
|
28
|
+
get("/v1/load_balancer_types/#{id}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hetzner
|
2
|
+
class Client
|
3
|
+
def networks
|
4
|
+
get("/v1/networks")
|
5
|
+
end
|
6
|
+
|
7
|
+
def network(id)
|
8
|
+
get("/v1/networks/#{id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def network_actions(id)
|
12
|
+
get("/v1/networks/#{id}/actions")
|
13
|
+
end
|
14
|
+
|
15
|
+
def network_action(id, action)
|
16
|
+
get("/v1/networks/#{id}/actions/#{action}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Hetzner
|
2
|
+
class Client
|
3
|
+
def servers
|
4
|
+
get("/v1/servers")
|
5
|
+
end
|
6
|
+
|
7
|
+
def server(id)
|
8
|
+
get("/v1/servers/#{id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def server_actions(id)
|
12
|
+
get("/v1/servers/#{id}/actions")
|
13
|
+
end
|
14
|
+
|
15
|
+
def server_action(id, action)
|
16
|
+
get("/v1/servers/#{id}/actions/#{action}")
|
17
|
+
end
|
18
|
+
|
19
|
+
def server_types
|
20
|
+
get("/v1/server_types")
|
21
|
+
end
|
22
|
+
|
23
|
+
def server_type(id)
|
24
|
+
get("/v1/server_types/#{id}")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hetzner
|
2
|
+
class Client
|
3
|
+
def volumes
|
4
|
+
get("/v1/volumes")
|
5
|
+
end
|
6
|
+
|
7
|
+
def volume(id)
|
8
|
+
get("/v1/volumes/#{id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def volume_actions(id)
|
12
|
+
get("/v1/volumes/#{id}/actions")
|
13
|
+
end
|
14
|
+
|
15
|
+
def volume_action(id, action)
|
16
|
+
get("/v1/volumes/#{id}/actions/#{action}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/hetzner/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hetzner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abe Shalash
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -54,6 +54,21 @@ files:
|
|
54
54
|
- bin/setup
|
55
55
|
- lib/hetzner.rb
|
56
56
|
- lib/hetzner/client.rb
|
57
|
+
- lib/hetzner/commands/actions.rb
|
58
|
+
- lib/hetzner/commands/certificates.rb
|
59
|
+
- lib/hetzner/commands/datacenters.rb
|
60
|
+
- lib/hetzner/commands/firewalls.rb
|
61
|
+
- lib/hetzner/commands/images.rb
|
62
|
+
- lib/hetzner/commands/ips.rb
|
63
|
+
- lib/hetzner/commands/isos.rb
|
64
|
+
- lib/hetzner/commands/load_balancers.rb
|
65
|
+
- lib/hetzner/commands/locations.rb
|
66
|
+
- lib/hetzner/commands/networks.rb
|
67
|
+
- lib/hetzner/commands/placement_groups.rb
|
68
|
+
- lib/hetzner/commands/pricing.rb
|
69
|
+
- lib/hetzner/commands/servers.rb
|
70
|
+
- lib/hetzner/commands/ssh.rb
|
71
|
+
- lib/hetzner/commands/volumes.rb
|
57
72
|
- lib/hetzner/version.rb
|
58
73
|
- sig/hetzner.rbs
|
59
74
|
homepage: https://github.com/Serviox/hetzner.git
|