amazon-ec2 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,31 +1,12 @@
1
- #--
2
- # Amazon Web Services EC2 Query API Ruby library, EBS snaphshots support
3
- #
4
- # Ruby Gem Name:: amazon-ec2
5
- # Author:: Yann Klis (mailto:yann.klis@novelys.com)
6
- # Copyright:: Copyright (c) 2008 Yann Klis
7
- # License:: Distributes under the same terms as Ruby
8
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
- #++
10
-
11
1
  module AWS
12
2
  module EC2
13
3
 
14
4
  class Base < AWS::Base
15
5
 
16
- #Amazon Developer Guide Docs:
17
- #
18
6
  # The DescribeSnapshots operation describes the status of Amazon EBS snapshots.
19
7
  #
20
- #Required Arguments:
21
- #
22
- # none
23
- #
24
- #Optional Arguments:
25
- #
26
- # :snapshot_id => Array (default : [])
8
+ # @option options [Array] :snapshot_id ([])
27
9
  #
28
-
29
10
  def describe_snapshots( options = {} )
30
11
 
31
12
  options = { :snapshot_id => [] }.merge(options)
@@ -36,22 +17,12 @@ module AWS
36
17
 
37
18
  end
38
19
 
39
- #Amazon Developer Guide Docs:
40
- #
41
20
  # The CreateSnapshot operation creates a snapshot of an Amazon EBS volume and stores it in Amazon S3. You can use snapshots for backups, to launch instances from identical snapshots, and to save data before shutting down an instance.
42
21
  #
43
- #Required Arguments:
44
- #
45
- # :volume_id => String (default : '')
46
- #
47
- #Optional Arguments:
22
+ # @option options [String] :volume_id ('')
48
23
  #
49
- # none
50
- #
51
-
52
24
  def create_snapshot( options = {} )
53
25
 
54
- # defaults
55
26
  options = { :volume_id => '' }.merge(options)
56
27
 
57
28
  raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
@@ -64,19 +35,11 @@ module AWS
64
35
 
65
36
  end
66
37
 
67
- #Amazon Developer Guide Docs:
68
- #
38
+
69
39
  # The DeleteSnapshot operation deletes a snapshot of an Amazon EBS volume that is stored in Amazon S3.
70
40
  #
71
- #Required Arguments:
41
+ # @option options [String] :snapshot_id ('')
72
42
  #
73
- # :snapshot_id => String (default : '')
74
- #
75
- #Optional Arguments:
76
- #
77
- # none
78
- #
79
-
80
43
  def delete_snapshot( options = {} )
81
44
 
82
45
  options = { :snapshot_id => '' }.merge(options)
@@ -1,55 +1,23 @@
1
- #--
2
- # Amazon Web Services EC2 Query API Ruby library, EBS volumes support
3
- #
4
- # Ruby Gem Name:: amazon-ec2
5
- # Author:: Yann Klis (mailto:yann.klis@novelys.com)
6
- # Copyright:: Copyright (c) 2008 Yann Klis
7
- # License:: Distributes under the same terms as Ruby
8
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
- #++
10
-
11
1
  module AWS
12
2
  module EC2
13
-
14
3
  class Base < AWS::Base
15
4
 
16
- #Amazon Developer Guide Docs:
17
- #
18
5
  # The DescribeVolumes operation lists one or more Amazon EBS volumes that you own, If you do not specify any volumes, Amazon EBS returns all volumes that you own.
19
6
  #
20
- #Required Arguments:
21
- #
22
- # none
23
- #
24
- #Optional Arguments:
7
+ # @option options [optional, String] :volume_id ([])
25
8
  #
26
- # :volume_id => Array (default : [])
27
- #
28
-
29
9
  def describe_volumes( options = {} )
30
-
31
10
  options = { :volume_id => [] }.merge(options)
32
-
33
11
  params = pathlist("VolumeId", options[:volume_id] )
34
-
35
12
  return response_generator(:action => "DescribeVolumes", :params => params)
36
-
37
13
  end
38
14
 
39
- #Amazon Developer Guide Docs:
40
- #
41
15
  # The CreateVolume operation creates a new Amazon EBS volume that you can mount from any Amazon EC2 instance.
42
16
  #
43
- #Required Arguments:
44
- #
45
- # :availability_zone => String (default : '')
17
+ # @option options [String] :availability_zone ('')
18
+ # @option options [optional, String] :size ('')
19
+ # @option options [optional, String] :snapshot_id ('')
46
20
  #
47
- #Optional Arguments:
48
- #
49
- # :size => String (default : '')
50
- # :snapshot_id => String (default : '')
51
- #
52
-
53
21
  def create_volume( options = {} )
54
22
 
55
23
  # defaults
@@ -70,19 +38,10 @@ module AWS
70
38
 
71
39
  end
72
40
 
73
- #Amazon Developer Guide Docs:
74
- #
75
41
  # The DeleteVolume operation deletes an Amazon EBS volume.
76
42
  #
77
- #Required Arguments:
43
+ # @option options [String] :volume_id ('')
78
44
  #
79
- # :volume_id => String (default : '')
80
- #
81
- #Optional Arguments:
82
- #
83
- # none
84
- #
85
-
86
45
  def delete_volume( options = {} )
87
46
 
88
47
  options = { :volume_id => '' }.merge(options)
@@ -97,21 +56,12 @@ module AWS
97
56
 
98
57
  end
99
58
 
100
- #Amazon Developer Guide Docs:
101
- #
102
59
  # The AttachVolume operation attaches an Amazon EBS volume to an instance.
103
60
  #
104
- #Required Arguments:
61
+ # @option options [String] :volume_id ('')
62
+ # @option options [String] :instance_id ('')
63
+ # @option options [String] :device ('')
105
64
  #
106
- # :volume_id => String (default : '')
107
- # :instance_id => String (default : '')
108
- # :device => String (default : '')
109
- #
110
- #Optional Arguments:
111
- #
112
- # none
113
- #
114
-
115
65
  def attach_volume( options = {} )
116
66
 
117
67
  options = { :volume_id => '' }.merge(options)
@@ -132,21 +82,13 @@ module AWS
132
82
 
133
83
  end
134
84
 
135
- #Amazon Developer Guide Docs:
136
- #
137
85
  # The DetachVolume operation detaches an Amazon EBS volume from an instance.
138
86
  #
139
- #Required Arguments:
140
- #
141
- # :volume_id => String (default : '')
142
- #
143
- #Optional Arguments:
144
- #
145
- # :instance_id => String (default : '')
146
- # :device => String (default : '')
147
- # :force => Boolean (default : '')
87
+ # @option options [String] :volume_id ('')
88
+ # @option options [optional, String] :instance_id ('')
89
+ # @option options [optional, String] :device ('')
90
+ # @option options [optional, Boolean] :force ('')
148
91
  #
149
-
150
92
  def detach_volume( options = {} )
151
93
 
152
94
  options = { :volume_id => '' }.merge(options)
@@ -165,8 +107,9 @@ module AWS
165
107
  }
166
108
 
167
109
  return response_generator(:action => "DetachVolume", :params => params)
168
-
169
110
  end
111
+
170
112
  end
171
113
  end
172
- end
114
+ end
115
+
data/lib/AWS/ELB.rb CHANGED
@@ -1,58 +1,23 @@
1
- #--
2
- # Amazon Web Services EC2 Query API Ruby library
3
- #
4
- # Ruby Gem Name:: amazon-ec2
5
- # Author:: Glenn Rempe (mailto:glenn@rempe.us)
6
- # Copyright:: Copyright (c) 2007-2008 Glenn Rempe
7
- # License:: Distributes under the same terms as Ruby
8
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
- #++
10
-
11
- # Require any lib files that we have bundled with this Ruby Gem in the lib/EC2 directory.
12
- # Parts of the EC2 module and Base class are broken out into separate
13
- # files for maintainability and are organized by the functional groupings defined
14
- # in the EC2 API developers guide.
15
- Dir[File.join(File.dirname(__FILE__), 'ELB/**/*.rb')].sort.each { |lib| require lib }
16
-
17
1
  module AWS
18
2
  module ELB
19
3
 
20
4
  # Which host FQDN will we connect to for all API calls to AWS?
21
- # If ELB_URL is defined in the users ENV we can use that. It is
22
- # expected that this var is set with something like:
23
- # export ELB_URL='https://ec2.amazonaws.com'
24
- #
5
+ # If ELB_URL is defined in the users ENV we can override the default with that.
6
+ #
7
+ # @example
8
+ # export ELB_URL='https://elasticloadbalancing.amazonaws.com'
25
9
  if ENV['ELB_URL']
26
10
  ELB_URL = ENV['ELB_URL']
27
11
  VALID_HOSTS = ['elasticloadbalancing.amazonaws.com']
28
12
  raise ArgumentError, "Invalid ELB_URL environment variable : #{ELB_URL}" unless VALID_HOSTS.include?(ELB_URL)
29
13
  DEFAULT_HOST = URI.parse(ELB_URL).host
30
14
  else
31
- # default US host
15
+ # Default US API endpoint
32
16
  DEFAULT_HOST = 'elasticloadbalancing.amazonaws.com'
33
17
  end
34
18
 
35
- # This is the version of the API as defined by Amazon Web Services
36
19
  API_VERSION = '2009-05-15'
37
20
 
38
- #Introduction:
39
- #
40
- # The library exposes one main interface class, 'AWS::ELB::Base'.
41
- # This class provides all the methods for using the ELB service
42
- # including the handling of header signing and other security issues .
43
- # This class uses Net::HTTP to interface with the ELB Query API interface.
44
- #
45
- #Required Arguments:
46
- #
47
- # :access_key_id => String (default : "")
48
- # :secret_access_key => String (default : "")
49
- #
50
- #Optional Arguments:
51
- #
52
- # :use_ssl => Boolean (default : true)
53
- # :server => String (default : 'elasticloadbalancing.amazonaws.com')
54
- # :proxy_server => String (default : nil)
55
- #
56
21
  class Base < AWS::Base
57
22
  def api_version
58
23
  API_VERSION
@@ -1,8 +1,7 @@
1
1
  module AWS
2
2
  module ELB
3
3
  class Base < AWS::Base
4
- # Amazon Developer Guide Docs:
5
- #
4
+
6
5
  # This API creates a new LoadBalancer. Once the call has completed
7
6
  # successfully, a new LoadBalancer will be created, but it will not be
8
7
  # usable until at least one instance has been registered. When the
@@ -10,12 +9,10 @@ module AWS
10
9
  # by using the DescribeInstanceHealth API. The LoadBalancer is usable as
11
10
  # soon as any registered instance is InService.
12
11
  #
13
- # Required Arguments:
14
- #
15
- # :load_balancer_name => String
16
- # :availability_zones => Array
17
- # :listeners => Array of Hashes (:protocol, :load_balancer_port, :instance_port)
18
- # :availability_zones => Array of Strings
12
+ # @option options [String] :load_balancer_name (nil) the name of the load balancer
13
+ # @option options [Array] :availability_zones (nil)
14
+ # @option options [Array] :listeners (nil) An Array of Hashes (:protocol, :load_balancer_port, :instance_port)
15
+ # @option options [Array] :availability_zones (nil) An Array of Strings
19
16
  #
20
17
  def create_load_balancer( options = {} )
21
18
  raise ArgumentError, "No :availability_zones provided" if options[:availability_zones].nil? || options[:availability_zones].empty?
@@ -35,8 +32,6 @@ module AWS
35
32
  return response_generator(:action => "CreateLoadBalancer", :params => params)
36
33
  end
37
34
 
38
- # Amazon Developer Guide Docs:
39
- #
40
35
  # This API deletes the specified LoadBalancer. On deletion, all of the
41
36
  # configured properties of the LoadBalancer will be deleted. If you
42
37
  # attempt to recreate the LoadBalancer, you need to reconfigure all the
@@ -47,20 +42,14 @@ module AWS
47
42
  # get the same DNS name even if you create a new LoadBalancer with same
48
43
  # LoadBalancerName.
49
44
  #
50
- # Required Arguments:
51
- #
52
- # :load_balancer_name => String
45
+ # @option options [String] :load_balancer_name the name of the load balancer
53
46
  #
54
47
  def delete_load_balancer( options = {} )
55
48
  raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
56
-
57
49
  params = { 'LoadBalancerName' => options[:load_balancer_name] }
58
-
59
50
  return response_generator(:action => "DeleteLoadBalancer", :params => params)
60
51
  end
61
52
 
62
- # Amazon Developer Guide Docs:
63
- #
64
53
  # This API returns detailed configuration information for the specified
65
54
  # LoadBalancers, or if no LoadBalancers are specified, then the API
66
55
  # returns configuration information for all LoadBalancers created by the
@@ -71,20 +60,14 @@ module AWS
71
60
  # this API, you must provide the same account credentials as those that
72
61
  # were used to create the LoadBalancer.
73
62
  #
74
- # Optional Arguments:
75
- #
76
- # :load_balancer_names => String
63
+ # @option options [Array<String>] :load_balancer_names ([]) An Array of names of load balancers to describe.
77
64
  #
78
65
  def describe_load_balancers( options = {} )
79
66
  options = { :load_balancer_names => [] }.merge(options)
80
-
81
67
  params = pathlist("LoadBalancerName.member", options[:load_balancer_names])
82
-
83
68
  return response_generator(:action => "DescribeLoadBalancers", :params => params)
84
69
  end
85
70
 
86
- # Amazon Developer Guide Docs:
87
- #
88
71
  # This API adds new instances to the LoadBalancer.
89
72
  #
90
73
  # Once the instance is registered, it starts receiving traffic and
@@ -102,25 +85,18 @@ module AWS
102
85
  # completed. Rather, it means that the request has been registered and
103
86
  # the changes will happen shortly.
104
87
  #
105
- # Required Arguments:
106
- #
107
- # :instances => Array of Strings
108
- # :load_balancer_name => String
88
+ # @option options [Array<String>] :instances An Array of instance names to add to the load balancer.
89
+ # @option options [String] :load_balancer_name The name of the load balancer.
109
90
  #
110
91
  def register_instances_with_load_balancer( options = {} )
111
92
  raise ArgumentError, "No :instances provided" if options[:instances].nil? || options[:instances].empty?
112
93
  raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
113
-
114
94
  params = {}
115
-
116
95
  params.merge!(pathlist('Instances.member', [options[:instances]].flatten))
117
96
  params['LoadBalancerName'] = options[:load_balancer_name]
118
-
119
97
  return response_generator(:action => "RegisterInstancesWithLoadBalancer", :params => params)
120
98
  end
121
99
 
122
- # Amazon Developer Guide Docs:
123
- #
124
100
  # This API deregisters instances from the LoadBalancer. Trying to
125
101
  # deregister an instance that is not registered with the LoadBalancer
126
102
  # does nothing.
@@ -132,34 +108,25 @@ module AWS
132
108
  # Once the instance is deregistered, it will stop receiving traffic from
133
109
  # the LoadBalancer.
134
110
  #
135
- # Required Arguments:
136
- #
137
- # :instances => Array of Strings
138
- # :load_balancer_name => String
111
+ # @option options [Array<String>] :instances An Array of instance names to remove from the load balancer.
112
+ # @option options [String] :load_balancer_name The name of the load balancer.
139
113
  #
140
114
  def deregister_instances_from_load_balancer( options = {} )
141
115
  raise ArgumentError, "No :instances provided" if options[:instances].nil? || options[:instances].empty?
142
116
  raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
143
-
144
117
  params = {}
145
-
146
118
  params.merge!(pathlist('Instances.member', [options[:instances]].flatten))
147
119
  params['LoadBalancerName'] = options[:load_balancer_name]
148
-
149
120
  return response_generator(:action => "DeregisterInstancesFromLoadBalancer", :params => params)
150
121
  end
151
122
 
152
- # Amazon Developer Guide Docs:
153
- #
154
123
  # This API enables you to define an application healthcheck for the
155
124
  # instances.
156
125
  #
157
126
  # Note: Completion of this API does not guarantee that operation has completed. Rather, it means that the request has been registered and the changes will happen shortly.
158
127
  #
159
- # Required Arguments
160
- #
161
- # :health_check => Hash (:timeout, :interval, :unhealthy_threshold, :healthy_threshold)
162
- # :load_balancer_name => String
128
+ # @option options [Hash] :health_check A Hash with the keys (:timeout, :interval, :unhealthy_threshold, :healthy_threshold)
129
+ # @option options [String] :load_balancer_name The name of the load balancer.
163
130
  #
164
131
  def configure_health_check( options = {} )
165
132
  raise ArgumentError, "No :health_check provided" if options[:health_check].nil? || options[:health_check].empty?
@@ -182,17 +149,30 @@ module AWS
182
149
  return response_generator(:action => "ConfigureHealthCheck", :params => params)
183
150
  end
184
151
 
185
- def describe_intance_health( options = {} )
152
+ # Not yet implemented
153
+ #
154
+ # @todo Implement this method
155
+ #
156
+ def describe_instance_health( options = {} )
186
157
  raise "Not yet implemented"
187
158
  end
188
159
 
160
+ # Not yet implemented
161
+ #
162
+ # @todo Implement this method
163
+ #
189
164
  def disable_availability_zones_for_load_balancer( options = {} )
190
165
  raise "Not yet implemented"
191
166
  end
192
167
 
168
+ # Not yet implemented
169
+ #
170
+ # @todo Implement this method
171
+ #
193
172
  def enable_availability_zones_for_load_balancer( options = {} )
194
173
  raise "Not yet implemented"
195
174
  end
175
+
196
176
  end
197
177
  end
198
178
  end