Class: Legion::Data::Model::AuditLog
- Inherits:
-
Object
- Object
- Legion::Data::Model::AuditLog
- Defined in:
- lib/legion/data/models/audit_log.rb
Constant Summary collapse
- VALID_EVENT_TYPES =
%w[runner_execution lifecycle_transition].freeze
- VALID_STATUSES =
%w[success failure denied].freeze
Instance Method Summary collapse
Instance Method Details
#before_destroy ⇒ Object
28 29 30 |
# File 'lib/legion/data/models/audit_log.rb', line 28 def before_destroy raise 'audit_log records are immutable and cannot be deleted' end |
#before_update ⇒ Object
24 25 26 |
# File 'lib/legion/data/models/audit_log.rb', line 24 def before_update raise 'audit_log records are immutable and cannot be updated' end |
#parsed_detail ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/legion/data/models/audit_log.rb', line 16 def parsed_detail return nil unless detail Legion::JSON.load(detail) rescue StandardError nil end |
#validate ⇒ Object
10 11 12 13 14 |
# File 'lib/legion/data/models/audit_log.rb', line 10 def validate super errors.add(:event_type, 'invalid') unless VALID_EVENT_TYPES.include?(event_type) errors.add(:status, 'invalid') unless VALID_STATUSES.include?(status) end |