Class: MistApi::WxlanTag

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

Overview

WxLAN Tag * type: * client: created manually (e.g. on wireless client table, when they spot a device of interest, they can create a wxlan tag for it * resource: created automatically when we discover a network resource

   * subnet: create automatically when a subnet is discovered   * match:
* wlan_id, ap_id: values are a list of Wlan / Device ids     * client_mac:

values are a list of MAC addresses * radius_group: this is a smart tag that matches RADIUS-Filter-ID, Airespace-ACL-Name (VendorID=14179, VendorType=6) / Aruba-User-Role (VendorID=14823, VendorType=1) * radius_username: this matches the ATTR-User-Name(1) * radius_class: the matches the ATTR-Class(25) * radius_attr: the values are [ “6=1” , “26=10.2.3.4” ], this support other RADIUS attributes where we know the type

* radius_vendor: the values are [ "14179.10=1" , "14178.16=1.2.3.4" ],

this matches vendor attributes and will be dynamically evaluated

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, type = nil, created_time = SKIP, for_site = SKIP, id = SKIP, last_ips = SKIP, mac = SKIP, match = SKIP, modified_time = SKIP, op = WxlanTagOperationEnum::ENUM_IN, org_id = SKIP, resource_mac = SKIP, services = SKIP, site_id = SKIP, specs = SKIP, subnet = SKIP, values = SKIP, vlan_id = SKIP, additional_properties = nil) ⇒ WxlanTag

Returns a new instance of WxlanTag.



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/wxlan_tag.rb', line 181

def initialize(name = nil, type = nil, created_time = SKIP, for_site = SKIP,
               id = SKIP, last_ips = SKIP, mac = SKIP, match = SKIP,
               modified_time = SKIP, op = WxlanTagOperationEnum::ENUM_IN,
               org_id = SKIP, resource_mac = SKIP, services = SKIP,
               site_id = SKIP, specs = SKIP, subnet = SKIP, values = SKIP,
               vlan_id = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @created_time = created_time unless created_time == SKIP
  @for_site = for_site unless for_site == SKIP
  @id = id unless id == SKIP
  @last_ips = last_ips unless last_ips == SKIP
  @mac = mac unless mac == SKIP
  @match = match unless match == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @name = name
  @op = op unless op == SKIP
  @org_id = org_id unless org_id == SKIP
  @resource_mac = resource_mac unless resource_mac == SKIP
  @services = services unless services == SKIP
  @site_id = site_id unless site_id == SKIP
  @specs = specs unless specs == SKIP
  @subnet = subnet unless subnet == SKIP
  @type = type
  @values = values unless values == SKIP
  @vlan_id = vlan_id unless vlan_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


26
27
28
# File 'lib/mist_api/models/wxlan_tag.rb', line 26

def created_time
  @created_time
end

#for_siteTrueClass | FalseClass

When the object has been created, in epoch

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/mist_api/models/wxlan_tag.rb', line 30

def for_site
  @for_site
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


34
35
36
# File 'lib/mist_api/models/wxlan_tag.rb', line 34

def id
  @id
end

#last_ipsArray[String]

Unique ID of the object instance in the Mist Organization

Returns:

  • (Array[String])


38
39
40
# File 'lib/mist_api/models/wxlan_tag.rb', line 38

def last_ips
  @last_ips
end

#macString

If ‘type`==`client`, Client MAC Address

Returns:

  • (String)


42
43
44
# File 'lib/mist_api/models/wxlan_tag.rb', line 42

def mac
  @mac
end

#matchWxlanTagMatchEnum

required if ‘type`==`match`. enum: `ap_id`, `app`, `asset_mac`, `client_mac`, `hostname`, `ip_range_subnet`, `port`, `psk_name`, `psk_role`, `radius_attr`, `radius_class`, `radius_group`, `radius_username`, `sdkclient_uuid`, `wlan_id`

Returns:



49
50
51
# File 'lib/mist_api/models/wxlan_tag.rb', line 49

def match
  @match
end

#modified_timeFloat

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

Returns:

  • (Float)


53
54
55
# File 'lib/mist_api/models/wxlan_tag.rb', line 53

def modified_time
  @modified_time
end

#nameString

The name

Returns:

  • (String)


57
58
59
# File 'lib/mist_api/models/wxlan_tag.rb', line 57

def name
  @name
end

#opWxlanTagOperationEnum

required if ‘type`==`match`, type of tag (inclusive/exclusive). enum: `in`, `not_in`



62
63
64
# File 'lib/mist_api/models/wxlan_tag.rb', line 62

def op
  @op
end

#org_idUUID | String

required if ‘type`==`match`, type of tag (inclusive/exclusive). enum: `in`, `not_in`

Returns:

  • (UUID | String)


67
68
69
# File 'lib/mist_api/models/wxlan_tag.rb', line 67

def org_id
  @org_id
end

#resource_macString

required if ‘type`==`match`, type of tag (inclusive/exclusive). enum: `in`, `not_in`

Returns:

  • (String)


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

def resource_mac
  @resource_mac
end

#servicesArray[String]

required if ‘type`==`match`, type of tag (inclusive/exclusive). enum: `in`, `not_in`

Returns:

  • (Array[String])


77
78
79
# File 'lib/mist_api/models/wxlan_tag.rb', line 77

def services
  @services
end

#site_idUUID | String

required if ‘type`==`match`, type of tag (inclusive/exclusive). enum: `in`, `not_in`

Returns:

  • (UUID | String)


82
83
84
# File 'lib/mist_api/models/wxlan_tag.rb', line 82

def site_id
  @site_id
end

#specsArray[WxlanTagSpec]

If ‘type`==`spec`

Returns:

  • (Array[WxlanTagSpec])


86
87
88
# File 'lib/mist_api/models/wxlan_tag.rb', line 86

def specs
  @specs
end

#subnetString

If ‘type`==`spec`

Returns:

  • (String)


90
91
92
# File 'lib/mist_api/models/wxlan_tag.rb', line 90

def subnet
  @subnet
end

#typeWxlanTagTypeEnum

enum: ‘client`, `match`, `resource`, `spec`, `subnet`, `vlan`

Returns:



94
95
96
# File 'lib/mist_api/models/wxlan_tag.rb', line 94

def type
  @type
end

#valuesArray[String]

Required if ‘type`==`match` and

* `match`==`ap_id`: list of AP IDs
* `match`==`app`: list of Application Names
* `match`==`asset_mac`: list of Asset MAC Addresses
* `match`==`client_mac`: list of Client MAC Addresses
* `match`==`hostname`: list of Resources Hostnames
* `match`==`ip_range_subnet`: list of IP Addresses and/or CIDRs
* `match`==`psk_name`: list of PSK Names
* `match`==`psk_role`: list of PSK Roles
* `match`==`port`: list of Ports or Port Ranges
* `match`==`radius_attr`: list of RADIUS Attributes. The values are [

“6=1”, “26=10.2.3.4” ], this support other RADIUS attributes where we know the type

* `match`==`radius_class`: list of RADIUS Classes. This matches the

ATTR-Class(25)

* `match`==`radius_group`: list of RADIUS Groups. This is a smart tag

that matches RADIUS-Filter-ID, Airespace-ACL-Name (VendorID=14179, VendorType=6) / Aruba-User-Role (VendorID=14823, VendorType=1)

* `match`==`radius_username`: list of RADIUS Usernames. This matches the

ATTR-User-Name(1)

* `match`==`sdkclient_uuid`: list of SDK UUIDs
* `match`==`wlan_id`: list of WLAN IDs

Notes: Variables are not allowed

Returns:

  • (Array[String])


121
122
123
# File 'lib/mist_api/models/wxlan_tag.rb', line 121

def values
  @values
end

#vlan_idObject

If ‘type`==`vlan_id`, VLAN ID or variable

Returns:

  • (Object)


125
126
127
# File 'lib/mist_api/models/wxlan_tag.rb', line 125

def vlan_id
  @vlan_id
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
# File 'lib/mist_api/models/wxlan_tag.rb', line 212

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  for_site = hash.key?('for_site') ? hash['for_site'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  last_ips = hash.key?('last_ips') ? hash['last_ips'] : SKIP
  mac = hash.key?('mac') ? hash['mac'] : SKIP
  match = hash.key?('match') ? hash['match'] : SKIP
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  op = hash['op'] ||= WxlanTagOperationEnum::ENUM_IN
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  resource_mac = hash.key?('resource_mac') ? hash['resource_mac'] : SKIP
  services = hash.key?('services') ? hash['services'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  # Parameter is an array, so we need to iterate through it
  specs = nil
  unless hash['specs'].nil?
    specs = []
    hash['specs'].each do |structure|
      specs << (WxlanTagSpec.from_hash(structure) if structure)
    end
  end

  specs = SKIP unless hash.key?('specs')
  subnet = hash.key?('subnet') ? hash['subnet'] : SKIP
  values = hash.key?('values') ? hash['values'] : SKIP
  vlan_id = hash.key?('vlan_id') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:WxlanTagVlanId), hash['vlan_id']
  ) : 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.
  WxlanTag.new(name,
               type,
               created_time,
               for_site,
               id,
               last_ips,
               mac,
               match,
               modified_time,
               op,
               org_id,
               resource_mac,
               services,
               site_id,
               specs,
               subnet,
               values,
               vlan_id,
               additional_properties)
end

.namesObject

A mapping from model property names to API property names.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/mist_api/models/wxlan_tag.rb', line 128

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_time'] = 'created_time'
  @_hash['for_site'] = 'for_site'
  @_hash['id'] = 'id'
  @_hash['last_ips'] = 'last_ips'
  @_hash['mac'] = 'mac'
  @_hash['match'] = 'match'
  @_hash['modified_time'] = 'modified_time'
  @_hash['name'] = 'name'
  @_hash['op'] = 'op'
  @_hash['org_id'] = 'org_id'
  @_hash['resource_mac'] = 'resource_mac'
  @_hash['services'] = 'services'
  @_hash['site_id'] = 'site_id'
  @_hash['specs'] = 'specs'
  @_hash['subnet'] = 'subnet'
  @_hash['type'] = 'type'
  @_hash['values'] = 'values'
  @_hash['vlan_id'] = 'vlan_id'
  @_hash
end

.nullablesObject

An array for nullable fields



174
175
176
177
178
179
# File 'lib/mist_api/models/wxlan_tag.rb', line 174

def self.nullables
  %w[
    mac
    resource_mac
  ]
end

.optionalsObject

An array for optional fields



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/mist_api/models/wxlan_tag.rb', line 152

def self.optionals
  %w[
    created_time
    for_site
    id
    last_ips
    mac
    match
    modified_time
    op
    org_id
    resource_mac
    services
    site_id
    specs
    subnet
    values
    vlan_id
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (WxlanTag | Hash)

    value against the validation is performed.



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/mist_api/models/wxlan_tag.rb', line 277

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.type,
                              ->(val) { WxlanTagTypeEnum.validate(val) })
    )
  end

  return false unless value.instance_of? Hash

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



309
310
311
312
313
314
315
316
317
318
# File 'lib/mist_api/models/wxlan_tag.rb', line 309

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time.inspect}, for_site: #{@for_site.inspect}, id:"\
  " #{@id.inspect}, last_ips: #{@last_ips.inspect}, mac: #{@mac.inspect}, match:"\
  " #{@match.inspect}, modified_time: #{@modified_time.inspect}, name: #{@name.inspect}, op:"\
  " #{@op.inspect}, org_id: #{@org_id.inspect}, resource_mac: #{@resource_mac.inspect},"\
  " services: #{@services.inspect}, site_id: #{@site_id.inspect}, specs: #{@specs.inspect},"\
  " subnet: #{@subnet.inspect}, type: #{@type.inspect}, values: #{@values.inspect}, vlan_id:"\
  " #{@vlan_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



298
299
300
301
302
303
304
305
306
# File 'lib/mist_api/models/wxlan_tag.rb', line 298

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time}, for_site: #{@for_site}, id: #{@id},"\
  " last_ips: #{@last_ips}, mac: #{@mac}, match: #{@match}, modified_time: #{@modified_time},"\
  " name: #{@name}, op: #{@op}, org_id: #{@org_id}, resource_mac: #{@resource_mac}, services:"\
  " #{@services}, site_id: #{@site_id}, specs: #{@specs}, subnet: #{@subnet}, type: #{@type},"\
  " values: #{@values}, vlan_id: #{@vlan_id}, additional_properties:"\
  " #{@additional_properties}>"
end