rhc-rest 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYRIGHT +1 -0
- data/Gemfile +4 -0
- data/LICENSE +11 -0
- data/Rakefile +1 -0
- data/bin/sample-usage.rb +124 -0
- data/doc/Gemfile.html +119 -0
- data/doc/Rakefile.html +117 -0
- data/doc/Rhc/Rest/Application.html +571 -0
- data/doc/Rhc/Rest/BaseException.html +226 -0
- data/doc/Rhc/Rest/Cartridge.html +475 -0
- data/doc/Rhc/Rest/Client.html +609 -0
- data/doc/Rhc/Rest/ClientErrorException.html +167 -0
- data/doc/Rhc/Rest/Domain.html +457 -0
- data/doc/Rhc/Rest/Key.html +378 -0
- data/doc/Rhc/Rest/RequestDeniedException.html +166 -0
- data/doc/Rhc/Rest/ResourceAccessException.html +161 -0
- data/doc/Rhc/Rest/ResourceNotFoundException.html +166 -0
- data/doc/Rhc/Rest/ServerErrorException.html +161 -0
- data/doc/Rhc/Rest/ServiceUnavailableException.html +167 -0
- data/doc/Rhc/Rest/UnAuthorizedException.html +167 -0
- data/doc/Rhc/Rest/User.html +354 -0
- data/doc/Rhc/Rest/ValidationException.html +255 -0
- data/doc/Rhc/Rest.html +410 -0
- data/doc/Rhc.html +329 -0
- data/doc/created.rid +13 -0
- data/doc/doc/created.rid +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +112 -0
- data/doc/js/darkfish.js +153 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +94 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/rdoc.css +543 -0
- data/doc/table_of_contents.html +198 -0
- data/lib/rhc-rest/application.rb +81 -0
- data/lib/rhc-rest/cartridge.rb +64 -0
- data/lib/rhc-rest/client.rb +122 -0
- data/lib/rhc-rest/domain.rb +56 -0
- data/lib/rhc-rest/exceptions/exceptions.rb +73 -0
- data/lib/rhc-rest/key.rb +34 -0
- data/lib/rhc-rest/user.rb +41 -0
- data/lib/rhc-rest/version.rb +5 -0
- data/lib/rhc-rest.rb +155 -0
- data/rhc-rest.gemspec +26 -0
- data/rhc-rest.spec +79 -0
- metadata +162 -0
data/COPYRIGHT
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Copyright 2012 Red Hat, Inc. and/or its affiliates.
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
+
you may not use this file except in compliance with the License.
|
3
|
+
You may obtain a copy of the License at
|
4
|
+
|
5
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
|
7
|
+
Unless required by applicable law or agreed to in writing, software
|
8
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
See the License for the specific language governing permissions and
|
11
|
+
limitations under the License.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/sample-usage.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Copyright 2011 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person
|
5
|
+
# obtaining a copy of this software and associated documentation files
|
6
|
+
# (the "Software"), to deal in the Software without restriction,
|
7
|
+
# including without limitation the rights to use, copy, modify, merge,
|
8
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
9
|
+
# and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
19
|
+
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
20
|
+
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
21
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require '../lib/rhc-rest'
|
25
|
+
|
26
|
+
|
27
|
+
if __FILE__ == $0
|
28
|
+
|
29
|
+
end_point = ARGV[0]
|
30
|
+
username = ARGV[1]
|
31
|
+
password = ARGV[2]
|
32
|
+
namespace = ARGV[3]
|
33
|
+
|
34
|
+
if end_point.nil? or username.nil? or password.nil? or namespace.nil?
|
35
|
+
puts "Usage: https://<hostname>/broker/rest <username> <password> <namespace>"
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
|
39
|
+
client = Rhc::Rest::Client.new(end_point, username, password)
|
40
|
+
|
41
|
+
puts "Creating a domain"
|
42
|
+
domain = client.add_domain(namespace)
|
43
|
+
puts "Domain created: #{domain.namespace}"
|
44
|
+
|
45
|
+
puts "Getting all cartridges..."
|
46
|
+
client.cartridges.each do |cart|
|
47
|
+
puts " #{cart.name} (type: #{cart.type})"
|
48
|
+
end
|
49
|
+
|
50
|
+
puts "Creating application appone"
|
51
|
+
carts = client.find_cartridge("php-5.3")
|
52
|
+
domain.add_application("appone", carts.first.name)
|
53
|
+
|
54
|
+
puts "Try deleting domain with an application"
|
55
|
+
begin
|
56
|
+
domain.delete
|
57
|
+
rescue Exception => e
|
58
|
+
puts e.message
|
59
|
+
end
|
60
|
+
|
61
|
+
puts "Getting all domains and applications..."
|
62
|
+
client.domains.each do |domain|
|
63
|
+
puts " Domain: #{domain.namespace}"
|
64
|
+
domain.applications.each do |app|
|
65
|
+
puts " Application: #{app.name}"
|
66
|
+
app.cartridges.each do |cart|
|
67
|
+
puts " Cartridge #{cart.name} (#{cart.type})"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
puts "Find application=appone and restart it..."
|
73
|
+
apps = client.find_application("appone")
|
74
|
+
apps.first.restart
|
75
|
+
|
76
|
+
apps = client.find_application("appthree")
|
77
|
+
if not apps.nil? and not apps.first.nil?
|
78
|
+
apps.first.delete
|
79
|
+
end
|
80
|
+
|
81
|
+
puts "Create new application named appthree..."
|
82
|
+
app = client.domains.first.add_application("appthree", "php-5.3")
|
83
|
+
puts "Adding MySQL cartridge to appthree"
|
84
|
+
cartridge = app.add_cartridge("mysql-5.1")
|
85
|
+
puts "Check to see if it was added"
|
86
|
+
app.cartridges.each do |cart|
|
87
|
+
puts "Cartridge #{cart.name} (#{cart.type})"
|
88
|
+
end
|
89
|
+
|
90
|
+
puts "Restart MySQL cartridge"
|
91
|
+
cartridge.restart
|
92
|
+
puts "Deleting MySQL cartridge"
|
93
|
+
cartridge.delete
|
94
|
+
puts "Check to see if it was deleted"
|
95
|
+
if app.cartridges.size == 0
|
96
|
+
puts "MySQL cartridge is deleted"
|
97
|
+
end
|
98
|
+
puts "Deleting appthree"
|
99
|
+
app.delete
|
100
|
+
end
|
101
|
+
|
102
|
+
puts "Adding, updating and deleting keys"
|
103
|
+
key = client.user.add_key("newkey", "NEWKEYCONTENT", "ssh-rsa")
|
104
|
+
|
105
|
+
puts "Added key: #{key.name} updating key content"
|
106
|
+
key.update(key.type, "NEWKEYCONTENT123")
|
107
|
+
|
108
|
+
puts "Getting all keys..."
|
109
|
+
client.user.keys.each do |key|
|
110
|
+
puts " Key: #{key.name} (type: #{key.type}) #{key.content}"
|
111
|
+
end
|
112
|
+
|
113
|
+
puts "Deleting key"
|
114
|
+
begin
|
115
|
+
key.delete
|
116
|
+
rescue Exception => e
|
117
|
+
puts e.message
|
118
|
+
end
|
119
|
+
|
120
|
+
puts 'Clean up domains and apps by force deleting domain'
|
121
|
+
client.domains.each do |domain|
|
122
|
+
domain.delete(true)
|
123
|
+
end
|
124
|
+
|
data/doc/Gemfile.html
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Gemfile - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="project-metadata">
|
47
|
+
<nav id="fileindex-section" class="section project-section">
|
48
|
+
<h3 class="section-header">Pages</h3>
|
49
|
+
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a>
|
53
|
+
|
54
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a>
|
55
|
+
|
56
|
+
</ul>
|
57
|
+
</nav>
|
58
|
+
|
59
|
+
<nav id="classindex-section" class="section project-section">
|
60
|
+
<h3 class="section-header">Class and Module Index</h3>
|
61
|
+
|
62
|
+
<ul class="link-list">
|
63
|
+
|
64
|
+
<li><a href="./Rhc.html">Rhc</a>
|
65
|
+
|
66
|
+
<li><a href="./Rhc/Rest.html">Rhc::Rest</a>
|
67
|
+
|
68
|
+
<li><a href="./Rhc/Rest/Application.html">Rhc::Rest::Application</a>
|
69
|
+
|
70
|
+
<li><a href="./Rhc/Rest/BaseException.html">Rhc::Rest::BaseException</a>
|
71
|
+
|
72
|
+
<li><a href="./Rhc/Rest/Cartridge.html">Rhc::Rest::Cartridge</a>
|
73
|
+
|
74
|
+
<li><a href="./Rhc/Rest/Client.html">Rhc::Rest::Client</a>
|
75
|
+
|
76
|
+
<li><a href="./Rhc/Rest/ClientErrorException.html">Rhc::Rest::ClientErrorException</a>
|
77
|
+
|
78
|
+
<li><a href="./Rhc/Rest/Domain.html">Rhc::Rest::Domain</a>
|
79
|
+
|
80
|
+
<li><a href="./Rhc/Rest/Key.html">Rhc::Rest::Key</a>
|
81
|
+
|
82
|
+
<li><a href="./Rhc/Rest/RequestDeniedException.html">Rhc::Rest::RequestDeniedException</a>
|
83
|
+
|
84
|
+
<li><a href="./Rhc/Rest/ResourceAccessException.html">Rhc::Rest::ResourceAccessException</a>
|
85
|
+
|
86
|
+
<li><a href="./Rhc/Rest/ResourceNotFoundException.html">Rhc::Rest::ResourceNotFoundException</a>
|
87
|
+
|
88
|
+
<li><a href="./Rhc/Rest/ServerErrorException.html">Rhc::Rest::ServerErrorException</a>
|
89
|
+
|
90
|
+
<li><a href="./Rhc/Rest/ServiceUnavailableException.html">Rhc::Rest::ServiceUnavailableException</a>
|
91
|
+
|
92
|
+
<li><a href="./Rhc/Rest/UnAuthorizedException.html">Rhc::Rest::UnAuthorizedException</a>
|
93
|
+
|
94
|
+
<li><a href="./Rhc/Rest/User.html">Rhc::Rest::User</a>
|
95
|
+
|
96
|
+
<li><a href="./Rhc/Rest/ValidationException.html">Rhc::Rest::ValidationException</a>
|
97
|
+
|
98
|
+
</ul>
|
99
|
+
</nav>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
</nav>
|
103
|
+
|
104
|
+
<div id="documentation" class="description">
|
105
|
+
|
106
|
+
<p>source “<a href="http://rubygems.org">rubygems.org</a>”</p>
|
107
|
+
|
108
|
+
<p># Specify your gem’s dependencies in rhc-rest.gemspec gemspec</p>
|
109
|
+
|
110
|
+
</div>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<footer id="validator-badges">
|
115
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
116
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
117
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
118
|
+
</footer>
|
119
|
+
|
data/doc/Rakefile.html
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Rakefile - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="project-metadata">
|
47
|
+
<nav id="fileindex-section" class="section project-section">
|
48
|
+
<h3 class="section-header">Pages</h3>
|
49
|
+
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a>
|
53
|
+
|
54
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a>
|
55
|
+
|
56
|
+
</ul>
|
57
|
+
</nav>
|
58
|
+
|
59
|
+
<nav id="classindex-section" class="section project-section">
|
60
|
+
<h3 class="section-header">Class and Module Index</h3>
|
61
|
+
|
62
|
+
<ul class="link-list">
|
63
|
+
|
64
|
+
<li><a href="./Rhc.html">Rhc</a>
|
65
|
+
|
66
|
+
<li><a href="./Rhc/Rest.html">Rhc::Rest</a>
|
67
|
+
|
68
|
+
<li><a href="./Rhc/Rest/Application.html">Rhc::Rest::Application</a>
|
69
|
+
|
70
|
+
<li><a href="./Rhc/Rest/BaseException.html">Rhc::Rest::BaseException</a>
|
71
|
+
|
72
|
+
<li><a href="./Rhc/Rest/Cartridge.html">Rhc::Rest::Cartridge</a>
|
73
|
+
|
74
|
+
<li><a href="./Rhc/Rest/Client.html">Rhc::Rest::Client</a>
|
75
|
+
|
76
|
+
<li><a href="./Rhc/Rest/ClientErrorException.html">Rhc::Rest::ClientErrorException</a>
|
77
|
+
|
78
|
+
<li><a href="./Rhc/Rest/Domain.html">Rhc::Rest::Domain</a>
|
79
|
+
|
80
|
+
<li><a href="./Rhc/Rest/Key.html">Rhc::Rest::Key</a>
|
81
|
+
|
82
|
+
<li><a href="./Rhc/Rest/RequestDeniedException.html">Rhc::Rest::RequestDeniedException</a>
|
83
|
+
|
84
|
+
<li><a href="./Rhc/Rest/ResourceAccessException.html">Rhc::Rest::ResourceAccessException</a>
|
85
|
+
|
86
|
+
<li><a href="./Rhc/Rest/ResourceNotFoundException.html">Rhc::Rest::ResourceNotFoundException</a>
|
87
|
+
|
88
|
+
<li><a href="./Rhc/Rest/ServerErrorException.html">Rhc::Rest::ServerErrorException</a>
|
89
|
+
|
90
|
+
<li><a href="./Rhc/Rest/ServiceUnavailableException.html">Rhc::Rest::ServiceUnavailableException</a>
|
91
|
+
|
92
|
+
<li><a href="./Rhc/Rest/UnAuthorizedException.html">Rhc::Rest::UnAuthorizedException</a>
|
93
|
+
|
94
|
+
<li><a href="./Rhc/Rest/User.html">Rhc::Rest::User</a>
|
95
|
+
|
96
|
+
<li><a href="./Rhc/Rest/ValidationException.html">Rhc::Rest::ValidationException</a>
|
97
|
+
|
98
|
+
</ul>
|
99
|
+
</nav>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
</nav>
|
103
|
+
|
104
|
+
<div id="documentation" class="description">
|
105
|
+
|
106
|
+
<p>require “bundler/gem_tasks”</p>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<footer id="validator-badges">
|
113
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
114
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
115
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
116
|
+
</footer>
|
117
|
+
|