aws-sdk-iam 1.0.0.rc1 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,310 +1,308 @@
1
1
  # WARNING ABOUT GENERATED CODE
2
2
  #
3
- # This file is generated. See the contributing for info on making contributions:
3
+ # This file is generated. See the contributing guide for more information:
4
4
  # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
5
  #
6
6
  # WARNING ABOUT GENERATED CODE
7
7
 
8
- module Aws
9
- module IAM
10
- class Role
8
+ module Aws::IAM
9
+ class Role
11
10
 
12
- extend Aws::Deprecations
11
+ extend Aws::Deprecations
13
12
 
14
- # @overload def initialize(name, options = {})
15
- # @param [String] name
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :name
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @name = extract_name(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
13
+ # @overload def initialize(name, options = {})
14
+ # @param [String] name
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :name
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @name = extract_name(args, options)
22
+ @data = options.delete(:data)
23
+ @client = options.delete(:client) || Client.new(options)
24
+ end
26
25
 
27
- # @!group Read-Only Attributes
26
+ # @!group Read-Only Attributes
28
27
 
29
- # @return [String]
30
- def name
31
- @name
32
- end
33
- alias :role_name :name
28
+ # @return [String]
29
+ def name
30
+ @name
31
+ end
32
+ alias :role_name :name
34
33
 
35
- # The path to the role. For more information about paths, see [IAM
36
- # Identifiers][1] in the *Using IAM* guide.
37
- #
38
- #
39
- #
40
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
41
- # @return [String]
42
- def path
43
- data.path
44
- end
34
+ # The path to the role. For more information about paths, see [IAM
35
+ # Identifiers][1] in the *Using IAM* guide.
36
+ #
37
+ #
38
+ #
39
+ # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
40
+ # @return [String]
41
+ def path
42
+ data.path
43
+ end
45
44
 
46
- # The stable and unique string identifying the role. For more
47
- # information about IDs, see [IAM Identifiers][1] in the *Using IAM*
48
- # guide.
49
- #
50
- #
51
- #
52
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
53
- # @return [String]
54
- def role_id
55
- data.role_id
56
- end
45
+ # The stable and unique string identifying the role. For more
46
+ # information about IDs, see [IAM Identifiers][1] in the *Using IAM*
47
+ # guide.
48
+ #
49
+ #
50
+ #
51
+ # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
52
+ # @return [String]
53
+ def role_id
54
+ data.role_id
55
+ end
57
56
 
58
- # The Amazon Resource Name (ARN) specifying the role. For more
59
- # information about ARNs and how to use them in policies, see [IAM
60
- # Identifiers][1] in the *Using IAM* guide.
61
- #
62
- #
63
- #
64
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
65
- # @return [String]
66
- def arn
67
- data.arn
68
- end
57
+ # The Amazon Resource Name (ARN) specifying the role. For more
58
+ # information about ARNs and how to use them in policies, see [IAM
59
+ # Identifiers][1] in the *Using IAM* guide.
60
+ #
61
+ #
62
+ #
63
+ # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
64
+ # @return [String]
65
+ def arn
66
+ data.arn
67
+ end
69
68
 
70
- # The date and time, in [ISO 8601 date-time format][1], when the role
71
- # was created.
72
- #
73
- #
74
- #
75
- # [1]: http://www.iso.org/iso/iso8601
76
- # @return [Time]
77
- def create_date
78
- data.create_date
79
- end
69
+ # The date and time, in [ISO 8601 date-time format][1], when the role
70
+ # was created.
71
+ #
72
+ #
73
+ #
74
+ # [1]: http://www.iso.org/iso/iso8601
75
+ # @return [Time]
76
+ def create_date
77
+ data.create_date
78
+ end
80
79
 
81
- # The policy that grants an entity permission to assume the role.
82
- # @return [String]
83
- def assume_role_policy_document
84
- data.assume_role_policy_document
85
- end
80
+ # The policy that grants an entity permission to assume the role.
81
+ # @return [String]
82
+ def assume_role_policy_document
83
+ data.assume_role_policy_document
84
+ end
86
85
 
87
- # @!endgroup
86
+ # @!endgroup
88
87
 
89
- # @return [Client]
90
- def client
91
- @client
92
- end
88
+ # @return [Client]
89
+ def client
90
+ @client
91
+ end
93
92
 
94
- # Loads, or reloads {#data} for the current {Role}.
95
- # Returns `self` making it possible to chain methods.
96
- #
97
- # role.reload.data
98
- #
99
- # @return [self]
100
- def load
101
- resp = @client.get_role(role_name: @name)
102
- @data = resp.role
103
- self
104
- end
105
- alias :reload :load
93
+ # Loads, or reloads {#data} for the current {Role}.
94
+ # Returns `self` making it possible to chain methods.
95
+ #
96
+ # role.reload.data
97
+ #
98
+ # @return [self]
99
+ def load
100
+ resp = @client.get_role(role_name: @name)
101
+ @data = resp.role
102
+ self
103
+ end
104
+ alias :reload :load
106
105
 
107
- # @return [Types::Role]
108
- # Returns the data for this {Role}. Calls
109
- # {Client#get_role} if {#data_loaded?} is `false`.
110
- def data
111
- load unless @data
112
- @data
113
- end
106
+ # @return [Types::Role]
107
+ # Returns the data for this {Role}. Calls
108
+ # {Client#get_role} if {#data_loaded?} is `false`.
109
+ def data
110
+ load unless @data
111
+ @data
112
+ end
114
113
 
115
- # @return [Boolean]
116
- # Returns `true` if this resource is loaded. Accessing attributes or
117
- # {#data} on an unloaded resource will trigger a call to {#load}.
118
- def data_loaded?
119
- !!@data
120
- end
114
+ # @return [Boolean]
115
+ # Returns `true` if this resource is loaded. Accessing attributes or
116
+ # {#data} on an unloaded resource will trigger a call to {#load}.
117
+ def data_loaded?
118
+ !!@data
119
+ end
121
120
 
122
- # @!group Actions
121
+ # @!group Actions
123
122
 
124
- # @example Request syntax with placeholder values
125
- #
126
- # role.attach_policy({
127
- # policy_arn: "arnType", # required
128
- # })
129
- # @param [Hash] options ({})
130
- # @option options [required, String] :policy_arn
131
- # The Amazon Resource Name (ARN) of the IAM policy you want to attach.
132
- #
133
- # For more information about ARNs, see [Amazon Resource Names (ARNs) and
134
- # AWS Service Namespaces][1] in the *AWS General Reference*.
135
- #
136
- #
137
- #
138
- # [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
139
- # @return [EmptyStructure]
140
- def attach_policy(options = {})
141
- options = options.merge(role_name: @name)
142
- resp = @client.attach_role_policy(options)
143
- resp.data
144
- end
123
+ # @example Request syntax with placeholder values
124
+ #
125
+ # role.attach_policy({
126
+ # policy_arn: "arnType", # required
127
+ # })
128
+ # @param [Hash] options ({})
129
+ # @option options [required, String] :policy_arn
130
+ # The Amazon Resource Name (ARN) of the IAM policy you want to attach.
131
+ #
132
+ # For more information about ARNs, see [Amazon Resource Names (ARNs) and
133
+ # AWS Service Namespaces][1] in the *AWS General Reference*.
134
+ #
135
+ #
136
+ #
137
+ # [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
138
+ # @return [EmptyStructure]
139
+ def attach_policy(options = {})
140
+ options = options.merge(role_name: @name)
141
+ resp = @client.attach_role_policy(options)
142
+ resp.data
143
+ end
145
144
 
146
- # @example Request syntax with placeholder values
147
- #
148
- # role.delete()
149
- # @param [Hash] options ({})
150
- # @return [EmptyStructure]
151
- def delete(options = {})
152
- options = options.merge(role_name: @name)
153
- resp = @client.delete_role(options)
154
- resp.data
155
- end
145
+ # @example Request syntax with placeholder values
146
+ #
147
+ # role.delete()
148
+ # @param [Hash] options ({})
149
+ # @return [EmptyStructure]
150
+ def delete(options = {})
151
+ options = options.merge(role_name: @name)
152
+ resp = @client.delete_role(options)
153
+ resp.data
154
+ end
156
155
 
157
- # @example Request syntax with placeholder values
158
- #
159
- # role.detach_policy({
160
- # policy_arn: "arnType", # required
161
- # })
162
- # @param [Hash] options ({})
163
- # @option options [required, String] :policy_arn
164
- # The Amazon Resource Name (ARN) of the IAM policy you want to detach.
165
- #
166
- # For more information about ARNs, see [Amazon Resource Names (ARNs) and
167
- # AWS Service Namespaces][1] in the *AWS General Reference*.
168
- #
169
- #
170
- #
171
- # [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
172
- # @return [EmptyStructure]
173
- def detach_policy(options = {})
174
- options = options.merge(role_name: @name)
175
- resp = @client.detach_role_policy(options)
176
- resp.data
177
- end
156
+ # @example Request syntax with placeholder values
157
+ #
158
+ # role.detach_policy({
159
+ # policy_arn: "arnType", # required
160
+ # })
161
+ # @param [Hash] options ({})
162
+ # @option options [required, String] :policy_arn
163
+ # The Amazon Resource Name (ARN) of the IAM policy you want to detach.
164
+ #
165
+ # For more information about ARNs, see [Amazon Resource Names (ARNs) and
166
+ # AWS Service Namespaces][1] in the *AWS General Reference*.
167
+ #
168
+ #
169
+ #
170
+ # [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
171
+ # @return [EmptyStructure]
172
+ def detach_policy(options = {})
173
+ options = options.merge(role_name: @name)
174
+ resp = @client.detach_role_policy(options)
175
+ resp.data
176
+ end
178
177
 
179
- # @!group Associations
178
+ # @!group Associations
180
179
 
181
- # @return [AssumeRolePolicy]
182
- def assume_role_policy
183
- AssumeRolePolicy.new(
184
- role_name: @name,
185
- client: @client
186
- )
187
- end
180
+ # @return [AssumeRolePolicy]
181
+ def assume_role_policy
182
+ AssumeRolePolicy.new(
183
+ role_name: @name,
184
+ client: @client
185
+ )
186
+ end
188
187
 
189
- # @example Request syntax with placeholder values
190
- #
191
- # attachedpolicies = role.attached_policies({
192
- # path_prefix: "policyPathType",
193
- # })
194
- # @param [Hash] options ({})
195
- # @option options [String] :path_prefix
196
- # The path prefix for filtering the results. This parameter is optional.
197
- # If it is not included, it defaults to a slash (/), listing all
198
- # policies.
199
- #
200
- # The [regex pattern][1] for this parameter is a string of characters
201
- # consisting of either a forward slash (/) by itself or a string that
202
- # must begin and end with forward slashes, containing any ASCII
203
- # character from the ! (\\u0021) thru the DEL character (\\u007F),
204
- # including most punctuation characters, digits, and upper and
205
- # lowercased letters.
206
- #
207
- #
208
- #
209
- # [1]: http://wikipedia.org/wiki/regex
210
- # @return [Policy::Collection]
211
- def attached_policies(options = {})
212
- batches = Enumerator.new do |y|
213
- options = options.merge(role_name: @name)
214
- resp = @client.list_attached_role_policies(options)
215
- resp.each_page do |page|
216
- batch = []
217
- page.data.attached_policies.each do |a|
218
- batch << Policy.new(
219
- arn: a.policy_arn,
220
- client: @client
221
- )
222
- end
223
- y.yield(batch)
188
+ # @example Request syntax with placeholder values
189
+ #
190
+ # attached_policies = role.attached_policies({
191
+ # path_prefix: "policyPathType",
192
+ # })
193
+ # @param [Hash] options ({})
194
+ # @option options [String] :path_prefix
195
+ # The path prefix for filtering the results. This parameter is optional.
196
+ # If it is not included, it defaults to a slash (/), listing all
197
+ # policies.
198
+ #
199
+ # This paramater allows (per its [regex pattern][1]) a string of
200
+ # characters consisting of either a forward slash (/) by itself or a
201
+ # string that must begin and end with forward slashes, containing any
202
+ # ASCII character from the ! (\\u0021) thru the DEL character (\\u007F),
203
+ # including most punctuation characters, digits, and upper and
204
+ # lowercased letters.
205
+ #
206
+ #
207
+ #
208
+ # [1]: http://wikipedia.org/wiki/regex
209
+ # @return [Policy::Collection]
210
+ def attached_policies(options = {})
211
+ batches = Enumerator.new do |y|
212
+ options = options.merge(role_name: @name)
213
+ resp = @client.list_attached_role_policies(options)
214
+ resp.each_page do |page|
215
+ batch = []
216
+ page.data.attached_policies.each do |a|
217
+ batch << Policy.new(
218
+ arn: a.policy_arn,
219
+ client: @client
220
+ )
224
221
  end
222
+ y.yield(batch)
225
223
  end
226
- Policy::Collection.new(batches)
227
224
  end
225
+ Policy::Collection.new(batches)
226
+ end
228
227
 
229
- # @example Request syntax with placeholder values
230
- #
231
- # instanceprofiles = role.instance_profiles()
232
- # @param [Hash] options ({})
233
- # @return [InstanceProfile::Collection]
234
- def instance_profiles(options = {})
235
- batches = Enumerator.new do |y|
236
- options = options.merge(role_name: @name)
237
- resp = @client.list_instance_profiles_for_role(options)
238
- resp.each_page do |page|
239
- batch = []
240
- page.data.instance_profiles.each do |i|
241
- batch << InstanceProfile.new(
242
- name: i.instance_profile_name,
243
- data: i,
244
- client: @client
245
- )
246
- end
247
- y.yield(batch)
228
+ # @example Request syntax with placeholder values
229
+ #
230
+ # role.instance_profiles()
231
+ # @param [Hash] options ({})
232
+ # @return [InstanceProfile::Collection]
233
+ def instance_profiles(options = {})
234
+ batches = Enumerator.new do |y|
235
+ options = options.merge(role_name: @name)
236
+ resp = @client.list_instance_profiles_for_role(options)
237
+ resp.each_page do |page|
238
+ batch = []
239
+ page.data.instance_profiles.each do |i|
240
+ batch << InstanceProfile.new(
241
+ name: i.instance_profile_name,
242
+ data: i,
243
+ client: @client
244
+ )
248
245
  end
246
+ y.yield(batch)
249
247
  end
250
- InstanceProfile::Collection.new(batches)
251
248
  end
249
+ InstanceProfile::Collection.new(batches)
250
+ end
252
251
 
253
- # @example Request syntax with placeholder values
254
- #
255
- # policies = role.policies()
256
- # @param [Hash] options ({})
257
- # @return [RolePolicy::Collection]
258
- def policies(options = {})
259
- batches = Enumerator.new do |y|
260
- options = options.merge(role_name: @name)
261
- resp = @client.list_role_policies(options)
262
- resp.each_page do |page|
263
- batch = []
264
- page.data.policy_names.each do |p|
265
- batch << RolePolicy.new(
266
- role_name: @name,
267
- name: p,
268
- client: @client
269
- )
270
- end
271
- y.yield(batch)
252
+ # @example Request syntax with placeholder values
253
+ #
254
+ # role.policies()
255
+ # @param [Hash] options ({})
256
+ # @return [RolePolicy::Collection]
257
+ def policies(options = {})
258
+ batches = Enumerator.new do |y|
259
+ options = options.merge(role_name: @name)
260
+ resp = @client.list_role_policies(options)
261
+ resp.each_page do |page|
262
+ batch = []
263
+ page.data.policy_names.each do |p|
264
+ batch << RolePolicy.new(
265
+ role_name: @name,
266
+ name: p,
267
+ client: @client
268
+ )
272
269
  end
270
+ y.yield(batch)
273
271
  end
274
- RolePolicy::Collection.new(batches)
275
272
  end
273
+ RolePolicy::Collection.new(batches)
274
+ end
276
275
 
277
- # @param [String] name
278
- # @return [RolePolicy]
279
- def policy(name)
280
- RolePolicy.new(
281
- role_name: @name,
282
- name: name,
283
- client: @client
284
- )
285
- end
276
+ # @param [String] name
277
+ # @return [RolePolicy]
278
+ def policy(name)
279
+ RolePolicy.new(
280
+ role_name: @name,
281
+ name: name,
282
+ client: @client
283
+ )
284
+ end
286
285
 
287
- # @deprecated
288
- # @api private
289
- def identifiers
290
- { name: @name }
291
- end
292
- deprecated(:identifiers)
286
+ # @deprecated
287
+ # @api private
288
+ def identifiers
289
+ { name: @name }
290
+ end
291
+ deprecated(:identifiers)
293
292
 
294
- private
293
+ private
295
294
 
296
- def extract_name(args, options)
297
- value = args[0] || options.delete(:name)
298
- case value
299
- when String then value
300
- when nil then raise ArgumentError, "missing required option :name"
301
- else
302
- msg = "expected :name to be a String, got #{value.class}"
303
- raise ArgumentError, msg
304
- end
295
+ def extract_name(args, options)
296
+ value = args[0] || options.delete(:name)
297
+ case value
298
+ when String then value
299
+ when nil then raise ArgumentError, "missing required option :name"
300
+ else
301
+ msg = "expected :name to be a String, got #{value.class}"
302
+ raise ArgumentError, msg
305
303
  end
306
-
307
- class Collection < Aws::Resources::Collection; end
308
304
  end
305
+
306
+ class Collection < Aws::Resources::Collection; end
309
307
  end
310
308
  end