Class: Projects::Alerting::NotifyService

Inherits:
BaseProjectService show all
Extended by:
Gitlab::Utils::Override
Includes:
AlertManagement::AlertProcessing, AlertManagement::Responses
Defined in:
app/services/projects/alerting/notify_service.rb

Instance Attribute Summary

Attributes inherited from BaseProjectService

#project

Attributes inherited from BaseContainerService

#container, #current_user, #group, #params, #project

Instance Method Summary collapse

Methods included from Gitlab::Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods included from AlertManagement::Responses

#bad_request, #created, #forbidden, #success, #unauthorized, #unprocessable_entity

Methods included from AlertManagement::AlertProcessing

#alert, #alert_source, #build_new_alert, #close_issue, #complete_post_processing_tasks, #find_existing_alert, #incoming_payload, #logger, #notifying_alert?, #process_alert, #process_existing_alert, #process_firing_alert, #process_incident_issues, #process_new_alert, #process_resolved_alert, #refind_and_increment_alert, #resolving_alert?, #send_alert_email

Methods included from IncidentManagement::Settings

#auto_close_incident?, #incident_management_setting, #process_issues?

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Methods inherited from BaseContainerService

#group_container?, #namespace_container?, #project_container?, #project_group

Constructor Details

#initialize(project, params) ⇒ NotifyService

Returns a new instance of NotifyService.



10
11
12
# File 'app/services/projects/alerting/notify_service.rb', line 10

def initialize(project, params)
  super(project: project, params: params.to_h)
end

Instance Method Details

#execute(token, integration = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/projects/alerting/notify_service.rb', line 14

def execute(token, integration = nil)
  @integration = integration

  return bad_request unless valid_payload_size?
  return forbidden unless active_integration?
  return unauthorized unless valid_token?(token)

  process_alert
  return bad_request unless alert.persisted?

  complete_post_processing_tasks

  success(alert)
end