tutum 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/tutum.rb +32 -0
- data/lib/tutum_api.rb +28 -0
- data/lib/tutum_clusters.rb +66 -0
- data/lib/tutum_containers.rb +65 -0
- data/lib/tutum_images.rb +43 -0
- metadata +50 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 75966173483c153b837c3002bf26d7b7fe4c3e37
|
4
|
+
data.tar.gz: 31679aa19491f217c370659fdb1dfb3c739f43a6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28d5f65569eddf3ce151eca6ea8713e7dc21cb244ac17fd7e62470c1f7f7ed73913c2c216cc4f7a65b57991f1c69018f829a887de9d5a6056cf18ce256d76945
|
7
|
+
data.tar.gz: 853524302151028c24acef49bd163e39fa4364944175efb3d42bb6b3a5c7bcfd37efe2c0eac1baf9df4bf6f48f5df899e5e5959a95a9e07034eb70c0915eb3e0
|
data/lib/tutum.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative './tutum_api'
|
2
|
+
require_relative './tutum_clusters'
|
3
|
+
require_relative './tutum_containers'
|
4
|
+
require_relative './tutum_images'
|
5
|
+
|
6
|
+
class Tutum
|
7
|
+
attr_reader :username, :api_key
|
8
|
+
def initialize(username, api_key)
|
9
|
+
@username = username
|
10
|
+
@api_key = api_key
|
11
|
+
end
|
12
|
+
|
13
|
+
def headers
|
14
|
+
{
|
15
|
+
"Authorization" => "ApiKey #{@username}:#{@api_key}",
|
16
|
+
"Accept" => "application/json",
|
17
|
+
"Content-Type" => "application/json"
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def containers
|
22
|
+
@containers ||= TutumContainers.new(headers)
|
23
|
+
end
|
24
|
+
|
25
|
+
def images
|
26
|
+
@images ||= TutumImages.new(headers)
|
27
|
+
end
|
28
|
+
|
29
|
+
def clusters
|
30
|
+
@clusters ||= TutumClusters.new(headers)
|
31
|
+
end
|
32
|
+
end
|
data/lib/tutum_api.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
class TutumApi
|
3
|
+
attr_reader :headers
|
4
|
+
BASE_API_PATH = "https://app.tutum.co/api"
|
5
|
+
API_VERSION = "v1"
|
6
|
+
def initialize(headers)
|
7
|
+
@headers = headers
|
8
|
+
end
|
9
|
+
def http_headers
|
10
|
+
{ headers: headers }
|
11
|
+
end
|
12
|
+
def api_path(path)
|
13
|
+
BASE_API_PATH+"/"+API_VERSION + path
|
14
|
+
end
|
15
|
+
|
16
|
+
def http_get(path, args={})
|
17
|
+
HTTParty.get(api_path(path), http_headers.merge({ :query => args }))
|
18
|
+
end
|
19
|
+
def http_post(path, args={})
|
20
|
+
HTTParty.post(api_path(path), http_headers.merge({ :body => args.to_json }))
|
21
|
+
end
|
22
|
+
def http_patch(path, args={})
|
23
|
+
HTTParty.patch(api_path(path), http_headers.merge({ :body => args.to_json }))
|
24
|
+
end
|
25
|
+
def http_delete(path, args={})
|
26
|
+
HTTParty.delete(api_path(path), http_headers.merge({ :query => args }))
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
class TutumClusters < TutumApi
|
2
|
+
def list_url
|
3
|
+
"/application/"
|
4
|
+
end
|
5
|
+
|
6
|
+
def list(params)
|
7
|
+
http_get(list_url, params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_url
|
11
|
+
"/application/"
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(params)
|
15
|
+
http_post(create_url, params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_url(uuid)
|
19
|
+
"/application/#{uuid}/"
|
20
|
+
end
|
21
|
+
|
22
|
+
def get(uuid)
|
23
|
+
http_get(get_url(uuid))
|
24
|
+
end
|
25
|
+
|
26
|
+
def start_url(uuid)
|
27
|
+
"/application/#{uuid}/start/"
|
28
|
+
end
|
29
|
+
|
30
|
+
def start(uuid)
|
31
|
+
http_post(start_url(uuid))
|
32
|
+
end
|
33
|
+
|
34
|
+
def stop_url(uuid)
|
35
|
+
"/application/#{uuid}/stop/"
|
36
|
+
end
|
37
|
+
|
38
|
+
def stop(uuid)
|
39
|
+
http_post(stop_url(uuid))
|
40
|
+
end
|
41
|
+
|
42
|
+
def update_url(uuid)
|
43
|
+
"/application/#{uuid}/"
|
44
|
+
end
|
45
|
+
|
46
|
+
def update(uuid, params)
|
47
|
+
http_patch(update_url(uuid), params)
|
48
|
+
end
|
49
|
+
|
50
|
+
def redeploy_url(uuid)
|
51
|
+
"/application/#{uuid}/redeploy/"
|
52
|
+
end
|
53
|
+
|
54
|
+
def redeploy(uuid, params)
|
55
|
+
http_post(redeploy_url(uuid), params)
|
56
|
+
end
|
57
|
+
|
58
|
+
def delete_url(uuid)
|
59
|
+
"/application/#{uuid}/"
|
60
|
+
end
|
61
|
+
|
62
|
+
def delete(uuid)
|
63
|
+
http_delete(delete_url(uuid))
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class TutumContainers < TutumApi
|
2
|
+
def list_url
|
3
|
+
"/container/"
|
4
|
+
end
|
5
|
+
|
6
|
+
def list(params)
|
7
|
+
http_get(list_url, params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_url
|
11
|
+
"/container/"
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(params)
|
15
|
+
http_post(create_url, params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_url(uuid)
|
19
|
+
"/container/#{uuid}/"
|
20
|
+
end
|
21
|
+
|
22
|
+
def get(uuid)
|
23
|
+
http_get(get_url(uuid))
|
24
|
+
end
|
25
|
+
|
26
|
+
def start_url(uuid)
|
27
|
+
"/container/#{uuid}/start/"
|
28
|
+
end
|
29
|
+
|
30
|
+
def start(uuid)
|
31
|
+
http_post(start_url(uuid))
|
32
|
+
end
|
33
|
+
|
34
|
+
def stop_url(uuid)
|
35
|
+
"/container/#{uuid}/stop/"
|
36
|
+
end
|
37
|
+
|
38
|
+
def stop(uuid)
|
39
|
+
http_post(stop_url(uuid))
|
40
|
+
end
|
41
|
+
|
42
|
+
def logs_url(uuid)
|
43
|
+
"/container/#{uuid}/logs/"
|
44
|
+
end
|
45
|
+
|
46
|
+
def logs(uuid)
|
47
|
+
http_get(logs_url(uuid))
|
48
|
+
end
|
49
|
+
|
50
|
+
def redeploy_url(uuid)
|
51
|
+
"/container/#{uuid}/redeploy/"
|
52
|
+
end
|
53
|
+
|
54
|
+
def redeploy(uuid, params)
|
55
|
+
http_post(redeploy_url(uuid), params)
|
56
|
+
end
|
57
|
+
|
58
|
+
def delete_url(uuid)
|
59
|
+
"/container/#{uuid}/"
|
60
|
+
end
|
61
|
+
|
62
|
+
def delete(uuid)
|
63
|
+
http_delete(delete_url(uuid))
|
64
|
+
end
|
65
|
+
end
|
data/lib/tutum_images.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
class TutumImages < TutumApi
|
2
|
+
def list_url
|
3
|
+
"/image/"
|
4
|
+
end
|
5
|
+
|
6
|
+
def list(params)
|
7
|
+
http_get(list_url, params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def add_url
|
11
|
+
"/image/"
|
12
|
+
end
|
13
|
+
|
14
|
+
def add(name, params)
|
15
|
+
http_post(add_url, params.merge({:name => name}))
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_url(name)
|
19
|
+
"/image/#{name}/"
|
20
|
+
end
|
21
|
+
|
22
|
+
def get(name)
|
23
|
+
http_get(get_url(name))
|
24
|
+
end
|
25
|
+
|
26
|
+
def update_url(name)
|
27
|
+
"/image/#{name}/"
|
28
|
+
end
|
29
|
+
|
30
|
+
def update(name, params)
|
31
|
+
http_patch(update_url(name), params)
|
32
|
+
end
|
33
|
+
|
34
|
+
def delete_url(name)
|
35
|
+
"/image/#{name}/"
|
36
|
+
end
|
37
|
+
|
38
|
+
def delete(name)
|
39
|
+
http_delete(delete_url(name))
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tutum
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martyn Garcia
|
8
|
+
- Mikkel Garcia
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Provides HTTP functionality wrapped in a nice ruby interface.
|
15
|
+
email: martyn@255bits.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/tutum.rb
|
21
|
+
- lib/tutum_api.rb
|
22
|
+
- lib/tutum_clusters.rb
|
23
|
+
- lib/tutum_containers.rb
|
24
|
+
- lib/tutum_images.rb
|
25
|
+
homepage: https://github.com/255BITS/ruby-tutum
|
26
|
+
licenses:
|
27
|
+
- MIT
|
28
|
+
metadata: {}
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 2.0.3
|
46
|
+
signing_key:
|
47
|
+
specification_version: 4
|
48
|
+
summary: Ruby interface for the tutum PaaS API.
|
49
|
+
test_files: []
|
50
|
+
has_rdoc:
|