Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(proto): cel service (#6221)

p0ny4c7b33a18bd6
diff --git a/frontend/src/types/proto/v1/cel_service.ts b/frontend/src/types/proto/v1/cel_service.ts
new file mode 100644
index 0000000000..57908077de
--- /dev/null
+++ b/frontend/src/types/proto/v1/cel_service.ts
@@ -0,0 +1,331 @@
+/* eslint-disable */
+import type { CallContext, CallOptions } from "nice-grpc-common";
+import * as _m0 from "protobufjs/minimal";
+import { ParsedExpr } from "../google/api/expr/v1alpha1/syntax";
+
+export const protobufPackage = "bytebase.v1";
+
+export interface ParseRequest {
+ expression: string;
+}
+
+export interface ParseResponse {
+ expression?: ParsedExpr;
+}
+
+export interface DeparseRequest {
+ expression?: ParsedExpr;
+}
+
+export interface DeparseResponse {
+ expression: string;
+}
+
+function createBaseParseRequest(): ParseRequest {
+ return { expression: "" };
+}
+
+export const ParseRequest = {
+ encode(message: ParseRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.expression !== "") {
+ writer.uint32(10).string(message.expression);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ParseRequest {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseParseRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 10) {
+ break;
+ }
+
+ message.expression = reader.string();
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): ParseRequest {
+ return { expression: isSet(object.expression) ? String(object.expression) : "" };
+ },
+
+ toJSON(message: ParseRequest): unknown {
+ const obj: any = {};
+ message.expression !== undefined && (obj.expression = message.expression);
+ return obj;
+ },
+
+ create(base?: DeepPartial<ParseRequest>): ParseRequest {
+ return ParseRequest.fromPartial(base ?? {});
+ },
+
+ fromPartial(object: DeepPartial<ParseRequest>): ParseRequest {
+ const message = createBaseParseRequest();
+ message.expression = object.expression ?? "";
+ return message;
+ },
+};
+
+function createBaseParseResponse(): ParseResponse {
+ return { expression: undefined };
+}
+
+export const ParseResponse = {
+ encode(message: ParseResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.expression !== undefined) {
+ ParsedExpr.encode(message.expression, writer.uint32(10).fork()).ldelim();
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ParseResponse {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseParseResponse();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 10) {
+ break;
+ }
+
+ message.expression = ParsedExpr.decode(reader, reader.uint32());
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): ParseResponse {
+ return { expression: isSet(object.expression) ? ParsedExpr.fromJSON(object.expression) : undefined };
+ },
+
+ toJSON(message: ParseResponse): unknown {
+ const obj: any = {};
+ message.expression !== undefined &&
+ (obj.expression = message.expression ? ParsedExpr.toJSON(message.expression) : undefined);
+ return obj;
+ },
+
+ create(base?: DeepPartial<ParseResponse>): ParseResponse {
+ return ParseResponse.fromPartial(base ?? {});
+ },
+
+ fromPartial(object: DeepPartial<ParseResponse>): ParseResponse {
+ const message = createBaseParseResponse();
+ message.expression = (object.expression !== undefined && object.expression !== null)
+ ? ParsedExpr.fromPartial(object.expression)
+ : undefined;
+ return message;
+ },
+};
+
+function createBaseDeparseRequest(): DeparseRequest {
+ return { expression: undefined };
+}
+
+export const DeparseRequest = {
+ encode(message: DeparseRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.expression !== undefined) {
+ ParsedExpr.encode(message.expression, writer.uint32(10).fork()).ldelim();
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): DeparseRequest {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseDeparseRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 10) {
+ break;
+ }
+
+ message.expression = ParsedExpr.decode(reader, reader.uint32());
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): DeparseRequest {
+ return { expression: isSet(object.expression) ? ParsedExpr.fromJSON(object.expression) : undefined };
+ },
+
+ toJSON(message: DeparseRequest): unknown {
+ const obj: any = {};
+ message.expression !== undefined &&
+ (obj.expression = message.expression ? ParsedExpr.toJSON(message.expression) : undefined);
+ return obj;
+ },
+
+ create(base?: DeepPartial<DeparseRequest>): DeparseRequest {
+ return DeparseRequest.fromPartial(base ?? {});
+ },
+
+ fromPartial(object: DeepPartial<DeparseRequest>): DeparseRequest {
+ const message = createBaseDeparseRequest();
+ message.expression = (object.expression !== undefined && object.expression !== null)
+ ? ParsedExpr.fromPartial(object.expression)
+ : undefined;
+ return message;
+ },
+};
+
+function createBaseDeparseResponse(): DeparseResponse {
+ return { expression: "" };
+}
+
+export const DeparseResponse = {
+ encode(message: DeparseResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.expression !== "") {
+ writer.uint32(10).string(message.expression);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): DeparseResponse {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseDeparseResponse();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 10) {
+ break;
+ }
+
+ message.expression = reader.string();
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): DeparseResponse {
+ return { expression: isSet(object.expression) ? String(object.expression) : "" };
+ },
+
+ toJSON(message: DeparseResponse): unknown {
+ const obj: any = {};
+ message.expression !== undefined && (obj.expression = message.expression);
+ return obj;
+ },
+
+ create(base?: DeepPartial<DeparseResponse>): DeparseResponse {
+ return DeparseResponse.fromPartial(base ?? {});
+ },
+
+ fromPartial(object: DeepPartial<DeparseResponse>): DeparseResponse {
+ const message = createBaseDeparseResponse();
+ message.expression = object.expression ?? "";
+ return message;
+ },
+};
+
+export type CelServiceDefinition = typeof CelServiceDefinition;
+export const CelServiceDefinition = {
+ name: "CelService",
+ fullName: "bytebase.v1.CelService",
+ methods: {
+ parse: {
+ name: "Parse",
+ requestType: ParseRequest,
+ requestStream: false,
+ responseType: ParseResponse,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 578365826: [
+ new Uint8Array([18, 58, 1, 42, 34, 13, 47, 118, 49, 47, 99, 101, 108, 47, 112, 97, 114, 115, 101]),
+ ],
+ },
+ },
+ },
+ deparse: {
+ name: "Deparse",
+ requestType: DeparseRequest,
+ requestStream: false,
+ responseType: DeparseResponse,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 578365826: [
+ new Uint8Array([
+ 20,
+ 58,
+ 1,
+ 42,
+ 34,
+ 15,
+ 47,
+ 118,
+ 49,
+ 47,
+ 99,
+ 101,
+ 108,
+ 47,
+ 100,
+ 101,
+ 112,
+ 97,
+ 114,
+ 115,
+ 101,
+ ]),
+ ],
+ },
+ },
+ },
+ },
+} as const;
+
+export interface CelServiceImplementation<CallContextExt = {}> {
+ parse(request: ParseRequest, context: CallContext & CallContextExt): Promise<DeepPartial<ParseResponse>>;
+ deparse(request: DeparseRequest, context: CallContext & CallContextExt): Promise<DeepPartial<DeparseResponse>>;
+}
+
+export interface CelServiceClient<CallOptionsExt = {}> {
+ parse(request: DeepPartial<ParseRequest>, options?: CallOptions & CallOptionsExt): Promise<ParseResponse>;
+ deparse(request: DeepPartial<DeparseRequest>, options?: CallOptions & CallOptionsExt): Promise<DeparseResponse>;
+}
+
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
+export type DeepPartial<T> = T extends Builtin ? T
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
+ : Partial<T>;
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 9eb6b3fdd5..92cdaf9cd3 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -60,6 +60,14 @@
- [BookmarkService](#bytebase-v1-BookmarkService)
+- [v1/cel_service.proto](#v1_cel_service-proto)
+ - [DeparseRequest](#bytebase-v1-DeparseRequest)
+ - [DeparseResponse](#bytebase-v1-DeparseResponse)
+ - [ParseRequest](#bytebase-v1-ParseRequest)
+ - [ParseResponse](#bytebase-v1-ParseResponse)
+
+ - [CelService](#bytebase-v1-CelService)
+
- [v1/database_service.proto](#v1_database_service-proto)
- [AdviseIndexRequest](#bytebase-v1-AdviseIndexRequest)
- [AdviseIndexResponse](#bytebase-v1-AdviseIndexResponse)
@@ -1195,6 +1203,93 @@ When paginating, all other parameters provided to `ListBookmarks` must match the
+<a name="v1_cel_service-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## v1/cel_service.proto
+
+
+
+<a name="bytebase-v1-DeparseRequest"></a>
+
+### DeparseRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| expression | [google.api.expr.v1alpha1.ParsedExpr](#google-api-expr-v1alpha1-ParsedExpr) | | |
+
+
+
+
+
+
+<a name="bytebase-v1-DeparseResponse"></a>
+
+### DeparseResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| expression | [string](#string) | | |
+
+
+
+
+
+
+<a name="bytebase-v1-ParseRequest"></a>
+
+### ParseRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| expression | [string](#string) | | |
+
+
+
+
+
+
+<a name="bytebase-v1-ParseResponse"></a>
+
+### ParseResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| expression | [google.api.expr.v1alpha1.ParsedExpr](#google-api-expr-v1alpha1-ParsedExpr) | | |
+
+
+
+
+
+
+
+
+
+
+
+
+<a name="bytebase-v1-CelService"></a>
+
+### CelService
+
+
+| Method Name | Request Type | Response Type | Description |
+| ----------- | ------------ | ------------- | ------------|
+| Parse | [ParseRequest](#bytebase-v1-ParseRequest) | [ParseResponse](#bytebase-v1-ParseResponse) | |
+| Deparse | [DeparseRequest](#bytebase-v1-DeparseRequest) | [DeparseResponse](#bytebase-v1-DeparseResponse) | |
+
+
+
+
+
<a name="v1_database_service-proto"></a>
<p align="right"><a href="#top">Top</a></p>
diff --git a/proto/generated-go/v1/cel_service.pb.go b/proto/generated-go/v1/cel_service.pb.go
new file mode 100644
index 0000000000..02d8897188
--- /dev/null
+++ b/proto/generated-go/v1/cel_service.pb.go
@@ -0,0 +1,363 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.30.0
+// protoc (unknown)
+// source: v1/cel_service.proto
+
+package v1
+
+import (
+ _ "google.golang.org/genproto/googleapis/api/annotations"
+ v1alpha1 "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type ParseRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Expression string `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`
+}
+
+func (x *ParseRequest) Reset() {
+ *x = ParseRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_cel_service_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ParseRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ParseRequest) ProtoMessage() {}
+
+func (x *ParseRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_cel_service_proto_msgTypes[0]
+ 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 ParseRequest.ProtoReflect.Descriptor instead.
+func (*ParseRequest) Descriptor() ([]byte, []int) {
+ return file_v1_cel_service_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *ParseRequest) GetExpression() string {
+ if x != nil {
+ return x.Expression
+ }
+ return ""
+}
+
+type ParseResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Expression *v1alpha1.ParsedExpr `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`
+}
+
+func (x *ParseResponse) Reset() {
+ *x = ParseResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_cel_service_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ParseResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ParseResponse) ProtoMessage() {}
+
+func (x *ParseResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_cel_service_proto_msgTypes[1]
+ 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 ParseResponse.ProtoReflect.Descriptor instead.
+func (*ParseResponse) Descriptor() ([]byte, []int) {
+ return file_v1_cel_service_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *ParseResponse) GetExpression() *v1alpha1.ParsedExpr {
+ if x != nil {
+ return x.Expression
+ }
+ return nil
+}
+
+type DeparseRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Expression *v1alpha1.ParsedExpr `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`
+}
+
+func (x *DeparseRequest) Reset() {
+ *x = DeparseRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_cel_service_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeparseRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeparseRequest) ProtoMessage() {}
+
+func (x *DeparseRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_cel_service_proto_msgTypes[2]
+ 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 DeparseRequest.ProtoReflect.Descriptor instead.
+func (*DeparseRequest) Descriptor() ([]byte, []int) {
+ return file_v1_cel_service_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *DeparseRequest) GetExpression() *v1alpha1.ParsedExpr {
+ if x != nil {
+ return x.Expression
+ }
+ return nil
+}
+
+type DeparseResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Expression string `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`
+}
+
+func (x *DeparseResponse) Reset() {
+ *x = DeparseResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_cel_service_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeparseResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeparseResponse) ProtoMessage() {}
+
+func (x *DeparseResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_cel_service_proto_msgTypes[3]
+ 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 DeparseResponse.ProtoReflect.Descriptor instead.
+func (*DeparseResponse) Descriptor() ([]byte, []int) {
+ return file_v1_cel_service_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *DeparseResponse) GetExpression() string {
+ if x != nil {
+ return x.Expression
+ }
+ return ""
+}
+
+var File_v1_cel_service_proto protoreflect.FileDescriptor
+
+var file_v1_cel_service_proto_rawDesc = []byte{
+ 0x0a, 0x14, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
+ 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f,
+ 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x1a, 0x25, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x78,
+ 0x70, 0x72, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x73, 0x79, 0x6e, 0x74,
+ 0x61, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2e, 0x0a, 0x0c, 0x50, 0x61, 0x72, 0x73,
+ 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72,
+ 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78,
+ 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x55, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x73,
+ 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x65, 0x78, 0x70,
+ 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e,
+ 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45,
+ 0x78, 0x70, 0x72, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22,
+ 0x56, 0x0a, 0x0e, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x12, 0x44, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61,
+ 0x70, 0x69, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31,
+ 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0a, 0x65, 0x78, 0x70,
+ 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x0f, 0x44, 0x65, 0x70, 0x61, 0x72,
+ 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78,
+ 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
+ 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0xc8, 0x01, 0x0a, 0x0a, 0x43,
+ 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x50, 0x61, 0x72,
+ 0x73, 0x65, 0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
+ 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x73,
+ 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02,
+ 0x12, 0x3a, 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x70, 0x61,
+ 0x72, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x07, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x12, 0x1b,
+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70,
+ 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x62, 0x79,
+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73,
+ 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02,
+ 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x64, 0x65,
+ 0x70, 0x61, 0x72, 0x73, 0x65, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
+ 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_v1_cel_service_proto_rawDescOnce sync.Once
+ file_v1_cel_service_proto_rawDescData = file_v1_cel_service_proto_rawDesc
+)
+
+func file_v1_cel_service_proto_rawDescGZIP() []byte {
+ file_v1_cel_service_proto_rawDescOnce.Do(func() {
+ file_v1_cel_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_cel_service_proto_rawDescData)
+ })
+ return file_v1_cel_service_proto_rawDescData
+}
+
+var file_v1_cel_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
+var file_v1_cel_service_proto_goTypes = []interface{}{
+ (*ParseRequest)(nil), // 0: bytebase.v1.ParseRequest
+ (*ParseResponse)(nil), // 1: bytebase.v1.ParseResponse
+ (*DeparseRequest)(nil), // 2: bytebase.v1.DeparseRequest
+ (*DeparseResponse)(nil), // 3: bytebase.v1.DeparseResponse
+ (*v1alpha1.ParsedExpr)(nil), // 4: google.api.expr.v1alpha1.ParsedExpr
+}
+var file_v1_cel_service_proto_depIdxs = []int32{
+ 4, // 0: bytebase.v1.ParseResponse.expression:type_name -> google.api.expr.v1alpha1.ParsedExpr
+ 4, // 1: bytebase.v1.DeparseRequest.expression:type_name -> google.api.expr.v1alpha1.ParsedExpr
+ 0, // 2: bytebase.v1.CelService.Parse:input_type -> bytebase.v1.ParseRequest
+ 2, // 3: bytebase.v1.CelService.Deparse:input_type -> bytebase.v1.DeparseRequest
+ 1, // 4: bytebase.v1.CelService.Parse:output_type -> bytebase.v1.ParseResponse
+ 3, // 5: bytebase.v1.CelService.Deparse:output_type -> bytebase.v1.DeparseResponse
+ 4, // [4:6] is the sub-list for method output_type
+ 2, // [2:4] is the sub-list for method input_type
+ 2, // [2:2] is the sub-list for extension type_name
+ 2, // [2:2] is the sub-list for extension extendee
+ 0, // [0:2] is the sub-list for field type_name
+}
+
+func init() { file_v1_cel_service_proto_init() }
+func file_v1_cel_service_proto_init() {
+ if File_v1_cel_service_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_v1_cel_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ParseRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_cel_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ParseResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_cel_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeparseRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_cel_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeparseResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_v1_cel_service_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 4,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_v1_cel_service_proto_goTypes,
+ DependencyIndexes: file_v1_cel_service_proto_depIdxs,
+ MessageInfos: file_v1_cel_service_proto_msgTypes,
+ }.Build()
+ File_v1_cel_service_proto = out.File
+ file_v1_cel_service_proto_rawDesc = nil
+ file_v1_cel_service_proto_goTypes = nil
+ file_v1_cel_service_proto_depIdxs = nil
+}
diff --git a/proto/generated-go/v1/cel_service.pb.gw.go b/proto/generated-go/v1/cel_service.pb.gw.go
new file mode 100644
index 0000000000..5a4ef6b948
--- /dev/null
+++ b/proto/generated-go/v1/cel_service.pb.gw.go
@@ -0,0 +1,256 @@
+// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
+// source: v1/cel_service.proto
+
+/*
+Package v1 is a reverse proxy.
+
+It translates gRPC into RESTful JSON APIs.
+*/
+package v1
+
+import (
+ "context"
+ "io"
+ "net/http"
+
+ "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
+ "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/grpclog"
+ "google.golang.org/grpc/metadata"
+ "google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
+)
+
+// Suppress "imported and not used" errors
+var _ codes.Code
+var _ io.Reader
+var _ status.Status
+var _ = runtime.String
+var _ = utilities.NewDoubleArray
+var _ = metadata.Join
+
+func request_CelService_Parse_0(ctx context.Context, marshaler runtime.Marshaler, client CelServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq ParseRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.Parse(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_CelService_Parse_0(ctx context.Context, marshaler runtime.Marshaler, server CelServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq ParseRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.Parse(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
+func request_CelService_Deparse_0(ctx context.Context, marshaler runtime.Marshaler, client CelServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq DeparseRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.Deparse(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_CelService_Deparse_0(ctx context.Context, marshaler runtime.Marshaler, server CelServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq DeparseRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.Deparse(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
+// RegisterCelServiceHandlerServer registers the http handlers for service CelService to "mux".
+// UnaryRPC :call CelServiceServer directly.
+// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
+// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCelServiceHandlerFromEndpoint instead.
+func RegisterCelServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CelServiceServer) error {
+
+ mux.Handle("POST", pattern_CelService_Parse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.CelService/Parse", runtime.WithHTTPPathPattern("/v1/cel/parse"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_CelService_Parse_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_CelService_Parse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("POST", pattern_CelService_Deparse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.CelService/Deparse", runtime.WithHTTPPathPattern("/v1/cel/deparse"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_CelService_Deparse_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_CelService_Deparse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ return nil
+}
+
+// RegisterCelServiceHandlerFromEndpoint is same as RegisterCelServiceHandler but
+// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
+func RegisterCelServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
+ conn, err := grpc.DialContext(ctx, endpoint, opts...)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if err != nil {
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ return
+ }
+ go func() {
+ <-ctx.Done()
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ }()
+ }()
+
+ return RegisterCelServiceHandler(ctx, mux, conn)
+}
+
+// RegisterCelServiceHandler registers the http handlers for service CelService to "mux".
+// The handlers forward requests to the grpc endpoint over "conn".
+func RegisterCelServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
+ return RegisterCelServiceHandlerClient(ctx, mux, NewCelServiceClient(conn))
+}
+
+// RegisterCelServiceHandlerClient registers the http handlers for service CelService
+// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CelServiceClient".
+// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CelServiceClient"
+// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
+// "CelServiceClient" to call the correct interceptors.
+func RegisterCelServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CelServiceClient) error {
+
+ mux.Handle("POST", pattern_CelService_Parse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.CelService/Parse", runtime.WithHTTPPathPattern("/v1/cel/parse"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_CelService_Parse_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_CelService_Parse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("POST", pattern_CelService_Deparse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.CelService/Deparse", runtime.WithHTTPPathPattern("/v1/cel/deparse"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_CelService_Deparse_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_CelService_Deparse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ return nil
+}
+
+var (
+ pattern_CelService_Parse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "cel", "parse"}, ""))
+
+ pattern_CelService_Deparse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "cel", "deparse"}, ""))
+)
+
+var (
+ forward_CelService_Parse_0 = runtime.ForwardResponseMessage
+
+ forward_CelService_Deparse_0 = runtime.ForwardResponseMessage
+)
diff --git a/proto/generated-go/v1/cel_service_grpc.pb.go b/proto/generated-go/v1/cel_service_grpc.pb.go
new file mode 100644
index 0000000000..5e66657b90
--- /dev/null
+++ b/proto/generated-go/v1/cel_service_grpc.pb.go
@@ -0,0 +1,146 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc (unknown)
+// source: v1/cel_service.proto
+
+package v1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ CelService_Parse_FullMethodName = "/bytebase.v1.CelService/Parse"
+ CelService_Deparse_FullMethodName = "/bytebase.v1.CelService/Deparse"
+)
+
+// CelServiceClient is the client API for CelService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type CelServiceClient interface {
+ Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error)
+ Deparse(ctx context.Context, in *DeparseRequest, opts ...grpc.CallOption) (*DeparseResponse, error)
+}
+
+type celServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewCelServiceClient(cc grpc.ClientConnInterface) CelServiceClient {
+ return &celServiceClient{cc}
+}
+
+func (c *celServiceClient) Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error) {
+ out := new(ParseResponse)
+ err := c.cc.Invoke(ctx, CelService_Parse_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *celServiceClient) Deparse(ctx context.Context, in *DeparseRequest, opts ...grpc.CallOption) (*DeparseResponse, error) {
+ out := new(DeparseResponse)
+ err := c.cc.Invoke(ctx, CelService_Deparse_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// CelServiceServer is the server API for CelService service.
+// All implementations must embed UnimplementedCelServiceServer
+// for forward compatibility
+type CelServiceServer interface {
+ Parse(context.Context, *ParseRequest) (*ParseResponse, error)
+ Deparse(context.Context, *DeparseRequest) (*DeparseResponse, error)
+ mustEmbedUnimplementedCelServiceServer()
+}
+
+// UnimplementedCelServiceServer must be embedded to have forward compatible implementations.
+type UnimplementedCelServiceServer struct {
+}
+
+func (UnimplementedCelServiceServer) Parse(context.Context, *ParseRequest) (*ParseResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Parse not implemented")
+}
+func (UnimplementedCelServiceServer) Deparse(context.Context, *DeparseRequest) (*DeparseResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Deparse not implemented")
+}
+func (UnimplementedCelServiceServer) mustEmbedUnimplementedCelServiceServer() {}
+
+// UnsafeCelServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to CelServiceServer will
+// result in compilation errors.
+type UnsafeCelServiceServer interface {
+ mustEmbedUnimplementedCelServiceServer()
+}
+
+func RegisterCelServiceServer(s grpc.ServiceRegistrar, srv CelServiceServer) {
+ s.RegisterService(&CelService_ServiceDesc, srv)
+}
+
+func _CelService_Parse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ParseRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(CelServiceServer).Parse(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: CelService_Parse_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(CelServiceServer).Parse(ctx, req.(*ParseRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _CelService_Deparse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeparseRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(CelServiceServer).Deparse(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: CelService_Deparse_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(CelServiceServer).Deparse(ctx, req.(*DeparseRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// CelService_ServiceDesc is the grpc.ServiceDesc for CelService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var CelService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "bytebase.v1.CelService",
+ HandlerType: (*CelServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "Parse",
+ Handler: _CelService_Parse_Handler,
+ },
+ {
+ MethodName: "Deparse",
+ Handler: _CelService_Deparse_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "v1/cel_service.proto",
+}
diff --git a/proto/v1/cel_service.proto b/proto/v1/cel_service.proto
new file mode 100644
index 0000000000..fa9041cdcf
--- /dev/null
+++ b/proto/v1/cel_service.proto
@@ -0,0 +1,39 @@
+syntax = "proto3";
+
+package bytebase.v1;
+
+import "google/api/annotations.proto";
+import "google/api/expr/v1alpha1/syntax.proto";
+
+option go_package = "generated-go/v1";
+
+service CelService {
+ rpc Parse(ParseRequest) returns (ParseResponse) {
+ option (google.api.http) = {
+ post: "/v1/cel/parse"
+ body: "*"
+ };
+ }
+ rpc Deparse(DeparseRequest) returns (DeparseResponse) {
+ option (google.api.http) = {
+ post: "/v1/cel/deparse"
+ body: "*"
+ };
+ }
+}
+
+message ParseRequest {
+ string expression = 1;
+}
+
+message ParseResponse {
+ google.api.expr.v1alpha1.ParsedExpr expression = 1;
+}
+
+message DeparseRequest {
+ google.api.expr.v1alpha1.ParsedExpr expression = 1;
+}
+
+message DeparseResponse {
+ string expression = 1;
+}