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/role.rb
CHANGED
@@ -1,310 +1,308 @@
|
|
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
|
-
class Role
|
8
|
+
module Aws::IAM
|
9
|
+
class Role
|
11
10
|
|
12
|
-
|
11
|
+
extend Aws::Deprecations
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
|
26
|
+
# @!group Read-Only Attributes
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
# @return [String]
|
29
|
+
def name
|
30
|
+
@name
|
31
|
+
end
|
32
|
+
alias :role_name :name
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
86
|
+
# @!endgroup
|
88
87
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
# @return [Client]
|
89
|
+
def client
|
90
|
+
@client
|
91
|
+
end
|
93
92
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
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
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
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
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
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
|
-
|
121
|
+
# @!group Actions
|
123
122
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
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
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
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
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
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
|
-
|
178
|
+
# @!group Associations
|
180
179
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
180
|
+
# @return [AssumeRolePolicy]
|
181
|
+
def assume_role_policy
|
182
|
+
AssumeRolePolicy.new(
|
183
|
+
role_name: @name,
|
184
|
+
client: @client
|
185
|
+
)
|
186
|
+
end
|
188
187
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
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
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
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
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
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
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
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
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
286
|
+
# @deprecated
|
287
|
+
# @api private
|
288
|
+
def identifiers
|
289
|
+
{ name: @name }
|
290
|
+
end
|
291
|
+
deprecated(:identifiers)
|
293
292
|
|
294
|
-
|
293
|
+
private
|
295
294
|
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
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
|