Class: MistApi::OrgSettingPasswordPolicy

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/org_setting_password_policy.rb

Overview

password policy

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(enabled = false, expiry_in_days = SKIP, min_length = 8, requires_special_char = false, requires_two_factor_auth = false) ⇒ OrgSettingPasswordPolicy

Returns a new instance of OrgSettingPasswordPolicy.



60
61
62
63
64
65
66
67
68
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 60

def initialize(enabled = false, expiry_in_days = SKIP, min_length = 8,
               requires_special_char = false,
               requires_two_factor_auth = false)
  @enabled = enabled unless enabled == SKIP
  @expiry_in_days = expiry_in_days unless expiry_in_days == SKIP
  @min_length = min_length unless min_length == SKIP
  @requires_special_char = requires_special_char unless requires_special_char == SKIP
  @requires_two_factor_auth = requires_two_factor_auth unless requires_two_factor_auth == SKIP
end

Instance Attribute Details

#enabledTrueClass | FalseClass

Whether the policy is enabled

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 14

def enabled
  @enabled
end

#expiry_in_daysInteger

Password expiry in days. Password Expiry Notice banner will display in the UI 14 days before expiration

Returns:

  • (Integer)


19
20
21
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 19

def expiry_in_days
  @expiry_in_days
end

#min_lengthInteger

Required password length

Returns:

  • (Integer)


23
24
25
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 23

def min_length
  @min_length
end

#requires_special_charTrueClass | FalseClass

Whether to require special character

Returns:

  • (TrueClass | FalseClass)


27
28
29
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 27

def requires_special_char
  @requires_special_char
end

#requires_two_factor_authTrueClass | FalseClass

Whether to require two-factor auth

Returns:

  • (TrueClass | FalseClass)


31
32
33
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 31

def requires_two_factor_auth
  @requires_two_factor_auth
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  enabled = hash['enabled'] ||= false
  expiry_in_days =
    hash.key?('expiry_in_days') ? hash['expiry_in_days'] : SKIP
  min_length = hash['min_length'] ||= 8
  requires_special_char = hash['requires_special_char'] ||= false
  requires_two_factor_auth = hash['requires_two_factor_auth'] ||= false

  # Create object from extracted values.
  OrgSettingPasswordPolicy.new(enabled,
                               expiry_in_days,
                               min_length,
                               requires_special_char,
                               requires_two_factor_auth)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['enabled'] = 'enabled'
  @_hash['expiry_in_days'] = 'expiry_in_days'
  @_hash['min_length'] = 'min_length'
  @_hash['requires_special_char'] = 'requires_special_char'
  @_hash['requires_two_factor_auth'] = 'requires_two_factor_auth'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
53
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 45

def self.optionals
  %w[
    enabled
    expiry_in_days
    min_length
    requires_special_char
    requires_two_factor_auth
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



99
100
101
102
103
104
105
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 99

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled.inspect}, expiry_in_days: #{@expiry_in_days.inspect},"\
  " min_length: #{@min_length.inspect}, requires_special_char:"\
  " #{@requires_special_char.inspect}, requires_two_factor_auth:"\
  " #{@requires_two_factor_auth.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



91
92
93
94
95
96
# File 'lib/mist_api/models/org_setting_password_policy.rb', line 91

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} enabled: #{@enabled}, expiry_in_days: #{@expiry_in_days}, min_length:"\
  " #{@min_length}, requires_special_char: #{@requires_special_char},"\
  " requires_two_factor_auth: #{@requires_two_factor_auth}>"
end