hetzner-api 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/Gemfile.lock +41 -43
- data/hetzner-api.gemspec +6 -8
- data/lib/hetzner/api/cli.rb +12 -14
- data/lib/hetzner/api/version.rb +1 -1
- metadata +20 -52
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hetzner-api (1.0
|
5
|
-
httparty (~> 0.
|
4
|
+
hetzner-api (1.1.0)
|
5
|
+
httparty (~> 0.10.0)
|
6
6
|
json
|
7
7
|
thor
|
8
8
|
xml-simple
|
@@ -10,15 +10,14 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: http://rubygems.org/
|
12
12
|
specs:
|
13
|
-
aruba (0.
|
14
|
-
childprocess (
|
13
|
+
aruba (0.5.1)
|
14
|
+
childprocess (~> 0.3.6)
|
15
15
|
cucumber (>= 1.1.1)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
ffi (~> 1.0.6)
|
16
|
+
rspec-expectations (>= 2.7.0)
|
17
|
+
builder (3.1.4)
|
18
|
+
childprocess (0.3.6)
|
19
|
+
ffi (~> 1.0, >= 1.0.6)
|
20
|
+
coderay (1.0.8)
|
22
21
|
cucumber (1.2.1)
|
23
22
|
builder (>= 2.1.2)
|
24
23
|
diff-lcs (>= 1.1.3)
|
@@ -26,40 +25,41 @@ GEM
|
|
26
25
|
json (>= 1.4.6)
|
27
26
|
diff-lcs (1.1.3)
|
28
27
|
fakeweb (1.3.0)
|
29
|
-
ffi (1.0
|
30
|
-
gherkin (2.11.
|
28
|
+
ffi (1.2.0)
|
29
|
+
gherkin (2.11.5)
|
31
30
|
json (>= 1.4.6)
|
32
|
-
|
33
|
-
guard (1.2.3)
|
31
|
+
guard (1.5.4)
|
34
32
|
listen (>= 0.4.2)
|
33
|
+
lumberjack (>= 1.0.2)
|
34
|
+
pry (>= 0.9.10)
|
35
35
|
thor (>= 0.14.6)
|
36
|
-
guard-rspec (
|
36
|
+
guard-rspec (2.3.1)
|
37
37
|
guard (>= 1.1)
|
38
|
-
|
38
|
+
rspec (~> 2.11)
|
39
|
+
httparty (0.10.0)
|
39
40
|
multi_json (~> 1.0)
|
40
41
|
multi_xml
|
41
|
-
json (1.7.
|
42
|
-
listen (0.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
multi_json (1.3.7)
|
42
|
+
json (1.7.5)
|
43
|
+
listen (0.6.0)
|
44
|
+
lumberjack (1.0.2)
|
45
|
+
method_source (0.8.1)
|
46
|
+
multi_json (1.5.0)
|
47
47
|
multi_xml (0.5.1)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
rspec-
|
56
|
-
rspec-
|
57
|
-
|
58
|
-
rspec-
|
59
|
-
rspec-expectations (2.11.2)
|
48
|
+
pry (0.9.10)
|
49
|
+
coderay (~> 1.0.5)
|
50
|
+
method_source (~> 0.8)
|
51
|
+
slop (~> 3.3.1)
|
52
|
+
rake (10.0.2)
|
53
|
+
rspec (2.12.0)
|
54
|
+
rspec-core (~> 2.12.0)
|
55
|
+
rspec-expectations (~> 2.12.0)
|
56
|
+
rspec-mocks (~> 2.12.0)
|
57
|
+
rspec-core (2.12.1)
|
58
|
+
rspec-expectations (2.12.0)
|
60
59
|
diff-lcs (~> 1.1.3)
|
61
|
-
rspec-mocks (2.
|
62
|
-
|
60
|
+
rspec-mocks (2.12.0)
|
61
|
+
slop (3.3.3)
|
62
|
+
thor (0.16.0)
|
63
63
|
xml-simple (1.1.2)
|
64
64
|
|
65
65
|
PLATFORMS
|
@@ -67,12 +67,10 @@ PLATFORMS
|
|
67
67
|
|
68
68
|
DEPENDENCIES
|
69
69
|
aruba
|
70
|
-
|
71
|
-
bundler (~> 1.2.2)
|
70
|
+
bundler
|
72
71
|
cucumber (~> 1.2.1)
|
73
|
-
fakeweb
|
74
|
-
|
75
|
-
guard-rspec (~> 1.2.0)
|
72
|
+
fakeweb (~> 1.3.0)
|
73
|
+
guard-rspec (~> 2.3.1)
|
76
74
|
hetzner-api!
|
77
|
-
rake
|
78
|
-
rspec (~> 2.
|
75
|
+
rake
|
76
|
+
rspec (~> 2.12.0)
|
data/hetzner-api.gemspec
CHANGED
@@ -18,20 +18,18 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_runtime_dependency 'jruby-openssl'
|
19
19
|
end
|
20
20
|
|
21
|
-
s.add_dependency 'httparty', '~> 0.
|
21
|
+
s.add_dependency 'httparty', '~> 0.10.0'
|
22
22
|
s.add_dependency 'thor'
|
23
23
|
s.add_dependency 'json'
|
24
24
|
s.add_dependency 'xml-simple'
|
25
25
|
|
26
|
-
s.add_development_dependency "bundler"
|
27
|
-
s.add_development_dependency "rspec", "~> 2.
|
28
|
-
s.add_development_dependency "guard-rspec", "~>
|
29
|
-
s.add_development_dependency "
|
30
|
-
s.add_development_dependency "background_process", "~> 1.3"
|
31
|
-
s.add_development_dependency "fakeweb"
|
26
|
+
s.add_development_dependency "bundler"
|
27
|
+
s.add_development_dependency "rspec", "~> 2.12.0"
|
28
|
+
s.add_development_dependency "guard-rspec", "~> 2.3.1"
|
29
|
+
s.add_development_dependency "fakeweb", "~> 1.3.0"
|
32
30
|
s.add_development_dependency "cucumber", "~> 1.2.1"
|
33
31
|
s.add_development_dependency "aruba"
|
34
|
-
s.add_development_dependency "rake"
|
32
|
+
s.add_development_dependency "rake"
|
35
33
|
|
36
34
|
s.files = `git ls-files`.split("\n")
|
37
35
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
data/lib/hetzner/api/cli.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'thor'
|
2
1
|
require 'ipaddr'
|
2
|
+
require 'thor'
|
3
3
|
require 'pp'
|
4
4
|
require 'json'
|
5
5
|
require 'xmlsimple'
|
@@ -8,30 +8,30 @@ module Hetzner
|
|
8
8
|
class API
|
9
9
|
class CLI < Thor
|
10
10
|
attr_accessor :api
|
11
|
-
|
11
|
+
|
12
12
|
desc "boot ACTION [SERVER_IP]", "get available boot options"
|
13
13
|
method_options :username => :string
|
14
14
|
method_options :password => :string
|
15
15
|
method_options :set => 'get'
|
16
|
-
|
16
|
+
|
17
17
|
def boot(ip = "")
|
18
18
|
require_ip ip
|
19
19
|
generate_api_instance
|
20
|
-
|
20
|
+
|
21
21
|
case options.set
|
22
22
|
when 'get'
|
23
23
|
require_ip ip
|
24
24
|
result = @api.boot? ip
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
output(result)
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
desc "failover [SERVER_IP] (--to [FAILOVER_IP])", "get/set failover of SERVER_IP (to FAILOVER_IP)"
|
31
31
|
method_options :username => :string
|
32
32
|
method_options :password => :string
|
33
33
|
method_options :to => :string
|
34
|
-
|
34
|
+
|
35
35
|
def failover(ip = nil)
|
36
36
|
generate_api_instance
|
37
37
|
|
@@ -42,19 +42,17 @@ module Hetzner
|
|
42
42
|
else
|
43
43
|
result = @api.failover? ip
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
output(result)
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
private
|
50
|
-
|
50
|
+
|
51
51
|
def output(result)
|
52
52
|
@render = 'xml'
|
53
53
|
case @render
|
54
54
|
when 'pp'
|
55
55
|
pp result.parsed_response
|
56
|
-
when 'yaml'
|
57
|
-
puts result.parsed_response.to_yaml
|
58
56
|
when 'xml'
|
59
57
|
puts XmlSimple.xml_out result.parsed_response, 'RootName' => 'result', 'AnonymousTag' => '' # dirty
|
60
58
|
when 'json'
|
@@ -62,13 +60,13 @@ module Hetzner
|
|
62
60
|
jj JSON.parse result.response.body
|
63
61
|
end
|
64
62
|
end
|
65
|
-
|
63
|
+
|
66
64
|
def require_ip(ip)
|
67
65
|
ip = IPAddr.new ip
|
68
66
|
rescue ArgumentError
|
69
67
|
raise RequiredArgumentMissingError, "server IP missing!"
|
70
68
|
end
|
71
|
-
|
69
|
+
|
72
70
|
def generate_api_instance
|
73
71
|
if options.username && options.password
|
74
72
|
@api = Hetzner::API.new options.username, options.password
|
data/lib/hetzner/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hetzner-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.10.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.10.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: thor
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,17 +80,17 @@ dependencies:
|
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: '0'
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
|
-
- -
|
91
|
+
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
93
|
+
version: '0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: rspec
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 2.
|
101
|
+
version: 2.12.0
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 2.
|
109
|
+
version: 2.12.0
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: guard-rspec
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +114,7 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 2.3.1
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,31 +122,15 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: growl
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
125
|
+
version: 2.3.1
|
142
126
|
- !ruby/object:Gem::Dependency
|
143
|
-
name:
|
127
|
+
name: fakeweb
|
144
128
|
requirement: !ruby/object:Gem::Requirement
|
145
129
|
none: false
|
146
130
|
requirements:
|
147
131
|
- - ~>
|
148
132
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
133
|
+
version: 1.3.0
|
150
134
|
type: :development
|
151
135
|
prerelease: false
|
152
136
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -154,23 +138,7 @@ dependencies:
|
|
154
138
|
requirements:
|
155
139
|
- - ~>
|
156
140
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: fakeweb
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ! '>='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
141
|
+
version: 1.3.0
|
174
142
|
- !ruby/object:Gem::Dependency
|
175
143
|
name: cucumber
|
176
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,17 +176,17 @@ dependencies:
|
|
208
176
|
requirement: !ruby/object:Gem::Requirement
|
209
177
|
none: false
|
210
178
|
requirements:
|
211
|
-
- -
|
179
|
+
- - ! '>='
|
212
180
|
- !ruby/object:Gem::Version
|
213
|
-
version: 0
|
181
|
+
version: '0'
|
214
182
|
type: :development
|
215
183
|
prerelease: false
|
216
184
|
version_requirements: !ruby/object:Gem::Requirement
|
217
185
|
none: false
|
218
186
|
requirements:
|
219
|
-
- -
|
187
|
+
- - ! '>='
|
220
188
|
- !ruby/object:Gem::Version
|
221
|
-
version: 0
|
189
|
+
version: '0'
|
222
190
|
description: A wrapper for Hetzner.de's server management API
|
223
191
|
email:
|
224
192
|
- roland@moriz.de
|
@@ -318,7 +286,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
318
286
|
version: '0'
|
319
287
|
segments:
|
320
288
|
- 0
|
321
|
-
hash:
|
289
|
+
hash: 2243244911634323905
|
322
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
323
291
|
none: false
|
324
292
|
requirements:
|