hetzner 0.0.3 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/hetzner-0.0.8.gem +0 -0
- data/lib/hetzner/client.rb +202 -18
- data/lib/hetzner/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fac0ee13fb334c49349d3644ca56f8c3b5627d7c63faf08e4534885c67f6647b
|
4
|
+
data.tar.gz: 28ea05f3afd9c38505e77633a5ead66d6ed1b0ce674cc6de7f66590bacda1666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd669ee716f7f5d932d83449f4929325a1a690dfca934e7cb16efdb9a2ae7de21379a1ef0a656b54cee89b08360952fa0df2a114c3d6e70e5da948ccc24c8c43
|
7
|
+
data.tar.gz: f3ce36ac9f874e57f196ee232d462fe136c3dd28182225acbcd10e8216ed77f90c84bcfb166d883a175ef6c2e588dc7f39e52e59834eb5af5b1df3e2b727311d
|
data/hetzner-0.0.8.gem
ADDED
Binary file
|
data/lib/hetzner/client.rb
CHANGED
@@ -4,7 +4,7 @@ require "oj"
|
|
4
4
|
|
5
5
|
module Hetzner
|
6
6
|
class Client
|
7
|
-
API_ENDPOINT =
|
7
|
+
API_ENDPOINT = "https://api.hetzner.cloud".freeze
|
8
8
|
|
9
9
|
attr_reader :api_token
|
10
10
|
|
@@ -12,39 +12,223 @@ module Hetzner
|
|
12
12
|
@api_token = api_token
|
13
13
|
end
|
14
14
|
|
15
|
+
def servers
|
16
|
+
get("/v1/servers")
|
17
|
+
end
|
18
|
+
|
19
|
+
def server(id)
|
20
|
+
get("/v1/servers/#{id}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def server_actions(id)
|
24
|
+
get("/v1/servers/#{id}/actions")
|
25
|
+
end
|
26
|
+
|
27
|
+
def server_action(id, action)
|
28
|
+
get("/v1/servers/#{id}/actions/#{action}")
|
29
|
+
end
|
30
|
+
|
15
31
|
def server_types
|
16
|
-
|
17
|
-
http_method: :get,
|
18
|
-
endpoint: "/server_types"
|
19
|
-
)
|
32
|
+
get("/v1/server_types")
|
20
33
|
end
|
21
34
|
|
22
35
|
def server_type(id)
|
23
|
-
|
24
|
-
http_method: :get,
|
25
|
-
endpoint: "/server_types/#{id}"
|
26
|
-
)
|
36
|
+
get("/v1/server_types/#{id}")
|
27
37
|
end
|
28
38
|
|
29
39
|
def pricing
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
40
|
+
get("/v1/pricing")
|
41
|
+
end
|
42
|
+
|
43
|
+
def actions
|
44
|
+
get("/v1/actions")
|
45
|
+
end
|
46
|
+
|
47
|
+
def action(id)
|
48
|
+
get("/v1/actions/#{id}")
|
49
|
+
end
|
50
|
+
|
51
|
+
def certificates
|
52
|
+
get("/v1/certificates")
|
53
|
+
end
|
54
|
+
|
55
|
+
def certificate(id)
|
56
|
+
get("/v1/certificates/#{id}")
|
57
|
+
end
|
58
|
+
|
59
|
+
def certificate_actions(id)
|
60
|
+
get("/v1/certificates/#{id}/actions")
|
61
|
+
end
|
62
|
+
|
63
|
+
def certificate_action(id, action)
|
64
|
+
get("/v1/certificates/#{id}/actions/#{action}")
|
65
|
+
end
|
66
|
+
|
67
|
+
def datacenters
|
68
|
+
get("/v1/datacenters")
|
69
|
+
end
|
70
|
+
|
71
|
+
def datacenter(id)
|
72
|
+
get("/v1/datacenters/#{id}")
|
73
|
+
end
|
74
|
+
|
75
|
+
def firewalls
|
76
|
+
get("/v1/firewalls")
|
77
|
+
end
|
78
|
+
|
79
|
+
def firewall(id)
|
80
|
+
get("/v1/firewalls/#{id}")
|
81
|
+
end
|
82
|
+
|
83
|
+
def firewall_actions(id)
|
84
|
+
get("/v1/firewalls/#{id}/actions")
|
85
|
+
end
|
86
|
+
|
87
|
+
def firewall_action(id, action)
|
88
|
+
get("/v1/firewalls/#{id}/actions/#{action}")
|
89
|
+
end
|
90
|
+
|
91
|
+
def floating_ips
|
92
|
+
get("/v1/floating_ips")
|
93
|
+
end
|
94
|
+
|
95
|
+
def floating_ip(id)
|
96
|
+
get("/v1/floating_ips/#{id}")
|
97
|
+
end
|
98
|
+
|
99
|
+
def floating_ip_actions(id)
|
100
|
+
get("/v1/floating_ips/#{id}/actions")
|
101
|
+
end
|
102
|
+
|
103
|
+
def floating_ip_action(id, action)
|
104
|
+
get("/v1/floating_ips/#{id}/actions/#{action}")
|
105
|
+
end
|
106
|
+
|
107
|
+
def images
|
108
|
+
get("/v1/images")
|
109
|
+
end
|
110
|
+
|
111
|
+
def image(id)
|
112
|
+
get("/v1/images/#{id}")
|
113
|
+
end
|
114
|
+
|
115
|
+
def image_actions(id)
|
116
|
+
get("/v1/images/#{id}/actions")
|
117
|
+
end
|
118
|
+
|
119
|
+
def image_action(id, action)
|
120
|
+
get("/v1/images/#{id}/actions/#{action}")
|
121
|
+
end
|
122
|
+
|
123
|
+
def isos
|
124
|
+
get("/v1/isos")
|
125
|
+
end
|
126
|
+
|
127
|
+
def iso(id)
|
128
|
+
get("/v1/isos/#{id}")
|
129
|
+
end
|
130
|
+
|
131
|
+
def load_balancers
|
132
|
+
get("/v1/load_balancers")
|
133
|
+
end
|
134
|
+
|
135
|
+
def load_balancer(id)
|
136
|
+
get("/v1/load_balancers/#{id}")
|
137
|
+
end
|
138
|
+
|
139
|
+
def load_balancer_metrics(id)
|
140
|
+
get("/v1/load_balancer/#{id}/metrics")
|
141
|
+
end
|
142
|
+
|
143
|
+
def load_balancer_actions(id)
|
144
|
+
get("/v1/load_balancers/#{id}/actions")
|
145
|
+
end
|
146
|
+
|
147
|
+
def load_balancer_action(id, action)
|
148
|
+
get("/v1/load_balancers/#{id}/actions/#{action}")
|
149
|
+
end
|
150
|
+
|
151
|
+
def load_balancer_types
|
152
|
+
get("/v1/load_balancer_types")
|
153
|
+
end
|
154
|
+
|
155
|
+
def load_balancer_type(id)
|
156
|
+
get("/v1/load_balancer_types/#{id}")
|
157
|
+
end
|
158
|
+
|
159
|
+
def locations
|
160
|
+
get("/v1/locations")
|
161
|
+
end
|
162
|
+
|
163
|
+
def location(id)
|
164
|
+
get("/v1/locations/#{id}")
|
165
|
+
end
|
166
|
+
|
167
|
+
def networks
|
168
|
+
get("/v1/networks")
|
169
|
+
end
|
170
|
+
|
171
|
+
def network(id)
|
172
|
+
get("/v1/networks/#{id}")
|
173
|
+
end
|
174
|
+
|
175
|
+
def network_actions(id)
|
176
|
+
get("/v1/networks/#{id}/actions")
|
177
|
+
end
|
178
|
+
|
179
|
+
def network_action(id, action)
|
180
|
+
get("/v1/networks/#{id}/actions/#{action}")
|
181
|
+
end
|
182
|
+
|
183
|
+
def placement_groups
|
184
|
+
get("/v1/placement_groups")
|
185
|
+
end
|
186
|
+
|
187
|
+
def placement_group(id)
|
188
|
+
get("/v1/placement_groups/#{id}")
|
189
|
+
end
|
190
|
+
|
191
|
+
def ssh_keys
|
192
|
+
get("/v1/ssh_keys")
|
193
|
+
end
|
194
|
+
|
195
|
+
def ssh_key(id)
|
196
|
+
get("/v1/ssh_keys/#{id}")
|
197
|
+
end
|
198
|
+
|
199
|
+
def volumes
|
200
|
+
get("/v1/volumes")
|
201
|
+
end
|
202
|
+
|
203
|
+
def volume(id)
|
204
|
+
get("/v1/volumes/#{id}")
|
205
|
+
end
|
206
|
+
|
207
|
+
def volume_actions(id)
|
208
|
+
get("/v1/volumes/#{id}/actions")
|
209
|
+
end
|
210
|
+
|
211
|
+
def volume_action(id, action)
|
212
|
+
get("/v1/volumes/#{id}/actions/#{action}")
|
34
213
|
end
|
35
214
|
|
36
215
|
private
|
37
216
|
|
38
217
|
def client
|
39
218
|
@_client ||= Faraday.new(API_ENDPOINT) do |client|
|
40
|
-
|
41
|
-
|
42
|
-
|
219
|
+
client.request :url_encoded
|
220
|
+
client.adapter Faraday.default_adapter
|
221
|
+
client.headers['Authorization'] = "Bearer #{@api_token}" if @api_token.present?
|
43
222
|
end
|
44
223
|
end
|
45
224
|
|
46
|
-
def
|
47
|
-
response = client.public_send(
|
225
|
+
def get(endpoint, params = {})
|
226
|
+
response = client.public_send(:get, endpoint, params)
|
227
|
+
Oj.load(response.body)
|
228
|
+
end
|
229
|
+
|
230
|
+
def post(endpoint, params = {})
|
231
|
+
response = client.public_send(:post, endpoint, params)
|
48
232
|
Oj.load(response.body)
|
49
233
|
end
|
50
234
|
end
|
data/lib/hetzner/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abe Shalash
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- bin/console
|
54
54
|
- bin/setup
|
55
|
+
- hetzner-0.0.8.gem
|
55
56
|
- lib/hetzner.rb
|
56
57
|
- lib/hetzner/client.rb
|
57
58
|
- lib/hetzner/version.rb
|