hetzner 0.0.1 → 0.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ea9424683ea563187f3a6cb31bda79108bedd3c50d8b9b3607d211d0d092d2c
4
- data.tar.gz: 9e36c188c44e45a4575d085c2b60f789d751e041654b6da3f11237f8df8c423a
3
+ metadata.gz: 8564112b50c1ebdc702892b47be85fcb7eb9b5c7cb58de764e9c727c7de0adc6
4
+ data.tar.gz: 1ee7d2a3f5e0f359255b30dc1692fe41e7c58af1c66a178493d3d612f1cbd3f1
5
5
  SHA512:
6
- metadata.gz: bdc9125a49fa17478003b65c2d685dcfd23db029b3ce7eb34281d58a60c6c9567fb507810327539367b9bd3f29e8553bc8c3518b833889a3aa8323a7060199e0
7
- data.tar.gz: 93cc687492cfc30cec47b757b2697d84980132fab18f302979e9329aea01845c2ba670b6f9dd85ba36a91a6419c07050ec388056cab6d3efb826835caf678c3b
6
+ metadata.gz: b4a62122c785ab66045a1417c26812ab5a6090f522d971522f909330d270cc163bd51f6569ee579048cc3911ba84e56a7a0f20f99066d63cd09a6e2932ab6109
7
+ data.tar.gz: fa778bd705d95a67bfb532ceaf0cb0dfe2696ca1509dbcfd917466925a58325924af1196f9ba5adc7c82a7fda4e192fd471c1e0d88111414ad9e1283d4fd295f
data/.DS_Store CHANGED
Binary file
@@ -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 = 'https://api.hetzner.cloud/v1'.freeze
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 request(http_method:, endpoint:, params: {})
32
- response = client.public_send(http_method, endpoint, params)
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,11 @@
1
+ module Hetzner
2
+ class Client
3
+ def actions
4
+ get("/v1/actions")
5
+ end
6
+
7
+ def action(id)
8
+ get("/v1/actions/#{id}")
9
+ end
10
+ end
11
+ 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,11 @@
1
+ module Hetzner
2
+ class Client
3
+ def datacenters
4
+ get("/v1/datacenters")
5
+ end
6
+
7
+ def datacenter(id)
8
+ get("/v1/datacenters/#{id}")
9
+ end
10
+ end
11
+ 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,11 @@
1
+ module Hetzner
2
+ class Client
3
+ def isos
4
+ get("/v1/isos")
5
+ end
6
+
7
+ def iso(id)
8
+ get("/v1/isos/#{id}")
9
+ end
10
+ end
11
+ 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,11 @@
1
+ module Hetzner
2
+ class Client
3
+ def locations
4
+ get("/v1/locations")
5
+ end
6
+
7
+ def location(id)
8
+ get("/v1/locations/#{id}")
9
+ end
10
+ end
11
+ 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,11 @@
1
+ module Hetzner
2
+ class Client
3
+ def placement_groups
4
+ get("/v1/placement_groups")
5
+ end
6
+
7
+ def placement_group(id)
8
+ get("/v1/placement_groups/#{id}")
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module Hetzner
2
+ class Client
3
+ def pricing
4
+ get("/v1/pricing")
5
+ end
6
+ end
7
+ 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,11 @@
1
+ module Hetzner
2
+ class Client
3
+ def ssh_keys
4
+ get("/v1/ssh_keys")
5
+ end
6
+
7
+ def ssh_key(id)
8
+ get("/v1/ssh_keys/#{id}")
9
+ end
10
+ end
11
+ 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hetzner
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.13"
5
5
  end
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.1
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-24 00:00:00.000000000 Z
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