diff --git a/components/dashboard/src/cell-disabled/DisabledCell.tsx b/components/dashboard/src/cell-disabled/DisabledCell.tsx new file mode 100644 index 00000000000000..075df51b33f4c6 --- /dev/null +++ b/components/dashboard/src/cell-disabled/DisabledCell.tsx @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2024 Gitpod GmbH. All rights reserved. + * Licensed under the GNU Affero General Public License (AGPL). + * See License.AGPL.txt in the project root for license information. + */ + +import { Heading2 } from "@podkit/typography/Headings"; +import { TextMuted } from "@podkit/typography/TextMuted"; +import { useTheme } from "../theme-context"; + +import cubicleImg from "../images/cubicle.webp"; +import cubicleDarkImg from "../images/cubicle-dark.webp"; +import cubicleImg2x from "../images/cubicle@2x.webp"; +import cubicleDarkImg2x from "../images/cubicle-dark@2x.webp"; + +export const DisabledCell = () => { + const { isDark } = useTheme(); + + return ( +
+
+ cubical illustration + Thank you for evaluating Gitpod + + This evaluation instance is now stopped.
+ Please contact our team to move to next steps. +
+
+
+ ); +}; diff --git a/components/dashboard/src/components/error-boundaries/QueryErrorBoundary.tsx b/components/dashboard/src/components/error-boundaries/QueryErrorBoundary.tsx index 9cce98dbc49f26..adf8e36d5ee7c9 100644 --- a/components/dashboard/src/components/error-boundaries/QueryErrorBoundary.tsx +++ b/components/dashboard/src/components/error-boundaries/QueryErrorBoundary.tsx @@ -13,6 +13,7 @@ import { isGitpodIo } from "../../utils"; import { CaughtError } from "./ReloadPageErrorBoundary"; import { gitpodHostUrl } from "../../service/service"; import QuickStart from "../QuickStart"; +import { DisabledCell } from "../../cell-disabled/DisabledCell"; // Error boundary intended to catch and handle expected errors from api calls export const QueryErrorBoundary: FC = ({ children }) => { @@ -57,6 +58,10 @@ const ExpectedQueryErrorsFallback: FC = ({ error, resetErrorBound return
; } + if (caughtError.code === ErrorCodes.CELL_EXPIRED) { + return ; + } + // User needs to Login if (caughtError.code === ErrorCodes.NOT_AUTHENTICATED) { console.log("clearing query cache for unauthenticated user"); diff --git a/components/dashboard/src/hooks/use-user-loader.ts b/components/dashboard/src/hooks/use-user-loader.ts index a2e897866e7da4..1abf1bc3ac86cb 100644 --- a/components/dashboard/src/hooks/use-user-loader.ts +++ b/components/dashboard/src/hooks/use-user-loader.ts @@ -22,13 +22,17 @@ export const useUserLoader = () => { queryFn: async () => { const user = (await userClient.getAuthenticatedUser({})).user; - return user || null; + return user ?? null; }, // We'll let an ErrorBoundary catch the error useErrorBoundary: true, // It's important we don't retry as we want to show the login screen as quickly as possible if a 401 retry: (_failureCount: number, error: Error & { code?: number }) => { - return error.code !== ErrorCodes.NOT_AUTHENTICATED && error.code !== ErrorCodes.USER_DELETED; + return ( + error.code !== ErrorCodes.NOT_AUTHENTICATED && + error.code !== ErrorCodes.USER_DELETED && + error.code !== ErrorCodes.CELL_EXPIRED + ); }, // docs: https://tanstack.com/query/v4/docs/react/guides/query-retries // backoff by doubling, max. 10s diff --git a/components/gitpod-protocol/src/messaging/error.ts b/components/gitpod-protocol/src/messaging/error.ts index 451bbdeb4af28b..59696b5b59715a 100644 --- a/components/gitpod-protocol/src/messaging/error.ts +++ b/components/gitpod-protocol/src/messaging/error.ts @@ -107,6 +107,9 @@ export const ErrorCodes = { // 481 Professional plan is required for this operation PLAN_PROFESSIONAL_REQUIRED: 481 as const, + // 482 Cell Expired + CELL_EXPIRED: 482 as const, + // 490 Too Many Running Workspace TOO_MANY_RUNNING_WORKSPACES: 490 as const, diff --git a/components/public-api/gitpod/v1/error.proto b/components/public-api/gitpod/v1/error.proto index 6b198e32901efa..25018da4c11b16 100644 --- a/components/public-api/gitpod/v1/error.proto +++ b/components/public-api/gitpod/v1/error.proto @@ -28,6 +28,7 @@ message FailedPreconditionDetails { RepositoryNotFoundError repository_not_found = 5; RepositoryUnauthorizedError repository_unauthorized = 6; ImageBuildLogsNotYetAvailableError image_build_logs_not_yet_available = 7; + CellDisabledError cell_is_disabled = 8; } } @@ -64,6 +65,8 @@ message RepositoryUnauthorizedError { message ImageBuildLogsNotYetAvailableError {} +message CellDisabledError {} + /* // details for INVALID_ARGUMENT status code // TODO: this is not yet implemented in the backend diff --git a/components/public-api/go/v1/error.pb.go b/components/public-api/go/v1/error.pb.go index 93a0ec5f08f59b..294d7f9524f73b 100644 --- a/components/public-api/go/v1/error.pb.go +++ b/components/public-api/go/v1/error.pb.go @@ -198,6 +198,7 @@ type FailedPreconditionDetails struct { // *FailedPreconditionDetails_RepositoryNotFound // *FailedPreconditionDetails_RepositoryUnauthorized // *FailedPreconditionDetails_ImageBuildLogsNotYetAvailable + // *FailedPreconditionDetails_CellIsDisabled Reason isFailedPreconditionDetails_Reason `protobuf_oneof:"reason"` } @@ -289,6 +290,13 @@ func (x *FailedPreconditionDetails) GetImageBuildLogsNotYetAvailable() *ImageBui return nil } +func (x *FailedPreconditionDetails) GetCellIsDisabled() *CellDisabledError { + if x, ok := x.GetReason().(*FailedPreconditionDetails_CellIsDisabled); ok { + return x.CellIsDisabled + } + return nil +} + type isFailedPreconditionDetails_Reason interface { isFailedPreconditionDetails_Reason() } @@ -321,6 +329,10 @@ type FailedPreconditionDetails_ImageBuildLogsNotYetAvailable struct { ImageBuildLogsNotYetAvailable *ImageBuildLogsNotYetAvailableError `protobuf:"bytes,7,opt,name=image_build_logs_not_yet_available,json=imageBuildLogsNotYetAvailable,proto3,oneof"` } +type FailedPreconditionDetails_CellIsDisabled struct { + CellIsDisabled *CellDisabledError `protobuf:"bytes,8,opt,name=cell_is_disabled,json=cellIsDisabled,proto3,oneof"` +} + func (*FailedPreconditionDetails_PaymentSpendingLimitReached) isFailedPreconditionDetails_Reason() {} func (*FailedPreconditionDetails_InvalidCostCenter) isFailedPreconditionDetails_Reason() {} @@ -336,6 +348,8 @@ func (*FailedPreconditionDetails_RepositoryUnauthorized) isFailedPreconditionDet func (*FailedPreconditionDetails_ImageBuildLogsNotYetAvailable) isFailedPreconditionDetails_Reason() { } +func (*FailedPreconditionDetails_CellIsDisabled) isFailedPreconditionDetails_Reason() {} + type PaymentSpendingLimitReachedError struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -726,6 +740,44 @@ func (*ImageBuildLogsNotYetAvailableError) Descriptor() ([]byte, []int) { return file_gitpod_v1_error_proto_rawDescGZIP(), []int{10} } +type CellDisabledError struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CellDisabledError) Reset() { + *x = CellDisabledError{} + if protoimpl.UnsafeEnabled { + mi := &file_gitpod_v1_error_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CellDisabledError) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CellDisabledError) ProtoMessage() {} + +func (x *CellDisabledError) ProtoReflect() protoreflect.Message { + mi := &file_gitpod_v1_error_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CellDisabledError.ProtoReflect.Descriptor instead. +func (*CellDisabledError) Descriptor() ([]byte, []int) { + return file_gitpod_v1_error_proto_rawDescGZIP(), []int{11} +} + var File_gitpod_v1_error_proto protoreflect.FileDescriptor var file_gitpod_v1_error_proto_rawDesc = []byte{ @@ -747,8 +799,8 @@ var file_gitpod_v1_error_proto_rawDesc = []byte{ 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x12, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x18, 0x0a, 0x16, 0x4e, 0x65, 0x65, 0x64, 0x73, 0x56, 0x65, 0x72, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xe2, - 0x05, 0x0a, 0x19, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x50, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x64, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xac, + 0x06, 0x0a, 0x19, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x50, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x72, 0x0a, 0x1e, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x18, 0x01, @@ -793,58 +845,64 @@ var file_gitpod_v1_error_proto_rawDesc = []byte{ 0x4c, 0x6f, 0x67, 0x73, 0x4e, 0x6f, 0x74, 0x59, 0x65, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x1d, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73, 0x4e, 0x6f, 0x74, 0x59, 0x65, 0x74, - 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x61, - 0x73, 0x6f, 0x6e, 0x22, 0x22, 0x0a, 0x20, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, - 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, - 0x65, 0x64, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x3f, 0x0a, 0x16, 0x49, 0x6e, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x54, 0x6f, 0x6f, 0x4d, - 0x61, 0x6e, 0x79, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x37, 0x0a, 0x15, 0x49, 0x6e, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x47, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x59, 0x4d, 0x4c, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x22, 0xeb, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, - 0x79, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, - 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, - 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, - 0x5f, 0x69, 0x73, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0b, 0x75, 0x73, 0x65, 0x72, 0x49, 0x73, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, - 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x1f, 0x0a, - 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1b, - 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6f, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x22, 0xfc, 0x01, 0x0a, 0x1b, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x55, - 0x6e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x68, 0x6f, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, - 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, - 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x23, 0x0a, - 0x0d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6f, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x32, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x73, 0x5f, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x69, 0x73, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, - 0x67, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, - 0x69, 0x73, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x22, - 0x24, 0x0a, 0x22, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, - 0x73, 0x4e, 0x6f, 0x74, 0x59, 0x65, 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x51, 0x0a, 0x16, 0x69, 0x6f, 0x2e, 0x67, 0x69, 0x74, 0x70, - 0x6f, 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x5a, - 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x70, - 0x6f, 0x64, 0x2d, 0x69, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2f, 0x63, 0x6f, 0x6d, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2d, 0x61, - 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x48, 0x0a, 0x10, 0x63, 0x65, 0x6c, + 0x6c, 0x5f, 0x69, 0x73, 0x5f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x65, 0x6c, 0x6c, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x65, 0x6c, 0x6c, 0x49, 0x73, 0x44, 0x69, 0x73, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x22, 0x0a, + 0x20, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x22, 0x3f, 0x0a, 0x16, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x43, 0x6f, 0x73, 0x74, + 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x54, 0x6f, 0x6f, 0x4d, 0x61, 0x6e, 0x79, 0x52, 0x75, 0x6e, + 0x6e, 0x69, 0x6e, 0x67, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x22, 0x37, 0x0a, 0x15, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x47, 0x69, + 0x74, 0x70, 0x6f, 0x64, 0x59, 0x4d, 0x4c, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x0a, + 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xeb, 0x01, 0x0a, + 0x17, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x6f, 0x74, 0x46, 0x6f, + 0x75, 0x6e, 0x64, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, + 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x73, 0x5f, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x73, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x73, 0x65, + 0x72, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x61, + 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6f, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, + 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xfc, 0x01, 0x0a, 0x1b, 0x52, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x64, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, + 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x27, + 0x0a, 0x0f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, + 0x64, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x72, 0x65, 0x70, 0x6f, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x72, 0x65, 0x70, 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x49, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x0a, + 0x11, 0x69, 0x73, 0x5f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x73, 0x4d, 0x69, 0x73, 0x73, + 0x69, 0x6e, 0x67, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x22, 0x24, 0x0a, 0x22, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x6f, 0x67, 0x73, 0x4e, 0x6f, 0x74, 0x59, 0x65, + 0x74, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x22, + 0x13, 0x0a, 0x11, 0x43, 0x65, 0x6c, 0x6c, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x42, 0x51, 0x0a, 0x16, 0x69, 0x6f, 0x2e, 0x67, 0x69, 0x74, 0x70, 0x6f, + 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x5a, 0x37, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, + 0x64, 0x2d, 0x69, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2f, 0x63, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2d, 0x61, 0x70, + 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -859,7 +917,7 @@ func file_gitpod_v1_error_proto_rawDescGZIP() []byte { return file_gitpod_v1_error_proto_rawDescData } -var file_gitpod_v1_error_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_gitpod_v1_error_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_gitpod_v1_error_proto_goTypes = []interface{}{ (*PermissionDeniedDetails)(nil), // 0: gitpod.v1.PermissionDeniedDetails (*UserBlockedError)(nil), // 1: gitpod.v1.UserBlockedError @@ -872,6 +930,7 @@ var file_gitpod_v1_error_proto_goTypes = []interface{}{ (*RepositoryNotFoundError)(nil), // 8: gitpod.v1.RepositoryNotFoundError (*RepositoryUnauthorizedError)(nil), // 9: gitpod.v1.RepositoryUnauthorizedError (*ImageBuildLogsNotYetAvailableError)(nil), // 10: gitpod.v1.ImageBuildLogsNotYetAvailableError + (*CellDisabledError)(nil), // 11: gitpod.v1.CellDisabledError } var file_gitpod_v1_error_proto_depIdxs = []int32{ 1, // 0: gitpod.v1.PermissionDeniedDetails.user_blocked:type_name -> gitpod.v1.UserBlockedError @@ -883,11 +942,12 @@ var file_gitpod_v1_error_proto_depIdxs = []int32{ 8, // 6: gitpod.v1.FailedPreconditionDetails.repository_not_found:type_name -> gitpod.v1.RepositoryNotFoundError 9, // 7: gitpod.v1.FailedPreconditionDetails.repository_unauthorized:type_name -> gitpod.v1.RepositoryUnauthorizedError 10, // 8: gitpod.v1.FailedPreconditionDetails.image_build_logs_not_yet_available:type_name -> gitpod.v1.ImageBuildLogsNotYetAvailableError - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 11, // 9: gitpod.v1.FailedPreconditionDetails.cell_is_disabled:type_name -> gitpod.v1.CellDisabledError + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_gitpod_v1_error_proto_init() } @@ -1028,6 +1088,18 @@ func file_gitpod_v1_error_proto_init() { return nil } } + file_gitpod_v1_error_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CellDisabledError); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_gitpod_v1_error_proto_msgTypes[0].OneofWrappers = []interface{}{ (*PermissionDeniedDetails_UserBlocked)(nil), @@ -1041,6 +1113,7 @@ func file_gitpod_v1_error_proto_init() { (*FailedPreconditionDetails_RepositoryNotFound)(nil), (*FailedPreconditionDetails_RepositoryUnauthorized)(nil), (*FailedPreconditionDetails_ImageBuildLogsNotYetAvailable)(nil), + (*FailedPreconditionDetails_CellIsDisabled)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -1048,7 +1121,7 @@ func file_gitpod_v1_error_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_gitpod_v1_error_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 12, NumExtensions: 0, NumServices: 0, }, diff --git a/components/public-api/java/src/main/java/io/gitpod/publicapi/v1/Error.java b/components/public-api/java/src/main/java/io/gitpod/publicapi/v1/Error.java index 586cd0378435cc..abbf914fee8c17 100644 --- a/components/public-api/java/src/main/java/io/gitpod/publicapi/v1/Error.java +++ b/components/public-api/java/src/main/java/io/gitpod/publicapi/v1/Error.java @@ -1741,6 +1741,21 @@ public interface FailedPreconditionDetailsOrBuilder extends */ io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableErrorOrBuilder getImageBuildLogsNotYetAvailableOrBuilder(); + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + * @return Whether the cellIsDisabled field is set. + */ + boolean hasCellIsDisabled(); + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + * @return The cellIsDisabled. + */ + io.gitpod.publicapi.v1.Error.CellDisabledError getCellIsDisabled(); + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + */ + io.gitpod.publicapi.v1.Error.CellDisabledErrorOrBuilder getCellIsDisabledOrBuilder(); + io.gitpod.publicapi.v1.Error.FailedPreconditionDetails.ReasonCase getReasonCase(); } /** @@ -1797,6 +1812,7 @@ public enum ReasonCase REPOSITORY_NOT_FOUND(5), REPOSITORY_UNAUTHORIZED(6), IMAGE_BUILD_LOGS_NOT_YET_AVAILABLE(7), + CELL_IS_DISABLED(8), REASON_NOT_SET(0); private final int value; private ReasonCase(int value) { @@ -1821,6 +1837,7 @@ public static ReasonCase forNumber(int value) { case 5: return REPOSITORY_NOT_FOUND; case 6: return REPOSITORY_UNAUTHORIZED; case 7: return IMAGE_BUILD_LOGS_NOT_YET_AVAILABLE; + case 8: return CELL_IS_DISABLED; case 0: return REASON_NOT_SET; default: return null; } @@ -2053,6 +2070,37 @@ public io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableErrorOrBuilder return io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableError.getDefaultInstance(); } + public static final int CELL_IS_DISABLED_FIELD_NUMBER = 8; + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + * @return Whether the cellIsDisabled field is set. + */ + @java.lang.Override + public boolean hasCellIsDisabled() { + return reasonCase_ == 8; + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + * @return The cellIsDisabled. + */ + @java.lang.Override + public io.gitpod.publicapi.v1.Error.CellDisabledError getCellIsDisabled() { + if (reasonCase_ == 8) { + return (io.gitpod.publicapi.v1.Error.CellDisabledError) reason_; + } + return io.gitpod.publicapi.v1.Error.CellDisabledError.getDefaultInstance(); + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + */ + @java.lang.Override + public io.gitpod.publicapi.v1.Error.CellDisabledErrorOrBuilder getCellIsDisabledOrBuilder() { + if (reasonCase_ == 8) { + return (io.gitpod.publicapi.v1.Error.CellDisabledError) reason_; + } + return io.gitpod.publicapi.v1.Error.CellDisabledError.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -2088,6 +2136,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (reasonCase_ == 7) { output.writeMessage(7, (io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableError) reason_); } + if (reasonCase_ == 8) { + output.writeMessage(8, (io.gitpod.publicapi.v1.Error.CellDisabledError) reason_); + } getUnknownFields().writeTo(output); } @@ -2125,6 +2176,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(7, (io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableError) reason_); } + if (reasonCase_ == 8) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, (io.gitpod.publicapi.v1.Error.CellDisabledError) reason_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2170,6 +2225,10 @@ public boolean equals(final java.lang.Object obj) { if (!getImageBuildLogsNotYetAvailable() .equals(other.getImageBuildLogsNotYetAvailable())) return false; break; + case 8: + if (!getCellIsDisabled() + .equals(other.getCellIsDisabled())) return false; + break; case 0: default: } @@ -2213,6 +2272,10 @@ public int hashCode() { hash = (37 * hash) + IMAGE_BUILD_LOGS_NOT_YET_AVAILABLE_FIELD_NUMBER; hash = (53 * hash) + getImageBuildLogsNotYetAvailable().hashCode(); break; + case 8: + hash = (37 * hash) + CELL_IS_DISABLED_FIELD_NUMBER; + hash = (53 * hash) + getCellIsDisabled().hashCode(); + break; case 0: default: } @@ -2372,6 +2435,9 @@ public Builder clear() { if (imageBuildLogsNotYetAvailableBuilder_ != null) { imageBuildLogsNotYetAvailableBuilder_.clear(); } + if (cellIsDisabledBuilder_ != null) { + cellIsDisabledBuilder_.clear(); + } reasonCase_ = 0; reason_ = null; return this; @@ -2441,6 +2507,10 @@ private void buildPartialOneofs(io.gitpod.publicapi.v1.Error.FailedPreconditionD imageBuildLogsNotYetAvailableBuilder_ != null) { result.reason_ = imageBuildLogsNotYetAvailableBuilder_.build(); } + if (reasonCase_ == 8 && + cellIsDisabledBuilder_ != null) { + result.reason_ = cellIsDisabledBuilder_.build(); + } } @java.lang.Override @@ -2484,6 +2554,10 @@ public Builder mergeFrom(io.gitpod.publicapi.v1.Error.FailedPreconditionDetails mergeImageBuildLogsNotYetAvailable(other.getImageBuildLogsNotYetAvailable()); break; } + case CELL_IS_DISABLED: { + mergeCellIsDisabled(other.getCellIsDisabled()); + break; + } case REASON_NOT_SET: { break; } @@ -2563,6 +2637,13 @@ public Builder mergeFrom( reasonCase_ = 7; break; } // case 58 + case 66: { + input.readMessage( + getCellIsDisabledFieldBuilder().getBuilder(), + extensionRegistry); + reasonCase_ = 8; + break; + } // case 66 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -3589,6 +3670,148 @@ public io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableErrorOrBuilder return imageBuildLogsNotYetAvailableBuilder_; } + private com.google.protobuf.SingleFieldBuilder< + io.gitpod.publicapi.v1.Error.CellDisabledError, io.gitpod.publicapi.v1.Error.CellDisabledError.Builder, io.gitpod.publicapi.v1.Error.CellDisabledErrorOrBuilder> cellIsDisabledBuilder_; + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + * @return Whether the cellIsDisabled field is set. + */ + @java.lang.Override + public boolean hasCellIsDisabled() { + return reasonCase_ == 8; + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + * @return The cellIsDisabled. + */ + @java.lang.Override + public io.gitpod.publicapi.v1.Error.CellDisabledError getCellIsDisabled() { + if (cellIsDisabledBuilder_ == null) { + if (reasonCase_ == 8) { + return (io.gitpod.publicapi.v1.Error.CellDisabledError) reason_; + } + return io.gitpod.publicapi.v1.Error.CellDisabledError.getDefaultInstance(); + } else { + if (reasonCase_ == 8) { + return cellIsDisabledBuilder_.getMessage(); + } + return io.gitpod.publicapi.v1.Error.CellDisabledError.getDefaultInstance(); + } + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + */ + public Builder setCellIsDisabled(io.gitpod.publicapi.v1.Error.CellDisabledError value) { + if (cellIsDisabledBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + onChanged(); + } else { + cellIsDisabledBuilder_.setMessage(value); + } + reasonCase_ = 8; + return this; + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + */ + public Builder setCellIsDisabled( + io.gitpod.publicapi.v1.Error.CellDisabledError.Builder builderForValue) { + if (cellIsDisabledBuilder_ == null) { + reason_ = builderForValue.build(); + onChanged(); + } else { + cellIsDisabledBuilder_.setMessage(builderForValue.build()); + } + reasonCase_ = 8; + return this; + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + */ + public Builder mergeCellIsDisabled(io.gitpod.publicapi.v1.Error.CellDisabledError value) { + if (cellIsDisabledBuilder_ == null) { + if (reasonCase_ == 8 && + reason_ != io.gitpod.publicapi.v1.Error.CellDisabledError.getDefaultInstance()) { + reason_ = io.gitpod.publicapi.v1.Error.CellDisabledError.newBuilder((io.gitpod.publicapi.v1.Error.CellDisabledError) reason_) + .mergeFrom(value).buildPartial(); + } else { + reason_ = value; + } + onChanged(); + } else { + if (reasonCase_ == 8) { + cellIsDisabledBuilder_.mergeFrom(value); + } else { + cellIsDisabledBuilder_.setMessage(value); + } + } + reasonCase_ = 8; + return this; + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + */ + public Builder clearCellIsDisabled() { + if (cellIsDisabledBuilder_ == null) { + if (reasonCase_ == 8) { + reasonCase_ = 0; + reason_ = null; + onChanged(); + } + } else { + if (reasonCase_ == 8) { + reasonCase_ = 0; + reason_ = null; + } + cellIsDisabledBuilder_.clear(); + } + return this; + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + */ + public io.gitpod.publicapi.v1.Error.CellDisabledError.Builder getCellIsDisabledBuilder() { + return getCellIsDisabledFieldBuilder().getBuilder(); + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + */ + @java.lang.Override + public io.gitpod.publicapi.v1.Error.CellDisabledErrorOrBuilder getCellIsDisabledOrBuilder() { + if ((reasonCase_ == 8) && (cellIsDisabledBuilder_ != null)) { + return cellIsDisabledBuilder_.getMessageOrBuilder(); + } else { + if (reasonCase_ == 8) { + return (io.gitpod.publicapi.v1.Error.CellDisabledError) reason_; + } + return io.gitpod.publicapi.v1.Error.CellDisabledError.getDefaultInstance(); + } + } + /** + * .gitpod.v1.CellDisabledError cell_is_disabled = 8 [json_name = "cellIsDisabled"]; + */ + private com.google.protobuf.SingleFieldBuilder< + io.gitpod.publicapi.v1.Error.CellDisabledError, io.gitpod.publicapi.v1.Error.CellDisabledError.Builder, io.gitpod.publicapi.v1.Error.CellDisabledErrorOrBuilder> + getCellIsDisabledFieldBuilder() { + if (cellIsDisabledBuilder_ == null) { + if (!(reasonCase_ == 8)) { + reason_ = io.gitpod.publicapi.v1.Error.CellDisabledError.getDefaultInstance(); + } + cellIsDisabledBuilder_ = new com.google.protobuf.SingleFieldBuilder< + io.gitpod.publicapi.v1.Error.CellDisabledError, io.gitpod.publicapi.v1.Error.CellDisabledError.Builder, io.gitpod.publicapi.v1.Error.CellDisabledErrorOrBuilder>( + (io.gitpod.publicapi.v1.Error.CellDisabledError) reason_, + getParentForChildren(), + isClean()); + reason_ = null; + } + reasonCase_ = 8; + onChanged(); + return cellIsDisabledBuilder_; + } + // @@protoc_insertion_point(builder_scope:gitpod.v1.FailedPreconditionDetails) } @@ -8346,6 +8569,361 @@ public io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableError getDefaul } + public interface CellDisabledErrorOrBuilder extends + // @@protoc_insertion_point(interface_extends:gitpod.v1.CellDisabledError) + com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code gitpod.v1.CellDisabledError} + */ + public static final class CellDisabledError extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:gitpod.v1.CellDisabledError) + CellDisabledErrorOrBuilder { + private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 27, + /* patch= */ 2, + /* suffix= */ "", + CellDisabledError.class.getName()); + } + // Use CellDisabledError.newBuilder() to construct. + private CellDisabledError(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private CellDisabledError() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.gitpod.publicapi.v1.Error.internal_static_gitpod_v1_CellDisabledError_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.gitpod.publicapi.v1.Error.internal_static_gitpod_v1_CellDisabledError_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.gitpod.publicapi.v1.Error.CellDisabledError.class, io.gitpod.publicapi.v1.Error.CellDisabledError.Builder.class); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.gitpod.publicapi.v1.Error.CellDisabledError)) { + return super.equals(obj); + } + io.gitpod.publicapi.v1.Error.CellDisabledError other = (io.gitpod.publicapi.v1.Error.CellDisabledError) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static io.gitpod.publicapi.v1.Error.CellDisabledError parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.gitpod.publicapi.v1.Error.CellDisabledError prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code gitpod.v1.CellDisabledError} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:gitpod.v1.CellDisabledError) + io.gitpod.publicapi.v1.Error.CellDisabledErrorOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.gitpod.publicapi.v1.Error.internal_static_gitpod_v1_CellDisabledError_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.gitpod.publicapi.v1.Error.internal_static_gitpod_v1_CellDisabledError_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.gitpod.publicapi.v1.Error.CellDisabledError.class, io.gitpod.publicapi.v1.Error.CellDisabledError.Builder.class); + } + + // Construct using io.gitpod.publicapi.v1.Error.CellDisabledError.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.gitpod.publicapi.v1.Error.internal_static_gitpod_v1_CellDisabledError_descriptor; + } + + @java.lang.Override + public io.gitpod.publicapi.v1.Error.CellDisabledError getDefaultInstanceForType() { + return io.gitpod.publicapi.v1.Error.CellDisabledError.getDefaultInstance(); + } + + @java.lang.Override + public io.gitpod.publicapi.v1.Error.CellDisabledError build() { + io.gitpod.publicapi.v1.Error.CellDisabledError result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.gitpod.publicapi.v1.Error.CellDisabledError buildPartial() { + io.gitpod.publicapi.v1.Error.CellDisabledError result = new io.gitpod.publicapi.v1.Error.CellDisabledError(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.gitpod.publicapi.v1.Error.CellDisabledError) { + return mergeFrom((io.gitpod.publicapi.v1.Error.CellDisabledError)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.gitpod.publicapi.v1.Error.CellDisabledError other) { + if (other == io.gitpod.publicapi.v1.Error.CellDisabledError.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:gitpod.v1.CellDisabledError) + } + + // @@protoc_insertion_point(class_scope:gitpod.v1.CellDisabledError) + private static final io.gitpod.publicapi.v1.Error.CellDisabledError DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.gitpod.publicapi.v1.Error.CellDisabledError(); + } + + public static io.gitpod.publicapi.v1.Error.CellDisabledError getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CellDisabledError parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.gitpod.publicapi.v1.Error.CellDisabledError getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + private static final com.google.protobuf.Descriptors.Descriptor internal_static_gitpod_v1_PermissionDeniedDetails_descriptor; private static final @@ -8401,6 +8979,11 @@ public io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableError getDefaul private static final com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_gitpod_v1_ImageBuildLogsNotYetAvailableError_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_gitpod_v1_CellDisabledError_descriptor; + private static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_gitpod_v1_CellDisabledError_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -8417,7 +9000,7 @@ public io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableError getDefaul "ed\022R\n\022needs_verification\030\002 \001(\0132!.gitpod." + "v1.NeedsVerificationErrorH\000R\021needsVerifi" + "cationB\010\n\006reason\"\022\n\020UserBlockedError\"\030\n\026" + - "NeedsVerificationError\"\342\005\n\031FailedPrecond" + + "NeedsVerificationError\"\254\006\n\031FailedPrecond" + "itionDetails\022r\n\036payment_spending_limit_r" + "eached\030\001 \001(\0132+.gitpod.v1.PaymentSpending" + "LimitReachedErrorH\000R\033paymentSpendingLimi" + @@ -8435,28 +9018,30 @@ public io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableError getDefaul "rorH\000R\026repositoryUnauthorized\022z\n\"image_b" + "uild_logs_not_yet_available\030\007 \001(\0132-.gitp" + "od.v1.ImageBuildLogsNotYetAvailableError" + - "H\000R\035imageBuildLogsNotYetAvailableB\010\n\006rea" + - "son\"\"\n PaymentSpendingLimitReachedError\"" + - "?\n\026InvalidCostCenterError\022%\n\016attribution" + - "_id\030\001 \001(\tR\rattributionId\"\037\n\035TooManyRunni" + - "ngWorkspacesError\"7\n\025InvalidGitpodYMLErr" + - "or\022\036\n\nviolations\030\001 \003(\tR\nviolations\"\353\001\n\027R" + - "epositoryNotFoundError\022\022\n\004host\030\001 \001(\tR\004ho" + - "st\022\024\n\005owner\030\002 \001(\tR\005owner\022\"\n\ruser_is_owne" + - "r\030\003 \001(\010R\013userIsOwner\022\037\n\013user_scopes\030\004 \003(" + - "\tR\nuserScopes\022\037\n\013last_update\030\005 \001(\tR\nlast" + - "Update\022\033\n\trepo_name\030\006 \001(\tR\010repoName\022#\n\re" + - "rror_message\030\007 \001(\tR\014errorMessage\"\374\001\n\033Rep" + - "ositoryUnauthorizedError\022\022\n\004host\030\001 \001(\tR\004" + - "host\022\'\n\017required_scopes\030\002 \003(\tR\016requiredS" + - "copes\022#\n\rprovider_type\030\003 \001(\tR\014providerTy" + - "pe\022\033\n\trepo_name\030\004 \001(\tR\010repoName\0222\n\025provi" + - "der_is_connected\030\005 \001(\010R\023providerIsConnec" + - "ted\022*\n\021is_missing_scopes\030\006 \001(\010R\017isMissin" + - "gScopes\"$\n\"ImageBuildLogsNotYetAvailable" + - "ErrorBQ\n\026io.gitpod.publicapi.v1Z7github." + - "com/gitpod-io/gitpod/components/public-a" + - "pi/go/v1b\006proto3" + "H\000R\035imageBuildLogsNotYetAvailable\022H\n\020cel" + + "l_is_disabled\030\010 \001(\0132\034.gitpod.v1.CellDisa" + + "bledErrorH\000R\016cellIsDisabledB\010\n\006reason\"\"\n" + + " PaymentSpendingLimitReachedError\"?\n\026Inv" + + "alidCostCenterError\022%\n\016attribution_id\030\001 " + + "\001(\tR\rattributionId\"\037\n\035TooManyRunningWork" + + "spacesError\"7\n\025InvalidGitpodYMLError\022\036\n\n" + + "violations\030\001 \003(\tR\nviolations\"\353\001\n\027Reposit" + + "oryNotFoundError\022\022\n\004host\030\001 \001(\tR\004host\022\024\n\005" + + "owner\030\002 \001(\tR\005owner\022\"\n\ruser_is_owner\030\003 \001(" + + "\010R\013userIsOwner\022\037\n\013user_scopes\030\004 \003(\tR\nuse" + + "rScopes\022\037\n\013last_update\030\005 \001(\tR\nlastUpdate" + + "\022\033\n\trepo_name\030\006 \001(\tR\010repoName\022#\n\rerror_m" + + "essage\030\007 \001(\tR\014errorMessage\"\374\001\n\033Repositor" + + "yUnauthorizedError\022\022\n\004host\030\001 \001(\tR\004host\022\'" + + "\n\017required_scopes\030\002 \003(\tR\016requiredScopes\022" + + "#\n\rprovider_type\030\003 \001(\tR\014providerType\022\033\n\t" + + "repo_name\030\004 \001(\tR\010repoName\0222\n\025provider_is" + + "_connected\030\005 \001(\010R\023providerIsConnected\022*\n" + + "\021is_missing_scopes\030\006 \001(\010R\017isMissingScope" + + "s\"$\n\"ImageBuildLogsNotYetAvailableError\"" + + "\023\n\021CellDisabledErrorBQ\n\026io.gitpod.public" + + "api.v1Z7github.com/gitpod-io/gitpod/comp" + + "onents/public-api/go/v1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -8486,7 +9071,7 @@ public io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableError getDefaul internal_static_gitpod_v1_FailedPreconditionDetails_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_gitpod_v1_FailedPreconditionDetails_descriptor, - new java.lang.String[] { "PaymentSpendingLimitReached", "InvalidCostCenter", "TooManyRunningWorkspaces", "InvalidGitpodYml", "RepositoryNotFound", "RepositoryUnauthorized", "ImageBuildLogsNotYetAvailable", "Reason", }); + new java.lang.String[] { "PaymentSpendingLimitReached", "InvalidCostCenter", "TooManyRunningWorkspaces", "InvalidGitpodYml", "RepositoryNotFound", "RepositoryUnauthorized", "ImageBuildLogsNotYetAvailable", "CellIsDisabled", "Reason", }); internal_static_gitpod_v1_PaymentSpendingLimitReachedError_descriptor = getDescriptor().getMessageTypes().get(4); internal_static_gitpod_v1_PaymentSpendingLimitReachedError_fieldAccessorTable = new @@ -8529,6 +9114,12 @@ public io.gitpod.publicapi.v1.Error.ImageBuildLogsNotYetAvailableError getDefaul com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_gitpod_v1_ImageBuildLogsNotYetAvailableError_descriptor, new java.lang.String[] { }); + internal_static_gitpod_v1_CellDisabledError_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_gitpod_v1_CellDisabledError_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_gitpod_v1_CellDisabledError_descriptor, + new java.lang.String[] { }); descriptor.resolveAllFeaturesImmutable(); com.google.protobuf.DescriptorProtos.getDescriptor(); } diff --git a/components/public-api/typescript-common/src/public-api-converter.ts b/components/public-api/typescript-common/src/public-api-converter.ts index 918f3534e7e915..aac5ae1ac8c09b 100644 --- a/components/public-api/typescript-common/src/public-api-converter.ts +++ b/components/public-api/typescript-common/src/public-api-converter.ts @@ -87,6 +87,7 @@ import { UserEnvironmentVariable, } from "@gitpod/public-api/lib/gitpod/v1/envvar_pb"; import { + CellDisabledError, FailedPreconditionDetails, ImageBuildLogsNotYetAvailableError, InvalidCostCenterError as InvalidCostCenterErrorData, @@ -649,6 +650,22 @@ export class PublicAPIConverter { if (reason.code === ErrorCodes.INTERNAL_SERVER_ERROR) { return new ConnectError(reason.message, Code.Internal, undefined, undefined, reason); } + if (reason.code === ErrorCodes.CELL_EXPIRED) { + return new ConnectError( + reason.message, + Code.FailedPrecondition, + undefined, + [ + new FailedPreconditionDetails({ + reason: { + case: "cellIsDisabled", + value: new CellDisabledError(), + }, + }), + ], + reason, + ); + } return new ConnectError(reason.message, Code.Unknown, undefined, undefined, reason); } return new ConnectError(`Oops! Something went wrong.`, Code.Internal, undefined, undefined, reason); @@ -703,6 +720,8 @@ export class PublicAPIConverter { return new ApplicationError(ErrorCodes.HEADLESS_LOG_NOT_YET_AVAILABLE, reason.rawMessage); case "tooManyRunningWorkspaces": return new ApplicationError(ErrorCodes.TOO_MANY_RUNNING_WORKSPACES, reason.rawMessage); + case "cellIsDisabled": + return new ApplicationError(ErrorCodes.CELL_EXPIRED, reason.rawMessage); } return new ApplicationError(ErrorCodes.PRECONDITION_FAILED, reason.rawMessage); } diff --git a/components/public-api/typescript/src/gitpod/v1/error_pb.ts b/components/public-api/typescript/src/gitpod/v1/error_pb.ts index ecc13c35770aeb..360a74ea653573 100644 --- a/components/public-api/typescript/src/gitpod/v1/error_pb.ts +++ b/components/public-api/typescript/src/gitpod/v1/error_pb.ts @@ -177,6 +177,12 @@ export class FailedPreconditionDetails extends Message) { @@ -194,6 +200,7 @@ export class FailedPreconditionDetails extends Message): FailedPreconditionDetails { @@ -519,3 +526,34 @@ export class ImageBuildLogsNotYetAvailableError extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "gitpod.v1.CellDisabledError"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CellDisabledError { + return new CellDisabledError().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CellDisabledError { + return new CellDisabledError().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CellDisabledError { + return new CellDisabledError().fromJsonString(jsonString, options); + } + + static equals(a: CellDisabledError | PlainMessage | undefined, b: CellDisabledError | PlainMessage | undefined): boolean { + return proto3.util.equals(CellDisabledError, a, b); + } +} diff --git a/components/server/src/api/server.ts b/components/server/src/api/server.ts index 11d2d3dac18414..43bd74d327d1e0 100644 --- a/components/server/src/api/server.ts +++ b/components/server/src/api/server.ts @@ -65,6 +65,7 @@ import { TokenServiceAPI } from "./token-service-api"; import { TokenService } from "@gitpod/public-api/lib/gitpod/v1/token_connect"; import { AuditLogService } from "../audit/AuditLogService"; import { AuditLogServiceAPI } from "./audit-log-service-api"; +import { getExperimentsClientForBackend } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server"; decorate(injectable(), PublicAPIConverter); @@ -284,7 +285,7 @@ export class API { await rateLimit(subjectId.toString()); await self.ensureFgaMigration(subjectId); } - // TODO(at) if unauthenticated, we still need to apply enforece a rate limit + // TODO(at) if unauthenticated, we still need to apply enforce a rate limit return subjectId; }; @@ -294,6 +295,22 @@ export class API { }; if (grpc_type === "unary" || grpc_type === "client_stream") { return withRequestContext(async () => { + const isCellDisabled = await getExperimentsClientForBackend().getValueAsync( + "cell_disabled", + false, + {}, + ); + if ( + isCellDisabled && + requestContext.requestMethod === "gitpod.v1.UserService/getAuthenticatedUser" + ) { + const error = self.apiConverter.toError( + new ApplicationError(ErrorCodes.CELL_EXPIRED, "Cell is disabled"), + ); + done(error); + throw error; + } + let subjectId: SubjectId | undefined = undefined; try { subjectId = await auth(); diff --git a/components/server/src/workspace/gitpod-server-impl.ts b/components/server/src/workspace/gitpod-server-impl.ts index 67321f5c51733e..c2a248b483d25b 100644 --- a/components/server/src/workspace/gitpod-server-impl.ts +++ b/components/server/src/workspace/gitpod-server-impl.ts @@ -382,6 +382,11 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable { } private async checkUser(methodName?: string, logPayload?: {}, ctx?: LogContext): Promise { + const cellDisabled = await getExperimentsClientForBackend().getValueAsync("cell_disabled", false, {}); + if (cellDisabled) { + throw new ApplicationError(ErrorCodes.CELL_EXPIRED, "Cell is disabled"); + } + // Generally, a user session is required. const userId = this.userID; if (!userId) {