Class: MistApi::CaptureWired

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

Overview

Initiate a Wired 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, duration = 600, format = CaptureWiredFormatEnum::PCAP, max_pkt_len = 512, num_packets = 1024, tcpdump_expression = SKIP, additional_properties = nil) ⇒ CaptureWired

Returns a new instance of CaptureWired.



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

def initialize(ap_mac = SKIP, duration = 600,
               format = CaptureWiredFormatEnum::PCAP, max_pkt_len = 512,
               num_packets = 1024, tcpdump_expression = 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
  @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
  @tcpdump_expression = tcpdump_expression unless tcpdump_expression == SKIP
  @type = 'wired'
  @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_wired.rb', line 14

def ap_mac
  @ap_mac
end

#durationInteger

Duration of the capture, in seconds

Returns:

  • (Integer)


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

def duration
  @duration
end

#formatCaptureWiredFormatEnum

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



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

def format
  @format
end

#max_pkt_lenInteger

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

Returns:

  • (Integer)


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

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)


31
32
33
# File 'lib/mist_api/models/capture_wired.rb', line 31

def num_packets
  @num_packets
end

#tcpdump_expressionString

tcpdump expression

Returns:

  • (String)


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

def tcpdump_expression
  @tcpdump_expression
end

#typeString (readonly)

enum: ‘wired`

Returns:

  • (String)


39
40
41
# File 'lib/mist_api/models/capture_wired.rb', line 39

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/mist_api/models/capture_wired.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ap_mac = hash.key?('ap_mac') ? hash['ap_mac'] : SKIP
  duration = hash['duration'] ||= 600
  format = hash['format'] ||= CaptureWiredFormatEnum::PCAP
  max_pkt_len = hash['max_pkt_len'] ||= 512
  num_packets = hash['num_packets'] ||= 1024
  tcpdump_expression =
    hash.key?('tcpdump_expression') ? hash['tcpdump_expression'] : 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.
  CaptureWired.new(ap_mac,
                   duration,
                   format,
                   max_pkt_len,
                   num_packets,
                   tcpdump_expression,
                   additional_properties)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/mist_api/models/capture_wired.rb', line 42

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

.nullablesObject

An array for nullable fields



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

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

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
62
63
64
# File 'lib/mist_api/models/capture_wired.rb', line 55

def self.optionals
  %w[
    ap_mac
    duration
    format
    max_pkt_len
    num_packets
    tcpdump_expression
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
# File 'lib/mist_api/models/capture_wired.rb', line 125

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