2020-12-04 18:09:55 +00:00
# frozen_string_literal: true
module Mutations
module Environments
module CanaryIngress
class Update < :: Mutations :: BaseMutation
graphql_name 'EnvironmentsCanaryIngressUpdate'
2022-03-23 06:07:44 +00:00
description '**Deprecated** This endpoint is planned to be removed along with certificate-based clusters. [See this epic](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) for more information.'
2020-12-04 18:09:55 +00:00
authorize :update_environment
argument :id ,
:: Types :: GlobalIDType [ :: Environment ] ,
required : true ,
2021-08-12 03:10:11 +00:00
description : 'Global ID of the environment to update.'
2020-12-04 18:09:55 +00:00
argument :weight ,
2021-07-23 15:09:21 +00:00
GraphQL :: Types :: Int ,
2020-12-04 18:09:55 +00:00
required : true ,
2021-08-12 03:10:11 +00:00
description : 'Weight of the Canary Ingress.'
2020-12-04 18:09:55 +00:00
2022-03-23 06:07:44 +00:00
REMOVAL_ERR_MSG = 'This endpoint was deactivated as part of the certificate-based' \
'kubernetes integration removal. See Epic:' \
'https://gitlab.com/groups/gitlab-org/configure/-/epics/8'
2020-12-04 18:09:55 +00:00
def resolve ( id : , ** kwargs )
2022-05-05 09:08:00 +00:00
return { errors : [ REMOVAL_ERR_MSG ] } unless certificate_based_clusters_enabled?
2022-03-23 06:07:44 +00:00
2020-12-04 18:09:55 +00:00
environment = authorized_find! ( id : id )
result = :: Environments :: CanaryIngress :: UpdateService
. new ( environment . project , current_user , kwargs )
. execute_async ( environment )
{ errors : Array . wrap ( result [ :message ] ) }
end
def find_object ( id : )
GitlabSchema . find_by_gid ( id )
end
2022-03-23 06:07:44 +00:00
private
2022-05-05 09:08:00 +00:00
def certificate_based_clusters_enabled?
instance_cluster = :: Clusters :: Instance . new
instance_cluster . certificate_based_clusters_enabled?
2022-03-23 06:07:44 +00:00
end
2020-12-04 18:09:55 +00:00
end
end
end
end