Skip to content

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

chore: merge v2 into v1 API (#4076)

Danny Xudf687aeb8b05
diff --git a/frontend/src/types/proto/v1/hello_service.ts b/frontend/src/types/proto/v1/hello_service.ts
deleted file mode 100644
index 23c1f8642d..0000000000
--- a/frontend/src/types/proto/v1/hello_service.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-/* eslint-disable */
-import _m0 from "protobufjs/minimal";
-
-export const protobufPackage = "bytebase.v1";
-
-export interface HelloRequest {
- name: string;
-}
-
-export interface HelloResponse {
- answer: string;
-}
-
-function createBaseHelloRequest(): HelloRequest {
- return { name: "" };
-}
-
-export const HelloRequest = {
- encode(message: HelloRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- return writer;
- },
-
- decode(input: _m0.Reader | Uint8Array, length?: number): HelloRequest {
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseHelloRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.name = reader.string();
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- },
-
- fromJSON(object: any): HelloRequest {
- return { name: isSet(object.name) ? String(object.name) : "" };
- },
-
- toJSON(message: HelloRequest): unknown {
- const obj: any = {};
- message.name !== undefined && (obj.name = message.name);
- return obj;
- },
-
- fromPartial<I extends Exact<DeepPartial<HelloRequest>, I>>(object: I): HelloRequest {
- const message = createBaseHelloRequest();
- message.name = object.name ?? "";
- return message;
- },
-};
-
-function createBaseHelloResponse(): HelloResponse {
- return { answer: "" };
-}
-
-export const HelloResponse = {
- encode(message: HelloResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
- if (message.answer !== "") {
- writer.uint32(10).string(message.answer);
- }
- return writer;
- },
-
- decode(input: _m0.Reader | Uint8Array, length?: number): HelloResponse {
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseHelloResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1:
- message.answer = reader.string();
- break;
- default:
- reader.skipType(tag & 7);
- break;
- }
- }
- return message;
- },
-
- fromJSON(object: any): HelloResponse {
- return { answer: isSet(object.answer) ? String(object.answer) : "" };
- },
-
- toJSON(message: HelloResponse): unknown {
- const obj: any = {};
- message.answer !== undefined && (obj.answer = message.answer);
- return obj;
- },
-
- fromPartial<I extends Exact<DeepPartial<HelloResponse>, I>>(object: I): HelloResponse {
- const message = createBaseHelloResponse();
- message.answer = object.answer ?? "";
- return message;
- },
-};
-
-export interface GreeterService {
- Hello(request: HelloRequest): Promise<HelloResponse>;
-}
-
-export class GreeterServiceClientImpl implements GreeterService {
- private readonly rpc: Rpc;
- private readonly service: string;
- constructor(rpc: Rpc, opts?: { service?: string }) {
- this.service = opts?.service || "bytebase.v1.GreeterService";
- this.rpc = rpc;
- this.Hello = this.Hello.bind(this);
- }
- Hello(request: HelloRequest): Promise<HelloResponse> {
- const data = HelloRequest.encode(request).finish();
- const promise = this.rpc.request(this.service, "Hello", data);
- return promise.then((data) => HelloResponse.decode(new _m0.Reader(data)));
- }
-}
-
-interface Rpc {
- request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
-}
-
-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>;
-
-type KeysOfUnion<T> = T extends T ? keyof T : never;
-export type Exact<P, I extends P> = P extends Builtin ? P
- : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
-
-function isSet(value: any): boolean {
- return value !== null && value !== undefined;
-}
diff --git a/proto/generated-go/v1/auth_service.pb.go b/proto/generated-go/v1/auth_service.pb.go
index 40c242d56e..38daa35e76 100644
--- a/proto/generated-go/v1/auth_service.pb.go
+++ b/proto/generated-go/v1/auth_service.pb.go
@@ -142,7 +142,7 @@ var file_v1_auth_service_proto_rawDesc = []byte{
0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a,
0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67,
0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93,
- 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f,
+ 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f,
0x6c, 0x6f, 0x67, 0x69, 0x6e, 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,
}
diff --git a/proto/generated-go/v1/auth_service.pb.gw.go b/proto/generated-go/v1/auth_service.pb.gw.go
index 131a53ba53..00a1c8e621 100644
--- a/proto/generated-go/v1/auth_service.pb.gw.go
+++ b/proto/generated-go/v1/auth_service.pb.gw.go
@@ -79,7 +79,7 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AuthService/Login", runtime.WithHTTPPathPattern("/v2/auth/login"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AuthService/Login", runtime.WithHTTPPathPattern("/v1/auth/login"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -143,7 +143,7 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AuthService/Login", runtime.WithHTTPPathPattern("/v2/auth/login"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AuthService/Login", runtime.WithHTTPPathPattern("/v1/auth/login"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -163,7 +163,7 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
}
var (
- pattern_AuthService_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "auth", "login"}, ""))
+ pattern_AuthService_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "auth", "login"}, ""))
)
var (
diff --git a/proto/generated-go/v1/environment_service.pb.go b/proto/generated-go/v1/environment_service.pb.go
index 3856fb8ded..595184d4d8 100644
--- a/proto/generated-go/v1/environment_service.pb.go
+++ b/proto/generated-go/v1/environment_service.pb.go
@@ -570,7 +570,7 @@ var file_v1_environment_service_proto_rawDesc = []byte{
0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65,
0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
0x65, 0x6e, 0x74, 0x22, 0x28, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93,
- 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e,
+ 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e,
0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7c, 0x0a,
0x10, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74,
0x73, 0x12, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
@@ -578,7 +578,7 @@ var file_v1_environment_service_proto_rawDesc = []byte{
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f,
0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b,
- 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x32, 0x2f, 0x65,
+ 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x65,
0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x7e, 0x0a, 0x11, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74,
0x12, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43,
@@ -586,7 +586,7 @@ var file_v1_environment_service_proto_rawDesc = []byte{
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
0x74, 0x22, 0x28, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x0b, 0x65, 0x6e,
- 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x10, 0x2f, 0x76, 0x32, 0x2f, 0x65,
+ 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x65,
0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0xaa, 0x01, 0x0a, 0x11,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
0x74, 0x12, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
@@ -596,7 +596,7 @@ var file_v1_environment_service_proto_rawDesc = []byte{
0x6e, 0x74, 0x22, 0x54, 0xda, 0x41, 0x17, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65,
0x6e, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3,
0xe4, 0x93, 0x02, 0x34, 0x3a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
- 0x74, 0x32, 0x25, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
+ 0x74, 0x32, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
0x65, 0x6e, 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7c, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65,
0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e,
@@ -604,7 +604,7 @@ var file_v1_environment_service_proto_rawDesc = []byte{
0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x28, 0xda, 0x41,
- 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x2a, 0x19, 0x2f, 0x76, 0x32,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x2a, 0x19, 0x2f, 0x76, 0x31,
0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65,
0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x87, 0x01, 0x0a, 0x13, 0x55, 0x6e, 0x64, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x27,
@@ -613,7 +613,7 @@ var file_v1_environment_service_proto_rawDesc = []byte{
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
0x74, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x76,
- 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
+ 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 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,
diff --git a/proto/generated-go/v1/environment_service.pb.gw.go b/proto/generated-go/v1/environment_service.pb.gw.go
index 4c71017e51..0fa21f45d8 100644
--- a/proto/generated-go/v1/environment_service.pb.gw.go
+++ b/proto/generated-go/v1/environment_service.pb.gw.go
@@ -405,7 +405,7 @@ func RegisterEnvironmentServiceHandlerServer(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/GetEnvironment", runtime.WithHTTPPathPattern("/v2/{name=environments/*}"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/GetEnvironment", runtime.WithHTTPPathPattern("/v1/{name=environments/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -430,7 +430,7 @@ func RegisterEnvironmentServiceHandlerServer(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/ListEnvironments", runtime.WithHTTPPathPattern("/v2/environments"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/ListEnvironments", runtime.WithHTTPPathPattern("/v1/environments"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -455,7 +455,7 @@ func RegisterEnvironmentServiceHandlerServer(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/CreateEnvironment", runtime.WithHTTPPathPattern("/v2/environments"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/CreateEnvironment", runtime.WithHTTPPathPattern("/v1/environments"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -480,7 +480,7 @@ func RegisterEnvironmentServiceHandlerServer(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UpdateEnvironment", runtime.WithHTTPPathPattern("/v2/{environment.name=environments/*}"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UpdateEnvironment", runtime.WithHTTPPathPattern("/v1/{environment.name=environments/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -505,7 +505,7 @@ func RegisterEnvironmentServiceHandlerServer(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/DeleteEnvironment", runtime.WithHTTPPathPattern("/v2/{name=environments/*}"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/DeleteEnvironment", runtime.WithHTTPPathPattern("/v1/{name=environments/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -530,7 +530,7 @@ func RegisterEnvironmentServiceHandlerServer(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UndeleteEnvironment", runtime.WithHTTPPathPattern("/v2/{name=environments/*}:undelete"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UndeleteEnvironment", runtime.WithHTTPPathPattern("/v1/{name=environments/*}:undelete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -594,7 +594,7 @@ func RegisterEnvironmentServiceHandlerClient(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/GetEnvironment", runtime.WithHTTPPathPattern("/v2/{name=environments/*}"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/GetEnvironment", runtime.WithHTTPPathPattern("/v1/{name=environments/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -616,7 +616,7 @@ func RegisterEnvironmentServiceHandlerClient(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/ListEnvironments", runtime.WithHTTPPathPattern("/v2/environments"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/ListEnvironments", runtime.WithHTTPPathPattern("/v1/environments"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -638,7 +638,7 @@ func RegisterEnvironmentServiceHandlerClient(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/CreateEnvironment", runtime.WithHTTPPathPattern("/v2/environments"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/CreateEnvironment", runtime.WithHTTPPathPattern("/v1/environments"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -660,7 +660,7 @@ func RegisterEnvironmentServiceHandlerClient(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UpdateEnvironment", runtime.WithHTTPPathPattern("/v2/{environment.name=environments/*}"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UpdateEnvironment", runtime.WithHTTPPathPattern("/v1/{environment.name=environments/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -682,7 +682,7 @@ func RegisterEnvironmentServiceHandlerClient(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/DeleteEnvironment", runtime.WithHTTPPathPattern("/v2/{name=environments/*}"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/DeleteEnvironment", runtime.WithHTTPPathPattern("/v1/{name=environments/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -704,7 +704,7 @@ func RegisterEnvironmentServiceHandlerClient(ctx context.Context, mux *runtime.S
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UndeleteEnvironment", runtime.WithHTTPPathPattern("/v2/{name=environments/*}:undelete"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UndeleteEnvironment", runtime.WithHTTPPathPattern("/v1/{name=environments/*}:undelete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -724,17 +724,17 @@ func RegisterEnvironmentServiceHandlerClient(ctx context.Context, mux *runtime.S
}
var (
- pattern_EnvironmentService_GetEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v2", "environments", "name"}, ""))
+ pattern_EnvironmentService_GetEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "environments", "name"}, ""))
- pattern_EnvironmentService_ListEnvironments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "environments"}, ""))
+ pattern_EnvironmentService_ListEnvironments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "environments"}, ""))
- pattern_EnvironmentService_CreateEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "environments"}, ""))
+ pattern_EnvironmentService_CreateEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "environments"}, ""))
- pattern_EnvironmentService_UpdateEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v2", "environments", "environment.name"}, ""))
+ pattern_EnvironmentService_UpdateEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "environments", "environment.name"}, ""))
- pattern_EnvironmentService_DeleteEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v2", "environments", "name"}, ""))
+ pattern_EnvironmentService_DeleteEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "environments", "name"}, ""))
- pattern_EnvironmentService_UndeleteEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v2", "environments", "name"}, "undelete"))
+ pattern_EnvironmentService_UndeleteEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "environments", "name"}, "undelete"))
)
var (
diff --git a/proto/generated-go/v1/hello_service.pb.go b/proto/generated-go/v1/hello_service.pb.go
deleted file mode 100644
index 705e14cf5e..0000000000
--- a/proto/generated-go/v1/hello_service.pb.go
+++ /dev/null
@@ -1,220 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.28.1
-// protoc (unknown)
-// source: v1/hello_service.proto
-
-package v1
-
-import (
- _ "google.golang.org/genproto/googleapis/api/annotations"
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- _ "google.golang.org/protobuf/types/known/wrapperspb"
- 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 HelloRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
-}
-
-func (x *HelloRequest) Reset() {
- *x = HelloRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_v1_hello_service_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *HelloRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*HelloRequest) ProtoMessage() {}
-
-func (x *HelloRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_hello_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 HelloRequest.ProtoReflect.Descriptor instead.
-func (*HelloRequest) Descriptor() ([]byte, []int) {
- return file_v1_hello_service_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *HelloRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-type HelloResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Answer string `protobuf:"bytes,1,opt,name=answer,proto3" json:"answer,omitempty"`
-}
-
-func (x *HelloResponse) Reset() {
- *x = HelloResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_v1_hello_service_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *HelloResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*HelloResponse) ProtoMessage() {}
-
-func (x *HelloResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_hello_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 HelloResponse.ProtoReflect.Descriptor instead.
-func (*HelloResponse) Descriptor() ([]byte, []int) {
- return file_v1_hello_service_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *HelloResponse) GetAnswer() string {
- if x != nil {
- return x.Answer
- }
- return ""
-}
-
-var File_v1_hello_service_proto protoreflect.FileDescriptor
-
-var file_v1_hello_service_proto_rawDesc = []byte{
- 0x0a, 0x16, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 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, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x22, 0x22, 0x0a, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x0d, 0x48, 0x65, 0x6c, 0x6c, 0x6f,
- 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6e, 0x73, 0x77,
- 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72,
- 0x32, 0x6a, 0x0a, 0x0e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69,
- 0x63, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x19, 0x2e, 0x62, 0x79,
- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x32, 0x2f,
- 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 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_hello_service_proto_rawDescOnce sync.Once
- file_v1_hello_service_proto_rawDescData = file_v1_hello_service_proto_rawDesc
-)
-
-func file_v1_hello_service_proto_rawDescGZIP() []byte {
- file_v1_hello_service_proto_rawDescOnce.Do(func() {
- file_v1_hello_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_hello_service_proto_rawDescData)
- })
- return file_v1_hello_service_proto_rawDescData
-}
-
-var file_v1_hello_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
-var file_v1_hello_service_proto_goTypes = []interface{}{
- (*HelloRequest)(nil), // 0: bytebase.v1.HelloRequest
- (*HelloResponse)(nil), // 1: bytebase.v1.HelloResponse
-}
-var file_v1_hello_service_proto_depIdxs = []int32{
- 0, // 0: bytebase.v1.GreeterService.Hello:input_type -> bytebase.v1.HelloRequest
- 1, // 1: bytebase.v1.GreeterService.Hello:output_type -> bytebase.v1.HelloResponse
- 1, // [1:2] is the sub-list for method output_type
- 0, // [0:1] is the sub-list for method input_type
- 0, // [0:0] is the sub-list for extension type_name
- 0, // [0:0] is the sub-list for extension extendee
- 0, // [0:0] is the sub-list for field type_name
-}
-
-func init() { file_v1_hello_service_proto_init() }
-func file_v1_hello_service_proto_init() {
- if File_v1_hello_service_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_v1_hello_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*HelloRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_v1_hello_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*HelloResponse); 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_hello_service_proto_rawDesc,
- NumEnums: 0,
- NumMessages: 2,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_v1_hello_service_proto_goTypes,
- DependencyIndexes: file_v1_hello_service_proto_depIdxs,
- MessageInfos: file_v1_hello_service_proto_msgTypes,
- }.Build()
- File_v1_hello_service_proto = out.File
- file_v1_hello_service_proto_rawDesc = nil
- file_v1_hello_service_proto_goTypes = nil
- file_v1_hello_service_proto_depIdxs = nil
-}
diff --git a/proto/generated-go/v1/hello_service.pb.gw.go b/proto/generated-go/v1/hello_service.pb.gw.go
deleted file mode 100644
index 194abac845..0000000000
--- a/proto/generated-go/v1/hello_service.pb.gw.go
+++ /dev/null
@@ -1,189 +0,0 @@
-// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
-// source: v1/hello_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_GreeterService_Hello_0(ctx context.Context, marshaler runtime.Marshaler, client GreeterServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq HelloRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
-
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
-
- msg, err := client.Hello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-
-}
-
-func local_request_GreeterService_Hello_0(ctx context.Context, marshaler runtime.Marshaler, server GreeterServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq HelloRequest
- var metadata runtime.ServerMetadata
-
- var (
- val string
- ok bool
- err error
- _ = err
- )
-
- val, ok = pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
-
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
-
- msg, err := server.Hello(ctx, &protoReq)
- return msg, metadata, err
-
-}
-
-// RegisterGreeterServiceHandlerServer registers the http handlers for service GreeterService to "mux".
-// UnaryRPC :call GreeterServiceServer 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 RegisterGreeterServiceHandlerFromEndpoint instead.
-func RegisterGreeterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreeterServiceServer) error {
-
- mux.Handle("GET", pattern_GreeterService_Hello_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.GreeterService/Hello", runtime.WithHTTPPathPattern("/v2/hello/{name}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_GreeterService_Hello_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_GreeterService_Hello_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-// RegisterGreeterServiceHandlerFromEndpoint is same as RegisterGreeterServiceHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterGreeterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.Dial(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 RegisterGreeterServiceHandler(ctx, mux, conn)
-}
-
-// RegisterGreeterServiceHandler registers the http handlers for service GreeterService to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterGreeterServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- return RegisterGreeterServiceHandlerClient(ctx, mux, NewGreeterServiceClient(conn))
-}
-
-// RegisterGreeterServiceHandlerClient registers the http handlers for service GreeterService
-// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "GreeterServiceClient".
-// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "GreeterServiceClient"
-// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
-// "GreeterServiceClient" to call the correct interceptors.
-func RegisterGreeterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterServiceClient) error {
-
- mux.Handle("GET", pattern_GreeterService_Hello_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.GreeterService/Hello", runtime.WithHTTPPathPattern("/v2/hello/{name}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_GreeterService_Hello_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
-
- forward_GreeterService_Hello_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
-
- })
-
- return nil
-}
-
-var (
- pattern_GreeterService_Hello_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v2", "hello", "name"}, ""))
-)
-
-var (
- forward_GreeterService_Hello_0 = runtime.ForwardResponseMessage
-)
diff --git a/proto/generated-go/v1/hello_service_grpc.pb.go b/proto/generated-go/v1/hello_service_grpc.pb.go
deleted file mode 100644
index 4fa57683ac..0000000000
--- a/proto/generated-go/v1/hello_service_grpc.pb.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.2.0
-// - protoc (unknown)
-// source: v1/hello_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
-
-// GreeterServiceClient is the client API for GreeterService 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 GreeterServiceClient interface {
- Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error)
-}
-
-type greeterServiceClient struct {
- cc grpc.ClientConnInterface
-}
-
-func NewGreeterServiceClient(cc grpc.ClientConnInterface) GreeterServiceClient {
- return &greeterServiceClient{cc}
-}
-
-func (c *greeterServiceClient) Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) {
- out := new(HelloResponse)
- err := c.cc.Invoke(ctx, "/bytebase.v1.GreeterService/Hello", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// GreeterServiceServer is the server API for GreeterService service.
-// All implementations must embed UnimplementedGreeterServiceServer
-// for forward compatibility
-type GreeterServiceServer interface {
- Hello(context.Context, *HelloRequest) (*HelloResponse, error)
- mustEmbedUnimplementedGreeterServiceServer()
-}
-
-// UnimplementedGreeterServiceServer must be embedded to have forward compatible implementations.
-type UnimplementedGreeterServiceServer struct {
-}
-
-func (UnimplementedGreeterServiceServer) Hello(context.Context, *HelloRequest) (*HelloResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Hello not implemented")
-}
-func (UnimplementedGreeterServiceServer) mustEmbedUnimplementedGreeterServiceServer() {}
-
-// UnsafeGreeterServiceServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to GreeterServiceServer will
-// result in compilation errors.
-type UnsafeGreeterServiceServer interface {
- mustEmbedUnimplementedGreeterServiceServer()
-}
-
-func RegisterGreeterServiceServer(s grpc.ServiceRegistrar, srv GreeterServiceServer) {
- s.RegisterService(&GreeterService_ServiceDesc, srv)
-}
-
-func _GreeterService_Hello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(HelloRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(GreeterServiceServer).Hello(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/bytebase.v1.GreeterService/Hello",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(GreeterServiceServer).Hello(ctx, req.(*HelloRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-// GreeterService_ServiceDesc is the grpc.ServiceDesc for GreeterService service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var GreeterService_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "bytebase.v1.GreeterService",
- HandlerType: (*GreeterServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "Hello",
- Handler: _GreeterService_Hello_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "v1/hello_service.proto",
-}
diff --git a/proto/generated-go/v1/instance_service.pb.go b/proto/generated-go/v1/instance_service.pb.go
index bb3a244824..34afd14416 100644
--- a/proto/generated-go/v1/instance_service.pb.go
+++ b/proto/generated-go/v1/instance_service.pb.go
@@ -882,7 +882,7 @@ var file_v1_instance_service_proto_rawDesc = []byte{
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x34,
0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f,
- 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
+ 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x8e, 0x01, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
@@ -891,7 +891,7 @@ var file_v1_instance_service_proto_rawDesc = []byte{
0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74,
0x61, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0xda,
0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25,
- 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69,
+ 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69,
0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x69, 0x6e, 0x73, 0x74,
0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x96, 0x01, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
@@ -900,7 +900,7 @@ var file_v1_instance_service_proto_rawDesc = []byte{
0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61,
0x6e, 0x63, 0x65, 0x22, 0x49, 0xda, 0x41, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x2c, 0x69,
0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x31, 0x3a, 0x08, 0x69,
- 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x25, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x70, 0x61,
+ 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61,
0x72, 0x65, 0x6e, 0x74, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74,
0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0xa4,
0x01, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,
@@ -910,7 +910,7 @@ var file_v1_instance_service_proto_rawDesc = []byte{
0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x57, 0xda, 0x41,
0x14, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3a, 0x3a, 0x08, 0x69, 0x6e, 0x73,
- 0x74, 0x61, 0x6e, 0x63, 0x65, 0x32, 0x2e, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x69, 0x6e, 0x73, 0x74,
+ 0x74, 0x61, 0x6e, 0x63, 0x65, 0x32, 0x2e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x69, 0x6e, 0x73, 0x74,
0x61, 0x6e, 0x63, 0x65, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,
0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,
0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x82, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
@@ -919,7 +919,7 @@ var file_v1_instance_service_proto_rawDesc = []byte{
0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
0x6d, 0x70, 0x74, 0x79, 0x22, 0x34, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4,
- 0x93, 0x02, 0x27, 0x2a, 0x25, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65,
+ 0x93, 0x02, 0x27, 0x2a, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65,
0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x69, 0x6e,
0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x8a, 0x01, 0x0a, 0x10, 0x55,
0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12,
@@ -927,7 +927,7 @@ var file_v1_instance_service_proto_rawDesc = []byte{
0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x39, 0x82, 0xd3,
- 0xe4, 0x93, 0x02, 0x33, 0x3a, 0x01, 0x2a, 0x22, 0x2e, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61,
+ 0xe4, 0x93, 0x02, 0x33, 0x3a, 0x01, 0x2a, 0x22, 0x2e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61,
0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f,
0x2a, 0x2f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x75,
0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72,
diff --git a/proto/generated-go/v1/instance_service.pb.gw.go b/proto/generated-go/v1/instance_service.pb.gw.go
index 330c5812d4..24e9a9a703 100644
--- a/proto/generated-go/v1/instance_service.pb.gw.go
+++ b/proto/generated-go/v1/instance_service.pb.gw.go
@@ -473,7 +473,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/GetInstance", runtime.WithHTTPPathPattern("/v2/{name=environments/*/instances/*}"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/GetInstance", runtime.WithHTTPPathPattern("/v1/{name=environments/*/instances/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -498,7 +498,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/ListInstances", runtime.WithHTTPPathPattern("/v2/{parent=environments/*}/instances"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/ListInstances", runtime.WithHTTPPathPattern("/v1/{parent=environments/*}/instances"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -523,7 +523,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/CreateInstance", runtime.WithHTTPPathPattern("/v2/{parent=environments/*}/instances"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/CreateInstance", runtime.WithHTTPPathPattern("/v1/{parent=environments/*}/instances"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -548,7 +548,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/UpdateInstance", runtime.WithHTTPPathPattern("/v2/{instance.name=environments/*/instances/*}"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/UpdateInstance", runtime.WithHTTPPathPattern("/v1/{instance.name=environments/*/instances/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -573,7 +573,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/DeleteInstance", runtime.WithHTTPPathPattern("/v2/{name=environments/*/instances/*}"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/DeleteInstance", runtime.WithHTTPPathPattern("/v1/{name=environments/*/instances/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -598,7 +598,7 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/UndeleteInstance", runtime.WithHTTPPathPattern("/v2/{name=environments/*/instances/*}:undelete"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.InstanceService/UndeleteInstance", runtime.WithHTTPPathPattern("/v1/{name=environments/*/instances/*}:undelete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -662,7 +662,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/GetInstance", runtime.WithHTTPPathPattern("/v2/{name=environments/*/instances/*}"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/GetInstance", runtime.WithHTTPPathPattern("/v1/{name=environments/*/instances/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -684,7 +684,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/ListInstances", runtime.WithHTTPPathPattern("/v2/{parent=environments/*}/instances"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/ListInstances", runtime.WithHTTPPathPattern("/v1/{parent=environments/*}/instances"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -706,7 +706,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/CreateInstance", runtime.WithHTTPPathPattern("/v2/{parent=environments/*}/instances"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/CreateInstance", runtime.WithHTTPPathPattern("/v1/{parent=environments/*}/instances"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -728,7 +728,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/UpdateInstance", runtime.WithHTTPPathPattern("/v2/{instance.name=environments/*/instances/*}"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/UpdateInstance", runtime.WithHTTPPathPattern("/v1/{instance.name=environments/*/instances/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -750,7 +750,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/DeleteInstance", runtime.WithHTTPPathPattern("/v2/{name=environments/*/instances/*}"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/DeleteInstance", runtime.WithHTTPPathPattern("/v1/{name=environments/*/instances/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -772,7 +772,7 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/UndeleteInstance", runtime.WithHTTPPathPattern("/v2/{name=environments/*/instances/*}:undelete"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.InstanceService/UndeleteInstance", runtime.WithHTTPPathPattern("/v1/{name=environments/*/instances/*}:undelete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -792,17 +792,17 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
}
var (
- pattern_InstanceService_GetInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v2", "environments", "instances", "name"}, ""))
+ pattern_InstanceService_GetInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "environments", "instances", "name"}, ""))
- pattern_InstanceService_ListInstances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v2", "environments", "parent", "instances"}, ""))
+ pattern_InstanceService_ListInstances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "environments", "parent", "instances"}, ""))
- pattern_InstanceService_CreateInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v2", "environments", "parent", "instances"}, ""))
+ pattern_InstanceService_CreateInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "environments", "parent", "instances"}, ""))
- pattern_InstanceService_UpdateInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v2", "environments", "instances", "instance.name"}, ""))
+ pattern_InstanceService_UpdateInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "environments", "instances", "instance.name"}, ""))
- pattern_InstanceService_DeleteInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v2", "environments", "instances", "name"}, ""))
+ pattern_InstanceService_DeleteInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "environments", "instances", "name"}, ""))
- pattern_InstanceService_UndeleteInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v2", "environments", "instances", "name"}, "undelete"))
+ pattern_InstanceService_UndeleteInstance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "environments", "instances", "name"}, "undelete"))
)
var (
diff --git a/proto/generated-go/v1/project_service.pb.go b/proto/generated-go/v1/project_service.pb.go
index 51292a49c9..3de3b8447f 100644
--- a/proto/generated-go/v1/project_service.pb.go
+++ b/proto/generated-go/v1/project_service.pb.go
@@ -1051,21 +1051,21 @@ var file_v1_project_service_proto_rawDesc = []byte{
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x24,
0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f,
- 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
+ 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6c, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x6a,
0x65, 0x63, 0x74, 0x73, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0xda, 0x41, 0x00, 0x82, 0xd3,
- 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x32, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,
+ 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,
0x74, 0x73, 0x12, 0x6a, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a,
0x65, 0x63, 0x74, 0x12, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x20, 0xda, 0x41,
0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
- 0x22, 0x0c, 0x2f, 0x76, 0x32, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x8e,
+ 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x8e,
0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
0x12, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75,
@@ -1073,21 +1073,21 @@ var file_v1_project_service_proto_rawDesc = []byte{
0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x44, 0xda, 0x41, 0x13, 0x70, 0x72,
0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73,
0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x3a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
- 0x32, 0x1d, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x6e,
+ 0x32, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x6e,
0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12,
0x70, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
0x12, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x24, 0xda, 0x41, 0x04,
- 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x2a, 0x15, 0x2f, 0x76, 0x32, 0x2f,
+ 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x2a, 0x15, 0x2f, 0x76, 0x31, 0x2f,
0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a,
0x7d, 0x12, 0x77, 0x0a, 0x0f, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f,
0x6a, 0x65, 0x63, 0x74, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,
0x76, 0x31, 0x2e, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65,
0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x62, 0x79, 0x74, 0x65,
0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x22,
- 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x01, 0x2a, 0x22, 0x1e, 0x2f, 0x76, 0x32, 0x2f,
+ 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x01, 0x2a, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f,
0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a,
0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65,
0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70,
diff --git a/proto/generated-go/v1/project_service.pb.gw.go b/proto/generated-go/v1/project_service.pb.gw.go
index 4c362fceff..12d5a396a8 100644
--- a/proto/generated-go/v1/project_service.pb.gw.go
+++ b/proto/generated-go/v1/project_service.pb.gw.go
@@ -405,7 +405,7 @@ func RegisterProjectServiceHandlerServer(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/GetProject", runtime.WithHTTPPathPattern("/v2/{name=projects/*}"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/GetProject", runtime.WithHTTPPathPattern("/v1/{name=projects/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -430,7 +430,7 @@ func RegisterProjectServiceHandlerServer(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/ListProjects", runtime.WithHTTPPathPattern("/v2/projects"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/ListProjects", runtime.WithHTTPPathPattern("/v1/projects"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -455,7 +455,7 @@ func RegisterProjectServiceHandlerServer(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/CreateProject", runtime.WithHTTPPathPattern("/v2/projects"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/CreateProject", runtime.WithHTTPPathPattern("/v1/projects"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -480,7 +480,7 @@ func RegisterProjectServiceHandlerServer(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/UpdateProject", runtime.WithHTTPPathPattern("/v2/{project.name=projects/*}"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/UpdateProject", runtime.WithHTTPPathPattern("/v1/{project.name=projects/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -505,7 +505,7 @@ func RegisterProjectServiceHandlerServer(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/DeleteProject", runtime.WithHTTPPathPattern("/v2/{name=projects/*}"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/DeleteProject", runtime.WithHTTPPathPattern("/v1/{name=projects/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -530,7 +530,7 @@ func RegisterProjectServiceHandlerServer(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/UndeleteProject", runtime.WithHTTPPathPattern("/v2/{name=projects/*}:undelete"))
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ProjectService/UndeleteProject", runtime.WithHTTPPathPattern("/v1/{name=projects/*}:undelete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -594,7 +594,7 @@ func RegisterProjectServiceHandlerClient(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/GetProject", runtime.WithHTTPPathPattern("/v2/{name=projects/*}"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/GetProject", runtime.WithHTTPPathPattern("/v1/{name=projects/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -616,7 +616,7 @@ func RegisterProjectServiceHandlerClient(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/ListProjects", runtime.WithHTTPPathPattern("/v2/projects"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/ListProjects", runtime.WithHTTPPathPattern("/v1/projects"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -638,7 +638,7 @@ func RegisterProjectServiceHandlerClient(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/CreateProject", runtime.WithHTTPPathPattern("/v2/projects"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/CreateProject", runtime.WithHTTPPathPattern("/v1/projects"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -660,7 +660,7 @@ func RegisterProjectServiceHandlerClient(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/UpdateProject", runtime.WithHTTPPathPattern("/v2/{project.name=projects/*}"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/UpdateProject", runtime.WithHTTPPathPattern("/v1/{project.name=projects/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -682,7 +682,7 @@ func RegisterProjectServiceHandlerClient(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/DeleteProject", runtime.WithHTTPPathPattern("/v2/{name=projects/*}"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/DeleteProject", runtime.WithHTTPPathPattern("/v1/{name=projects/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -704,7 +704,7 @@ func RegisterProjectServiceHandlerClient(ctx context.Context, mux *runtime.Serve
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/UndeleteProject", runtime.WithHTTPPathPattern("/v2/{name=projects/*}:undelete"))
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ProjectService/UndeleteProject", runtime.WithHTTPPathPattern("/v1/{name=projects/*}:undelete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -724,17 +724,17 @@ func RegisterProjectServiceHandlerClient(ctx context.Context, mux *runtime.Serve
}
var (
- pattern_ProjectService_GetProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v2", "projects", "name"}, ""))
+ pattern_ProjectService_GetProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "projects", "name"}, ""))
- pattern_ProjectService_ListProjects_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "projects"}, ""))
+ pattern_ProjectService_ListProjects_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "projects"}, ""))
- pattern_ProjectService_CreateProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "projects"}, ""))
+ pattern_ProjectService_CreateProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "projects"}, ""))
- pattern_ProjectService_UpdateProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v2", "projects", "project.name"}, ""))
+ pattern_ProjectService_UpdateProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "projects", "project.name"}, ""))
- pattern_ProjectService_DeleteProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v2", "projects", "name"}, ""))
+ pattern_ProjectService_DeleteProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "projects", "name"}, ""))
- pattern_ProjectService_UndeleteProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v2", "projects", "name"}, "undelete"))
+ pattern_ProjectService_UndeleteProject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "projects", "name"}, "undelete"))
)
var (
diff --git a/proto/v1/auth_service.proto b/proto/v1/auth_service.proto
index 8a1d039829..d3a53d7f04 100644
--- a/proto/v1/auth_service.proto
+++ b/proto/v1/auth_service.proto
@@ -9,7 +9,7 @@ option go_package = "generated-go/v1";
service AuthService {
rpc Login(LoginRequest) returns (LoginResponse) {
option (google.api.http) = {
- post: "/v2/auth/login"
+ post: "/v1/auth/login"
body: "*"
};
}
diff --git a/proto/v1/environment_service.proto b/proto/v1/environment_service.proto
index d7d521ee21..75bfeffcd3 100644
--- a/proto/v1/environment_service.proto
+++ b/proto/v1/environment_service.proto
@@ -15,21 +15,21 @@ option go_package = "generated-go/v1";
service EnvironmentService {
rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) {
option (google.api.http) = {
- get: "/v2/{name=environments/*}"
+ get: "/v1/{name=environments/*}"
};
option (google.api.method_signature) = "name";
}
rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) {
option (google.api.http) = {
- get: "/v2/environments"
+ get: "/v1/environments"
};
option (google.api.method_signature) = "";
}
rpc CreateEnvironment(CreateEnvironmentRequest) returns (Environment) {
option (google.api.http) = {
- post: "/v2/environments"
+ post: "/v1/environments"
body: "environment"
};
option (google.api.method_signature) = "";
@@ -37,7 +37,7 @@ service EnvironmentService {
rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (Environment) {
option (google.api.http) = {
- patch: "/v2/{environment.name=environments/*}"
+ patch: "/v1/{environment.name=environments/*}"
body: "environment"
};
option (google.api.method_signature) = "environment,update_mask";
@@ -45,14 +45,14 @@ service EnvironmentService {
rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
- delete: "/v2/{name=environments/*}"
+ delete: "/v1/{name=environments/*}"
};
option (google.api.method_signature) = "name";
}
rpc UndeleteEnvironment(UndeleteEnvironmentRequest) returns (Environment) {
option (google.api.http) = {
- post: "/v2/{name=environments/*}:undelete"
+ post: "/v1/{name=environments/*}:undelete"
body: "*"
};
}
diff --git a/proto/v1/hello_service.proto b/proto/v1/hello_service.proto
deleted file mode 100644
index 6d9b639d39..0000000000
--- a/proto/v1/hello_service.proto
+++ /dev/null
@@ -1,24 +0,0 @@
-syntax = "proto3";
-
-package bytebase.v1;
-
-import "google/api/annotations.proto";
-import "google/protobuf/wrappers.proto";
-
-option go_package = "generated-go/v1";
-
-service GreeterService {
- rpc Hello(HelloRequest) returns (HelloResponse) {
- option (google.api.http) = {
- get: "/v2/hello/{name}"
- };
- }
-}
-
-message HelloRequest {
- string name = 1;
-}
-
-message HelloResponse {
- string answer = 1;
-}
\ No newline at end of file
diff --git a/proto/v1/instance_service.proto b/proto/v1/instance_service.proto
index 908fd761c7..bd4d3faac9 100644
--- a/proto/v1/instance_service.proto
+++ b/proto/v1/instance_service.proto
@@ -15,21 +15,21 @@ option go_package = "generated-go/v1";
service InstanceService {
rpc GetInstance(GetInstanceRequest) returns (Instance) {
option (google.api.http) = {
- get: "/v2/{name=environments/*/instances/*}"
+ get: "/v1/{name=environments/*/instances/*}"
};
option (google.api.method_signature) = "name";
}
rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) {
option (google.api.http) = {
- get: "/v2/{parent=environments/*}/instances"
+ get: "/v1/{parent=environments/*}/instances"
};
option (google.api.method_signature) = "parent";
}
rpc CreateInstance(CreateInstanceRequest) returns (Instance) {
option (google.api.http) = {
- post: "/v2/{parent=environments/*}/instances"
+ post: "/v1/{parent=environments/*}/instances"
body: "instance"
};
option (google.api.method_signature) = "parent,instance";
@@ -37,7 +37,7 @@ service InstanceService {
rpc UpdateInstance(UpdateInstanceRequest) returns (Instance) {
option (google.api.http) = {
- patch: "/v2/{instance.name=environments/*/instances/*}"
+ patch: "/v1/{instance.name=environments/*/instances/*}"
body: "instance"
};
option (google.api.method_signature) = "instance,update_mask";
@@ -45,14 +45,14 @@ service InstanceService {
rpc DeleteInstance(DeleteInstanceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
- delete: "/v2/{name=environments/*/instances/*}"
+ delete: "/v1/{name=environments/*/instances/*}"
};
option (google.api.method_signature) = "name";
}
rpc UndeleteInstance(UndeleteInstanceRequest) returns (Instance) {
option (google.api.http) = {
- post: "/v2/{name=environments/*/instances/*}:undelete"
+ post: "/v1/{name=environments/*/instances/*}:undelete"
body: "*"
};
}
diff --git a/proto/v1/project_service.proto b/proto/v1/project_service.proto
index 866cede59b..4af8c71a10 100644
--- a/proto/v1/project_service.proto
+++ b/proto/v1/project_service.proto
@@ -15,21 +15,21 @@ option go_package = "generated-go/v1";
service ProjectService {
rpc GetProject(GetProjectRequest) returns (Project) {
option (google.api.http) = {
- get: "/v2/{name=projects/*}"
+ get: "/v1/{name=projects/*}"
};
option (google.api.method_signature) = "name";
}
rpc ListProjects(ListProjectsRequest) returns (ListProjectsResponse) {
option (google.api.http) = {
- get: "/v2/projects"
+ get: "/v1/projects"
};
option (google.api.method_signature) = "";
}
rpc CreateProject(CreateProjectRequest) returns (Project) {
option (google.api.http) = {
- post: "/v2/projects"
+ post: "/v1/projects"
body: "project"
};
option (google.api.method_signature) = "";
@@ -37,7 +37,7 @@ service ProjectService {
rpc UpdateProject(UpdateProjectRequest) returns (Project) {
option (google.api.http) = {
- patch: "/v2/{project.name=projects/*}"
+ patch: "/v1/{project.name=projects/*}"
body: "project"
};
option (google.api.method_signature) = "project,update_mask";
@@ -45,14 +45,14 @@ service ProjectService {
rpc DeleteProject(DeleteProjectRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
- delete: "/v2/{name=projects/*}"
+ delete: "/v1/{name=projects/*}"
};
option (google.api.method_signature) = "name";
}
rpc UndeleteProject(UndeleteProjectRequest) returns (Project) {
option (google.api.http) = {
- post: "/v2/{name=projects/*}:undelete"
+ post: "/v1/{name=projects/*}:undelete"
body: "*"
};
}
diff --git a/server/api/auth/config.go b/server/api/auth/config.go
index 42ae10d9bc..be72178c82 100644
--- a/server/api/auth/config.go
+++ b/server/api/auth/config.go
@@ -7,7 +7,8 @@ import (
const apiPackagePrefix = "/bytebase.v1."
var authenticationAllowlistMethods = map[string]bool{
- "AuthService/Login": true,
+ "AuthService/Login": true,
+ "GreeterService/Hello": true,
}
var ownerAndDBAMethods = map[string]bool{
diff --git a/server/api/v1/hello_service.go b/server/api/v1/hello_service.go
deleted file mode 100644
index a05d1cbfdc..0000000000
--- a/server/api/v1/hello_service.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package v1
-
-import (
- "context"
- "fmt"
-
- "github.com/bytebase/bytebase/common"
- gw "github.com/bytebase/bytebase/proto/generated-go/v1"
-)
-
-// GreeterServerImpl implements the greeter service.
-type GreeterServerImpl struct {
- gw.UnimplementedGreeterServiceServer
-}
-
-// Hello is the implementation of Greater Hello method.
-func (*GreeterServerImpl) Hello(ctx context.Context, request *gw.HelloRequest) (*gw.HelloResponse, error) {
- principalID := ctx.Value(common.PrincipalIDContextKey).(int)
- return &gw.HelloResponse{
- Answer: fmt.Sprintf("hello %s from %v", request.Name, principalID),
- }, nil
-}
diff --git a/server/jwt.go b/server/jwt.go
index 8b1079fb22..fc46786f5f 100644
--- a/server/jwt.go
+++ b/server/jwt.go
@@ -85,11 +85,6 @@ func GenerateTokensAndSetCookies(c echo.Context, user *api.Principal, mode commo
return nil
}
-func generateAPIToken(user *api.Principal, mode common.ReleaseMode, secret string) (string, error) {
- expirationTime := time.Now().Add(apiTokenDuration)
- return generateToken(user, fmt.Sprintf(accessTokenAudienceFmt, mode), expirationTime, []byte(secret))
-}
-
func generateAccessToken(user *api.Principal, mode common.ReleaseMode, secret string) (string, error) {
expirationTime := time.Now().Add(accessTokenDuration)
return generateToken(user, fmt.Sprintf(accessTokenAudienceFmt, mode), expirationTime, []byte(secret))
diff --git a/server/openapi_auth.go b/server/openapi_auth.go
deleted file mode 100644
index 60e54ccfc6..0000000000
--- a/server/openapi_auth.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package server
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "net/http"
-
- "github.com/labstack/echo/v4"
- "golang.org/x/crypto/bcrypt"
-
- "github.com/bytebase/bytebase/api"
- openAPIV1 "github.com/bytebase/bytebase/api/v1"
-)
-
-func (s *Server) registerOpenAPIRoutesForAuth(g *echo.Group) {
- g.POST("/auth/login", s.openAPIUserLogin)
-}
-
-func (s *Server) openAPIUserLogin(c echo.Context) error {
- ctx := c.Request().Context()
- login := &openAPIV1.Login{}
- body, err := io.ReadAll(c.Request().Body)
- if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, "Failed to read request body").SetInternal(err)
- }
- if err := json.Unmarshal(body, login); err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, "Malformed login request").SetInternal(err)
- }
-
- user, err := s.store.GetPrincipalByEmail(ctx, login.Email)
- if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to authenticate user").SetInternal(err)
- }
- if user == nil {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("User not found: %s", login.Email))
- }
-
- // Compare the stored hashed password, with the hashed version of the password that was received.
- if err := bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(login.Password)); err != nil {
- // If the two passwords don't match, return a 401 status.
- return echo.NewHTTPError(http.StatusUnauthorized, "Incorrect password").SetInternal(err)
- }
-
- // test the status of this user
- member, err := s.store.GetMemberByPrincipalID(ctx, user.ID)
- if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to authenticate user").SetInternal(err)
- }
- if member == nil {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Member not found: %s", user.Email))
- }
- if member.RowStatus == api.Archived {
- return echo.NewHTTPError(http.StatusUnauthorized, "This user has been deactivated by the admin")
- }
-
- accessToken, err := generateAPIToken(user, s.profile.Mode, s.secret)
- if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to generate access token").SetInternal(err)
- }
-
- response := &openAPIV1.LoginResponse{
- ID: user.ID,
- Name: user.Name,
- Email: user.Email,
- Token: accessToken,
- }
- return c.JSON(http.StatusOK, response)
-}
diff --git a/server/openapi_environment.go b/server/openapi_environment.go
index ecd91ddb0e..703bd565a7 100644
--- a/server/openapi_environment.go
+++ b/server/openapi_environment.go
@@ -18,14 +18,6 @@ import (
"github.com/bytebase/bytebase/store"
)
-func (s *Server) registerOpenAPIRoutesForEnvironment(g *echo.Group) {
- g.GET("/environment", s.listEnvironment)
- g.POST("/environment", s.createEnvironmentByOpenAPI)
- g.GET("/environment/:environmentID", s.getEnvironmentByID)
- g.PATCH("/environment/:environmentID", s.updateEnvironmentByOpenAPI)
- g.DELETE("/environment/:environmentID", s.deleteEnvironmentByOpenAPI)
-}
-
func (s *Server) listEnvironment(c echo.Context) error {
ctx := c.Request().Context()
rowStatus := api.Normal
diff --git a/server/openapi_instance.go b/server/openapi_instance.go
index f110d6784a..fe4b110095 100644
--- a/server/openapi_instance.go
+++ b/server/openapi_instance.go
@@ -21,20 +21,6 @@ import (
"github.com/bytebase/bytebase/store"
)
-func (s *Server) registerOpenAPIRoutesForInstance(g *echo.Group) {
- g.POST("/instance", s.createInstanceByOpenAPI)
- g.GET("/instance", s.listInstance)
- g.GET("/instance/:instanceID", s.getInstanceByID)
- g.PATCH("/instance/:instanceID", s.updateInstanceByOpenAPI)
- g.DELETE("/instance/:instanceID", s.deleteInstanceByOpenAPI)
- g.GET("/instance/:instanceID/role", s.listDatabaseRole)
- g.POST("/instance/:instanceID/role", s.createDatabaseRole)
- g.GET("/instance/:instanceID/role/:roleName", s.getDatabaseRole)
- g.PATCH("/instance/:instanceID/role/:roleName", s.updateDatabaseRole)
- g.DELETE("/instance/:instanceID/role/:roleName", s.deleteDatabaseRole)
- g.PATCH("/instances/:instanceName/databases/:database", s.updateInstanceDatabase)
-}
-
func (s *Server) listInstance(c echo.Context) error {
ctx := c.Request().Context()
rowStatus := api.Normal
diff --git a/server/openapi_issue.go b/server/openapi_issue.go
index 5e9768ed9a..d68e8059aa 100644
--- a/server/openapi_issue.go
+++ b/server/openapi_issue.go
@@ -13,10 +13,6 @@ import (
"github.com/bytebase/bytebase/plugin/db"
)
-func (s *Server) registerOpenAPIRoutesForIssue(g *echo.Group) {
- g.POST("/issues", s.createIssueByOpenAPI)
-}
-
func (s *Server) createIssueByOpenAPI(c echo.Context) error {
ctx := c.Request().Context()
diff --git a/server/openapi_sql.go b/server/openapi_sql.go
index c52250e358..f913cb93f6 100644
--- a/server/openapi_sql.go
+++ b/server/openapi_sql.go
@@ -40,11 +40,6 @@ func (c *catalogService) GetFinder() *catalog.Finder {
return c.finder
}
-func (s *Server) registerOpenAPIRoutesForSQL(g *echo.Group) {
- g.POST("/sql/advise", s.sqlCheckController)
- g.POST("/sql/schema/diff", schemaDiff)
-}
-
type sqlCheckRequestBody struct {
Statement string `json:"statement"`
DatabaseType string `json:"databaseType"`
diff --git a/server/server.go b/server/server.go
index d4335af8d6..4878563ea6 100644
--- a/server/server.go
+++ b/server/server.go
@@ -305,7 +305,6 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
grpc.ChainUnaryInterceptor(authProvider.AuthenticationInterceptor, authProvider.ACLInterceptor),
)
mux := runtime.NewServeMux()
- v1pb.RegisterGreeterServiceServer(s.grpcServer, &v1.GreeterServerImpl{})
v1pb.RegisterAuthServiceServer(s.grpcServer, v1.NewAuthService(s.store, s.secret, &profile))
v1pb.RegisterEnvironmentServiceServer(s.grpcServer, v1.NewEnvironmentService(s.store, s.licenseService))
v1pb.RegisterInstanceServiceServer(s.grpcServer, v1.NewInstanceService(s.store, s.licenseService))
@@ -315,10 +314,16 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
if err := v1pb.RegisterAuthServiceHandlerFromEndpoint(ctx, mux, grpcEndpoint, opts); err != nil {
return nil, err
}
- if err := v1pb.RegisterGreeterServiceHandlerFromEndpoint(ctx, mux, grpcEndpoint, opts); err != nil {
+ if err := v1pb.RegisterEnvironmentServiceHandlerFromEndpoint(ctx, mux, grpcEndpoint, opts); err != nil {
return nil, err
}
- e.Any("/v2/*", echo.WrapHandler(mux))
+ if err := v1pb.RegisterInstanceServiceHandlerFromEndpoint(ctx, mux, grpcEndpoint, opts); err != nil {
+ return nil, err
+ }
+ if err := v1pb.RegisterProjectServiceHandlerFromEndpoint(ctx, mux, grpcEndpoint, opts); err != nil {
+ return nil, err
+ }
+ e.Any("/v1/*", echo.WrapHandler(mux))
embedFrontend(e)
s.e = e
@@ -469,29 +474,34 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
}
func (s *Server) registerOpenAPIRoutes(e *echo.Echo, ce *casbin.Enforcer, prof config.Profile) {
- openAPIGroup := e.Group(openAPIPrefix)
-
- openAPIGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
+ jwtMiddlewareFunc := func(next echo.HandlerFunc) echo.HandlerFunc {
return JWTMiddleware(openAPIPrefix, s.store, next, prof.Mode, s.secret)
- })
- openAPIGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
+ }
+ aclMiddlewareFunc := func(next echo.HandlerFunc) echo.HandlerFunc {
return aclMiddleware(s, openAPIPrefix, ce, next, prof.Readonly)
- })
- openAPIGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
+ }
+ metricMiddlewareFunc := func(next echo.HandlerFunc) echo.HandlerFunc {
return openAPIMetricMiddleware(s, next)
- })
-
- s.registerOpenAPIRoutesForSQL(openAPIGroup)
- s.registerOpenAPIRoutesForAuth(openAPIGroup)
- s.registerOpenAPIRoutesForInstance(openAPIGroup)
- s.registerOpenAPIRoutesForIssue(openAPIGroup)
- s.registerOpenAPIRoutesForEnvironment(openAPIGroup)
-
- openAPIGroup.GET("/healthz", func(c echo.Context) error {
- return c.JSON(http.StatusOK, map[string]string{
- "content": "OK",
- })
- })
+ }
+ e.POST("/v1/sql/advise", s.sqlCheckController)
+ e.POST("/v1/sql/schema/diff", schemaDiff)
+ e.POST("/v1/instance", s.createInstanceByOpenAPI, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.GET("/v1/instance", s.listInstance, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.GET("/v1/instance/:instanceID", s.getInstanceByID, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.PATCH("/v1/instance/:instanceID", s.updateInstanceByOpenAPI, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.DELETE("/v1/instance/:instanceID", s.deleteInstanceByOpenAPI, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.GET("/v1/instance/:instanceID/role", s.listDatabaseRole, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.POST("/v1/instance/:instanceID/role", s.createDatabaseRole, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.GET("/v1/instance/:instanceID/role/:roleName", s.getDatabaseRole, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.PATCH("/v1/instance/:instanceID/role/:roleName", s.updateDatabaseRole, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.DELETE("/v1/instance/:instanceID/role/:roleName", s.deleteDatabaseRole, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.PATCH("/v1/instances/:instanceName/databases/:database", s.updateInstanceDatabase, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.POST("/v1/issues", s.createIssueByOpenAPI, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.GET("/v1/environment", s.listEnvironment, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.POST("/v1/environment", s.createEnvironmentByOpenAPI, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.GET("/v1/environment/:environmentID", s.getEnvironmentByID, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.PATCH("/v1/environment/:environmentID", s.updateEnvironmentByOpenAPI, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
+ e.DELETE("/v1/environment/:environmentID", s.deleteEnvironmentByOpenAPI, jwtMiddlewareFunc, aclMiddlewareFunc, metricMiddlewareFunc)
}
// initMetricReporter will initial the metric scheduler.
diff --git a/store/data_source.go b/store/data_source.go
index bb4b77e9fd..a16d59a9f7 100644
--- a/store/data_source.go
+++ b/store/data_source.go
@@ -535,22 +535,24 @@ type DataSourceMessage struct {
Database string
}
-func (*Store) listDataSourceV2(ctx context.Context, tx *Tx, instanceID int) ([]*DataSourceMessage, error) {
+func (*Store) listDataSourceV2(ctx context.Context, tx *Tx, instanceID string) ([]*DataSourceMessage, error) {
var dataSourceMessages []*DataSourceMessage
rows, err := tx.QueryContext(ctx, `
SELECT
- name,
- type,
- username,
- password,
- ssl_key,
- ssl_cert,
- ssl_ca,
- host,
- port,
- database
+ data_source.name,
+ data_source.type,
+ data_source.username,
+ data_source.password,
+ data_source.ssl_key,
+ data_source.ssl_cert,
+ data_source.ssl_ca,
+ data_source.host,
+ data_source.port,
+ data_source.database
FROM data_source
- WHERE instance_id = $1`,
+ LEFT JOIN instance
+ ON instance.id = data_source.instance_id
+ WHERE instance.resource_id = $1`,
instanceID,
)
if err != nil {
diff --git a/store/environment.go b/store/environment.go
index 33846063a4..40be04c25a 100644
--- a/store/environment.go
+++ b/store/environment.go
@@ -574,7 +574,7 @@ func (s *Store) ListEnvironmentV2(ctx context.Context, showDeleted bool) ([]*Env
var environmentMessages []*EnvironmentMessage
rows, err := tx.QueryContext(ctx, `
SELECT
- resource_id
+ resource_id,
name,
"order",
row_status
diff --git a/store/instance.go b/store/instance.go
index 70b66aa0b1..62a8f4453c 100644
--- a/store/instance.go
+++ b/store/instance.go
@@ -1010,7 +1010,7 @@ func (s *Store) UpdateInstanceV2(ctx context.Context, patch *UpdateInstanceMessa
instanceMessage.Deleted = convertRowStatusToDeleted(rowStatus)
- dataSourceList, err := s.listDataSourceV2(ctx, tx, instanceID)
+ dataSourceList, err := s.listDataSourceV2(ctx, tx, patch.ResourceID)
if err != nil {
return nil, FormatError(err)
}
@@ -1038,7 +1038,6 @@ func (s *Store) listInstanceImplV2(ctx context.Context, tx *Tx, find *FindInstan
var instanceMessages []*InstanceMessage
rows, err := tx.QueryContext(ctx, `
SELECT
- instance.id AS id,
environment.resource_id as environment_id,
instance.resource_id AS resource_id,
instance.name AS name,
@@ -1058,9 +1057,7 @@ func (s *Store) listInstanceImplV2(ctx context.Context, tx *Tx, find *FindInstan
for rows.Next() {
var instanceMessage InstanceMessage
var rowStatus string
- var instanceID int
if err := rows.Scan(
- &instanceID,
&instanceMessage.EnvironmentID,
&instanceMessage.InstanceID,
&instanceMessage.Title,
@@ -1071,12 +1068,15 @@ func (s *Store) listInstanceImplV2(ctx context.Context, tx *Tx, find *FindInstan
return nil, FormatError(err)
}
instanceMessage.Deleted = convertRowStatusToDeleted(rowStatus)
- dataSourceList, err := s.listDataSourceV2(ctx, tx, instanceID)
+ instanceMessages = append(instanceMessages, &instanceMessage)
+ }
+
+ for _, instanceMessage := range instanceMessages {
+ dataSourceList, err := s.listDataSourceV2(ctx, tx, instanceMessage.InstanceID)
if err != nil {
return nil, FormatError(err)
}
instanceMessage.DataSources = dataSourceList
- instanceMessages = append(instanceMessages, &instanceMessage)
}
return instanceMessages, nil