Class: MistApi::CaptureWireless

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

Overview

Initiate a Wireless Packet Capture

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(ap_mac = SKIP, band = CaptureWirelessBandEnum::ENUM_24, duration = 600, format = CaptureWirelessFormatEnum::PCAP, max_pkt_len = 512, num_packets = 1024, ssid = SKIP, wlan_id = SKIP, additional_properties = nil) ⇒ CaptureWireless

Returns a new instance of CaptureWireless.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/mist_api/models/capture_wireless.rb', line 89

def initialize(ap_mac = SKIP, band = CaptureWirelessBandEnum::ENUM_24,
               duration = 600, format = CaptureWirelessFormatEnum::PCAP,
               max_pkt_len = 512, num_packets = 1024, ssid = SKIP,
               wlan_id = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @ap_mac = ap_mac unless ap_mac == SKIP
  @band = band unless band == SKIP
  @duration = duration unless duration == SKIP
  @format = format unless format == SKIP
  @max_pkt_len = max_pkt_len unless max_pkt_len == SKIP
  @num_packets = num_packets unless num_packets == SKIP
  @ssid = ssid unless ssid == SKIP
  @type = 'wireless'
  @wlan_id = wlan_id unless wlan_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#ap_macString

TODO: Write general description for this method

Returns:

  • (String)


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

def ap_mac
  @ap_mac
end

#bandCaptureWirelessBandEnum

enum: ‘24`, `5`, `6`



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

def band
  @band
end

#durationInteger

Duration of the capture, in seconds

Returns:

  • (Integer)


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

def duration
  @duration
end

#formatCaptureWirelessFormatEnum

pcap format. enum: ‘pcap`, `stream`



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

def format
  @format
end

#max_pkt_lenInteger

pcap format. enum: ‘pcap`, `stream`

Returns:

  • (Integer)


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

def max_pkt_len
  @max_pkt_len
end

#num_packetsInteger

number of packets to capture, 0 for unlimited, default is 1024, maximum is 10000

Returns:

  • (Integer)


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

def num_packets
  @num_packets
end

#ssidString

number of packets to capture, 0 for unlimited, default is 1024, maximum is 10000

Returns:

  • (String)


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

def ssid
  @ssid
end

#typeString (readonly)

enum: ‘wireless`

Returns:

  • (String)


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

def type
  @type
end

#wlan_idUUID | String

WLAN ID

Returns:

  • (UUID | String)


48
49
50
# File 'lib/mist_api/models/capture_wireless.rb', line 48

def wlan_id
  @wlan_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/mist_api/models/capture_wireless.rb', line 109

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ap_mac = hash.key?('ap_mac') ? hash['ap_mac'] : SKIP
  band = hash['band'] ||= CaptureWirelessBandEnum::ENUM_24
  duration = hash['duration'] ||= 600
  format = hash['format'] ||= CaptureWirelessFormatEnum::PCAP
  max_pkt_len = hash['max_pkt_len'] ||= 512
  num_packets = hash['num_packets'] ||= 1024
  ssid = hash.key?('ssid') ? hash['ssid'] : SKIP
  wlan_id = hash.key?('wlan_id') ? hash['wlan_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.
  CaptureWireless.new(ap_mac,
                      band,
                      duration,
                      format,
                      max_pkt_len,
                      num_packets,
                      ssid,
                      wlan_id,
                      additional_properties)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/mist_api/models/capture_wireless.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ap_mac'] = 'ap_mac'
  @_hash['band'] = 'band'
  @_hash['duration'] = 'duration'
  @_hash['format'] = 'format'
  @_hash['max_pkt_len'] = 'max_pkt_len'
  @_hash['num_packets'] = 'num_packets'
  @_hash['ssid'] = 'ssid'
  @_hash['type'] = 'type'
  @_hash['wlan_id'] = 'wlan_id'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
83
84
85
86
87
# File 'lib/mist_api/models/capture_wireless.rb', line 80

def self.nullables
  %w[
    ap_mac
    duration
    max_pkt_len
    num_packets
  ]
end

.optionalsObject

An array for optional fields



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/mist_api/models/capture_wireless.rb', line 66

def self.optionals
  %w[
    ap_mac
    band
    duration
    format
    max_pkt_len
    num_packets
    ssid
    wlan_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



150
151
152
153
154
155
156
# File 'lib/mist_api/models/capture_wireless.rb', line 150

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_mac: #{@ap_mac.inspect}, band: #{@band.inspect}, duration:"\
  " #{@duration.inspect}, format: #{@format.inspect}, max_pkt_len: #{@max_pkt_len.inspect},"\
  " num_packets: #{@num_packets.inspect}, ssid: #{@ssid.inspect}, type: #{@type.inspect},"\
  " wlan_id: #{@wlan_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_mac: #{@ap_mac}, band: #{@band}, duration: #{@duration}, format:"\
  " #{@format}, max_pkt_len: #{@max_pkt_len}, num_packets: #{@num_packets}, ssid: #{@ssid},"\
  " type: #{@type}, wlan_id: #{@wlan_id}, additional_properties: #{@additional_properties}>"
end