Module: AlertManagement::Responses

Included in:
ProcessPrometheusAlertService, Projects::Alerting::NotifyService, Projects::Prometheus::Alerts::NotifyService
Defined in:
app/services/concerns/alert_management/responses.rb

Overview

Module to hold common response logic for AlertManagement services.

Instance Method Summary collapse

Instance Method Details

#bad_requestObject



14
15
16
# File 'app/services/concerns/alert_management/responses.rb', line 14

def bad_request
  ServiceResponse.error(message: 'Bad Request', http_status: :bad_request)
end

#createdObject



10
11
12
# File 'app/services/concerns/alert_management/responses.rb', line 10

def created
  ServiceResponse.success(http_status: :created)
end

#forbiddenObject



26
27
28
# File 'app/services/concerns/alert_management/responses.rb', line 26

def forbidden
  ServiceResponse.error(message: 'Forbidden', http_status: :forbidden)
end

#success(alerts) ⇒ Object



6
7
8
# File 'app/services/concerns/alert_management/responses.rb', line 6

def success(alerts)
  ServiceResponse.success(payload: { alerts: Array(alerts) })
end

#unauthorizedObject



18
19
20
# File 'app/services/concerns/alert_management/responses.rb', line 18

def unauthorized
  ServiceResponse.error(message: 'Unauthorized', http_status: :unauthorized)
end

#unprocessable_entityObject



22
23
24
# File 'app/services/concerns/alert_management/responses.rb', line 22

def unprocessable_entity
  ServiceResponse.error(message: 'Unprocessable Entity', http_status: :unprocessable_entity)
end