Class: MistApi::OrgSettingAutoAssignmentRule

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

Overview

Auto_rules in org settings

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(src = nil, create_new_site_if_needed = false, expression = SKIP, gatewaytemplate_id = SKIP, match_country = SKIP, match_device_type = DeviceTypeDefaultApEnum::AP, match_model = SKIP, model = SKIP, prefix = SKIP, subnet = SKIP, suffix = SKIP, value = SKIP) ⇒ OrgSettingAutoAssignmentRule

Returns a new instance of OrgSettingAutoAssignmentRule.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 113

def initialize(src = nil, create_new_site_if_needed = false,
               expression = SKIP, gatewaytemplate_id = SKIP,
               match_country = SKIP,
               match_device_type = DeviceTypeDefaultApEnum::AP,
               match_model = SKIP, model = SKIP, prefix = SKIP,
               subnet = SKIP, suffix = SKIP, value = SKIP)
  unless create_new_site_if_needed == SKIP
    @create_new_site_if_needed =
      create_new_site_if_needed
  end
  @expression = expression unless expression == SKIP
  @gatewaytemplate_id = gatewaytemplate_id unless gatewaytemplate_id == SKIP
  @match_country = match_country unless match_country == SKIP
  @match_device_type = match_device_type unless match_device_type == SKIP
  @match_model = match_model unless match_model == SKIP
  @model = model unless model == SKIP
  @prefix = prefix unless prefix == SKIP
  @src = src
  @subnet = subnet unless subnet == SKIP
  @suffix = suffix unless suffix == SKIP
  @value = value unless value == SKIP
end

Instance Attribute Details

#create_new_site_if_neededTrueClass | FalseClass

If ‘src`==`geoip`. By default, a claimed device only gets assigned if the site exists to auto-create the site, enable this

Returns:

  • (TrueClass | FalseClass)


15
16
17
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 15

def create_new_site_if_needed
  @create_new_site_if_needed
end

#expressionString

If ‘src`==`name`, `src`==`lldp_system_name`, `src`==`dns_suffix`

"[0:3]"            // "abcdef" -> "abc"  
"split(.)[1]"      // "a.b.c" -> "b"  
"split(-)[1][0:3]" // "a1234-b5678-c90" -> "b56"'

Returns:

  • (String)


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

def expression
  @expression
end

#gatewaytemplate_idString

If ‘src`==`geoip` and `create_new_site_if_needed`==`true`. If a gateway template is desired for this newly created site

Returns:

  • (String)


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

def gatewaytemplate_id
  @gatewaytemplate_id
end

#match_countryString

If ‘src`==`geoip`

Returns:

  • (String)


31
32
33
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 31

def match_country
  @match_country
end

#match_device_typeDeviceTypeDefaultApEnum

enum: ‘ap`, `gateway`, `switch`



35
36
37
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 35

def match_device_type
  @match_device_type
end

#match_modelString

Optional/additional filter

Returns:

  • (String)


39
40
41
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 39

def match_model
  @match_model
end

#modelString

If ‘src`==`model`

Returns:

  • (String)


43
44
45
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 43

def model
  @model
end

#prefixString

If ‘src`==`name`

Returns:

  • (String)


47
48
49
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 47

def prefix
  @prefix
end

#srcOrgSettingAutoSiteAssignmentSrcEnum

enum: ‘ext_ip`, `dns_suffix`, `geoip`, `lldp_port_desc`, `lldp_system_name`, `model`, `name`, `subnet`



52
53
54
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 52

def src
  @src
end

#subnetString

If ‘src`==`subnet` or `ext_ip`==`ext_ip`

Returns:

  • (String)


56
57
58
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 56

def subnet
  @subnet
end

#suffixString

If ‘src`==`name`

Returns:

  • (String)


60
61
62
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 60

def suffix
  @suffix
end

#valueString

If

* `src`==`ext_ip`, `src`==`subnet` or `src`==`model`, the site name
* `src`==`geoip`: site name for the device to be assigned to (\"city\" /

"city+country" / …)“

Returns:

  • (String)


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

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  src = hash.key?('src') ? hash['src'] : nil
  create_new_site_if_needed = hash['create_new_site_if_needed'] ||= false
  expression = hash.key?('expression') ? hash['expression'] : SKIP
  gatewaytemplate_id =
    hash.key?('gatewaytemplate_id') ? hash['gatewaytemplate_id'] : SKIP
  match_country = hash.key?('match_country') ? hash['match_country'] : SKIP
  match_device_type =
    hash['match_device_type'] ||= DeviceTypeDefaultApEnum::AP
  match_model = hash.key?('match_model') ? hash['match_model'] : SKIP
  model = hash.key?('model') ? hash['model'] : SKIP
  prefix = hash.key?('prefix') ? hash['prefix'] : SKIP
  subnet = hash.key?('subnet') ? hash['subnet'] : SKIP
  suffix = hash.key?('suffix') ? hash['suffix'] : SKIP
  value = hash.key?('value') ? hash['value'] : SKIP

  # Create object from extracted values.
  OrgSettingAutoAssignmentRule.new(src,
                                   create_new_site_if_needed,
                                   expression,
                                   gatewaytemplate_id,
                                   match_country,
                                   match_device_type,
                                   match_model,
                                   model,
                                   prefix,
                                   subnet,
                                   suffix,
                                   value)
end

.namesObject

A mapping from model property names to API property names.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 70

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['create_new_site_if_needed'] = 'create_new_site_if_needed'
  @_hash['expression'] = 'expression'
  @_hash['gatewaytemplate_id'] = 'gatewaytemplate_id'
  @_hash['match_country'] = 'match_country'
  @_hash['match_device_type'] = 'match_device_type'
  @_hash['match_model'] = 'match_model'
  @_hash['model'] = 'model'
  @_hash['prefix'] = 'prefix'
  @_hash['src'] = 'src'
  @_hash['subnet'] = 'subnet'
  @_hash['suffix'] = 'suffix'
  @_hash['value'] = 'value'
  @_hash
end

.nullablesObject

An array for nullable fields



105
106
107
108
109
110
111
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 105

def self.nullables
  %w[
    expression
    prefix
    suffix
  ]
end

.optionalsObject

An array for optional fields



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 88

def self.optionals
  %w[
    create_new_site_if_needed
    expression
    gatewaytemplate_id
    match_country
    match_device_type
    match_model
    model
    prefix
    subnet
    suffix
    value
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



182
183
184
185
186
187
188
189
190
# File 'lib/mist_api/models/org_setting_auto_assignment_rule.rb', line 182

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} create_new_site_if_needed: #{@create_new_site_if_needed.inspect},"\
  " expression: #{@expression.inspect}, gatewaytemplate_id: #{@gatewaytemplate_id.inspect},"\
  " match_country: #{@match_country.inspect}, match_device_type:"\
  " #{@match_device_type.inspect}, match_model: #{@match_model.inspect}, model:"\
  " #{@model.inspect}, prefix: #{@prefix.inspect}, src: #{@src.inspect}, subnet:"\
  " #{@subnet.inspect}, suffix: #{@suffix.inspect}, value: #{@value.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} create_new_site_if_needed: #{@create_new_site_if_needed}, expression:"\
  " #{@expression}, gatewaytemplate_id: #{@gatewaytemplate_id}, match_country:"\
  " #{@match_country}, match_device_type: #{@match_device_type}, match_model: #{@match_model},"\
  " model: #{@model}, prefix: #{@prefix}, src: #{@src}, subnet: #{@subnet}, suffix:"\
  " #{@suffix}, value: #{@value}>"
end