diff options
Diffstat (limited to 'app/graphql/mutations/ci/catalog/resources/unpublish.rb')
-rw-r--r-- | app/graphql/mutations/ci/catalog/resources/unpublish.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/graphql/mutations/ci/catalog/resources/unpublish.rb b/app/graphql/mutations/ci/catalog/resources/unpublish.rb new file mode 100644 index 00000000000..e45e9646147 --- /dev/null +++ b/app/graphql/mutations/ci/catalog/resources/unpublish.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Mutations + module Ci + module Catalog + module Resources + class Unpublish < BaseMutation + graphql_name 'CatalogResourceUnpublish' + + authorize :add_catalog_resource + + argument :id, ::Types::GlobalIDType[::Ci::Catalog::Resource], + required: true, + description: 'Global ID of the catalog resource to unpublish.' + + def resolve(id:) + catalog_resource = ::Gitlab::Graphql::Lazy.force(GitlabSchema.find_by_gid(id)) + authorize!(catalog_resource&.project) + + catalog_resource.unpublish! + + { + errors: [] + } + end + end + end + end + end +end |