Class: MistApi::LogEvent
- Defined in:
- lib/mist_api/models/log_event.rb
Overview
LogEvent Model.
Instance Attribute Summary collapse
-
#admin_id ⇒ UUID | String
admin id.
-
#admin_name ⇒ String
Name of the admin that performs the action.
-
#after ⇒ Object
field values after the change.
-
#before ⇒ Object
field values prior to the change.
-
#device_id ⇒ UUID | String
Device id.
-
#for_site ⇒ TrueClass | FalseClass
Device id.
-
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization.
-
#message ⇒ String
log message.
-
#org_id ⇒ UUID | String
log message.
-
#site_id ⇒ UUID | String
log message.
-
#src_ip ⇒ String
sender source ip address.
-
#timestamp ⇒ Float
Epoch (seconds).
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(message = nil, org_id = nil, timestamp = nil, admin_id = SKIP, admin_name = SKIP, after = SKIP, before = SKIP, device_id = SKIP, for_site = SKIP, id = SKIP, site_id = SKIP, src_ip = SKIP) ⇒ LogEvent
constructor
A new instance of LogEvent.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(message = nil, org_id = nil, timestamp = nil, admin_id = SKIP, admin_name = SKIP, after = SKIP, before = SKIP, device_id = SKIP, for_site = SKIP, id = SKIP, site_id = SKIP, src_ip = SKIP) ⇒ LogEvent
Returns a new instance of LogEvent.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/mist_api/models/log_event.rb', line 103 def initialize( = nil, org_id = nil, = nil, admin_id = SKIP, admin_name = SKIP, after = SKIP, before = SKIP, device_id = SKIP, for_site = SKIP, id = SKIP, site_id = SKIP, src_ip = SKIP) @admin_id = admin_id unless admin_id == SKIP @admin_name = admin_name unless admin_name == SKIP @after = after unless after == SKIP @before = before unless before == SKIP @device_id = device_id unless device_id == SKIP @for_site = for_site unless for_site == SKIP @id = id unless id == SKIP @message = @org_id = org_id @site_id = site_id unless site_id == SKIP @src_ip = src_ip unless src_ip == SKIP @timestamp = end |
Instance Attribute Details
#admin_id ⇒ UUID | String
admin id
14 15 16 |
# File 'lib/mist_api/models/log_event.rb', line 14 def admin_id @admin_id end |
#admin_name ⇒ String
Name of the admin that performs the action
18 19 20 |
# File 'lib/mist_api/models/log_event.rb', line 18 def admin_name @admin_name end |
#after ⇒ Object
field values after the change
22 23 24 |
# File 'lib/mist_api/models/log_event.rb', line 22 def after @after end |
#before ⇒ Object
field values prior to the change
26 27 28 |
# File 'lib/mist_api/models/log_event.rb', line 26 def before @before end |
#device_id ⇒ UUID | String
Device id
30 31 32 |
# File 'lib/mist_api/models/log_event.rb', line 30 def device_id @device_id end |
#for_site ⇒ TrueClass | FalseClass
Device id
34 35 36 |
# File 'lib/mist_api/models/log_event.rb', line 34 def for_site @for_site end |
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization
38 39 40 |
# File 'lib/mist_api/models/log_event.rb', line 38 def id @id end |
#message ⇒ String
log message
42 43 44 |
# File 'lib/mist_api/models/log_event.rb', line 42 def @message end |
#org_id ⇒ UUID | String
log message
46 47 48 |
# File 'lib/mist_api/models/log_event.rb', line 46 def org_id @org_id end |
#site_id ⇒ UUID | String
log message
50 51 52 |
# File 'lib/mist_api/models/log_event.rb', line 50 def site_id @site_id end |
#src_ip ⇒ String
sender source ip address
54 55 56 |
# File 'lib/mist_api/models/log_event.rb', line 54 def src_ip @src_ip end |
#timestamp ⇒ Float
Epoch (seconds)
58 59 60 |
# File 'lib/mist_api/models/log_event.rb', line 58 def @timestamp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
122 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 |
# File 'lib/mist_api/models/log_event.rb', line 122 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = hash.key?('message') ? hash['message'] : nil org_id = hash.key?('org_id') ? hash['org_id'] : nil = hash.key?('timestamp') ? hash['timestamp'] : nil admin_id = hash.key?('admin_id') ? hash['admin_id'] : SKIP admin_name = hash.key?('admin_name') ? hash['admin_name'] : SKIP after = hash.key?('after') ? hash['after'] : SKIP before = hash.key?('before') ? hash['before'] : SKIP device_id = hash.key?('device_id') ? hash['device_id'] : SKIP for_site = hash.key?('for_site') ? hash['for_site'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP site_id = hash.key?('site_id') ? hash['site_id'] : SKIP src_ip = hash.key?('src_ip') ? hash['src_ip'] : SKIP # Create object from extracted values. LogEvent.new(, org_id, , admin_id, admin_name, after, before, device_id, for_site, id, site_id, src_ip) end |
.names ⇒ Object
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/log_event.rb', line 61 def self.names @_hash = {} if @_hash.nil? @_hash['admin_id'] = 'admin_id' @_hash['admin_name'] = 'admin_name' @_hash['after'] = 'after' @_hash['before'] = 'before' @_hash['device_id'] = 'device_id' @_hash['for_site'] = 'for_site' @_hash['id'] = 'id' @_hash['message'] = 'message' @_hash['org_id'] = 'org_id' @_hash['site_id'] = 'site_id' @_hash['src_ip'] = 'src_ip' @_hash['timestamp'] = 'timestamp' @_hash end |
.nullables ⇒ Object
An array for nullable fields
94 95 96 97 98 99 100 101 |
# File 'lib/mist_api/models/log_event.rb', line 94 def self.nullables %w[ admin_id admin_name device_id site_id ] end |
.optionals ⇒ Object
An array for optional fields
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/mist_api/models/log_event.rb', line 79 def self.optionals %w[ admin_id admin_name after before device_id for_site id site_id src_ip ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/mist_api/models/log_event.rb', line 156 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value., ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.org_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value., ->(val) { val.instance_of? Float }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['message'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['org_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['timestamp'], ->(val) { val.instance_of? Float }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
190 191 192 193 194 195 196 197 |
# File 'lib/mist_api/models/log_event.rb', line 190 def inspect class_name = self.class.name.split('::').last "<#{class_name} admin_id: #{@admin_id.inspect}, admin_name: #{@admin_name.inspect}, after:"\ " #{@after.inspect}, before: #{@before.inspect}, device_id: #{@device_id.inspect}, for_site:"\ " #{@for_site.inspect}, id: #{@id.inspect}, message: #{@message.inspect}, org_id:"\ " #{@org_id.inspect}, site_id: #{@site_id.inspect}, src_ip: #{@src_ip.inspect}, timestamp:"\ " #{@timestamp.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
181 182 183 184 185 186 187 |
# File 'lib/mist_api/models/log_event.rb', line 181 def to_s class_name = self.class.name.split('::').last "<#{class_name} admin_id: #{@admin_id}, admin_name: #{@admin_name}, after: #{@after},"\ " before: #{@before}, device_id: #{@device_id}, for_site: #{@for_site}, id: #{@id}, message:"\ " #{@message}, org_id: #{@org_id}, site_id: #{@site_id}, src_ip: #{@src_ip}, timestamp:"\ " #{@timestamp}>" end |