Class: MistApi::NacRule

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

Overview

NacRule 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(action = nil, name = nil, apply_tags = SKIP, created_time = SKIP, enabled = true, guest_auth_state = SKIP, id = SKIP, matching = SKIP, modified_time = SKIP, not_matching = SKIP, order = SKIP, org_id = SKIP, additional_properties = nil) ⇒ NacRule

Returns a new instance of NacRule.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/mist_api/models/nac_rule.rb', line 99

def initialize(action = nil, name = nil, apply_tags = SKIP,
               created_time = SKIP, enabled = true, guest_auth_state = SKIP,
               id = SKIP, matching = SKIP, modified_time = SKIP,
               not_matching = SKIP, order = SKIP, org_id = SKIP,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @action = action
  @apply_tags = apply_tags unless apply_tags == SKIP
  @created_time = created_time unless created_time == SKIP
  @enabled = enabled unless enabled == SKIP
  @guest_auth_state = guest_auth_state unless guest_auth_state == SKIP
  @id = id unless id == SKIP
  @matching = matching unless matching == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @name = name
  @not_matching = not_matching unless not_matching == SKIP
  @order = order unless order == SKIP
  @org_id = org_id unless org_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#actionNacRuleActionEnum

enum: ‘allow`, `block`

Returns:



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

def action
  @action
end

#apply_tagsArray[String]

All optional, this goes into Access-Accept

Returns:

  • (Array[String])


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

def apply_tags
  @apply_tags
end

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


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

def created_time
  @created_time
end

#enabledTrueClass | FalseClass

Enabled or not

Returns:

  • (TrueClass | FalseClass)


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

def enabled
  @enabled
end

#guest_auth_stateNacRuleGuestAuthStateEnum

Guest portal authorization state. enum: ‘authorized`, `unknown`



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

def guest_auth_state
  @guest_auth_state
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#matchingNacRuleMatching

Unique ID of the object instance in the Mist Organization

Returns:



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

def matching
  @matching
end

#modified_timeFloat

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

Returns:

  • (Float)


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

def modified_time
  @modified_time
end

#nameString

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

Returns:

  • (String)


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

def name
  @name
end

#not_matchingNacRuleMatching

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

Returns:



50
51
52
# File 'lib/mist_api/models/nac_rule.rb', line 50

def not_matching
  @not_matching
end

#orderInteger

Order of the rule, lower value implies higher priority

Returns:

  • (Integer)


54
55
56
# File 'lib/mist_api/models/nac_rule.rb', line 54

def order
  @order
end

#org_idUUID | String

Order of the rule, lower value implies higher priority

Returns:

  • (UUID | String)


58
59
60
# File 'lib/mist_api/models/nac_rule.rb', line 58

def org_id
  @org_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
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
# File 'lib/mist_api/models/nac_rule.rb', line 123

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  action = hash.key?('action') ? hash['action'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  apply_tags = hash.key?('apply_tags') ? hash['apply_tags'] : SKIP
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  enabled = hash['enabled'] ||= true
  guest_auth_state =
    hash.key?('guest_auth_state') ? hash['guest_auth_state'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  matching = NacRuleMatching.from_hash(hash['matching']) if hash['matching']
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  not_matching = NacRuleMatching.from_hash(hash['not_matching']) if hash['not_matching']
  order = hash.key?('order') ? hash['order'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_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.
  NacRule.new(action,
              name,
              apply_tags,
              created_time,
              enabled,
              guest_auth_state,
              id,
              matching,
              modified_time,
              not_matching,
              order,
              org_id,
              additional_properties)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/mist_api/models/nac_rule.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['action'] = 'action'
  @_hash['apply_tags'] = 'apply_tags'
  @_hash['created_time'] = 'created_time'
  @_hash['enabled'] = 'enabled'
  @_hash['guest_auth_state'] = 'guest_auth_state'
  @_hash['id'] = 'id'
  @_hash['matching'] = 'matching'
  @_hash['modified_time'] = 'modified_time'
  @_hash['name'] = 'name'
  @_hash['not_matching'] = 'not_matching'
  @_hash['order'] = 'order'
  @_hash['org_id'] = 'org_id'
  @_hash
end

.nullablesObject

An array for nullable fields



95
96
97
# File 'lib/mist_api/models/nac_rule.rb', line 95

def self.nullables
  []
end

.optionalsObject

An array for optional fields



79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/mist_api/models/nac_rule.rb', line 79

def self.optionals
  %w[
    apply_tags
    created_time
    enabled
    guest_auth_state
    id
    matching
    modified_time
    not_matching
    order
    org_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



175
176
177
178
179
180
181
182
183
# File 'lib/mist_api/models/nac_rule.rb', line 175

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} action: #{@action.inspect}, apply_tags: #{@apply_tags.inspect},"\
  " created_time: #{@created_time.inspect}, enabled: #{@enabled.inspect}, guest_auth_state:"\
  " #{@guest_auth_state.inspect}, id: #{@id.inspect}, matching: #{@matching.inspect},"\
  " modified_time: #{@modified_time.inspect}, name: #{@name.inspect}, not_matching:"\
  " #{@not_matching.inspect}, order: #{@order.inspect}, org_id: #{@org_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



165
166
167
168
169
170
171
172
# File 'lib/mist_api/models/nac_rule.rb', line 165

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} action: #{@action}, apply_tags: #{@apply_tags}, created_time:"\
  " #{@created_time}, enabled: #{@enabled}, guest_auth_state: #{@guest_auth_state}, id:"\
  " #{@id}, matching: #{@matching}, modified_time: #{@modified_time}, name: #{@name},"\
  " not_matching: #{@not_matching}, order: #{@order}, org_id: #{@org_id},"\
  " additional_properties: #{@additional_properties}>"
end