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.
- 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/user.rb
CHANGED
@@ -1,744 +1,749 @@
|
|
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 User
|
10
|
+
|
11
|
+
extend Aws::Deprecations
|
12
|
+
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
28
|
+
# @return [String]
|
29
|
+
def name
|
30
|
+
@name
|
31
|
+
end
|
32
|
+
alias :user_name :name
|
33
|
+
|
34
|
+
# The path to the user. 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 user. 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 user_id
|
54
|
+
data.user_id
|
55
|
+
end
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
57
|
+
# The Amazon Resource Name (ARN) that identifies the user. For more
|
58
|
+
# information about ARNs and how to use ARNs 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 user
|
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
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
80
|
+
# The date and time, in [ISO 8601 date-time format][1], when the user's
|
81
|
+
# password was last used to sign in to an AWS website. For a list of AWS
|
82
|
+
# websites that capture a user's last sign-in time, see the [Credential
|
83
|
+
# Reports][2] topic in the *Using IAM* guide. If a password is used more
|
84
|
+
# than once in a five-minute span, only the first use is returned in
|
85
|
+
# this field. This field is null (not present) when:
|
86
|
+
#
|
87
|
+
# * The user does not have a password
|
88
|
+
#
|
89
|
+
# * The password exists but has never been used (at least not since IAM
|
90
|
+
# started tracking this information on October 20th, 2014
|
91
|
+
#
|
92
|
+
# * there is no sign-in data associated with the user
|
93
|
+
#
|
94
|
+
# This value is returned only in the GetUser and ListUsers actions.
|
95
|
+
#
|
96
|
+
#
|
97
|
+
#
|
98
|
+
# [1]: http://www.iso.org/iso/iso8601
|
99
|
+
# [2]: http://docs.aws.amazon.com/IAM/latest/UserGuide/credential-reports.html
|
100
|
+
# @return [Time]
|
101
|
+
def password_last_used
|
102
|
+
data.password_last_used
|
103
|
+
end
|
105
104
|
|
106
|
-
|
105
|
+
# @!endgroup
|
107
106
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
107
|
+
# @return [Client]
|
108
|
+
def client
|
109
|
+
@client
|
110
|
+
end
|
112
111
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
112
|
+
# Loads, or reloads {#data} for the current {User}.
|
113
|
+
# Returns `self` making it possible to chain methods.
|
114
|
+
#
|
115
|
+
# user.reload.data
|
116
|
+
#
|
117
|
+
# @return [self]
|
118
|
+
def load
|
119
|
+
resp = @client.get_user(user_name: @name)
|
120
|
+
@data = resp.user
|
121
|
+
self
|
122
|
+
end
|
123
|
+
alias :reload :load
|
124
|
+
|
125
|
+
# @return [Types::User]
|
126
|
+
# Returns the data for this {User}. Calls
|
127
|
+
# {Client#get_user} if {#data_loaded?} is `false`.
|
128
|
+
def data
|
129
|
+
load unless @data
|
130
|
+
@data
|
131
|
+
end
|
133
132
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
133
|
+
# @return [Boolean]
|
134
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
135
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
136
|
+
def data_loaded?
|
137
|
+
!!@data
|
138
|
+
end
|
140
139
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
end
|
140
|
+
# @param [Hash] options ({})
|
141
|
+
# @return [Boolean]
|
142
|
+
# Returns `true` if the User exists.
|
143
|
+
def exists?(options = {})
|
144
|
+
begin
|
145
|
+
wait_until_exists(options.merge(max_attempts: 1))
|
146
|
+
true
|
147
|
+
rescue Aws::Waiters::Errors::UnexpectedError => e
|
148
|
+
raise e.error
|
149
|
+
rescue Aws::Waiters::Errors::WaiterFailed
|
150
|
+
false
|
153
151
|
end
|
152
|
+
end
|
154
153
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
154
|
+
# @param [Hash] options ({})
|
155
|
+
# @option options [Integer] :max_attempts (20)
|
156
|
+
# @option options [Float] :delay (1)
|
157
|
+
# @option options [Proc] :before_attempt
|
158
|
+
# @option options [Proc] :before_wait
|
159
|
+
# @return [User]
|
160
|
+
def wait_until_exists(options = {})
|
161
|
+
options, params = separate_params_and_options(options)
|
162
|
+
waiter = Waiters::UserExists.new(options)
|
163
|
+
yield_waiter_and_warn(waiter, &Proc.new) if block_given?
|
164
|
+
waiter.wait(params.merge(user_name: @name))
|
165
|
+
User.new({
|
166
|
+
name: @name,
|
167
|
+
client: @client
|
168
|
+
})
|
169
|
+
end
|
171
170
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
171
|
+
# @!group Actions
|
172
|
+
|
173
|
+
# @example Request syntax with placeholder values
|
174
|
+
#
|
175
|
+
# user.add_group({
|
176
|
+
# group_name: "groupNameType", # required
|
177
|
+
# })
|
178
|
+
# @param [Hash] options ({})
|
179
|
+
# @option options [required, String] :group_name
|
180
|
+
# The name of the group to update.
|
181
|
+
#
|
182
|
+
# This parameter allows (per its [regex pattern][1]) a string of
|
183
|
+
# characters consisting of upper and lowercase alphanumeric characters
|
184
|
+
# with no spaces. You can also include any of the following characters:
|
185
|
+
# =,.@-
|
186
|
+
#
|
187
|
+
#
|
188
|
+
#
|
189
|
+
# [1]: http://wikipedia.org/wiki/regex
|
190
|
+
# @return [EmptyStructure]
|
191
|
+
def add_group(options = {})
|
192
|
+
options = options.merge(user_name: @name)
|
193
|
+
resp = @client.add_user_to_group(options)
|
194
|
+
resp.data
|
195
|
+
end
|
196
196
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
197
|
+
# @example Request syntax with placeholder values
|
198
|
+
#
|
199
|
+
# user.attach_policy({
|
200
|
+
# policy_arn: "arnType", # required
|
201
|
+
# })
|
202
|
+
# @param [Hash] options ({})
|
203
|
+
# @option options [required, String] :policy_arn
|
204
|
+
# The Amazon Resource Name (ARN) of the IAM policy you want to attach.
|
205
|
+
#
|
206
|
+
# For more information about ARNs, see [Amazon Resource Names (ARNs) and
|
207
|
+
# AWS Service Namespaces][1] in the *AWS General Reference*.
|
208
|
+
#
|
209
|
+
#
|
210
|
+
#
|
211
|
+
# [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
|
212
|
+
# @return [EmptyStructure]
|
213
|
+
def attach_policy(options = {})
|
214
|
+
options = options.merge(user_name: @name)
|
215
|
+
resp = @client.attach_user_policy(options)
|
216
|
+
resp.data
|
217
|
+
end
|
218
218
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
219
|
+
# @example Request syntax with placeholder values
|
220
|
+
#
|
221
|
+
# user = user.create({
|
222
|
+
# path: "pathType",
|
223
|
+
# })
|
224
|
+
# @param [Hash] options ({})
|
225
|
+
# @option options [String] :path
|
226
|
+
# The path for the user name. For more information about paths, see [IAM
|
227
|
+
# Identifiers][1] in the *IAM User Guide*.
|
228
|
+
#
|
229
|
+
# This parameter is optional. If it is not included, it defaults to a
|
230
|
+
# slash (/).
|
231
|
+
#
|
232
|
+
# This paramater allows (per its [regex pattern][2]) a string of
|
233
|
+
# characters consisting of either a forward slash (/) by itself or a
|
234
|
+
# string that must begin and end with forward slashes, containing any
|
235
|
+
# ASCII character from the ! (\\u0021) thru the DEL character (\\u007F),
|
236
|
+
# including most punctuation characters, digits, and upper and
|
237
|
+
# lowercased letters.
|
238
|
+
#
|
239
|
+
#
|
240
|
+
#
|
241
|
+
# [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
|
242
|
+
# [2]: http://wikipedia.org/wiki/regex
|
243
|
+
# @return [User]
|
244
|
+
def create(options = {})
|
245
|
+
options = options.merge(user_name: @name)
|
246
|
+
resp = @client.create_user(options)
|
247
|
+
User.new(
|
248
|
+
name: options[:user_name],
|
249
|
+
data: resp.data.user,
|
250
|
+
client: @client
|
251
|
+
)
|
252
|
+
end
|
253
253
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
254
|
+
# @example Request syntax with placeholder values
|
255
|
+
#
|
256
|
+
# user.create_access_key_pair()
|
257
|
+
# @param [Hash] options ({})
|
258
|
+
# @return [AccessKeyPair]
|
259
|
+
def create_access_key_pair(options = {})
|
260
|
+
options = options.merge(user_name: @name)
|
261
|
+
resp = @client.create_access_key(options)
|
262
|
+
AccessKeyPair.new(
|
263
|
+
user_name: @name,
|
264
|
+
id: resp.data.access_key.access_key_id,
|
265
|
+
secret: resp.data.access_key.secret_access_key,
|
266
|
+
data: resp.data.access_key,
|
267
|
+
client: @client
|
268
|
+
)
|
269
|
+
end
|
270
270
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
271
|
+
# @example Request syntax with placeholder values
|
272
|
+
#
|
273
|
+
# loginprofile = user.create_login_profile({
|
274
|
+
# password: "passwordType", # required
|
275
|
+
# password_reset_required: false,
|
276
|
+
# })
|
277
|
+
# @param [Hash] options ({})
|
278
|
+
# @option options [required, String] :password
|
279
|
+
# The new password for the user.
|
280
|
+
#
|
281
|
+
# The [regex pattern][1] used to validate this parameter is a string of
|
282
|
+
# characters consisting of almost any printable ASCII character from the
|
283
|
+
# space (\\u0020) through the end of the ASCII character range
|
284
|
+
# (\\u00FF). You can also include the tab (\\u0009), line feed
|
285
|
+
# (\\u000A), and carriage return (\\u000D) characters. Although any of
|
286
|
+
# these characters are valid in a password, note that many tools, such
|
287
|
+
# as the AWS Management Console, might restrict the ability to enter
|
288
|
+
# certain characters because they have special meaning within that tool.
|
289
|
+
#
|
290
|
+
#
|
291
|
+
#
|
292
|
+
# [1]: http://wikipedia.org/wiki/regex
|
293
|
+
# @option options [Boolean] :password_reset_required
|
294
|
+
# Specifies whether the user is required to set a new password on next
|
295
|
+
# sign-in.
|
296
|
+
# @return [LoginProfile]
|
297
|
+
def create_login_profile(options = {})
|
298
|
+
options = options.merge(user_name: @name)
|
299
|
+
resp = @client.create_login_profile(options)
|
300
|
+
LoginProfile.new(
|
301
|
+
user_name: resp.data.login_profile.user_name,
|
302
|
+
data: resp.data.login_profile,
|
303
|
+
client: @client
|
304
|
+
)
|
305
|
+
end
|
306
306
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
307
|
+
# @example Request syntax with placeholder values
|
308
|
+
#
|
309
|
+
# userpolicy = user.create_policy({
|
310
|
+
# policy_name: "policyNameType", # required
|
311
|
+
# policy_document: "policyDocumentType", # required
|
312
|
+
# })
|
313
|
+
# @param [Hash] options ({})
|
314
|
+
# @option options [required, String] :policy_name
|
315
|
+
# The name of the policy document.
|
316
|
+
#
|
317
|
+
# This parameter allows (per its [regex pattern][1]) a string of
|
318
|
+
# characters consisting of upper and lowercase alphanumeric characters
|
319
|
+
# with no spaces. You can also include any of the following characters:
|
320
|
+
# =,.@-
|
321
|
+
#
|
322
|
+
#
|
323
|
+
#
|
324
|
+
# [1]: http://wikipedia.org/wiki/regex
|
325
|
+
# @option options [required, String] :policy_document
|
326
|
+
# The policy document.
|
327
|
+
#
|
328
|
+
# The [regex pattern][1] used to validate this parameter is a string of
|
329
|
+
# characters consisting of any printable ASCII character ranging from
|
330
|
+
# the space character (\\u0020) through end of the ASCII character range
|
331
|
+
# as well as the printable characters in the Basic Latin and Latin-1
|
332
|
+
# Supplement character set (through \\u00FF). It also includes the
|
333
|
+
# special characters tab (\\u0009), line feed (\\u000A), and carriage
|
334
|
+
# return (\\u000D).
|
335
|
+
#
|
336
|
+
#
|
337
|
+
#
|
338
|
+
# [1]: http://wikipedia.org/wiki/regex
|
339
|
+
# @return [UserPolicy]
|
340
|
+
def create_policy(options = {})
|
341
|
+
options = options.merge(user_name: @name)
|
342
|
+
resp = @client.put_user_policy(options)
|
343
|
+
UserPolicy.new(
|
344
|
+
user_name: @name,
|
345
|
+
name: options[:policy_name],
|
346
|
+
client: @client
|
347
|
+
)
|
348
|
+
end
|
346
349
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
350
|
+
# @example Request syntax with placeholder values
|
351
|
+
#
|
352
|
+
# user.delete()
|
353
|
+
# @param [Hash] options ({})
|
354
|
+
# @return [EmptyStructure]
|
355
|
+
def delete(options = {})
|
356
|
+
options = options.merge(user_name: @name)
|
357
|
+
resp = @client.delete_user(options)
|
358
|
+
resp.data
|
359
|
+
end
|
357
360
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
361
|
+
# @example Request syntax with placeholder values
|
362
|
+
#
|
363
|
+
# user.detach_policy({
|
364
|
+
# policy_arn: "arnType", # required
|
365
|
+
# })
|
366
|
+
# @param [Hash] options ({})
|
367
|
+
# @option options [required, String] :policy_arn
|
368
|
+
# The Amazon Resource Name (ARN) of the IAM policy you want to detach.
|
369
|
+
#
|
370
|
+
# For more information about ARNs, see [Amazon Resource Names (ARNs) and
|
371
|
+
# AWS Service Namespaces][1] in the *AWS General Reference*.
|
372
|
+
#
|
373
|
+
#
|
374
|
+
#
|
375
|
+
# [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
|
376
|
+
# @return [EmptyStructure]
|
377
|
+
def detach_policy(options = {})
|
378
|
+
options = options.merge(user_name: @name)
|
379
|
+
resp = @client.detach_user_policy(options)
|
380
|
+
resp.data
|
381
|
+
end
|
379
382
|
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
383
|
+
# @example Request syntax with placeholder values
|
384
|
+
#
|
385
|
+
# mfadevice = user.enable_mfa({
|
386
|
+
# serial_number: "serialNumberType", # required
|
387
|
+
# authentication_code_1: "authenticationCodeType", # required
|
388
|
+
# authentication_code_2: "authenticationCodeType", # required
|
389
|
+
# })
|
390
|
+
# @param [Hash] options ({})
|
391
|
+
# @option options [required, String] :serial_number
|
392
|
+
# The serial number that uniquely identifies the MFA device. For virtual
|
393
|
+
# MFA devices, the serial number is the device ARN.
|
394
|
+
#
|
395
|
+
# This parameter allows (per its [regex pattern][1]) a string of
|
396
|
+
# characters consisting of upper and lowercase alphanumeric characters
|
397
|
+
# with no spaces. You can also include any of the following characters:
|
398
|
+
# =/:,.@-
|
399
|
+
#
|
400
|
+
#
|
401
|
+
#
|
402
|
+
# [1]: http://wikipedia.org/wiki/regex
|
403
|
+
# @option options [required, String] :authentication_code_1
|
404
|
+
# An authentication code emitted by the device.
|
405
|
+
#
|
406
|
+
# The format for this parameter is a string of 6 digits.
|
407
|
+
# @option options [required, String] :authentication_code_2
|
408
|
+
# A subsequent authentication code emitted by the device.
|
409
|
+
#
|
410
|
+
# The format for this parameter is a string of 6 digits.
|
411
|
+
# @return [MfaDevice]
|
412
|
+
def enable_mfa(options = {})
|
413
|
+
options = options.merge(user_name: @name)
|
414
|
+
resp = @client.enable_mfa_device(options)
|
415
|
+
MfaDevice.new(
|
416
|
+
user_name: @name,
|
417
|
+
serial_number: options[:serial_number],
|
418
|
+
client: @client
|
419
|
+
)
|
420
|
+
end
|
417
421
|
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
422
|
+
# @example Request syntax with placeholder values
|
423
|
+
#
|
424
|
+
# user.remove_group({
|
425
|
+
# group_name: "groupNameType", # required
|
426
|
+
# })
|
427
|
+
# @param [Hash] options ({})
|
428
|
+
# @option options [required, String] :group_name
|
429
|
+
# The name of the group to update.
|
430
|
+
#
|
431
|
+
# This parameter allows (per its [regex pattern][1]) a string of
|
432
|
+
# characters consisting of upper and lowercase alphanumeric characters
|
433
|
+
# with no spaces. You can also include any of the following characters:
|
434
|
+
# =,.@-
|
435
|
+
#
|
436
|
+
#
|
437
|
+
#
|
438
|
+
# [1]: http://wikipedia.org/wiki/regex
|
439
|
+
# @return [EmptyStructure]
|
440
|
+
def remove_group(options = {})
|
441
|
+
options = options.merge(user_name: @name)
|
442
|
+
resp = @client.remove_user_from_group(options)
|
443
|
+
resp.data
|
444
|
+
end
|
440
445
|
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
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
|
-
|
446
|
+
# @example Request syntax with placeholder values
|
447
|
+
#
|
448
|
+
# user = user.update({
|
449
|
+
# new_path: "pathType",
|
450
|
+
# new_user_name: "userNameType",
|
451
|
+
# })
|
452
|
+
# @param [Hash] options ({})
|
453
|
+
# @option options [String] :new_path
|
454
|
+
# New path for the IAM user. Include this parameter only if you're
|
455
|
+
# changing the user's path.
|
456
|
+
#
|
457
|
+
# This paramater allows (per its [regex pattern][1]) a string of
|
458
|
+
# characters consisting of either a forward slash (/) by itself or a
|
459
|
+
# string that must begin and end with forward slashes, containing any
|
460
|
+
# ASCII character from the ! (\\u0021) thru the DEL character (\\u007F),
|
461
|
+
# including most punctuation characters, digits, and upper and
|
462
|
+
# lowercased letters.
|
463
|
+
#
|
464
|
+
#
|
465
|
+
#
|
466
|
+
# [1]: http://wikipedia.org/wiki/regex
|
467
|
+
# @option options [String] :new_user_name
|
468
|
+
# New name for the user. Include this parameter only if you're changing
|
469
|
+
# the user's name.
|
470
|
+
#
|
471
|
+
# This parameter allows (per its [regex pattern][1]) a string of
|
472
|
+
# characters consisting of upper and lowercase alphanumeric characters
|
473
|
+
# with no spaces. You can also include any of the following characters:
|
474
|
+
# =,.@-
|
475
|
+
#
|
476
|
+
#
|
477
|
+
#
|
478
|
+
# [1]: http://wikipedia.org/wiki/regex
|
479
|
+
# @return [User]
|
480
|
+
def update(options = {})
|
481
|
+
options = options.merge(user_name: @name)
|
482
|
+
resp = @client.update_user(options)
|
483
|
+
User.new(
|
484
|
+
name: options[:new_user_name],
|
485
|
+
client: @client
|
486
|
+
)
|
487
|
+
end
|
482
488
|
|
483
|
-
|
489
|
+
# @!group Associations
|
484
490
|
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
491
|
+
# @param [String] id
|
492
|
+
# @return [AccessKey]
|
493
|
+
def access_key(id)
|
494
|
+
AccessKey.new(
|
495
|
+
user_name: @name,
|
496
|
+
id: id,
|
497
|
+
client: @client
|
498
|
+
)
|
499
|
+
end
|
494
500
|
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
end
|
514
|
-
y.yield(batch)
|
501
|
+
# @example Request syntax with placeholder values
|
502
|
+
#
|
503
|
+
# user.access_keys()
|
504
|
+
# @param [Hash] options ({})
|
505
|
+
# @return [AccessKey::Collection]
|
506
|
+
def access_keys(options = {})
|
507
|
+
batches = Enumerator.new do |y|
|
508
|
+
options = options.merge(user_name: @name)
|
509
|
+
resp = @client.list_access_keys(options)
|
510
|
+
resp.each_page do |page|
|
511
|
+
batch = []
|
512
|
+
page.data.access_key_metadata.each do |a|
|
513
|
+
batch << AccessKey.new(
|
514
|
+
user_name: @name,
|
515
|
+
id: a.access_key_id,
|
516
|
+
data: a,
|
517
|
+
client: @client
|
518
|
+
)
|
515
519
|
end
|
520
|
+
y.yield(batch)
|
516
521
|
end
|
517
|
-
AccessKey::Collection.new(batches)
|
518
522
|
end
|
523
|
+
AccessKey::Collection.new(batches)
|
524
|
+
end
|
519
525
|
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
end
|
554
|
-
y.yield(batch)
|
526
|
+
# @example Request syntax with placeholder values
|
527
|
+
#
|
528
|
+
# attached_policies = user.attached_policies({
|
529
|
+
# path_prefix: "policyPathType",
|
530
|
+
# })
|
531
|
+
# @param [Hash] options ({})
|
532
|
+
# @option options [String] :path_prefix
|
533
|
+
# The path prefix for filtering the results. This parameter is optional.
|
534
|
+
# If it is not included, it defaults to a slash (/), listing all
|
535
|
+
# policies.
|
536
|
+
#
|
537
|
+
# This paramater allows (per its [regex pattern][1]) a string of
|
538
|
+
# characters consisting of either a forward slash (/) by itself or a
|
539
|
+
# string that must begin and end with forward slashes, containing any
|
540
|
+
# ASCII character from the ! (\\u0021) thru the DEL character (\\u007F),
|
541
|
+
# including most punctuation characters, digits, and upper and
|
542
|
+
# lowercased letters.
|
543
|
+
#
|
544
|
+
#
|
545
|
+
#
|
546
|
+
# [1]: http://wikipedia.org/wiki/regex
|
547
|
+
# @return [Policy::Collection]
|
548
|
+
def attached_policies(options = {})
|
549
|
+
batches = Enumerator.new do |y|
|
550
|
+
options = options.merge(user_name: @name)
|
551
|
+
resp = @client.list_attached_user_policies(options)
|
552
|
+
resp.each_page do |page|
|
553
|
+
batch = []
|
554
|
+
page.data.attached_policies.each do |a|
|
555
|
+
batch << Policy.new(
|
556
|
+
arn: a.policy_arn,
|
557
|
+
client: @client
|
558
|
+
)
|
555
559
|
end
|
560
|
+
y.yield(batch)
|
556
561
|
end
|
557
|
-
Policy::Collection.new(batches)
|
558
562
|
end
|
563
|
+
Policy::Collection.new(batches)
|
564
|
+
end
|
559
565
|
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
end
|
578
|
-
y.yield(batch)
|
566
|
+
# @example Request syntax with placeholder values
|
567
|
+
#
|
568
|
+
# user.groups()
|
569
|
+
# @param [Hash] options ({})
|
570
|
+
# @return [Group::Collection]
|
571
|
+
def groups(options = {})
|
572
|
+
batches = Enumerator.new do |y|
|
573
|
+
options = options.merge(user_name: @name)
|
574
|
+
resp = @client.list_groups_for_user(options)
|
575
|
+
resp.each_page do |page|
|
576
|
+
batch = []
|
577
|
+
page.data.groups.each do |g|
|
578
|
+
batch << Group.new(
|
579
|
+
name: g.group_name,
|
580
|
+
data: g,
|
581
|
+
client: @client
|
582
|
+
)
|
579
583
|
end
|
584
|
+
y.yield(batch)
|
580
585
|
end
|
581
|
-
Group::Collection.new(batches)
|
582
586
|
end
|
587
|
+
Group::Collection.new(batches)
|
588
|
+
end
|
583
589
|
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
590
|
+
# @return [LoginProfile]
|
591
|
+
def login_profile
|
592
|
+
LoginProfile.new(
|
593
|
+
user_name: @name,
|
594
|
+
client: @client
|
595
|
+
)
|
596
|
+
end
|
591
597
|
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
598
|
+
# @param [String] serial_number
|
599
|
+
# @return [MfaDevice]
|
600
|
+
def mfa_device(serial_number)
|
601
|
+
MfaDevice.new(
|
602
|
+
user_name: @name,
|
603
|
+
serial_number: serial_number,
|
604
|
+
client: @client
|
605
|
+
)
|
606
|
+
end
|
601
607
|
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
end
|
621
|
-
y.yield(batch)
|
608
|
+
# @example Request syntax with placeholder values
|
609
|
+
#
|
610
|
+
# user.mfa_devices()
|
611
|
+
# @param [Hash] options ({})
|
612
|
+
# @return [MfaDevice::Collection]
|
613
|
+
def mfa_devices(options = {})
|
614
|
+
batches = Enumerator.new do |y|
|
615
|
+
options = options.merge(user_name: @name)
|
616
|
+
resp = @client.list_mfa_devices(options)
|
617
|
+
resp.each_page do |page|
|
618
|
+
batch = []
|
619
|
+
page.data.mfa_devices.each do |m|
|
620
|
+
batch << MfaDevice.new(
|
621
|
+
user_name: @name,
|
622
|
+
serial_number: m.serial_number,
|
623
|
+
data: m,
|
624
|
+
client: @client
|
625
|
+
)
|
622
626
|
end
|
627
|
+
y.yield(batch)
|
623
628
|
end
|
624
|
-
MfaDevice::Collection.new(batches)
|
625
629
|
end
|
630
|
+
MfaDevice::Collection.new(batches)
|
631
|
+
end
|
626
632
|
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
end
|
645
|
-
y.yield(batch)
|
633
|
+
# @example Request syntax with placeholder values
|
634
|
+
#
|
635
|
+
# user.policies()
|
636
|
+
# @param [Hash] options ({})
|
637
|
+
# @return [UserPolicy::Collection]
|
638
|
+
def policies(options = {})
|
639
|
+
batches = Enumerator.new do |y|
|
640
|
+
options = options.merge(user_name: @name)
|
641
|
+
resp = @client.list_user_policies(options)
|
642
|
+
resp.each_page do |page|
|
643
|
+
batch = []
|
644
|
+
page.data.policy_names.each do |p|
|
645
|
+
batch << UserPolicy.new(
|
646
|
+
user_name: @name,
|
647
|
+
name: p,
|
648
|
+
client: @client
|
649
|
+
)
|
646
650
|
end
|
651
|
+
y.yield(batch)
|
647
652
|
end
|
648
|
-
UserPolicy::Collection.new(batches)
|
649
653
|
end
|
654
|
+
UserPolicy::Collection.new(batches)
|
655
|
+
end
|
650
656
|
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
657
|
+
# @param [String] name
|
658
|
+
# @return [UserPolicy]
|
659
|
+
def policy(name)
|
660
|
+
UserPolicy.new(
|
661
|
+
user_name: @name,
|
662
|
+
name: name,
|
663
|
+
client: @client
|
664
|
+
)
|
665
|
+
end
|
660
666
|
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
667
|
+
# @param [String] id
|
668
|
+
# @return [SigningCertificate]
|
669
|
+
def signing_certificate(id)
|
670
|
+
SigningCertificate.new(
|
671
|
+
user_name: @name,
|
672
|
+
id: id,
|
673
|
+
client: @client
|
674
|
+
)
|
675
|
+
end
|
670
676
|
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
end
|
690
|
-
y.yield(batch)
|
677
|
+
# @example Request syntax with placeholder values
|
678
|
+
#
|
679
|
+
# user.signing_certificates()
|
680
|
+
# @param [Hash] options ({})
|
681
|
+
# @return [SigningCertificate::Collection]
|
682
|
+
def signing_certificates(options = {})
|
683
|
+
batches = Enumerator.new do |y|
|
684
|
+
options = options.merge(user_name: @name)
|
685
|
+
resp = @client.list_signing_certificates(options)
|
686
|
+
resp.each_page do |page|
|
687
|
+
batch = []
|
688
|
+
page.data.certificates.each do |c|
|
689
|
+
batch << SigningCertificate.new(
|
690
|
+
user_name: @name,
|
691
|
+
id: c.certificate_id,
|
692
|
+
data: c,
|
693
|
+
client: @client
|
694
|
+
)
|
691
695
|
end
|
696
|
+
y.yield(batch)
|
692
697
|
end
|
693
|
-
SigningCertificate::Collection.new(batches)
|
694
698
|
end
|
699
|
+
SigningCertificate::Collection.new(batches)
|
700
|
+
end
|
695
701
|
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
+
# @deprecated
|
703
|
+
# @api private
|
704
|
+
def identifiers
|
705
|
+
{ name: @name }
|
706
|
+
end
|
707
|
+
deprecated(:identifiers)
|
702
708
|
|
703
|
-
|
709
|
+
private
|
704
710
|
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
end
|
711
|
+
def extract_name(args, options)
|
712
|
+
value = args[0] || options.delete(:name)
|
713
|
+
case value
|
714
|
+
when String then value
|
715
|
+
when nil then raise ArgumentError, "missing required option :name"
|
716
|
+
else
|
717
|
+
msg = "expected :name to be a String, got #{value.class}"
|
718
|
+
raise ArgumentError, msg
|
714
719
|
end
|
720
|
+
end
|
715
721
|
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
end
|
723
|
-
yield(waiter.waiter)
|
722
|
+
def yield_waiter_and_warn(waiter, &block)
|
723
|
+
if !@waiter_block_warned
|
724
|
+
msg = "pass options to configure the waiter; "
|
725
|
+
msg << "yielding the waiter is deprecated"
|
726
|
+
warn(msg)
|
727
|
+
@waiter_block_warned = true
|
724
728
|
end
|
729
|
+
yield(waiter.waiter)
|
730
|
+
end
|
725
731
|
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
end
|
732
|
+
def separate_params_and_options(options)
|
733
|
+
opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
|
734
|
+
waiter_opts = {}
|
735
|
+
waiter_params = {}
|
736
|
+
options.each_pair do |key, value|
|
737
|
+
if opts.include?(key)
|
738
|
+
waiter_opts[key] = value
|
739
|
+
else
|
740
|
+
waiter_params[key] = value
|
736
741
|
end
|
737
|
-
waiter_opts[:client] ||= @client
|
738
|
-
[waiter_opts, waiter_params]
|
739
742
|
end
|
740
|
-
|
741
|
-
|
743
|
+
waiter_opts[:client] ||= @client
|
744
|
+
[waiter_opts, waiter_params]
|
742
745
|
end
|
746
|
+
|
747
|
+
class Collection < Aws::Resources::Collection; end
|
743
748
|
end
|
744
749
|
end
|