Class: Authentik::Api::Flow

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

Overview

Flow Serializer

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 = {}) ⇒ Flow

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
177
178
179
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/authentik/api/models/flow.rb', line 148

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Authentik::Api::Flow` 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::Flow`. 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?(:'pk')
    self.pk = attributes[:'pk']
  else
    self.pk = nil
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#authenticationObject

Required level of authentication and authorization to access a flow.



57
58
59
# File 'lib/authentik/api/models/flow.rb', line 57

def authentication
  @authentication
end

#backgroundObject

Background shown during execution



29
30
31
# File 'lib/authentik/api/models/flow.rb', line 29

def background
  @background
end

#background_themed_urlsObject

Returns the value of attribute background_themed_urls.



34
35
36
# File 'lib/authentik/api/models/flow.rb', line 34

def background_themed_urls
  @background_themed_urls
end

#background_urlObject

Get the URL to the background image



32
33
34
# File 'lib/authentik/api/models/flow.rb', line 32

def background_url
  @background_url
end

#cache_countObject

Get count of cached flows



41
42
43
# File 'lib/authentik/api/models/flow.rb', line 41

def cache_count
  @cache_count
end

#compatibility_modeObject

Enable compatibility mode, increases compatibility with password managers on mobile devices.



46
47
48
# File 'lib/authentik/api/models/flow.rb', line 46

def compatibility_mode
  @compatibility_mode
end

#denied_actionObject

Configure what should happen when a flow denies access to a user.



54
55
56
# File 'lib/authentik/api/models/flow.rb', line 54

def denied_action
  @denied_action
end

#designationObject

Decides what this Flow is used for. For example, the Authentication flow is redirect to when an un-authenticated user visits authentik.



26
27
28
# File 'lib/authentik/api/models/flow.rb', line 26

def designation
  @designation
end

#export_urlObject

Get export URL for flow



49
50
51
# File 'lib/authentik/api/models/flow.rb', line 49

def export_url
  @export_url
end

#layoutObject

Returns the value of attribute layout.



51
52
53
# File 'lib/authentik/api/models/flow.rb', line 51

def layout
  @layout
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#pkObject

Returns the value of attribute pk.



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

def pk
  @pk
end

#policiesObject

Returns the value of attribute policies.



38
39
40
# File 'lib/authentik/api/models/flow.rb', line 38

def policies
  @policies
end

#policy_engine_modeObject

Returns the value of attribute policy_engine_mode.



43
44
45
# File 'lib/authentik/api/models/flow.rb', line 43

def policy_engine_mode
  @policy_engine_mode
end

#policybindingmodel_ptr_idObject

Returns the value of attribute policybindingmodel_ptr_id.



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

def policybindingmodel_ptr_id
  @policybindingmodel_ptr_id
end

#slugObject

Visible in the URL.



20
21
22
# File 'lib/authentik/api/models/flow.rb', line 20

def slug
  @slug
end

#stagesObject

Returns the value of attribute stages.



36
37
38
# File 'lib/authentik/api/models/flow.rb', line 36

def stages
  @stages
end

#titleObject

Shown as the Title in Flow pages.



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

def title
  @title
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



106
107
108
# File 'lib/authentik/api/models/flow.rb', line 106

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



111
112
113
# File 'lib/authentik/api/models/flow.rb', line 111

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/authentik/api/models/flow.rb', line 82

def self.attribute_map
  {
    :'pk' => :'pk',
    :'policybindingmodel_ptr_id' => :'policybindingmodel_ptr_id',
    :'name' => :'name',
    :'slug' => :'slug',
    :'title' => :'title',
    :'designation' => :'designation',
    :'background' => :'background',
    :'background_url' => :'background_url',
    :'background_themed_urls' => :'background_themed_urls',
    :'stages' => :'stages',
    :'policies' => :'policies',
    :'cache_count' => :'cache_count',
    :'policy_engine_mode' => :'policy_engine_mode',
    :'compatibility_mode' => :'compatibility_mode',
    :'export_url' => :'export_url',
    :'layout' => :'layout',
    :'denied_action' => :'denied_action',
    :'authentication' => :'authentication'
  }
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



494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/authentik/api/models/flow.rb', line 494

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



140
141
142
143
144
# File 'lib/authentik/api/models/flow.rb', line 140

def self.openapi_nullable
  Set.new([
    :'background_themed_urls',
  ])
end

.openapi_typesObject

Attribute type mapping.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/authentik/api/models/flow.rb', line 116

def self.openapi_types
  {
    :'pk' => :'String',
    :'policybindingmodel_ptr_id' => :'String',
    :'name' => :'String',
    :'slug' => :'String',
    :'title' => :'String',
    :'designation' => :'FlowDesignationEnum',
    :'background' => :'String',
    :'background_url' => :'String',
    :'background_themed_urls' => :'ThemedUrls',
    :'stages' => :'Array<String>',
    :'policies' => :'Array<String>',
    :'cache_count' => :'Integer',
    :'policy_engine_mode' => :'PolicyEngineMode',
    :'compatibility_mode' => :'Boolean',
    :'export_url' => :'String',
    :'layout' => :'FlowLayoutEnum',
    :'denied_action' => :'DeniedActionEnum',
    :'authentication' => :'AuthenticationEnum'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/authentik/api/models/flow.rb', line 456

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      pk == o.pk &&
      policybindingmodel_ptr_id == o.policybindingmodel_ptr_id &&
      name == o.name &&
      slug == o.slug &&
      title == o.title &&
      designation == o.designation &&
      background == o.background &&
      background_url == o.background_url &&
      background_themed_urls == o.background_themed_urls &&
      stages == o.stages &&
      policies == o.policies &&
      cache_count == o.cache_count &&
      policy_engine_mode == o.policy_engine_mode &&
      compatibility_mode == o.compatibility_mode &&
      export_url == o.export_url &&
      layout == o.layout &&
      denied_action == o.denied_action &&
      authentication == o.authentication
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


481
482
483
# File 'lib/authentik/api/models/flow.rb', line 481

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



487
488
489
# File 'lib/authentik/api/models/flow.rb', line 487

def hash
  [pk, policybindingmodel_ptr_id, name, slug, title, designation, background, background_url, background_themed_urls, stages, policies, cache_count, policy_engine_mode, compatibility_mode, export_url, layout, denied_action, authentication].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/authentik/api/models/flow.rb', line 265

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

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

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

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

  pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
  if @slug !~ pattern
    invalid_properties.push("invalid value for \"slug\", must conform to the pattern #{pattern}.")
  end

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

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

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

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

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

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

  if @export_url.nil?
    invalid_properties.push('invalid value for "export_url", export_url 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



516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/authentik/api/models/flow.rb', line 516

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



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/authentik/api/models/flow.rb', line 322

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @pk.nil?
  return false if @policybindingmodel_ptr_id.nil?
  return false if @name.nil?
  return false if @slug.nil?
  return false if @slug !~ Regexp.new(/^[-a-zA-Z0-9_]+$/)
  return false if @title.nil?
  return false if @designation.nil?
  return false if @background_url.nil?
  return false if @stages.nil?
  return false if @policies.nil?
  return false if @cache_count.nil?
  return false if @export_url.nil?
  true
end