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

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,744 +1,749 @@
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 User
11
-
12
- extend Aws::Deprecations
13
-
14
- # @overload def initialize(name, options = {})
15
- # @param [String] name
16
- # @option options [Client] :client
17
- # @overload def initialize(options = {})
18
- # @option options [required, String] :name
19
- # @option options [Client] :client
20
- def initialize(*args)
21
- options = Hash === args.last ? args.pop.dup : {}
22
- @name = extract_name(args, options)
23
- @data = options.delete(:data)
24
- @client = options.delete(:client) || Client.new(options)
25
- end
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
- # @!group Read-Only Attributes
26
+ # @!group Read-Only Attributes
28
27
 
29
- # @return [String]
30
- def name
31
- @name
32
- end
33
- alias :user_name :name
34
-
35
- # The path to the user. For more information about paths, see [IAM
36
- # Identifiers][1] in the *Using IAM* guide.
37
- #
38
- #
39
- #
40
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
41
- # @return [String]
42
- def path
43
- data.path
44
- end
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
- # The stable and unique string identifying the user. For more
47
- # information about IDs, see [IAM Identifiers][1] in the *Using IAM*
48
- # guide.
49
- #
50
- #
51
- #
52
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
53
- # @return [String]
54
- def user_id
55
- data.user_id
56
- end
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
- # The Amazon Resource Name (ARN) that identifies the user. For more
59
- # information about ARNs and how to use ARNs in policies, see [IAM
60
- # Identifiers][1] in the *Using IAM* guide.
61
- #
62
- #
63
- #
64
- # [1]: http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
65
- # @return [String]
66
- def arn
67
- data.arn
68
- end
57
+ # The Amazon Resource Name (ARN) 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
- # The date and time, in [ISO 8601 date-time format][1], when the user
71
- # was created.
72
- #
73
- #
74
- #
75
- # [1]: http://www.iso.org/iso/iso8601
76
- # @return [Time]
77
- def create_date
78
- data.create_date
79
- end
69
+ # The date and time, in [ISO 8601 date-time format][1], when the 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
- # The date and time, in [ISO 8601 date-time format][1], when the user's
82
- # password was last used to sign in to an AWS website. For a list of AWS
83
- # websites that capture a user's last sign-in time, see the [Credential
84
- # Reports][2] topic in the *Using IAM* guide. If a password is used more
85
- # than once in a five-minute span, only the first use is returned in
86
- # this field. This field is null (not present) when:
87
- #
88
- # * The user does not have a password
89
- #
90
- # * The password exists but has never been used (at least not since IAM
91
- # started tracking this information on October 20th, 2014
92
- #
93
- # * there is no sign-in data associated with the user
94
- #
95
- # This value is returned only in the GetUser and ListUsers actions.
96
- #
97
- #
98
- #
99
- # [1]: http://www.iso.org/iso/iso8601
100
- # [2]: http://docs.aws.amazon.com/IAM/latest/UserGuide/credential-reports.html
101
- # @return [Time]
102
- def password_last_used
103
- data.password_last_used
104
- end
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
- # @!endgroup
105
+ # @!endgroup
107
106
 
108
- # @return [Client]
109
- def client
110
- @client
111
- end
107
+ # @return [Client]
108
+ def client
109
+ @client
110
+ end
112
111
 
113
- # Loads, or reloads {#data} for the current {User}.
114
- # Returns `self` making it possible to chain methods.
115
- #
116
- # user.reload.data
117
- #
118
- # @return [self]
119
- def load
120
- resp = @client.get_user(user_name: @name)
121
- @data = resp.user
122
- self
123
- end
124
- alias :reload :load
125
-
126
- # @return [Types::User]
127
- # Returns the data for this {User}. Calls
128
- # {Client#get_user} if {#data_loaded?} is `false`.
129
- def data
130
- load unless @data
131
- @data
132
- end
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
- # @return [Boolean]
135
- # Returns `true` if this resource is loaded. Accessing attributes or
136
- # {#data} on an unloaded resource will trigger a call to {#load}.
137
- def data_loaded?
138
- !!@data
139
- end
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
- # @param [Hash] options ({})
142
- # @return [Boolean]
143
- # Returns `true` if the User exists.
144
- def exists?(options = {})
145
- begin
146
- wait_until_exists(options.merge(max_attempts: 1))
147
- true
148
- rescue Aws::Waiters::Errors::UnexpectedError => e
149
- raise e.error
150
- rescue Aws::Waiters::Errors::WaiterFailed
151
- false
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
- # @param [Hash] options ({})
156
- # @option options [Integer] :max_attempts (20)
157
- # @option options [Float] :delay (1)
158
- # @option options [Proc] :before_attempt
159
- # @option options [Proc] :before_wait
160
- # @return [User]
161
- def wait_until_exists(options = {})
162
- options, params = separate_params_and_options(options)
163
- waiter = Waiters::UserExists.new(options)
164
- yield_waiter_and_warn(waiter, &Proc.new) if block_given?
165
- waiter.wait(params.merge(user_name: @name))
166
- User.new({
167
- name: @name,
168
- client: @client
169
- })
170
- end
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
- # @!group Actions
173
-
174
- # @example Request syntax with placeholder values
175
- #
176
- # user.add_group({
177
- # group_name: "groupNameType", # required
178
- # })
179
- # @param [Hash] options ({})
180
- # @option options [required, String] :group_name
181
- # The name of the group to update.
182
- #
183
- # The [regex pattern][1] for this parameter is a string of characters
184
- # consisting of upper and lowercase alphanumeric characters with no
185
- # spaces. You can also include any of the following characters: =,.@-
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
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
- # @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
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
- # @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
- # The [regex pattern][2] for this parameter is a string of characters
233
- # consisting of either a forward slash (/) by itself or a string that
234
- # must begin and end with forward slashes, containing any ASCII
235
- # 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
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
- # @example Request syntax with placeholder values
255
- #
256
- # accesskeypair = 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
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
- # @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] for this parameter is a string of characters
282
- # consisting of almost any printable ASCII character from the space
283
- # (\\u0020) through the end of the ASCII character range (\\u00FF). You
284
- # can also include the tab (\\u0009), line feed (\\u000A), and carriage
285
- # return (\\u000D) characters. Although any of these characters are
286
- # valid in a password, note that many tools, such as the AWS Management
287
- # Console, might restrict the ability to enter certain characters
288
- # 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
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
- # @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
- # The [regex pattern][1] for this parameter is a string of characters
318
- # consisting of upper and lowercase alphanumeric characters with no
319
- # spaces. You can also include any of the following characters: =,.@-
320
- #
321
- #
322
- #
323
- # [1]: http://wikipedia.org/wiki/regex
324
- # @option options [required, String] :policy_document
325
- # The policy document.
326
- #
327
- # The [regex pattern][1] for this parameter is a string of characters
328
- # consisting of any printable ASCII character ranging from the space
329
- # character (\\u0020) through end of the ASCII character range
330
- # (\\u00FF). It also includes the special characters tab (\\u0009), line
331
- # feed (\\u000A), and carriage return (\\u000D).
332
- #
333
- #
334
- #
335
- # [1]: http://wikipedia.org/wiki/regex
336
- # @return [UserPolicy]
337
- def create_policy(options = {})
338
- options = options.merge(user_name: @name)
339
- resp = @client.put_user_policy(options)
340
- UserPolicy.new(
341
- user_name: @name,
342
- name: options[:policy_name],
343
- client: @client
344
- )
345
- end
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
- # @example Request syntax with placeholder values
348
- #
349
- # user.delete()
350
- # @param [Hash] options ({})
351
- # @return [EmptyStructure]
352
- def delete(options = {})
353
- options = options.merge(user_name: @name)
354
- resp = @client.delete_user(options)
355
- resp.data
356
- end
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
- # @example Request syntax with placeholder values
359
- #
360
- # user.detach_policy({
361
- # policy_arn: "arnType", # required
362
- # })
363
- # @param [Hash] options ({})
364
- # @option options [required, String] :policy_arn
365
- # The Amazon Resource Name (ARN) of the IAM policy you want to detach.
366
- #
367
- # For more information about ARNs, see [Amazon Resource Names (ARNs) and
368
- # AWS Service Namespaces][1] in the *AWS General Reference*.
369
- #
370
- #
371
- #
372
- # [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
373
- # @return [EmptyStructure]
374
- def detach_policy(options = {})
375
- options = options.merge(user_name: @name)
376
- resp = @client.detach_user_policy(options)
377
- resp.data
378
- end
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
- # @example Request syntax with placeholder values
381
- #
382
- # mfadevice = user.enable_mfa({
383
- # serial_number: "serialNumberType", # required
384
- # authentication_code_1: "authenticationCodeType", # required
385
- # authentication_code_2: "authenticationCodeType", # required
386
- # })
387
- # @param [Hash] options ({})
388
- # @option options [required, String] :serial_number
389
- # The serial number that uniquely identifies the MFA device. For virtual
390
- # MFA devices, the serial number is the device ARN.
391
- #
392
- # The [regex pattern][1] for this parameter is a string of characters
393
- # consisting of upper and lowercase alphanumeric characters with no
394
- # spaces. You can also include any of the following characters: =/:,.@-
395
- #
396
- #
397
- #
398
- # [1]: http://wikipedia.org/wiki/regex
399
- # @option options [required, String] :authentication_code_1
400
- # An authentication code emitted by the device.
401
- #
402
- # The format for this parameter is a string of 6 digits.
403
- # @option options [required, String] :authentication_code_2
404
- # A subsequent authentication code emitted by the device.
405
- #
406
- # The format for this parameter is a string of 6 digits.
407
- # @return [MfaDevice]
408
- def enable_mfa(options = {})
409
- options = options.merge(user_name: @name)
410
- resp = @client.enable_mfa_device(options)
411
- MfaDevice.new(
412
- user_name: @name,
413
- serial_number: options[:serial_number],
414
- client: @client
415
- )
416
- end
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
- # @example Request syntax with placeholder values
419
- #
420
- # user.remove_group({
421
- # group_name: "groupNameType", # required
422
- # })
423
- # @param [Hash] options ({})
424
- # @option options [required, String] :group_name
425
- # The name of the group to update.
426
- #
427
- # The [regex pattern][1] for this parameter is a string of characters
428
- # consisting of upper and lowercase alphanumeric characters with no
429
- # spaces. You can also include any of the following characters: =,.@-
430
- #
431
- #
432
- #
433
- # [1]: http://wikipedia.org/wiki/regex
434
- # @return [EmptyStructure]
435
- def remove_group(options = {})
436
- options = options.merge(user_name: @name)
437
- resp = @client.remove_user_from_group(options)
438
- resp.data
439
- end
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
- # @example Request syntax with placeholder values
442
- #
443
- # user = user.update({
444
- # new_path: "pathType",
445
- # new_user_name: "userNameType",
446
- # })
447
- # @param [Hash] options ({})
448
- # @option options [String] :new_path
449
- # New path for the IAM user. Include this parameter only if you're
450
- # changing the user's path.
451
- #
452
- # The [regex pattern][1] for this parameter is a string of characters
453
- # consisting of either a forward slash (/) by itself or a string that
454
- # must begin and end with forward slashes, containing any ASCII
455
- # character from the ! (\\u0021) thru the DEL character (\\u007F),
456
- # including most punctuation characters, digits, and upper and
457
- # lowercased letters.
458
- #
459
- #
460
- #
461
- # [1]: http://wikipedia.org/wiki/regex
462
- # @option options [String] :new_user_name
463
- # New name for the user. Include this parameter only if you're changing
464
- # the user's name.
465
- #
466
- # The [regex pattern][1] for this parameter is a string of characters
467
- # consisting of upper and lowercase alphanumeric characters with no
468
- # spaces. You can also include any of the following characters: =,.@-
469
- #
470
- #
471
- #
472
- # [1]: http://wikipedia.org/wiki/regex
473
- # @return [User]
474
- def update(options = {})
475
- options = options.merge(user_name: @name)
476
- resp = @client.update_user(options)
477
- User.new(
478
- name: options[:new_user_name],
479
- client: @client
480
- )
481
- end
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
- # @!group Associations
489
+ # @!group Associations
484
490
 
485
- # @param [String] id
486
- # @return [AccessKey]
487
- def access_key(id)
488
- AccessKey.new(
489
- user_name: @name,
490
- id: id,
491
- client: @client
492
- )
493
- end
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
- # @example Request syntax with placeholder values
496
- #
497
- # accesskeys = user.access_keys()
498
- # @param [Hash] options ({})
499
- # @return [AccessKey::Collection]
500
- def access_keys(options = {})
501
- batches = Enumerator.new do |y|
502
- options = options.merge(user_name: @name)
503
- resp = @client.list_access_keys(options)
504
- resp.each_page do |page|
505
- batch = []
506
- page.data.access_key_metadata.each do |a|
507
- batch << AccessKey.new(
508
- user_name: @name,
509
- id: a.access_key_id,
510
- data: a,
511
- client: @client
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
- # @example Request syntax with placeholder values
521
- #
522
- # attachedpolicies = user.attached_policies({
523
- # path_prefix: "policyPathType",
524
- # })
525
- # @param [Hash] options ({})
526
- # @option options [String] :path_prefix
527
- # The path prefix for filtering the results. This parameter is optional.
528
- # If it is not included, it defaults to a slash (/), listing all
529
- # policies.
530
- #
531
- # The [regex pattern][1] for this parameter is a string of characters
532
- # consisting of either a forward slash (/) by itself or a string that
533
- # must begin and end with forward slashes, containing any ASCII
534
- # character from the ! (\\u0021) thru the DEL character (\\u007F),
535
- # including most punctuation characters, digits, and upper and
536
- # lowercased letters.
537
- #
538
- #
539
- #
540
- # [1]: http://wikipedia.org/wiki/regex
541
- # @return [Policy::Collection]
542
- def attached_policies(options = {})
543
- batches = Enumerator.new do |y|
544
- options = options.merge(user_name: @name)
545
- resp = @client.list_attached_user_policies(options)
546
- resp.each_page do |page|
547
- batch = []
548
- page.data.attached_policies.each do |a|
549
- batch << Policy.new(
550
- arn: a.policy_arn,
551
- client: @client
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
- # @example Request syntax with placeholder values
561
- #
562
- # groups = user.groups()
563
- # @param [Hash] options ({})
564
- # @return [Group::Collection]
565
- def groups(options = {})
566
- batches = Enumerator.new do |y|
567
- options = options.merge(user_name: @name)
568
- resp = @client.list_groups_for_user(options)
569
- resp.each_page do |page|
570
- batch = []
571
- page.data.groups.each do |g|
572
- batch << Group.new(
573
- name: g.group_name,
574
- data: g,
575
- client: @client
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
- # @return [LoginProfile]
585
- def login_profile
586
- LoginProfile.new(
587
- user_name: @name,
588
- client: @client
589
- )
590
- end
590
+ # @return [LoginProfile]
591
+ def login_profile
592
+ LoginProfile.new(
593
+ user_name: @name,
594
+ client: @client
595
+ )
596
+ end
591
597
 
592
- # @param [String] serial_number
593
- # @return [MfaDevice]
594
- def mfa_device(serial_number)
595
- MfaDevice.new(
596
- user_name: @name,
597
- serial_number: serial_number,
598
- client: @client
599
- )
600
- end
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
- # @example Request syntax with placeholder values
603
- #
604
- # mfadevices = user.mfa_devices()
605
- # @param [Hash] options ({})
606
- # @return [MfaDevice::Collection]
607
- def mfa_devices(options = {})
608
- batches = Enumerator.new do |y|
609
- options = options.merge(user_name: @name)
610
- resp = @client.list_mfa_devices(options)
611
- resp.each_page do |page|
612
- batch = []
613
- page.data.mfa_devices.each do |m|
614
- batch << MfaDevice.new(
615
- user_name: @name,
616
- serial_number: m.serial_number,
617
- data: m,
618
- client: @client
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
- # @example Request syntax with placeholder values
628
- #
629
- # policies = user.policies()
630
- # @param [Hash] options ({})
631
- # @return [UserPolicy::Collection]
632
- def policies(options = {})
633
- batches = Enumerator.new do |y|
634
- options = options.merge(user_name: @name)
635
- resp = @client.list_user_policies(options)
636
- resp.each_page do |page|
637
- batch = []
638
- page.data.policy_names.each do |p|
639
- batch << UserPolicy.new(
640
- user_name: @name,
641
- name: p,
642
- client: @client
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
- # @param [String] name
652
- # @return [UserPolicy]
653
- def policy(name)
654
- UserPolicy.new(
655
- user_name: @name,
656
- name: name,
657
- client: @client
658
- )
659
- end
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
- # @param [String] id
662
- # @return [SigningCertificate]
663
- def signing_certificate(id)
664
- SigningCertificate.new(
665
- user_name: @name,
666
- id: id,
667
- client: @client
668
- )
669
- end
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
- # @example Request syntax with placeholder values
672
- #
673
- # signingcertificates = user.signing_certificates()
674
- # @param [Hash] options ({})
675
- # @return [SigningCertificate::Collection]
676
- def signing_certificates(options = {})
677
- batches = Enumerator.new do |y|
678
- options = options.merge(user_name: @name)
679
- resp = @client.list_signing_certificates(options)
680
- resp.each_page do |page|
681
- batch = []
682
- page.data.certificates.each do |c|
683
- batch << SigningCertificate.new(
684
- user_name: @name,
685
- id: c.certificate_id,
686
- data: c,
687
- client: @client
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
- # @deprecated
697
- # @api private
698
- def identifiers
699
- { name: @name }
700
- end
701
- deprecated(:identifiers)
702
+ # @deprecated
703
+ # @api private
704
+ def identifiers
705
+ { name: @name }
706
+ end
707
+ deprecated(:identifiers)
702
708
 
703
- private
709
+ private
704
710
 
705
- def extract_name(args, options)
706
- value = args[0] || options.delete(:name)
707
- case value
708
- when String then value
709
- when nil then raise ArgumentError, "missing required option :name"
710
- else
711
- msg = "expected :name to be a String, got #{value.class}"
712
- raise ArgumentError, msg
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
- def yield_waiter_and_warn(waiter, &block)
717
- if !@waiter_block_warned
718
- msg = "pass options to configure the waiter; "
719
- msg << "yielding the waiter is deprecated"
720
- warn(msg)
721
- @waiter_block_warned = true
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
- def separate_params_and_options(options)
727
- opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
728
- waiter_opts = {}
729
- waiter_params = {}
730
- options.each_pair do |key, value|
731
- if opts.include?(key)
732
- waiter_opts[key] = value
733
- else
734
- waiter_params[key] = value
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
- class Collection < Aws::Resources::Collection; end
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