Class: Authentik::Api::RequestRuleBinding

Inherits:
ApiModelBase show all
Defined in:
lib/authentik/api/models/request_rule_binding.rb

Overview

Mixin to validate that a valid enterprise license exists before allowing to save the object

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ RequestRuleBinding

Initializes the object

Parameters:

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

    Model attributes in the form of hash



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/authentik/api/models/request_rule_binding.rb', line 107

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Authentik::Api::RequestRuleBinding` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Authentik::Api::RequestRuleBinding`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'uuid')
    self.uuid = attributes[:'uuid']
  end

  if attributes.key?(:'pbm_uuid')
    self.pbm_uuid = attributes[:'pbm_uuid']
  else
    self.pbm_uuid = nil
  end

  if attributes.key?(:'policy_engine_mode')
    self.policy_engine_mode = attributes[:'policy_engine_mode']
  end

  if attributes.key?(:'rule')
    self.rule = attributes[:'rule']
  else
    self.rule = nil
  end

  if attributes.key?(:'rule_obj')
    self.rule_obj = attributes[:'rule_obj']
  else
    self.rule_obj = nil
  end

  if attributes.key?(:'target')
    self.target = attributes[:'target']
  else
    self.target = nil
  end

  if attributes.key?(:'related')
    if (value = attributes[:'related']).is_a?(Array)
      self.related = value
    end
  else
    self.related = nil
  end

  if attributes.key?(:'related_obj')
    if (value = attributes[:'related_obj']).is_a?(Array)
      self.related_obj = value
    end
  else
    self.related_obj = nil
  end

  if attributes.key?(:'expiry_pending')
    self.expiry_pending = attributes[:'expiry_pending']
  end

  if attributes.key?(:'expiry_granted_max')
    self.expiry_granted_max = attributes[:'expiry_granted_max']
  end
end

Instance Attribute Details

#expiry_granted_maxObject

The maximum duration a grant approved against this binding can last.



33
34
35
# File 'lib/authentik/api/models/request_rule_binding.rb', line 33

def expiry_granted_max
  @expiry_granted_max
end

#expiry_pendingObject

How long a request against this binding stays pending before it automatically lapses if not approved or denied.



30
31
32
# File 'lib/authentik/api/models/request_rule_binding.rb', line 30

def expiry_pending
  @expiry_pending
end

#pbm_uuidObject

Returns the value of attribute pbm_uuid.



15
16
17
# File 'lib/authentik/api/models/request_rule_binding.rb', line 15

def pbm_uuid
  @pbm_uuid
end

#policy_engine_modeObject

Returns the value of attribute policy_engine_mode.



17
18
19
# File 'lib/authentik/api/models/request_rule_binding.rb', line 17

def policy_engine_mode
  @policy_engine_mode
end

Returns the value of attribute related.



25
26
27
# File 'lib/authentik/api/models/request_rule_binding.rb', line 25

def related
  @related
end

Returns the value of attribute related_obj.



27
28
29
# File 'lib/authentik/api/models/request_rule_binding.rb', line 27

def related_obj
  @related_obj
end

#ruleObject

Returns the value of attribute rule.



19
20
21
# File 'lib/authentik/api/models/request_rule_binding.rb', line 19

def rule
  @rule
end

#rule_objObject

Returns the value of attribute rule_obj.



21
22
23
# File 'lib/authentik/api/models/request_rule_binding.rb', line 21

def rule_obj
  @rule_obj
end

#targetObject

Returns the value of attribute target.



23
24
25
# File 'lib/authentik/api/models/request_rule_binding.rb', line 23

def target
  @target
end

#uuidObject

Returns the value of attribute uuid.



13
14
15
# File 'lib/authentik/api/models/request_rule_binding.rb', line 13

def uuid
  @uuid
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



74
75
76
# File 'lib/authentik/api/models/request_rule_binding.rb', line 74

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



79
80
81
# File 'lib/authentik/api/models/request_rule_binding.rb', line 79

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/authentik/api/models/request_rule_binding.rb', line 58

def self.attribute_map
  {
    :'uuid' => :'uuid',
    :'pbm_uuid' => :'pbm_uuid',
    :'policy_engine_mode' => :'policy_engine_mode',
    :'rule' => :'rule',
    :'rule_obj' => :'rule_obj',
    :'target' => :'target',
    :'related' => :'related',
    :'related_obj' => :'related_obj',
    :'expiry_pending' => :'expiry_pending',
    :'expiry_granted_max' => :'expiry_granted_max'
  }
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



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/authentik/api/models/request_rule_binding.rb', line 315

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



100
101
102
103
# File 'lib/authentik/api/models/request_rule_binding.rb', line 100

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/authentik/api/models/request_rule_binding.rb', line 84

def self.openapi_types
  {
    :'uuid' => :'String',
    :'pbm_uuid' => :'String',
    :'policy_engine_mode' => :'PolicyEngineMode',
    :'rule' => :'String',
    :'rule_obj' => :'RequestRule',
    :'target' => :'String',
    :'related' => :'Array<String>',
    :'related_obj' => :'Array<RelatedTarget>',
    :'expiry_pending' => :'String',
    :'expiry_granted_max' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/authentik/api/models/request_rule_binding.rb', line 285

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      uuid == o.uuid &&
      pbm_uuid == o.pbm_uuid &&
      policy_engine_mode == o.policy_engine_mode &&
      rule == o.rule &&
      rule_obj == o.rule_obj &&
      target == o.target &&
      related == o.related &&
      related_obj == o.related_obj &&
      expiry_pending == o.expiry_pending &&
      expiry_granted_max == o.expiry_granted_max
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


302
303
304
# File 'lib/authentik/api/models/request_rule_binding.rb', line 302

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



308
309
310
# File 'lib/authentik/api/models/request_rule_binding.rb', line 308

def hash
  [uuid, pbm_uuid, policy_engine_mode, rule, rule_obj, target, related, related_obj, expiry_pending, expiry_granted_max].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/authentik/api/models/request_rule_binding.rb', line 180

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @pbm_uuid.nil?
    invalid_properties.push('invalid value for "pbm_uuid", pbm_uuid cannot be nil.')
  end

  if @rule.nil?
    invalid_properties.push('invalid value for "rule", rule cannot be nil.')
  end

  if @rule_obj.nil?
    invalid_properties.push('invalid value for "rule_obj", rule_obj cannot be nil.')
  end

  if @target.nil?
    invalid_properties.push('invalid value for "target", target cannot be nil.')
  end

  if @related.nil?
    invalid_properties.push('invalid value for "related", related cannot be nil.')
  end

  if @related_obj.nil?
    invalid_properties.push('invalid value for "related_obj", related_obj cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/authentik/api/models/request_rule_binding.rb', line 337

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

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

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



212
213
214
215
216
217
218
219
220
221
# File 'lib/authentik/api/models/request_rule_binding.rb', line 212

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @pbm_uuid.nil?
  return false if @rule.nil?
  return false if @rule_obj.nil?
  return false if @target.nil?
  return false if @related.nil?
  return false if @related_obj.nil?
  true
end