Class: MistApi::OrgSettingAutoDeviceNamingRule

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

Overview

OrgSettingAutoDeviceNamingRule Model.

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(expression = SKIP, match_device = DeviceTypeDefaultApEnum::AP, prefix = SKIP, src = SKIP, suffix = SKIP) ⇒ OrgSettingAutoDeviceNamingRule

Returns a new instance of OrgSettingAutoDeviceNamingRule.



61
62
63
64
65
66
67
68
69
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 61

def initialize(expression = SKIP,
               match_device = DeviceTypeDefaultApEnum::AP, prefix = SKIP,
               src = SKIP, suffix = SKIP)
  @expression = expression unless expression == SKIP
  @match_device = match_device unless match_device == SKIP
  @prefix = prefix unless prefix == SKIP
  @src = src unless src == SKIP
  @suffix = suffix unless suffix == SKIP
end

Instance Attribute Details

#expressionString

“[0:3]” // “abcdef” -> “abc”

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

Returns:

  • (String)


16
17
18
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 16

def expression
  @expression
end

#match_deviceDeviceTypeDefaultApEnum

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



20
21
22
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 20

def match_device
  @match_device
end

#prefixString

Prefix to append to the device name

Returns:

  • (String)


24
25
26
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 24

def prefix
  @prefix
end

#srcOrgSettingAutoDeviceNamingRuleSrcEnum

enum: ‘lldp_port_desc`, `mac`



28
29
30
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 28

def src
  @src
end

#suffixString

Suffix to append to the device name

Returns:

  • (String)


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

def suffix
  @suffix
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  expression = hash.key?('expression') ? hash['expression'] : SKIP
  match_device = hash['match_device'] ||= DeviceTypeDefaultApEnum::AP
  prefix = hash.key?('prefix') ? hash['prefix'] : SKIP
  src = hash.key?('src') ? hash['src'] : SKIP
  suffix = hash.key?('suffix') ? hash['suffix'] : SKIP

  # Create object from extracted values.
  OrgSettingAutoDeviceNamingRule.new(expression,
                                     match_device,
                                     prefix,
                                     src,
                                     suffix)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['expression'] = 'expression'
  @_hash['match_device'] = 'match_device'
  @_hash['prefix'] = 'prefix'
  @_hash['src'] = 'src'
  @_hash['suffix'] = 'suffix'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
54
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 46

def self.optionals
  %w[
    expression
    match_device
    prefix
    src
    suffix
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



98
99
100
101
102
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 98

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} expression: #{@expression.inspect}, match_device: #{@match_device.inspect},"\
  " prefix: #{@prefix.inspect}, src: #{@src.inspect}, suffix: #{@suffix.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



91
92
93
94
95
# File 'lib/mist_api/models/org_setting_auto_device_naming_rule.rb', line 91

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} expression: #{@expression}, match_device: #{@match_device}, prefix:"\
  " #{@prefix}, src: #{@src}, suffix: #{@suffix}>"
end