debian-mirror-gitlab/app/graphql/mutations/alert_management/http_integration/create.rb

38 lines
1.1 KiB
Ruby
Raw Normal View History

2021-01-29 00:20:46 +05:30
# frozen_string_literal: true
module Mutations
module AlertManagement
module HttpIntegration
class Create < HttpIntegrationBase
2021-03-11 19:13:27 +05:30
include FindsProject
2021-01-29 00:20:46 +05:30
graphql_name 'HttpIntegrationCreate'
2021-10-27 15:23:28 +05:30
argument :project_path, GraphQL::Types::ID,
2021-01-29 00:20:46 +05:30
required: true,
2021-10-27 15:23:28 +05:30
description: 'Project to create the integration in.'
2021-01-29 00:20:46 +05:30
2021-10-27 15:23:28 +05:30
argument :name, GraphQL::Types::String,
2021-01-29 00:20:46 +05:30
required: true,
2021-10-27 15:23:28 +05:30
description: 'Name of the integration.'
2021-01-29 00:20:46 +05:30
2021-10-27 15:23:28 +05:30
argument :active, GraphQL::Types::Boolean,
2021-01-29 00:20:46 +05:30
required: true,
2021-03-08 18:12:59 +05:30
description: 'Whether the integration is receiving alerts.'
2021-01-29 00:20:46 +05:30
def resolve(args)
2021-03-11 19:13:27 +05:30
project = authorized_find!(args[:project_path])
2021-01-29 00:20:46 +05:30
response ::AlertManagement::HttpIntegrations::CreateService.new(
project,
current_user,
2021-03-11 19:13:27 +05:30
http_integration_params(project, args)
2021-01-29 00:20:46 +05:30
).execute
end
end
end
end
end
2021-03-08 18:12:59 +05:30
2021-06-08 01:23:25 +05:30
Mutations::AlertManagement::HttpIntegration::Create.prepend_mod_with('Mutations::AlertManagement::HttpIntegration::Create')