Class: MistApi::Psk

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

Overview

PSK

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(name = nil, passphrase = nil, ssid = nil, admin_sso_id = SKIP, created_time = SKIP, email = SKIP, expire_time = SKIP, expiry_notification_time = SKIP, id = SKIP, mac = SKIP, macs = SKIP, max_usage = 0, modified_time = SKIP, note = SKIP, notify_expiry = false, notify_on_create_or_edit = SKIP, old_passphrase = SKIP, org_id = SKIP, role = SKIP, site_id = SKIP, usage = PskUsageEnum::MULTI, vlan_id = SKIP, vlan_name = SKIP, additional_properties = nil) ⇒ Psk

Returns a new instance of Psk.



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
# File 'lib/mist_api/models/psk.rb', line 173

def initialize(name = nil, passphrase = nil, ssid = nil,
               admin_sso_id = SKIP, created_time = SKIP, email = SKIP,
               expire_time = SKIP, expiry_notification_time = SKIP,
               id = SKIP, mac = SKIP, macs = SKIP, max_usage = 0,
               modified_time = SKIP, note = SKIP, notify_expiry = false,
               notify_on_create_or_edit = SKIP, old_passphrase = SKIP,
               org_id = SKIP, role = SKIP, site_id = SKIP,
               usage = PskUsageEnum::MULTI, vlan_id = SKIP,
               vlan_name = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @admin_sso_id = admin_sso_id unless admin_sso_id == SKIP
  @created_time = created_time unless created_time == SKIP
  @email = email unless email == SKIP
  @expire_time = expire_time unless expire_time == SKIP
  @expiry_notification_time = expiry_notification_time unless expiry_notification_time == SKIP
  @id = id unless id == SKIP
  @mac = mac unless mac == SKIP
  @macs = macs unless macs == SKIP
  @max_usage = max_usage unless max_usage == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @name = name
  @note = note unless note == SKIP
  @notify_expiry = notify_expiry unless notify_expiry == SKIP
  @notify_on_create_or_edit = notify_on_create_or_edit unless notify_on_create_or_edit == SKIP
  @old_passphrase = old_passphrase unless old_passphrase == SKIP
  @org_id = org_id unless org_id == SKIP
  @passphrase = passphrase
  @role = role unless role == SKIP
  @site_id = site_id unless site_id == SKIP
  @ssid = ssid
  @usage = usage unless usage == SKIP
  @vlan_id = vlan_id unless vlan_id == SKIP
  @vlan_name = vlan_name unless vlan_name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#admin_sso_idString

sso id for psk created from psk portal

Returns:

  • (String)


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

def admin_sso_id
  @admin_sso_id
end

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


18
19
20
# File 'lib/mist_api/models/psk.rb', line 18

def created_time
  @created_time
end

#emailString

email to send psk expiring notifications to

Returns:

  • (String)


22
23
24
# File 'lib/mist_api/models/psk.rb', line 22

def email
  @email
end

#expire_timeInteger

Expire time for this PSK key (epoch time in seconds). Default ‘null` (as no expiration)

Returns:

  • (Integer)


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

def expire_time
  @expire_time
end

#expiry_notification_timeInteger

Number of days before psk is expired. Used as to when to start sending reminder notification when the psk is about to expire

Returns:

  • (Integer)


32
33
34
# File 'lib/mist_api/models/psk.rb', line 32

def expiry_notification_time
  @expiry_notification_time
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


36
37
38
# File 'lib/mist_api/models/psk.rb', line 36

def id
  @id
end

#macString

If ‘usage`==`single`, the mac that this PSK ties to, empty if `auto-binding`

Returns:

  • (String)


41
42
43
# File 'lib/mist_api/models/psk.rb', line 41

def mac
  @mac
end

#macsArray[String]

If ‘usage`==`macs`, this list contains N number of client mac addresses or mac patterns(1122*) or both. This list is capped at 5000

Returns:

  • (Array[String])


46
47
48
# File 'lib/mist_api/models/psk.rb', line 46

def macs
  @macs
end

#max_usageInteger

For Org PSK Only. Max concurrent users for this PSK key. Default is 0 (unlimited)

Returns:

  • (Integer)


51
52
53
# File 'lib/mist_api/models/psk.rb', line 51

def max_usage
  @max_usage
end

#modified_timeFloat

When the object has been modified for the last time, in epoch

Returns:

  • (Float)


55
56
57
# File 'lib/mist_api/models/psk.rb', line 55

def modified_time
  @modified_time
end

#nameString

When the object has been modified for the last time, in epoch

Returns:

  • (String)


59
60
61
# File 'lib/mist_api/models/psk.rb', line 59

def name
  @name
end

#noteString

When the object has been modified for the last time, in epoch

Returns:

  • (String)


63
64
65
# File 'lib/mist_api/models/psk.rb', line 63

def note
  @note
end

#notify_expiryTrueClass | FalseClass

If set to true, reminder notification will be sent when psk is about to expire

Returns:

  • (TrueClass | FalseClass)


68
69
70
# File 'lib/mist_api/models/psk.rb', line 68

def notify_expiry
  @notify_expiry
end

#notify_on_create_or_editTrueClass | FalseClass

If set to true, notification will be sent when psk is created or edited

Returns:

  • (TrueClass | FalseClass)


72
73
74
# File 'lib/mist_api/models/psk.rb', line 72

def notify_on_create_or_edit
  @notify_on_create_or_edit
end

#old_passphraseString

previous passphrase of the PSK if it has been rotated

Returns:

  • (String)


76
77
78
# File 'lib/mist_api/models/psk.rb', line 76

def old_passphrase
  @old_passphrase
end

#org_idUUID | String

previous passphrase of the PSK if it has been rotated

Returns:

  • (UUID | String)


80
81
82
# File 'lib/mist_api/models/psk.rb', line 80

def org_id
  @org_id
end

#passphraseString

passphrase of the PSK (8-63 character or 64 in hex)

Returns:

  • (String)


84
85
86
# File 'lib/mist_api/models/psk.rb', line 84

def passphrase
  @passphrase
end

#roleString

passphrase of the PSK (8-63 character or 64 in hex)

Returns:

  • (String)


88
89
90
# File 'lib/mist_api/models/psk.rb', line 88

def role
  @role
end

#site_idUUID | String

passphrase of the PSK (8-63 character or 64 in hex)

Returns:

  • (UUID | String)


92
93
94
# File 'lib/mist_api/models/psk.rb', line 92

def site_id
  @site_id
end

#ssidString

SSID this PSK should be applicable to

Returns:

  • (String)


96
97
98
# File 'lib/mist_api/models/psk.rb', line 96

def ssid
  @ssid
end

#usagePskUsageEnum

enum: ‘macs`, `multi`, `single`

Returns:



100
101
102
# File 'lib/mist_api/models/psk.rb', line 100

def usage
  @usage
end

#vlan_idObject

VLAN for this PSK key

Returns:

  • (Object)


104
105
106
# File 'lib/mist_api/models/psk.rb', line 104

def vlan_id
  @vlan_id
end

#vlan_nameString

VLAN name to be assigned. Optional, ‘vlan_id` takes precedence if both are provided

Returns:

  • (String)


109
110
111
# File 'lib/mist_api/models/psk.rb', line 109

def vlan_name
  @vlan_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/mist_api/models/psk.rb', line 212

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  passphrase = hash.key?('passphrase') ? hash['passphrase'] : nil
  ssid = hash.key?('ssid') ? hash['ssid'] : nil
  admin_sso_id = hash.key?('admin_sso_id') ? hash['admin_sso_id'] : SKIP
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  expire_time = hash.key?('expire_time') ? hash['expire_time'] : SKIP
  expiry_notification_time =
    hash.key?('expiry_notification_time') ? hash['expiry_notification_time'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  macs = hash.key?('macs') ? hash['macs'] : SKIP
  max_usage = hash['max_usage'] ||= 0
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  note = hash.key?('note') ? hash['note'] : SKIP
  notify_expiry = hash['notify_expiry'] ||= false
  notify_on_create_or_edit =
    hash.key?('notify_on_create_or_edit') ? hash['notify_on_create_or_edit'] : SKIP
  old_passphrase =
    hash.key?('old_passphrase') ? hash['old_passphrase'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  role = hash.key?('role') ? hash['role'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  usage = hash['usage'] ||= PskUsageEnum::MULTI
  vlan_id = hash.key?('vlan_id') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PskVlanId), hash['vlan_id']
  ) : SKIP
  vlan_name = hash.key?('vlan_name') ? hash['vlan_name'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Psk.new(name,
          passphrase,
          ssid,
          admin_sso_id,
          created_time,
          email,
          expire_time,
          expiry_notification_time,
          id,
          mac,
          macs,
          max_usage,
          modified_time,
          note,
          notify_expiry,
          notify_on_create_or_edit,
          old_passphrase,
          org_id,
          role,
          site_id,
          usage,
          vlan_id,
          vlan_name,
          additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/mist_api/models/psk.rb', line 112

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['admin_sso_id'] = 'admin_sso_id'
  @_hash['created_time'] = 'created_time'
  @_hash['email'] = 'email'
  @_hash['expire_time'] = 'expire_time'
  @_hash['expiry_notification_time'] = 'expiry_notification_time'
  @_hash['id'] = 'id'
  @_hash['mac'] = 'mac'
  @_hash['macs'] = 'macs'
  @_hash['max_usage'] = 'max_usage'
  @_hash['modified_time'] = 'modified_time'
  @_hash['name'] = 'name'
  @_hash['note'] = 'note'
  @_hash['notify_expiry'] = 'notify_expiry'
  @_hash['notify_on_create_or_edit'] = 'notify_on_create_or_edit'
  @_hash['old_passphrase'] = 'old_passphrase'
  @_hash['org_id'] = 'org_id'
  @_hash['passphrase'] = 'passphrase'
  @_hash['role'] = 'role'
  @_hash['site_id'] = 'site_id'
  @_hash['ssid'] = 'ssid'
  @_hash['usage'] = 'usage'
  @_hash['vlan_id'] = 'vlan_id'
  @_hash['vlan_name'] = 'vlan_name'
  @_hash
end

.nullablesObject

An array for nullable fields



167
168
169
170
171
# File 'lib/mist_api/models/psk.rb', line 167

def self.nullables
  %w[
    expire_time
  ]
end

.optionalsObject

An array for optional fields



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/mist_api/models/psk.rb', line 141

def self.optionals
  %w[
    admin_sso_id
    created_time
    email
    expire_time
    expiry_notification_time
    id
    mac
    macs
    max_usage
    modified_time
    note
    notify_expiry
    notify_on_create_or_edit
    old_passphrase
    org_id
    role
    site_id
    usage
    vlan_id
    vlan_name
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (Psk | Hash)

    value against the validation is performed.



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/mist_api/models/psk.rb', line 281

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.name,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.passphrase,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.ssid,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['name'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['passphrase'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['ssid'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/mist_api/models/psk.rb', line 319

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} admin_sso_id: #{@admin_sso_id.inspect}, created_time:"\
  " #{@created_time.inspect}, email: #{@email.inspect}, expire_time: #{@expire_time.inspect},"\
  " expiry_notification_time: #{@expiry_notification_time.inspect}, id: #{@id.inspect}, mac:"\
  " #{@mac.inspect}, macs: #{@macs.inspect}, max_usage: #{@max_usage.inspect}, modified_time:"\
  " #{@modified_time.inspect}, name: #{@name.inspect}, note: #{@note.inspect}, notify_expiry:"\
  " #{@notify_expiry.inspect}, notify_on_create_or_edit: #{@notify_on_create_or_edit.inspect},"\
  " old_passphrase: #{@old_passphrase.inspect}, org_id: #{@org_id.inspect}, passphrase:"\
  " #{@passphrase.inspect}, role: #{@role.inspect}, site_id: #{@site_id.inspect}, ssid:"\
  " #{@ssid.inspect}, usage: #{@usage.inspect}, vlan_id: #{@vlan_id.inspect}, vlan_name:"\
  " #{@vlan_name.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



306
307
308
309
310
311
312
313
314
315
316
# File 'lib/mist_api/models/psk.rb', line 306

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} admin_sso_id: #{@admin_sso_id}, created_time: #{@created_time}, email:"\
  " #{@email}, expire_time: #{@expire_time}, expiry_notification_time:"\
  " #{@expiry_notification_time}, id: #{@id}, mac: #{@mac}, macs: #{@macs}, max_usage:"\
  " #{@max_usage}, modified_time: #{@modified_time}, name: #{@name}, note: #{@note},"\
  " notify_expiry: #{@notify_expiry}, notify_on_create_or_edit: #{@notify_on_create_or_edit},"\
  " old_passphrase: #{@old_passphrase}, org_id: #{@org_id}, passphrase: #{@passphrase}, role:"\
  " #{@role}, site_id: #{@site_id}, ssid: #{@ssid}, usage: #{@usage}, vlan_id: #{@vlan_id},"\
  " vlan_name: #{@vlan_name}, additional_properties: #{@additional_properties}>"
end