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.
- checksums.yaml +4 -4
- data/lib/aws-sdk-iam.rb +1 -1
- data/lib/aws-sdk-iam/access_key.rb +150 -152
- data/lib/aws-sdk-iam/access_key_pair.rb +160 -162
- data/lib/aws-sdk-iam/account_password_policy.rb +208 -207
- data/lib/aws-sdk-iam/account_summary.rb +55 -57
- data/lib/aws-sdk-iam/assume_role_policy.rb +101 -101
- data/lib/aws-sdk-iam/client.rb +7849 -6742
- data/lib/aws-sdk-iam/client_api.rb +2896 -2784
- data/lib/aws-sdk-iam/current_user.rb +231 -230
- data/lib/aws-sdk-iam/errors.rb +4 -13
- data/lib/aws-sdk-iam/group.rb +422 -418
- data/lib/aws-sdk-iam/group_policy.rb +153 -153
- data/lib/aws-sdk-iam/instance_profile.rb +223 -223
- data/lib/aws-sdk-iam/login_profile.rb +171 -172
- data/lib/aws-sdk-iam/mfa_device.rb +163 -165
- data/lib/aws-sdk-iam/policy.rb +508 -502
- data/lib/aws-sdk-iam/policy_version.rb +149 -151
- data/lib/aws-sdk-iam/resource.rb +986 -969
- data/lib/aws-sdk-iam/role.rb +262 -264
- data/lib/aws-sdk-iam/role_policy.rb +153 -153
- data/lib/aws-sdk-iam/saml_provider.rb +120 -122
- data/lib/aws-sdk-iam/server_certificate.rb +144 -145
- data/lib/aws-sdk-iam/signing_certificate.rb +155 -157
- data/lib/aws-sdk-iam/types.rb +8333 -7476
- data/lib/aws-sdk-iam/user.rb +677 -672
- data/lib/aws-sdk-iam/user_policy.rb +153 -153
- data/lib/aws-sdk-iam/virtual_mfa_device.rb +117 -119
- data/lib/aws-sdk-iam/waiters.rb +76 -77
- metadata +2 -2
data/lib/aws-sdk-iam/policy.rb
CHANGED
@@ -1,554 +1,560 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
26
|
+
# @!group Read-Only Attributes
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
# @return [String]
|
29
|
+
def arn
|
30
|
+
@arn
|
31
|
+
end
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
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
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
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
|
-
|
122
|
+
# @!endgroup
|
124
123
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
124
|
+
# @return [Client]
|
125
|
+
def client
|
126
|
+
@client
|
127
|
+
end
|
129
128
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
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
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
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
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
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
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
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
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
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
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
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
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
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
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
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
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
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
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
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
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
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
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
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
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
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
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
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
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
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
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
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
|