Class: SmplkitGeneratedClient::Audit::Event
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- SmplkitGeneratedClient::Audit::Event
- Defined in:
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb
Overview
An audit event — a record that something happened, attributed to an actor and a resource. When recording a snapshot of the resource at the time of the event, place it inside ‘data`. smplkit’s own integrations nest it under ‘data.snapshot`, but the slot is yours to use however you like.
Instance Attribute Summary collapse
-
#action ⇒ Object
Slug for what happened, e.g.
-
#actor_id ⇒ Object
Identifier of the actor that emitted the event.
-
#actor_label ⇒ Object
Human-readable label for the actor (e.g. the user’s email address or the API key name) at the time the event was recorded.
-
#actor_type ⇒ Object
Kind of credential that emitted the event, e.g.
-
#created_at ⇒ Object
When the event was received and recorded.
-
#data ⇒ Object
Free-form payload attached to the event.
-
#description ⇒ Object
Free-text description of the event.
-
#do_not_forward ⇒ Object
When ‘true`, the event is recorded but not delivered to any forwarder.
-
#idempotency_key ⇒ Object
The idempotency key used to deduplicate the record.
-
#occurred_at ⇒ Object
When the event actually happened.
-
#resource_id ⇒ Object
Identifier of the specific resource the event is about.
-
#resource_type ⇒ Object
Slug for the kind of resource the event is about, e.g.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Event
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Event
Initializes the object
116 117 118 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 187 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 116 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::Event` 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::Event`. 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?(:'action') self.action = attributes[:'action'] else self.action = nil end if attributes.key?(:'resource_type') self.resource_type = attributes[:'resource_type'] else self.resource_type = nil end if attributes.key?(:'resource_id') self.resource_id = attributes[:'resource_id'] else self.resource_id = nil end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'occurred_at') self.occurred_at = attributes[:'occurred_at'] end if attributes.key?(:'data') if (value = attributes[:'data']).is_a?(Hash) self.data = value end end if attributes.key?(:'do_not_forward') self.do_not_forward = attributes[:'do_not_forward'] else self.do_not_forward = false end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'actor_type') self.actor_type = attributes[:'actor_type'] end if attributes.key?(:'actor_id') self.actor_id = attributes[:'actor_id'] end if attributes.key?(:'actor_label') self.actor_label = attributes[:'actor_label'] end if attributes.key?(:'idempotency_key') self.idempotency_key = attributes[:'idempotency_key'] end end |
Instance Attribute Details
#action ⇒ Object
Slug for what happened, e.g. ‘user.created`. Lowercase, dot-separated.
20 21 22 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 20 def action @action end |
#actor_id ⇒ Object
Identifier of the actor that emitted the event.
47 48 49 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 47 def actor_id @actor_id end |
#actor_label ⇒ Object
Human-readable label for the actor (e.g. the user’s email address or the API key name) at the time the event was recorded.
50 51 52 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 50 def actor_label @actor_label end |
#actor_type ⇒ Object
Kind of credential that emitted the event, e.g. ‘USER` or `API_KEY`. Resolved server-side from the request credential.
44 45 46 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 44 def actor_type @actor_type end |
#created_at ⇒ Object
When the event was received and recorded.
41 42 43 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 41 def created_at @created_at end |
#data ⇒ Object
Free-form payload attached to the event. Use it for resource snapshots (by convention under ‘data.snapshot`), request identifiers, or any other context the event needs to carry.
35 36 37 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 35 def data @data end |
#description ⇒ Object
Free-text description of the event. Included alongside ‘resource_id` in the `filter` substring target.
29 30 31 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 29 def description @description end |
#do_not_forward ⇒ Object
When ‘true`, the event is recorded but not delivered to any forwarder. A delivery log entry with status `SKIPPED_DO_NOT_FORWARD` is written for each enabled forwarder so the skip is visible in the delivery log.
38 39 40 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 38 def do_not_forward @do_not_forward end |
#idempotency_key ⇒ Object
The idempotency key used to deduplicate the record. Echoes the ‘Idempotency-Key` header if one was supplied, otherwise a key derived from the event’s content.
53 54 55 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 53 def idempotency_key @idempotency_key end |
#occurred_at ⇒ Object
When the event actually happened. Defaults to the server receipt time (‘created_at`).
32 33 34 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 32 def occurred_at @occurred_at end |
#resource_id ⇒ Object
Identifier of the specific resource the event is about.
26 27 28 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 26 def resource_id @resource_id end |
#resource_type ⇒ Object
Slug for the kind of resource the event is about, e.g. ‘user`. Lowercase, dot-separated.
23 24 25 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 23 def resource_type @resource_type end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
74 75 76 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 74 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
79 80 81 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 79 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
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.rb', line 56 def self.attribute_map { :'action' => :'action', :'resource_type' => :'resource_type', :'resource_id' => :'resource_id', :'description' => :'description', :'occurred_at' => :'occurred_at', :'data' => :'data', :'do_not_forward' => :'do_not_forward', :'created_at' => :'created_at', :'actor_type' => :'actor_type', :'actor_id' => :'actor_id', :'actor_label' => :'actor_label', :'idempotency_key' => :'idempotency_key' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 310 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_nullable ⇒ Object
List of attributes with nullable: true
102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 102 def self.openapi_nullable Set.new([ :'description', :'occurred_at', :'created_at', :'actor_type', :'actor_id', :'actor_label', :'idempotency_key' ]) end |
.openapi_types ⇒ Object
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.rb', line 84 def self.openapi_types { :'action' => :'String', :'resource_type' => :'String', :'resource_id' => :'String', :'description' => :'String', :'occurred_at' => :'Time', :'data' => :'Hash<String, Object>', :'do_not_forward' => :'Boolean', :'created_at' => :'Time', :'actor_type' => :'String', :'actor_id' => :'String', :'actor_label' => :'String', :'idempotency_key' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 278 def ==(o) return true if self.equal?(o) self.class == o.class && action == o.action && resource_type == o.resource_type && resource_id == o.resource_id && description == o.description && occurred_at == o.occurred_at && data == o.data && do_not_forward == o.do_not_forward && created_at == o.created_at && actor_type == o.actor_type && actor_id == o.actor_id && actor_label == o.actor_label && idempotency_key == o.idempotency_key end |
#eql?(o) ⇒ Boolean
297 298 299 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 297 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
303 304 305 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 303 def hash [action, resource_type, resource_id, description, occurred_at, data, do_not_forward, created_at, actor_type, actor_id, actor_label, idempotency_key].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 217 218 219 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 191 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @action.nil? invalid_properties.push('invalid value for "action", action cannot be nil.') end if @action.to_s.length < 1 invalid_properties.push('invalid value for "action", the character length must be greater than or equal to 1.') end if @resource_type.nil? invalid_properties.push('invalid value for "resource_type", resource_type cannot be nil.') end if @resource_type.to_s.length < 1 invalid_properties.push('invalid value for "resource_type", the character length must be greater than or equal to 1.') end if @resource_id.nil? invalid_properties.push('invalid value for "resource_id", resource_id cannot be nil.') end if @resource_id.to_s.length < 1 invalid_properties.push('invalid value for "resource_id", the character length must be greater than or equal to 1.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 332 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
223 224 225 226 227 228 229 230 231 232 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 223 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @action.nil? return false if @action.to_s.length < 1 return false if @resource_type.nil? return false if @resource_type.to_s.length < 1 return false if @resource_id.nil? return false if @resource_id.to_s.length < 1 true end |