Commit b91845f1 authored by Philip Cunningham's avatar Philip Cunningham Committed by Vitali Tatarintev

Extract common DastSiteProfile mutation arguments

parent f8a75d53
# 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 ...@@ -4,43 +4,19 @@ module Mutations
module DastSiteProfiles module DastSiteProfiles
class Create < BaseMutation class Create < BaseMutation
include FindsProject include FindsProject
include Mutations::AppSec::Dast::SiteProfiles::SharedArguments
graphql_name 'DastSiteProfileCreate' graphql_name 'DastSiteProfileCreate'
field :id, ::Types::GlobalIDType[::DastSiteProfile], field :id, SiteProfileID,
null: true, null: true,
description: 'ID of the site profile.' 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], argument :excluded_urls, [GraphQL::Types::String],
required: false, required: false,
default_value: [], default_value: [],
description: 'URLs to skip during an authenticated scan. Defaults to `[]`.' 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 authorize :create_on_demand_dast_scan
def resolve(full_path:, profile_name:, target_url: nil, **params) def resolve(full_path:, profile_name:, target_url: nil, **params)
......
...@@ -9,7 +9,7 @@ module Mutations ...@@ -9,7 +9,7 @@ module Mutations
required: true, required: true,
description: 'Project the site profile belongs to.' description: 'Project the site profile belongs to.'
argument :id, ::Types::GlobalIDType[::DastSiteProfile], argument :id, Mutations::AppSec::Dast::SiteProfiles::SharedArguments::SiteProfileID,
required: true, required: true,
description: 'ID of the site profile to be deleted.' description: 'ID of the site profile to be deleted.'
......
...@@ -4,48 +4,22 @@ module Mutations ...@@ -4,48 +4,22 @@ module Mutations
module DastSiteProfiles module DastSiteProfiles
class Update < BaseMutation class Update < BaseMutation
include FindsProject include FindsProject
include Mutations::AppSec::Dast::SiteProfiles::SharedArguments
graphql_name 'DastSiteProfileUpdate' graphql_name 'DastSiteProfileUpdate'
SiteProfileID = ::Types::GlobalIDType[::DastSiteProfile]
field :id, SiteProfileID, field :id, SiteProfileID,
null: true, null: true,
description: 'ID of the site profile.' description: 'ID of the site profile.'
argument :full_path, GraphQL::Types::ID,
required: true,
description: 'Project the site profile belongs to.'
argument :id, SiteProfileID, argument :id, SiteProfileID,
required: true, required: true,
description: 'ID of the site profile to be updated.' 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], argument :excluded_urls, [GraphQL::Types::String],
required: false, required: false,
description: 'URLs to skip during an authenticated scan.' 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 authorize :create_on_demand_dast_scan
def resolve(full_path:, id:, profile_name:, target_url: nil, **params) 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