Class: OCI::Identity::Models::PasswordPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/identity/models/password_policy.rb

Overview

Password policy, currently set for the given compartment.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PasswordPolicy

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/oci/identity/models/password_policy.rb', line 75

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.minimum_password_length = attributes[:'minimumPasswordLength'] if attributes[:'minimumPasswordLength']

  raise 'You cannot provide both :minimumPasswordLength and :minimum_password_length' if attributes.key?(:'minimumPasswordLength') && attributes.key?(:'minimum_password_length')

  self.minimum_password_length = attributes[:'minimum_password_length'] if attributes[:'minimum_password_length']

  self.is_uppercase_characters_required = attributes[:'isUppercaseCharactersRequired'] unless attributes[:'isUppercaseCharactersRequired'].nil?
  self.is_uppercase_characters_required = true if is_uppercase_characters_required.nil? && !attributes.key?(:'isUppercaseCharactersRequired') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isUppercaseCharactersRequired and :is_uppercase_characters_required' if attributes.key?(:'isUppercaseCharactersRequired') && attributes.key?(:'is_uppercase_characters_required')

  self.is_uppercase_characters_required = attributes[:'is_uppercase_characters_required'] unless attributes[:'is_uppercase_characters_required'].nil?
  self.is_uppercase_characters_required = true if is_uppercase_characters_required.nil? && !attributes.key?(:'isUppercaseCharactersRequired') && !attributes.key?(:'is_uppercase_characters_required') # rubocop:disable Style/StringLiterals

  self.is_lowercase_characters_required = attributes[:'isLowercaseCharactersRequired'] unless attributes[:'isLowercaseCharactersRequired'].nil?
  self.is_lowercase_characters_required = true if is_lowercase_characters_required.nil? && !attributes.key?(:'isLowercaseCharactersRequired') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isLowercaseCharactersRequired and :is_lowercase_characters_required' if attributes.key?(:'isLowercaseCharactersRequired') && attributes.key?(:'is_lowercase_characters_required')

  self.is_lowercase_characters_required = attributes[:'is_lowercase_characters_required'] unless attributes[:'is_lowercase_characters_required'].nil?
  self.is_lowercase_characters_required = true if is_lowercase_characters_required.nil? && !attributes.key?(:'isLowercaseCharactersRequired') && !attributes.key?(:'is_lowercase_characters_required') # rubocop:disable Style/StringLiterals

  self.is_numeric_characters_required = attributes[:'isNumericCharactersRequired'] unless attributes[:'isNumericCharactersRequired'].nil?
  self.is_numeric_characters_required = true if is_numeric_characters_required.nil? && !attributes.key?(:'isNumericCharactersRequired') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isNumericCharactersRequired and :is_numeric_characters_required' if attributes.key?(:'isNumericCharactersRequired') && attributes.key?(:'is_numeric_characters_required')

  self.is_numeric_characters_required = attributes[:'is_numeric_characters_required'] unless attributes[:'is_numeric_characters_required'].nil?
  self.is_numeric_characters_required = true if is_numeric_characters_required.nil? && !attributes.key?(:'isNumericCharactersRequired') && !attributes.key?(:'is_numeric_characters_required') # rubocop:disable Style/StringLiterals

  self.is_special_characters_required = attributes[:'isSpecialCharactersRequired'] unless attributes[:'isSpecialCharactersRequired'].nil?
  self.is_special_characters_required = true if is_special_characters_required.nil? && !attributes.key?(:'isSpecialCharactersRequired') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isSpecialCharactersRequired and :is_special_characters_required' if attributes.key?(:'isSpecialCharactersRequired') && attributes.key?(:'is_special_characters_required')

  self.is_special_characters_required = attributes[:'is_special_characters_required'] unless attributes[:'is_special_characters_required'].nil?
  self.is_special_characters_required = true if is_special_characters_required.nil? && !attributes.key?(:'isSpecialCharactersRequired') && !attributes.key?(:'is_special_characters_required') # rubocop:disable Style/StringLiterals

  self.is_username_containment_allowed = attributes[:'isUsernameContainmentAllowed'] unless attributes[:'isUsernameContainmentAllowed'].nil?
  self.is_username_containment_allowed = false if is_username_containment_allowed.nil? && !attributes.key?(:'isUsernameContainmentAllowed') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isUsernameContainmentAllowed and :is_username_containment_allowed' if attributes.key?(:'isUsernameContainmentAllowed') && attributes.key?(:'is_username_containment_allowed')

  self.is_username_containment_allowed = attributes[:'is_username_containment_allowed'] unless attributes[:'is_username_containment_allowed'].nil?
  self.is_username_containment_allowed = false if is_username_containment_allowed.nil? && !attributes.key?(:'isUsernameContainmentAllowed') && !attributes.key?(:'is_username_containment_allowed') # rubocop:disable Style/StringLiterals
end

Instance Attribute Details

#is_lowercase_characters_requiredBOOLEAN

At least one lower case character required.

Returns:

  • (BOOLEAN)


21
22
23
# File 'lib/oci/identity/models/password_policy.rb', line 21

def is_lowercase_characters_required
  @is_lowercase_characters_required
end

#is_numeric_characters_requiredBOOLEAN

At least one numeric character required.

Returns:

  • (BOOLEAN)


25
26
27
# File 'lib/oci/identity/models/password_policy.rb', line 25

def is_numeric_characters_required
  @is_numeric_characters_required
end

#is_special_characters_requiredBOOLEAN

At least one special character required.

Returns:

  • (BOOLEAN)


29
30
31
# File 'lib/oci/identity/models/password_policy.rb', line 29

def is_special_characters_required
  @is_special_characters_required
end

#is_uppercase_characters_requiredBOOLEAN

At least one uppercase character required.

Returns:

  • (BOOLEAN)


17
18
19
# File 'lib/oci/identity/models/password_policy.rb', line 17

def is_uppercase_characters_required
  @is_uppercase_characters_required
end

#is_username_containment_allowedBOOLEAN

User name is allowed to be part of the password.

Returns:

  • (BOOLEAN)


33
34
35
# File 'lib/oci/identity/models/password_policy.rb', line 33

def is_username_containment_allowed
  @is_username_containment_allowed
end

#minimum_password_lengthInteger

Minimum password length required.

Returns:

  • (Integer)


13
14
15
# File 'lib/oci/identity/models/password_policy.rb', line 13

def minimum_password_length
  @minimum_password_length
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/oci/identity/models/password_policy.rb', line 36

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'minimum_password_length': :'minimumPasswordLength',
    'is_uppercase_characters_required': :'isUppercaseCharactersRequired',
    'is_lowercase_characters_required': :'isLowercaseCharactersRequired',
    'is_numeric_characters_required': :'isNumericCharactersRequired',
    'is_special_characters_required': :'isSpecialCharactersRequired',
    'is_username_containment_allowed': :'isUsernameContainmentAllowed'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/identity/models/password_policy.rb', line 50

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'minimum_password_length': :'Integer',
    'is_uppercase_characters_required': :'BOOLEAN',
    'is_lowercase_characters_required': :'BOOLEAN',
    'is_numeric_characters_required': :'BOOLEAN',
    'is_special_characters_required': :'BOOLEAN',
    'is_username_containment_allowed': :'BOOLEAN'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



135
136
137
138
139
140
141
142
143
144
145
# File 'lib/oci/identity/models/password_policy.rb', line 135

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    minimum_password_length == other.minimum_password_length &&
    is_uppercase_characters_required == other.is_uppercase_characters_required &&
    is_lowercase_characters_required == other.is_lowercase_characters_required &&
    is_numeric_characters_required == other.is_numeric_characters_required &&
    is_special_characters_required == other.is_special_characters_required &&
    is_username_containment_allowed == other.is_username_containment_allowed
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/oci/identity/models/password_policy.rb', line 170

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


150
151
152
# File 'lib/oci/identity/models/password_policy.rb', line 150

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



159
160
161
# File 'lib/oci/identity/models/password_policy.rb', line 159

def hash
  [minimum_password_length, is_uppercase_characters_required, is_lowercase_characters_required, is_numeric_characters_required, is_special_characters_required, is_username_containment_allowed].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



203
204
205
206
207
208
209
210
211
212
# File 'lib/oci/identity/models/password_policy.rb', line 203

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



197
198
199
# File 'lib/oci/identity/models/password_policy.rb', line 197

def to_s
  to_hash.to_s
end