tutum 0.2.6 → 0.2.7
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/lib/tutum.rb +25 -5
- data/lib/tutum_stacks.rb +73 -0
- data/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 443bc124a5992a7183a1fa3477da95b85e01af6f
|
4
|
+
data.tar.gz: d5c8429c96c1bef0777b113cd9bc8f8296e71c03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53a31cbf355bfcec71e86014741490333c6e804d01e1c3714c9a87c1b279c2c505af4e44c4c4820a9af21f230d9d96150e42d299f0016b6a114334e310f5ba65
|
7
|
+
data.tar.gz: aa259d2a9800a6beefb9280518b4e2bcabc8c0fb7a6de580f1f6c829456b594fb3e2b9000357ffc0e19823844aa3b923307e661c4ab2b6149532861649e9a28c
|
data/lib/tutum.rb
CHANGED
@@ -8,18 +8,21 @@ require_relative './tutum_nodes'
|
|
8
8
|
require_relative './tutum_providers'
|
9
9
|
require_relative './tutum_regions'
|
10
10
|
require_relative './tutum_services'
|
11
|
+
require_relative './tutum_stacks'
|
11
12
|
|
12
13
|
class Tutum
|
13
|
-
attr_reader :username, :api_key
|
14
|
+
attr_reader :username, :api_key, :tutum_auth
|
14
15
|
|
15
|
-
def initialize(
|
16
|
-
@
|
17
|
-
@
|
16
|
+
def initialize(*options)
|
17
|
+
@options = extract_options! options
|
18
|
+
@username = @options[:username]
|
19
|
+
@api_key = @options[:api_key]
|
20
|
+
@tutum_auth = @options[:tutum_auth]
|
18
21
|
end
|
19
22
|
|
20
23
|
def headers
|
21
24
|
{
|
22
|
-
'Authorization' => "ApiKey #{@username}:#{@api_key}",
|
25
|
+
'Authorization' => @tutum_auth ? @tutum_auth : "ApiKey #{@username}:#{@api_key}",
|
23
26
|
'Accept' => 'application/json',
|
24
27
|
'Content-Type' => 'application/json'
|
25
28
|
}
|
@@ -60,4 +63,21 @@ class Tutum
|
|
60
63
|
def services
|
61
64
|
@services ||= TutumServices.new(headers)
|
62
65
|
end
|
66
|
+
|
67
|
+
def stacks
|
68
|
+
@stacks ||= TutumStacks.new(headers)
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def extract_options!(args)
|
74
|
+
options = {}
|
75
|
+
if args[0].class == String
|
76
|
+
options[:username] = args[0]
|
77
|
+
options[:api_key] = args[1]
|
78
|
+
else
|
79
|
+
options = args[0]
|
80
|
+
end
|
81
|
+
options
|
82
|
+
end
|
63
83
|
end
|
data/lib/tutum_stacks.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
class TutumStacks < TutumApi
|
2
|
+
def list_url
|
3
|
+
"/stack/"
|
4
|
+
end
|
5
|
+
|
6
|
+
def list(params={})
|
7
|
+
http_get(list_url, params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_url(uuid)
|
11
|
+
"/stack/#{uuid}/"
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(uuid)
|
15
|
+
http_get(get_url(uuid))
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_url
|
19
|
+
"/stack/"
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(params)
|
23
|
+
http_post(create_url, params)
|
24
|
+
end
|
25
|
+
|
26
|
+
def export_url(uuid)
|
27
|
+
"/stack/#{uuid}/export/"
|
28
|
+
end
|
29
|
+
|
30
|
+
def export(uuid)
|
31
|
+
http_get(export_url(uuid))
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_url(uuid)
|
35
|
+
"/stack/#{uuid}/"
|
36
|
+
end
|
37
|
+
|
38
|
+
def update(uuid, params)
|
39
|
+
http_patch(update_url(uuid), params)
|
40
|
+
end
|
41
|
+
|
42
|
+
def stop_url(uuid)
|
43
|
+
"/stack/#{uuid}/stop/"
|
44
|
+
end
|
45
|
+
|
46
|
+
def stop(uuid)
|
47
|
+
http_post(stop_url(uuid))
|
48
|
+
end
|
49
|
+
|
50
|
+
def start_url(uuid)
|
51
|
+
"/stack/#{uuid}/start/"
|
52
|
+
end
|
53
|
+
|
54
|
+
def start(uuid)
|
55
|
+
http_post(start_url(uuid))
|
56
|
+
end
|
57
|
+
|
58
|
+
def redeploy_url(uuid)
|
59
|
+
"/stack/#{uuid}/redeploy/"
|
60
|
+
end
|
61
|
+
|
62
|
+
def redeploy(uuid)
|
63
|
+
http_post(redeploy_url(uuid))
|
64
|
+
end
|
65
|
+
|
66
|
+
def terminate_url(uuid)
|
67
|
+
"/stack/#{uuid}/"
|
68
|
+
end
|
69
|
+
|
70
|
+
def terminate(uuid)
|
71
|
+
http_delete(terminate_url(uuid))
|
72
|
+
end
|
73
|
+
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tutum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josie Wright
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2015-05-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- lib/tutum_providers.rb
|
132
132
|
- lib/tutum_regions.rb
|
133
133
|
- lib/tutum_services.rb
|
134
|
+
- lib/tutum_stacks.rb
|
134
135
|
- lib/version.rb
|
135
136
|
homepage: https://github.com/tutumcloud/ruby-tutum
|
136
137
|
licenses:
|