hetzner-api 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +36 -3
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/hetzner-api.gemspec +5 -2
- data/lib/api/boot.rb +1 -0
- data/lib/api/failover.rb +2 -0
- data/lib/api/rdns.rb +6 -0
- data/lib/api/rescue.rb +6 -0
- data/lib/api/reset.rb +7 -0
- data/lib/api/vnc.rb +7 -2
- data/lib/api/wol.rb +3 -0
- data/spec/spec_helper.rb +1 -1
- metadata +17 -3
data/README.rdoc
CHANGED
@@ -1,9 +1,38 @@
|
|
1
1
|
= hetzner-api
|
2
2
|
|
3
|
-
A HTTParty based wrapper for Hetzner.de's server management
|
4
|
-
|
3
|
+
A HTTParty[http://httparty.rubyforge.org/] based wrapper for Hetzner.de's server management API.
|
4
|
+
|
5
|
+
see http://wiki.hetzner.de/index.php/Robot_Webservice_en for details.
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
<b>gem install hetzner-api</b>
|
10
|
+
|
11
|
+
(you may want to use sudo for that.)
|
12
|
+
|
13
|
+
== Example
|
14
|
+
|
15
|
+
<tt>h = Hetzner::API.new "username", "password"</tt>
|
16
|
+
|
17
|
+
<tt>h.reset? "111.111.111.111"</tt>
|
18
|
+
|
19
|
+
<tt>h.enable_rescue! "111.111.111.111", "linux", "64"</tt>
|
20
|
+
|
21
|
+
<tt>h.reset! "111.111.111.111", :sw</tt>
|
22
|
+
|
23
|
+
<tt>h.wol! "111.111.111.222"</tt>
|
24
|
+
|
25
|
+
<tt>h.rdns! "111.111.111.222", "web100.falkenstein.de.example.com"</tt>
|
26
|
+
|
27
|
+
== Readme (rdoc)
|
28
|
+
|
29
|
+
<b>http://rdoc.info/github/rmoriz/hetzner-api</b>
|
30
|
+
|
31
|
+
|
32
|
+
== WARNING!
|
33
|
+
|
34
|
+
This is not an official Hetzner AG project.
|
5
35
|
|
6
|
-
This is not an official Hetzner AG software!
|
7
36
|
The gem and the author are not related to Hetzner AG!
|
8
37
|
|
9
38
|
<b>Use at your very own risk! Satisfaction NOT guaranteed!</b>
|
@@ -11,3 +40,7 @@ The gem and the author are not related to Hetzner AG!
|
|
11
40
|
== Copyright
|
12
41
|
|
13
42
|
Copyright (c) 2010 Roland Moriz. See LICENSE for details.
|
43
|
+
|
44
|
+
{Ruby on Rails Entwicklung}[http://moriz.de/] -> Moriz GmbH
|
45
|
+
|
46
|
+
{Ruby on Rails Hosting}[http://rails.io/] -> Rails.io
|
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/rmoriz/hetzner-api"
|
12
12
|
gem.authors = ["Roland Moriz"]
|
13
13
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
gem.add_dependency "httparty", ">= 0.6.1"
|
14
15
|
end
|
15
16
|
Jeweler::GemcutterTasks.new
|
16
17
|
rescue LoadError
|
@@ -38,7 +39,7 @@ Rake::RDocTask.new do |rdoc|
|
|
38
39
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
39
40
|
|
40
41
|
rdoc.rdoc_dir = 'rdoc'
|
41
|
-
rdoc.title = "hetzner #{version}"
|
42
|
+
rdoc.title = "hetzner-api #{version}"
|
42
43
|
rdoc.rdoc_files.include('README*')
|
43
44
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
44
45
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/hetzner-api.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{hetzner-api}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Roland Moriz"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-03}
|
13
13
|
s.description = %q{A small, unofficial wrapper for Hetzner.de's API (server management)}
|
14
14
|
s.email = %q{roland@rails.io}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -53,11 +53,14 @@ Gem::Specification.new do |s|
|
|
53
53
|
|
54
54
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
55
55
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
56
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
|
56
57
|
else
|
57
58
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
59
|
+
s.add_dependency(%q<httparty>, [">= 0.6.1"])
|
58
60
|
end
|
59
61
|
else
|
60
62
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
63
|
+
s.add_dependency(%q<httparty>, [">= 0.6.1"])
|
61
64
|
end
|
62
65
|
end
|
63
66
|
|
data/lib/api/boot.rb
CHANGED
data/lib/api/failover.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
module Hetzner
|
2
2
|
class API
|
3
3
|
module Failover
|
4
|
+
# queries the failover status of one IP address or all failover IP addresses of the account
|
4
5
|
def failover?(ip = nil)
|
5
6
|
path = "/failover"
|
6
7
|
path << "/#{ip}" if @ip
|
7
8
|
perform_get path
|
8
9
|
end
|
9
10
|
|
11
|
+
# redirects the failover_ip to another server ip
|
10
12
|
def failover!(failover_ip, active_server_ip)
|
11
13
|
path = "/rdns/#{failover_ip}"
|
12
14
|
perform_post path, :query => { :active_server_ip => active_server_ip }
|
data/lib/api/rdns.rb
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
module Hetzner
|
2
2
|
class API
|
3
3
|
module Rdns
|
4
|
+
# queries the reverse mapping status of one IP address
|
4
5
|
def rdns?(ip)
|
5
6
|
path = "/rdns/#{ip}"
|
6
7
|
perform_get path
|
7
8
|
end
|
8
9
|
|
10
|
+
# creates or updates a reverse mapping record.
|
11
|
+
# ptr contains a hostname
|
9
12
|
def rdns!(ip, ptr)
|
10
13
|
path = "/rdns/#{ip}"
|
11
14
|
perform_post path, :query => { :ptr => ptr }
|
12
15
|
end
|
13
16
|
|
17
|
+
# creates a reverse mapping record. fails if already one exists
|
18
|
+
# ptr contains a hostname
|
14
19
|
def initialize_rdns!(ip, ptr)
|
15
20
|
path = "/rdns/#{ip}"
|
16
21
|
perform_put path, :query => { :ptr => ptr }
|
17
22
|
end
|
18
23
|
|
24
|
+
# delete the reverse mapping of one IP address
|
19
25
|
def delete_rdns!(ip)
|
20
26
|
path = "/rdns/#{ip}"
|
21
27
|
perform_delete path
|
data/lib/api/rescue.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
module Hetzner
|
2
2
|
class API
|
3
3
|
module Rescue
|
4
|
+
# enables the rescue systm for given IP address/server using <em>os</em> (operating system) and <em>arch</em> (architecture)
|
5
|
+
#
|
6
|
+
# see <em>boot?</em> method to query the API for available options
|
7
|
+
#
|
8
|
+
# defaults to 64bit Linux
|
4
9
|
def enable_rescue!(ip, os = 'linux', arch = '64')
|
5
10
|
perform_post "/boot/#{ip}/rescue", :query => { :os => os, :arch => arch }
|
6
11
|
end
|
7
12
|
|
13
|
+
# disables the rescue system for a given IP address/server
|
8
14
|
def disable_rescue!(ip)
|
9
15
|
perform_delete "/boot/#{ip}/rescue"
|
10
16
|
end
|
data/lib/api/reset.rb
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
module Hetzner
|
2
2
|
class API
|
3
3
|
module Reset
|
4
|
+
# returns the reset status of a given IP address or all servers of the account
|
4
5
|
def reset?(ip = nil)
|
5
6
|
path = "/reset"
|
6
7
|
path << "/#{ip}" if ip
|
7
8
|
perform_get path
|
8
9
|
end
|
9
10
|
|
11
|
+
# resets a server by its IP address.
|
12
|
+
#
|
13
|
+
# <em>type</em> is one of:
|
14
|
+
# * <b>sw</b> (software reset)
|
15
|
+
# * <b>hw</b> (hardware reset)
|
16
|
+
# * <b>man</b> (manual reset)
|
10
17
|
def reset!(ip, type)
|
11
18
|
perform_post "/reset/#{ip}", :query => { :type => type }
|
12
19
|
end
|
data/lib/api/vnc.rb
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
module Hetzner
|
2
2
|
class API
|
3
3
|
module VNC
|
4
|
+
# queries the vnc boot status of one IP address/server
|
4
5
|
def boot_vnc?(ip)
|
5
6
|
path = "/boot/#{ip}/vnc"
|
6
7
|
perform_get path
|
7
8
|
end
|
8
|
-
|
9
|
+
|
10
|
+
# enables vnc boot option for one IP address/server
|
11
|
+
#
|
12
|
+
# see <em>Boot</em> to query the API for available options
|
9
13
|
def boot_vnc!(ip, dist, arch, lang)
|
10
14
|
path = "/boot/#{ip}/vnc"
|
11
15
|
perform_post path, :query => { :dist => dist, :arch => arch, :lang => lang }
|
12
16
|
end
|
13
|
-
|
17
|
+
|
18
|
+
# disables the vnc boot status of one IP address/server
|
14
19
|
def disable_boot_vnc!(ip)
|
15
20
|
path = "/boot/#{ip}/vnc"
|
16
21
|
perform_delete path
|
data/lib/api/wol.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
module Hetzner
|
2
2
|
class API
|
3
3
|
module WOL
|
4
|
+
# queries the WOL of one IP address/server
|
4
5
|
def wol?(ip)
|
5
6
|
path = "/wol/#{ip}"
|
6
7
|
perform_get path
|
7
8
|
end
|
9
|
+
|
10
|
+
# triggers a WOL packet for given IP address/server
|
8
11
|
def wol!(ip)
|
9
12
|
path = "/wol/#{ip}"
|
10
13
|
perform_post path
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Roland Moriz
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-03 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -31,6 +31,20 @@ dependencies:
|
|
31
31
|
version: 1.2.9
|
32
32
|
type: :development
|
33
33
|
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: httparty
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 6
|
44
|
+
- 1
|
45
|
+
version: 0.6.1
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
34
48
|
description: A small, unofficial wrapper for Hetzner.de's API (server management)
|
35
49
|
email: roland@rails.io
|
36
50
|
executables: []
|