hcloud 1.2.0 → 1.3.0
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/.github/workflows/ruby.yml +8 -1
- data/CHANGELOG.md +22 -1
- data/Gemfile.lock +22 -10
- data/hcloud.gemspec +1 -1
- data/lib/hcloud/abstract_resource.rb +1 -1
- data/lib/hcloud/entry_loader.rb +3 -35
- data/lib/hcloud/floating_ip.rb +1 -1
- data/lib/hcloud/floating_ip_resource.rb +1 -1
- data/lib/hcloud/future.rb +4 -1
- data/lib/hcloud/image.rb +2 -0
- data/lib/hcloud/image_resource.rb +1 -1
- data/lib/hcloud/network.rb +6 -0
- data/lib/hcloud/placement_group_resource.rb +1 -1
- data/lib/hcloud/resource_loader.rb +62 -0
- data/lib/hcloud/server.rb +39 -1
- data/lib/hcloud/server_resource.rb +5 -0
- data/lib/hcloud/ssh_key_resource.rb +1 -1
- data/lib/hcloud/version.rb +1 -1
- data/lib/hcloud/volume_resource.rb +1 -1
- data/lib/hcloud.rb +2 -0
- metadata +11 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d0476422e0663e6960e40d0198cfcc4544701def1670fbefae008cfcb4208a41
|
|
4
|
+
data.tar.gz: 192b15230064d1f5fea319268ce5ea897785e9bcc5c7f970ee50451490339fe7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9676ed391c7b0474fdb4c3b16d9ff2556ffe0909dfb2bc16a3d9fb9eed48d178b5d6d7ea7cc42eb93ebed99d38854846bbe0791e36a3967fd8c45ba5ca2fcd60
|
|
7
|
+
data.tar.gz: e9c4d5118d2e16ce1421cdc42c0413326bb58b17f986f91081d2db04004cb1a1e60edbcb4f84eec904adc6d6e71d5d7db4f052f4b1a07b2d0bede23184d87410
|
data/.github/workflows/ruby.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [v1.
|
|
3
|
+
## [v1.3.0](https://github.com/tonobo/hcloud-ruby/tree/v1.3.0) (2024-02-20)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v1.2.0...v1.3.0)
|
|
6
|
+
|
|
7
|
+
**Closed issues:**
|
|
8
|
+
|
|
9
|
+
- \[Enhancement\] Add missing fields / endpoints to Images + Servers [\#30](https://github.com/tonobo/hcloud-ruby/issues/30)
|
|
10
|
+
|
|
11
|
+
**Merged pull requests:**
|
|
12
|
+
|
|
13
|
+
- fix activemodel in Gemfile.lock [\#87](https://github.com/tonobo/hcloud-ruby/pull/87) ([skoch-hc](https://github.com/skoch-hc))
|
|
14
|
+
- Fix typo for pagination method [\#85](https://github.com/tonobo/hcloud-ruby/pull/85) ([coorasse](https://github.com/coorasse))
|
|
15
|
+
- \(\#82\) fix undefined method `.blank?` [\#84](https://github.com/tonobo/hcloud-ruby/pull/84) ([bastelfreak](https://github.com/bastelfreak))
|
|
16
|
+
- CI: Run on PRs and pushes to master [\#83](https://github.com/tonobo/hcloud-ruby/pull/83) ([bastelfreak](https://github.com/bastelfreak))
|
|
17
|
+
- Dont list activemodel as dev- and runtime dep [\#80](https://github.com/tonobo/hcloud-ruby/pull/80) ([bastelfreak](https://github.com/bastelfreak))
|
|
18
|
+
- version: bump to v1.2.0 [\#79](https://github.com/tonobo/hcloud-ruby/pull/79) ([aufziehvogel](https://github.com/aufziehvogel))
|
|
19
|
+
- build\(deps\): bump rack from 3.0.1 to 3.0.6.1 [\#75](https://github.com/tonobo/hcloud-ruby/pull/75) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
20
|
+
- add missing features to existing resources [\#60](https://github.com/tonobo/hcloud-ruby/pull/60) ([aufziehvogel](https://github.com/aufziehvogel))
|
|
21
|
+
|
|
22
|
+
## [v1.2.0](https://github.com/tonobo/hcloud-ruby/tree/v1.2.0) (2023-10-11)
|
|
4
23
|
|
|
5
24
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v1.1.0...v1.2.0)
|
|
6
25
|
|
|
7
26
|
**Closed issues:**
|
|
8
27
|
|
|
28
|
+
- question: could you point out the differences to other hcloud gem? [\#71](https://github.com/tonobo/hcloud-ruby/issues/71)
|
|
9
29
|
- \[Feature\] Add Primary IPs [\#57](https://github.com/tonobo/hcloud-ruby/issues/57)
|
|
10
30
|
- \[Feature\] Add Primary IPs [\#56](https://github.com/tonobo/hcloud-ruby/issues/56)
|
|
11
31
|
- \[Bug\] Firewalls do not expose actions [\#54](https://github.com/tonobo/hcloud-ruby/issues/54)
|
|
@@ -17,6 +37,7 @@
|
|
|
17
37
|
|
|
18
38
|
**Merged pull requests:**
|
|
19
39
|
|
|
40
|
+
- version: bump to v1.2.0 [\#78](https://github.com/tonobo/hcloud-ruby/pull/78) ([aufziehvogel](https://github.com/aufziehvogel))
|
|
20
41
|
- lib: import active\_support before cherry-picking imports [\#77](https://github.com/tonobo/hcloud-ruby/pull/77) ([aufziehvogel](https://github.com/aufziehvogel))
|
|
21
42
|
- Dependencies: Drop rake, as it's unnecessary [\#74](https://github.com/tonobo/hcloud-ruby/pull/74) ([Kjarrigan](https://github.com/Kjarrigan))
|
|
22
43
|
- server: return `next_actions` data on create [\#72](https://github.com/tonobo/hcloud-ruby/pull/72) ([aufziehvogel](https://github.com/aufziehvogel))
|
data/Gemfile.lock
CHANGED
|
@@ -1,33 +1,44 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
hcloud (1.
|
|
4
|
+
hcloud (1.3.0)
|
|
5
5
|
activemodel
|
|
6
|
+
activesupport
|
|
6
7
|
oj
|
|
7
8
|
typhoeus
|
|
8
9
|
|
|
9
10
|
GEM
|
|
10
11
|
remote: https://rubygems.org/
|
|
11
12
|
specs:
|
|
12
|
-
activemodel (7.
|
|
13
|
-
activesupport (= 7.
|
|
14
|
-
activesupport (7.
|
|
13
|
+
activemodel (7.1.1)
|
|
14
|
+
activesupport (= 7.1.1)
|
|
15
|
+
activesupport (7.1.1)
|
|
16
|
+
base64
|
|
17
|
+
bigdecimal
|
|
15
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
|
+
connection_pool (>= 2.2.5)
|
|
20
|
+
drb
|
|
16
21
|
i18n (>= 1.6, < 2)
|
|
17
22
|
minitest (>= 5.1)
|
|
23
|
+
mutex_m
|
|
18
24
|
tzinfo (~> 2.0)
|
|
19
25
|
addressable (2.8.1)
|
|
20
26
|
public_suffix (>= 2.0.2, < 6.0)
|
|
21
27
|
ast (2.4.2)
|
|
28
|
+
base64 (0.1.1)
|
|
29
|
+
bigdecimal (3.1.4)
|
|
22
30
|
builder (3.2.4)
|
|
23
31
|
codecov (0.6.0)
|
|
24
32
|
simplecov (>= 0.15, < 0.22)
|
|
25
33
|
coderay (1.1.3)
|
|
26
34
|
concurrent-ruby (1.1.10)
|
|
35
|
+
connection_pool (2.4.1)
|
|
27
36
|
crack (0.4.5)
|
|
28
37
|
rexml
|
|
29
38
|
diff-lcs (1.5.0)
|
|
30
39
|
docile (1.4.0)
|
|
40
|
+
drb (2.1.1)
|
|
41
|
+
ruby2_keywords
|
|
31
42
|
dry-core (1.0.0)
|
|
32
43
|
concurrent-ruby (~> 1.0)
|
|
33
44
|
zeitwerk (~> 2.6)
|
|
@@ -47,8 +58,8 @@ GEM
|
|
|
47
58
|
faker (3.0.0)
|
|
48
59
|
i18n (>= 1.8.11, < 2)
|
|
49
60
|
ffi (1.16.3)
|
|
50
|
-
grape (1.
|
|
51
|
-
activesupport
|
|
61
|
+
grape (1.8.0)
|
|
62
|
+
activesupport (>= 5)
|
|
52
63
|
builder
|
|
53
64
|
dry-types (>= 1.1)
|
|
54
65
|
mustermann-grape (~> 1.0.0)
|
|
@@ -64,7 +75,9 @@ GEM
|
|
|
64
75
|
ruby2_keywords (~> 0.0.1)
|
|
65
76
|
mustermann-grape (1.0.2)
|
|
66
77
|
mustermann (>= 1.0.0)
|
|
67
|
-
|
|
78
|
+
mutex_m (0.1.2)
|
|
79
|
+
oj (3.16.3)
|
|
80
|
+
bigdecimal (>= 3.0)
|
|
68
81
|
parallel (1.22.1)
|
|
69
82
|
parser (3.1.3.0)
|
|
70
83
|
ast (~> 2.4.1)
|
|
@@ -72,7 +85,7 @@ GEM
|
|
|
72
85
|
coderay (~> 1.1)
|
|
73
86
|
method_source (~> 1.0)
|
|
74
87
|
public_suffix (5.0.0)
|
|
75
|
-
rack (3.0.1)
|
|
88
|
+
rack (3.0.6.1)
|
|
76
89
|
rack-accept (0.4.5)
|
|
77
90
|
rack (>= 0.4)
|
|
78
91
|
rainbow (3.1.1)
|
|
@@ -111,7 +124,7 @@ GEM
|
|
|
111
124
|
simplecov_json_formatter (~> 0.1)
|
|
112
125
|
simplecov-html (0.12.3)
|
|
113
126
|
simplecov_json_formatter (0.1.4)
|
|
114
|
-
typhoeus (1.4.
|
|
127
|
+
typhoeus (1.4.1)
|
|
115
128
|
ethon (>= 0.9.0)
|
|
116
129
|
tzinfo (2.0.5)
|
|
117
130
|
concurrent-ruby (~> 1.0)
|
|
@@ -127,7 +140,6 @@ PLATFORMS
|
|
|
127
140
|
x86_64-linux
|
|
128
141
|
|
|
129
142
|
DEPENDENCIES
|
|
130
|
-
activemodel
|
|
131
143
|
bundler
|
|
132
144
|
codecov
|
|
133
145
|
faker
|
data/hcloud.gemspec
CHANGED
|
@@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
24
|
spec.require_paths = ['lib']
|
|
25
25
|
|
|
26
|
-
spec.add_development_dependency 'activemodel'
|
|
27
26
|
spec.add_development_dependency 'bundler'
|
|
28
27
|
spec.add_development_dependency 'grape'
|
|
29
28
|
spec.add_development_dependency 'rspec'
|
|
30
29
|
spec.add_development_dependency 'webmock'
|
|
31
30
|
spec.add_runtime_dependency 'activemodel'
|
|
31
|
+
spec.add_runtime_dependency 'activesupport'
|
|
32
32
|
spec.add_runtime_dependency 'oj'
|
|
33
33
|
spec.add_runtime_dependency 'typhoeus'
|
|
34
34
|
end
|
|
@@ -12,7 +12,7 @@ module Hcloud
|
|
|
12
12
|
def bind_to(klass)
|
|
13
13
|
resource = self
|
|
14
14
|
%w[find find_by where all [] page limit per_page order
|
|
15
|
-
to_a count pagnation each].each do |method|
|
|
15
|
+
to_a count pagnation pagination each].each do |method|
|
|
16
16
|
klass.define_singleton_method(method) do |*args, &block|
|
|
17
17
|
resource.new(client: Client.connection).public_send(method, *args, &block)
|
|
18
18
|
end
|
data/lib/hcloud/entry_loader.rb
CHANGED
|
@@ -223,49 +223,17 @@ module Hcloud
|
|
|
223
223
|
instance_variable_set("@#{key}", value)
|
|
224
224
|
end
|
|
225
225
|
|
|
226
|
-
# rubocop: disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/AbcSize
|
|
227
226
|
def _load(resource)
|
|
228
227
|
return if resource.nil?
|
|
229
228
|
|
|
230
229
|
@_attributes = {}.with_indifferent_access
|
|
231
230
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if definition == :time
|
|
236
|
-
_update_attribute(key, value ? Time.parse(value) : nil)
|
|
237
|
-
next
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
if definition.is_a?(Class) && definition.include?(EntryLoader)
|
|
241
|
-
_update_attribute(key, value ? definition.new(client, value) : nil)
|
|
242
|
-
next
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
# if schema definition is [Class]
|
|
246
|
-
if definition.is_a?(Array) && definition.first.include?(EntryLoader)
|
|
247
|
-
|
|
248
|
-
# just set attribute to an empty array if value is no array or empty
|
|
249
|
-
if !value.is_a?(Array) || value.empty?
|
|
250
|
-
_update_attribute(key, [])
|
|
251
|
-
next
|
|
252
|
-
end
|
|
253
|
-
|
|
254
|
-
if value.first.is_a?(Integer)
|
|
255
|
-
# If value is an integer, this is the id of an object which's class can be
|
|
256
|
-
# retreived from definition. Load a future object that can on access retreive the
|
|
257
|
-
# data from the api and convert it to a proper object.
|
|
258
|
-
_update_attribute(key, value.map { |id| Future.new(client, definition.first, id) })
|
|
259
|
-
else
|
|
260
|
-
# Otherwise the value *is* the content of the object
|
|
261
|
-
_update_attribute(key, value.map { |item| definition.first.new(client, item) })
|
|
262
|
-
end
|
|
263
|
-
next
|
|
264
|
-
end
|
|
231
|
+
loader = Hcloud::ResourceLoader.new(self.class.schema, client: client)
|
|
232
|
+
loaded_data = loader.load(resource)
|
|
265
233
|
|
|
234
|
+
loaded_data.each do |key, value|
|
|
266
235
|
_update_attribute(key, value.is_a?(Hash) ? value.with_indifferent_access : value)
|
|
267
236
|
end
|
|
268
237
|
end
|
|
269
|
-
# rubocop: enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/AbcSize
|
|
270
238
|
end
|
|
271
239
|
end
|
data/lib/hcloud/floating_ip.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Hcloud
|
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def create(type:, server: nil, home_location: nil, description: nil, labels: {})
|
|
16
|
+
def create(type:, name: nil, server: nil, home_location: nil, description: nil, labels: {})
|
|
17
17
|
raise Hcloud::Error::InvalidInput, 'no type given' if type.blank?
|
|
18
18
|
if server.nil? && home_location.nil?
|
|
19
19
|
raise Hcloud::Error::InvalidInput, 'either server or home_location must be given'
|
data/lib/hcloud/future.rb
CHANGED
|
@@ -4,10 +4,13 @@ require 'active_support/core_ext/string/inflections'
|
|
|
4
4
|
|
|
5
5
|
module Hcloud
|
|
6
6
|
class Future < Delegator
|
|
7
|
+
attr_reader :raw_data
|
|
8
|
+
|
|
7
9
|
# rubocop: disable Lint/MissingSuper
|
|
8
|
-
def initialize(client, target_class, id)
|
|
10
|
+
def initialize(client, target_class, id, raw_data: nil)
|
|
9
11
|
@target_class = target_class
|
|
10
12
|
@id = id
|
|
13
|
+
@raw_data = raw_data
|
|
11
14
|
@__client = client
|
|
12
15
|
end
|
|
13
16
|
# rubocop: enable Lint/MissingSuper
|
data/lib/hcloud/image.rb
CHANGED
data/lib/hcloud/network.rb
CHANGED
|
@@ -40,5 +40,11 @@ module Hcloud
|
|
|
40
40
|
|
|
41
41
|
prepare_request('actions/delete_route', j: COLLECT_ARGS.call(__method__, binding))
|
|
42
42
|
end
|
|
43
|
+
|
|
44
|
+
def change_ip_range(ip_range:)
|
|
45
|
+
raise Hcloud::Error::InvalidInput, 'no ip_range given' if ip_range.blank?
|
|
46
|
+
|
|
47
|
+
prepare_request('actions/change_ip_range', j: COLLECT_ARGS.call(__method__, binding))
|
|
48
|
+
end
|
|
43
49
|
end
|
|
44
50
|
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'time'
|
|
4
|
+
|
|
5
|
+
module Hcloud
|
|
6
|
+
class ResourceLoader
|
|
7
|
+
def initialize(schema, client:)
|
|
8
|
+
@schema = schema
|
|
9
|
+
@client = client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def load(data)
|
|
13
|
+
load_with_schema(@schema, data)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def load_with_schema(schema, data)
|
|
19
|
+
if schema.respond_to?(:call)
|
|
20
|
+
schema.call(data, @client)
|
|
21
|
+
elsif schema.is_a?(Array) && schema.count.positive? && data.is_a?(Array)
|
|
22
|
+
load_array(schema, data)
|
|
23
|
+
elsif schema.is_a?(Hash) && data.is_a?(Hash)
|
|
24
|
+
load_hash(schema, data)
|
|
25
|
+
else
|
|
26
|
+
load_single_item(schema, data)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def load_array(schema, data)
|
|
31
|
+
data.map do |item|
|
|
32
|
+
load_with_schema(schema[0], item)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def load_hash(schema, data)
|
|
37
|
+
data.map do |key, value|
|
|
38
|
+
[key, load_with_schema(schema[key], value)]
|
|
39
|
+
end.to_h
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def load_single_item(definition, value)
|
|
43
|
+
if definition == :time
|
|
44
|
+
return value ? Time.parse(value) : nil
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
if definition.is_a?(Class) && definition.include?(EntryLoader)
|
|
48
|
+
return if value.nil?
|
|
49
|
+
|
|
50
|
+
# If value is an integer, this is the id of an object which's class can be
|
|
51
|
+
# retreived from definition. Load a future object that can on access retreive the
|
|
52
|
+
# data from the api and convert it to a proper object.
|
|
53
|
+
return Future.new(@client, definition, value) if value.is_a?(Integer)
|
|
54
|
+
|
|
55
|
+
# Otherwise the value *is* the content of the object
|
|
56
|
+
return definition.new(@client, value)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
value
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
data/lib/hcloud/server.rb
CHANGED
|
@@ -12,7 +12,24 @@ module Hcloud
|
|
|
12
12
|
datacenter: Datacenter,
|
|
13
13
|
image: Image,
|
|
14
14
|
iso: Iso,
|
|
15
|
+
load_balancers: [LoadBalancer],
|
|
16
|
+
placement_group: PlacementGroup,
|
|
15
17
|
private_net: [Network],
|
|
18
|
+
public_net: {
|
|
19
|
+
ipv4: lambda do |data, client|
|
|
20
|
+
Future.new(client, PrimaryIP, data[:id]) if data.to_h[:id].is_a?(Integer)
|
|
21
|
+
end,
|
|
22
|
+
ipv6: lambda do |data, client|
|
|
23
|
+
Future.new(client, PrimaryIP, data[:id]) if data.to_h[:id].is_a?(Integer)
|
|
24
|
+
end,
|
|
25
|
+
floating_ips: [FloatingIP],
|
|
26
|
+
firewalls: [
|
|
27
|
+
lambda do |data, client|
|
|
28
|
+
Future.new(client, Firewall, data[:id], raw_data: data) if data.to_h[:id].is_a?(Integer)
|
|
29
|
+
end
|
|
30
|
+
]
|
|
31
|
+
# firewalls: [{ id: Firewall }]
|
|
32
|
+
},
|
|
16
33
|
volumes: [Volume]
|
|
17
34
|
)
|
|
18
35
|
|
|
@@ -21,6 +38,7 @@ module Hcloud
|
|
|
21
38
|
destructible
|
|
22
39
|
|
|
23
40
|
has_actions
|
|
41
|
+
has_metrics
|
|
24
42
|
|
|
25
43
|
def enable_rescue(type: 'linux64', ssh_keys: [])
|
|
26
44
|
query = COLLECT_ARGS.call(__method__, binding)
|
|
@@ -73,10 +91,30 @@ module Hcloud
|
|
|
73
91
|
prepare_request('actions/detach_from_network', j: { network: network })
|
|
74
92
|
end
|
|
75
93
|
|
|
94
|
+
def add_to_placement_group(placement_group:)
|
|
95
|
+
raise Hcloud::Error::InvalidInput, 'no placement_group given' if placement_group.nil?
|
|
96
|
+
|
|
97
|
+
prepare_request('actions/add_to_placement_group', j: COLLECT_ARGS.call(__method__, binding))
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def change_alias_ips(alias_ips:, network:)
|
|
101
|
+
raise Hcloud::Error::InvalidInput, 'no alias_ips given' if alias_ips.to_a.count.zero?
|
|
102
|
+
raise Hcloud::Error::InvalidInput, 'no network given' if network.nil?
|
|
103
|
+
|
|
104
|
+
prepare_request('actions/change_alias_ips', j: COLLECT_ARGS.call(__method__, binding))
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def change_dns_ptr(ip:, dns_ptr:)
|
|
108
|
+
raise Hcloud::Error::InvalidInput, 'no IP given' if ip.blank?
|
|
109
|
+
raise Hcloud::Error::InvalidInput, 'no dns_ptr given' if dns_ptr.blank?
|
|
110
|
+
|
|
111
|
+
prepare_request('actions/change_dns_ptr', j: COLLECT_ARGS.call(__method__, binding))
|
|
112
|
+
end
|
|
113
|
+
|
|
76
114
|
%w[
|
|
77
115
|
poweron poweroff shutdown reboot reset
|
|
78
116
|
disable_rescue disable_backup detach_iso
|
|
79
|
-
request_console
|
|
117
|
+
request_console remove_from_placement_group
|
|
80
118
|
].each do |action|
|
|
81
119
|
define_method(action) do
|
|
82
120
|
prepare_request("actions/#{action}", method: :post)
|
|
@@ -12,8 +12,13 @@ module Hcloud
|
|
|
12
12
|
location: nil,
|
|
13
13
|
start_after_create: nil,
|
|
14
14
|
ssh_keys: [],
|
|
15
|
+
public_net: nil,
|
|
16
|
+
firewalls: nil,
|
|
15
17
|
networks: [],
|
|
18
|
+
placement_group: nil,
|
|
16
19
|
user_data: nil,
|
|
20
|
+
volumes: nil,
|
|
21
|
+
automount: nil,
|
|
17
22
|
labels: {})
|
|
18
23
|
prepare_request('servers', j: COLLECT_ARGS.call(__method__, binding),
|
|
19
24
|
expected_code: 201) do |response|
|
data/lib/hcloud/version.rb
CHANGED
data/lib/hcloud.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'hcloud/version'
|
|
|
4
4
|
require 'active_support'
|
|
5
5
|
require 'active_support/core_ext/object/to_query'
|
|
6
6
|
require 'active_support/core_ext/hash/indifferent_access'
|
|
7
|
+
require 'active_support/core_ext/object/blank'
|
|
7
8
|
|
|
8
9
|
module Hcloud
|
|
9
10
|
autoload :Error, 'hcloud/errors'
|
|
@@ -12,6 +13,7 @@ module Hcloud
|
|
|
12
13
|
autoload :TyphoeusExt, 'hcloud/typhoeus_ext'
|
|
13
14
|
autoload :AbstractResource, 'hcloud/abstract_resource'
|
|
14
15
|
autoload :EntryLoader, 'hcloud/entry_loader'
|
|
16
|
+
autoload :ResourceLoader, 'hcloud/resource_loader'
|
|
15
17
|
|
|
16
18
|
autoload :Server, 'hcloud/server'
|
|
17
19
|
autoload :ServerResource, 'hcloud/server_resource'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hcloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Foerster
|
|
@@ -9,10 +9,10 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
|
-
name:
|
|
15
|
+
name: bundler
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
requirements:
|
|
18
18
|
- - ">="
|
|
@@ -26,7 +26,7 @@ dependencies:
|
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '0'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
|
-
name:
|
|
29
|
+
name: grape
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
32
|
- - ">="
|
|
@@ -40,7 +40,7 @@ dependencies:
|
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
41
|
version: '0'
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
|
-
name:
|
|
43
|
+
name: rspec
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
45
45
|
requirements:
|
|
46
46
|
- - ">="
|
|
@@ -54,7 +54,7 @@ dependencies:
|
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
55
|
version: '0'
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
|
-
name:
|
|
57
|
+
name: webmock
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
59
59
|
requirements:
|
|
60
60
|
- - ">="
|
|
@@ -68,13 +68,13 @@ dependencies:
|
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
69
|
version: '0'
|
|
70
70
|
- !ruby/object:Gem::Dependency
|
|
71
|
-
name:
|
|
71
|
+
name: activemodel
|
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
|
73
73
|
requirements:
|
|
74
74
|
- - ">="
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
76
|
version: '0'
|
|
77
|
-
type: :
|
|
77
|
+
type: :runtime
|
|
78
78
|
prerelease: false
|
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
|
@@ -82,7 +82,7 @@ dependencies:
|
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
83
|
version: '0'
|
|
84
84
|
- !ruby/object:Gem::Dependency
|
|
85
|
-
name:
|
|
85
|
+
name: activesupport
|
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
|
87
87
|
requirements:
|
|
88
88
|
- - ">="
|
|
@@ -177,6 +177,7 @@ files:
|
|
|
177
177
|
- lib/hcloud/placement_group_resource.rb
|
|
178
178
|
- lib/hcloud/primary_ip.rb
|
|
179
179
|
- lib/hcloud/primary_ip_resource.rb
|
|
180
|
+
- lib/hcloud/resource_loader.rb
|
|
180
181
|
- lib/hcloud/server.rb
|
|
181
182
|
- lib/hcloud/server_resource.rb
|
|
182
183
|
- lib/hcloud/server_type.rb
|
|
@@ -206,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
206
207
|
- !ruby/object:Gem::Version
|
|
207
208
|
version: '0'
|
|
208
209
|
requirements: []
|
|
209
|
-
rubygems_version: 3.3.
|
|
210
|
+
rubygems_version: 3.3.25
|
|
210
211
|
signing_key:
|
|
211
212
|
specification_version: 4
|
|
212
213
|
summary: HetznerCloud native Ruby client
|