2021-01-21 00:11:07 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Security
|
|
|
|
module CiConfiguration
|
2021-07-19 15:09:40 +00:00
|
|
|
class ConfigureSast < BaseSecurityAnalyzer
|
2021-01-21 00:11:07 +00:00
|
|
|
graphql_name 'ConfigureSast'
|
2021-04-28 12:10:09 +00:00
|
|
|
description <<~DESC
|
|
|
|
Configure SAST for a project by enabling SAST in a new or modified
|
|
|
|
`.gitlab-ci.yml` file in a new branch. The new branch and a URL to
|
|
|
|
create a Merge Request are a part of the response.
|
|
|
|
DESC
|
2021-01-21 00:11:07 +00:00
|
|
|
|
|
|
|
argument :configuration, ::Types::CiConfiguration::Sast::InputType,
|
|
|
|
required: true,
|
|
|
|
description: 'SAST CI configuration for the project.'
|
|
|
|
|
2021-07-19 15:09:40 +00:00
|
|
|
def configure_analyzer(project, **args)
|
2022-06-07 00:09:08 +00:00
|
|
|
::Security::CiConfiguration::SastCreateService.new(project, current_user, args[:configuration].to_h).execute
|
2021-01-21 00:11:07 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|