Class: Aws::IAM::User
- Inherits:
-
Object
- Object
- Aws::IAM::User
- Extended by:
- Deprecations
- Defined in:
- sig/user.rbs,
lib/aws-sdk-iam/user.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#arn ⇒ String
The Amazon Resource Name (ARN) that identifies the user.
-
#create_date ⇒ Time
The date and time, in [ISO 8601 date-time format][1], when the user was created.
- #name ⇒ String (also: #user_name)
-
#password_last_used ⇒ Time
The date and time, in [ISO 8601 date-time format][1], when the user's password was last used to sign in to an Amazon Web Services website.
-
#path ⇒ String
The path to the user.
-
#permissions_boundary ⇒ Types::AttachedPermissionsBoundary
For more information about permissions boundaries, see [Permissions boundaries for IAM identities ][1] in the IAM User Guide.
-
#tags ⇒ Array<Types::Tag>
A list of tags that are associated with the user.
-
#user_id ⇒ String
The stable and unique string identifying the user.
Actions collapse
- #add_group(options = {}) ⇒ EmptyStructure
- #attach_policy(options = {}) ⇒ EmptyStructure
- #create(options = {}) ⇒ User
- #create_access_key_pair(options = {}) ⇒ AccessKeyPair
- #create_login_profile(options = {}) ⇒ LoginProfile
- #create_policy(options = {}) ⇒ UserPolicy
- #delete(options = {}) ⇒ EmptyStructure
- #detach_policy(options = {}) ⇒ EmptyStructure
- #enable_mfa(options = {}) ⇒ MfaDevice
- #remove_group(options = {}) ⇒ EmptyStructure
- #update(options = {}) ⇒ User
Associations collapse
- #access_key(id) ⇒ AccessKey
- #access_keys(options = {}) ⇒ AccessKey::Collection
- #attached_policies(options = {}) ⇒ Policy::Collection
- #groups(options = {}) ⇒ Group::Collection
- #identifiers ⇒ Object deprecated private Deprecated.
- #login_profile ⇒ LoginProfile
- #mfa_device(serial_number) ⇒ MfaDevice
- #mfa_devices(options = {}) ⇒ MfaDevice::Collection
- #policies(options = {}) ⇒ UserPolicy::Collection
- #policy(name) ⇒ UserPolicy
- #signing_certificate(id) ⇒ SigningCertificate
- #signing_certificates(options = {}) ⇒ SigningCertificate::Collection
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::User
Returns the data for this User.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. -
#exists?(options = {}) ⇒ Boolean
Returns
trueif the User exists. -
#initialize(*args) ⇒ User
constructor
A new instance of User.
- #load ⇒ self (also: #reload)
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::IAM::Client] #wait_until instead
- #wait_until_exists(options = {}, &block) ⇒ User
Constructor Details
Instance Method Details
#access_key(id) ⇒ AccessKey
139 |
# File 'sig/user.rbs', line 139
def access_key: (String id) -> AccessKey
|
#access_keys(options = {}) ⇒ AccessKey::Collection
142 |
# File 'sig/user.rbs', line 142
def access_keys: (
|
#add_group(options = {}) ⇒ EmptyStructure
63 |
# File 'sig/user.rbs', line 63
def add_group: (
|
#arn ⇒ String
The Amazon Resource Name (ARN) that identifies the user. For more information about ARNs and how to use ARNs in policies, see IAM Identifiers in the IAM User Guide.
28 |
# File 'sig/user.rbs', line 28
def arn: () -> ::String
|
#attach_policy(options = {}) ⇒ EmptyStructure
69 |
# File 'sig/user.rbs', line 69
def attach_policy: (
|
#attached_policies(options = {}) ⇒ Policy::Collection
147 |
# File 'sig/user.rbs', line 147
def attached_policies: (
|
#create_access_key_pair(options = {}) ⇒ AccessKeyPair
88 |
# File 'sig/user.rbs', line 88
def create_access_key_pair: (
|
#create_date ⇒ Time
The date and time, in ISO 8601 date-time format, when the user was created.
31 |
# File 'sig/user.rbs', line 31
def create_date: () -> ::Time
|
#create_login_profile(options = {}) ⇒ LoginProfile
93 |
# File 'sig/user.rbs', line 93
def create_login_profile: (
|
#data ⇒ Types::User
Returns the data for this Aws::IAM::User. Calls
Client#get_user if #data_loaded? is false.
49 |
# File 'sig/user.rbs', line 49
def data: () -> Types::User
|
#data_loaded? ⇒ Boolean
52 |
# File 'sig/user.rbs', line 52
def data_loaded?: () -> bool
|
#delete(options = {}) ⇒ EmptyStructure
107 |
# File 'sig/user.rbs', line 107
def delete: (
|
#detach_policy(options = {}) ⇒ EmptyStructure
112 |
# File 'sig/user.rbs', line 112
def detach_policy: (
|
#exists?(options = {}) ⇒ Boolean
Returns true if the User exists.
55 56 |
# File 'sig/user.rbs', line 55
def exists?: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) -> bool
| (?Hash[Symbol, untyped]) -> bool
|
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
948 949 950 |
# File 'lib/aws-sdk-iam/user.rb', line 948 def identifiers { name: @name } end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::IAM::User.
Returns self making it possible to chain methods.
user.reload.data
45 |
# File 'sig/user.rbs', line 45
def load: () -> self
|
#login_profile ⇒ LoginProfile
158 |
# File 'sig/user.rbs', line 158
def login_profile: () -> LoginProfile
|
#mfa_device(serial_number) ⇒ MfaDevice
161 |
# File 'sig/user.rbs', line 161
def mfa_device: (String serial_number) -> MfaDevice
|
#mfa_devices(options = {}) ⇒ MfaDevice::Collection
164 |
# File 'sig/user.rbs', line 164
def mfa_devices: (
|
#name ⇒ String Also known as: user_name
18 |
# File 'sig/user.rbs', line 18
def name: () -> String
|
#password_last_used ⇒ Time
The date and time, in ISO 8601 date-time format, when the user's password was last used to sign in to an Amazon Web Services website. For a list of Amazon Web Services websites that capture a user's last sign-in time, see the Credential reports topic in the IAM User Guide. If a password is used more than once in a five-minute span, only the first use is returned in this field. If the field is null (no value), then it indicates that they never signed in with a password. This can be because:
-
The user never had a password.
-
A password exists but has not been used since IAM started tracking this information on October 20, 2014.
A null value does not mean that the user never had a password. Also, if the user does not currently have a password but had one in the past, then this field contains the date and time the most recent password was used.
This value is returned only in the GetUser and ListUsers operations.
34 |
# File 'sig/user.rbs', line 34
def password_last_used: () -> ::Time
|
#path ⇒ String
The path to the user. For more information about paths, see IAM identifiers in the IAM User Guide.
The ARN of the policy used to set the permissions boundary for the user.
22 |
# File 'sig/user.rbs', line 22
def path: () -> ::String
|
#permissions_boundary ⇒ Types::AttachedPermissionsBoundary
For more information about permissions boundaries, see Permissions boundaries for IAM identities in the IAM User Guide.
37 |
# File 'sig/user.rbs', line 37
def permissions_boundary: () -> Types::AttachedPermissionsBoundary
|
#policies(options = {}) ⇒ UserPolicy::Collection
169 |
# File 'sig/user.rbs', line 169
def policies: (
|
#policy(name) ⇒ UserPolicy
174 |
# File 'sig/user.rbs', line 174
def policy: (String name) -> UserPolicy
|
#remove_group(options = {}) ⇒ EmptyStructure
126 |
# File 'sig/user.rbs', line 126
def remove_group: (
|
#signing_certificate(id) ⇒ SigningCertificate
177 |
# File 'sig/user.rbs', line 177
def signing_certificate: (String id) -> SigningCertificate
|
#signing_certificates(options = {}) ⇒ SigningCertificate::Collection
180 |
# File 'sig/user.rbs', line 180
def signing_certificates: (
|
#tags ⇒ Array<Types::Tag>
A list of tags that are associated with the user. For more information about tagging, see Tagging IAM resources in the IAM User Guide.
40 |
# File 'sig/user.rbs', line 40
def tags: () -> ::Array[Types::Tag]
|
#user_id ⇒ String
The stable and unique string identifying the user. For more information about IDs, see IAM identifiers in the IAM User Guide.
25 |
# File 'sig/user.rbs', line 25
def user_id: () -> ::String
|
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::IAM::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/aws-sdk-iam/user.rb', line 292 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |
#wait_until_exists(options = {}, &block) ⇒ User
59 60 |
# File 'sig/user.rbs', line 59
def wait_until_exists: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) ?{ (untyped waiter) -> void } -> User
| (?Hash[Symbol, untyped]) ?{ (untyped waiter) -> void } -> User
|