aws-sdk-iam 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 UserPolicy
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(user_name, name, options = {})
15
+ # @param [String] user_name
16
+ # @param [String] name
17
+ # @option options [Client] :client
18
+ # @overload def initialize(options = {})
19
+ # @option options [required, String] :user_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
+ @user_name = extract_user_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 user_name
34
+ @user_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 {UserPolicy}.
57
+ # Returns `self` making it possible to chain methods.
58
+ #
59
+ # user_policy.reload.data
60
+ #
61
+ # @return [self]
62
+ def load
63
+ resp = @client.get_user_policy(
64
+ user_name: @user_name,
65
+ policy_name: @name
66
+ )
67
+ @data = resp.data
68
+ self
69
+ end
70
+ alias :reload :load
71
+
72
+ # @return [Types::GetUserPolicyResponse]
73
+ # Returns the data for this {UserPolicy}. Calls
74
+ # {Client#get_user_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
+ # user_policy.delete()
92
+ # @param [Hash] options ({})
93
+ # @return [EmptyStructure]
94
+ def delete(options = {})
95
+ options = options.merge(
96
+ user_name: @user_name,
97
+ policy_name: @name
98
+ )
99
+ resp = @client.delete_user_policy(options)
100
+ resp.data
101
+ end
102
+
103
+ # @example Request syntax with placeholder values
104
+ #
105
+ # user_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
+ user_name: @user_name,
125
+ policy_name: @name
126
+ )
127
+ resp = @client.put_user_policy(options)
128
+ resp.data
129
+ end
130
+
131
+ # @!group Associations
132
+
133
+ # @return [User]
134
+ def user
135
+ User.new(
136
+ name: @user_name,
137
+ client: @client
138
+ )
139
+ end
140
+
141
+ # @deprecated
142
+ # @api private
143
+ def identifiers
144
+ {
145
+ user_name: @user_name,
146
+ name: @name
147
+ }
148
+ end
149
+ deprecated(:identifiers)
150
+
151
+ private
152
+
153
+ def extract_user_name(args, options)
154
+ value = args[0] || options.delete(:user_name)
155
+ case value
156
+ when String then value
157
+ when nil then raise ArgumentError, "missing required option :user_name"
158
+ else
159
+ msg = "expected :user_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
@@ -0,0 +1,142 @@
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 VirtualMfaDevice
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(serial_number, options = {})
15
+ # @param [String] serial_number
16
+ # @option options [Client] :client
17
+ # @overload def initialize(options = {})
18
+ # @option options [required, String] :serial_number
19
+ # @option options [Client] :client
20
+ def initialize(*args)
21
+ options = Hash === args.last ? args.pop.dup : {}
22
+ @serial_number = extract_serial_number(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 serial_number
31
+ @serial_number
32
+ end
33
+
34
+ # The Base32 seed defined as specified in [RFC3548][1]. The
35
+ # `Base32StringSeed` is Base64-encoded.
36
+ #
37
+ #
38
+ #
39
+ # [1]: http://www.ietf.org/rfc/rfc3548.txt
40
+ # @return [String]
41
+ def base_32_string_seed
42
+ data.base_32_string_seed
43
+ end
44
+
45
+ # A QR code PNG image that encodes
46
+ # `otpauth://totp/$virtualMFADeviceName@$AccountName?secret=$Base32String`
47
+ # where `$virtualMFADeviceName` is one of the create call arguments,
48
+ # `AccountName` is the user name if set (otherwise, the account ID
49
+ # otherwise), and `Base32String` is the seed in Base32 format. The
50
+ # `Base32String` value is Base64-encoded.
51
+ # @return [String]
52
+ def qr_code_png
53
+ data.qr_code_png
54
+ end
55
+
56
+ # The date and time on which the virtual MFA device was enabled.
57
+ # @return [Time]
58
+ def enable_date
59
+ data.enable_date
60
+ end
61
+
62
+ # @!endgroup
63
+
64
+ # @return [Client]
65
+ def client
66
+ @client
67
+ end
68
+
69
+ # @raise [Errors::ResourceNotLoadable]
70
+ # @api private
71
+ def load
72
+ msg = "#load is not implemented, data only available via enumeration"
73
+ raise Errors::ResourceNotLoadable, msg
74
+ end
75
+ alias :reload :load
76
+
77
+ # @raise [Errors::ResourceNotLoadableError] Raises when {#data_loaded?} is `false`.
78
+ # @return [Types::VirtualMFADevice]
79
+ # Returns the data for this {VirtualMfaDevice}.
80
+ def data
81
+ load unless @data
82
+ @data
83
+ end
84
+
85
+ # @return [Boolean]
86
+ # Returns `true` if this resource is loaded. Accessing attributes or
87
+ # {#data} on an unloaded resource will trigger a call to {#load}.
88
+ def data_loaded?
89
+ !!@data
90
+ end
91
+
92
+ # @!group Actions
93
+
94
+ # @example Request syntax with placeholder values
95
+ #
96
+ # virtual_mfa_device.delete()
97
+ # @param [Hash] options ({})
98
+ # @return [EmptyStructure]
99
+ def delete(options = {})
100
+ options = options.merge(serial_number: @serial_number)
101
+ resp = @client.delete_virtual_mfa_device(options)
102
+ resp.data
103
+ end
104
+
105
+ # @!group Associations
106
+
107
+ # @return [User, nil]
108
+ def user
109
+ if data.user.user_name
110
+ User.new(
111
+ name: data.user.user_name,
112
+ client: @client
113
+ )
114
+ else
115
+ nil
116
+ end
117
+ end
118
+
119
+ # @deprecated
120
+ # @api private
121
+ def identifiers
122
+ { serial_number: @serial_number }
123
+ end
124
+ deprecated(:identifiers)
125
+
126
+ private
127
+
128
+ def extract_serial_number(args, options)
129
+ value = args[0] || options.delete(:serial_number)
130
+ case value
131
+ when String then value
132
+ when nil then raise ArgumentError, "missing required option :serial_number"
133
+ else
134
+ msg = "expected :serial_number to be a String, got #{value.class}"
135
+ raise ArgumentError, msg
136
+ end
137
+ end
138
+
139
+ class Collection < Aws::Resources::Collection; end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,98 @@
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
+ require 'aws-sdk-core/waiters'
9
+
10
+ module Aws
11
+ module IAM
12
+ module Waiters
13
+ class InstanceProfileExists
14
+
15
+ # @param [Hash] options
16
+ # @option options [required, Client] :client
17
+ # @option options [Integer] :max_attempts (40)
18
+ # @option options [Integer] :delay (1)
19
+ # @option options [Proc] :before_attempt
20
+ # @option options [Proc] :before_wait
21
+ def initialize(options)
22
+ @client = options.fetch(:client)
23
+ @waiter = Aws::Waiters::Waiter.new({
24
+ max_attempts: 40,
25
+ delay: 1,
26
+ poller: Aws::Waiters::Poller.new(
27
+ operation_name: :get_instance_profile,
28
+ acceptors: [
29
+ {
30
+ "expected" => 200,
31
+ "matcher" => "status",
32
+ "state" => "success"
33
+ },
34
+ {
35
+ "state" => "retry",
36
+ "matcher" => "status",
37
+ "expected" => 404
38
+ }
39
+ ]
40
+ )
41
+ }.merge(options))
42
+ end
43
+
44
+ # @option (see Client#get_instance_profile)
45
+ # @return (see Client#get_instance_profile)
46
+ def wait(params = {})
47
+ @waiter.wait(client: @client, params: params)
48
+ end
49
+
50
+ # @api private
51
+ attr_reader :waiter
52
+
53
+ end
54
+
55
+ class UserExists
56
+
57
+ # @param [Hash] options
58
+ # @option options [required, Client] :client
59
+ # @option options [Integer] :max_attempts (20)
60
+ # @option options [Integer] :delay (1)
61
+ # @option options [Proc] :before_attempt
62
+ # @option options [Proc] :before_wait
63
+ def initialize(options)
64
+ @client = options.fetch(:client)
65
+ @waiter = Aws::Waiters::Waiter.new({
66
+ max_attempts: 20,
67
+ delay: 1,
68
+ poller: Aws::Waiters::Poller.new(
69
+ operation_name: :get_user,
70
+ acceptors: [
71
+ {
72
+ "state" => "success",
73
+ "matcher" => "status",
74
+ "expected" => 200
75
+ },
76
+ {
77
+ "state" => "retry",
78
+ "matcher" => "error",
79
+ "expected" => "NoSuchEntity"
80
+ }
81
+ ]
82
+ )
83
+ }.merge(options))
84
+ end
85
+
86
+ # @option (see Client#get_user)
87
+ # @return (see Client#get_user)
88
+ def wait(params = {})
89
+ @waiter.wait(client: @client, params: params)
90
+ end
91
+
92
+ # @api private
93
+ attr_reader :waiter
94
+
95
+ end
96
+ end
97
+ end
98
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws-sdk-iam
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.rc1
5
+ platform: ruby
6
+ authors:
7
+ - Amazon Web Services
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0.rc1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0.rc1
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sigv4
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ description: Official AWS Ruby gem for AWS Identity and Access Management (IAM). This
42
+ gem is part of the AWS SDK for Ruby.
43
+ email:
44
+ - trevrowe@amazon.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - lib/aws-sdk-iam.rb
50
+ - lib/aws-sdk-iam/access_key.rb
51
+ - lib/aws-sdk-iam/access_key_pair.rb
52
+ - lib/aws-sdk-iam/account_password_policy.rb
53
+ - lib/aws-sdk-iam/account_summary.rb
54
+ - lib/aws-sdk-iam/assume_role_policy.rb
55
+ - lib/aws-sdk-iam/client.rb
56
+ - lib/aws-sdk-iam/client_api.rb
57
+ - lib/aws-sdk-iam/current_user.rb
58
+ - lib/aws-sdk-iam/customizations.rb
59
+ - lib/aws-sdk-iam/customizations/resource.rb
60
+ - lib/aws-sdk-iam/errors.rb
61
+ - lib/aws-sdk-iam/group.rb
62
+ - lib/aws-sdk-iam/group_policy.rb
63
+ - lib/aws-sdk-iam/instance_profile.rb
64
+ - lib/aws-sdk-iam/login_profile.rb
65
+ - lib/aws-sdk-iam/mfa_device.rb
66
+ - lib/aws-sdk-iam/policy.rb
67
+ - lib/aws-sdk-iam/policy_version.rb
68
+ - lib/aws-sdk-iam/resource.rb
69
+ - lib/aws-sdk-iam/role.rb
70
+ - lib/aws-sdk-iam/role_policy.rb
71
+ - lib/aws-sdk-iam/saml_provider.rb
72
+ - lib/aws-sdk-iam/server_certificate.rb
73
+ - lib/aws-sdk-iam/signing_certificate.rb
74
+ - lib/aws-sdk-iam/types.rb
75
+ - lib/aws-sdk-iam/user.rb
76
+ - lib/aws-sdk-iam/user_policy.rb
77
+ - lib/aws-sdk-iam/virtual_mfa_device.rb
78
+ - lib/aws-sdk-iam/waiters.rb
79
+ homepage: http://github.com/aws/aws-sdk-ruby
80
+ licenses:
81
+ - Apache-2.0
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.3.1
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.5.1
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: AWS SDK for Ruby - IAM
103
+ test_files: []