Class: MistApi::Secpolicy

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

Overview

Security Policy is designed to audit / catch discrepancies between “what’s intended to be running” versus “what’s actually running” in a network. Many big organizations have separated Security and IT team (for good reasons). Each site can be assigned a security policy. Whenever an AP is provisioned, the configuration will be checked against the security policy. Any violations will be flagged in Device Config History where you can search for the when and where the violation occurs.

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(created_time = SKIP, id = SKIP, modified_time = SKIP, name = SKIP, org_id = SKIP, site_id = SKIP, wlans = SKIP, additional_properties = nil) ⇒ Secpolicy

Returns a new instance of Secpolicy.



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

def initialize(created_time = SKIP, id = SKIP, modified_time = SKIP,
               name = SKIP, org_id = SKIP, site_id = SKIP, wlans = 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
  @id = id unless id == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @name = name unless name == SKIP
  @org_id = org_id unless org_id == SKIP
  @site_id = site_id unless site_id == SKIP
  @wlans = wlans unless wlans == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


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

def created_time
  @created_time
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#modified_timeFloat

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

Returns:

  • (Float)


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

def modified_time
  @modified_time
end

#nameString

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

Returns:

  • (String)


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

def name
  @name
end

#org_idUUID | String

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

Returns:

  • (UUID | String)


36
37
38
# File 'lib/mist_api/models/secpolicy.rb', line 36

def org_id
  @org_id
end

#site_idUUID | String

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

Returns:

  • (UUID | String)


40
41
42
# File 'lib/mist_api/models/secpolicy.rb', line 40

def site_id
  @site_id
end

#wlansArray[Wlan]

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

Returns:

  • (Array[Wlan])


44
45
46
# File 'lib/mist_api/models/secpolicy.rb', line 44

def wlans
  @wlans
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/mist_api/models/secpolicy.rb', line 94

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  org_id = hash.key?('org_id') ? hash['org_id'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  # Parameter is an array, so we need to iterate through it
  wlans = nil
  unless hash['wlans'].nil?
    wlans = []
    hash['wlans'].each do |structure|
      wlans << (Wlan.from_hash(structure) if structure)
    end
  end

  wlans = SKIP unless hash.key?('wlans')

  # 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.
  Secpolicy.new(created_time,
                id,
                modified_time,
                name,
                org_id,
                site_id,
                wlans,
                additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/mist_api/models/secpolicy.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_time'] = 'created_time'
  @_hash['id'] = 'id'
  @_hash['modified_time'] = 'modified_time'
  @_hash['name'] = 'name'
  @_hash['org_id'] = 'org_id'
  @_hash['site_id'] = 'site_id'
  @_hash['wlans'] = 'wlans'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/mist_api/models/secpolicy.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    created_time
    id
    modified_time
    name
    org_id
    site_id
    wlans
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



142
143
144
145
146
147
148
# File 'lib/mist_api/models/secpolicy.rb', line 142

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time.inspect}, id: #{@id.inspect}, modified_time:"\
  " #{@modified_time.inspect}, name: #{@name.inspect}, org_id: #{@org_id.inspect}, site_id:"\
  " #{@site_id.inspect}, wlans: #{@wlans.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



134
135
136
137
138
139
# File 'lib/mist_api/models/secpolicy.rb', line 134

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_time: #{@created_time}, id: #{@id}, modified_time:"\
  " #{@modified_time}, name: #{@name}, org_id: #{@org_id}, site_id: #{@site_id}, wlans:"\
  " #{@wlans}, additional_properties: #{@additional_properties}>"
end