poolparty 1.6.6 → 1.6.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/VERSION.yml +2 -3
  2. data/lib/poolparty/chef_solo.rb +0 -1
  3. metadata +12 -69
  4. data/vendor/gems/amazon-ec2/ChangeLog +0 -304
  5. data/vendor/gems/amazon-ec2/LICENSE +0 -66
  6. data/vendor/gems/amazon-ec2/README.rdoc +0 -359
  7. data/vendor/gems/amazon-ec2/README_dev.rdoc +0 -10
  8. data/vendor/gems/amazon-ec2/Rakefile +0 -70
  9. data/vendor/gems/amazon-ec2/VERSION +0 -1
  10. data/vendor/gems/amazon-ec2/amazon-ec2.gemspec +0 -142
  11. data/vendor/gems/amazon-ec2/bin/ec2-gem-example.rb +0 -137
  12. data/vendor/gems/amazon-ec2/bin/ec2-gem-profile.rb +0 -10
  13. data/vendor/gems/amazon-ec2/bin/ec2sh +0 -62
  14. data/vendor/gems/amazon-ec2/bin/setup.rb +0 -29
  15. data/vendor/gems/amazon-ec2/deps.rip +0 -1
  16. data/vendor/gems/amazon-ec2/lib/AWS/Autoscaling/autoscaling.rb +0 -273
  17. data/vendor/gems/amazon-ec2/lib/AWS/Autoscaling.rb +0 -70
  18. data/vendor/gems/amazon-ec2/lib/AWS/Cloudwatch/monitoring.rb +0 -80
  19. data/vendor/gems/amazon-ec2/lib/AWS/Cloudwatch.rb +0 -32
  20. data/vendor/gems/amazon-ec2/lib/AWS/EC2/availability_zones.rb +0 -29
  21. data/vendor/gems/amazon-ec2/lib/AWS/EC2/console.rb +0 -25
  22. data/vendor/gems/amazon-ec2/lib/AWS/EC2/devpay.rb +0 -18
  23. data/vendor/gems/amazon-ec2/lib/AWS/EC2/elastic_ips.rb +0 -86
  24. data/vendor/gems/amazon-ec2/lib/AWS/EC2/image_attributes.rb +0 -133
  25. data/vendor/gems/amazon-ec2/lib/AWS/EC2/images.rb +0 -117
  26. data/vendor/gems/amazon-ec2/lib/AWS/EC2/instances.rb +0 -249
  27. data/vendor/gems/amazon-ec2/lib/AWS/EC2/keypairs.rb +0 -47
  28. data/vendor/gems/amazon-ec2/lib/AWS/EC2/products.rb +0 -21
  29. data/vendor/gems/amazon-ec2/lib/AWS/EC2/security_groups.rb +0 -164
  30. data/vendor/gems/amazon-ec2/lib/AWS/EC2/snapshots.rb +0 -80
  31. data/vendor/gems/amazon-ec2/lib/AWS/EC2/volumes.rb +0 -100
  32. data/vendor/gems/amazon-ec2/lib/AWS/EC2.rb +0 -33
  33. data/vendor/gems/amazon-ec2/lib/AWS/ELB/load_balancers.rb +0 -178
  34. data/vendor/gems/amazon-ec2/lib/AWS/ELB.rb +0 -71
  35. data/vendor/gems/amazon-ec2/lib/AWS/RDS/rds.rb +0 -522
  36. data/vendor/gems/amazon-ec2/lib/AWS/RDS.rb +0 -73
  37. data/vendor/gems/amazon-ec2/lib/AWS/exceptions.rb +0 -200
  38. data/vendor/gems/amazon-ec2/lib/AWS/responses.rb +0 -21
  39. data/vendor/gems/amazon-ec2/lib/AWS.rb +0 -304
  40. data/vendor/gems/amazon-ec2/perftools/ec2prof +0 -0
  41. data/vendor/gems/amazon-ec2/perftools/ec2prof-results.dot +0 -132
  42. data/vendor/gems/amazon-ec2/perftools/ec2prof-results.txt +0 -100
  43. data/vendor/gems/amazon-ec2/perftools/ec2prof.symbols +0 -102
  44. data/vendor/gems/amazon-ec2/test/test_Autoscaling_groups.rb +0 -337
  45. data/vendor/gems/amazon-ec2/test/test_EC2.rb +0 -68
  46. data/vendor/gems/amazon-ec2/test/test_EC2_availability_zones.rb +0 -49
  47. data/vendor/gems/amazon-ec2/test/test_EC2_console.rb +0 -54
  48. data/vendor/gems/amazon-ec2/test/test_EC2_elastic_ips.rb +0 -144
  49. data/vendor/gems/amazon-ec2/test/test_EC2_image_attributes.rb +0 -238
  50. data/vendor/gems/amazon-ec2/test/test_EC2_images.rb +0 -229
  51. data/vendor/gems/amazon-ec2/test/test_EC2_instances.rb +0 -611
  52. data/vendor/gems/amazon-ec2/test/test_EC2_keypairs.rb +0 -123
  53. data/vendor/gems/amazon-ec2/test/test_EC2_products.rb +0 -48
  54. data/vendor/gems/amazon-ec2/test/test_EC2_responses.rb +0 -53
  55. data/vendor/gems/amazon-ec2/test/test_EC2_s3_xmlsimple.rb +0 -80
  56. data/vendor/gems/amazon-ec2/test/test_EC2_security_groups.rb +0 -205
  57. data/vendor/gems/amazon-ec2/test/test_EC2_snapshots.rb +0 -83
  58. data/vendor/gems/amazon-ec2/test/test_EC2_volumes.rb +0 -142
  59. data/vendor/gems/amazon-ec2/test/test_ELB_load_balancers.rb +0 -239
  60. data/vendor/gems/amazon-ec2/test/test_RDS.rb +0 -354
  61. data/vendor/gems/amazon-ec2/test/test_helper.rb +0 -23
  62. data/vendor/gems/amazon-ec2/wsdl/2007-08-29.ec2.wsdl +0 -1269
  63. data/vendor/gems/amazon-ec2/wsdl/2008-02-01.ec2.wsdl +0 -1614
  64. data/vendor/gems/amazon-ec2/wsdl/2008-05-05.ec2.wsdl +0 -2052
  65. data/vendor/gems/amazon-ec2/wsdl/2008-12-01.ec2.wsdl +0 -2354
  66. data/vendor/gems/amazon-ec2/wsdl/2009-10-31.ec2.wsdl +0 -4261
  67. data/vendor/gems/amazon-ec2/wsdl/2009-11-30.ec2.wsdl +0 -4668
@@ -1,137 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Amazon Web Services EC2 Query API Ruby library
4
- #
5
- # Ruby Gem Name:: amazon-ec2
6
- # Author:: Glenn Rempe (mailto:glenn@rempe.us)
7
- # Copyright:: Copyright (c) 2007-2008 Glenn Rempe
8
- # License:: Distributes under the same terms as Ruby
9
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
10
- #++
11
-
12
- require File.dirname(__FILE__) + '/../lib/AWS'
13
- require 'pp'
14
-
15
- # pull these from the local shell environment variables set in ~/.bash_login
16
- # or using appropriate methods specific to your login shell.
17
- #
18
- # e.g. in ~/.bash_login
19
- #
20
- # # For amazon-ec2 and amazon s3 ruby gems
21
- # export AMAZON_ACCESS_KEY_ID="FOO"
22
- # export AMAZON_SECRET_ACCESS_KEY="BAR"
23
-
24
- ACCESS_KEY_ID = ENV['AMAZON_ACCESS_KEY_ID']
25
- SECRET_ACCESS_KEY = ENV['AMAZON_SECRET_ACCESS_KEY']
26
-
27
- if ACCESS_KEY_ID.nil? || ACCESS_KEY_ID.empty?
28
- puts "Error : You must add the shell environment variables AMAZON_ACCESS_KEY_ID and AMAZON_SECRET_ACCESS_KEY before calling #{$0}!"
29
- exit
30
- end
31
-
32
- # us-east-1.ec2.amazonaws.com == ec2.amazonaws.com
33
- # eu-west-1.ec2.amazonaws.com for the european region
34
- # test different servers by running something like:
35
- # export EC2_URL='https://ec2.amazonaws.com';./bin/ec2-gem-example.rb
36
- if ENV['EC2_URL']
37
- ec2 = AWS::EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['EC2_URL']).host )
38
- else
39
- # default server is US ec2.amazonaws.com
40
- ec2 = AWS::EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY )
41
- end
42
-
43
- puts "----- ec2.methods.sort -----"
44
- p ec2.methods.sort
45
-
46
- puts "----- listing images owned by 'amazon' -----"
47
- ec2.describe_images(:owner_id => "amazon").imagesSet.item.each do |image|
48
- image.keys.each do |key|
49
- puts "#{key} => #{image[key]}"
50
- end
51
- end
52
-
53
- puts "----- listing all running instances -----"
54
- pp ec2.describe_instances()
55
-
56
- puts "----- creating a security group -----"
57
- pp ec2.create_security_group(:group_name => "ec2-example-rb-test-group", :group_description => "ec-example.rb test group description.")
58
-
59
- puts "----- listing security groups -----"
60
- pp ec2.describe_security_groups()
61
-
62
- puts "----- deleting a security group -----"
63
- pp ec2.delete_security_group(:group_name => "ec2-example-rb-test-group")
64
-
65
- puts "----- listing my keypairs (verbose mode) -----"
66
- pp ec2.describe_keypairs()
67
-
68
- # ELB examples
69
- # Autoscaling examples
70
- if ENV['ELB_URL']
71
- elb = AWS::ELB::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['ELB_URL']).host )
72
- else
73
- elb = AWS::ELB::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)
74
- end
75
-
76
- puts "----- creating an elastic load balancer -----"
77
- pp elb.create_load_balancer(
78
- :availability_zones => ["us-east-1a"],
79
- :load_balancer_name => "elb-test-load-balancer",
80
- :listeners => [{:protocol => "tcp", :load_balancer_port => "80", :instance_port => "8080"}]
81
- )
82
-
83
- puts "----- listing elastic load balancers -----"
84
- pp elb.describe_load_balancers(:load_balancer_names => ["elb-test-load-balancer"])
85
-
86
- puts "----- deleting load balancer -----"
87
- pp elb.delete_load_balancer(:load_balancer_name => "elb-test-load-balancer")
88
-
89
- # Autoscaling examples
90
- if ENV['AS_URL']
91
- as = AWS::Autoscaling::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY, :server => URI.parse(ENV['AS_URL']).host )
92
- else
93
- as = AWS::Autoscaling::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)
94
- end
95
-
96
- puts "---- creating a launch configuration group -----"
97
- pp as.create_launch_configuration(
98
- :image_id => "ami-ed46a784",
99
- :instance_type => "m1.small",
100
- :availability_zones => ["us-east-1a"],
101
- :launch_configuration_name => "ec2-example-test-launch-configuration"
102
- )
103
-
104
- puts "---- creating an autoscaling group -----"
105
- pp as.create_autoscaling_group( :autoscaling_group_name => "ec2-example-test-autoscaling-group",
106
- :availability_zones => ["us-east-1a"],
107
- :min_size => 0,
108
- :max_size => 0,
109
- :launch_configuration_name => "ec2-example-test-launch-configuration"
110
- )
111
-
112
- puts "---- listing autoscaling groups -----"
113
- pp as.describe_autoscaling_groups(:autoscaling_group_names => [])
114
-
115
- puts "---- creating a new autoscaling trigger ----"
116
- pp as.create_or_updated_scaling_trigger(
117
- :autoscaling_group_name => "ec2-example-test-autoscaling-group",
118
- :measure_name => "CPUUtilization",
119
- :statistic => "Average",
120
- :period => 300,
121
- :trigger_name => "test-auto-scaling-trigger-name",
122
- :lower_threshold => 0.2,
123
- :lower_breach_scale_increment => 0,
124
- :upper_threshold => 1.5,
125
- :upper_breach_scale_increment => 0,
126
- :breach_duration => 1200,
127
- :dimensions => ["AutoScalingGroupName", "ec2-example-test-autoscaling-group"]
128
- )
129
-
130
- puts "---- deleting scaling trigger -----"
131
- pp as.delete_trigger(:trigger_name => "test-auto-scaling-trigger-name", :autoscaling_group_name => "ec2-example-test-autoscaling-group")
132
-
133
- puts "---- deleting autoscaling group -----"
134
- pp as.delete_autoscaling_group(:autoscaling_group_name => "ec2-example-test-autoscaling-group")
135
-
136
- puts "---- deleting launch configuration group -----"
137
- pp as.delete_launch_configuration(:launch_configuration_name => "ec2-example-test-launch-configuration")
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Basic single command application that we can call with perftools.rb to get consistent results.
4
-
5
- require File.dirname(__FILE__) + '/../lib/AWS'
6
- ACCESS_KEY_ID = ENV['AMAZON_ACCESS_KEY_ID']
7
- SECRET_ACCESS_KEY = ENV['AMAZON_SECRET_ACCESS_KEY']
8
- ec2 = AWS::EC2::Base.new( :access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY )
9
- @images = ec2.describe_images
10
-
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Amazon Web Services EC2 Query API Ruby library
4
- #
5
- # Ruby Gem Name:: amazon-ec2
6
- # Author:: Glenn Rempe (mailto:glenn@rempe.us)
7
- # Copyright:: Copyright (c) 2007-2008 Glenn Rempe
8
- # License:: Distributes under the same terms as Ruby
9
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
10
- #++
11
-
12
- # CREDITS : Credit for this bit of shameful ripoff coolness
13
- # goes to Marcel Molina and his AWS::S3 gem. Thanks!
14
-
15
- # Usage : running this starts up an irb session and
16
- # sets up the connection to EC2 as a class variable called
17
- # '@ec2'. So just do something like the following on the
18
- # shell command line:
19
-
20
- # macbook-pro:~ glenn$ ec2sh
21
- # >> @ec2.describe_images
22
- # => [#<AWS::EC2::Item image_location...
23
-
24
- aws_lib = File.dirname(__FILE__) + '/../lib/AWS'
25
- setup = File.dirname(__FILE__) + '/setup'
26
- irb_name = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'
27
-
28
- if ( ENV['AMAZON_ACCESS_KEY_ID'] && ENV['AMAZON_SECRET_ACCESS_KEY'] )
29
-
30
- welcome_message = <<-MESSAGE
31
-
32
- 'ec2sh' usage :
33
- This is an interactive 'irb' command shell that allows you to use all
34
- commands available to the amazon-ec2 gem. You'll find this to be a
35
- great tool to help you debug issues and practice running commands
36
- against the live EC2 servers prior to putting them in your code.
37
-
38
- The EC2 connection is wired to the class instance '@ec2'. Make method calls
39
- on this to execute commands on EC2. Adding a #to_s
40
- at the end of any command should give you a full String representation of the
41
- response.
42
-
43
- Examples to try:
44
-
45
- returns : all ec2 public methods
46
- >> @ec2.methods.sort
47
-
48
- returns : a string representation of ALL images
49
- >> @ec2.describe_images.to_s
50
-
51
- returns : an Array of AWS::Response objects, each an EC2 image and its data
52
- >> @ec2.describe_images.imagesSet.item
53
- >> @ec2.describe_images.imagesSet.item[0] (a hash representing a single item in that array)
54
- >> @ec2.describe_images.imagesSet.item[0].to_s (a String representation of that item)
55
-
56
- MESSAGE
57
-
58
- puts welcome_message
59
- exec "#{irb_name} -rubygems -r #{aws_lib} -r #{setup} --simple-prompt"
60
- else
61
- puts "You must define AMAZON_ACCESS_KEY_ID and AMAZON_SECRET_ACCESS_KEY as shell environment variables before running #{$0}!"
62
- end
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Amazon Web Services EC2 Query API Ruby library
4
- #
5
- # Ruby Gem Name:: amazon-ec2
6
- # Author:: Glenn Rempe (mailto:glenn@rempe.us)
7
- # Copyright:: Copyright (c) 2007-2008 Glenn Rempe
8
- # License:: Distributes under the same terms as Ruby
9
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
10
- #++
11
-
12
- if ENV['AMAZON_ACCESS_KEY_ID'] && ENV['AMAZON_SECRET_ACCESS_KEY']
13
- opts = {
14
- :access_key_id => ENV['AMAZON_ACCESS_KEY_ID'],
15
- :secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
16
- }
17
- if ENV['EC2_URL']
18
- opts[:server] = URI.parse(ENV['EC2_URL']).host
19
- end
20
- @ec2 = AWS::EC2::Base.new(opts)
21
- @elb = AWS::ELB::Base.new(opts)
22
- @as = AWS::Autoscaling::Base.new(opts)
23
- @rds = AWS::RDS::Base.new(opts)
24
- end
25
-
26
- puts "EC2 Server: #{opts[:server]}"
27
-
28
- include AWS
29
-
@@ -1 +0,0 @@
1
- xml-simple 1.0.12
@@ -1,273 +0,0 @@
1
- module AWS
2
- module Autoscaling
3
- class Base < AWS::Base
4
-
5
- # Create a launch configuration
6
- # Creates a new Launch Configuration. Please note that the launch configuration name used must be unique, within the scope of your AWS account, and the maximum limit of launch configurations must not yet have been met, or else the call will fail.
7
- # Once created, the new launch configuration is available for immediate use.
8
- #
9
- # @option options [String] :launch_configuration_name (nil) the name of the launch configuration
10
- # @option options [String] :image_id (nil) the image id to use with this launch configuration
11
- # @option options [String] :instance_type (nil) the type of instance to launch
12
- # @option options [Array] :security_groups (nil) the names of security_groups to launch within
13
- # @option options [String] :key_name (nil) the name of the EC2 key pair
14
- # @option options [String] :user_data (nil) the user data available to the launched EC2 instances
15
- # @option options [String] :kernel_id (nil) the ID of the kernel associated with the EC2 ami
16
- # @option options [String] :ramdisk_id (nil) the name of the RAM disk associated with the EC2 ami
17
- # @option options [Array] :block_device_mappings (nil) specifies how block devices are exposed to the instance
18
- def create_launch_configuration( options = {})
19
- raise ArgumentError, "No :image_id provided" if options[:image_id].nil? || options[:image_id].empty?
20
- raise ArgumentError, "No :launch_configuration_name provided" if options[:launch_configuration_name].nil? || options[:launch_configuration_name].empty?
21
- raise ArgumentError, "No :instance_type provided" if options[:instance_type].nil? || options[:instance_type].empty?
22
-
23
- params = {}
24
- params["ImageId"] = options[:image_id]
25
- params["KeyName"] = options[:key_name] if options[:key_name]
26
- params["LaunchConfigurationName"] = options[:launch_configuration_name]
27
- params.merge!(pathlist('SecurityGroups.member', [options[:security_groups]].flatten)) if options[:security_groups]
28
- params["UserData"] = options[:user_data] if options[:user_data]
29
- params["InstanceType"] = options[:instance_type] if options[:instance_type]
30
- params["KernelId"] = options[:kernel_id] if options[:kernel_id]
31
- params["RamdiskId"] = options[:ramdisk_id] if options[:ramdisk_id]
32
- params.merge!(pathlist('BlockDeviceMappings.member', [options[:block_device_mappings]].flatten)) if options[:block_device_mappings]
33
-
34
- return response_generator(:action => "CreateLaunchConfiguration", :params => params)
35
- end
36
-
37
- # Creates a new AutoScalingGroup with the specified name.
38
- # You must not have already used up your entire quota of AutoScalingGroups in order for this call to be successful. Once the creation request is completed, the AutoScalingGroup is ready to be used in other calls.
39
- #
40
- # @option options [String] :autoscaling_group_name (nil) the name of the autoscaling group
41
- # @option options [Array] :availability_zones (nil) The availability_zones for the group
42
- # @option options [String] :launch_configuration_name (nil) the name of the launch_configuration group
43
- # @option options [String] :min_size (nil) minimum size of the group
44
- # @option options [String] :max_size (nil) the maximum size of the group
45
- # @option options [optional,Array] :load_balancer_names (nil) the names of the load balancers
46
- # @option options [optional,String] :cooldown (nil) the amount of time after a scaling activity complese before any further trigger-related scaling activities can start
47
- def create_autoscaling_group( options = {} )
48
- raise ArgumentError, "No :autoscaling_group_name provided" if options[:autoscaling_group_name].nil? || options[:autoscaling_group_name].empty?
49
- raise ArgumentError, "No :availability_zones provided" if options[:availability_zones].nil? || options[:availability_zones].empty?
50
- raise ArgumentError, "No :launch_configuration_name provided" if options[:launch_configuration_name].nil? || options[:launch_configuration_name].empty?
51
- raise ArgumentError, "No :min_size provided" if options[:min_size].nil?
52
- raise ArgumentError, "No :max_size provided" if options[:max_size].nil?
53
-
54
- params = {}
55
-
56
- params.merge!(pathlist('AvailabilityZones.member', [options[:availability_zones]].flatten))
57
- params['LaunchConfigurationName'] = options[:launch_configuration_name]
58
- params['AutoScalingGroupName'] = options[:autoscaling_group_name]
59
- params['MinSize'] = options[:min_size].to_s
60
- params['MaxSize'] = options[:max_size].to_s
61
- params.merge!(pathlist("LoadBalancerNames.member", [options[:load_balancer_names]].flatten)) if options.has_key?(:load_balancer_names)
62
- params['CoolDown'] = options[:cooldown] if options[:cooldown]
63
-
64
- return response_generator(:action => "CreateAutoScalingGroup", :params => params)
65
- end
66
-
67
- # Create or update scaling trigger
68
- # This call sets the parameters that governs when and how to scale an AutoScalingGroup.
69
- #
70
- # @option options [String] :autoscaling_group_name (nil) the name of the autoscaling group
71
- # @option options [Array|Hash] :dimensions (nil) The dimensions associated with the metric used by the trigger to determine whether to activate
72
- # This must be given as either an array or a hash
73
- # When called as a hash, the values must look like: {:name => "name", :value => "value"}
74
- # In the array format, the first value is assumed to be the name and the second is assumed to be the value
75
- # @option options [String] :measure_name (nil) the measure name associated with the metric used by the trigger
76
- # @option options [String|Integer] :period (nil) the period associated with the metric in seconds
77
- # @option options [String] :statistic (nil) The particular statistic used by the trigger when fetching metric statistics to examine. Must be one of the following: Minimum, Maximum, Sum, Average
78
- # @option options [String] :trigger_name (nil) the name for this trigger
79
- # @option options [String] :unit (nil) the standard unit of measurement for a given measure
80
- # @option options [String|Integer] :lower_threshold (nil) the lower limit for the metric. If all datapoints in the last :breach_duration seconds fall below the lower threshold, the trigger will activate
81
- # @option options [String|Integer] :lower_breach_scale_increment (nil) the incremental amount to use when performing scaling activities when the lower threshold has been breached
82
- # @option options [String|Integer] :upper_threshold (nil) the upper limit for the metric. If all datapoints in the last :breach_duration seconds exceed the upper threshold, the trigger will activate
83
- # @option options [String|Integer] :upper_breach_scale_increment (nil) the incremental amount to use when performing scaling activities when the upper threshold has been breached
84
- def create_or_updated_scaling_trigger( options = {} )
85
- if options[:dimensions].nil? || options[:dimensions].empty?
86
- raise ArgumentError, "No :dimensions provided"
87
- end
88
- raise ArgumentError, "No :autoscaling_group_name provided" if options[:autoscaling_group_name].nil? || options[:autoscaling_group_name].empty?
89
- raise ArgumentError, "No :measure_name provided" if options[:measure_name].nil? || options[:measure_name].empty?
90
- raise ArgumentError, "No :statistic provided" if options[:statistic].nil? || options[:statistic].empty?
91
- raise ArgumentError, "No :period provided" if options[:period].nil?
92
- raise ArgumentError, "No :trigger_name provided" if options[:trigger_name].nil? || options[:trigger_name].empty?
93
- raise ArgumentError, "No :lower_threshold provided" if options[:lower_threshold].nil?
94
- raise ArgumentError, "No :lower_breach_scale_increment provided" if options[:lower_breach_scale_increment].nil?
95
- raise ArgumentError, "No :upper_threshold provided" if options[:upper_threshold].nil?
96
- raise ArgumentError, "No :upper_breach_scale_increment provided" if options[:upper_breach_scale_increment].nil?
97
- raise ArgumentError, "No :breach_duration provided" if options[:breach_duration].nil?
98
- statistic_option_list = %w(minimum maximum average sum)
99
- unless statistic_option_list.include?(options[:statistic].downcase)
100
-
101
- raise ArgumentError, "The statistic option must be one of the following: #{statistic_option_list.join(", ")}"
102
- end
103
-
104
- params = {}
105
- params['Unit'] = options[:unit] || "Seconds"
106
- params['AutoScalingGroupName'] = options[:autoscaling_group_name]
107
- case options[:dimensions]
108
- when Array
109
- params["Dimensions.member.1.Name"] = options[:dimensions][0]
110
- params["Dimensions.member.1.Value"] = options[:dimensions][1]
111
- when Hash
112
- params["Dimensions.member.1.Name"] = options[:dimensions][:name]
113
- params["Dimensions.member.1.Value"] = options[:dimensions][:value]
114
- else
115
- raise ArgumentError, "Dimensionss must be either an array or a hash"
116
- end
117
- params['MeasureName'] = options[:measure_name]
118
- params['Statistic'] = options[:statistic]
119
- params['Period'] = options[:period].to_s
120
- params['TriggerName'] = options[:trigger_name]
121
- params['LowerThreshold'] = options[:lower_threshold].to_s
122
- params['LowerBreachScaleIncrement'] = options[:lower_breach_scale_increment].to_s
123
- params['UpperThreshold'] = options[:upper_threshold].to_s
124
- params['UpperBreachScaleIncrement'] = options[:upper_breach_scale_increment].to_s
125
- params['BreachDuration'] = options[:breach_duration].to_s
126
-
127
- return response_generator(:action => "CreateOrUpdateScalingTrigger", :params => params)
128
- end
129
-
130
- # Deletes all configuration for this AutoScalingGroup and also deletes the group.
131
- # In order to successfully call this API, no triggers (and therefore, Scaling Activity) can be currently in progress. Once this call successfully executes, no further triggers will begin and the AutoScalingGroup will not be available for use in other API calls. See key term Trigger.
132
- #
133
- # @option options [String] :autoscaling_group_name (nil) the name of the autoscaling group
134
- def delete_autoscaling_group( options = {} )
135
- raise ArgumentError, "No :autoscaling_group_name provided" if options[:autoscaling_group_name].nil? || options[:autoscaling_group_name].empty?
136
- params = { 'AutoScalingGroupName' => options[:autoscaling_group_name] }
137
- return response_generator(:action => "DeleteAutoScalingGroup", :params => params)
138
- end
139
-
140
- # Deletes the given Launch Configuration.
141
- # The launch configuration to be deleted must not be currently attached to any AutoScalingGroup. Once this call completes, the launch configuration is no longer available for use by any other API call.
142
- #
143
- # @option options [String] :launch_configuration_name (nil) the name of the launch_configuration
144
- def delete_launch_configuration( options = {} )
145
- raise ArgumentError, "No :launch_configuration_name provided" if options[:launch_configuration_name].nil? || options[:launch_configuration_name].empty?
146
- params = { 'LaunchConfigurationName' => options[:launch_configuration_name] }
147
- return response_generator(:action => "DeleteLaunchConfiguration", :params => params)
148
- end
149
-
150
- # Deletes the given trigger
151
- # If a trigger is currently in progress, it will continue to run until its activities are complete.
152
- #
153
- # @option options [String] :trigger_name (nil) the name of the trigger to delete
154
- def delete_trigger( options = {} )
155
- raise ArgumentError, "No :trigger_name provided" if options[:trigger_name].nil? || options[:trigger_name].empty?
156
- raise ArgumentError, "No :autoscaling_group_name provided" if options[:autoscaling_group_name].nil? || options[:autoscaling_group_name].empty?
157
- params = { 'TriggerName' => options[:trigger_name], 'AutoScalingGroupName' => options[:autoscaling_group_name] }
158
- return response_generator(:action => "DeleteTrigger", :params => params)
159
- end
160
-
161
- # Describe autoscaling group
162
- # Returns a full description of the AutoScalingGroups from the given list. This includes all EC2 instances that are members of the group. If a list of names is not provided, then the full details of all AutoScalingGroups is returned. This style conforms to the EC2 DescribeInstances API behavior. See key term AutoScalingGroup.
163
- #
164
- # @option options [Array] :autoscaling_group_names (nil) the name of the autoscaling groups to describe
165
- def describe_autoscaling_groups( options = {} )
166
- options = { :autoscaling_group_names => [] }.merge(options)
167
- params = pathlist("AutoScalingGroupNames.member", options[:autoscaling_group_names])
168
- return response_generator(:action => "DescribeAutoScalingGroups", :params => params)
169
- end
170
-
171
- # Describe launch configurations
172
- # Returns a full description of the launch configurations given the specified names. If no names are specified, then the full details of all launch configurations are returned. See key term Launch Configuration.
173
- #
174
- # @option options [Array] :launch_configuration_names (nil) the name of the launch_configurations to describe
175
- def describe_launch_configurations( options = {} )
176
- options = { :launch_configuration_names => [] }.merge(options)
177
- params = pathlist("AutoScalingGroupNames.member", options[:launch_configuration_names])
178
- params['MaxRecords'] = options[:max_records].to_s if options.has_key?(:max_records)
179
- return response_generator(:action => "DescribeLaunchConfigurations", :params => params)
180
- end
181
-
182
- # Describe autoscaling activities
183
- # Returns the scaling activities specified for the given group. If the input list is empty, all the activities from the past six weeks will be returned. Activities will be sorted by completion time. Activities that have no completion time will be considered as using the most recent possible time. See key term Scaling Activity.
184
- #
185
- # @option options [String] :autoscaling_group_name (nil) the name of the autoscaling_group_name
186
- # @option options [String] :max_records (nil) the maximum number of scaling activities to return
187
- # @option options [String] :launch_configuration_names (nil) activity_ids to return
188
- def describe_scaling_activities( options = {} )
189
- raise ArgumentError, "No :autoscaling_group_name provided" if options[:autoscaling_group_name].nil? || options[:autoscaling_group_name].empty?
190
-
191
- params = {}
192
- params['AutoScalingGroupName'] = options[:autoscaling_group_name]
193
- params['MaxRecords'] = options[:max_records] if options.has_key?(:max_records)
194
- params['ActivityIds'] = options[:activity_ids] if options.has_key?(:activity_ids)
195
- return response_generator(:action => "DescribeScalingActivities", :params => params)
196
- end
197
-
198
- # Describe triggers
199
- # Returns a full description of the trigger (see Trigger), in the specified AutoScalingGroup.
200
- #
201
- # @option options [String] :autoscaling_group_name (nil) the name of the autoscaling_group_name
202
- def describe_triggers( options = {} )
203
- raise ArgumentError, "No :autoscaling_group_name provided" if options[:autoscaling_group_name].nil? || options[:autoscaling_group_name].empty?
204
- params = {}
205
- params['AutoScalingGroupName'] = options[:autoscaling_group_name]
206
-
207
- return response_generator(:action => "DescribeTriggers", :params => params)
208
- end
209
-
210
- # Set desired capacity
211
- # This API adjusts the desired size of the AutoScalingGroup by initiating scaling activities, as necessary. When adjusting the size of the group downward, it is not possible to define which EC2 instances will be terminated. This applies to any auto-scaling decisions that might result in the termination of instances.
212
- # To check the scaling status of the system, query the desired capacity using DescribeAutoScalingGroups and then query the actual capacity using DescribeAutoScalingGroups and looking at the instance lifecycle state in order to understand how close the system is to the desired capacity at any given time.
213
- #
214
- # @option options [String] :autoscaling_group_name (nil) the name of the autoscaling_group_name
215
- # @option options [String] :desired_capacity (nil) the new capacity setting for the group
216
- def set_desired_capacity( options = {} )
217
- raise ArgumentError, "No :autoscaling_group_name provided" if options[:autoscaling_group_name].nil? || options[:autoscaling_group_name].empty?
218
- raise ArgumentError, "No :desired_capacity provided" if options[:desired_capacity].nil? || options[:desired_capacity].empty?
219
-
220
- params = {}
221
- params['AutoScalingGroupName'] = options[:autoscaling_group_name]
222
- params['DesiredCapacity'] = options[:desired_capacity].to_s
223
-
224
- return response_generator(:action => "SetDesiredCapacity", :params => params)
225
- end
226
-
227
-
228
- # Terminate instance in an autoscaling group
229
- # This call will terminate the specified Instance. Optionally, the desired group size can be adjusted. If set to true, the default, the AutoScalingGroup size will decrease by one. If the AutoScalingGroup is associated with a LoadBalancer, the system will deregister the instance before terminating it.
230
- # This call simply registers a termination request. The termination of the instance can not happen immediately.
231
- #
232
- # @option options [String] :instance_id (nil) the instance id to terminate
233
- # @option options [String] :decrement_desired_capacity (nil) specified whether terminating this instance should also decrement the size of the autoscaling group
234
- def terminate_instance_in_autoscaling_group( options = {} )
235
- raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
236
-
237
- params = {}
238
- params['InstanceId'] = options[:instance_id]
239
- params['ShouldDecrementDesiredCapacity'] = options[:decrement_desired_capacity].to_s if options.has_key?(:decrement_desired_capacity)
240
-
241
- return response_generator(:action => "TerminateInstanceInAutoScalingGroup", :params => params)
242
- end
243
-
244
- # Creates a new AutoScalingGroup with the specified name.
245
- # Updates the configuration for the given AutoScalingGroup. If MaxSize is lower than the current size, then there will be an implicit call to SetDesiredCapacity to set the group to the new MaxSize. The same is true for MinSize there will also be an implicit call to SetDesiredCapacity. All optional parameters are left unchanged if not passed in the request.=
246
- # The new settings are registered upon the completion of this call. Any launch configuration settings will take effect on any triggers after this call returns. However, triggers that are currently in progress can not be affected. See key term Trigger.
247
- #
248
- # @option options [String] :autoscaling_group_name (nil) the name of the autoscaling group
249
- # @option options [Array] :availability_zones (nil) The availability_zones for the group
250
- # @option options [String] :launch_configuration_name (nil) the name of the launch_configuration group
251
- # @option options [String] :min_size (nil) minimum size of the group
252
- # @option options [String] :max_size (nil) the maximum size of the group
253
- # @option options [String] :cooldown (nil) the amount of time after a scaling activity complese before any further trigger-related scaling activities can start
254
- def update_autoscaling_group( options = {})
255
- raise ArgumentError, "No :autoscaling_group_name provided" if options[:autoscaling_group_name].nil? || options[:autoscaling_group_name].empty?
256
-
257
- params = {}
258
-
259
- params.merge!(pathlist('AvailabilityZones.member', [options[:availability_zones]].flatten)) if options.has_key?(:availability_zones)
260
- params['LaunchConfigurationName'] = options[:launch_configuration_name] if options.has_key?(:launch_configuration_name)
261
- params['AutoScalingGroupName'] = options[:autoscaling_group_name]
262
- params['MinSize'] = options[:min_size] if options.has_key?(:min_size)
263
- params['MaxSize'] = options[:max_size] if options.has_key?(:max_size)
264
- params['CoolDown'] = options[:cooldown] if options.has_key?(:cooldown)
265
-
266
- return response_generator(:action => "UpdateAutoScalingGroup", :params => params)
267
-
268
- end
269
-
270
- end
271
- end
272
- end
273
-
@@ -1,70 +0,0 @@
1
- module AWS
2
- module Autoscaling
3
- # Which host FQDN will we connect to for all API calls to AWS?
4
- # If AS_URL is defined in the users ENV we can override the default with that.
5
- #
6
- # @example
7
- # export AS_URL='http://autoscaling.amazonaws.com'
8
- if ENV['AS_URL']
9
- AS_URL = ENV['AS_URL']
10
- VALID_HOSTS = ['http://autoscaling.amazonaws.com']
11
- raise ArgumentError, "Invalid AS_URL environment variable : #{AS_URL}" unless VALID_HOSTS.include?(AS_URL)
12
- DEFAULT_HOST = URI.parse(AS_URL).host
13
- else
14
- # Default US API endpoint
15
- DEFAULT_HOST = 'autoscaling.amazonaws.com'
16
- end
17
-
18
- API_VERSION = '2009-05-15'
19
-
20
- class Base < AWS::Base
21
- def api_version
22
- API_VERSION
23
- end
24
-
25
- def default_host
26
- DEFAULT_HOST
27
- end
28
-
29
- # Raises the appropriate error if the specified Net::HTTPResponse object
30
- # contains an Amazon EC2 error; returns +false+ otherwise.
31
- def aws_error?(response)
32
-
33
- # return false if we got a HTTP 200 code,
34
- # otherwise there is some type of error (40x,50x) and
35
- # we should try to raise an appropriate exception
36
- # from one of our exception classes defined in
37
- # exceptions.rb
38
- return false if response.is_a?(Net::HTTPSuccess)
39
-
40
- # parse the XML document so we can walk through it
41
- doc = REXML::Document.new(response.body)
42
-
43
- # Check that the Error element is in the place we would expect.
44
- # and if not raise a generic error exception
45
- unless doc.root.elements[1].name == "Error"
46
- raise Error, "Unexpected error format. response.body is: #{response.body}"
47
- end
48
-
49
- # An valid error response looks like this:
50
- # <?xml version="1.0"?><Response><Errors><Error><Code>InvalidParameterCombination</Code><Message>Unknown parameter: foo</Message></Error></Errors><RequestID>291cef62-3e86-414b-900e-17246eccfae8</RequestID></Response>
51
- # AWS EC2 throws some exception codes that look like Error.SubError. Since we can't name classes this way
52
- # we need to strip out the '.' in the error 'Code' and we name the error exceptions with this
53
- # non '.' name as well.
54
- error_code = doc.root.elements['//ErrorResponse/Error/Code'].text.gsub('.', '')
55
- error_message = doc.root.elements['//ErrorResponse/Error/Message'].text
56
-
57
- # Raise one of our specific error classes if it exists.
58
- # otherwise, throw a generic EC2 Error with a few details.
59
- if AWS.const_defined?(error_code)
60
- raise AWS.const_get(error_code), error_message
61
- else
62
- raise AWS::Error, error_message
63
- end
64
-
65
- end
66
-
67
- end
68
-
69
- end
70
- end