Use audit event type definition YML file when present

Description

We want to start using the audit event type definition YML files so that these are the single source of truth for audit events. In the next iterations we want to start throwing an exception if an audit event is logged but it doesn't have a corresponding YML definition.

Implementation Plan

  1. Update the audit method of Gitlab::Audit::Auditor to add a warning if the name of the event being audited doesn't have an associated YML file. This can be done by creating a method like below:
# Inside lib/gitlab/audit/type/definition.rb
def defined?(key)
  definitions[key.to_sym].present?
end

# And then use it inside lib/gitlab/audit/auditor.rb
Gitlab::Audit::Type::Definition.defined?('<event_name>') # add warning logs if false
  1. Update the initialize method of Gitlab::Audit::Auditor to read from the YML definition (so that the YML is the single source of truth)
# Inside lib/gitlab/audit/type/definition.rb
def stream_only?(key)
  # if saved_to_database if false then stream_only would be true
  # since both saved_to_database and stream_only cannot be false together.
  !definitions[key.to_sym].saved_to_database
end

# And then use it inside lib/gitlab/audit/auditor.rb
@stream_only = Gitlab::Audit::Type::Definition.stream_only?(name)
  1. Check the existing YAML definitions and ensure that the saved_to_database and stream fields matches with the current logic in the codebase and update the existing YAML files in case of mismatch.