Class: SmplkitGeneratedClient::Audit::EventSearchRequest

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb

Overview

Request body for “POST /api/v1/events/search“. Mirrors every column filter accepted by “GET /api/v1/events“ with identical semantics, and adds a top-level “filter“ field carrying a JSON Logic expression. When “filter“ is present the search is silently capped to the last 30 days by “occurred_at“; the expression is then evaluated in memory against each row that passes the column filters using the same “json-logic-qubit“ evaluator that runs in the forwarder pipeline (so search results match what would be forwarded). Filter-combination rules match “GET /api/v1/events“ exactly: - “filter“ must be accompanied by “filter“ — the index is keyed on the pair. - “filter“ must be accompanied by either “filter“ or “filter“ + “filter“ — substring matching has no index, so an unbounded substring scan is rejected.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ EventSearchRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 137

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::EventSearchRequest` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::EventSearchRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'filter')
    if (value = attributes[:'filter']).is_a?(Hash)
      self.filter = value
    end
  end

  if attributes.key?(:'filter_environment')
    self.filter_environment = attributes[:'filter_environment']
  end

  if attributes.key?(:'filter_event_type')
    self.filter_event_type = attributes[:'filter_event_type']
  end

  if attributes.key?(:'filter_resource_type')
    self.filter_resource_type = attributes[:'filter_resource_type']
  end

  if attributes.key?(:'filter_resource_id')
    self.filter_resource_id = attributes[:'filter_resource_id']
  end

  if attributes.key?(:'filter_severity')
    self.filter_severity = attributes[:'filter_severity']
  end

  if attributes.key?(:'filter_category')
    self.filter_category = attributes[:'filter_category']
  end

  if attributes.key?(:'filter_actor_type')
    self.filter_actor_type = attributes[:'filter_actor_type']
  end

  if attributes.key?(:'filter_actor_id')
    self.filter_actor_id = attributes[:'filter_actor_id']
  end

  if attributes.key?(:'filter_occurred_at')
    self.filter_occurred_at = attributes[:'filter_occurred_at']
  end

  if attributes.key?(:'filter_search')
    self.filter_search = attributes[:'filter_search']
  end

  if attributes.key?(:'filter_do_not_forward')
    self.filter_do_not_forward = attributes[:'filter_do_not_forward']
  end

  if attributes.key?(:'page_size')
    self.page_size = attributes[:'page_size']
  else
    self.page_size = 1000
  end

  if attributes.key?(:'page_after')
    self.page_after = attributes[:'page_after']
  end

  if attributes.key?(:'sort')
    self.sort = attributes[:'sort']
  else
    self.sort = '-occurred_at'
  end
end

Instance Attribute Details

#filterObject

Optional JSON Logic expression evaluated against each row after column filters narrow the candidate set. Null, absent, or an empty object disables JSON Logic filtering. When present, the search is silently capped to the last 30 days by ‘occurred_at` (intersected with any explicit `filter` the caller supplied).



20
21
22
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 20

def filter
  @filter
end

#filter_actor_idObject

Exact match on the event’s ‘actor_id` field.



44
45
46
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 44

def filter_actor_id
  @filter_actor_id
end

#filter_actor_typeObject

Exact match on the event’s ‘actor_type` field.



41
42
43
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 41

def filter_actor_type
  @filter_actor_type
end

#filter_categoryObject

Exact match on the event’s ‘category` field.



38
39
40
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 38

def filter_category
  @filter_category
end

#filter_do_not_forwardObject

When set, restrict to events whose ‘do_not_forward` flag matches the given boolean. Forwarder previews typically pass `false` to match live-pipeline semantics (events flagged `do_not_forward=true` are skipped by the forwarder pipeline).



53
54
55
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 53

def filter_do_not_forward
  @filter_do_not_forward
end

#filter_environmentObject

Comma-separated list of environment keys to scope results to (e.g. ‘production,staging`). When omitted, results are scoped to your single accessible environment; send the `X-Smplkit-Environment` header instead if you can access more than one. The reserved value `smplkit` selects platform change events that smplkit records about your own resources (flags, configuration, and so on); these are not tied to a deployment environment and are readable regardless of which environments you manage.



23
24
25
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 23

def filter_environment
  @filter_environment
end

#filter_event_typeObject

Exact match on the event’s ‘event_type` field.



26
27
28
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 26

def filter_event_type
  @filter_event_type
end

#filter_occurred_atObject

Date range using interval notation, e.g. ‘[2026-04-01T00:00:00Z,2026-04-15T00:00:00Z)`. Required by `filter` when the resource pair isn’t provided. When a JSON Logic ‘filter` is present, the effective range is intersected with the last 30 days.



47
48
49
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 47

def filter_occurred_at
  @filter_occurred_at
end

#filter_resource_idObject

Exact match on the event’s ‘resource_id` field. Must be accompanied by `filter`.



32
33
34
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 32

def filter_resource_id
  @filter_resource_id
end

#filter_resource_typeObject

Exact match on the event’s ‘resource_type` field.



29
30
31
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 29

def filter_resource_type
  @filter_resource_type
end

#filter_searchObject

Case-insensitive substring match on ‘resource_id` or `description`. Must be accompanied by either `filter` or `filter` + `filter`.



50
51
52
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 50

def filter_search
  @filter_search
end

#filter_severityObject

Exact match on the event’s ‘severity` field. One of `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `FATAL`.



35
36
37
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 35

def filter_severity
  @filter_severity
end

#page_afterObject

Opaque cursor — pass the previous response’s ‘links.next` cursor verbatim to fetch the next page. Keep the same `sort` value across paginated requests.



59
60
61
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 59

def page_after
  @page_after
end

#page_sizeObject

Maximum events to return. Range 1..1000, default 1000 — matches every other list / search endpoint on the platform. Set explicitly to a smaller value when the consumer is rendering results card-by-card.



56
57
58
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 56

def page_size
  @page_size
end

#sortObject

Sort field: ‘occurred_at` or `created_at`, optionally prefixed with `-` for descending order. Default `-occurred_at` (newest first).



62
63
64
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 62

def sort
  @sort
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



86
87
88
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 86

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



91
92
93
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 91

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 65

def self.attribute_map
  {
    :'filter' => :'filter',
    :'filter_environment' => :'filter[environment]',
    :'filter_event_type' => :'filter[event_type]',
    :'filter_resource_type' => :'filter[resource_type]',
    :'filter_resource_id' => :'filter[resource_id]',
    :'filter_severity' => :'filter[severity]',
    :'filter_category' => :'filter[category]',
    :'filter_actor_type' => :'filter[actor_type]',
    :'filter_actor_id' => :'filter[actor_id]',
    :'filter_occurred_at' => :'filter[occurred_at]',
    :'filter_search' => :'filter[search]',
    :'filter_do_not_forward' => :'filter[do_not_forward]',
    :'page_size' => :'page[size]',
    :'page_after' => :'page[after]',
    :'sort' => :'sort'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 298

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 117

def self.openapi_nullable
  Set.new([
    :'filter',
    :'filter_environment',
    :'filter_event_type',
    :'filter_resource_type',
    :'filter_resource_id',
    :'filter_severity',
    :'filter_category',
    :'filter_actor_type',
    :'filter_actor_id',
    :'filter_occurred_at',
    :'filter_search',
    :'filter_do_not_forward',
    :'page_after',
  ])
end

.openapi_typesObject

Attribute type mapping.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 96

def self.openapi_types
  {
    :'filter' => :'Hash<String, Object>',
    :'filter_environment' => :'String',
    :'filter_event_type' => :'String',
    :'filter_resource_type' => :'String',
    :'filter_resource_id' => :'String',
    :'filter_severity' => :'String',
    :'filter_category' => :'String',
    :'filter_actor_type' => :'String',
    :'filter_actor_id' => :'String',
    :'filter_occurred_at' => :'String',
    :'filter_search' => :'String',
    :'filter_do_not_forward' => :'Boolean',
    :'page_size' => :'Integer',
    :'page_after' => :'String',
    :'sort' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 263

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      filter == o.filter &&
      filter_environment == o.filter_environment &&
      filter_event_type == o.filter_event_type &&
      filter_resource_type == o.filter_resource_type &&
      filter_resource_id == o.filter_resource_id &&
      filter_severity == o.filter_severity &&
      filter_category == o.filter_category &&
      filter_actor_type == o.filter_actor_type &&
      filter_actor_id == o.filter_actor_id &&
      filter_occurred_at == o.filter_occurred_at &&
      filter_search == o.filter_search &&
      filter_do_not_forward == o.filter_do_not_forward &&
      page_size == o.page_size &&
      page_after == o.page_after &&
      sort == o.sort
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


285
286
287
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 285

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



291
292
293
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 291

def hash
  [filter, filter_environment, filter_event_type, filter_resource_type, filter_resource_id, filter_severity, filter_category, filter_actor_type, filter_actor_id, filter_occurred_at, filter_search, filter_do_not_forward, page_size, page_after, sort].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 220

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@page_size.nil? && @page_size > 1000
    invalid_properties.push('invalid value for "page_size", must be smaller than or equal to 1000.')
  end

  if !@page_size.nil? && @page_size < 1
    invalid_properties.push('invalid value for "page_size", must be greater than or equal to 1.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 320

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



236
237
238
239
240
241
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 236

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@page_size.nil? && @page_size > 1000
  return false if !@page_size.nil? && @page_size < 1
  true
end