Class: Aws::IAM::AccountPasswordPolicy
- Inherits:
-
Object
- Object
- Aws::IAM::AccountPasswordPolicy
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-iam/account_password_policy.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#allow_users_to_change_password ⇒ Boolean
Specifies whether IAM users are allowed to change their own password.
-
#expire_passwords ⇒ Boolean
Indicates whether passwords in the account expire.
-
#hard_expiry ⇒ Boolean
Specifies whether IAM users are prevented from setting a new password after their password has expired.
-
#max_password_age ⇒ Integer
The number of days that an IAM user password is valid.
-
#minimum_password_length ⇒ Integer
Minimum length to require for IAM user passwords.
-
#password_reuse_prevention ⇒ Integer
Specifies the number of previous passwords that IAM users are prevented from reusing.
-
#require_lowercase_characters ⇒ Boolean
Specifies whether to require lowercase characters for IAM user passwords.
-
#require_numbers ⇒ Boolean
Specifies whether to require numbers for IAM user passwords.
-
#require_symbols ⇒ Boolean
Specifies whether to require symbols for IAM user passwords.
-
#require_uppercase_characters ⇒ Boolean
Specifies whether to require uppercase characters for IAM user passwords.
Actions collapse
- #delete(options = {}) ⇒ EmptyStructure
- #identifiers ⇒ Object deprecated private Deprecated.
- #update(options = {}) ⇒ EmptyStructure
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::PasswordPolicy
Returns the data for this AccountPasswordPolicy.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(options = {}) ⇒ AccountPasswordPolicy
constructor
A new instance of AccountPasswordPolicy.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current AccountPasswordPolicy.
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::IAM::Client] #wait_until instead
Constructor Details
#initialize(options = {}) ⇒ AccountPasswordPolicy
Returns a new instance of AccountPasswordPolicy.
16 17 18 19 20 21 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 16 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @data = .delete(:data) @client = .delete(:client) || Client.new() @waiter_block_warned = false end |
Instance Method Details
#allow_users_to_change_password ⇒ Boolean
Specifies whether IAM users are allowed to change their own password.
59 60 61 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 59 def allow_users_to_change_password data[:allow_users_to_change_password] end |
#client ⇒ Client
94 95 96 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 94 def client @client end |
#data ⇒ Types::PasswordPolicy
Returns the data for this Aws::IAM::AccountPasswordPolicy. Calls Client#get_account_password_policy if #data_loaded? is ‘false`.
114 115 116 117 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 114 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
122 123 124 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 122 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EmptyStructure
230 231 232 233 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 230 def delete( = {}) resp = @client.delete_account_password_policy() resp.data end |
#expire_passwords ⇒ Boolean
Indicates whether passwords in the account expire. Returns true if ‘MaxPasswordAge` contains a value greater than 0. Returns false if MaxPasswordAge is 0 or not present.
67 68 69 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 67 def expire_passwords data[:expire_passwords] end |
#hard_expiry ⇒ Boolean
Specifies whether IAM users are prevented from setting a new password after their password has expired.
87 88 89 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 87 def hard_expiry data[:hard_expiry] end |
#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.
327 328 329 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 327 def identifiers {} end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::IAM::AccountPasswordPolicy. Returns ‘self` making it possible to chain methods.
account_password_policy.reload.data
104 105 106 107 108 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 104 def load resp = @client.get_account_password_policy @data = resp.password_policy self end |
#max_password_age ⇒ Integer
The number of days that an IAM user password is valid.
73 74 75 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 73 def max_password_age data[:max_password_age] end |
#minimum_password_length ⇒ Integer
Minimum length to require for IAM user passwords.
27 28 29 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 27 def minimum_password_length data[:minimum_password_length] end |
#password_reuse_prevention ⇒ Integer
Specifies the number of previous passwords that IAM users are prevented from reusing.
80 81 82 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 80 def password_reuse_prevention data[:password_reuse_prevention] end |
#require_lowercase_characters ⇒ Boolean
Specifies whether to require lowercase characters for IAM user passwords.
53 54 55 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 53 def require_lowercase_characters data[:require_lowercase_characters] end |
#require_numbers ⇒ Boolean
Specifies whether to require numbers for IAM user passwords.
39 40 41 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 39 def require_numbers data[:require_numbers] end |
#require_symbols ⇒ Boolean
Specifies whether to require symbols for IAM user passwords.
33 34 35 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 33 def require_symbols data[:require_symbols] end |
#require_uppercase_characters ⇒ Boolean
Specifies whether to require uppercase characters for IAM user passwords.
46 47 48 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 46 def require_uppercase_characters data[:require_uppercase_characters] end |
#update(options = {}) ⇒ EmptyStructure
320 321 322 323 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 320 def update( = {}) resp = @client.update_account_password_policy() resp.data end |
#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
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/aws-sdk-iam/account_password_policy.rb', line 206 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::Waiters::Waiter.new().wait({}) end |