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/search/events“. 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



119
120
121
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
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
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 119

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_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_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.



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

def filter_actor_id
  @filter_actor_id
end

#filter_actor_typeObject

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



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

def filter_actor_type
  @filter_actor_type
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).



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

def filter_do_not_forward
  @filter_do_not_forward
end

#filter_event_typeObject

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



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

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.



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

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`.



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

def filter_resource_id
  @filter_resource_id
end

#filter_resource_typeObject

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



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

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`.



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

def filter_search
  @filter_search
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.



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

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.



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

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).



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

def sort
  @sort
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



74
75
76
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 74

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



79
80
81
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 79

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 56

def self.attribute_map
  {
    :'filter' => :'filter',
    :'filter_event_type' => :'filter[event_type]',
    :'filter_resource_type' => :'filter[resource_type]',
    :'filter_resource_id' => :'filter[resource_id]',
    :'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



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

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



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

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

.openapi_typesObject

Attribute type mapping.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 84

def self.openapi_types
  {
    :'filter' => :'Hash<String, Object>',
    :'filter_event_type' => :'String',
    :'filter_resource_type' => :'String',
    :'filter_resource_id' => :'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



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 233

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      filter == o.filter &&
      filter_event_type == o.filter_event_type &&
      filter_resource_type == o.filter_resource_type &&
      filter_resource_id == o.filter_resource_id &&
      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


252
253
254
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 252

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



258
259
260
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 258

def hash
  [filter, filter_event_type, filter_resource_type, filter_resource_id, 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



190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 190

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



287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 287

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



206
207
208
209
210
211
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event_search_request.rb', line 206

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