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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,554 +1,560 @@
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 Policy
11
-
12
- extend Aws::Deprecations
13
-
14
- # @overload def initialize(arn, options = {})
15
- # @param [String] arn
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :arn
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @arn = extract_arn(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
8
+ module Aws::IAM
9
+ class Policy
10
+
11
+ extend Aws::Deprecations
12
+
13
+ # @overload def initialize(arn, options = {})
14
+ # @param [String] arn
15
+ # @option options [Client] :client
16
+ # @overload def initialize(options = {})
17
+ # @option options [required, String] :arn
18
+ # @option options [Client] :client
19
+ def initialize(*args)
20
+ options = Hash === args.last ? args.pop.dup : {}
21
+ @arn = extract_arn(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 arn
31
- @arn
32
- end
28
+ # @return [String]
29
+ def arn
30
+ @arn
31
+ end
33
32
 
34
- # The friendly name (not ARN) identifying the policy.
35
- # @return [String]
36
- def policy_name
37
- data.policy_name
38
- end
33
+ # The friendly name (not ARN) identifying the policy.
34
+ # @return [String]
35
+ def policy_name
36
+ data.policy_name
37
+ end
39
38
 
40
- # The stable and unique string identifying the policy.
41
- #
42
- # For more information about IDs, see [IAM Identifiers][1] in the *Using
43
- # IAM* guide.
44
- #
45
- #
46
- #
47
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
48
- # @return [String]
49
- def policy_id
50
- data.policy_id
51
- end
39
+ # The stable and unique string identifying the policy.
40
+ #
41
+ # For more information about IDs, see [IAM Identifiers][1] in the *Using
42
+ # IAM* guide.
43
+ #
44
+ #
45
+ #
46
+ # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
47
+ # @return [String]
48
+ def policy_id
49
+ data.policy_id
50
+ end
52
51
 
53
- # The path to the policy.
54
- #
55
- # For more information about paths, see [IAM Identifiers][1] in the
56
- # *Using IAM* guide.
57
- #
58
- #
59
- #
60
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
61
- # @return [String]
62
- def path
63
- data.path
64
- end
52
+ # The path to the policy.
53
+ #
54
+ # For more information about paths, see [IAM Identifiers][1] in the
55
+ # *Using IAM* guide.
56
+ #
57
+ #
58
+ #
59
+ # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
60
+ # @return [String]
61
+ def path
62
+ data.path
63
+ end
65
64
 
66
- # The identifier for the version of the policy that is set as the
67
- # default version.
68
- # @return [String]
69
- def default_version_id
70
- data.default_version_id
71
- end
65
+ # The identifier for the version of the policy that is set as the
66
+ # default version.
67
+ # @return [String]
68
+ def default_version_id
69
+ data.default_version_id
70
+ end
72
71
 
73
- # The number of entities (users, groups, and roles) that the policy is
74
- # attached to.
75
- # @return [Integer]
76
- def attachment_count
77
- data.attachment_count
78
- end
72
+ # The number of entities (users, groups, and roles) that the policy is
73
+ # attached to.
74
+ # @return [Integer]
75
+ def attachment_count
76
+ data.attachment_count
77
+ end
79
78
 
80
- # Specifies whether the policy can be attached to an IAM user, group, or
81
- # role.
82
- # @return [Boolean]
83
- def is_attachable
84
- data.is_attachable
85
- end
79
+ # Specifies whether the policy can be attached to an IAM user, group, or
80
+ # role.
81
+ # @return [Boolean]
82
+ def is_attachable
83
+ data.is_attachable
84
+ end
86
85
 
87
- # A friendly description of the policy.
88
- #
89
- # This element is included in the response to the GetPolicy operation.
90
- # It is not included in the response to the ListPolicies operation.
91
- # @return [String]
92
- def description
93
- data.description
94
- end
86
+ # A friendly description of the policy.
87
+ #
88
+ # This element is included in the response to the GetPolicy operation.
89
+ # It is not included in the response to the ListPolicies operation.
90
+ # @return [String]
91
+ def description
92
+ data.description
93
+ end
95
94
 
96
- # The date and time, in [ISO 8601 date-time format][1], when the policy
97
- # was created.
98
- #
99
- #
100
- #
101
- # [1]: http://www.iso.org/iso/iso8601
102
- # @return [Time]
103
- def create_date
104
- data.create_date
105
- end
95
+ # The date and time, in [ISO 8601 date-time format][1], when the policy
96
+ # was created.
97
+ #
98
+ #
99
+ #
100
+ # [1]: http://www.iso.org/iso/iso8601
101
+ # @return [Time]
102
+ def create_date
103
+ data.create_date
104
+ end
106
105
 
107
- # The date and time, in [ISO 8601 date-time format][1], when the policy
108
- # was last updated.
109
- #
110
- # When a policy has only one version, this field contains the date and
111
- # time when the policy was created. When a policy has more than one
112
- # version, this field contains the date and time when the most recent
113
- # policy version was created.
114
- #
115
- #
116
- #
117
- # [1]: http://www.iso.org/iso/iso8601
118
- # @return [Time]
119
- def update_date
120
- data.update_date
121
- end
106
+ # The date and time, in [ISO 8601 date-time format][1], when the policy
107
+ # was last updated.
108
+ #
109
+ # When a policy has only one version, this field contains the date and
110
+ # time when the policy was created. When a policy has more than one
111
+ # version, this field contains the date and time when the most recent
112
+ # policy version was created.
113
+ #
114
+ #
115
+ #
116
+ # [1]: http://www.iso.org/iso/iso8601
117
+ # @return [Time]
118
+ def update_date
119
+ data.update_date
120
+ end
122
121
 
123
- # @!endgroup
122
+ # @!endgroup
124
123
 
125
- # @return [Client]
126
- def client
127
- @client
128
- end
124
+ # @return [Client]
125
+ def client
126
+ @client
127
+ end
129
128
 
130
- # Loads, or reloads {#data} for the current {Policy}.
131
- # Returns `self` making it possible to chain methods.
132
- #
133
- # policy.reload.data
134
- #
135
- # @return [self]
136
- def load
137
- resp = @client.get_policy(policy_arn: @arn)
138
- @data = resp.policy
139
- self
140
- end
141
- alias :reload :load
142
-
143
- # @return [Types::Policy]
144
- # Returns the data for this {Policy}. Calls
145
- # {Client#get_policy} if {#data_loaded?} is `false`.
146
- def data
147
- load unless @data
148
- @data
149
- end
129
+ # Loads, or reloads {#data} for the current {Policy}.
130
+ # Returns `self` making it possible to chain methods.
131
+ #
132
+ # policy.reload.data
133
+ #
134
+ # @return [self]
135
+ def load
136
+ resp = @client.get_policy(policy_arn: @arn)
137
+ @data = resp.policy
138
+ self
139
+ end
140
+ alias :reload :load
141
+
142
+ # @return [Types::Policy]
143
+ # Returns the data for this {Policy}. Calls
144
+ # {Client#get_policy} if {#data_loaded?} is `false`.
145
+ def data
146
+ load unless @data
147
+ @data
148
+ end
150
149
 
151
- # @return [Boolean]
152
- # Returns `true` if this resource is loaded. Accessing attributes or
153
- # {#data} on an unloaded resource will trigger a call to {#load}.
154
- def data_loaded?
155
- !!@data
156
- end
150
+ # @return [Boolean]
151
+ # Returns `true` if this resource is loaded. Accessing attributes or
152
+ # {#data} on an unloaded resource will trigger a call to {#load}.
153
+ def data_loaded?
154
+ !!@data
155
+ end
157
156
 
158
- # @!group Actions
159
-
160
- # @example Request syntax with placeholder values
161
- #
162
- # policy.attach_group({
163
- # group_name: "groupNameType", # required
164
- # })
165
- # @param [Hash] options ({})
166
- # @option options [required, String] :group_name
167
- # The name (friendly name, not ARN) of the group to attach the policy
168
- # to.
169
- #
170
- # The [regex pattern][1] for this parameter is a string of characters
171
- # consisting of upper and lowercase alphanumeric characters with no
172
- # spaces. You can also include any of the following characters: =,.@-
173
- #
174
- #
175
- #
176
- # [1]: http://wikipedia.org/wiki/regex
177
- # @return [EmptyStructure]
178
- def attach_group(options = {})
179
- options = options.merge(policy_arn: @arn)
180
- resp = @client.attach_group_policy(options)
181
- resp.data
182
- end
157
+ # @!group Actions
158
+
159
+ # @example Request syntax with placeholder values
160
+ #
161
+ # policy.attach_group({
162
+ # group_name: "groupNameType", # required
163
+ # })
164
+ # @param [Hash] options ({})
165
+ # @option options [required, String] :group_name
166
+ # The name (friendly name, not ARN) of the group to attach the policy
167
+ # to.
168
+ #
169
+ # This parameter allows (per its [regex pattern][1]) a string of
170
+ # characters consisting of upper and lowercase alphanumeric characters
171
+ # with no spaces. You can also include any of the following characters:
172
+ # =,.@-
173
+ #
174
+ #
175
+ #
176
+ # [1]: http://wikipedia.org/wiki/regex
177
+ # @return [EmptyStructure]
178
+ def attach_group(options = {})
179
+ options = options.merge(policy_arn: @arn)
180
+ resp = @client.attach_group_policy(options)
181
+ resp.data
182
+ end
183
183
 
184
- # @example Request syntax with placeholder values
185
- #
186
- # policy.attach_role({
187
- # role_name: "roleNameType", # required
188
- # })
189
- # @param [Hash] options ({})
190
- # @option options [required, String] :role_name
191
- # The name (friendly name, not ARN) of the role to attach the policy to.
192
- #
193
- # The [regex pattern][1] for this parameter is a string of characters
194
- # consisting of upper and lowercase alphanumeric characters with no
195
- # spaces. You can also include any of the following characters: =,.@-
196
- #
197
- #
198
- #
199
- # [1]: http://wikipedia.org/wiki/regex
200
- # @return [EmptyStructure]
201
- def attach_role(options = {})
202
- options = options.merge(policy_arn: @arn)
203
- resp = @client.attach_role_policy(options)
204
- resp.data
205
- end
184
+ # @example Request syntax with placeholder values
185
+ #
186
+ # policy.attach_role({
187
+ # role_name: "roleNameType", # required
188
+ # })
189
+ # @param [Hash] options ({})
190
+ # @option options [required, String] :role_name
191
+ # The name (friendly name, not ARN) of the role to attach the policy to.
192
+ #
193
+ # This parameter allows (per its [regex pattern][1]) a string of
194
+ # characters consisting of upper and lowercase alphanumeric characters
195
+ # with no spaces. You can also include any of the following characters:
196
+ # =,.@-
197
+ #
198
+ #
199
+ #
200
+ # [1]: http://wikipedia.org/wiki/regex
201
+ # @return [EmptyStructure]
202
+ def attach_role(options = {})
203
+ options = options.merge(policy_arn: @arn)
204
+ resp = @client.attach_role_policy(options)
205
+ resp.data
206
+ end
206
207
 
207
- # @example Request syntax with placeholder values
208
- #
209
- # policy.attach_user({
210
- # user_name: "userNameType", # required
211
- # })
212
- # @param [Hash] options ({})
213
- # @option options [required, String] :user_name
214
- # The name (friendly name, not ARN) of the IAM user to attach the policy
215
- # to.
216
- #
217
- # The [regex pattern][1] for this parameter is a string of characters
218
- # consisting of upper and lowercase alphanumeric characters with no
219
- # spaces. You can also include any of the following characters: =,.@-
220
- #
221
- #
222
- #
223
- # [1]: http://wikipedia.org/wiki/regex
224
- # @return [EmptyStructure]
225
- def attach_user(options = {})
226
- options = options.merge(policy_arn: @arn)
227
- resp = @client.attach_user_policy(options)
228
- resp.data
229
- end
208
+ # @example Request syntax with placeholder values
209
+ #
210
+ # policy.attach_user({
211
+ # user_name: "userNameType", # required
212
+ # })
213
+ # @param [Hash] options ({})
214
+ # @option options [required, String] :user_name
215
+ # The name (friendly name, not ARN) of the IAM user to attach the policy
216
+ # to.
217
+ #
218
+ # This parameter allows (per its [regex pattern][1]) a string of
219
+ # characters consisting of upper and lowercase alphanumeric characters
220
+ # with no spaces. You can also include any of the following characters:
221
+ # =,.@-
222
+ #
223
+ #
224
+ #
225
+ # [1]: http://wikipedia.org/wiki/regex
226
+ # @return [EmptyStructure]
227
+ def attach_user(options = {})
228
+ options = options.merge(policy_arn: @arn)
229
+ resp = @client.attach_user_policy(options)
230
+ resp.data
231
+ end
230
232
 
231
- # @example Request syntax with placeholder values
232
- #
233
- # policyversion = policy.create_version({
234
- # policy_document: "policyDocumentType", # required
235
- # set_as_default: false,
236
- # })
237
- # @param [Hash] options ({})
238
- # @option options [required, String] :policy_document
239
- # The JSON policy document that you want to use as the content for this
240
- # new version of the policy.
241
- #
242
- # The [regex pattern][1] for this parameter is a string of characters
243
- # consisting of any printable ASCII character ranging from the space
244
- # character (\\u0020) through end of the ASCII character range
245
- # (\\u00FF). It also includes the special characters tab (\\u0009), line
246
- # feed (\\u000A), and carriage return (\\u000D).
247
- #
248
- #
249
- #
250
- # [1]: http://wikipedia.org/wiki/regex
251
- # @option options [Boolean] :set_as_default
252
- # Specifies whether to set this version as the policy's default
253
- # version.
254
- #
255
- # When this parameter is `true`, the new policy version becomes the
256
- # operative version; that is, the version that is in effect for the IAM
257
- # users, groups, and roles that the policy is attached to.
258
- #
259
- # For more information about managed policy versions, see [Versioning
260
- # for Managed Policies][1] in the *IAM User Guide*.
261
- #
262
- #
263
- #
264
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html
265
- # @return [PolicyVersion]
266
- def create_version(options = {})
267
- options = options.merge(policy_arn: @arn)
268
- resp = @client.create_policy_version(options)
269
- PolicyVersion.new(
270
- arn: @arn,
271
- version_id: resp.data.policy_version.version_id,
272
- client: @client
273
- )
274
- end
233
+ # @example Request syntax with placeholder values
234
+ #
235
+ # policyversion = policy.create_version({
236
+ # policy_document: "policyDocumentType", # required
237
+ # set_as_default: false,
238
+ # })
239
+ # @param [Hash] options ({})
240
+ # @option options [required, String] :policy_document
241
+ # The JSON policy document that you want to use as the content for this
242
+ # new version of the policy.
243
+ #
244
+ # The [regex pattern][1] used to validate this parameter is a string of
245
+ # characters consisting of any printable ASCII character ranging from
246
+ # the space character (\\u0020) through end of the ASCII character range
247
+ # as well as the printable characters in the Basic Latin and Latin-1
248
+ # Supplement character set (through \\u00FF). It also includes the
249
+ # special characters tab (\\u0009), line feed (\\u000A), and carriage
250
+ # return (\\u000D).
251
+ #
252
+ #
253
+ #
254
+ # [1]: http://wikipedia.org/wiki/regex
255
+ # @option options [Boolean] :set_as_default
256
+ # Specifies whether to set this version as the policy's default
257
+ # version.
258
+ #
259
+ # When this parameter is `true`, the new policy version becomes the
260
+ # operative version; that is, the version that is in effect for the IAM
261
+ # users, groups, and roles that the policy is attached to.
262
+ #
263
+ # For more information about managed policy versions, see [Versioning
264
+ # for Managed Policies][1] in the *IAM User Guide*.
265
+ #
266
+ #
267
+ #
268
+ # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html
269
+ # @return [PolicyVersion]
270
+ def create_version(options = {})
271
+ options = options.merge(policy_arn: @arn)
272
+ resp = @client.create_policy_version(options)
273
+ PolicyVersion.new(
274
+ arn: @arn,
275
+ version_id: resp.data.policy_version.version_id,
276
+ client: @client
277
+ )
278
+ end
275
279
 
276
- # @example Request syntax with placeholder values
277
- #
278
- # policy.delete()
279
- # @param [Hash] options ({})
280
- # @return [EmptyStructure]
281
- def delete(options = {})
282
- options = options.merge(policy_arn: @arn)
283
- resp = @client.delete_policy(options)
284
- resp.data
285
- end
280
+ # @example Request syntax with placeholder values
281
+ #
282
+ # policy.delete()
283
+ # @param [Hash] options ({})
284
+ # @return [EmptyStructure]
285
+ def delete(options = {})
286
+ options = options.merge(policy_arn: @arn)
287
+ resp = @client.delete_policy(options)
288
+ resp.data
289
+ end
286
290
 
287
- # @example Request syntax with placeholder values
288
- #
289
- # policy.detach_group({
290
- # group_name: "groupNameType", # required
291
- # })
292
- # @param [Hash] options ({})
293
- # @option options [required, String] :group_name
294
- # The name (friendly name, not ARN) of the IAM group to detach the
295
- # policy from.
296
- #
297
- # The [regex pattern][1] for this parameter is a string of characters
298
- # consisting of upper and lowercase alphanumeric characters with no
299
- # spaces. You can also include any of the following characters: =,.@-
300
- #
301
- #
302
- #
303
- # [1]: http://wikipedia.org/wiki/regex
304
- # @return [EmptyStructure]
305
- def detach_group(options = {})
306
- options = options.merge(policy_arn: @arn)
307
- resp = @client.detach_group_policy(options)
308
- resp.data
309
- end
291
+ # @example Request syntax with placeholder values
292
+ #
293
+ # policy.detach_group({
294
+ # group_name: "groupNameType", # required
295
+ # })
296
+ # @param [Hash] options ({})
297
+ # @option options [required, String] :group_name
298
+ # The name (friendly name, not ARN) of the IAM group to detach the
299
+ # policy from.
300
+ #
301
+ # This parameter allows (per its [regex pattern][1]) a string of
302
+ # characters consisting of upper and lowercase alphanumeric characters
303
+ # with no spaces. You can also include any of the following characters:
304
+ # =,.@-
305
+ #
306
+ #
307
+ #
308
+ # [1]: http://wikipedia.org/wiki/regex
309
+ # @return [EmptyStructure]
310
+ def detach_group(options = {})
311
+ options = options.merge(policy_arn: @arn)
312
+ resp = @client.detach_group_policy(options)
313
+ resp.data
314
+ end
310
315
 
311
- # @example Request syntax with placeholder values
312
- #
313
- # policy.detach_role({
314
- # role_name: "roleNameType", # required
315
- # })
316
- # @param [Hash] options ({})
317
- # @option options [required, String] :role_name
318
- # The name (friendly name, not ARN) of the IAM role to detach the policy
319
- # from.
320
- #
321
- # The [regex pattern][1] for this parameter is a string of characters
322
- # consisting of upper and lowercase alphanumeric characters with no
323
- # spaces. You can also include any of the following characters: =,.@-
324
- #
325
- #
326
- #
327
- # [1]: http://wikipedia.org/wiki/regex
328
- # @return [EmptyStructure]
329
- def detach_role(options = {})
330
- options = options.merge(policy_arn: @arn)
331
- resp = @client.detach_role_policy(options)
332
- resp.data
333
- end
316
+ # @example Request syntax with placeholder values
317
+ #
318
+ # policy.detach_role({
319
+ # role_name: "roleNameType", # required
320
+ # })
321
+ # @param [Hash] options ({})
322
+ # @option options [required, String] :role_name
323
+ # The name (friendly name, not ARN) of the IAM role to detach the policy
324
+ # from.
325
+ #
326
+ # This parameter allows (per its [regex pattern][1]) a string of
327
+ # characters consisting of upper and lowercase alphanumeric characters
328
+ # with no spaces. You can also include any of the following characters:
329
+ # =,.@-
330
+ #
331
+ #
332
+ #
333
+ # [1]: http://wikipedia.org/wiki/regex
334
+ # @return [EmptyStructure]
335
+ def detach_role(options = {})
336
+ options = options.merge(policy_arn: @arn)
337
+ resp = @client.detach_role_policy(options)
338
+ resp.data
339
+ end
334
340
 
335
- # @example Request syntax with placeholder values
336
- #
337
- # policy.detach_user({
338
- # user_name: "userNameType", # required
339
- # })
340
- # @param [Hash] options ({})
341
- # @option options [required, String] :user_name
342
- # The name (friendly name, not ARN) of the IAM user to detach the policy
343
- # from.
344
- #
345
- # The [regex pattern][1] for this parameter is a string of characters
346
- # consisting of upper and lowercase alphanumeric characters with no
347
- # spaces. You can also include any of the following characters: =,.@-
348
- #
349
- #
350
- #
351
- # [1]: http://wikipedia.org/wiki/regex
352
- # @return [EmptyStructure]
353
- def detach_user(options = {})
354
- options = options.merge(policy_arn: @arn)
355
- resp = @client.detach_user_policy(options)
356
- resp.data
357
- end
341
+ # @example Request syntax with placeholder values
342
+ #
343
+ # policy.detach_user({
344
+ # user_name: "userNameType", # required
345
+ # })
346
+ # @param [Hash] options ({})
347
+ # @option options [required, String] :user_name
348
+ # The name (friendly name, not ARN) of the IAM user to detach the policy
349
+ # from.
350
+ #
351
+ # This parameter allows (per its [regex pattern][1]) a string of
352
+ # characters consisting of upper and lowercase alphanumeric characters
353
+ # with no spaces. You can also include any of the following characters:
354
+ # =,.@-
355
+ #
356
+ #
357
+ #
358
+ # [1]: http://wikipedia.org/wiki/regex
359
+ # @return [EmptyStructure]
360
+ def detach_user(options = {})
361
+ options = options.merge(policy_arn: @arn)
362
+ resp = @client.detach_user_policy(options)
363
+ resp.data
364
+ end
358
365
 
359
- # @!group Associations
360
-
361
- # @example Request syntax with placeholder values
362
- #
363
- # attachedgroups = policy.attached_groups({
364
- # path_prefix: "pathType",
365
- # })
366
- # @param [Hash] options ({})
367
- # @option options [String] :path_prefix
368
- # The path prefix for filtering the results. This parameter is optional.
369
- # If it is not included, it defaults to a slash (/), listing all
370
- # entities.
371
- #
372
- # The [regex pattern][1] for this parameter is a string of characters
373
- # consisting of either a forward slash (/) by itself or a string that
374
- # must begin and end with forward slashes, containing any ASCII
375
- # character from the ! (\\u0021) thru the DEL character (\\u007F),
376
- # including most punctuation characters, digits, and upper and
377
- # lowercased letters.
378
- #
379
- #
380
- #
381
- # [1]: http://wikipedia.org/wiki/regex
382
- # @return [Group::Collection]
383
- def attached_groups(options = {})
384
- batches = Enumerator.new do |y|
385
- options = options.merge(
386
- policy_arn: @arn,
387
- entity_filter: "Group"
388
- )
389
- resp = @client.list_entities_for_policy(options)
390
- resp.each_page do |page|
391
- batch = []
392
- page.data.policy_groups.each do |p|
393
- batch << Group.new(
394
- name: p.group_name,
395
- data: p,
396
- client: @client
397
- )
398
- end
399
- y.yield(batch)
366
+ # @!group Associations
367
+
368
+ # @example Request syntax with placeholder values
369
+ #
370
+ # attached_groups = policy.attached_groups({
371
+ # path_prefix: "pathType",
372
+ # })
373
+ # @param [Hash] options ({})
374
+ # @option options [String] :path_prefix
375
+ # The path prefix for filtering the results. This parameter is optional.
376
+ # If it is not included, it defaults to a slash (/), listing all
377
+ # entities.
378
+ #
379
+ # This paramater allows (per its [regex pattern][1]) a string of
380
+ # characters consisting of either a forward slash (/) by itself or a
381
+ # string that must begin and end with forward slashes, containing any
382
+ # ASCII character from the ! (\\u0021) thru the DEL character (\\u007F),
383
+ # including most punctuation characters, digits, and upper and
384
+ # lowercased letters.
385
+ #
386
+ #
387
+ #
388
+ # [1]: http://wikipedia.org/wiki/regex
389
+ # @return [Group::Collection]
390
+ def attached_groups(options = {})
391
+ batches = Enumerator.new do |y|
392
+ options = options.merge(
393
+ policy_arn: @arn,
394
+ entity_filter: "Group"
395
+ )
396
+ resp = @client.list_entities_for_policy(options)
397
+ resp.each_page do |page|
398
+ batch = []
399
+ page.data.policy_groups.each do |p|
400
+ batch << Group.new(
401
+ name: p.group_name,
402
+ data: p,
403
+ client: @client
404
+ )
400
405
  end
406
+ y.yield(batch)
401
407
  end
402
- Group::Collection.new(batches)
403
408
  end
409
+ Group::Collection.new(batches)
410
+ end
404
411
 
405
- # @example Request syntax with placeholder values
406
- #
407
- # attachedroles = policy.attached_roles({
408
- # path_prefix: "pathType",
409
- # })
410
- # @param [Hash] options ({})
411
- # @option options [String] :path_prefix
412
- # The path prefix for filtering the results. This parameter is optional.
413
- # If it is not included, it defaults to a slash (/), listing all
414
- # entities.
415
- #
416
- # The [regex pattern][1] for this parameter is a string of characters
417
- # consisting of either a forward slash (/) by itself or a string that
418
- # must begin and end with forward slashes, containing any ASCII
419
- # character from the ! (\\u0021) thru the DEL character (\\u007F),
420
- # including most punctuation characters, digits, and upper and
421
- # lowercased letters.
422
- #
423
- #
424
- #
425
- # [1]: http://wikipedia.org/wiki/regex
426
- # @return [Role::Collection]
427
- def attached_roles(options = {})
428
- batches = Enumerator.new do |y|
429
- options = options.merge(
430
- policy_arn: @arn,
431
- entity_filter: "Role"
432
- )
433
- resp = @client.list_entities_for_policy(options)
434
- resp.each_page do |page|
435
- batch = []
436
- page.data.policy_roles.each do |p|
437
- batch << Role.new(
438
- name: p.role_name,
439
- data: p,
440
- client: @client
441
- )
442
- end
443
- y.yield(batch)
412
+ # @example Request syntax with placeholder values
413
+ #
414
+ # attached_roles = policy.attached_roles({
415
+ # path_prefix: "pathType",
416
+ # })
417
+ # @param [Hash] options ({})
418
+ # @option options [String] :path_prefix
419
+ # The path prefix for filtering the results. This parameter is optional.
420
+ # If it is not included, it defaults to a slash (/), listing all
421
+ # entities.
422
+ #
423
+ # This paramater allows (per its [regex pattern][1]) a string of
424
+ # characters consisting of either a forward slash (/) by itself or a
425
+ # string that must begin and end with forward slashes, containing any
426
+ # ASCII character from the ! (\\u0021) thru the DEL character (\\u007F),
427
+ # including most punctuation characters, digits, and upper and
428
+ # lowercased letters.
429
+ #
430
+ #
431
+ #
432
+ # [1]: http://wikipedia.org/wiki/regex
433
+ # @return [Role::Collection]
434
+ def attached_roles(options = {})
435
+ batches = Enumerator.new do |y|
436
+ options = options.merge(
437
+ policy_arn: @arn,
438
+ entity_filter: "Role"
439
+ )
440
+ resp = @client.list_entities_for_policy(options)
441
+ resp.each_page do |page|
442
+ batch = []
443
+ page.data.policy_roles.each do |p|
444
+ batch << Role.new(
445
+ name: p.role_name,
446
+ data: p,
447
+ client: @client
448
+ )
444
449
  end
450
+ y.yield(batch)
445
451
  end
446
- Role::Collection.new(batches)
447
452
  end
453
+ Role::Collection.new(batches)
454
+ end
448
455
 
449
- # @example Request syntax with placeholder values
450
- #
451
- # attachedusers = policy.attached_users({
452
- # path_prefix: "pathType",
453
- # })
454
- # @param [Hash] options ({})
455
- # @option options [String] :path_prefix
456
- # The path prefix for filtering the results. This parameter is optional.
457
- # If it is not included, it defaults to a slash (/), listing all
458
- # entities.
459
- #
460
- # The [regex pattern][1] for this parameter is a string of characters
461
- # consisting of either a forward slash (/) by itself or a string that
462
- # must begin and end with forward slashes, containing any ASCII
463
- # character from the ! (\\u0021) thru the DEL character (\\u007F),
464
- # including most punctuation characters, digits, and upper and
465
- # lowercased letters.
466
- #
467
- #
468
- #
469
- # [1]: http://wikipedia.org/wiki/regex
470
- # @return [User::Collection]
471
- def attached_users(options = {})
472
- batches = Enumerator.new do |y|
473
- options = options.merge(
474
- policy_arn: @arn,
475
- entity_filter: "User"
476
- )
477
- resp = @client.list_entities_for_policy(options)
478
- resp.each_page do |page|
479
- batch = []
480
- page.data.policy_users.each do |p|
481
- batch << User.new(
482
- name: p.user_name,
483
- data: p,
484
- client: @client
485
- )
486
- end
487
- y.yield(batch)
456
+ # @example Request syntax with placeholder values
457
+ #
458
+ # attached_users = policy.attached_users({
459
+ # path_prefix: "pathType",
460
+ # })
461
+ # @param [Hash] options ({})
462
+ # @option options [String] :path_prefix
463
+ # The path prefix for filtering the results. This parameter is optional.
464
+ # If it is not included, it defaults to a slash (/), listing all
465
+ # entities.
466
+ #
467
+ # This paramater allows (per its [regex pattern][1]) a string of
468
+ # characters consisting of either a forward slash (/) by itself or a
469
+ # string that must begin and end with forward slashes, containing any
470
+ # ASCII character from the ! (\\u0021) thru the DEL character (\\u007F),
471
+ # including most punctuation characters, digits, and upper and
472
+ # lowercased letters.
473
+ #
474
+ #
475
+ #
476
+ # [1]: http://wikipedia.org/wiki/regex
477
+ # @return [User::Collection]
478
+ def attached_users(options = {})
479
+ batches = Enumerator.new do |y|
480
+ options = options.merge(
481
+ policy_arn: @arn,
482
+ entity_filter: "User"
483
+ )
484
+ resp = @client.list_entities_for_policy(options)
485
+ resp.each_page do |page|
486
+ batch = []
487
+ page.data.policy_users.each do |p|
488
+ batch << User.new(
489
+ name: p.user_name,
490
+ data: p,
491
+ client: @client
492
+ )
488
493
  end
494
+ y.yield(batch)
489
495
  end
490
- User::Collection.new(batches)
491
496
  end
497
+ User::Collection.new(batches)
498
+ end
492
499
 
493
- # @return [PolicyVersion, nil]
494
- def default_version
495
- if data.default_version_id
496
- PolicyVersion.new(
497
- arn: @arn,
498
- version_id: data.default_version_id,
499
- client: @client
500
- )
501
- else
502
- nil
503
- end
500
+ # @return [PolicyVersion, nil]
501
+ def default_version
502
+ if data.default_version_id
503
+ PolicyVersion.new(
504
+ arn: @arn,
505
+ version_id: data.default_version_id,
506
+ client: @client
507
+ )
508
+ else
509
+ nil
504
510
  end
511
+ end
505
512
 
506
- # @example Request syntax with placeholder values
507
- #
508
- # versions = policy.versions()
509
- # @param [Hash] options ({})
510
- # @return [PolicyVersion::Collection]
511
- def versions(options = {})
512
- batches = Enumerator.new do |y|
513
- options = options.merge(policy_arn: @arn)
514
- resp = @client.list_policy_versions(options)
515
- resp.each_page do |page|
516
- batch = []
517
- page.data.versions.each do |v|
518
- batch << PolicyVersion.new(
519
- arn: @arn,
520
- version_id: v.version_id,
521
- data: v,
522
- client: @client
523
- )
524
- end
525
- y.yield(batch)
513
+ # @example Request syntax with placeholder values
514
+ #
515
+ # policy.versions()
516
+ # @param [Hash] options ({})
517
+ # @return [PolicyVersion::Collection]
518
+ def versions(options = {})
519
+ batches = Enumerator.new do |y|
520
+ options = options.merge(policy_arn: @arn)
521
+ resp = @client.list_policy_versions(options)
522
+ resp.each_page do |page|
523
+ batch = []
524
+ page.data.versions.each do |v|
525
+ batch << PolicyVersion.new(
526
+ arn: @arn,
527
+ version_id: v.version_id,
528
+ data: v,
529
+ client: @client
530
+ )
526
531
  end
532
+ y.yield(batch)
527
533
  end
528
- PolicyVersion::Collection.new(batches)
529
534
  end
535
+ PolicyVersion::Collection.new(batches)
536
+ end
530
537
 
531
- # @deprecated
532
- # @api private
533
- def identifiers
534
- { arn: @arn }
535
- end
536
- deprecated(:identifiers)
537
-
538
- private
539
-
540
- def extract_arn(args, options)
541
- value = args[0] || options.delete(:arn)
542
- case value
543
- when String then value
544
- when nil then raise ArgumentError, "missing required option :arn"
545
- else
546
- msg = "expected :arn to be a String, got #{value.class}"
547
- raise ArgumentError, msg
548
- end
538
+ # @deprecated
539
+ # @api private
540
+ def identifiers
541
+ { arn: @arn }
542
+ end
543
+ deprecated(:identifiers)
544
+
545
+ private
546
+
547
+ def extract_arn(args, options)
548
+ value = args[0] || options.delete(:arn)
549
+ case value
550
+ when String then value
551
+ when nil then raise ArgumentError, "missing required option :arn"
552
+ else
553
+ msg = "expected :arn to be a String, got #{value.class}"
554
+ raise ArgumentError, msg
549
555
  end
550
-
551
- class Collection < Aws::Resources::Collection; end
552
556
  end
557
+
558
+ class Collection < Aws::Resources::Collection; end
553
559
  end
554
560
  end