2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
module Mutations
module Environments
module CanaryIngress
class Update < :: Mutations :: BaseMutation
graphql_name 'EnvironmentsCanaryIngressUpdate'
2022-06-21 17:19:12 +05:30
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.'
2021-02-22 17:27:13 +05:30
authorize :update_environment
argument :id ,
:: Types :: GlobalIDType [ :: Environment ] ,
required : true ,
2021-10-27 15:23:28 +05:30
description : 'Global ID of the environment to update.'
2021-02-22 17:27:13 +05:30
argument :weight ,
2021-10-27 15:23:28 +05:30
GraphQL :: Types :: Int ,
2021-02-22 17:27:13 +05:30
required : true ,
2021-10-27 15:23:28 +05:30
description : 'Weight of the Canary Ingress.'
2021-02-22 17:27:13 +05:30
2022-06-21 17:19:12 +05:30
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'
2021-02-22 17:27:13 +05:30
def resolve ( id : , ** kwargs )
2022-07-16 23:28:13 +05:30
return { errors : [ REMOVAL_ERR_MSG ] } unless certificate_based_clusters_enabled?
2022-06-21 17:19:12 +05:30
2021-02-22 17:27:13 +05:30
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-06-21 17:19:12 +05:30
private
2022-07-16 23:28:13 +05:30
def certificate_based_clusters_enabled?
instance_cluster = :: Clusters :: Instance . new
instance_cluster . certificate_based_clusters_enabled?
2022-06-21 17:19:12 +05:30
end
2021-02-22 17:27:13 +05:30
end
end
end
end