aws-sdk-iam 1.0.0.rc1
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 +7 -0
- data/lib/aws-sdk-iam.rb +69 -0
- data/lib/aws-sdk-iam/access_key.rb +179 -0
- data/lib/aws-sdk-iam/access_key_pair.rb +190 -0
- data/lib/aws-sdk-iam/account_password_policy.rb +216 -0
- data/lib/aws-sdk-iam/account_summary.rb +76 -0
- data/lib/aws-sdk-iam/assume_role_policy.rb +122 -0
- data/lib/aws-sdk-iam/client.rb +6894 -0
- data/lib/aws-sdk-iam/client_api.rb +2868 -0
- data/lib/aws-sdk-iam/current_user.rb +269 -0
- data/lib/aws-sdk-iam/customizations.rb +2 -0
- data/lib/aws-sdk-iam/customizations/resource.rb +19 -0
- data/lib/aws-sdk-iam/errors.rb +23 -0
- data/lib/aws-sdk-iam/group.rb +459 -0
- data/lib/aws-sdk-iam/group_policy.rb +178 -0
- data/lib/aws-sdk-iam/instance_profile.rb +264 -0
- data/lib/aws-sdk-iam/login_profile.rb +196 -0
- data/lib/aws-sdk-iam/mfa_device.rb +191 -0
- data/lib/aws-sdk-iam/policy.rb +554 -0
- data/lib/aws-sdk-iam/policy_version.rb +176 -0
- data/lib/aws-sdk-iam/resource.rb +1037 -0
- data/lib/aws-sdk-iam/role.rb +310 -0
- data/lib/aws-sdk-iam/role_policy.rb +178 -0
- data/lib/aws-sdk-iam/saml_provider.rb +144 -0
- data/lib/aws-sdk-iam/server_certificate.rb +167 -0
- data/lib/aws-sdk-iam/signing_certificate.rb +185 -0
- data/lib/aws-sdk-iam/types.rb +7486 -0
- data/lib/aws-sdk-iam/user.rb +744 -0
- data/lib/aws-sdk-iam/user_policy.rb +178 -0
- data/lib/aws-sdk-iam/virtual_mfa_device.rb +142 -0
- data/lib/aws-sdk-iam/waiters.rb +98 -0
- metadata +103 -0
@@ -0,0 +1,310 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing for info on making contributions:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws
|
9
|
+
module IAM
|
10
|
+
class Role
|
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
|
26
|
+
|
27
|
+
# @!group Read-Only Attributes
|
28
|
+
|
29
|
+
# @return [String]
|
30
|
+
def name
|
31
|
+
@name
|
32
|
+
end
|
33
|
+
alias :role_name :name
|
34
|
+
|
35
|
+
# The path to the role. 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
|
45
|
+
|
46
|
+
# The stable and unique string identifying the role. 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 role_id
|
55
|
+
data.role_id
|
56
|
+
end
|
57
|
+
|
58
|
+
# The Amazon Resource Name (ARN) specifying the role. For more
|
59
|
+
# information about ARNs and how to use them 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
|
69
|
+
|
70
|
+
# The date and time, in [ISO 8601 date-time format][1], when the role
|
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
|
80
|
+
|
81
|
+
# The policy that grants an entity permission to assume the role.
|
82
|
+
# @return [String]
|
83
|
+
def assume_role_policy_document
|
84
|
+
data.assume_role_policy_document
|
85
|
+
end
|
86
|
+
|
87
|
+
# @!endgroup
|
88
|
+
|
89
|
+
# @return [Client]
|
90
|
+
def client
|
91
|
+
@client
|
92
|
+
end
|
93
|
+
|
94
|
+
# Loads, or reloads {#data} for the current {Role}.
|
95
|
+
# Returns `self` making it possible to chain methods.
|
96
|
+
#
|
97
|
+
# role.reload.data
|
98
|
+
#
|
99
|
+
# @return [self]
|
100
|
+
def load
|
101
|
+
resp = @client.get_role(role_name: @name)
|
102
|
+
@data = resp.role
|
103
|
+
self
|
104
|
+
end
|
105
|
+
alias :reload :load
|
106
|
+
|
107
|
+
# @return [Types::Role]
|
108
|
+
# Returns the data for this {Role}. Calls
|
109
|
+
# {Client#get_role} if {#data_loaded?} is `false`.
|
110
|
+
def data
|
111
|
+
load unless @data
|
112
|
+
@data
|
113
|
+
end
|
114
|
+
|
115
|
+
# @return [Boolean]
|
116
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
117
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
118
|
+
def data_loaded?
|
119
|
+
!!@data
|
120
|
+
end
|
121
|
+
|
122
|
+
# @!group Actions
|
123
|
+
|
124
|
+
# @example Request syntax with placeholder values
|
125
|
+
#
|
126
|
+
# role.attach_policy({
|
127
|
+
# policy_arn: "arnType", # required
|
128
|
+
# })
|
129
|
+
# @param [Hash] options ({})
|
130
|
+
# @option options [required, String] :policy_arn
|
131
|
+
# The Amazon Resource Name (ARN) of the IAM policy you want to attach.
|
132
|
+
#
|
133
|
+
# For more information about ARNs, see [Amazon Resource Names (ARNs) and
|
134
|
+
# AWS Service Namespaces][1] in the *AWS General Reference*.
|
135
|
+
#
|
136
|
+
#
|
137
|
+
#
|
138
|
+
# [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
|
139
|
+
# @return [EmptyStructure]
|
140
|
+
def attach_policy(options = {})
|
141
|
+
options = options.merge(role_name: @name)
|
142
|
+
resp = @client.attach_role_policy(options)
|
143
|
+
resp.data
|
144
|
+
end
|
145
|
+
|
146
|
+
# @example Request syntax with placeholder values
|
147
|
+
#
|
148
|
+
# role.delete()
|
149
|
+
# @param [Hash] options ({})
|
150
|
+
# @return [EmptyStructure]
|
151
|
+
def delete(options = {})
|
152
|
+
options = options.merge(role_name: @name)
|
153
|
+
resp = @client.delete_role(options)
|
154
|
+
resp.data
|
155
|
+
end
|
156
|
+
|
157
|
+
# @example Request syntax with placeholder values
|
158
|
+
#
|
159
|
+
# role.detach_policy({
|
160
|
+
# policy_arn: "arnType", # required
|
161
|
+
# })
|
162
|
+
# @param [Hash] options ({})
|
163
|
+
# @option options [required, String] :policy_arn
|
164
|
+
# The Amazon Resource Name (ARN) of the IAM policy you want to detach.
|
165
|
+
#
|
166
|
+
# For more information about ARNs, see [Amazon Resource Names (ARNs) and
|
167
|
+
# AWS Service Namespaces][1] in the *AWS General Reference*.
|
168
|
+
#
|
169
|
+
#
|
170
|
+
#
|
171
|
+
# [1]: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
|
172
|
+
# @return [EmptyStructure]
|
173
|
+
def detach_policy(options = {})
|
174
|
+
options = options.merge(role_name: @name)
|
175
|
+
resp = @client.detach_role_policy(options)
|
176
|
+
resp.data
|
177
|
+
end
|
178
|
+
|
179
|
+
# @!group Associations
|
180
|
+
|
181
|
+
# @return [AssumeRolePolicy]
|
182
|
+
def assume_role_policy
|
183
|
+
AssumeRolePolicy.new(
|
184
|
+
role_name: @name,
|
185
|
+
client: @client
|
186
|
+
)
|
187
|
+
end
|
188
|
+
|
189
|
+
# @example Request syntax with placeholder values
|
190
|
+
#
|
191
|
+
# attachedpolicies = role.attached_policies({
|
192
|
+
# path_prefix: "policyPathType",
|
193
|
+
# })
|
194
|
+
# @param [Hash] options ({})
|
195
|
+
# @option options [String] :path_prefix
|
196
|
+
# The path prefix for filtering the results. This parameter is optional.
|
197
|
+
# If it is not included, it defaults to a slash (/), listing all
|
198
|
+
# policies.
|
199
|
+
#
|
200
|
+
# The [regex pattern][1] for this parameter is a string of characters
|
201
|
+
# consisting of either a forward slash (/) by itself or a string that
|
202
|
+
# must begin and end with forward slashes, containing any ASCII
|
203
|
+
# character from the ! (\\u0021) thru the DEL character (\\u007F),
|
204
|
+
# including most punctuation characters, digits, and upper and
|
205
|
+
# lowercased letters.
|
206
|
+
#
|
207
|
+
#
|
208
|
+
#
|
209
|
+
# [1]: http://wikipedia.org/wiki/regex
|
210
|
+
# @return [Policy::Collection]
|
211
|
+
def attached_policies(options = {})
|
212
|
+
batches = Enumerator.new do |y|
|
213
|
+
options = options.merge(role_name: @name)
|
214
|
+
resp = @client.list_attached_role_policies(options)
|
215
|
+
resp.each_page do |page|
|
216
|
+
batch = []
|
217
|
+
page.data.attached_policies.each do |a|
|
218
|
+
batch << Policy.new(
|
219
|
+
arn: a.policy_arn,
|
220
|
+
client: @client
|
221
|
+
)
|
222
|
+
end
|
223
|
+
y.yield(batch)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
Policy::Collection.new(batches)
|
227
|
+
end
|
228
|
+
|
229
|
+
# @example Request syntax with placeholder values
|
230
|
+
#
|
231
|
+
# instanceprofiles = role.instance_profiles()
|
232
|
+
# @param [Hash] options ({})
|
233
|
+
# @return [InstanceProfile::Collection]
|
234
|
+
def instance_profiles(options = {})
|
235
|
+
batches = Enumerator.new do |y|
|
236
|
+
options = options.merge(role_name: @name)
|
237
|
+
resp = @client.list_instance_profiles_for_role(options)
|
238
|
+
resp.each_page do |page|
|
239
|
+
batch = []
|
240
|
+
page.data.instance_profiles.each do |i|
|
241
|
+
batch << InstanceProfile.new(
|
242
|
+
name: i.instance_profile_name,
|
243
|
+
data: i,
|
244
|
+
client: @client
|
245
|
+
)
|
246
|
+
end
|
247
|
+
y.yield(batch)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
InstanceProfile::Collection.new(batches)
|
251
|
+
end
|
252
|
+
|
253
|
+
# @example Request syntax with placeholder values
|
254
|
+
#
|
255
|
+
# policies = role.policies()
|
256
|
+
# @param [Hash] options ({})
|
257
|
+
# @return [RolePolicy::Collection]
|
258
|
+
def policies(options = {})
|
259
|
+
batches = Enumerator.new do |y|
|
260
|
+
options = options.merge(role_name: @name)
|
261
|
+
resp = @client.list_role_policies(options)
|
262
|
+
resp.each_page do |page|
|
263
|
+
batch = []
|
264
|
+
page.data.policy_names.each do |p|
|
265
|
+
batch << RolePolicy.new(
|
266
|
+
role_name: @name,
|
267
|
+
name: p,
|
268
|
+
client: @client
|
269
|
+
)
|
270
|
+
end
|
271
|
+
y.yield(batch)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
RolePolicy::Collection.new(batches)
|
275
|
+
end
|
276
|
+
|
277
|
+
# @param [String] name
|
278
|
+
# @return [RolePolicy]
|
279
|
+
def policy(name)
|
280
|
+
RolePolicy.new(
|
281
|
+
role_name: @name,
|
282
|
+
name: name,
|
283
|
+
client: @client
|
284
|
+
)
|
285
|
+
end
|
286
|
+
|
287
|
+
# @deprecated
|
288
|
+
# @api private
|
289
|
+
def identifiers
|
290
|
+
{ name: @name }
|
291
|
+
end
|
292
|
+
deprecated(:identifiers)
|
293
|
+
|
294
|
+
private
|
295
|
+
|
296
|
+
def extract_name(args, options)
|
297
|
+
value = args[0] || options.delete(:name)
|
298
|
+
case value
|
299
|
+
when String then value
|
300
|
+
when nil then raise ArgumentError, "missing required option :name"
|
301
|
+
else
|
302
|
+
msg = "expected :name to be a String, got #{value.class}"
|
303
|
+
raise ArgumentError, msg
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
class Collection < Aws::Resources::Collection; end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# WARNING ABOUT GENERATED CODE
|
2
|
+
#
|
3
|
+
# This file is generated. See the contributing for info on making contributions:
|
4
|
+
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
|
+
#
|
6
|
+
# WARNING ABOUT GENERATED CODE
|
7
|
+
|
8
|
+
module Aws
|
9
|
+
module IAM
|
10
|
+
class RolePolicy
|
11
|
+
|
12
|
+
extend Aws::Deprecations
|
13
|
+
|
14
|
+
# @overload def initialize(role_name, name, options = {})
|
15
|
+
# @param [String] role_name
|
16
|
+
# @param [String] name
|
17
|
+
# @option options [Client] :client
|
18
|
+
# @overload def initialize(options = {})
|
19
|
+
# @option options [required, String] :role_name
|
20
|
+
# @option options [required, String] :name
|
21
|
+
# @option options [Client] :client
|
22
|
+
def initialize(*args)
|
23
|
+
options = Hash === args.last ? args.pop.dup : {}
|
24
|
+
@role_name = extract_role_name(args, options)
|
25
|
+
@name = extract_name(args, options)
|
26
|
+
@data = options.delete(:data)
|
27
|
+
@client = options.delete(:client) || Client.new(options)
|
28
|
+
end
|
29
|
+
|
30
|
+
# @!group Read-Only Attributes
|
31
|
+
|
32
|
+
# @return [String]
|
33
|
+
def role_name
|
34
|
+
@role_name
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [String]
|
38
|
+
def name
|
39
|
+
@name
|
40
|
+
end
|
41
|
+
alias :policy_name :name
|
42
|
+
|
43
|
+
# The policy document.
|
44
|
+
# @return [String]
|
45
|
+
def policy_document
|
46
|
+
data.policy_document
|
47
|
+
end
|
48
|
+
|
49
|
+
# @!endgroup
|
50
|
+
|
51
|
+
# @return [Client]
|
52
|
+
def client
|
53
|
+
@client
|
54
|
+
end
|
55
|
+
|
56
|
+
# Loads, or reloads {#data} for the current {RolePolicy}.
|
57
|
+
# Returns `self` making it possible to chain methods.
|
58
|
+
#
|
59
|
+
# role_policy.reload.data
|
60
|
+
#
|
61
|
+
# @return [self]
|
62
|
+
def load
|
63
|
+
resp = @client.get_role_policy(
|
64
|
+
role_name: @role_name,
|
65
|
+
policy_name: @name
|
66
|
+
)
|
67
|
+
@data = resp.data
|
68
|
+
self
|
69
|
+
end
|
70
|
+
alias :reload :load
|
71
|
+
|
72
|
+
# @return [Types::GetRolePolicyResponse]
|
73
|
+
# Returns the data for this {RolePolicy}. Calls
|
74
|
+
# {Client#get_role_policy} if {#data_loaded?} is `false`.
|
75
|
+
def data
|
76
|
+
load unless @data
|
77
|
+
@data
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [Boolean]
|
81
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
82
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
83
|
+
def data_loaded?
|
84
|
+
!!@data
|
85
|
+
end
|
86
|
+
|
87
|
+
# @!group Actions
|
88
|
+
|
89
|
+
# @example Request syntax with placeholder values
|
90
|
+
#
|
91
|
+
# role_policy.delete()
|
92
|
+
# @param [Hash] options ({})
|
93
|
+
# @return [EmptyStructure]
|
94
|
+
def delete(options = {})
|
95
|
+
options = options.merge(
|
96
|
+
role_name: @role_name,
|
97
|
+
policy_name: @name
|
98
|
+
)
|
99
|
+
resp = @client.delete_role_policy(options)
|
100
|
+
resp.data
|
101
|
+
end
|
102
|
+
|
103
|
+
# @example Request syntax with placeholder values
|
104
|
+
#
|
105
|
+
# role_policy.put({
|
106
|
+
# policy_document: "policyDocumentType", # required
|
107
|
+
# })
|
108
|
+
# @param [Hash] options ({})
|
109
|
+
# @option options [required, String] :policy_document
|
110
|
+
# The policy document.
|
111
|
+
#
|
112
|
+
# The [regex pattern][1] for this parameter is a string of characters
|
113
|
+
# consisting of any printable ASCII character ranging from the space
|
114
|
+
# character (\\u0020) through end of the ASCII character range
|
115
|
+
# (\\u00FF). It also includes the special characters tab (\\u0009), line
|
116
|
+
# feed (\\u000A), and carriage return (\\u000D).
|
117
|
+
#
|
118
|
+
#
|
119
|
+
#
|
120
|
+
# [1]: http://wikipedia.org/wiki/regex
|
121
|
+
# @return [EmptyStructure]
|
122
|
+
def put(options = {})
|
123
|
+
options = options.merge(
|
124
|
+
role_name: @role_name,
|
125
|
+
policy_name: @name
|
126
|
+
)
|
127
|
+
resp = @client.put_role_policy(options)
|
128
|
+
resp.data
|
129
|
+
end
|
130
|
+
|
131
|
+
# @!group Associations
|
132
|
+
|
133
|
+
# @return [Role]
|
134
|
+
def role
|
135
|
+
Role.new(
|
136
|
+
name: @role_name,
|
137
|
+
client: @client
|
138
|
+
)
|
139
|
+
end
|
140
|
+
|
141
|
+
# @deprecated
|
142
|
+
# @api private
|
143
|
+
def identifiers
|
144
|
+
{
|
145
|
+
role_name: @role_name,
|
146
|
+
name: @name
|
147
|
+
}
|
148
|
+
end
|
149
|
+
deprecated(:identifiers)
|
150
|
+
|
151
|
+
private
|
152
|
+
|
153
|
+
def extract_role_name(args, options)
|
154
|
+
value = args[0] || options.delete(:role_name)
|
155
|
+
case value
|
156
|
+
when String then value
|
157
|
+
when nil then raise ArgumentError, "missing required option :role_name"
|
158
|
+
else
|
159
|
+
msg = "expected :role_name to be a String, got #{value.class}"
|
160
|
+
raise ArgumentError, msg
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def extract_name(args, options)
|
165
|
+
value = args[1] || options.delete(:name)
|
166
|
+
case value
|
167
|
+
when String then value
|
168
|
+
when nil then raise ArgumentError, "missing required option :name"
|
169
|
+
else
|
170
|
+
msg = "expected :name to be a String, got #{value.class}"
|
171
|
+
raise ArgumentError, msg
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
class Collection < Aws::Resources::Collection; end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|