Commit 8e1fbdf4 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'philipcunningham-extract-common-arguments-324599' into 'master'

Extract common DastSiteProfile mutation arguments

See merge request gitlab-org/gitlab!72469
parents d9d3a072 b91845f1
# frozen_string_literal: true
module Mutations
module AppSec
module Dast
module SiteProfiles
module SharedArguments
extend ActiveSupport::Concern
SiteProfileID = ::Types::GlobalIDType[::DastSiteProfile]
included do
argument :full_path, GraphQL::Types::ID,
required: true,
description: 'Project the site profile belongs to.'
argument :profile_name, GraphQL::Types::String,
required: true,
description: 'Name of the site profile.'
argument :target_url, GraphQL::Types::String,
required: false,
description: 'URL of the target to be scanned.'
argument :target_type, Types::DastTargetTypeEnum,
required: false,
description: 'Type of target to be scanned.'
argument :request_headers, GraphQL::Types::String,
required: false,
description: 'Comma-separated list of request header names and values to be ' \
'added to every request made by DAST.'
argument :auth, ::Types::Dast::SiteProfileAuthInputType,
required: false,
description: 'Parameters for authentication.'
end
end
end
end
end
end
......@@ -4,43 +4,19 @@ module Mutations
module DastSiteProfiles
class Create < BaseMutation
include FindsProject
include Mutations::AppSec::Dast::SiteProfiles::SharedArguments
graphql_name 'DastSiteProfileCreate'
field :id, ::Types::GlobalIDType[::DastSiteProfile],
field :id, SiteProfileID,
null: true,
description: 'ID of the site profile.'
argument :full_path, GraphQL::Types::ID,
required: true,
description: 'Project the site profile belongs to.'
argument :profile_name, GraphQL::Types::String,
required: true,
description: 'Name of the site profile.'
argument :target_url, GraphQL::Types::String,
required: false,
description: 'URL of the target to be scanned.'
argument :target_type, Types::DastTargetTypeEnum,
required: false,
description: 'Type of target to be scanned.'
argument :excluded_urls, [GraphQL::Types::String],
required: false,
default_value: [],
description: 'URLs to skip during an authenticated scan. Defaults to `[]`.'
argument :request_headers, GraphQL::Types::String,
required: false,
description: 'Comma-separated list of request header names and values to be ' \
'added to every request made by DAST.'
argument :auth, ::Types::Dast::SiteProfileAuthInputType,
required: false,
description: 'Parameters for authentication.'
authorize :create_on_demand_dast_scan
def resolve(full_path:, profile_name:, target_url: nil, **params)
......
......@@ -9,7 +9,7 @@ module Mutations
required: true,
description: 'Project the site profile belongs to.'
argument :id, ::Types::GlobalIDType[::DastSiteProfile],
argument :id, Mutations::AppSec::Dast::SiteProfiles::SharedArguments::SiteProfileID,
required: true,
description: 'ID of the site profile to be deleted.'
......
......@@ -4,48 +4,22 @@ module Mutations
module DastSiteProfiles
class Update < BaseMutation
include FindsProject
include Mutations::AppSec::Dast::SiteProfiles::SharedArguments
graphql_name 'DastSiteProfileUpdate'
SiteProfileID = ::Types::GlobalIDType[::DastSiteProfile]
field :id, SiteProfileID,
null: true,
description: 'ID of the site profile.'
argument :full_path, GraphQL::Types::ID,
required: true,
description: 'Project the site profile belongs to.'
argument :id, SiteProfileID,
required: true,
description: 'ID of the site profile to be updated.'
argument :profile_name, GraphQL::Types::String,
required: true,
description: 'Name of the site profile.'
argument :target_url, GraphQL::Types::String,
required: false,
description: 'URL of the target to be scanned.'
argument :target_type, Types::DastTargetTypeEnum,
required: false,
description: 'Type of target to be scanned.'
argument :excluded_urls, [GraphQL::Types::String],
required: false,
description: 'URLs to skip during an authenticated scan.'
argument :request_headers, GraphQL::Types::String,
required: false,
description: 'Comma-separated list of request header names and values to be ' \
'added to every request made by DAST.'
argument :auth, ::Types::Dast::SiteProfileAuthInputType,
required: false,
description: 'Parameters for authentication.'
authorize :create_on_demand_dast_scan
def resolve(full_path:, id:, profile_name:, target_url: nil, **params)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment