hetzner 0.0.2 → 0.0.22
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 +10 -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 +31 -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 -3
- data/hetzner-0.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 417250f33d174488ff2e82c8492b4fd7d78e671ce61864c9406b7999632242d0
|
4
|
+
data.tar.gz: 9f723d5e347e711ff3b636ecdfc2f1cd5dd06ce51d9b2398530391f956c4b749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaf61595620306167b90f031fc108da683f247a2f40d182c21550f03695f204d96d2f5478613cd1c1dcf33d48320a1669b58c00b24713fcade1bcd76c9df9a3f
|
7
|
+
data.tar.gz: d94896ec6903e5f3276920517578f672a79d8de22088f03ce775be229f248e64d78fc787d3181a5198522e21d21d84926255c96ee89c4a9339aa3199b8171100
|
data/.DS_Store
CHANGED
Binary file
|
data/lib/hetzner/client.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "faraday"
|
3
3
|
require "oj"
|
4
|
+
Dir[File.join(__dir__, 'commands', '*.rb')].each { |f| require f }
|
4
5
|
|
5
6
|
module Hetzner
|
6
7
|
class Client
|
7
|
-
API_ENDPOINT =
|
8
|
+
API_ENDPOINT = "https://api.hetzner.cloud".freeze
|
8
9
|
|
9
10
|
attr_reader :api_token
|
10
11
|
|
@@ -12,25 +13,23 @@ module Hetzner
|
|
12
13
|
@api_token = api_token
|
13
14
|
end
|
14
15
|
|
15
|
-
def list_server_types
|
16
|
-
request(
|
17
|
-
http_method: :get,
|
18
|
-
endpoint: "/server_types"
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
16
|
private
|
23
17
|
|
24
18
|
def client
|
25
19
|
@_client ||= Faraday.new(API_ENDPOINT) do |client|
|
26
20
|
client.request :url_encoded
|
27
21
|
client.adapter Faraday.default_adapter
|
28
|
-
client.headers['Authorization'] = "Bearer #{api_token}" if api_token.present?
|
22
|
+
client.headers['Authorization'] = "Bearer #{@api_token}" if @api_token.present?
|
29
23
|
end
|
30
24
|
end
|
31
25
|
|
32
|
-
def
|
33
|
-
response = client.
|
26
|
+
def get(endpoint)
|
27
|
+
response = client.get(endpoint)
|
28
|
+
Oj.load(response.body)
|
29
|
+
end
|
30
|
+
|
31
|
+
def post(endpoint, body)
|
32
|
+
response = client.post(endpoint, body.to_json, "Content-Type" => "application/json")
|
34
33
|
Oj.load(response.body)
|
35
34
|
end
|
36
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,31 @@
|
|
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
|
+
|
27
|
+
def create_server(name, server_type, image)
|
28
|
+
post("/v1/servers", { name: name, server_type: server_type, image: image })
|
29
|
+
end
|
30
|
+
end
|
31
|
+
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.22
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -52,9 +52,23 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- bin/console
|
54
54
|
- bin/setup
|
55
|
-
- hetzner-0.0.1.gem
|
56
55
|
- lib/hetzner.rb
|
57
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
|
58
72
|
- lib/hetzner/version.rb
|
59
73
|
- sig/hetzner.rbs
|
60
74
|
homepage: https://github.com/Serviox/hetzner.git
|
data/hetzner-0.0.1.gem
DELETED
Binary file
|