diff options
Diffstat (limited to 'app/graphql/mutations/ci/project_ci_cd_settings_update.rb')
-rw-r--r-- | app/graphql/mutations/ci/project_ci_cd_settings_update.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/graphql/mutations/ci/project_ci_cd_settings_update.rb b/app/graphql/mutations/ci/project_ci_cd_settings_update.rb new file mode 100644 index 00000000000..b0cffa2c088 --- /dev/null +++ b/app/graphql/mutations/ci/project_ci_cd_settings_update.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module Mutations + module Ci + class ProjectCiCdSettingsUpdate < BaseMutation + graphql_name 'ProjectCiCdSettingsUpdate' + + include FindsProject + + authorize :admin_project + + argument :full_path, GraphQL::Types::ID, + required: true, + description: 'Full Path of the project the settings belong to.' + + argument :keep_latest_artifact, GraphQL::Types::Boolean, + required: false, + description: 'Indicates if the latest artifact should be kept for this project.' + + argument :job_token_scope_enabled, GraphQL::Types::Boolean, + required: false, + description: 'Indicates CI job tokens generated in this project have restricted access to resources.' + + field :ci_cd_settings, + Types::Ci::CiCdSettingType, + null: false, + description: 'CI/CD settings after mutation.' + + def resolve(full_path:, **args) + project = authorized_find!(full_path) + settings = project.ci_cd_settings + settings.update(args) + + { + ci_cd_settings: settings, + errors: errors_on_object(settings) + } + end + end + end +end + +Mutations::Ci::ProjectCiCdSettingsUpdate.prepend_mod_with('Mutations::Ci::ProjectCiCdSettingsUpdate') |