rest_connection 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +140 -0
- data/lib/rest_connection/rightscale/account.rb +1 -1
- data/lib/rest_connection/rightscale/alert_spec.rb +3 -0
- data/lib/rest_connection/rightscale/alert_spec_subject.rb +3 -0
- data/lib/rest_connection/rightscale/audit_entry.rb +3 -0
- data/lib/rest_connection/rightscale/backup.rb +1 -1
- data/lib/rest_connection/rightscale/child_account.rb +1 -1
- data/lib/rest_connection/rightscale/cloud.rb +1 -1
- data/lib/rest_connection/rightscale/cloud_account.rb +1 -1
- data/lib/rest_connection/rightscale/credential.rb +3 -0
- data/lib/rest_connection/rightscale/deployment.rb +3 -0
- data/lib/rest_connection/rightscale/ec2_ebs_snapshot.rb +3 -0
- data/lib/rest_connection/rightscale/ec2_ebs_volume.rb +3 -0
- data/lib/rest_connection/rightscale/ec2_elastic_ip.rb +3 -0
- data/lib/rest_connection/rightscale/ec2_security_group.rb +3 -0
- data/lib/rest_connection/rightscale/ec2_server_array.rb +34 -3
- data/lib/rest_connection/rightscale/ec2_ssh_key.rb +3 -0
- data/lib/rest_connection/rightscale/ec2_ssh_key_internal.rb +3 -0
- data/lib/rest_connection/rightscale/executable.rb +3 -0
- data/lib/rest_connection/rightscale/instance.rb +5 -3
- data/lib/rest_connection/rightscale/instance_type.rb +1 -1
- data/lib/rest_connection/rightscale/macro.rb +3 -0
- data/lib/rest_connection/rightscale/mc_audit_entry.rb +1 -1
- data/lib/rest_connection/rightscale/mc_datacenter.rb +1 -1
- data/lib/rest_connection/rightscale/mc_deployment.rb +1 -1
- data/lib/rest_connection/rightscale/mc_image.rb +1 -1
- data/lib/rest_connection/rightscale/mc_instance.rb +9 -2
- data/lib/rest_connection/rightscale/mc_instance_type.rb +1 -1
- data/lib/rest_connection/rightscale/mc_multi_cloud_image.rb +1 -1
- data/lib/rest_connection/rightscale/mc_multi_cloud_image_setting.rb +1 -1
- data/lib/rest_connection/rightscale/mc_security_group.rb +1 -1
- data/lib/rest_connection/rightscale/mc_server.rb +3 -3
- data/lib/rest_connection/rightscale/mc_server_array.rb +1 -1
- data/lib/rest_connection/rightscale/mc_server_template.rb +1 -1
- data/lib/rest_connection/rightscale/mc_server_template_multi_cloud_image.rb +1 -1
- data/lib/rest_connection/rightscale/mc_ssh_key.rb +1 -1
- data/lib/rest_connection/rightscale/mc_tag.rb +1 -1
- data/lib/rest_connection/rightscale/mc_volume.rb +1 -1
- data/lib/rest_connection/rightscale/mc_volume_attachment.rb +1 -1
- data/lib/rest_connection/rightscale/mc_volume_snapshot.rb +1 -1
- data/lib/rest_connection/rightscale/mc_volume_type.rb +1 -1
- data/lib/rest_connection/rightscale/monitoring_metric.rb +1 -1
- data/lib/rest_connection/rightscale/multi_cloud_image.rb +3 -0
- data/lib/rest_connection/rightscale/multi_cloud_image_cloud_setting_internal.rb +3 -0
- data/lib/rest_connection/rightscale/multi_cloud_image_internal.rb +3 -0
- data/lib/rest_connection/rightscale/permission.rb +1 -1
- data/lib/rest_connection/rightscale/right_script.rb +3 -0
- data/lib/rest_connection/rightscale/right_script_attachment_internal.rb +3 -0
- data/lib/rest_connection/rightscale/right_script_internal.rb +3 -1
- data/lib/rest_connection/rightscale/rightscale_api_base.rb +28 -8
- data/lib/rest_connection/rightscale/rightscale_api_gateway.rb +12 -0
- data/lib/rest_connection/rightscale/rightscale_api_internal.rb +8 -0
- data/lib/rest_connection/rightscale/rightscale_api_mc_input.rb +1 -1
- data/lib/rest_connection/rightscale/rightscale_api_mc_taggable.rb +1 -1
- data/lib/rest_connection/rightscale/rightscale_api_resources.rb +0 -1
- data/lib/rest_connection/rightscale/rs_internal.rb +1 -1
- data/lib/rest_connection/rightscale/s3_bucket.rb +3 -0
- data/lib/rest_connection/rightscale/security_group_rule.rb +1 -1
- data/lib/rest_connection/rightscale/server.rb +3 -0
- data/lib/rest_connection/rightscale/server_ec2_ebs_volume.rb +3 -0
- data/lib/rest_connection/rightscale/server_internal.rb +1 -1
- data/lib/rest_connection/rightscale/server_template.rb +3 -0
- data/lib/rest_connection/rightscale/server_template_internal.rb +3 -0
- data/lib/rest_connection/rightscale/session.rb +1 -1
- data/lib/rest_connection/rightscale/sqs_queue.rb +3 -0
- data/lib/rest_connection/rightscale/status.rb +3 -0
- data/lib/rest_connection/rightscale/tag.rb +3 -0
- data/lib/rest_connection/rightscale/task.rb +1 -1
- data/lib/rest_connection/rightscale/user.rb +1 -1
- data/lib/rest_connection/rightscale/vpc_dhcp_option.rb +3 -0
- data/lib/rest_connection/ssh_hax.rb +1 -1
- data/lib/rest_connection/version.rb +1 -1
- data/lib/rest_connection.rb +6 -0
- data/rest_connection.gemspec +2 -2
- metadata +43 -49
- data/Gemfile.lock +0 -43
- data/README.rdoc +0 -63
- data/lib/rest_connection/rightscale/ec2_server_array_internal.rb +0 -53
data/Gemfile.lock
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
rest_connection (1.0.5)
|
5
|
-
activesupport (= 2.3.10)
|
6
|
-
highline
|
7
|
-
json
|
8
|
-
net-ssh (= 2.1.4)
|
9
|
-
nokogiri
|
10
|
-
rest-client
|
11
|
-
|
12
|
-
GEM
|
13
|
-
remote: http://rubygems.org/
|
14
|
-
specs:
|
15
|
-
activesupport (2.3.10)
|
16
|
-
columnize (0.3.6)
|
17
|
-
highline (1.6.15)
|
18
|
-
json (1.7.5)
|
19
|
-
linecache (0.46)
|
20
|
-
rbx-require-relative (> 0.0.4)
|
21
|
-
mime-types (1.19)
|
22
|
-
net-ssh (2.1.4)
|
23
|
-
nokogiri (1.5.6)
|
24
|
-
rake (0.8.7)
|
25
|
-
rbx-require-relative (0.0.9)
|
26
|
-
rest-client (1.6.7)
|
27
|
-
mime-types (>= 1.16)
|
28
|
-
rspec (1.3.0)
|
29
|
-
ruby-debug (0.10.4)
|
30
|
-
columnize (>= 0.1)
|
31
|
-
ruby-debug-base (~> 0.10.4.0)
|
32
|
-
ruby-debug-base (0.10.4)
|
33
|
-
linecache (>= 0.3)
|
34
|
-
|
35
|
-
PLATFORMS
|
36
|
-
ruby
|
37
|
-
|
38
|
-
DEPENDENCIES
|
39
|
-
bundler
|
40
|
-
rake (= 0.8.7)
|
41
|
-
rest_connection!
|
42
|
-
rspec (= 1.3.0)
|
43
|
-
ruby-debug
|
data/README.rdoc
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
= rest_connection Quick Start
|
2
|
-
== Install
|
3
|
-
==== Installing with rubygems
|
4
|
-
"gem install rest_connection"
|
5
|
-
|
6
|
-
==== Installing from source
|
7
|
-
"git clone git@github.com:rightscale/rest_connection.git"
|
8
|
-
"cd rest_connection"
|
9
|
-
"gem install rconf"
|
10
|
-
"rconf" <- follow any further instructions from rconf
|
11
|
-
"bundle install"
|
12
|
-
|
13
|
-
== Configuration
|
14
|
-
|
15
|
-
You must setup ~/.rest_connection/rest_api_config.yaml or /etc/rest_connection/rest_api_config.yaml
|
16
|
-
|
17
|
-
Copy the example from GEMHOME/rest_connection/config/rest_api_config.yaml.sample and fill in your connection info.
|
18
|
-
|
19
|
-
Pro Tip: to find a GEMHOME, use gemedit
|
20
|
-
"gem install gemedit"
|
21
|
-
"gem edit rest_connection"
|
22
|
-
|
23
|
-
== Usage: some IRB samples for the RightScale API module
|
24
|
-
|
25
|
-
$ irb
|
26
|
-
ruby> require 'rubygems'; require 'rest_connection'
|
27
|
-
|
28
|
-
=== Lookup and run a RightScript
|
29
|
-
|
30
|
-
first_fe = Server.find(:first) { |s| s.nickname =~ /Front End/ }
|
31
|
-
st = ServerTemplate.find(first_fe.server_template_href)
|
32
|
-
connect_script = st.executables.detect { |ex| ex.name =~ /LB [app|mongrels]+ to HA proxy connect/i }
|
33
|
-
state = first_fe.run_executable(connect_script)
|
34
|
-
state.wait_for_completed
|
35
|
-
|
36
|
-
=== Stop a Deployment
|
37
|
-
|
38
|
-
deployment = Deployment.find(opts[:id])
|
39
|
-
my_servers = deployment.servers
|
40
|
-
my_servers.each { |s| s.stop }
|
41
|
-
my_servers.each { |s| s.wait_for_state("stopped") }
|
42
|
-
|
43
|
-
=== Activate an Ec2ServerArray / Display instances IPs
|
44
|
-
|
45
|
-
my_array = Ec2ServerArray.find(opts[:href])
|
46
|
-
my_array.active = true
|
47
|
-
my_array.save
|
48
|
-
|
49
|
-
puts my_array.instances.map { |i| i['ip-address'] }
|
50
|
-
|
51
|
-
=== To cut a new gem and push to RubyGems.org
|
52
|
-
|
53
|
-
Edit lib/rest_connection/version.rb and bump the number according to http://semver.org
|
54
|
-
|
55
|
-
"bundle exec gem build rest_connection.gemspec"
|
56
|
-
"ls *.gem" <- verify that gem was built
|
57
|
-
"cd /tmp"
|
58
|
-
"bundle exec gem install /path/to/local/rest_connection-X.Y.Z.gem" <- replace X.Y.Z with your new version number
|
59
|
-
"bundle exec gem uninstall rest_connection"
|
60
|
-
"cd -"
|
61
|
-
"bundle exec gem push rest_connection-X.Y.Z.gem"
|
62
|
-
|
63
|
-
Check it out: https://rubygems.org/gems/rest_connection
|
@@ -1,53 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2010-2012 RightScale Inc
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# 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 BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
#++
|
23
|
-
|
24
|
-
class Ec2ServerArrayInternal
|
25
|
-
include RightScale::Api::Base
|
26
|
-
extend RightScale::Api::BaseExtend
|
27
|
-
include RightScale::Api::Internal
|
28
|
-
extend RightScale::Api::InternalExtend
|
29
|
-
|
30
|
-
deny_methods :index, :show, :create, :update, :destroy
|
31
|
-
|
32
|
-
def run_script_on_instances(script, ec2_instance_hrefs=[], opts={})
|
33
|
-
uri = URI.parse(self.href)
|
34
|
-
case script
|
35
|
-
when Executable then script = script.right_script
|
36
|
-
when String then script = RightScript.new('href' => script)
|
37
|
-
end
|
38
|
-
|
39
|
-
params = {:right_script_href => script.href }
|
40
|
-
unless ec2_instance_hrefs.nil? || ec2_instance_hrefs.empty?
|
41
|
-
params[:ec2_instance_hrefs] = ec2_instance_hrefs
|
42
|
-
end
|
43
|
-
unless opts.nil? || opts.empty?
|
44
|
-
params[:parameters] = opts
|
45
|
-
end
|
46
|
-
params = {:ec2_server_array => params}
|
47
|
-
status_array=[]
|
48
|
-
connection.post(uri.path + "/run_script_on_instances", params).map do |work_unit|
|
49
|
-
status_array.push Status.new('href' => work_unit)
|
50
|
-
end
|
51
|
-
return(status_array)
|
52
|
-
end
|
53
|
-
end
|