aws-sdk 1.1.4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/aws.rb +2 -0
- data/lib/aws/api_config/ELB-2011-08-15.yml +380 -0
- data/lib/aws/api_config/SNS-2010-03-31.yml +2 -2
- data/lib/aws/api_config/SimpleEmailService-2010-12-01.yml +5 -5
- data/lib/aws/core.rb +18 -3
- data/lib/aws/core/client_logging.rb +5 -6
- data/lib/aws/core/collection.rb +241 -0
- data/lib/aws/core/collection/batchable.rb +133 -0
- data/lib/aws/core/collection/limitable.rb +92 -0
- data/lib/aws/core/collection/simple.rb +89 -0
- data/lib/aws/core/configuration.rb +23 -0
- data/lib/aws/core/option_grammar.rb +2 -0
- data/lib/aws/core/page_result.rb +73 -0
- data/lib/aws/ec2/security_group.rb +154 -89
- data/lib/aws/ec2/security_group/egress_ip_permission_collection.rb +1 -2
- data/lib/aws/ec2/security_group/{ip_permission_collection.rb → ingress_ip_permission_collection.rb} +4 -1
- data/lib/aws/ec2/security_group/ip_permission.rb +23 -45
- data/lib/aws/elb.rb +65 -0
- data/lib/aws/elb/availability_zone_collection.rb +138 -0
- data/lib/aws/elb/backend_server_policy_collection.rb +150 -0
- data/lib/aws/elb/client.rb +35 -0
- data/lib/aws/elb/client/xml.rb +33 -0
- data/lib/aws/elb/config.rb +18 -0
- data/lib/aws/elb/errors.rb +30 -0
- data/lib/aws/elb/instance_collection.rb +174 -0
- data/lib/aws/elb/listener.rb +189 -0
- data/lib/aws/elb/listener_collection.rb +119 -0
- data/lib/aws/elb/listener_opts.rb +45 -0
- data/lib/aws/elb/listener_spec.rb +14 -0
- data/lib/aws/elb/load_balancer.rb +255 -0
- data/lib/aws/elb/load_balancer_collection.rb +113 -0
- data/lib/aws/elb/load_balancer_policy.rb +93 -0
- data/lib/aws/elb/load_balancer_policy_collection.rb +208 -0
- data/lib/aws/elb/request.rb +23 -0
- data/lib/aws/iam/collection.rb +24 -26
- data/lib/aws/iam/group_user_collection.rb +21 -28
- data/lib/aws/iam/server_certificate_collection.rb +1 -37
- data/lib/aws/record.rb +1 -1
- data/lib/aws/record/base.rb +14 -1
- data/lib/aws/record/finder_methods.rb +4 -1
- data/lib/aws/record/validations.rb +73 -32
- data/lib/aws/{core/api_config_transform.rb → record/validators/method.rb} +9 -12
- data/lib/aws/s3/bucket_collection.rb +6 -4
- data/lib/aws/s3/client.rb +37 -6
- data/lib/aws/s3/config.rb +3 -1
- data/lib/aws/s3/prefixed_collection.rb +1 -2
- data/lib/aws/s3/presigned_post.rb +37 -4
- data/lib/aws/s3/s3_object.rb +93 -1
- data/lib/aws/simple_db/domain.rb +8 -0
- data/lib/aws/simple_db/item.rb +15 -0
- data/lib/aws/simple_db/item_collection.rb +255 -201
- data/lib/aws/simple_db/item_data.rb +1 -1
- data/lib/aws/simple_email_service/client.rb +0 -1
- data/lib/aws/sns/client.rb +0 -1
- metadata +107 -55
- data/lib/aws/core/collections.rb +0 -229
- data/lib/aws/simple_email_service/client/options.rb +0 -21
- data/lib/aws/sns/client/options.rb +0 -21
@@ -0,0 +1,93 @@
|
|
1
|
+
# Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class ELB
|
16
|
+
class LoadBalancerPolicy < Core::Resource
|
17
|
+
|
18
|
+
# @private
|
19
|
+
def initialize load_balancer, name, options = {}
|
20
|
+
@load_balancer = load_balancer
|
21
|
+
super(load_balancer, options.merge(:name => name.to_s))
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [LoadBalancer] Returns the load balancer this policy belongs to.
|
25
|
+
attr_reader :load_balancer
|
26
|
+
|
27
|
+
attribute :name, :static => true, :as => :policy_name
|
28
|
+
|
29
|
+
attribute :type, :static => true, :as => :policy_type_name
|
30
|
+
|
31
|
+
attribute :policy_attribute_descriptions, :static => true
|
32
|
+
|
33
|
+
protected :policy_attribute_descriptions
|
34
|
+
|
35
|
+
populates_from(:describe_load_balancer_policies) do |resp|
|
36
|
+
if resp.request_options[:load_balancer_name] == load_balancer.name
|
37
|
+
resp.policy_descriptions.find do |desc|
|
38
|
+
desc.policy_name == name
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [Hash] Returns a hash of policy attributes. Keys are
|
44
|
+
# policy attribute names, and values are arrays one or more policy
|
45
|
+
# attribute values.
|
46
|
+
def attributes
|
47
|
+
attributes = {}
|
48
|
+
policy_attribute_descriptions.each do |desc|
|
49
|
+
attributes[desc.attribute_name] ||= []
|
50
|
+
attributes[desc.attribute_name] << desc.attribute_value
|
51
|
+
end
|
52
|
+
attributes
|
53
|
+
end
|
54
|
+
|
55
|
+
# Deletes this load balancer policy.
|
56
|
+
# @return [nil]
|
57
|
+
def delete
|
58
|
+
|
59
|
+
client.delete_load_balancer_policy(
|
60
|
+
:load_balancer_name => load_balancer.name,
|
61
|
+
:policy_name => name)
|
62
|
+
|
63
|
+
nil
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
# Useful for determining if a policy with the given name exists:
|
68
|
+
#
|
69
|
+
# load_balancer.policies['my-policy-name'].exists? # => true/false
|
70
|
+
#
|
71
|
+
# @return [Boolean] Returns true this policy's load balancer has a
|
72
|
+
# policy with this name.
|
73
|
+
def exists?
|
74
|
+
r = get_resource
|
75
|
+
r.policy_descriptions.find{|d| d.policy_name == name } ? true : false
|
76
|
+
rescue AWS::ELB::Errors::LoadBalancerNotFound
|
77
|
+
false
|
78
|
+
end
|
79
|
+
|
80
|
+
protected
|
81
|
+
def resource_identifiers
|
82
|
+
[[:load_balancer_name, load_balancer.name],[:policy_name, name]]
|
83
|
+
end
|
84
|
+
|
85
|
+
protected
|
86
|
+
def get_resource attr_name = nil
|
87
|
+
client.describe_load_balancer_policies(
|
88
|
+
:load_balancer_name => load_balancer.name)
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,208 @@
|
|
1
|
+
# Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class ELB
|
16
|
+
|
17
|
+
class LoadBalancerPolicyCollection
|
18
|
+
|
19
|
+
include Core::Collection::Simple
|
20
|
+
|
21
|
+
def initialize load_balancer, options = {}
|
22
|
+
@load_balancer = load_balancer
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
attr_reader :load_balancer
|
27
|
+
|
28
|
+
# Creates a new load balancer policy that contains the necessary
|
29
|
+
# attributes depending on the policy type. Policies are settings
|
30
|
+
# that are saved for your load balancer and that can be applied to
|
31
|
+
# the front-end listener, or the back-end application server,
|
32
|
+
# depending on your policy type.
|
33
|
+
#
|
34
|
+
# == Applying Policies
|
35
|
+
#
|
36
|
+
# To apply a policy to a front-end listener:
|
37
|
+
#
|
38
|
+
# # each listener may only have a single policy
|
39
|
+
# load_balancer.listener[80].policy = listener_policy
|
40
|
+
#
|
41
|
+
# To apply a policy to backend instance port
|
42
|
+
#
|
43
|
+
# # back end servers can have multiple policies per instance port
|
44
|
+
# load_balancer.backend_server_policies.add(80, back_end_policy)
|
45
|
+
#
|
46
|
+
# @param [String] name The name of the policy being created. The name
|
47
|
+
# must be unique within the set of policies for this load balancer.
|
48
|
+
#
|
49
|
+
# @param [String] type The policy type name. Valid values inlucde:
|
50
|
+
#
|
51
|
+
# * 'PublicKeyPolicyType'
|
52
|
+
# * 'AppCookieStickinessPolicyType'
|
53
|
+
# * 'LBCookieStickinessPolicyType'
|
54
|
+
# * 'SSLNegotiationPolicyType'
|
55
|
+
# * 'BackendServerAuthenticationPolicyType'
|
56
|
+
#
|
57
|
+
# @param [Hash] attributes A hash of policy attributes. Each policy
|
58
|
+
# type accepts a different list of hash options. Below each
|
59
|
+
# policy type name is listed with its list of accepted options.
|
60
|
+
# Attributes that accept more than one value should be provided
|
61
|
+
# as an array of values.
|
62
|
+
#
|
63
|
+
# Hash keys should be attribute names, values may be single
|
64
|
+
# values or arrays of values.
|
65
|
+
#
|
66
|
+
# PublicKeyPolicyType
|
67
|
+
#
|
68
|
+
# Policy containing a list of public keys to accept when authenticating the back-end server(s). This policy cannot be applied directly to back-end servers or listeners but must be part of a BackendServerAuthenticationPolicyType.
|
69
|
+
#
|
70
|
+
# * 'PublicKey', String, one
|
71
|
+
#
|
72
|
+
# AppCookieStickinessPolicyType
|
73
|
+
#
|
74
|
+
# Stickiness policy with session lifetimes controlled by the lifetime of the application-generated cookie. This policy can be associated only with HTTP/HTTPS listeners.
|
75
|
+
#
|
76
|
+
# * 'CookieName', String, one
|
77
|
+
#
|
78
|
+
# LBCookieStickinessPolicyType
|
79
|
+
#
|
80
|
+
# Stickiness policy with session lifetimes controlled by the browser (user-agent) or a specified expiration period. This policy can be associated only with HTTP/HTTPS listeners.
|
81
|
+
#
|
82
|
+
# * 'CookieExpirationPeriod', Long, zero or one
|
83
|
+
#
|
84
|
+
# SSLNegotiationPolicyType
|
85
|
+
#
|
86
|
+
# Listener policy that defines the ciphers and protocols that will be accepted by the load balancer. This policy can be associated only with HTTPS/SSL listeners.
|
87
|
+
#
|
88
|
+
# * 'Protocol-SSLv2', Boolean, zero or one
|
89
|
+
# * 'Protocol-TLSv1', Boolean, zero or one
|
90
|
+
# * 'Protocol-SSLv3', Boolean, zero or one
|
91
|
+
# * 'DHE-RSA-AES256-SHA', Boolean, zero or one
|
92
|
+
# * 'DHE-DSS-AES256-SHA', Boolean, zero or one
|
93
|
+
# * 'DHE-RSA-CAMELLIA256-SHA', Boolean, zero or one
|
94
|
+
# * 'DHE-DSS-CAMELLIA256-SHA', Boolean, zero or one
|
95
|
+
# * 'ADH-AES256-SHA', Boolean, zero or one
|
96
|
+
# * 'ADH-CAMELLIA256-SHA', Boolean, zero or one
|
97
|
+
# * 'AES256-SHA', Boolean, zero or one
|
98
|
+
# * 'CAMELLIA256-SHA', Boolean, zero or one
|
99
|
+
# * 'PSK-AES256-CBC-SHA', Boolean, zero or one
|
100
|
+
# * 'EDH-RSA-DES-CBC3-SHA', Boolean, zero or one
|
101
|
+
# * 'EDH-DSS-DES-CBC3-SHA', Boolean, zero or one
|
102
|
+
# * 'ADH-DES-CBC3-SHA', Boolean, zero or one
|
103
|
+
# * 'DES-CBC3-SHA', Boolean, zero or one
|
104
|
+
# * 'DES-CBC3-MD5', Boolean, zero or one
|
105
|
+
# * 'PSK-3DES-EDE-CBC-SHA', Boolean, zero or one
|
106
|
+
# * 'KRB5-DES-CBC3-SHA', Boolean, zero or one
|
107
|
+
# * 'KRB5-DES-CBC3-MD5', Boolean, zero or one
|
108
|
+
# * 'DHE-RSA-AES128-SHA', Boolean, zero or one
|
109
|
+
# * 'DHE-DSS-AES128-SHA', Boolean, zero or one
|
110
|
+
# * 'DHE-RSA-SEED-SHA', Boolean, zero or one
|
111
|
+
# * 'DHE-DSS-SEED-SHA', Boolean, zero or one
|
112
|
+
# * 'DHE-RSA-CAMELLIA128-SHA', Boolean, zero or one
|
113
|
+
# * 'DHE-DSS-CAMELLIA128-SHA', Boolean, zero or one
|
114
|
+
# * 'ADH-AES128-SHA', Boolean, zero or one
|
115
|
+
# * 'ADH-SEED-SHA', Boolean, zero or one
|
116
|
+
# * 'ADH-CAMELLIA128-SHA', Boolean, zero or one
|
117
|
+
# * 'AES128-SHA', Boolean, zero or one
|
118
|
+
# * 'SEED-SHA', Boolean, zero or one
|
119
|
+
# * 'CAMELLIA128-SHA', Boolean, zero or one
|
120
|
+
# * 'RC2-CBC-MD5', Boolean, zero or one
|
121
|
+
# * 'PSK-AES128-CBC-SHA', Boolean, zero or one
|
122
|
+
# * 'ADH-RC4-MD5', Boolean, zero or one
|
123
|
+
# * 'IDEA-CBC-SHA', Boolean, zero or one
|
124
|
+
# * 'RC4-SHA', Boolean, zero or one
|
125
|
+
# * 'RC4-MD5', Boolean, zero or one
|
126
|
+
# * 'PSK-RC4-SHA', Boolean, zero or one
|
127
|
+
# * 'KRB5-RC4-SHA', Boolean, zero or one
|
128
|
+
# * 'KRB5-RC4-MD5', Boolean, zero or one
|
129
|
+
# * 'EDH-RSA-DES-CBC-SHA', Boolean, zero or one
|
130
|
+
# * 'EDH-DSS-DES-CBC-SHA', Boolean, zero or one
|
131
|
+
# * 'ADH-DES-CBC-SHA', Boolean, zero or one
|
132
|
+
# * 'DES-CBC-SHA', Boolean, zero or one
|
133
|
+
# * 'DES-CBC-MD5', Boolean, zero or one
|
134
|
+
# * 'KRB5-DES-CBC-SHA', Boolean, zero or one
|
135
|
+
# * 'KRB5-DES-CBC-MD5', Boolean, zero or one
|
136
|
+
# * 'EXP-EDH-RSA-DES-CBC-SHA', Boolean, zero or one
|
137
|
+
# * 'EXP-EDH-DSS-DES-CBC-SHA', Boolean, zero or one
|
138
|
+
# * 'EXP-ADH-DES-CBC-SHA', Boolean, zero or one
|
139
|
+
# * 'EXP-DES-CBC-SHA', Boolean, zero or one
|
140
|
+
# * 'EXP-RC2-CBC-MD5', Boolean, zero or one
|
141
|
+
# * 'EXP-KRB5-RC2-CBC-SHA', Boolean, zero or one
|
142
|
+
# * 'EXP-KRB5-DES-CBC-SHA', Boolean, zero or one
|
143
|
+
# * 'EXP-KRB5-RC2-CBC-MD5', Boolean, zero or one
|
144
|
+
# * 'EXP-KRB5-DES-CBC-MD5', Boolean, zero or one
|
145
|
+
# * 'EXP-ADH-RC4-MD5', Boolean, zero or one
|
146
|
+
# * 'EXP-RC4-MD5', Boolean, zero or one
|
147
|
+
# * 'EXP-KRB5-RC4-SHA', Boolean, zero or one
|
148
|
+
# * 'EXP-KRB5-RC4-MD5', Boolean, zero or one
|
149
|
+
#
|
150
|
+
# BackendServerAuthenticationPolicyType
|
151
|
+
#
|
152
|
+
# Policy that controls authentication to back-end server(s) and contains one or more policies, such as an instance of a PublicKeyPolicyType. This policy can be associated only with back-end servers that are using HTTPS/SSL.
|
153
|
+
#
|
154
|
+
# * 'PublicKeyPolicyName', PolicyName, one or more
|
155
|
+
#
|
156
|
+
# @return [nil]
|
157
|
+
#
|
158
|
+
def create name, type, attributes = {}
|
159
|
+
|
160
|
+
attribute_list = []
|
161
|
+
|
162
|
+
attributes.each do |attr_name,values|
|
163
|
+
[values].flatten.each do |value|
|
164
|
+
attribute_list << {
|
165
|
+
:attribute_name => attr_name,
|
166
|
+
:attribute_value => value.to_s
|
167
|
+
}
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
client.create_load_balancer_policy(
|
172
|
+
:load_balancer_name => load_balancer.name,
|
173
|
+
:policy_name => name.to_s,
|
174
|
+
:policy_type_name => type.to_s,
|
175
|
+
:policy_attributes => attribute_list)
|
176
|
+
|
177
|
+
LoadBalancerPolicy.new(load_balancer, name, :type => type.to_s)
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
# @param [String] policy_name The name of the policy to return.
|
182
|
+
# @return [LoadBalancerPolicy] Returns a reference to the load balancer
|
183
|
+
# policy with the given name.
|
184
|
+
def [] policy_name
|
185
|
+
LoadBalancerPolicy.new(load_balancer, policy_name)
|
186
|
+
end
|
187
|
+
|
188
|
+
protected
|
189
|
+
def _each_item options = {}, &block
|
190
|
+
|
191
|
+
options[:load_balancer_name] = load_balancer.name
|
192
|
+
|
193
|
+
response = client.describe_load_balancer_policies(options)
|
194
|
+
response.policy_descriptions.each do |desc|
|
195
|
+
|
196
|
+
load_balancer_policy = LoadBalancerPolicy.new_from(
|
197
|
+
:describe_load_balancer_policies,
|
198
|
+
desc, load_balancer, desc.policy_name)
|
199
|
+
|
200
|
+
yield(load_balancer_policy)
|
201
|
+
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class ELB
|
16
|
+
|
17
|
+
# @private
|
18
|
+
class Request < Core::Http::Request
|
19
|
+
include Core::AuthorizeV2
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/aws/iam/collection.rb
CHANGED
@@ -14,7 +14,7 @@ module AWS
|
|
14
14
|
class IAM
|
15
15
|
module Collection
|
16
16
|
|
17
|
-
include Core::
|
17
|
+
include Core::Collection::Limitable
|
18
18
|
|
19
19
|
# Common methods for collection classes that can be filtered by
|
20
20
|
# a path prefix.
|
@@ -27,23 +27,11 @@ module AWS
|
|
27
27
|
attr_reader :prefix
|
28
28
|
|
29
29
|
# @private
|
30
|
-
def initialize
|
30
|
+
def initialize options = {}
|
31
31
|
@prefix = options[:prefix]
|
32
32
|
super
|
33
33
|
end
|
34
34
|
|
35
|
-
def each options = {}, &block
|
36
|
-
options = {
|
37
|
-
:path_prefix => prefix
|
38
|
-
}.merge(options) if prefix
|
39
|
-
options[:path_prefix] = options.delete(:prefix) if
|
40
|
-
options.key?(:prefix)
|
41
|
-
if prefix = options[:path_prefix]
|
42
|
-
options[:path_prefix] = "/#{prefix}".sub(%r{^//}, "/")
|
43
|
-
end
|
44
|
-
super(options, &block)
|
45
|
-
end
|
46
|
-
|
47
35
|
# Returns a collection object including only those groups whose
|
48
36
|
# paths begin with the supplied prefix.
|
49
37
|
#
|
@@ -51,31 +39,41 @@ module AWS
|
|
51
39
|
# results.
|
52
40
|
#
|
53
41
|
# @return [GroupCollection]
|
54
|
-
def with_prefix
|
42
|
+
def with_prefix prefix
|
55
43
|
prefix = "/#{prefix}".sub(%r{^//}, "/")
|
56
|
-
self.class.new(:prefix => prefix,
|
57
|
-
|
44
|
+
self.class.new(:prefix => prefix, :config => config)
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
def _each_item marker, max_items, options = {}, &block
|
49
|
+
|
50
|
+
prefix = options.delete(:prefix) || self.prefix
|
51
|
+
|
52
|
+
options[:path_prefix] = "/#{prefix}".sub(%r{^//}, "/") if prefix
|
53
|
+
|
54
|
+
super(marker, max_items, options, &block)
|
55
|
+
|
58
56
|
end
|
59
57
|
|
60
58
|
end
|
61
59
|
|
62
|
-
# @private
|
63
60
|
protected
|
64
61
|
def request_method
|
65
62
|
name = Core::Inflection.ruby_name(self.class.name).sub(/_collection$/, '')
|
66
63
|
"list_#{name}s"
|
67
64
|
end
|
68
65
|
|
69
|
-
# @private
|
70
66
|
protected
|
71
|
-
def
|
72
|
-
|
73
|
-
|
67
|
+
def _each_item marker, max_items, options = {}, &block
|
68
|
+
|
69
|
+
options[:marker] = marker if marker
|
70
|
+
options[:max_items] = max_items if max_items
|
71
|
+
|
72
|
+
response = client.send(request_method, options)
|
73
|
+
each_item(response, &block)
|
74
|
+
|
75
|
+
response.marker if response.respond_to?(:marker)
|
74
76
|
|
75
|
-
# @private
|
76
|
-
protected
|
77
|
-
def limit_key
|
78
|
-
:max_items
|
79
77
|
end
|
80
78
|
|
81
79
|
end
|
@@ -20,27 +20,32 @@ module AWS
|
|
20
20
|
# group = AWS::IAM.new.groups.first
|
21
21
|
# users = group.users
|
22
22
|
# users.each { |u| puts u.name }
|
23
|
+
#
|
23
24
|
class GroupUserCollection
|
24
25
|
|
25
|
-
include Core::
|
26
|
-
|
27
|
-
# @attr_reader [Group] The group.
|
28
|
-
attr_reader :group
|
26
|
+
include Core::Collection::Simple
|
29
27
|
|
30
28
|
# @private
|
31
|
-
def initialize
|
29
|
+
def initialize group, options = {}
|
32
30
|
@group = group
|
33
31
|
super
|
34
32
|
end
|
35
33
|
|
34
|
+
# @attr_reader [Group] The group.
|
35
|
+
attr_reader :group
|
36
|
+
|
36
37
|
# Adds a user to the group.
|
37
38
|
#
|
38
39
|
# @param [User] user The user to add.
|
39
40
|
# @return [nil]
|
40
41
|
def add(user)
|
41
|
-
|
42
|
-
|
42
|
+
|
43
|
+
client.add_user_to_group(
|
44
|
+
:group_name => group.name,
|
45
|
+
:user_name => user.name)
|
46
|
+
|
43
47
|
nil
|
48
|
+
|
44
49
|
end
|
45
50
|
|
46
51
|
# Remove a user from the group.
|
@@ -48,37 +53,25 @@ module AWS
|
|
48
53
|
# @param [User] user The user to remove.
|
49
54
|
# @return [nil]
|
50
55
|
def remove(user)
|
51
|
-
|
52
|
-
|
56
|
+
|
57
|
+
client.remove_user_from_group(
|
58
|
+
:group_name => group.name,
|
59
|
+
:user_name => user.name)
|
60
|
+
|
53
61
|
nil
|
62
|
+
|
54
63
|
end
|
55
64
|
|
56
65
|
# Removes all users from this group.
|
57
66
|
# @return [nil]
|
58
67
|
def clear
|
59
|
-
each
|
60
|
-
remove(user)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# Yields once for each user in the group.
|
65
|
-
#
|
66
|
-
# @param [Hash] options
|
67
|
-
# @yieldparam [User] user
|
68
|
-
# @return [nil]
|
69
|
-
def each(options = {}, &block)
|
70
|
-
super(options.merge(:group_name => group.name), &block)
|
71
|
-
end
|
72
|
-
|
73
|
-
# @private
|
74
|
-
protected
|
75
|
-
def request_method
|
76
|
-
:get_group
|
68
|
+
each {|user| remove(user) }
|
77
69
|
end
|
78
70
|
|
79
71
|
# @private
|
80
72
|
protected
|
81
|
-
def
|
73
|
+
def _each_item options = {}, &block
|
74
|
+
response = client.get_group(:group_name => group.name)
|
82
75
|
response.users.each do |u|
|
83
76
|
user = User.new_from(:get_group, u, u.user_name, :config => config)
|
84
77
|
yield(user)
|