hcloud 1.0.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Hcloud
4
4
  class VolumeResource < AbstractResource
5
- filter_attributes :name
5
+ filter_attributes :name, :label_selector
6
6
 
7
7
  def [](arg)
8
8
  case arg
@@ -11,7 +11,13 @@ module Hcloud
11
11
  end
12
12
  end
13
13
 
14
- def create(size:, name:, automount: nil, format: nil, location: nil, server: nil)
14
+ def create(size:, name:, automount: nil, format: nil, location: nil, server: nil, labels: {})
15
+ raise Hcloud::Error::InvalidInput, 'no name given' if name.blank?
16
+ raise Hcloud::Error::InvalidInput, 'invalid size given' unless size.to_i >= 10
17
+ if location.blank? && server.nil?
18
+ raise Hcloud::Error::InvalidInput, 'location or server must be given'
19
+ end
20
+
15
21
  prepare_request(
16
22
  'volumes', j: COLLECT_ARGS.call(__method__, binding),
17
23
  expected_code: 201
data/lib/hcloud.rb CHANGED
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'hcloud/version'
4
+ require 'active_support'
4
5
  require 'active_support/core_ext/object/to_query'
5
6
  require 'active_support/core_ext/hash/indifferent_access'
6
7
 
7
8
  module Hcloud
8
9
  autoload :Error, 'hcloud/errors'
9
10
  autoload :Client, 'hcloud/client'
11
+ autoload :Future, 'hcloud/future'
10
12
  autoload :TyphoeusExt, 'hcloud/typhoeus_ext'
11
13
  autoload :AbstractResource, 'hcloud/abstract_resource'
12
14
  autoload :EntryLoader, 'hcloud/entry_loader'
@@ -20,9 +22,15 @@ module Hcloud
20
22
  autoload :FloatingIP, 'hcloud/floating_ip'
21
23
  autoload :FloatingIPResource, 'hcloud/floating_ip_resource'
22
24
 
25
+ autoload :PrimaryIP, 'hcloud/primary_ip'
26
+ autoload :PrimaryIPResource, 'hcloud/primary_ip_resource'
27
+
23
28
  autoload :SSHKey, 'hcloud/ssh_key'
24
29
  autoload :SSHKeyResource, 'hcloud/ssh_key_resource'
25
30
 
31
+ autoload :Certificate, 'hcloud/certificate'
32
+ autoload :CertificateResource, 'hcloud/certificate_resource'
33
+
26
34
  autoload :Datacenter, 'hcloud/datacenter'
27
35
  autoload :DatacenterResource, 'hcloud/datacenter_resource'
28
36
 
@@ -35,6 +43,9 @@ module Hcloud
35
43
  autoload :Network, 'hcloud/network'
36
44
  autoload :NetworkResource, 'hcloud/network_resource'
37
45
 
46
+ autoload :Firewall, 'hcloud/firewall'
47
+ autoload :FirewallResource, 'hcloud/firewall_resource'
48
+
38
49
  autoload :Volume, 'hcloud/volume'
39
50
  autoload :VolumeResource, 'hcloud/volume_resource'
40
51
 
@@ -46,6 +57,15 @@ module Hcloud
46
57
 
47
58
  autoload :Pagination, 'hcloud/pagination'
48
59
 
60
+ autoload :PlacementGroup, 'hcloud/placement_group'
61
+ autoload :PlacementGroupResource, 'hcloud/placement_group_resource'
62
+
63
+ autoload :LoadBalancerType, 'hcloud/load_balancer_type'
64
+ autoload :LoadBalancerTypeResource, 'hcloud/load_balancer_type_resource'
65
+
66
+ autoload :LoadBalancer, 'hcloud/load_balancer'
67
+ autoload :LoadBalancerResource, 'hcloud/load_balancer_resource'
68
+
49
69
  COLLECT_ARGS = proc do |method_name, bind|
50
70
  query = bind.receiver.method(method_name).parameters.inject({}) do |hash, (_type, name)|
51
71
  hash.merge(name => bind.local_variable_get(name))
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.0.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Foerster
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-02-17 00:00:00.000000000 Z
12
+ date: 2023-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -25,20 +25,6 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: activesupport
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - '='
33
- - !ruby/object:Gem::Version
34
- version: 6.1.4.4
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - '='
40
- - !ruby/object:Gem::Version
41
- version: 6.1.4.4
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: bundler
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -67,20 +53,6 @@ dependencies:
67
53
  - - ">="
68
54
  - !ruby/object:Gem::Version
69
55
  version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: rake
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
56
  - !ruby/object:Gem::Dependency
85
57
  name: rspec
86
58
  requirement: !ruby/object:Gem::Requirement
@@ -123,20 +95,6 @@ dependencies:
123
95
  - - ">="
124
96
  - !ruby/object:Gem::Version
125
97
  version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: activesupport
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - '='
131
- - !ruby/object:Gem::Version
132
- version: 6.1.4.4
133
- type: :runtime
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - '='
138
- - !ruby/object:Gem::Version
139
- version: 6.1.4.4
140
98
  - !ruby/object:Gem::Dependency
141
99
  name: oj
142
100
  requirement: !ruby/object:Gem::Requirement
@@ -181,8 +139,8 @@ files:
181
139
  - CHANGELOG.md
182
140
  - Gemfile
183
141
  - Gemfile.lock
142
+ - LICENSE
184
143
  - README.md
185
- - Rakefile
186
144
  - bin/console
187
145
  - bin/setup
188
146
  - hcloud.gemspec
@@ -190,22 +148,35 @@ files:
190
148
  - lib/hcloud/abstract_resource.rb
191
149
  - lib/hcloud/action.rb
192
150
  - lib/hcloud/action_resource.rb
151
+ - lib/hcloud/certificate.rb
152
+ - lib/hcloud/certificate_resource.rb
193
153
  - lib/hcloud/client.rb
194
154
  - lib/hcloud/datacenter.rb
195
155
  - lib/hcloud/datacenter_resource.rb
196
156
  - lib/hcloud/entry_loader.rb
197
157
  - lib/hcloud/errors.rb
158
+ - lib/hcloud/firewall.rb
159
+ - lib/hcloud/firewall_resource.rb
198
160
  - lib/hcloud/floating_ip.rb
199
161
  - lib/hcloud/floating_ip_resource.rb
162
+ - lib/hcloud/future.rb
200
163
  - lib/hcloud/image.rb
201
164
  - lib/hcloud/image_resource.rb
202
165
  - lib/hcloud/iso.rb
203
166
  - lib/hcloud/iso_resource.rb
167
+ - lib/hcloud/load_balancer.rb
168
+ - lib/hcloud/load_balancer_resource.rb
169
+ - lib/hcloud/load_balancer_type.rb
170
+ - lib/hcloud/load_balancer_type_resource.rb
204
171
  - lib/hcloud/location.rb
205
172
  - lib/hcloud/location_resource.rb
206
173
  - lib/hcloud/network.rb
207
174
  - lib/hcloud/network_resource.rb
208
175
  - lib/hcloud/pagination.rb
176
+ - lib/hcloud/placement_group.rb
177
+ - lib/hcloud/placement_group_resource.rb
178
+ - lib/hcloud/primary_ip.rb
179
+ - lib/hcloud/primary_ip_resource.rb
209
180
  - lib/hcloud/server.rb
210
181
  - lib/hcloud/server_resource.rb
211
182
  - lib/hcloud/server_type.rb
@@ -217,7 +188,8 @@ files:
217
188
  - lib/hcloud/volume.rb
218
189
  - lib/hcloud/volume_resource.rb
219
190
  homepage: https://github.com/tonobo/hcloud-ruby
220
- licenses: []
191
+ licenses:
192
+ - MIT
221
193
  metadata: {}
222
194
  post_install_message:
223
195
  rdoc_options: []
@@ -234,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
206
  - !ruby/object:Gem::Version
235
207
  version: '0'
236
208
  requirements: []
237
- rubygems_version: 3.2.22
209
+ rubygems_version: 3.3.7
238
210
  signing_key:
239
211
  specification_version: 4
240
212
  summary: HetznerCloud native Ruby client
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- task default: :spec