Class: OCI::IdentityDataPlane::Models::PasswordPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/identity_data_plane/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):



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
127
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 76

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)


22
23
24
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 22

def is_lowercase_characters_required
  @is_lowercase_characters_required
end

#is_numeric_characters_requiredBOOLEAN

At least one numeric character required.

Returns:

  • (BOOLEAN)


26
27
28
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 26

def is_numeric_characters_required
  @is_numeric_characters_required
end

#is_special_characters_requiredBOOLEAN

At least one special character required.

Returns:

  • (BOOLEAN)


30
31
32
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 30

def is_special_characters_required
  @is_special_characters_required
end

#is_uppercase_characters_requiredBOOLEAN

At least one uppercase character required.

Returns:

  • (BOOLEAN)


18
19
20
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 18

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)


34
35
36
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 34

def is_username_containment_allowed
  @is_username_containment_allowed
end

#minimum_password_lengthInteger

Minimum password length required.

Returns:

  • (Integer)


14
15
16
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 14

def minimum_password_length
  @minimum_password_length
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


151
152
153
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 151

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



160
161
162
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 160

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



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

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



198
199
200
# File 'lib/oci/identity_data_plane/models/password_policy.rb', line 198

def to_s
  to_hash.to_s
end