rest_connection 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/rest_connection.rb +1 -1
- data/lib/rest_connection/rightscale/rightscale_api_gateway.rb +4 -2
- data/rest_connection.gemspec +4 -4
- metadata +9 -37
- data/git_hooks/post-commit +0 -43
- data/lib/rest_connection/rightscale/alert_spec_subject.rb +0 -21
- data/lib/rest_connection/rightscale/backup.rb +0 -70
- data/lib/rest_connection/rightscale/cloud_account.rb +0 -39
- data/lib/rest_connection/rightscale/ec2_server_array_internal.rb +0 -43
- data/lib/rest_connection/rightscale/mc_audit_entry.rb +0 -101
- data/lib/rest_connection/rightscale/mc_server_template_multi_cloud_image.rb +0 -50
- data/lib/rest_connection/rightscale/right_script_attachment_internal.rb +0 -92
- data/lib/rest_connection/rightscale/security_group_rule.rb +0 -31
- data/lib/rest_connection/rightscale/server_ec2_ebs_volume.rb +0 -40
- data/lib/rest_connection/rightscale/session.rb +0 -61
- data/lib/rest_connection/rightscale/sqs_queue.rb +0 -22
- data/lib/rest_connection/rightscale/vpc_dhcp_option.rb +0 -19
data/README.rdoc
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"gem install rest_connection"
|
5
5
|
|
6
6
|
==== Installing from source
|
7
|
-
"git clone http://github.com/
|
7
|
+
"git clone http://github.com/rightscale/rest_connection.git"
|
8
8
|
"gem install jeweler rspec"
|
9
9
|
"rake check_dependencies" <- Install any gems listed.
|
10
10
|
"rake install"
|
data/lib/rest_connection.rb
CHANGED
@@ -205,7 +205,7 @@ module RestConnection
|
|
205
205
|
def handle_response(res)
|
206
206
|
if res.code.to_i == 201 or res.code.to_i == 202
|
207
207
|
return res['Location']
|
208
|
-
elsif [200,203,204
|
208
|
+
elsif [200,203,204].detect { |d| d == res.code.to_i }
|
209
209
|
if res.body
|
210
210
|
begin
|
211
211
|
return JSON.load(res.body)
|
@@ -54,6 +54,7 @@ module RightScale
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def nickname
|
57
|
+
raise TypeError.new("@params isn't a Hash! @params.to_s=#{@params.to_s}") unless @params.is_a?(Hash)
|
57
58
|
@params["nickname"] || @params["name"]
|
58
59
|
end
|
59
60
|
|
@@ -94,7 +95,7 @@ module RightScale
|
|
94
95
|
end
|
95
96
|
|
96
97
|
def method_missing(method_name, *args)
|
97
|
-
puts "DEBUG: method_missing in #{self.class.to_s}: #{method_name}" if ENV['REST_CONNECT_DEBUG']
|
98
|
+
puts "DEBUG: method_missing in #{self.class.to_s}: #{method_name.to_s}" if ENV['REST_CONNECT_DEBUG']
|
98
99
|
mn = method_name.to_s
|
99
100
|
assignment = mn.gsub!(/=/,"")
|
100
101
|
mn_dash = mn.gsub(/_/,"-")
|
@@ -118,7 +119,8 @@ module RightScale
|
|
118
119
|
return self[mn]
|
119
120
|
else
|
120
121
|
return nil
|
121
|
-
|
122
|
+
warn "!!!! WARNING - called unknown method #{method_name.to_s}# with #{args.inspect}"
|
123
|
+
#raise "called unknown method #{method_name.to_s}# with #{args.inspect}"
|
122
124
|
end
|
123
125
|
end
|
124
126
|
|
data/rest_connection.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rest_connection"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeremy Deininger", "Timothy Rodriguez"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-02-27"
|
13
13
|
s.description = "provides rest_connection"
|
14
|
-
s.email = ["
|
14
|
+
s.email = ["daniel.onorato@rightscale.com"]
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
@@ -110,7 +110,7 @@ Gem::Specification.new do |s|
|
|
110
110
|
"spec/spec_helper.rb",
|
111
111
|
"spec/tag_spec.rb"
|
112
112
|
]
|
113
|
-
s.homepage = "http://github.com/
|
113
|
+
s.homepage = "http://github.com/rigthscale/rest_connection"
|
114
114
|
s.require_paths = ["lib"]
|
115
115
|
s.rubygems_version = "1.7.2"
|
116
116
|
s.summary = "lib for restful connections to the rightscale api"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest_connection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeremy Deininger
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-02-
|
19
|
+
date: 2012-02-27 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: activesupport
|
@@ -78,24 +78,9 @@ dependencies:
|
|
78
78
|
version: "0"
|
79
79
|
type: :runtime
|
80
80
|
version_requirements: *id004
|
81
|
-
|
82
|
-
name: rest-client
|
83
|
-
prerelease: false
|
84
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
hash: 3
|
90
|
-
segments:
|
91
|
-
- 0
|
92
|
-
version: "0"
|
93
|
-
type: :runtime
|
94
|
-
version_requirements: *id005
|
95
|
-
description: "A Modular RESTful API library. Current implemented modules: RightScale API"
|
81
|
+
description: provides rest_connection
|
96
82
|
email:
|
97
|
-
-
|
98
|
-
- tw.rodriguez@gmail.com
|
83
|
+
- daniel.onorato@rightscale.com
|
99
84
|
executables: []
|
100
85
|
|
101
86
|
extensions: []
|
@@ -116,7 +101,6 @@ files:
|
|
116
101
|
- examples/cucumber/step_definitions/spot_check_steps.rb
|
117
102
|
- examples/relaunch_deployment.rb
|
118
103
|
- examples/right_scale_ec2_instances_api_test.rb
|
119
|
-
- git_hooks/post-commit
|
120
104
|
- git_hooks/post-commit.disabled
|
121
105
|
- git_hooks/post-merge.disabled
|
122
106
|
- git_hooks/pre-commit
|
@@ -124,12 +108,9 @@ files:
|
|
124
108
|
- lib/rest_connection/patches.rb
|
125
109
|
- lib/rest_connection/rightscale/account.rb
|
126
110
|
- lib/rest_connection/rightscale/alert_spec.rb
|
127
|
-
- lib/rest_connection/rightscale/alert_spec_subject.rb
|
128
111
|
- lib/rest_connection/rightscale/audit_entry.rb
|
129
|
-
- lib/rest_connection/rightscale/backup.rb
|
130
112
|
- lib/rest_connection/rightscale/child_account.rb
|
131
113
|
- lib/rest_connection/rightscale/cloud.rb
|
132
|
-
- lib/rest_connection/rightscale/cloud_account.rb
|
133
114
|
- lib/rest_connection/rightscale/credential.rb
|
134
115
|
- lib/rest_connection/rightscale/deployment.rb
|
135
116
|
- lib/rest_connection/rightscale/ec2_ebs_snapshot.rb
|
@@ -137,14 +118,12 @@ files:
|
|
137
118
|
- lib/rest_connection/rightscale/ec2_elastic_ip.rb
|
138
119
|
- lib/rest_connection/rightscale/ec2_security_group.rb
|
139
120
|
- lib/rest_connection/rightscale/ec2_server_array.rb
|
140
|
-
- lib/rest_connection/rightscale/ec2_server_array_internal.rb
|
141
121
|
- lib/rest_connection/rightscale/ec2_ssh_key.rb
|
142
122
|
- lib/rest_connection/rightscale/ec2_ssh_key_internal.rb
|
143
123
|
- lib/rest_connection/rightscale/executable.rb
|
144
124
|
- lib/rest_connection/rightscale/instance.rb
|
145
125
|
- lib/rest_connection/rightscale/instance_type.rb
|
146
126
|
- lib/rest_connection/rightscale/macro.rb
|
147
|
-
- lib/rest_connection/rightscale/mc_audit_entry.rb
|
148
127
|
- lib/rest_connection/rightscale/mc_datacenter.rb
|
149
128
|
- lib/rest_connection/rightscale/mc_deployment.rb
|
150
129
|
- lib/rest_connection/rightscale/mc_image.rb
|
@@ -156,7 +135,6 @@ files:
|
|
156
135
|
- lib/rest_connection/rightscale/mc_server.rb
|
157
136
|
- lib/rest_connection/rightscale/mc_server_array.rb
|
158
137
|
- lib/rest_connection/rightscale/mc_server_template.rb
|
159
|
-
- lib/rest_connection/rightscale/mc_server_template_multi_cloud_image.rb
|
160
138
|
- lib/rest_connection/rightscale/mc_ssh_key.rb
|
161
139
|
- lib/rest_connection/rightscale/mc_tag.rb
|
162
140
|
- lib/rest_connection/rightscale/mc_volume.rb
|
@@ -169,7 +147,6 @@ files:
|
|
169
147
|
- lib/rest_connection/rightscale/multi_cloud_image_internal.rb
|
170
148
|
- lib/rest_connection/rightscale/permission.rb
|
171
149
|
- lib/rest_connection/rightscale/right_script.rb
|
172
|
-
- lib/rest_connection/rightscale/right_script_attachment_internal.rb
|
173
150
|
- lib/rest_connection/rightscale/right_script_internal.rb
|
174
151
|
- lib/rest_connection/rightscale/rightscale_api_base.rb
|
175
152
|
- lib/rest_connection/rightscale/rightscale_api_gateway.rb
|
@@ -180,20 +157,15 @@ files:
|
|
180
157
|
- lib/rest_connection/rightscale/rightscale_api_taggable.rb
|
181
158
|
- lib/rest_connection/rightscale/rs_internal.rb
|
182
159
|
- lib/rest_connection/rightscale/s3_bucket.rb
|
183
|
-
- lib/rest_connection/rightscale/security_group_rule.rb
|
184
160
|
- lib/rest_connection/rightscale/server.rb
|
185
|
-
- lib/rest_connection/rightscale/server_ec2_ebs_volume.rb
|
186
161
|
- lib/rest_connection/rightscale/server_interface.rb
|
187
162
|
- lib/rest_connection/rightscale/server_internal.rb
|
188
163
|
- lib/rest_connection/rightscale/server_template.rb
|
189
164
|
- lib/rest_connection/rightscale/server_template_internal.rb
|
190
|
-
- lib/rest_connection/rightscale/session.rb
|
191
|
-
- lib/rest_connection/rightscale/sqs_queue.rb
|
192
165
|
- lib/rest_connection/rightscale/status.rb
|
193
166
|
- lib/rest_connection/rightscale/tag.rb
|
194
167
|
- lib/rest_connection/rightscale/task.rb
|
195
168
|
- lib/rest_connection/rightscale/user.rb
|
196
|
-
- lib/rest_connection/rightscale/vpc_dhcp_option.rb
|
197
169
|
- lib/rest_connection/ssh_hax.rb
|
198
170
|
- rest_connection.gemspec
|
199
171
|
- spec/ec2_server_array_spec.rb
|
@@ -209,7 +181,7 @@ files:
|
|
209
181
|
- spec/server_template_internal.rb
|
210
182
|
- spec/spec_helper.rb
|
211
183
|
- spec/tag_spec.rb
|
212
|
-
homepage: http://github.com/
|
184
|
+
homepage: http://github.com/rigthscale/rest_connection
|
213
185
|
licenses: []
|
214
186
|
|
215
187
|
post_install_message:
|
@@ -238,9 +210,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
210
|
requirements: []
|
239
211
|
|
240
212
|
rubyforge_project:
|
241
|
-
rubygems_version: 1.
|
213
|
+
rubygems_version: 1.8.17
|
242
214
|
signing_key:
|
243
215
|
specification_version: 3
|
244
|
-
summary:
|
216
|
+
summary: lib for restful connections to the rightscale api
|
245
217
|
test_files: []
|
246
218
|
|
data/git_hooks/post-commit
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
puts <<EOS
|
3
|
-
..,ONMMMMMO.
|
4
|
-
NM8~:~:.,+NMM=
|
5
|
-
MO .MM:
|
6
|
-
NM. ,MN
|
7
|
-
.. .7MN . . 8M,
|
8
|
-
==. ?N: .MMN .,,.. 8$ZZ.~MN
|
9
|
-
.$. N8 ,DD. ,MMN ...+:. .MMM
|
10
|
-
D 8D.Z= .$. NMMM..,~8I ,88+. MMMM:.
|
11
|
-
,~... ,MM .N . MMMM7. .... MMMMM,
|
12
|
-
DZ.. .:OZ.:M. ..8= .MMMM. .OMMMMM
|
13
|
-
:7 . 8+$M:.D+ +MMMM, .:N+,MMD: 7MMMMM.
|
14
|
-
.MM7:.... 8 .M. 7MMMMM. MMMMZMMMMO.7MMMMM.
|
15
|
-
,?. .. ..8 ,M =MMMMM MMN8$7O8DMM.OMMM~ +.
|
16
|
-
N.. . .+ M, .MMMMMOM M8. .OM.MIMMMZ =,.
|
17
|
-
=NZI+~, + I8 .MMMMMMM= .=DD, MMMMMI ~~
|
18
|
-
O. .N + M. IMMMMMMMMMD ~MN 7MMMMMMM .Z
|
19
|
-
.MNZZNMZ. . MM 7MMMMMMMMMMMMMMMMMMMMMMMM, .~M,.
|
20
|
-
ID=. . . MMI MMMMMMMMMMMMMMMMMMMMMMMMMD. .+N
|
21
|
-
.DMO,ZND+. MMM. :MMMMMMMMN =MMMMMMMMN:ZMMM,. +M~,$OD$
|
22
|
-
.MMO... MMM OMMMMMMMM~ . ,I++O7. OMMM= .IM7 . .=..+MNI.
|
23
|
-
.8MO :MMM .MMMMMMMMMM. MMMMM= ~D ?MO:7MN...
|
24
|
-
+$ON. $NMM .NMMMMMMMMM7. .MMMMM. .8Z. :7N...MM:
|
25
|
-
O7?N M+MMNMMMMMMMMMMMMMMMMMN MMMMMM8D. . $, .$8 M ..,$MN~,,.
|
26
|
-
N$:=M. .NM.MM. ?MMMMMMO. .. D IO$IM:D.,$O, ,. O.I,Z :M: .+MI
|
27
|
-
MO, MMI ..NM8.MM. =. MM..IMN7,. .,IDN7~MMMMMM, N .Z N.M. ,M. =N.
|
28
|
-
.MO. MMMMMMMM::MM .: . .M :+I?=D.~.MMMMMMM?,,~INMMNNM+ ~ ~. D8. ,8.
|
29
|
-
.M8. MMMMMMMM ZM$. 8 7. ~ M,MM+MMMMMMMMMMMMMMM.. , : ,M. .O+
|
30
|
-
.MO. MMMMMMMI.MM, N = .....,IDI. MMMMMMMM8MMMMMM.. = M+ .M.
|
31
|
-
.MZ~.MMMMMMM..MM . N .=. ?M,NMMMMMM?~MM$IMMM7MMMMM7 :O M
|
32
|
-
M7I.NMMMMM8.$MZ.~ 8 .~, : MMMMMMMMMMMMM.~OOIMMM+MMMMM, .N M
|
33
|
-
N=D OMMMMM, MM O .I .7. MMMMMMMMMMMMMMMMMMMMMD7NMM:MMMMN D .M
|
34
|
-
O:M,~MMMMD NM? D.=, 8 OMMMMMMMMMMMMMMMMMMMMMZZMM?MMMM: ... Z .M
|
35
|
-
+=M$ MMMZ :MN ~, D. I. ~MMMMMMM+,,~I, .NMMMMMZ.MDNMM7 I. . .M.
|
36
|
-
.$NM .,.. MM .M :N. :~ .MMMMMM. MMMMMMZ=M,MM. .M. 7M
|
37
|
-
.N.MM~ $MZ. O. N? N. ,MMMMMMM. MMMMMMMM+8Z: NZ. . .MI.
|
38
|
-
.M.=MMMMN.. .+=..M. M. NMMMMMMMD 8MMMMMMM.MMM. $M. . ?, ~M.
|
39
|
-
+. ~MM .. $, M: N: . 7MMMMMMN .~MMMMMM8,MMMMMMMMMMM ..M. :MM
|
40
|
-
D N . ,M N NN. I8. $MMMMMMM?.. .?MMMMMMM?OMMMMMMMMMMMMMMMMMMMMI . ...MM$
|
41
|
-
7? .?N.7O DM ,M ZMMMMMMMMMM7.IMMMMMMMMD$MMMMMMMMMMMMMMMMMMMMMMMMZ: IMMN.
|
42
|
-
.~MM?.=NM~DM8.. M 8MMMMMMMMMMMMMMMMM7=MMMMMMMMMMMMMMMMMD.IMMMNZZNMMN~
|
43
|
-
EOS
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
#
|
16
|
-
class AlertSpecSubject
|
17
|
-
include RightScale::Api::Base
|
18
|
-
extend RightScale::Api::BaseExtend
|
19
|
-
|
20
|
-
deny_methods :index, :destroy, :update, :show
|
21
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
#
|
17
|
-
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
-
#
|
19
|
-
class Backup
|
20
|
-
include RightScale::Api::Gateway
|
21
|
-
extend RightScale::Api::GatewayExtend
|
22
|
-
|
23
|
-
deny_methods :index
|
24
|
-
|
25
|
-
def self.filters
|
26
|
-
[:cloud_href, :committed, :completed, :from_master, :latest_before]
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.find_all(lineage)
|
30
|
-
index(lineage)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.find_with_filter(lineage, filter={})
|
34
|
-
index(lineage, filter)
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.index(lineage, filter={})
|
38
|
-
filter_params = []
|
39
|
-
filter.each { |key,val|
|
40
|
-
unless self.filters.include?(key.to_sym)
|
41
|
-
raise ArgumentError.new("#{key} is not a valid filter for resource #{self.resource_singular_name}")
|
42
|
-
end
|
43
|
-
filter_params << "#{key}==#{val}"
|
44
|
-
}
|
45
|
-
|
46
|
-
a = Array.new
|
47
|
-
url = self.resource_plural_name
|
48
|
-
hsh = {'lineage' => lineage}
|
49
|
-
hsh.merge(:filter => filter_params) unless filter_params.empty?
|
50
|
-
connection.get(url, hsh).each do |object|
|
51
|
-
a << self.new(object)
|
52
|
-
end
|
53
|
-
|
54
|
-
return a
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.cleanup(lineage, keep_last, params={})
|
58
|
-
params.merge!('keep_last' => keep_last, 'lineage' => lineage)
|
59
|
-
connection.post(resource_plural_name + "/cleanup", params)
|
60
|
-
end
|
61
|
-
|
62
|
-
def restore(instance_href, name=nil, description=nil)
|
63
|
-
uri = URI.parse(self.href)
|
64
|
-
params = {'instance_href' => instance_href}
|
65
|
-
params.deep_merge!({'backup' => {'name' => name}}) if name
|
66
|
-
params.deep_merge!({'backup' => {'description' => description}}) if description
|
67
|
-
location = connection.post(uri.path + "/restore", params)
|
68
|
-
Task.new('href' => location)
|
69
|
-
end
|
70
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
#
|
17
|
-
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
-
#
|
19
|
-
class CloudAccount
|
20
|
-
include RightScale::Api::Gateway
|
21
|
-
extend RightScale::Api::GatewayExtend
|
22
|
-
|
23
|
-
deny_methods :update
|
24
|
-
|
25
|
-
def cloud_id
|
26
|
-
self.cloud.split("/").last
|
27
|
-
end
|
28
|
-
|
29
|
-
def create(opts)
|
30
|
-
location = connection.post(self.resource_plural_name, self.resource_singular_name.to_sym => opts)
|
31
|
-
if location =~ /aws/
|
32
|
-
return "AWS Cloud Added successfully"
|
33
|
-
else
|
34
|
-
newrecord = self.new('links' => [ {'rel' => 'self', 'href' => location } ])
|
35
|
-
newrecord.reload
|
36
|
-
return newrecord
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
class Ec2ServerArray
|
17
|
-
include RightScale::Api::Base
|
18
|
-
extend RightScale::Api::BaseExtend
|
19
|
-
include RightScale::Api::Taggable
|
20
|
-
extend RightScale::Api::TaggableExtend
|
21
|
-
|
22
|
-
deny_methods :index, :show, :create, :update, :destroy
|
23
|
-
|
24
|
-
def run_script_on_instances(script, ec2_instance_hrefs=[], opts={})
|
25
|
-
uri = URI.parse(self.href)
|
26
|
-
case script
|
27
|
-
when Executable then script = script.right_script
|
28
|
-
when String then script = RightScript.new('href' => script)
|
29
|
-
end
|
30
|
-
|
31
|
-
params = {:right_script_href => script.href}
|
32
|
-
unless ec2_instance_hrefs.nil? || ec2_instance_hrefs.empty?
|
33
|
-
params[:ec2_instance_hrefs] = ec2_instance_hrefs
|
34
|
-
end
|
35
|
-
unless opts.nil? || opts.empty?
|
36
|
-
params[:parameters] = opts
|
37
|
-
end
|
38
|
-
params = {:ec2_server_array => params}
|
39
|
-
connection.post(uri.path + "/run_script_on_instances", params).map do |work_unit|
|
40
|
-
Status.new('href' => location)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
#
|
17
|
-
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
-
#
|
19
|
-
class McAuditEntry
|
20
|
-
include RightScale::Api::Gateway
|
21
|
-
extend RightScale::Api::GatewayExtend
|
22
|
-
|
23
|
-
deny_methods :destroy, :index
|
24
|
-
|
25
|
-
def resource_plural_name
|
26
|
-
"audit_entries"
|
27
|
-
end
|
28
|
-
|
29
|
-
def resource_singular_name
|
30
|
-
"audit_entry"
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.resource_plural_name
|
34
|
-
"audit_entries"
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.resource_singular_name
|
38
|
-
"audit_entry"
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.filters
|
42
|
-
[:auditee_href, :user_email]
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.find_all(start_date=nil, end_date=nil, limit=1000)
|
46
|
-
start_date ||= (Time.now.utc - (60*60*24*31)).strftime(RightScale::Api::DATETIME_FMT)
|
47
|
-
end_date ||= Time.now.utc.strftime(RightScale::Api::DATETIME_FMT)
|
48
|
-
index(start_date, end_date, limit)
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.find_with_filter(start_date, end_date, limit, filter)
|
52
|
-
index(start_date, end_date, limit, filter)
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.index(start_date, end_date, limit=1000, filter={})
|
56
|
-
# Validate index params
|
57
|
-
ex_fmt = "2011/06/25 00:00:00 +0000"
|
58
|
-
regex = /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4})$/
|
59
|
-
unless start_date =~ regex
|
60
|
-
raise ArgumentError.new("start_date doesn't match format. e.g., #{ex_fmt}")
|
61
|
-
end
|
62
|
-
unless end_date =~ regex
|
63
|
-
raise ArgumentError.new("end_date doesn't match format. e.g., #{ex_fmt}")
|
64
|
-
end
|
65
|
-
unless (1..1000) === limit.to_i
|
66
|
-
raise ArgumentError.new("limit is not within the range of 1..1000")
|
67
|
-
end
|
68
|
-
filter_params = []
|
69
|
-
filter.each { |key,val|
|
70
|
-
unless self.filters.include?(key.to_sym)
|
71
|
-
raise ArgumentError.new("#{key} is not a valid filter for resource #{self.resource_singular_name}")
|
72
|
-
end
|
73
|
-
filter_params << "#{key}==#{val}"
|
74
|
-
}
|
75
|
-
|
76
|
-
a = Array.new
|
77
|
-
url = self.resource_plural_name
|
78
|
-
if filter_params.empty?
|
79
|
-
connection.get(url).each do |object|
|
80
|
-
a << self.new(object)
|
81
|
-
end
|
82
|
-
else
|
83
|
-
connection.get(url, :filter => filter_params).each do |object|
|
84
|
-
a << self.new(object)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
return a
|
89
|
-
end
|
90
|
-
|
91
|
-
def append(detail, offset)
|
92
|
-
uri = URI.parse(self.href)
|
93
|
-
connection.post(uri.path + "/append", 'detail' => detail, 'offset' => offset)
|
94
|
-
end
|
95
|
-
|
96
|
-
def detail
|
97
|
-
uri = URI.parse(self.href)
|
98
|
-
res = connection.post(uri.path + "/detail")
|
99
|
-
return res.body
|
100
|
-
end
|
101
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
#
|
17
|
-
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
-
#
|
19
|
-
|
20
|
-
class McServerTemplateMultiCloudImage
|
21
|
-
include RightScale::Api::Gateway
|
22
|
-
extend RightScale::Api::GatewayExtend
|
23
|
-
|
24
|
-
deny_methods :update
|
25
|
-
|
26
|
-
def resource_plural_name
|
27
|
-
"server_template_multi_cloud_images"
|
28
|
-
end
|
29
|
-
|
30
|
-
def resource_singular_name
|
31
|
-
"server_template_multi_cloud_image"
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.resource_plural_name
|
35
|
-
"server_template_multi_cloud_images"
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.resource_singular_name
|
39
|
-
"server_template_multi_cloud_image"
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.filters
|
43
|
-
[:is_default, :multi_cloud_image_href, :server_template_href]
|
44
|
-
end
|
45
|
-
|
46
|
-
def make_default
|
47
|
-
my_href = URI.parse(self.href)
|
48
|
-
connection.post(my_href + "/make_default")
|
49
|
-
end
|
50
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
require 'rest-client'
|
17
|
-
RestClient.log = ENV["REST_CONNECTION_LOG"] || "stdout"
|
18
|
-
|
19
|
-
class RightScriptAttachmentInternal
|
20
|
-
include RightScale::Api::Base
|
21
|
-
extend RightScale::Api::BaseExtend
|
22
|
-
include RightScale::Api::Internal
|
23
|
-
extend RightScale::Api::InternalExtend
|
24
|
-
|
25
|
-
deny_methods :index, :create, :update
|
26
|
-
|
27
|
-
def resource_plural_name
|
28
|
-
"right_script_attachments"
|
29
|
-
end
|
30
|
-
|
31
|
-
def resource_singular_name
|
32
|
-
"right_script_attachment"
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.resource_plural_name
|
36
|
-
"right_script_attachments"
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.resource_singular_name
|
40
|
-
"right_script_attachment"
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.get_s3_upload_params(right_script_href)
|
44
|
-
url = self.resource_plural_name + "/get_s3_upload_params"
|
45
|
-
params = {"right_script_href" => right_script_href}
|
46
|
-
params = {self.resource_singular_name => params}
|
47
|
-
connection.get(url, params)
|
48
|
-
end
|
49
|
-
|
50
|
-
=begin
|
51
|
-
def self.upload(filepath, right_script_href)
|
52
|
-
hsh = get_s3_upload_params(right_script_href)
|
53
|
-
params = {}
|
54
|
-
hsh.keys.each { |k| params[k.gsub(/-/,"_").to_sym] = hsh[k] }
|
55
|
-
params[:file] = File.new(filepath, 'rb')
|
56
|
-
req = RestClient::Request.new({
|
57
|
-
:method => :post,
|
58
|
-
:url => hsh["url"],
|
59
|
-
:payload => params,
|
60
|
-
:multipart => true,
|
61
|
-
})
|
62
|
-
s = req.payload.to_s
|
63
|
-
splitter = s.split("\r\n").first
|
64
|
-
a = s.split(/#{splitter}-?-?\r\n/)
|
65
|
-
a.push(a.delete(a.detect { |n| n =~ %r{name="file";} }))
|
66
|
-
new_payload = a.join(splitter + "\r\n") + splitter + "--\r\n"
|
67
|
-
|
68
|
-
uri = URI.parse(hsh["url"])
|
69
|
-
net_http = Net::HTTP::Post.new(uri.request_uri)
|
70
|
-
req.transmit(uri, net_http, new_payload)
|
71
|
-
# TODO: Precondition Failing
|
72
|
-
|
73
|
-
callback_uri = URI.parse(hsh["success_action_redirect"])
|
74
|
-
connection.get(callback_uri.request_uri)
|
75
|
-
end
|
76
|
-
=end
|
77
|
-
|
78
|
-
def download
|
79
|
-
self.reload unless @params["authenticated_s3_url"]
|
80
|
-
RestClient.get(@params["authenticated_s3_url"])
|
81
|
-
end
|
82
|
-
|
83
|
-
def download_to_file(path=Dir.pwd)
|
84
|
-
data = self.download
|
85
|
-
File.open(File.join(path, @params["filename"]), 'w') { |f| f.write(data) }
|
86
|
-
end
|
87
|
-
|
88
|
-
def reload
|
89
|
-
uri = URI.parse(self.href || "#{resource_plural_name}/#{@params["id"]}")
|
90
|
-
@params ? @params.merge!(connection.get(uri.path)) : @params = connection.get(uri.path)
|
91
|
-
end
|
92
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
#
|
17
|
-
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
-
#
|
19
|
-
class SecurityGroupRule
|
20
|
-
include RightScale::Api::Gateway
|
21
|
-
extend RightScale::Api::GatewayExtend
|
22
|
-
|
23
|
-
deny_methods :update
|
24
|
-
|
25
|
-
def self.parse_args(cloud_id=nil, security_group_id=nil)
|
26
|
-
if cloud_id.nil? ^ security_group_id.nil?
|
27
|
-
raise ArgumentError.new("#{self} requires either 0 arguments, or 2 arguments")
|
28
|
-
end
|
29
|
-
"clouds/#{cloud_id}/security_groups/#{security_group_id}/"
|
30
|
-
end
|
31
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
#
|
16
|
-
|
17
|
-
class ServerEc2EbsVolume
|
18
|
-
include RightScale::Api::Base
|
19
|
-
extend RightScale::Api::BaseExtend
|
20
|
-
include RightScale::Api::Taggable
|
21
|
-
extend RightScale::Api::TaggableExtend
|
22
|
-
|
23
|
-
deny_methods :index, :update
|
24
|
-
|
25
|
-
def resource_plural_name
|
26
|
-
"component_ec2_ebs_volumes"
|
27
|
-
end
|
28
|
-
|
29
|
-
def resource_singular_name
|
30
|
-
"component_ec2_ebs_volume"
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.resource_plural_name
|
34
|
-
"component_ec2_ebs_volumes"
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.resource_singular_name
|
38
|
-
"component_ec2_ebs_volume"
|
39
|
-
end
|
40
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
#
|
17
|
-
# You must have Beta v1.5 API access to use these internal API calls.
|
18
|
-
#
|
19
|
-
class Session
|
20
|
-
include RightScale::Api::Gateway
|
21
|
-
extend RightScale::Api::GatewayExtend
|
22
|
-
|
23
|
-
deny_methods :index, :destroy, :update, :show
|
24
|
-
|
25
|
-
def self.index
|
26
|
-
self.new(connection.get(resource_singular_name))
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.create(opts={})
|
30
|
-
settings = connection.settings
|
31
|
-
ignored, account = settings[:api_url].split(/\/acct\//) if settings[:api_url].include?("acct")
|
32
|
-
params = {
|
33
|
-
"email" => settings[:user],
|
34
|
-
"password" => settings[:pass],
|
35
|
-
"account_href" => "/api/accounts/#{account}"
|
36
|
-
}.merge(opts)
|
37
|
-
resp = connection.post(resource_singular_name, params)
|
38
|
-
connection.cookie = resp.response['set-cookie']
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.accounts(opts={})
|
42
|
-
settings = connection.settings
|
43
|
-
params = {
|
44
|
-
"email" => settings[:user],
|
45
|
-
"password" => settings[:pass],
|
46
|
-
}.merge(opts)
|
47
|
-
a = Array.new
|
48
|
-
connection.get(resource_singular_name + "/accounts").each do |object|
|
49
|
-
a << Account.new(object)
|
50
|
-
end
|
51
|
-
return a
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.create_instance_session
|
55
|
-
# TODO
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.index_instance_session
|
59
|
-
# TODO
|
60
|
-
end
|
61
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
#
|
16
|
-
|
17
|
-
class SqsQueue
|
18
|
-
include RightScale::Api::Base
|
19
|
-
extend RightScale::Api::BaseExtend
|
20
|
-
|
21
|
-
deny_methods :update
|
22
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# This file is part of RestConnection
|
2
|
-
#
|
3
|
-
# RestConnection is free software: you can redistribute it and/or modify
|
4
|
-
# it under the terms of the GNU General Public License as published by
|
5
|
-
# the Free Software Foundation, either version 3 of the License, or
|
6
|
-
# (at your option) any later version.
|
7
|
-
#
|
8
|
-
# RestConnection is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with RestConnection. If not, see <http://www.gnu.org/licenses/>.
|
15
|
-
|
16
|
-
class VpcDhcpOption
|
17
|
-
include RightScale::Api::Base
|
18
|
-
extend RightScale::Api::BaseExtend
|
19
|
-
end
|