Class: MistApi::WlanCiscoCwa

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

Overview

Cisco CWA (central web authentication) required RADIUS with COA in order to work. See CWA: www.cisco.com/c/en/us/support/docs/security/identity-services-engine /115732-central-web-auth-00.html

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(allowed_hostnames = SKIP, allowed_subnets = SKIP, blocked_subnets = SKIP, enabled = false) ⇒ WlanCiscoCwa

Returns a new instance of WlanCiscoCwa.



56
57
58
59
60
61
62
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 56

def initialize(allowed_hostnames = SKIP, allowed_subnets = SKIP,
               blocked_subnets = SKIP, enabled = false)
  @allowed_hostnames = allowed_hostnames unless allowed_hostnames == SKIP
  @allowed_subnets = allowed_subnets unless allowed_subnets == SKIP
  @blocked_subnets = blocked_subnets unless blocked_subnets == SKIP
  @enabled = enabled unless enabled == SKIP
end

Instance Attribute Details

#allowed_hostnamesArray[String]

List of hostnames without http(s):// (matched by substring)

Returns:

  • (Array[String])


17
18
19
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 17

def allowed_hostnames
  @allowed_hostnames
end

#allowed_subnetsArray[String]

List of CIDRs

Returns:

  • (Array[String])


21
22
23
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 21

def allowed_subnets
  @allowed_subnets
end

#blocked_subnetsArray[String]

List of blocked CIDRs

Returns:

  • (Array[String])


25
26
27
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 25

def blocked_subnets
  @blocked_subnets
end

#enabledTrueClass | FalseClass

List of blocked CIDRs

Returns:

  • (TrueClass | FalseClass)


29
30
31
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 29

def enabled
  @enabled
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  allowed_hostnames =
    hash.key?('allowed_hostnames') ? hash['allowed_hostnames'] : SKIP
  allowed_subnets =
    hash.key?('allowed_subnets') ? hash['allowed_subnets'] : SKIP
  blocked_subnets =
    hash.key?('blocked_subnets') ? hash['blocked_subnets'] : SKIP
  enabled = hash['enabled'] ||= false

  # Create object from extracted values.
  WlanCiscoCwa.new(allowed_hostnames,
                   allowed_subnets,
                   blocked_subnets,
                   enabled)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['allowed_hostnames'] = 'allowed_hostnames'
  @_hash['allowed_subnets'] = 'allowed_subnets'
  @_hash['blocked_subnets'] = 'blocked_subnets'
  @_hash['enabled'] = 'enabled'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
48
49
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 42

def self.optionals
  %w[
    allowed_hostnames
    allowed_subnets
    blocked_subnets
    enabled
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (WlanCiscoCwa | Hash)

    value against the validation is performed.



86
87
88
89
90
91
92
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 86

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



102
103
104
105
106
107
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 102

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} allowed_hostnames: #{@allowed_hostnames.inspect}, allowed_subnets:"\
  " #{@allowed_subnets.inspect}, blocked_subnets: #{@blocked_subnets.inspect}, enabled:"\
  " #{@enabled.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



95
96
97
98
99
# File 'lib/mist_api/models/wlan_cisco_cwa.rb', line 95

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} allowed_hostnames: #{@allowed_hostnames}, allowed_subnets:"\
  " #{@allowed_subnets}, blocked_subnets: #{@blocked_subnets}, enabled: #{@enabled}>"
end