hcloud 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +32 -0
- data/.rubocop.yml +4 -1
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +74 -2
- data/Gemfile.lock +98 -96
- data/LICENSE +21 -0
- data/README.md +1 -1
- data/bin/console +4 -4
- data/hcloud.gemspec +7 -6
- data/lib/hcloud/abstract_resource.rb +15 -17
- data/lib/hcloud/client.rb +9 -4
- data/lib/hcloud/entry_loader.rb +62 -9
- data/lib/hcloud/errors.rb +1 -1
- data/lib/hcloud/firewall.rb +26 -0
- data/lib/hcloud/firewall_resource.rb +23 -0
- data/lib/hcloud/floating_ip_resource.rb +2 -2
- data/lib/hcloud/future.rb +26 -0
- data/lib/hcloud/image_resource.rb +1 -1
- data/lib/hcloud/network.rb +3 -3
- data/lib/hcloud/network_resource.rb +2 -2
- data/lib/hcloud/server.rb +4 -1
- data/lib/hcloud/server_resource.rb +4 -4
- data/lib/hcloud/ssh_key_resource.rb +2 -2
- data/lib/hcloud/typhoeus_ext.rb +9 -11
- data/lib/hcloud/version.rb +1 -1
- data/lib/hcloud/volume_resource.rb +2 -2
- data/lib/hcloud.rb +4 -0
- metadata +18 -39
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f32bc658bc4cb2d5151d8af866b7f09769b688bdda0fb3626932ba02268dd1c
|
4
|
+
data.tar.gz: c9882c417f63c0b7100540cbfb3c86c299674904ac4676a5b85e934d888a72d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0f0a02ffe7bf1f53b2da59775df790d3340616a4c1a30c15cd24c6556d8412e713286b7d690e9c618ebfa9682b81f2ee1a6543e5c056b02c121f0655db3a818
|
7
|
+
data.tar.gz: 3c5e42fdca1fa5e0e1ce8050052583b4055ae5a0b9206a8d020721d5f845ebdc26ffd99696d4fa9fac943cc9cf17f6b0de3306daa74bdc7f87d4fa719f963ac2
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: hcloud-ruby ci
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
lint:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
steps:
|
7
|
+
- uses: actions/checkout@v2
|
8
|
+
- name: Setup Ruby
|
9
|
+
uses: ruby/setup-ruby@v1
|
10
|
+
with:
|
11
|
+
ruby-version: 2.7
|
12
|
+
bundler-cache: true
|
13
|
+
- name: Run rubocop
|
14
|
+
run: bundle exec rubocop --parallel
|
15
|
+
|
16
|
+
test:
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby-version: [ '2.7', '3.0', '3.1' ]
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v2
|
24
|
+
- name: Setup Ruby
|
25
|
+
uses: ruby/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby-version }}
|
28
|
+
bundler-cache: true
|
29
|
+
- name: Run double tests
|
30
|
+
run: bundle exec rspec -t doubles --order rand
|
31
|
+
- name: Run legacy tests
|
32
|
+
run: LEGACY_TESTS=y bundle exec rspec -t ~doubles
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.7
|
5
|
+
|
3
6
|
Style/GlobalVars:
|
4
7
|
Exclude:
|
5
8
|
- 'spec/**/*.rb'
|
@@ -10,7 +13,7 @@ Style/Documentation:
|
|
10
13
|
Naming/ConstantName:
|
11
14
|
Enabled: false
|
12
15
|
|
13
|
-
Lint/
|
16
|
+
Lint/SuppressedException:
|
14
17
|
Enabled: false
|
15
18
|
|
16
19
|
Lint/AssignmentInCondition:
|
data/.rubocop_todo.yml
CHANGED
@@ -39,7 +39,7 @@ Metrics/PerceivedComplexity:
|
|
39
39
|
# Offense count: 3
|
40
40
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
41
41
|
# AllowedNames: io, id, to, by, on, in, at, ip, db
|
42
|
-
Naming/
|
42
|
+
Naming/MethodParameterName:
|
43
43
|
Exclude:
|
44
44
|
- 'lib/hcloud/abstract_resource.rb'
|
45
45
|
- 'spec/fake_service/action.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,69 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [v1.1.0](https://github.com/tonobo/hcloud-ruby/tree/v1.1.0) (2022-11-29)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v1.0.3...v1.1.0)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Doubles tests failure with seed 50938 [\#46](https://github.com/tonobo/hcloud-ruby/issues/46)
|
10
|
+
- \[Feature\] Add missing Resources/Endpoints Q1/2022 [\#24](https://github.com/tonobo/hcloud-ruby/issues/24)
|
11
|
+
- \[Dependencies\] Unpin activesupport [\#23](https://github.com/tonobo/hcloud-ruby/issues/23)
|
12
|
+
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- handle action array responses for firewall actions [\#48](https://github.com/tonobo/hcloud-ruby/pull/48) ([aufziehvogel](https://github.com/aufziehvogel))
|
16
|
+
- fix auto pagination test to always use three pages [\#47](https://github.com/tonobo/hcloud-ruby/pull/47) ([aufziehvogel](https://github.com/aufziehvogel))
|
17
|
+
- label support \(create, update, search\) [\#45](https://github.com/tonobo/hcloud-ruby/pull/45) ([aufziehvogel](https://github.com/aufziehvogel))
|
18
|
+
- set Github Workflow badge for build status [\#44](https://github.com/tonobo/hcloud-ruby/pull/44) ([aufziehvogel](https://github.com/aufziehvogel))
|
19
|
+
- fix rubocop linting warnings [\#42](https://github.com/tonobo/hcloud-ruby/pull/42) ([aufziehvogel](https://github.com/aufziehvogel))
|
20
|
+
- Implement firewall support [\#41](https://github.com/tonobo/hcloud-ruby/pull/41) ([aufziehvogel](https://github.com/aufziehvogel))
|
21
|
+
- Create unit tests for networks [\#40](https://github.com/tonobo/hcloud-ruby/pull/40) ([aufziehvogel](https://github.com/aufziehvogel))
|
22
|
+
- fix typo in exception name ResourceUnavailable [\#39](https://github.com/tonobo/hcloud-ruby/pull/39) ([aufziehvogel](https://github.com/aufziehvogel))
|
23
|
+
- Bump rack from 2.2.3 to 2.2.3.1 [\#38](https://github.com/tonobo/hcloud-ruby/pull/38) ([dependabot[bot]](https://github.com/apps/dependabot))
|
24
|
+
- dependency: update + unpin activesupport [\#36](https://github.com/tonobo/hcloud-ruby/pull/36) ([RaphaelPour](https://github.com/RaphaelPour))
|
25
|
+
- Add MIT license to gemspec [\#34](https://github.com/tonobo/hcloud-ruby/pull/34) ([bastelfreak](https://github.com/bastelfreak))
|
26
|
+
- Create LICENSE [\#33](https://github.com/tonobo/hcloud-ruby/pull/33) ([RaphaelPour](https://github.com/RaphaelPour))
|
27
|
+
- Update server attributes [\#32](https://github.com/tonobo/hcloud-ruby/pull/32) ([RaphaelPour](https://github.com/RaphaelPour))
|
28
|
+
|
29
|
+
## [v1.0.3](https://github.com/tonobo/hcloud-ruby/tree/v1.0.3) (2022-02-17)
|
30
|
+
|
31
|
+
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v1.0.2...v1.0.3)
|
32
|
+
|
33
|
+
**Closed issues:**
|
34
|
+
|
35
|
+
- Support Ruby 3.0+ [\#18](https://github.com/tonobo/hcloud-ruby/issues/18)
|
36
|
+
|
37
|
+
**Merged pull requests:**
|
38
|
+
|
39
|
+
- bump version to v1.0.3 [\#22](https://github.com/tonobo/hcloud-ruby/pull/22) ([RaphaelPour](https://github.com/RaphaelPour))
|
40
|
+
- lib: adjust code to work with 3.x ruby versions [\#21](https://github.com/tonobo/hcloud-ruby/pull/21) ([Kjarrigan](https://github.com/Kjarrigan))
|
41
|
+
- ci: add github workflow [\#20](https://github.com/tonobo/hcloud-ruby/pull/20) ([RaphaelPour](https://github.com/RaphaelPour))
|
42
|
+
|
43
|
+
## [v1.0.2](https://github.com/tonobo/hcloud-ruby/tree/v1.0.2) (2020-02-13)
|
44
|
+
|
45
|
+
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v1.0.1...v1.0.2)
|
46
|
+
|
47
|
+
**Closed issues:**
|
48
|
+
|
49
|
+
- Thank you! [\#14](https://github.com/tonobo/hcloud-ruby/issues/14)
|
50
|
+
|
51
|
+
## [v1.0.1](https://github.com/tonobo/hcloud-ruby/tree/v1.0.1) (2020-02-12)
|
52
|
+
|
53
|
+
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v1.0.0...v1.0.1)
|
54
|
+
|
55
|
+
## [v1.0.0](https://github.com/tonobo/hcloud-ruby/tree/v1.0.0) (2019-10-22)
|
56
|
+
|
57
|
+
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.2...v1.0.0)
|
58
|
+
|
59
|
+
**Merged pull requests:**
|
60
|
+
|
61
|
+
- Refactor resource handling [\#15](https://github.com/tonobo/hcloud-ruby/pull/15) ([tonobo](https://github.com/tonobo))
|
62
|
+
- Development [\#13](https://github.com/tonobo/hcloud-ruby/pull/13) ([tonobo](https://github.com/tonobo))
|
63
|
+
- Mention destroy instead of delete. [\#10](https://github.com/tonobo/hcloud-ruby/pull/10) ([FloHeinle](https://github.com/FloHeinle))
|
2
64
|
|
3
65
|
## [v0.1.2](https://github.com/tonobo/hcloud-ruby/tree/v0.1.2) (2018-02-27)
|
66
|
+
|
4
67
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.1...v0.1.2)
|
5
68
|
|
6
69
|
**Closed issues:**
|
@@ -14,6 +77,7 @@
|
|
14
77
|
- Enhance test suite [\#5](https://github.com/tonobo/hcloud-ruby/pull/5) ([tonobo](https://github.com/tonobo))
|
15
78
|
|
16
79
|
## [v0.1.1](https://github.com/tonobo/hcloud-ruby/tree/v0.1.1) (2018-02-26)
|
80
|
+
|
17
81
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0...v0.1.1)
|
18
82
|
|
19
83
|
**Merged pull requests:**
|
@@ -21,6 +85,7 @@
|
|
21
85
|
- Floating IP context [\#4](https://github.com/tonobo/hcloud-ruby/pull/4) ([MarkusFreitag](https://github.com/MarkusFreitag))
|
22
86
|
|
23
87
|
## [v0.1.0](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0) (2018-02-25)
|
88
|
+
|
24
89
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha4...v0.1.0)
|
25
90
|
|
26
91
|
**Closed issues:**
|
@@ -32,9 +97,11 @@
|
|
32
97
|
- Pagination proposal [\#3](https://github.com/tonobo/hcloud-ruby/pull/3) ([tonobo](https://github.com/tonobo))
|
33
98
|
|
34
99
|
## [v0.1.0.pre.alpha4](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha4) (2018-01-30)
|
100
|
+
|
35
101
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha3...v0.1.0.pre.alpha4)
|
36
102
|
|
37
103
|
## [v0.1.0.pre.alpha3](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha3) (2018-01-29)
|
104
|
+
|
38
105
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha2...v0.1.0.pre.alpha3)
|
39
106
|
|
40
107
|
**Merged pull requests:**
|
@@ -42,12 +109,17 @@
|
|
42
109
|
- set needed gems to runtime dependency [\#1](https://github.com/tonobo/hcloud-ruby/pull/1) ([bastelfreak](https://github.com/bastelfreak))
|
43
110
|
|
44
111
|
## [v0.1.0.pre.alpha2](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha2) (2018-01-28)
|
112
|
+
|
45
113
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha1...v0.1.0.pre.alpha2)
|
46
114
|
|
47
115
|
## [v0.1.0.pre.alpha1](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha1) (2018-01-28)
|
116
|
+
|
48
117
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha0...v0.1.0.pre.alpha1)
|
49
118
|
|
50
119
|
## [v0.1.0.pre.alpha0](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha0) (2018-01-27)
|
51
120
|
|
121
|
+
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/7f85d9b10b15c275f44f57d1b6fb6f122d95b5aa...v0.1.0.pre.alpha0)
|
122
|
+
|
123
|
+
|
52
124
|
|
53
|
-
\* *This
|
125
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile.lock
CHANGED
@@ -1,125 +1,128 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hcloud (0.
|
5
|
-
|
4
|
+
hcloud (1.0.3)
|
5
|
+
activemodel
|
6
6
|
oj
|
7
7
|
typhoeus
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activemodel (
|
13
|
-
activesupport (=
|
14
|
-
activesupport (
|
12
|
+
activemodel (7.0.3)
|
13
|
+
activesupport (= 7.0.3)
|
14
|
+
activesupport (7.0.3)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
-
i18n (>=
|
17
|
-
minitest (
|
18
|
-
tzinfo (~>
|
19
|
-
|
20
|
-
addressable (2.7.0)
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
addressable (2.8.0)
|
21
20
|
public_suffix (>= 2.0.2, < 5.0)
|
22
|
-
ast (2.4.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
21
|
+
ast (2.4.2)
|
22
|
+
builder (3.2.4)
|
23
|
+
codecov (0.6.0)
|
24
|
+
simplecov (>= 0.15, < 0.22)
|
25
|
+
coderay (1.1.3)
|
26
|
+
concurrent-ruby (1.1.10)
|
27
|
+
crack (0.4.5)
|
28
|
+
rexml
|
29
|
+
diff-lcs (1.5.0)
|
30
|
+
docile (1.4.0)
|
31
|
+
dry-configurable (0.15.0)
|
32
|
+
concurrent-ruby (~> 1.0)
|
33
|
+
dry-core (~> 0.6)
|
34
|
+
dry-container (0.9.0)
|
35
|
+
concurrent-ruby (~> 1.0)
|
36
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
37
|
+
dry-core (0.7.1)
|
38
|
+
concurrent-ruby (~> 1.0)
|
39
|
+
dry-inflector (0.2.1)
|
40
|
+
dry-logic (1.2.0)
|
41
|
+
concurrent-ruby (~> 1.0)
|
42
|
+
dry-core (~> 0.5, >= 0.5)
|
43
|
+
dry-types (1.5.1)
|
44
|
+
concurrent-ruby (~> 1.0)
|
45
|
+
dry-container (~> 0.3)
|
46
|
+
dry-core (~> 0.5, >= 0.5)
|
47
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
48
|
+
dry-logic (~> 1.0, >= 1.0.2)
|
49
|
+
ethon (0.15.0)
|
50
|
+
ffi (>= 1.15.0)
|
51
|
+
faker (2.20.0)
|
52
|
+
i18n (>= 1.8.11, < 2)
|
53
|
+
ffi (1.15.5)
|
54
|
+
grape (1.6.2)
|
49
55
|
activesupport
|
50
56
|
builder
|
57
|
+
dry-types (>= 1.1)
|
51
58
|
mustermann-grape (~> 1.0.0)
|
52
59
|
rack (>= 1.3.0)
|
53
60
|
rack-accept
|
54
|
-
|
55
|
-
|
56
|
-
i18n (1.7.0)
|
61
|
+
hashdiff (1.0.1)
|
62
|
+
i18n (1.10.0)
|
57
63
|
concurrent-ruby (~> 1.0)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
public_suffix (4.0.1)
|
74
|
-
rack (2.0.7)
|
64
|
+
method_source (1.0.0)
|
65
|
+
minitest (5.15.0)
|
66
|
+
mustermann (1.1.1)
|
67
|
+
ruby2_keywords (~> 0.0.1)
|
68
|
+
mustermann-grape (1.0.2)
|
69
|
+
mustermann (>= 1.0.0)
|
70
|
+
oj (3.13.11)
|
71
|
+
parallel (1.22.1)
|
72
|
+
parser (3.1.2.0)
|
73
|
+
ast (~> 2.4.1)
|
74
|
+
pry (0.14.1)
|
75
|
+
coderay (~> 1.1)
|
76
|
+
method_source (~> 1.0)
|
77
|
+
public_suffix (4.0.7)
|
78
|
+
rack (2.2.3.1)
|
75
79
|
rack-accept (0.4.5)
|
76
80
|
rack (>= 0.4)
|
77
|
-
rainbow (3.
|
78
|
-
rake (13.0.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
rspec-
|
83
|
-
|
84
|
-
rspec-
|
85
|
-
rspec-
|
81
|
+
rainbow (3.1.1)
|
82
|
+
rake (13.0.6)
|
83
|
+
regexp_parser (2.4.0)
|
84
|
+
rexml (3.2.5)
|
85
|
+
rspec (3.11.0)
|
86
|
+
rspec-core (~> 3.11.0)
|
87
|
+
rspec-expectations (~> 3.11.0)
|
88
|
+
rspec-mocks (~> 3.11.0)
|
89
|
+
rspec-core (3.11.0)
|
90
|
+
rspec-support (~> 3.11.0)
|
91
|
+
rspec-expectations (3.11.0)
|
86
92
|
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
-
rspec-support (~> 3.
|
88
|
-
rspec-mocks (3.
|
93
|
+
rspec-support (~> 3.11.0)
|
94
|
+
rspec-mocks (3.11.1)
|
89
95
|
diff-lcs (>= 1.2.0, < 2.0)
|
90
|
-
rspec-support (~> 3.
|
91
|
-
rspec-support (3.
|
92
|
-
rubocop (
|
93
|
-
jaro_winkler (~> 1.5.1)
|
96
|
+
rspec-support (~> 3.11.0)
|
97
|
+
rspec-support (3.11.0)
|
98
|
+
rubocop (1.29.0)
|
94
99
|
parallel (~> 1.10)
|
95
|
-
parser (>=
|
100
|
+
parser (>= 3.1.0.0)
|
96
101
|
rainbow (>= 2.2.2, < 4.0)
|
102
|
+
regexp_parser (>= 1.8, < 3.0)
|
103
|
+
rexml (>= 3.2.5, < 4.0)
|
104
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
97
105
|
ruby-progressbar (~> 1.7)
|
98
|
-
unicode-display_width (>= 1.4.0, <
|
99
|
-
|
100
|
-
|
101
|
-
|
106
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
107
|
+
rubocop-ast (1.17.0)
|
108
|
+
parser (>= 3.1.1.0)
|
109
|
+
ruby-progressbar (1.11.0)
|
110
|
+
ruby2_keywords (0.0.5)
|
111
|
+
simplecov (0.21.2)
|
102
112
|
docile (~> 1.1)
|
103
|
-
|
104
|
-
|
105
|
-
simplecov-html (0.
|
106
|
-
|
107
|
-
typhoeus (1.
|
113
|
+
simplecov-html (~> 0.11)
|
114
|
+
simplecov_json_formatter (~> 0.1)
|
115
|
+
simplecov-html (0.12.3)
|
116
|
+
simplecov_json_formatter (0.1.4)
|
117
|
+
typhoeus (1.4.0)
|
108
118
|
ethon (>= 0.9.0)
|
109
|
-
tzinfo (
|
110
|
-
|
111
|
-
unicode-display_width (1.
|
112
|
-
|
113
|
-
|
114
|
-
axiom-types (~> 0.1)
|
115
|
-
coercible (~> 1.0)
|
116
|
-
descendants_tracker (~> 0.0, >= 0.0.3)
|
117
|
-
equalizer (~> 0.0, >= 0.0.9)
|
118
|
-
webmock (3.7.6)
|
119
|
-
addressable (>= 2.3.6)
|
119
|
+
tzinfo (2.0.4)
|
120
|
+
concurrent-ruby (~> 1.0)
|
121
|
+
unicode-display_width (2.1.0)
|
122
|
+
webmock (3.14.0)
|
123
|
+
addressable (>= 2.8.0)
|
120
124
|
crack (>= 0.3.2)
|
121
125
|
hashdiff (>= 0.4.0, < 2.0.0)
|
122
|
-
zeitwerk (2.2.0)
|
123
126
|
|
124
127
|
PLATFORMS
|
125
128
|
ruby
|
@@ -127,7 +130,6 @@ PLATFORMS
|
|
127
130
|
|
128
131
|
DEPENDENCIES
|
129
132
|
activemodel
|
130
|
-
activesupport
|
131
133
|
bundler
|
132
134
|
codecov
|
133
135
|
faker
|
@@ -140,4 +142,4 @@ DEPENDENCIES
|
|
140
142
|
webmock
|
141
143
|
|
142
144
|
BUNDLED WITH
|
143
|
-
|
145
|
+
2.3.9
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Tim Foerster
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Hcloud
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/tonobo/hcloud-ruby/actions/workflows/ruby.yml/badge.svg)](https://github.com/tonobo/hcloud-ruby/actions/workflows/ruby.yml)
|
4
4
|
[![codecov](https://codecov.io/gh/tonobo/hcloud-ruby/branch/master/graph/badge.svg)](https://codecov.io/gh/tonobo/hcloud-ruby)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/hcloud.svg)](https://badge.fury.io/rb/hcloud)
|
6
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/aa67f9d590d86845822f/maintainability)](https://codeclimate.com/github/tonobo/hcloud-ruby/maintainability)
|
data/bin/console
CHANGED
@@ -8,8 +8,8 @@ require 'hcloud'
|
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
9
9
|
|
10
10
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
|
12
|
-
|
11
|
+
require 'pry'
|
12
|
+
Pry.start
|
13
13
|
|
14
|
-
require 'irb'
|
15
|
-
IRB.start(__FILE__)
|
14
|
+
# require 'irb'
|
15
|
+
# IRB.start(__FILE__)
|
data/hcloud.gemspec
CHANGED
@@ -7,13 +7,16 @@ require 'hcloud/version'
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'hcloud'
|
9
9
|
spec.version = Hcloud::VERSION
|
10
|
-
spec.authors = ['Tim Foerster']
|
11
|
-
spec.email = ['github@moo.gl']
|
10
|
+
spec.authors = ['Tim Foerster', 'Raphael Pour']
|
11
|
+
spec.email = ['github@moo.gl', 'rubygems@evilcookie.de']
|
12
12
|
|
13
13
|
spec.summary = 'HetznerCloud native Ruby client'
|
14
|
-
spec.homepage = 'https://github.com/tonobo/hcloud'
|
14
|
+
spec.homepage = 'https://github.com/tonobo/hcloud-ruby'
|
15
|
+
spec.license = 'MIT'
|
15
16
|
|
16
|
-
spec.
|
17
|
+
spec.required_ruby_version = '>= 2.7.0'
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
20
|
f.match(%r{^(test|spec|features)/})
|
18
21
|
end
|
19
22
|
spec.bindir = 'exe'
|
@@ -21,14 +24,12 @@ Gem::Specification.new do |spec|
|
|
21
24
|
spec.require_paths = ['lib']
|
22
25
|
|
23
26
|
spec.add_development_dependency 'activemodel'
|
24
|
-
spec.add_development_dependency 'activesupport'
|
25
27
|
spec.add_development_dependency 'bundler'
|
26
28
|
spec.add_development_dependency 'grape'
|
27
29
|
spec.add_development_dependency 'rake'
|
28
30
|
spec.add_development_dependency 'rspec'
|
29
31
|
spec.add_development_dependency 'webmock'
|
30
32
|
spec.add_runtime_dependency 'activemodel'
|
31
|
-
spec.add_runtime_dependency 'activesupport'
|
32
33
|
spec.add_runtime_dependency 'oj'
|
33
34
|
spec.add_runtime_dependency 'typhoeus'
|
34
35
|
end
|
@@ -66,8 +66,8 @@ module Hcloud
|
|
66
66
|
where
|
67
67
|
end
|
68
68
|
|
69
|
-
def where(
|
70
|
-
kwargs.
|
69
|
+
def where(kwargs = {})
|
70
|
+
kwargs.each_key do |key|
|
71
71
|
keys = self.class.filter_attributes.map(&:to_s)
|
72
72
|
next if keys.include?(key.to_s)
|
73
73
|
|
@@ -117,16 +117,16 @@ module Hcloud
|
|
117
117
|
def order(*sort)
|
118
118
|
_dup :@order,
|
119
119
|
begin
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
120
|
+
sort.flat_map do |s|
|
121
|
+
case s
|
122
|
+
when Symbol, String then s.to_s
|
123
|
+
when Hash then s.map { |k, v| "#{k}:#{v}" }
|
124
|
+
else
|
125
|
+
raise ArgumentError,
|
126
|
+
"Unable to resolve type for given #{s.inspect} from #{sort}"
|
127
|
+
end
|
127
128
|
end
|
128
129
|
end
|
129
|
-
end
|
130
130
|
end
|
131
131
|
|
132
132
|
def run
|
@@ -138,10 +138,8 @@ module Hcloud
|
|
138
138
|
)
|
139
139
|
end
|
140
140
|
|
141
|
-
def each
|
142
|
-
run.each
|
143
|
-
yield(member)
|
144
|
-
end
|
141
|
+
def each(&block)
|
142
|
+
run.each(&block)
|
145
143
|
end
|
146
144
|
|
147
145
|
# this is just to keep the actual bevahior
|
@@ -195,14 +193,13 @@ module Hcloud
|
|
195
193
|
r.compact.join('&')
|
196
194
|
end
|
197
195
|
|
196
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
198
197
|
def __entries__(path, **o)
|
199
198
|
first_page = request(path, o.merge(ep: ep(per_page: 1, page: 1))).run
|
200
199
|
total_entries = first_page.pagination.total_entries
|
201
200
|
return [first_page] if total_entries <= 1 || @limit == 1
|
202
201
|
|
203
|
-
|
204
|
-
total_entries = @limit if total_entries > @limit
|
205
|
-
end
|
202
|
+
total_entries = @limit if !@limit.nil? && (total_entries > @limit)
|
206
203
|
pages = total_entries / Client::MAX_ENTRIES_PER_PAGE
|
207
204
|
pages += 1 if (total_entries % Client::MAX_ENTRIES_PER_PAGE).positive?
|
208
205
|
pages.times.map do |page|
|
@@ -215,5 +212,6 @@ module Hcloud
|
|
215
212
|
end
|
216
213
|
end
|
217
214
|
end
|
215
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
218
216
|
end
|
219
217
|
end
|
data/lib/hcloud/client.rb
CHANGED
@@ -20,6 +20,7 @@ module Hcloud
|
|
20
20
|
end
|
21
21
|
|
22
22
|
attr_reader :token, :auto_pagination, :hydra, :user_agent
|
23
|
+
|
23
24
|
def initialize(token:, auto_pagination: false, concurrency: 20, user_agent: nil)
|
24
25
|
@token = token
|
25
26
|
@user_agent = user_agent || "hcloud-ruby v#{VERSION}"
|
@@ -93,12 +94,16 @@ module Hcloud
|
|
93
94
|
NetworkResource.new(client: self)
|
94
95
|
end
|
95
96
|
|
97
|
+
def firewalls
|
98
|
+
FirewallResource.new(client: self)
|
99
|
+
end
|
100
|
+
|
96
101
|
def volumes
|
97
102
|
VolumeResource.new(client: self)
|
98
103
|
end
|
99
104
|
|
100
105
|
class ResourceFuture < Delegator
|
101
|
-
def initialize(request)
|
106
|
+
def initialize(request) # rubocop:disable Lint/MissingSuper
|
102
107
|
@request = request
|
103
108
|
end
|
104
109
|
|
@@ -107,7 +112,7 @@ module Hcloud
|
|
107
112
|
end
|
108
113
|
end
|
109
114
|
|
110
|
-
def prepare_request(url,
|
115
|
+
def prepare_request(url, args = {}, &block)
|
111
116
|
req = request(url, **args.merge(block: block))
|
112
117
|
return req.run.resource unless concurrent?
|
113
118
|
|
@@ -115,7 +120,7 @@ module Hcloud
|
|
115
120
|
ResourceFuture.new(req)
|
116
121
|
end
|
117
122
|
|
118
|
-
def request(path,
|
123
|
+
def request(path, options = {}) # rubocop:disable Metrics/MethodLength
|
119
124
|
hcloud_attributes = TyphoeusExt.collect_attributes(options)
|
120
125
|
if x = options.delete(:j)
|
121
126
|
options[:body] = Oj.dump(x, mode: :compat)
|
@@ -127,7 +132,7 @@ module Hcloud
|
|
127
132
|
q << x.to_param
|
128
133
|
end
|
129
134
|
path = path.dup
|
130
|
-
path <<
|
135
|
+
path << "?#{q.join('&')}"
|
131
136
|
r = Typhoeus::Request.new(
|
132
137
|
"https://api.hetzner.cloud/v1/#{path}",
|
133
138
|
{
|
data/lib/hcloud/entry_loader.rb
CHANGED
@@ -53,7 +53,7 @@ module Hcloud
|
|
53
53
|
|
54
54
|
def protectable(*args)
|
55
55
|
define_method(:change_protection) do |**kwargs|
|
56
|
-
kwargs.
|
56
|
+
kwargs.each_key do |key|
|
57
57
|
next if args.map(&:to_s).include? key.to_s
|
58
58
|
|
59
59
|
raise ArgumentError, "#{key} not an allowed protection mode (allowed: #{args})"
|
@@ -74,29 +74,57 @@ module Hcloud
|
|
74
74
|
|
75
75
|
def from_response(response, autoload_action: nil)
|
76
76
|
attributes = response.resource_attributes
|
77
|
-
|
77
|
+
|
78
|
+
action_resp = _try_load_action(response) if autoload_action
|
79
|
+
return action_resp unless attributes || action_resp.nil?
|
80
|
+
|
78
81
|
client = response.context.client
|
79
82
|
if attributes.is_a?(Array)
|
80
|
-
results = attributes.map
|
83
|
+
results = attributes.map do |item|
|
84
|
+
new(client, item).tap do |entity|
|
85
|
+
entity.response = response
|
86
|
+
end
|
87
|
+
end
|
81
88
|
results.tap { |ary| ary.extend(Collection) }.response = response
|
82
89
|
return results
|
83
90
|
end
|
84
91
|
|
85
|
-
|
86
|
-
|
92
|
+
if action_resp.nil?
|
93
|
+
return new(client, attributes).tap { |entity| entity.response = response }
|
94
|
+
end
|
87
95
|
|
88
96
|
[
|
89
|
-
|
90
|
-
new(attributes).tap { |entity| entity.response = response }
|
97
|
+
action_resp,
|
98
|
+
new(client, attributes).tap { |entity| entity.response = response }
|
91
99
|
]
|
92
100
|
end
|
101
|
+
|
102
|
+
def _try_load_action(response)
|
103
|
+
# some API endpoints return a list of actions (e.g. firewall action
|
104
|
+
# apply_to_resources), some a single action (e.g. server action
|
105
|
+
# attach_iso)
|
106
|
+
actions = response.parsed_json[:actions]
|
107
|
+
action = response.parsed_json[:action]
|
108
|
+
|
109
|
+
client = response.context.client
|
110
|
+
|
111
|
+
if actions
|
112
|
+
return actions.map do |act|
|
113
|
+
Action.new(client, act)
|
114
|
+
end
|
115
|
+
elsif action
|
116
|
+
return Action.new(client, action)
|
117
|
+
end
|
118
|
+
|
119
|
+
nil
|
120
|
+
end
|
93
121
|
end
|
94
122
|
|
95
123
|
attr_accessor :response
|
96
124
|
|
97
|
-
def initialize(client = nil,
|
125
|
+
def initialize(client = nil, resource = {})
|
98
126
|
@client = client
|
99
|
-
_load(
|
127
|
+
_load(resource)
|
100
128
|
end
|
101
129
|
|
102
130
|
def inspect
|
@@ -174,7 +202,10 @@ module Hcloud
|
|
174
202
|
instance_variable_set("@#{key}", value)
|
175
203
|
end
|
176
204
|
|
205
|
+
# rubocop: disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/AbcSize
|
177
206
|
def _load(resource)
|
207
|
+
return if resource.nil?
|
208
|
+
|
178
209
|
@_attributes = {}.with_indifferent_access
|
179
210
|
|
180
211
|
resource.each do |key, value|
|
@@ -190,8 +221,30 @@ module Hcloud
|
|
190
221
|
next
|
191
222
|
end
|
192
223
|
|
224
|
+
# if schema definition is [Class]
|
225
|
+
if definition.is_a?(Array) && definition.first.include?(EntryLoader)
|
226
|
+
|
227
|
+
# just set attribute to an empty array if value is no array or empty
|
228
|
+
if !value.is_a?(Array) || value.empty?
|
229
|
+
_update_attribute(key, [])
|
230
|
+
next
|
231
|
+
end
|
232
|
+
|
233
|
+
if value.first.is_a?(Integer)
|
234
|
+
# If value is an integer, this is the id of an object which's class can be
|
235
|
+
# retreived from definition. Load a future object that can on access retreive the
|
236
|
+
# data from the api and convert it to a proper object.
|
237
|
+
_update_attribute(key, value.map { |id| Future.new(client, definition.first, id) })
|
238
|
+
else
|
239
|
+
# Otherwise the value *is* the content of the object
|
240
|
+
_update_attribute(key, value.map { |item| definition.first.new(client, item) })
|
241
|
+
end
|
242
|
+
next
|
243
|
+
end
|
244
|
+
|
193
245
|
_update_attribute(key, value.is_a?(Hash) ? value.with_indifferent_access : value)
|
194
246
|
end
|
195
247
|
end
|
248
|
+
# rubocop: enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/AbcSize
|
196
249
|
end
|
197
250
|
end
|
data/lib/hcloud/errors.rb
CHANGED
@@ -9,7 +9,7 @@ module Hcloud
|
|
9
9
|
class Locked < Error; end
|
10
10
|
class NotFound < Error; end
|
11
11
|
class RateLimitExceeded < Error; end
|
12
|
-
class
|
12
|
+
class ResourceUnavailable < Error; end
|
13
13
|
class ServiceError < Error; end
|
14
14
|
class UniquenessError < Error; end
|
15
15
|
class UnknownError < Error; end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hcloud
|
4
|
+
class Firewall
|
5
|
+
require 'hcloud/firewall_resource'
|
6
|
+
|
7
|
+
include EntryLoader
|
8
|
+
|
9
|
+
updatable :name
|
10
|
+
destructible
|
11
|
+
|
12
|
+
has_actions
|
13
|
+
|
14
|
+
def set_rules(rules:) # rubocop:disable Naming/AccessorMethodName
|
15
|
+
prepare_request('actions/set_rules', j: COLLECT_ARGS.call(__method__, binding))
|
16
|
+
end
|
17
|
+
|
18
|
+
def apply_to_resources(apply_to:)
|
19
|
+
prepare_request('actions/apply_to_resources', j: COLLECT_ARGS.call(__method__, binding))
|
20
|
+
end
|
21
|
+
|
22
|
+
def remove_from_resources(remove_from:)
|
23
|
+
prepare_request('actions/remove_from_resources', j: COLLECT_ARGS.call(__method__, binding))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hcloud
|
4
|
+
class FirewallResource < AbstractResource
|
5
|
+
filter_attributes :name, :label_selector
|
6
|
+
|
7
|
+
def [](arg)
|
8
|
+
case arg
|
9
|
+
when Integer then find_by(id: arg)
|
10
|
+
when String then find_by(name: arg)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(name:, rules: [], apply_to: [], labels: {})
|
15
|
+
prepare_request(
|
16
|
+
'firewalls', j: COLLECT_ARGS.call(__method__, binding),
|
17
|
+
expected_code: 201
|
18
|
+
) do |response|
|
19
|
+
Firewall.new(client, response.parsed_json[:firewall])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Hcloud
|
4
4
|
class FloatingIPResource < AbstractResource
|
5
|
-
filter_attributes :name
|
5
|
+
filter_attributes :name, :label_selector
|
6
6
|
|
7
7
|
bind_to FloatingIP
|
8
8
|
|
@@ -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)
|
16
|
+
def create(type:, server: nil, home_location: nil, description: nil, labels: {})
|
17
17
|
prepare_request(
|
18
18
|
'floating_ips', j: COLLECT_ARGS.call(__method__, binding),
|
19
19
|
expected_code: 201
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/string/inflections'
|
4
|
+
|
5
|
+
module Hcloud
|
6
|
+
class Future < Delegator
|
7
|
+
# rubocop: disable Lint/MissingSuper
|
8
|
+
def initialize(client, target_class, id)
|
9
|
+
@target_class = target_class
|
10
|
+
@id = id
|
11
|
+
@__client = client
|
12
|
+
end
|
13
|
+
# rubocop: enable Lint/MissingSuper
|
14
|
+
|
15
|
+
def __getobj__
|
16
|
+
# pluralize class name and convert it to symbol
|
17
|
+
@__getobj__ ||= @__client.public_send(
|
18
|
+
@target_class.name # full name of the class including namespaces
|
19
|
+
.demodulize # last module name only
|
20
|
+
.tableize # convert to table name, split words by _ + downcase
|
21
|
+
.pluralize
|
22
|
+
.to_sym
|
23
|
+
).find(@id)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/hcloud/network.rb
CHANGED
@@ -14,12 +14,12 @@ module Hcloud
|
|
14
14
|
|
15
15
|
has_actions
|
16
16
|
|
17
|
-
def add_subnet(type:, ip_range: nil
|
17
|
+
def add_subnet(type:, network_zone:, ip_range: nil)
|
18
18
|
prepare_request('actions/add_subnet', j: COLLECT_ARGS.call(__method__, binding))
|
19
19
|
end
|
20
20
|
|
21
21
|
def del_subnet(ip_range:)
|
22
|
-
prepare_request('actions/
|
22
|
+
prepare_request('actions/delete_subnet', j: COLLECT_ARGS.call(__method__, binding))
|
23
23
|
end
|
24
24
|
|
25
25
|
def add_route(destination:, gateway:)
|
@@ -27,7 +27,7 @@ module Hcloud
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def del_route(destination:, gateway:)
|
30
|
-
prepare_request('actions/
|
30
|
+
prepare_request('actions/delete_route', j: COLLECT_ARGS.call(__method__, binding))
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Hcloud
|
4
4
|
class NetworkResource < AbstractResource
|
5
|
-
filter_attributes :name
|
5
|
+
filter_attributes :name, :label_selector
|
6
6
|
|
7
7
|
bind_to Network
|
8
8
|
|
@@ -13,7 +13,7 @@ module Hcloud
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def create(name:, ip_range:, subnets: nil, routes: nil)
|
16
|
+
def create(name:, ip_range:, subnets: nil, routes: nil, labels: {})
|
17
17
|
prepare_request(
|
18
18
|
'networks', j: COLLECT_ARGS.call(__method__, binding),
|
19
19
|
expected_code: 201
|
data/lib/hcloud/server.rb
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
|
3
3
|
module Hcloud
|
4
4
|
class ServerResource < AbstractResource
|
5
|
-
filter_attributes :status, :name
|
5
|
+
filter_attributes :status, :name, :label_selector
|
6
6
|
|
7
7
|
bind_to Server
|
8
8
|
|
9
9
|
def create(name:,
|
10
10
|
server_type:,
|
11
|
-
datacenter: nil,
|
11
|
+
image:, datacenter: nil,
|
12
12
|
location: nil,
|
13
13
|
start_after_create: nil,
|
14
|
-
image:,
|
15
14
|
ssh_keys: [],
|
16
15
|
networks: [],
|
17
|
-
user_data: nil
|
16
|
+
user_data: nil,
|
17
|
+
labels: {})
|
18
18
|
prepare_request('servers', j: COLLECT_ARGS.call(__method__, binding),
|
19
19
|
expected_code: 201) do |response|
|
20
20
|
[
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Hcloud
|
4
4
|
class SSHKeyResource < AbstractResource
|
5
|
-
filter_attributes :name
|
5
|
+
filter_attributes :name, :label_selector
|
6
6
|
|
7
7
|
def [](arg)
|
8
8
|
case arg
|
@@ -11,7 +11,7 @@ module Hcloud
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
def create(name:, public_key:)
|
14
|
+
def create(name:, public_key:, labels: {})
|
15
15
|
prepare_request(
|
16
16
|
'ssh_keys', j: COLLECT_ARGS.call(__method__, binding),
|
17
17
|
expected_code: 201
|
data/lib/hcloud/typhoeus_ext.rb
CHANGED
@@ -30,16 +30,14 @@ module Hcloud
|
|
30
30
|
def parsed_json
|
31
31
|
return {} if code == 204
|
32
32
|
|
33
|
-
@parsed_json ||=
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
33
|
+
@parsed_json ||= Oj.load(body, symbol_keys: true).tap do |json|
|
34
|
+
next unless request.hydra
|
35
|
+
|
36
|
+
check_for_error(
|
37
|
+
e_code: json.to_h.dig(:error, :code),
|
38
|
+
e_message: json.to_h.dig(:error, :message)
|
39
|
+
)
|
40
|
+
end
|
43
41
|
rescue StandardError
|
44
42
|
raise Error::UnexpectedError, "unable to load body: #{body}"
|
45
43
|
end
|
@@ -60,7 +58,7 @@ module Hcloud
|
|
60
58
|
end
|
61
59
|
|
62
60
|
def pagination
|
63
|
-
@pagination ||= Pagination.new(parsed_json[:meta].to_h[:pagination])
|
61
|
+
@pagination ||= Pagination.new(nil, parsed_json[:meta].to_h[:pagination])
|
64
62
|
end
|
65
63
|
|
66
64
|
def resource_attributes
|
data/lib/hcloud/version.rb
CHANGED
@@ -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,7 @@ 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
15
|
prepare_request(
|
16
16
|
'volumes', j: COLLECT_ARGS.call(__method__, binding),
|
17
17
|
expected_code: 201
|
data/lib/hcloud.rb
CHANGED
@@ -7,6 +7,7 @@ require 'active_support/core_ext/hash/indifferent_access'
|
|
7
7
|
module Hcloud
|
8
8
|
autoload :Error, 'hcloud/errors'
|
9
9
|
autoload :Client, 'hcloud/client'
|
10
|
+
autoload :Future, 'hcloud/future'
|
10
11
|
autoload :TyphoeusExt, 'hcloud/typhoeus_ext'
|
11
12
|
autoload :AbstractResource, 'hcloud/abstract_resource'
|
12
13
|
autoload :EntryLoader, 'hcloud/entry_loader'
|
@@ -35,6 +36,9 @@ module Hcloud
|
|
35
36
|
autoload :Network, 'hcloud/network'
|
36
37
|
autoload :NetworkResource, 'hcloud/network_resource'
|
37
38
|
|
39
|
+
autoload :Firewall, 'hcloud/firewall'
|
40
|
+
autoload :FirewallResource, 'hcloud/firewall_resource'
|
41
|
+
|
38
42
|
autoload :Volume, 'hcloud/volume'
|
39
43
|
autoload :VolumeResource, 'hcloud/volume_resource'
|
40
44
|
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Foerster
|
8
|
-
|
8
|
+
- Raphael Pour
|
9
|
+
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activemodel
|
@@ -24,20 +25,6 @@ dependencies:
|
|
24
25
|
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
27
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: activesupport
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
28
|
- !ruby/object:Gem::Dependency
|
42
29
|
name: bundler
|
43
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,20 +109,6 @@ dependencies:
|
|
122
109
|
- - ">="
|
123
110
|
- !ruby/object:Gem::Version
|
124
111
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: activesupport
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :runtime
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
112
|
- !ruby/object:Gem::Dependency
|
140
113
|
name: oj
|
141
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,21 +137,23 @@ dependencies:
|
|
164
137
|
- - ">="
|
165
138
|
- !ruby/object:Gem::Version
|
166
139
|
version: '0'
|
167
|
-
description:
|
140
|
+
description:
|
168
141
|
email:
|
169
142
|
- github@moo.gl
|
143
|
+
- rubygems@evilcookie.de
|
170
144
|
executables: []
|
171
145
|
extensions: []
|
172
146
|
extra_rdoc_files: []
|
173
147
|
files:
|
148
|
+
- ".github/workflows/ruby.yml"
|
174
149
|
- ".gitignore"
|
175
150
|
- ".rspec"
|
176
151
|
- ".rubocop.yml"
|
177
152
|
- ".rubocop_todo.yml"
|
178
|
-
- ".travis.yml"
|
179
153
|
- CHANGELOG.md
|
180
154
|
- Gemfile
|
181
155
|
- Gemfile.lock
|
156
|
+
- LICENSE
|
182
157
|
- README.md
|
183
158
|
- Rakefile
|
184
159
|
- bin/console
|
@@ -193,8 +168,11 @@ files:
|
|
193
168
|
- lib/hcloud/datacenter_resource.rb
|
194
169
|
- lib/hcloud/entry_loader.rb
|
195
170
|
- lib/hcloud/errors.rb
|
171
|
+
- lib/hcloud/firewall.rb
|
172
|
+
- lib/hcloud/firewall_resource.rb
|
196
173
|
- lib/hcloud/floating_ip.rb
|
197
174
|
- lib/hcloud/floating_ip_resource.rb
|
175
|
+
- lib/hcloud/future.rb
|
198
176
|
- lib/hcloud/image.rb
|
199
177
|
- lib/hcloud/image_resource.rb
|
200
178
|
- lib/hcloud/iso.rb
|
@@ -214,10 +192,11 @@ files:
|
|
214
192
|
- lib/hcloud/version.rb
|
215
193
|
- lib/hcloud/volume.rb
|
216
194
|
- lib/hcloud/volume_resource.rb
|
217
|
-
homepage: https://github.com/tonobo/hcloud
|
218
|
-
licenses:
|
195
|
+
homepage: https://github.com/tonobo/hcloud-ruby
|
196
|
+
licenses:
|
197
|
+
- MIT
|
219
198
|
metadata: {}
|
220
|
-
post_install_message:
|
199
|
+
post_install_message:
|
221
200
|
rdoc_options: []
|
222
201
|
require_paths:
|
223
202
|
- lib
|
@@ -225,15 +204,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
204
|
requirements:
|
226
205
|
- - ">="
|
227
206
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
207
|
+
version: 2.7.0
|
229
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
209
|
requirements:
|
231
210
|
- - ">="
|
232
211
|
- !ruby/object:Gem::Version
|
233
212
|
version: '0'
|
234
213
|
requirements: []
|
235
|
-
rubygems_version: 3.1.
|
236
|
-
signing_key:
|
214
|
+
rubygems_version: 3.1.6
|
215
|
+
signing_key:
|
237
216
|
specification_version: 4
|
238
217
|
summary: HetznerCloud native Ruby client
|
239
218
|
test_files: []
|