diff --git a/.github/testing/core.yaml b/.github/testing/core.yaml index ca73e0ba..5132a4f3 100644 --- a/.github/testing/core.yaml +++ b/.github/testing/core.yaml @@ -67,3 +67,9 @@ items: request: api: /GetVersion method: POST +- name: secrets + request: + api: /GetSecrets + method: POST + expect: + statusCode: 500 diff --git a/Makefile b/Makefile index d94abbdc..2c515aca 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,11 @@ grpc-gw: --grpc-gateway_opt paths=source_relative \ --grpc-gateway_opt generate_unbound_methods=true \ pkg/server/server.proto +grpc-java: + protoc --plugin=protoc-gen-grpc-java \ + --grpc-java_out=bin --proto_path=. \ + pkg/server/server.proto \ + pkg/testing/remote/loader.proto grpc-js: protoc -I=pkg/server server.proto \ --js_out=import_style=commonjs:bin \ diff --git a/cmd/server.go b/cmd/server.go index 4370d652..ff7df5e8 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -15,6 +15,7 @@ import ( _ "embed" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + template "github.com/linuxsuren/api-testing/pkg/render" "github.com/linuxsuren/api-testing/pkg/server" "github.com/linuxsuren/api-testing/pkg/testing" "github.com/linuxsuren/api-testing/pkg/testing/remote" @@ -44,6 +45,7 @@ func createServerCmd(execer fakeruntime.Execer, gRPCServer gRPCServer, httpServe flags.StringArrayVarP(&opt.localStorage, "local-storage", "", []string{"*.yaml"}, "The local storage path") flags.StringVarP(&opt.consolePath, "console-path", "", "", "The path of the console") flags.StringVarP(&opt.configDir, "config-dir", "", "$HOME/.config/atest", "The config directory") + flags.StringVarP(&opt.secretServer, "secret-server", "", "", "The secret server URL") return } @@ -57,6 +59,7 @@ type serverOption struct { printProto bool localStorage []string consolePath string + secretServer string configDir string } @@ -95,7 +98,16 @@ func (o *serverOption) runE(cmd *cobra.Command, args []string) (err error) { } } - removeServer := server.NewRemoteServer(loader, remote.NewGRPCloaderFromStore(), o.configDir) + var secretServer remote.SecretServiceServer + if o.secretServer != "" { + if secretServer, err = remote.NewGRPCSecretFrom(o.secretServer); err != nil { + return + } + + template.SetSecretGetter(remote.NewGRPCSecretGetter(secretServer)) + } + + removeServer := server.NewRemoteServer(loader, remote.NewGRPCloaderFromStore(), secretServer, o.configDir) s := o.gRPCServer go func() { if gRPCServer, ok := s.(reflection.GRPCServer); ok { diff --git a/cmd/server_test.go b/cmd/server_test.go index 8efa3457..d867e1c3 100644 --- a/cmd/server_test.go +++ b/cmd/server_test.go @@ -32,7 +32,8 @@ func TestPrintProto(t *testing.T) { }, }, { name: "random port", - args: []string{"server", "-p=0", "--http-port=0", "--local-storage=./*"}, + args: []string{"server", "-p=0", "--http-port=0", + "--local-storage=./*", "--secret-server=localhost:7073"}, verify: func(t *testing.T, buf *bytes.Buffer, err error) { assert.Nil(t, err) }, diff --git a/docs/README.md b/docs/README.md index a13241b3..00f8a92e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -27,14 +27,16 @@ Currently, it supports the following kinds of services: * Operate System services * Linux, and Darwin -* Podman, and Docker +* [Podman](https://github.com/containers/podman), and Docker Please see the following example usage: ```shell -atest service start -m podman --version master +sudo atest service install -m podman --version master ``` +the default web server port is `8080`. So you can visit it via: http://localhost:8080 + ## Run in k3s ```shell @@ -51,6 +53,7 @@ There are multiple storage backends supported. See the status from the list: | Name | Status | |---|---| | Local Storage | Ready | +| S3 | Ready | | ORM DataBase | Developing | | Etcd DataBase | Developing | @@ -108,7 +111,7 @@ podman run -p 7071:7071 \ ghcr.io/linuxsuren/api-testing:master atest-store-orm ``` -### ORM S3 Storage +### S3 Storage You can use a S3 compatible storage as the storage backend. ```shell @@ -134,8 +137,17 @@ See also the expected configuration below: region: cn ``` +## Secret Server +You can put the sensitive information into a secret server. For example, [Vault](https://www.github.com/hashicorp/vault). + +Connect to [a vault extension](https://github.com/LinuxSuRen/api-testing-secret-extension) via flag: `--secret-server`. Such as: + +```shell +atest server --secret-server localhost:7073 +``` + ## Extensions -Developers could have a storage extension. Implement a gRPC server according to [loader.proto](../pkg/testing/remote/loader.proto) is required. +Developers could have storage, secret extensions. Implement a gRPC server according to [loader.proto](../pkg/testing/remote/loader.proto) is required. ## Official Images You could find the official images from both [Docker Hub](https://hub.docker.com/r/linuxsuren/api-testing) and [GitHub Images](https://github.com/users/LinuxSuRen/packages/container/package/api-testing). See the image path: diff --git a/pkg/render/secret.go b/pkg/render/secret.go new file mode 100644 index 00000000..ec8d88a9 --- /dev/null +++ b/pkg/render/secret.go @@ -0,0 +1,17 @@ +package render + +import ( + "github.com/linuxsuren/api-testing/pkg/secret" +) + +type nonSecretGetter struct { + value string + err error +} + +func (n *nonSecretGetter) GetSecret(name string) (s secret.Secret, err error) { + s.Value = n.value + s.Name = name + err = n.err + return +} diff --git a/pkg/render/template.go b/pkg/render/template.go index d1f58c06..3a836d6f 100644 --- a/pkg/render/template.go +++ b/pkg/render/template.go @@ -10,9 +10,22 @@ import ( "strings" "github.com/Masterminds/sprig/v3" + "github.com/linuxsuren/api-testing/pkg/secret" "github.com/linuxsuren/api-testing/pkg/util" ) +var secretGetter secret.SecretGetter + +// SetSecretGetter set the secret getter +func SetSecretGetter(getter secret.SecretGetter) { + if getter == nil { + getter = &nonSecretGetter{ + err: fmt.Errorf("no secret server"), + } + } + secretGetter = getter +} + // Render render then return the result func Render(name, text string, ctx interface{}) (result string, err error) { var tpl *template.Template @@ -69,6 +82,15 @@ var advancedFuncs = []AdvancedFunc{{ writeWithContext(ctx, `{{randAlpha `+fields+`}}`) return }, +}, { + FuncName: "secretValue", + Func: func(name string) string { + val, err := secretGetter.GetSecret(name) + if err == nil { + return val.Value + } + return err.Error() + }, }} // GetAdvancedFuncs returns all the advanced functions @@ -112,7 +134,6 @@ func writeWithContext(ctx context.Context, text string) { if ok && writer != nil { _, _ = writer.Write([]byte(text)) } - return } // AdvancedFunc represents an advanced function diff --git a/pkg/render/template_test.go b/pkg/render/template_test.go index d48914ef..dd555e79 100644 --- a/pkg/render/template_test.go +++ b/pkg/render/template_test.go @@ -154,3 +154,18 @@ func TestGenerateJSONString(t *testing.T) { result := generateJSONString([]string{"name", "age"}) assert.Equal(t, `{"age":"random","name":"random"}`, result) } + +func TestSecret(t *testing.T) { + SetSecretGetter(nil) + result, err := Render("", `{{secretValue "pass"}}`, nil) + assert.NoError(t, err) + assert.Equal(t, "no secret server", result) + + expected := "password" + SetSecretGetter(&nonSecretGetter{ + value: expected, + }) + result, err = Render("", `{{secretValue "pass"}}`, nil) + assert.NoError(t, err) + assert.Equal(t, expected, result) +} diff --git a/pkg/secret/types.go b/pkg/secret/types.go new file mode 100644 index 00000000..42802a2e --- /dev/null +++ b/pkg/secret/types.go @@ -0,0 +1,30 @@ +/* +MIT License +Copyright (c) 2023 API Testing Authors. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +package secret + +type Secret struct { + Name string + Value string +} + +type SecretGetter interface { + GetSecret(name string) (secret Secret, err error) +} diff --git a/pkg/server/remote_server.go b/pkg/server/remote_server.go index 13864330..577653c6 100644 --- a/pkg/server/remote_server.go +++ b/pkg/server/remote_server.go @@ -31,14 +31,56 @@ type server struct { loader testing.Writer storeWriterFactory testing.StoreWriterFactory configDir string + + secretServer SecretServiceServer +} + +type SecretServiceServer interface { + GetSecrets(context.Context, *Empty) (*Secrets, error) + CreateSecret(context.Context, *Secret) (*CommonResult, error) + DeleteSecret(context.Context, *Secret) (*CommonResult, error) + UpdateSecret(context.Context, *Secret) (*CommonResult, error) +} + +type SecertServiceGetable interface { + GetSecret(context.Context, *Secret) (*Secret, error) +} + +type fakeSecretServer struct{} + +var errNoSecretService = errors.New("no secret service found") + +func (f *fakeSecretServer) GetSecrets(ctx context.Context, in *Empty) (reply *Secrets, err error) { + err = errNoSecretService + return +} + +func (f *fakeSecretServer) CreateSecret(ctx context.Context, in *Secret) (reply *CommonResult, err error) { + err = errNoSecretService + return +} + +func (f *fakeSecretServer) DeleteSecret(ctx context.Context, in *Secret) (reply *CommonResult, err error) { + err = errNoSecretService + return +} + +func (f *fakeSecretServer) UpdateSecret(ctx context.Context, in *Secret) (reply *CommonResult, err error) { + err = errNoSecretService + return } // NewRemoteServer creates a remote server instance -func NewRemoteServer(loader testing.Writer, storeWriterFactory testing.StoreWriterFactory, configDir string) RunnerServer { +func NewRemoteServer(loader testing.Writer, storeWriterFactory testing.StoreWriterFactory, secretServer SecretServiceServer, configDir string) RunnerServer { + if secretServer == nil { + secretServer = &fakeSecretServer{} + } + return &server{ loader: loader, storeWriterFactory: storeWriterFactory, configDir: configDir, + secretServer: secretServer, } } @@ -645,6 +687,20 @@ func (s *server) VerifyStore(ctx context.Context, in *SimpleQuery) (reply *Commo return } +// secret related interfaces +func (s *server) GetSecrets(ctx context.Context, in *Empty) (reply *Secrets, err error) { + return s.secretServer.GetSecrets(ctx, in) +} +func (s *server) CreateSecret(ctx context.Context, in *Secret) (reply *CommonResult, err error) { + return s.secretServer.CreateSecret(ctx, in) +} +func (s *server) DeleteSecret(ctx context.Context, in *Secret) (reply *CommonResult, err error) { + return s.secretServer.DeleteSecret(ctx, in) +} +func (s *server) UpdateSecret(ctx context.Context, in *Secret) (reply *CommonResult, err error) { + return s.secretServer.UpdateSecret(ctx, in) +} + func (s *server) getLoaderByStoreName(storeName string) (loader testing.Writer, err error) { var store *testing.Store store, err = testing.NewStoreFactory(s.configDir).GetStore(storeName) diff --git a/pkg/server/remote_server_test.go b/pkg/server/remote_server_test.go index 056b1c91..d3072467 100644 --- a/pkg/server/remote_server_test.go +++ b/pkg/server/remote_server_test.go @@ -25,31 +25,33 @@ const ( ) func TestRemoteServer(t *testing.T) { + ctx := context.Background() + loader := atesting.NewFileWriter("") loader.Put("testdata/simple.yaml") - server := NewRemoteServer(loader, nil, "") - _, err := server.Run(context.TODO(), &TestTask{ + server := NewRemoteServer(loader, nil, nil, "") + _, err := server.Run(ctx, &TestTask{ Kind: "fake", }) assert.NotNil(t, err) gock.New(urlFoo).Get("/").Reply(http.StatusOK).JSON(&server) gock.New(urlFoo).Get("/").Reply(http.StatusOK).JSON(&server) - _, err = server.Run(context.TODO(), &TestTask{ + _, err = server.Run(ctx, &TestTask{ Kind: "suite", Data: simpleSuite, }) assert.Nil(t, err) gock.New(urlFoo).Get("/").Reply(http.StatusOK).JSON(&server) - _, err = server.Run(context.TODO(), &TestTask{ + _, err = server.Run(ctx, &TestTask{ Kind: "testcase", Data: simpleTestCase, }) assert.Nil(t, err) gock.New(urlFoo).Get("/").Reply(http.StatusOK).JSON(&server) - _, err = server.Run(context.TODO(), &TestTask{ + _, err = server.Run(ctx, &TestTask{ Kind: "testcaseInSuite", Data: simpleSuite, CaseName: "get", @@ -57,7 +59,7 @@ func TestRemoteServer(t *testing.T) { assert.Nil(t, err) gock.New(urlFoo).Get("/").Reply(http.StatusOK).JSON(&server) - _, err = server.Run(context.TODO(), &TestTask{ + _, err = server.Run(ctx, &TestTask{ Kind: "testcaseInSuite", Data: simpleSuite, CaseName: "fake", @@ -68,16 +70,16 @@ func TestRemoteServer(t *testing.T) { assert.NotNil(t, err) var ver *HelloReply - ver, err = server.GetVersion(context.TODO(), &Empty{}) + ver, err = server.GetVersion(ctx, &Empty{}) assert.Empty(t, ver.Message) assert.Nil(t, err) - ver, err = server.Sample(context.TODO(), &Empty{}) + ver, err = server.Sample(ctx, &Empty{}) assert.Nil(t, err) assert.Equal(t, sample.TestSuiteGitLab, ver.Message) var suites *Suites - suites, err = server.GetSuites(context.TODO(), &Empty{}) + suites, err = server.GetSuites(ctx, &Empty{}) assert.Nil(t, err) assert.Equal(t, suites, &Suites{Data: map[string]*Items{ "simple": { @@ -86,19 +88,32 @@ func TestRemoteServer(t *testing.T) { }}) var testCase *TestCase - testCase, err = server.GetTestCase(context.TODO(), &TestCaseIdentity{ + testCase, err = server.GetTestCase(ctx, &TestCaseIdentity{ Suite: "simple", Testcase: "get", }) assert.Nil(t, err) assert.Equal(t, "get", testCase.Name) assert.Equal(t, urlFoo, testCase.Request.Api) + + // secret functions + _, err = server.GetSecrets(ctx, &Empty{}) + assert.Error(t, err) + + _, err = server.CreateSecret(ctx, &Secret{}) + assert.Error(t, err) + + _, err = server.DeleteSecret(ctx, &Secret{}) + assert.Error(t, err) + + _, err = server.UpdateSecret(ctx, &Secret{}) + assert.Error(t, err) } func TestRunTestCase(t *testing.T) { loader := atesting.NewFileWriter("") loader.Put("testdata/simple.yaml") - server := NewRemoteServer(loader, nil, "") + server := NewRemoteServer(loader, nil, nil, "") defer gock.Clean() gock.New(urlFoo).Get("/").MatchHeader("key", "value"). @@ -273,7 +288,7 @@ func TestUpdateTestCase(t *testing.T) { assert.NoError(t, err) ctx := context.Background() - server := NewRemoteServer(writer, nil, "") + server := NewRemoteServer(writer, nil, nil, "") _, err = server.UpdateTestCase(ctx, &TestCaseWithSuite{ SuiteName: "simple", Data: &TestCase{ @@ -345,7 +360,7 @@ func TestListTestCase(t *testing.T) { writer := atesting.NewFileWriter(os.TempDir()) writer.Put(tmpFile.Name()) - server := NewRemoteServer(writer, nil, "") + server := NewRemoteServer(writer, nil, nil, "") ctx := context.Background() t.Run("get two testcases", func(t *testing.T) { @@ -683,12 +698,29 @@ func TestStoreManager(t *testing.T) { }) } +func TestFakeSecretServer(t *testing.T) { + fakeSecret := &fakeSecretServer{} + ctx := context.Background() + + _, err := fakeSecret.GetSecrets(ctx, &Empty{}) + assert.Error(t, err) + + _, err = fakeSecret.CreateSecret(ctx, &Secret{}) + assert.Error(t, err) + + _, err = fakeSecret.DeleteSecret(ctx, &Secret{}) + assert.Error(t, err) + + _, err = fakeSecret.UpdateSecret(ctx, &Secret{}) + assert.Error(t, err) +} + func getRemoteServerInTempDir() (server RunnerServer, call func()) { dir, _ := os.MkdirTemp(os.TempDir(), "remote-server-test") call = func() { os.RemoveAll(dir) } writer := atesting.NewFileWriter(dir) - server = NewRemoteServer(writer, newLocalloaderFromStore(), dir) + server = NewRemoteServer(writer, newLocalloaderFromStore(), nil, dir) return } diff --git a/pkg/server/server.pb.go b/pkg/server/server.pb.go index fdf28475..4c8ad737 100644 --- a/pkg/server/server.pb.go +++ b/pkg/server/server.pb.go @@ -1657,6 +1657,116 @@ func (x *CodeGenerateRequest) GetGenerator() string { return "" } +type Secrets struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []*Secret `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` +} + +func (x *Secrets) Reset() { + *x = Secrets{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_server_server_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Secrets) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Secrets) ProtoMessage() {} + +func (x *Secrets) ProtoReflect() protoreflect.Message { + mi := &file_pkg_server_server_proto_msgTypes[27] + 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 Secrets.ProtoReflect.Descriptor instead. +func (*Secrets) Descriptor() ([]byte, []int) { + return file_pkg_server_server_proto_rawDescGZIP(), []int{27} +} + +func (x *Secrets) GetData() []*Secret { + if x != nil { + return x.Data + } + return nil +} + +type Secret struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Value string `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"` + Description string `protobuf:"bytes,3,opt,name=Description,proto3" json:"Description,omitempty"` +} + +func (x *Secret) Reset() { + *x = Secret{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_server_server_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Secret) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Secret) ProtoMessage() {} + +func (x *Secret) ProtoReflect() protoreflect.Message { + mi := &file_pkg_server_server_proto_msgTypes[28] + 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 Secret.ProtoReflect.Descriptor instead. +func (*Secret) Descriptor() ([]byte, []int) { + return file_pkg_server_server_proto_rawDescGZIP(), []int{28} +} + +func (x *Secret) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Secret) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *Secret) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + type Empty struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1666,7 +1776,7 @@ type Empty struct { func (x *Empty) Reset() { *x = Empty{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_server_server_proto_msgTypes[27] + mi := &file_pkg_server_server_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1679,7 +1789,7 @@ func (x *Empty) String() string { func (*Empty) ProtoMessage() {} func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_pkg_server_server_proto_msgTypes[27] + mi := &file_pkg_server_server_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1692,7 +1802,7 @@ func (x *Empty) ProtoReflect() protoreflect.Message { // Deprecated: Use Empty.ProtoReflect.Descriptor instead. func (*Empty) Descriptor() ([]byte, []int) { - return file_pkg_server_server_proto_rawDescGZIP(), []int{27} + return file_pkg_server_server_proto_rawDescGZIP(), []int{29} } var File_pkg_server_server_proto protoreflect.FileDescriptor @@ -1860,106 +1970,128 @@ var file_pkg_server_server_proto_rawDesc = []byte{ 0x75, 0x69, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x07, - 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, 0xeb, 0x0b, 0x0a, 0x06, 0x52, 0x75, 0x6e, 0x6e, - 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x03, 0x52, 0x75, 0x6e, 0x12, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x12, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, - 0x00, 0x12, 0x2c, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x73, 0x12, 0x0d, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0e, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x69, 0x74, 0x65, 0x73, 0x22, 0x00, 0x12, - 0x42, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, - 0x74, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, - 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x12, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, - 0x69, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, - 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x11, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, - 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x65, 0x73, - 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x12, 0x11, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x42, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, - 0x74, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, - 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x12, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x65, 0x73, 0x74, 0x43, - 0x61, 0x73, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, - 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x0d, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x69, 0x74, 0x65, 0x22, 0x00, 0x12, - 0x42, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x65, 0x64, 0x41, - 0x50, 0x49, 0x73, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, - 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x11, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, - 0x73, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0b, 0x52, 0x75, 0x6e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, - 0x73, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, - 0x43, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x54, 0x65, 0x73, - 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, - 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, - 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, 0x73, - 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, - 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, 0x53, 0x75, 0x69, 0x74, 0x65, - 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, 0x53, 0x75, - 0x69, 0x74, 0x65, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, - 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, - 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x11, 0x4c, - 0x69, 0x73, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, - 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x4c, - 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, - 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x0e, 0x50, 0x6f, - 0x70, 0x75, 0x6c, 0x61, 0x72, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x0d, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0d, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x73, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0e, - 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x13, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x69, - 0x72, 0x73, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x14, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x13, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x73, - 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x31, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, - 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x06, 0x53, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x2d, + 0x0a, 0x07, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x54, 0x0a, + 0x06, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, 0xc3, 0x0d, 0x0a, + 0x06, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x03, 0x52, 0x75, 0x6e, 0x12, 0x10, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x54, 0x61, 0x73, 0x6b, + 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x2c, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x75, 0x69, + 0x74, 0x65, 0x73, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x69, 0x74, + 0x65, 0x73, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x65, + 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, - 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0x4b, 0x69, 0x6e, 0x64, 0x73, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x54, + 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x1a, 0x11, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, + 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x12, 0x11, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x1a, 0x12, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, + 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, + 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, + 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x69, + 0x74, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x75, 0x67, 0x67, 0x65, + 0x73, 0x74, 0x65, 0x64, 0x41, 0x50, 0x49, 0x73, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x1a, 0x11, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, + 0x74, 0x43, 0x61, 0x73, 0x65, 0x73, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0b, 0x52, 0x75, 0x6e, 0x54, + 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x1a, 0x16, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, + 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x0b, 0x47, + 0x65, 0x74, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x1a, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, + 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x19, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, + 0x53, 0x75, 0x69, 0x74, 0x65, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, + 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x12, 0x19, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, 0x57, + 0x69, 0x74, 0x68, 0x53, 0x75, 0x69, 0x74, 0x65, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x40, + 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, 0x73, 0x65, + 0x12, 0x18, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x61, + 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, + 0x12, 0x38, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x69, + 0x6d, 0x70, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0c, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, + 0x30, 0x0a, 0x0e, 0x50, 0x6f, 0x70, 0x75, 0x6c, 0x61, 0x72, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x73, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x73, 0x22, + 0x00, 0x12, 0x36, 0x0a, 0x0e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x12, 0x13, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x6d, + 0x70, 0x6c, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x73, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x14, 0x46, 0x75, 0x6e, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x12, 0x13, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, + 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x50, 0x61, 0x69, 0x72, 0x73, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x31, 0x0a, 0x0a, 0x47, + 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x4b, 0x69, 0x6e, 0x64, 0x73, 0x22, 0x00, 0x12, 0x2c, - 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x0d, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0e, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x0b, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x0d, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x0b, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x0b, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x56, 0x65, 0x72, - 0x69, 0x66, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, 0x14, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x22, 0x00, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x73, 0x75, 0x72, 0x65, 0x6e, 0x2f, 0x61, - 0x70, 0x69, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2d, + 0x0a, 0x06, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x34, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x4b, 0x69, 0x6e, 0x64, 0x73, 0x12, 0x0d, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x4b, 0x69, 0x6e, 0x64, + 0x73, 0x22, 0x00, 0x12, 0x2c, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, + 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x22, + 0x00, 0x12, 0x2d, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x1a, + 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x00, + 0x12, 0x2d, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, + 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x0d, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x00, 0x12, + 0x2d, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x0d, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x0d, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x00, 0x12, 0x3a, + 0x0a, 0x0b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x13, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x0a, 0x47, 0x65, + 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0c, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0c, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x22, 0x00, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x73, 0x75, 0x72, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2d, + 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1974,7 +2106,7 @@ func file_pkg_server_server_proto_rawDescGZIP() []byte { return file_pkg_server_server_proto_rawDescData } -var file_pkg_server_server_proto_msgTypes = make([]protoimpl.MessageInfo, 30) +var file_pkg_server_server_proto_msgTypes = make([]protoimpl.MessageInfo, 32) var file_pkg_server_server_proto_goTypes = []interface{}{ (*Suites)(nil), // 0: server.Suites (*Items)(nil), // 1: server.Items @@ -2003,15 +2135,17 @@ var file_pkg_server_server_proto_goTypes = []interface{}{ (*SimpleList)(nil), // 24: server.SimpleList (*SimpleName)(nil), // 25: server.SimpleName (*CodeGenerateRequest)(nil), // 26: server.CodeGenerateRequest - (*Empty)(nil), // 27: server.Empty - nil, // 28: server.Suites.DataEntry - nil, // 29: server.TestTask.EnvEntry + (*Secrets)(nil), // 27: server.Secrets + (*Secret)(nil), // 28: server.Secret + (*Empty)(nil), // 29: server.Empty + nil, // 30: server.Suites.DataEntry + nil, // 31: server.TestTask.EnvEntry } var file_pkg_server_server_proto_depIdxs = []int32{ - 28, // 0: server.Suites.data:type_name -> server.Suites.DataEntry + 30, // 0: server.Suites.data:type_name -> server.Suites.DataEntry 16, // 1: server.TestSuite.param:type_name -> server.Pair 4, // 2: server.TestSuite.spec:type_name -> server.APISpec - 29, // 3: server.TestTask.env:type_name -> server.TestTask.EnvEntry + 31, // 3: server.TestTask.env:type_name -> server.TestTask.EnvEntry 15, // 4: server.TestResult.testCaseResult:type_name -> server.TestCaseResult 12, // 5: server.Suite.items:type_name -> server.TestCase 12, // 6: server.TestCaseWithSuite.data:type_name -> server.TestCase @@ -2030,64 +2164,73 @@ var file_pkg_server_server_proto_depIdxs = []int32{ 22, // 19: server.Store.kind:type_name -> server.StoreKind 22, // 20: server.StoreKinds.data:type_name -> server.StoreKind 16, // 21: server.SimpleList.data:type_name -> server.Pair - 1, // 22: server.Suites.DataEntry.value:type_name -> server.Items - 6, // 23: server.Runner.Run:input_type -> server.TestTask - 27, // 24: server.Runner.GetSuites:input_type -> server.Empty - 5, // 25: server.Runner.CreateTestSuite:input_type -> server.TestSuiteIdentity - 5, // 26: server.Runner.GetTestSuite:input_type -> server.TestSuiteIdentity - 3, // 27: server.Runner.UpdateTestSuite:input_type -> server.TestSuite - 5, // 28: server.Runner.DeleteTestSuite:input_type -> server.TestSuiteIdentity - 5, // 29: server.Runner.ListTestCase:input_type -> server.TestSuiteIdentity - 5, // 30: server.Runner.GetSuggestedAPIs:input_type -> server.TestSuiteIdentity - 2, // 31: server.Runner.RunTestCase:input_type -> server.TestCaseIdentity - 2, // 32: server.Runner.GetTestCase:input_type -> server.TestCaseIdentity - 10, // 33: server.Runner.CreateTestCase:input_type -> server.TestCaseWithSuite - 10, // 34: server.Runner.UpdateTestCase:input_type -> server.TestCaseWithSuite - 2, // 35: server.Runner.DeleteTestCase:input_type -> server.TestCaseIdentity - 27, // 36: server.Runner.ListCodeGenerator:input_type -> server.Empty - 26, // 37: server.Runner.GenerateCode:input_type -> server.CodeGenerateRequest - 27, // 38: server.Runner.PopularHeaders:input_type -> server.Empty - 18, // 39: server.Runner.FunctionsQuery:input_type -> server.SimpleQuery - 18, // 40: server.Runner.FunctionsQueryStream:input_type -> server.SimpleQuery - 27, // 41: server.Runner.GetVersion:input_type -> server.Empty - 27, // 42: server.Runner.Sample:input_type -> server.Empty - 27, // 43: server.Runner.GetStoreKinds:input_type -> server.Empty - 27, // 44: server.Runner.GetStores:input_type -> server.Empty - 20, // 45: server.Runner.CreateStore:input_type -> server.Store - 20, // 46: server.Runner.UpdateStore:input_type -> server.Store - 20, // 47: server.Runner.DeleteStore:input_type -> server.Store - 18, // 48: server.Runner.VerifyStore:input_type -> server.SimpleQuery - 7, // 49: server.Runner.Run:output_type -> server.TestResult - 0, // 50: server.Runner.GetSuites:output_type -> server.Suites - 8, // 51: server.Runner.CreateTestSuite:output_type -> server.HelloReply - 3, // 52: server.Runner.GetTestSuite:output_type -> server.TestSuite - 8, // 53: server.Runner.UpdateTestSuite:output_type -> server.HelloReply - 8, // 54: server.Runner.DeleteTestSuite:output_type -> server.HelloReply - 9, // 55: server.Runner.ListTestCase:output_type -> server.Suite - 11, // 56: server.Runner.GetSuggestedAPIs:output_type -> server.TestCases - 15, // 57: server.Runner.RunTestCase:output_type -> server.TestCaseResult - 12, // 58: server.Runner.GetTestCase:output_type -> server.TestCase - 8, // 59: server.Runner.CreateTestCase:output_type -> server.HelloReply - 8, // 60: server.Runner.UpdateTestCase:output_type -> server.HelloReply - 8, // 61: server.Runner.DeleteTestCase:output_type -> server.HelloReply - 24, // 62: server.Runner.ListCodeGenerator:output_type -> server.SimpleList - 23, // 63: server.Runner.GenerateCode:output_type -> server.CommonResult - 17, // 64: server.Runner.PopularHeaders:output_type -> server.Pairs - 17, // 65: server.Runner.FunctionsQuery:output_type -> server.Pairs - 17, // 66: server.Runner.FunctionsQueryStream:output_type -> server.Pairs - 8, // 67: server.Runner.GetVersion:output_type -> server.HelloReply - 8, // 68: server.Runner.Sample:output_type -> server.HelloReply - 21, // 69: server.Runner.GetStoreKinds:output_type -> server.StoreKinds - 19, // 70: server.Runner.GetStores:output_type -> server.Stores - 20, // 71: server.Runner.CreateStore:output_type -> server.Store - 20, // 72: server.Runner.UpdateStore:output_type -> server.Store - 20, // 73: server.Runner.DeleteStore:output_type -> server.Store - 23, // 74: server.Runner.VerifyStore:output_type -> server.CommonResult - 49, // [49:75] is the sub-list for method output_type - 23, // [23:49] is the sub-list for method input_type - 23, // [23:23] is the sub-list for extension type_name - 23, // [23:23] is the sub-list for extension extendee - 0, // [0:23] is the sub-list for field type_name + 28, // 22: server.Secrets.data:type_name -> server.Secret + 1, // 23: server.Suites.DataEntry.value:type_name -> server.Items + 6, // 24: server.Runner.Run:input_type -> server.TestTask + 29, // 25: server.Runner.GetSuites:input_type -> server.Empty + 5, // 26: server.Runner.CreateTestSuite:input_type -> server.TestSuiteIdentity + 5, // 27: server.Runner.GetTestSuite:input_type -> server.TestSuiteIdentity + 3, // 28: server.Runner.UpdateTestSuite:input_type -> server.TestSuite + 5, // 29: server.Runner.DeleteTestSuite:input_type -> server.TestSuiteIdentity + 5, // 30: server.Runner.ListTestCase:input_type -> server.TestSuiteIdentity + 5, // 31: server.Runner.GetSuggestedAPIs:input_type -> server.TestSuiteIdentity + 2, // 32: server.Runner.RunTestCase:input_type -> server.TestCaseIdentity + 2, // 33: server.Runner.GetTestCase:input_type -> server.TestCaseIdentity + 10, // 34: server.Runner.CreateTestCase:input_type -> server.TestCaseWithSuite + 10, // 35: server.Runner.UpdateTestCase:input_type -> server.TestCaseWithSuite + 2, // 36: server.Runner.DeleteTestCase:input_type -> server.TestCaseIdentity + 29, // 37: server.Runner.ListCodeGenerator:input_type -> server.Empty + 26, // 38: server.Runner.GenerateCode:input_type -> server.CodeGenerateRequest + 29, // 39: server.Runner.PopularHeaders:input_type -> server.Empty + 18, // 40: server.Runner.FunctionsQuery:input_type -> server.SimpleQuery + 18, // 41: server.Runner.FunctionsQueryStream:input_type -> server.SimpleQuery + 29, // 42: server.Runner.GetVersion:input_type -> server.Empty + 29, // 43: server.Runner.Sample:input_type -> server.Empty + 29, // 44: server.Runner.GetStoreKinds:input_type -> server.Empty + 29, // 45: server.Runner.GetStores:input_type -> server.Empty + 20, // 46: server.Runner.CreateStore:input_type -> server.Store + 20, // 47: server.Runner.UpdateStore:input_type -> server.Store + 20, // 48: server.Runner.DeleteStore:input_type -> server.Store + 18, // 49: server.Runner.VerifyStore:input_type -> server.SimpleQuery + 29, // 50: server.Runner.GetSecrets:input_type -> server.Empty + 28, // 51: server.Runner.CreateSecret:input_type -> server.Secret + 28, // 52: server.Runner.DeleteSecret:input_type -> server.Secret + 28, // 53: server.Runner.UpdateSecret:input_type -> server.Secret + 7, // 54: server.Runner.Run:output_type -> server.TestResult + 0, // 55: server.Runner.GetSuites:output_type -> server.Suites + 8, // 56: server.Runner.CreateTestSuite:output_type -> server.HelloReply + 3, // 57: server.Runner.GetTestSuite:output_type -> server.TestSuite + 8, // 58: server.Runner.UpdateTestSuite:output_type -> server.HelloReply + 8, // 59: server.Runner.DeleteTestSuite:output_type -> server.HelloReply + 9, // 60: server.Runner.ListTestCase:output_type -> server.Suite + 11, // 61: server.Runner.GetSuggestedAPIs:output_type -> server.TestCases + 15, // 62: server.Runner.RunTestCase:output_type -> server.TestCaseResult + 12, // 63: server.Runner.GetTestCase:output_type -> server.TestCase + 8, // 64: server.Runner.CreateTestCase:output_type -> server.HelloReply + 8, // 65: server.Runner.UpdateTestCase:output_type -> server.HelloReply + 8, // 66: server.Runner.DeleteTestCase:output_type -> server.HelloReply + 24, // 67: server.Runner.ListCodeGenerator:output_type -> server.SimpleList + 23, // 68: server.Runner.GenerateCode:output_type -> server.CommonResult + 17, // 69: server.Runner.PopularHeaders:output_type -> server.Pairs + 17, // 70: server.Runner.FunctionsQuery:output_type -> server.Pairs + 17, // 71: server.Runner.FunctionsQueryStream:output_type -> server.Pairs + 8, // 72: server.Runner.GetVersion:output_type -> server.HelloReply + 8, // 73: server.Runner.Sample:output_type -> server.HelloReply + 21, // 74: server.Runner.GetStoreKinds:output_type -> server.StoreKinds + 19, // 75: server.Runner.GetStores:output_type -> server.Stores + 20, // 76: server.Runner.CreateStore:output_type -> server.Store + 20, // 77: server.Runner.UpdateStore:output_type -> server.Store + 20, // 78: server.Runner.DeleteStore:output_type -> server.Store + 23, // 79: server.Runner.VerifyStore:output_type -> server.CommonResult + 27, // 80: server.Runner.GetSecrets:output_type -> server.Secrets + 23, // 81: server.Runner.CreateSecret:output_type -> server.CommonResult + 23, // 82: server.Runner.DeleteSecret:output_type -> server.CommonResult + 23, // 83: server.Runner.UpdateSecret:output_type -> server.CommonResult + 54, // [54:84] is the sub-list for method output_type + 24, // [24:54] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name } func init() { file_pkg_server_server_proto_init() } @@ -2421,6 +2564,30 @@ func file_pkg_server_server_proto_init() { } } file_pkg_server_server_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Secrets); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_server_server_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Secret); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_server_server_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Empty); i { case 0: return &v.state @@ -2439,7 +2606,7 @@ func file_pkg_server_server_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pkg_server_server_proto_rawDesc, NumEnums: 0, - NumMessages: 30, + NumMessages: 32, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/server/server.pb.gw.go b/pkg/server/server.pb.gw.go index f7a128d4..2bcf3ab9 100644 --- a/pkg/server/server.pb.gw.go +++ b/pkg/server/server.pb.gw.go @@ -924,6 +924,142 @@ func local_request_Runner_VerifyStore_0(ctx context.Context, marshaler runtime.M } +func request_Runner_GetSecrets_0(ctx context.Context, marshaler runtime.Marshaler, client RunnerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Empty + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetSecrets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Runner_GetSecrets_0(ctx context.Context, marshaler runtime.Marshaler, server RunnerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Empty + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetSecrets(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Runner_CreateSecret_0(ctx context.Context, marshaler runtime.Marshaler, client RunnerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Secret + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateSecret(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Runner_CreateSecret_0(ctx context.Context, marshaler runtime.Marshaler, server RunnerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Secret + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateSecret(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Runner_DeleteSecret_0(ctx context.Context, marshaler runtime.Marshaler, client RunnerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Secret + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DeleteSecret(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Runner_DeleteSecret_0(ctx context.Context, marshaler runtime.Marshaler, server RunnerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Secret + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DeleteSecret(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Runner_UpdateSecret_0(ctx context.Context, marshaler runtime.Marshaler, client RunnerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Secret + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateSecret(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Runner_UpdateSecret_0(ctx context.Context, marshaler runtime.Marshaler, server RunnerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq Secret + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateSecret(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterRunnerHandlerServer registers the http handlers for service Runner to "mux". // UnaryRPC :call RunnerServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -1562,6 +1698,106 @@ func RegisterRunnerHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) + mux.Handle("POST", pattern_Runner_GetSecrets_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, "/server.Runner/GetSecrets", runtime.WithHTTPPathPattern("/server.Runner/GetSecrets")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Runner_GetSecrets_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_Runner_GetSecrets_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Runner_CreateSecret_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, "/server.Runner/CreateSecret", runtime.WithHTTPPathPattern("/server.Runner/CreateSecret")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Runner_CreateSecret_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_Runner_CreateSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Runner_DeleteSecret_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, "/server.Runner/DeleteSecret", runtime.WithHTTPPathPattern("/server.Runner/DeleteSecret")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Runner_DeleteSecret_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_Runner_DeleteSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Runner_UpdateSecret_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, "/server.Runner/UpdateSecret", runtime.WithHTTPPathPattern("/server.Runner/UpdateSecret")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Runner_UpdateSecret_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_Runner_UpdateSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -2175,6 +2411,94 @@ func RegisterRunnerHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) + mux.Handle("POST", pattern_Runner_GetSecrets_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, "/server.Runner/GetSecrets", runtime.WithHTTPPathPattern("/server.Runner/GetSecrets")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Runner_GetSecrets_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Runner_GetSecrets_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Runner_CreateSecret_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, "/server.Runner/CreateSecret", runtime.WithHTTPPathPattern("/server.Runner/CreateSecret")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Runner_CreateSecret_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Runner_CreateSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Runner_DeleteSecret_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, "/server.Runner/DeleteSecret", runtime.WithHTTPPathPattern("/server.Runner/DeleteSecret")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Runner_DeleteSecret_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Runner_DeleteSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Runner_UpdateSecret_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, "/server.Runner/UpdateSecret", runtime.WithHTTPPathPattern("/server.Runner/UpdateSecret")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Runner_UpdateSecret_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_Runner_UpdateSecret_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -2230,6 +2554,14 @@ var ( pattern_Runner_DeleteStore_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"server.Runner", "DeleteStore"}, "")) pattern_Runner_VerifyStore_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"server.Runner", "VerifyStore"}, "")) + + pattern_Runner_GetSecrets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"server.Runner", "GetSecrets"}, "")) + + pattern_Runner_CreateSecret_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"server.Runner", "CreateSecret"}, "")) + + pattern_Runner_DeleteSecret_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"server.Runner", "DeleteSecret"}, "")) + + pattern_Runner_UpdateSecret_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"server.Runner", "UpdateSecret"}, "")) ) var ( @@ -2284,4 +2616,12 @@ var ( forward_Runner_DeleteStore_0 = runtime.ForwardResponseMessage forward_Runner_VerifyStore_0 = runtime.ForwardResponseMessage + + forward_Runner_GetSecrets_0 = runtime.ForwardResponseMessage + + forward_Runner_CreateSecret_0 = runtime.ForwardResponseMessage + + forward_Runner_DeleteSecret_0 = runtime.ForwardResponseMessage + + forward_Runner_UpdateSecret_0 = runtime.ForwardResponseMessage ) diff --git a/pkg/server/server.proto b/pkg/server/server.proto index 37bdc9d8..8555730d 100644 --- a/pkg/server/server.proto +++ b/pkg/server/server.proto @@ -41,6 +41,12 @@ service Runner { rpc UpdateStore(Store) returns (Store) {} rpc DeleteStore(Store) returns (Store) {} rpc VerifyStore(SimpleQuery) returns (CommonResult) {} + + // secret related interfaces + rpc GetSecrets(Empty) returns (Secrets) {} + rpc CreateSecret(Secret) returns (CommonResult) {} + rpc DeleteSecret(Secret) returns (CommonResult) {} + rpc UpdateSecret(Secret) returns (CommonResult) {} } message Suites { @@ -197,5 +203,15 @@ message CodeGenerateRequest { string Generator = 3; } +message Secrets { + repeated Secret data = 1; +} + +message Secret { + string Name = 1; + string Value = 2; + string Description = 3; +} + message Empty { } diff --git a/pkg/server/server_grpc.pb.go b/pkg/server/server_grpc.pb.go index cfdb004a..4f5ea71c 100644 --- a/pkg/server/server_grpc.pb.go +++ b/pkg/server/server_grpc.pb.go @@ -53,6 +53,11 @@ type RunnerClient interface { UpdateStore(ctx context.Context, in *Store, opts ...grpc.CallOption) (*Store, error) DeleteStore(ctx context.Context, in *Store, opts ...grpc.CallOption) (*Store, error) VerifyStore(ctx context.Context, in *SimpleQuery, opts ...grpc.CallOption) (*CommonResult, error) + // secret related interfaces + GetSecrets(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Secrets, error) + CreateSecret(ctx context.Context, in *Secret, opts ...grpc.CallOption) (*CommonResult, error) + DeleteSecret(ctx context.Context, in *Secret, opts ...grpc.CallOption) (*CommonResult, error) + UpdateSecret(ctx context.Context, in *Secret, opts ...grpc.CallOption) (*CommonResult, error) } type runnerClient struct { @@ -319,6 +324,42 @@ func (c *runnerClient) VerifyStore(ctx context.Context, in *SimpleQuery, opts .. return out, nil } +func (c *runnerClient) GetSecrets(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Secrets, error) { + out := new(Secrets) + err := c.cc.Invoke(ctx, "/server.Runner/GetSecrets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *runnerClient) CreateSecret(ctx context.Context, in *Secret, opts ...grpc.CallOption) (*CommonResult, error) { + out := new(CommonResult) + err := c.cc.Invoke(ctx, "/server.Runner/CreateSecret", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *runnerClient) DeleteSecret(ctx context.Context, in *Secret, opts ...grpc.CallOption) (*CommonResult, error) { + out := new(CommonResult) + err := c.cc.Invoke(ctx, "/server.Runner/DeleteSecret", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *runnerClient) UpdateSecret(ctx context.Context, in *Secret, opts ...grpc.CallOption) (*CommonResult, error) { + out := new(CommonResult) + err := c.cc.Invoke(ctx, "/server.Runner/UpdateSecret", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // RunnerServer is the server API for Runner service. // All implementations must embed UnimplementedRunnerServer // for forward compatibility @@ -354,6 +395,11 @@ type RunnerServer interface { UpdateStore(context.Context, *Store) (*Store, error) DeleteStore(context.Context, *Store) (*Store, error) VerifyStore(context.Context, *SimpleQuery) (*CommonResult, error) + // secret related interfaces + GetSecrets(context.Context, *Empty) (*Secrets, error) + CreateSecret(context.Context, *Secret) (*CommonResult, error) + DeleteSecret(context.Context, *Secret) (*CommonResult, error) + UpdateSecret(context.Context, *Secret) (*CommonResult, error) mustEmbedUnimplementedRunnerServer() } @@ -439,6 +485,18 @@ func (UnimplementedRunnerServer) DeleteStore(context.Context, *Store) (*Store, e func (UnimplementedRunnerServer) VerifyStore(context.Context, *SimpleQuery) (*CommonResult, error) { return nil, status.Errorf(codes.Unimplemented, "method VerifyStore not implemented") } +func (UnimplementedRunnerServer) GetSecrets(context.Context, *Empty) (*Secrets, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSecrets not implemented") +} +func (UnimplementedRunnerServer) CreateSecret(context.Context, *Secret) (*CommonResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateSecret not implemented") +} +func (UnimplementedRunnerServer) DeleteSecret(context.Context, *Secret) (*CommonResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteSecret not implemented") +} +func (UnimplementedRunnerServer) UpdateSecret(context.Context, *Secret) (*CommonResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSecret not implemented") +} func (UnimplementedRunnerServer) mustEmbedUnimplementedRunnerServer() {} // UnsafeRunnerServer may be embedded to opt out of forward compatibility for this service. @@ -928,6 +986,78 @@ func _Runner_VerifyStore_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Runner_GetSecrets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RunnerServer).GetSecrets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/server.Runner/GetSecrets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RunnerServer).GetSecrets(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _Runner_CreateSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Secret) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RunnerServer).CreateSecret(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/server.Runner/CreateSecret", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RunnerServer).CreateSecret(ctx, req.(*Secret)) + } + return interceptor(ctx, in, info, handler) +} + +func _Runner_DeleteSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Secret) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RunnerServer).DeleteSecret(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/server.Runner/DeleteSecret", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RunnerServer).DeleteSecret(ctx, req.(*Secret)) + } + return interceptor(ctx, in, info, handler) +} + +func _Runner_UpdateSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Secret) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RunnerServer).UpdateSecret(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/server.Runner/UpdateSecret", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RunnerServer).UpdateSecret(ctx, req.(*Secret)) + } + return interceptor(ctx, in, info, handler) +} + // Runner_ServiceDesc is the grpc.ServiceDesc for Runner service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -1035,6 +1165,22 @@ var Runner_ServiceDesc = grpc.ServiceDesc{ MethodName: "VerifyStore", Handler: _Runner_VerifyStore_Handler, }, + { + MethodName: "GetSecrets", + Handler: _Runner_GetSecrets_Handler, + }, + { + MethodName: "CreateSecret", + Handler: _Runner_CreateSecret_Handler, + }, + { + MethodName: "DeleteSecret", + Handler: _Runner_DeleteSecret_Handler, + }, + { + MethodName: "UpdateSecret", + Handler: _Runner_UpdateSecret_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/pkg/testing/remote/converter_test.go b/pkg/testing/remote/converter_test.go index f667190b..91c70330 100644 --- a/pkg/testing/remote/converter_test.go +++ b/pkg/testing/remote/converter_test.go @@ -22,12 +22,18 @@ func TestConvert(t *testing.T) { Kind: "http", URL: "/v1", }, + Items: []atest.TestCase{{ + Name: "fake", + }}, }, ConvertToNormalTestSuite(&TestSuite{ Param: defaultPairs, Spec: &server.APISpec{ Url: "/v1", Kind: "http", }, + Items: []*server.TestCase{{ + Name: "fake", + }}, })) }) @@ -35,6 +41,9 @@ func TestConvert(t *testing.T) { result := ConvertToGRPCTestSuite(&atest.TestSuite{ API: "v1", Param: defaultMap, + Items: []atest.TestCase{{ + Name: "fake", + }}, }) assert.Equal(t, "v1", result.Api) assert.Equal(t, defaultPairs, result.Param) diff --git a/pkg/testing/remote/grpc_secret.go b/pkg/testing/remote/grpc_secret.go new file mode 100644 index 00000000..3d350572 --- /dev/null +++ b/pkg/testing/remote/grpc_secret.go @@ -0,0 +1,92 @@ +/* +MIT License + +Copyright (c) 2023 API Testing Authors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +package remote + +import ( + context "context" + + "github.com/linuxsuren/api-testing/pkg/secret" + "github.com/linuxsuren/api-testing/pkg/server" + "google.golang.org/grpc" +) + +type gRPCSecret struct { + UnimplementedSecretServiceServer + client SecretServiceClient +} + +func NewGRPCSecretFrom(address string) (server SecretServiceServer, err error) { + server = &gRPCSecret{} + var conn *grpc.ClientConn + if conn, err = grpc.Dial(address, grpc.WithInsecure()); err == nil { + server = &gRPCSecret{ + client: NewSecretServiceClient(conn), + } + } + return +} + +func (s *gRPCSecret) GetSecret(ctx context.Context, in *server.Secret) (reply *server.Secret, err error) { + return s.client.GetSecret(ctx, in) +} + +func (s *gRPCSecret) GetSecrets(ctx context.Context, in *server.Empty) (reply *server.Secrets, err error) { + return s.client.GetSecrets(ctx, in) +} + +func (s *gRPCSecret) CreateSecret(ctx context.Context, in *server.Secret) (reply *server.CommonResult, err error) { + return s.client.CreateSecret(ctx, in) +} + +func (s *gRPCSecret) DeleteSecret(ctx context.Context, in *server.Secret) (reply *server.CommonResult, err error) { + return s.client.DeleteSecret(ctx, in) +} + +func (s *gRPCSecret) UpdateSecret(ctx context.Context, in *server.Secret) (reply *server.CommonResult, err error) { + return s.client.UpdateSecret(ctx, in) +} + +// make sure gRPCSecret implemented SecretServiceClient +var _ SecretServiceServer = &gRPCSecret{} + +type grpcSecretGetter struct { + remoteServer server.SecertServiceGetable +} + +func NewGRPCSecretGetter(remoteServer server.SecertServiceGetable) secret.SecretGetter { + return &grpcSecretGetter{ + remoteServer: remoteServer, + } +} + +func (s *grpcSecretGetter) GetSecret(name string) (reply secret.Secret, err error) { + var result *server.Secret + if result, err = s.remoteServer.GetSecret(context.Background(), + &server.Secret{Name: name}); err == nil && result != nil { + reply.Name = result.Name + reply.Value = result.Value + } + return +} diff --git a/pkg/testing/remote/grpc_secret_test.go b/pkg/testing/remote/grpc_secret_test.go new file mode 100644 index 00000000..94cad11d --- /dev/null +++ b/pkg/testing/remote/grpc_secret_test.go @@ -0,0 +1,93 @@ +/* +MIT License + +Copyright (c) 2023 API Testing Authors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +package remote + +import ( + context "context" + "errors" + "testing" + + "github.com/linuxsuren/api-testing/pkg/secret" + server "github.com/linuxsuren/api-testing/pkg/server" + "github.com/stretchr/testify/assert" +) + +func TestGetSecret(t *testing.T) { + t.Run("no err", func(t *testing.T) { + getter := NewGRPCSecretGetter(&fakeSecretGetter{ + secret: &server.Secret{ + Name: "fake", + Value: "value", + }, + }) + result, err := getter.GetSecret("fake") + assert.Nil(t, err) + assert.Equal(t, secret.Secret{ + Name: "fake", + Value: "value", + }, result) + }) + + t.Run("have err", func(t *testing.T) { + getter := NewGRPCSecretGetter(&fakeSecretGetter{ + err: errors.New("fake"), + }) + secret, err := getter.GetSecret("fake") + assert.NotNil(t, err) + assert.NotNil(t, secret) + }) + + secretServer, err := NewGRPCSecretFrom("fake") + assert.Nil(t, err) + assert.NotNil(t, secretServer) + + ctx := context.Background() + _, err = secretServer.GetSecret(ctx, &server.Secret{Name: "fake"}) + assert.NotNil(t, err) + + _, err = secretServer.GetSecrets(ctx, &server.Empty{}) + assert.NotNil(t, err) + + _, err = secretServer.CreateSecret(ctx, &server.Secret{}) + assert.NotNil(t, err) + + _, err = secretServer.DeleteSecret(ctx, &server.Secret{}) + assert.NotNil(t, err) + + _, err = secretServer.UpdateSecret(ctx, &server.Secret{}) + assert.NotNil(t, err) +} + +type fakeSecretGetter struct { + secret *server.Secret + err error +} + +func (f *fakeSecretGetter) GetSecret(context.Context, *server.Secret) ( + secret *server.Secret, err error) { + secret = f.secret + err = f.err + return +} diff --git a/pkg/testing/remote/grpc.go b/pkg/testing/remote/grpc_store.go similarity index 79% rename from pkg/testing/remote/grpc.go rename to pkg/testing/remote/grpc_store.go index b036b12e..310e722c 100644 --- a/pkg/testing/remote/grpc.go +++ b/pkg/testing/remote/grpc_store.go @@ -1,3 +1,27 @@ +/* +MIT License + +Copyright (c) 2023 API Testing Authors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + package remote import ( diff --git a/pkg/testing/remote/grpc_store_test.go b/pkg/testing/remote/grpc_store_test.go new file mode 100644 index 00000000..ba3e5f12 --- /dev/null +++ b/pkg/testing/remote/grpc_store_test.go @@ -0,0 +1,105 @@ +/* +MIT License + +Copyright (c) 2023 API Testing Authors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +package remote + +import ( + "testing" + + atest "github.com/linuxsuren/api-testing/pkg/testing" + "github.com/stretchr/testify/assert" +) + +func TestNewGRPCLoader(t *testing.T) { + factory := NewGRPCloaderFromStore() + + t.Run("invalid address", func(t *testing.T) { + writer, err := factory.NewInstance(atest.Store{}) + assert.Error(t, err) + assert.Nil(t, writer) + }) + + t.Run("valid address", func(t *testing.T) { + writer, err := factory.NewInstance(atest.Store{ + Kind: atest.StoreKind{ + URL: "localhost:7070", + }, + }) + assert.NoError(t, err) + assert.NotNil(t, writer) + + assert.False(t, writer.HasMore()) + var data []byte + data, err = writer.Load() + assert.NoError(t, err) + assert.Nil(t, data) + + assert.NoError(t, writer.Put("foo")) + + assert.Empty(t, writer.GetContext()) + + assert.Equal(t, 0, writer.GetCount()) + writer.Reset() + + _, err = writer.ListTestCase("") + assert.Error(t, err) + + _, err = writer.GetTestCase("", "") + assert.Error(t, err) + + err = writer.CreateTestCase("", atest.TestCase{}) + assert.Error(t, err) + + err = writer.UpdateTestCase("", atest.TestCase{}) + assert.Error(t, err) + + err = writer.DeleteTestCase("", "") + assert.Error(t, err) + + _, err = writer.ListTestSuite() + assert.Error(t, err) + + _, err = writer.GetTestSuite("", false) + assert.Error(t, err) + + err = writer.CreateSuite("", "") + assert.Error(t, err) + + _, _, err = writer.GetSuite("") + assert.Error(t, err) + + err = writer.UpdateSuite(atest.TestSuite{}) + assert.Error(t, err) + + err = writer.DeleteSuite("") + assert.Error(t, err) + + err = writer.Verify() + assert.Error(t, err) + }) + + t.Run("NewGRPCloaderFromStore", func(t *testing.T) { + assert.NotNil(t, NewGRPCloaderFromStore()) + }) +} diff --git a/pkg/testing/remote/grpc_test.go b/pkg/testing/remote/grpc_test.go deleted file mode 100644 index 84eb0375..00000000 --- a/pkg/testing/remote/grpc_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package remote - -import ( - "testing" - - atest "github.com/linuxsuren/api-testing/pkg/testing" - "github.com/stretchr/testify/assert" -) - -func TestNewGRPCLoader(t *testing.T) { - factory := NewGRPCloaderFromStore() - - t.Run("invalid address", func(t *testing.T) { - writer, err := factory.NewInstance(atest.Store{}) - assert.Error(t, err) - assert.Nil(t, writer) - }) - - t.Run("valid address", func(t *testing.T) { - writer, err := factory.NewInstance(atest.Store{ - Kind: atest.StoreKind{ - URL: "localhost:7070", - }, - }) - assert.NoError(t, err) - assert.NotNil(t, writer) - - assert.False(t, writer.HasMore()) - var data []byte - data, err = writer.Load() - assert.NoError(t, err) - assert.Nil(t, data) - - assert.NoError(t, writer.Put("foo")) - - assert.Empty(t, writer.GetContext()) - - assert.Equal(t, 0, writer.GetCount()) - writer.Reset() - }) - - t.Run("NewGRPCloaderFromStore", func(t *testing.T) { - assert.NotNil(t, NewGRPCloaderFromStore()) - }) -} diff --git a/pkg/testing/remote/loader.pb.go b/pkg/testing/remote/loader.pb.go index 81cca706..7e3b26a8 100644 --- a/pkg/testing/remote/loader.pb.go +++ b/pkg/testing/remote/loader.pb.go @@ -215,11 +215,28 @@ var file_pkg_testing_remote_loader_proto_rawDesc = []byte{ 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x06, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x22, 0x00, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x73, 0x75, 0x72, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, - 0x2d, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x74, 0x22, 0x00, 0x32, 0x96, 0x02, 0x0a, 0x0d, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x1a, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x73, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x1a, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x73, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0c, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x14, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x1a, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x00, 0x42, 0x36, 0x5a, 0x34, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x75, 0x78, + 0x73, 0x75, 0x72, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -242,8 +259,10 @@ var file_pkg_testing_remote_loader_proto_goTypes = []interface{}{ (*server.APISpec)(nil), // 3: server.APISpec (*server.TestCase)(nil), // 4: server.TestCase (*server.Empty)(nil), // 5: server.Empty - (*server.TestCases)(nil), // 6: server.TestCases - (*server.CommonResult)(nil), // 7: server.CommonResult + (*server.Secret)(nil), // 6: server.Secret + (*server.TestCases)(nil), // 7: server.TestCases + (*server.CommonResult)(nil), // 8: server.CommonResult + (*server.Secrets)(nil), // 9: server.Secrets } var file_pkg_testing_remote_loader_proto_depIdxs = []int32{ 1, // 0: remote.TestSuites.data:type_name -> remote.TestSuite @@ -261,19 +280,29 @@ var file_pkg_testing_remote_loader_proto_depIdxs = []int32{ 4, // 12: remote.Loader.UpdateTestCase:input_type -> server.TestCase 4, // 13: remote.Loader.DeleteTestCase:input_type -> server.TestCase 5, // 14: remote.Loader.Verify:input_type -> server.Empty - 0, // 15: remote.Loader.ListTestSuite:output_type -> remote.TestSuites - 5, // 16: remote.Loader.CreateTestSuite:output_type -> server.Empty - 1, // 17: remote.Loader.GetTestSuite:output_type -> remote.TestSuite - 1, // 18: remote.Loader.UpdateTestSuite:output_type -> remote.TestSuite - 5, // 19: remote.Loader.DeleteTestSuite:output_type -> server.Empty - 6, // 20: remote.Loader.ListTestCases:output_type -> server.TestCases - 5, // 21: remote.Loader.CreateTestCase:output_type -> server.Empty - 4, // 22: remote.Loader.GetTestCase:output_type -> server.TestCase - 4, // 23: remote.Loader.UpdateTestCase:output_type -> server.TestCase - 5, // 24: remote.Loader.DeleteTestCase:output_type -> server.Empty - 7, // 25: remote.Loader.Verify:output_type -> server.CommonResult - 15, // [15:26] is the sub-list for method output_type - 4, // [4:15] is the sub-list for method input_type + 6, // 15: remote.SecretService.GetSecret:input_type -> server.Secret + 5, // 16: remote.SecretService.GetSecrets:input_type -> server.Empty + 6, // 17: remote.SecretService.CreateSecret:input_type -> server.Secret + 6, // 18: remote.SecretService.DeleteSecret:input_type -> server.Secret + 6, // 19: remote.SecretService.UpdateSecret:input_type -> server.Secret + 0, // 20: remote.Loader.ListTestSuite:output_type -> remote.TestSuites + 5, // 21: remote.Loader.CreateTestSuite:output_type -> server.Empty + 1, // 22: remote.Loader.GetTestSuite:output_type -> remote.TestSuite + 1, // 23: remote.Loader.UpdateTestSuite:output_type -> remote.TestSuite + 5, // 24: remote.Loader.DeleteTestSuite:output_type -> server.Empty + 7, // 25: remote.Loader.ListTestCases:output_type -> server.TestCases + 5, // 26: remote.Loader.CreateTestCase:output_type -> server.Empty + 4, // 27: remote.Loader.GetTestCase:output_type -> server.TestCase + 4, // 28: remote.Loader.UpdateTestCase:output_type -> server.TestCase + 5, // 29: remote.Loader.DeleteTestCase:output_type -> server.Empty + 8, // 30: remote.Loader.Verify:output_type -> server.CommonResult + 6, // 31: remote.SecretService.GetSecret:output_type -> server.Secret + 9, // 32: remote.SecretService.GetSecrets:output_type -> server.Secrets + 8, // 33: remote.SecretService.CreateSecret:output_type -> server.CommonResult + 8, // 34: remote.SecretService.DeleteSecret:output_type -> server.CommonResult + 8, // 35: remote.SecretService.UpdateSecret:output_type -> server.CommonResult + 20, // [20:36] is the sub-list for method output_type + 4, // [4:20] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name 4, // [4:4] is the sub-list for extension extendee 0, // [0:4] is the sub-list for field type_name @@ -318,7 +347,7 @@ func file_pkg_testing_remote_loader_proto_init() { NumEnums: 0, NumMessages: 2, NumExtensions: 0, - NumServices: 1, + NumServices: 2, }, GoTypes: file_pkg_testing_remote_loader_proto_goTypes, DependencyIndexes: file_pkg_testing_remote_loader_proto_depIdxs, diff --git a/pkg/testing/remote/loader.proto b/pkg/testing/remote/loader.proto index 68446300..f426cfb0 100644 --- a/pkg/testing/remote/loader.proto +++ b/pkg/testing/remote/loader.proto @@ -34,3 +34,11 @@ message TestSuite { repeated server.TestCase items = 5; bool full = 6; } + +service SecretService { + rpc GetSecret(server.Secret) returns (server.Secret) {} + rpc GetSecrets(server.Empty) returns (server.Secrets) {} + rpc CreateSecret(server.Secret) returns (server.CommonResult) {} + rpc DeleteSecret(server.Secret) returns (server.CommonResult) {} + rpc UpdateSecret(server.Secret) returns (server.CommonResult) {} +} diff --git a/pkg/testing/remote/loader_grpc.pb.go b/pkg/testing/remote/loader_grpc.pb.go index 372c17f9..8eb7d3fc 100644 --- a/pkg/testing/remote/loader_grpc.pb.go +++ b/pkg/testing/remote/loader_grpc.pb.go @@ -464,3 +464,233 @@ var Loader_ServiceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "pkg/testing/remote/loader.proto", } + +// SecretServiceClient is the client API for SecretService 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 SecretServiceClient interface { + GetSecret(ctx context.Context, in *server.Secret, opts ...grpc.CallOption) (*server.Secret, error) + GetSecrets(ctx context.Context, in *server.Empty, opts ...grpc.CallOption) (*server.Secrets, error) + CreateSecret(ctx context.Context, in *server.Secret, opts ...grpc.CallOption) (*server.CommonResult, error) + DeleteSecret(ctx context.Context, in *server.Secret, opts ...grpc.CallOption) (*server.CommonResult, error) + UpdateSecret(ctx context.Context, in *server.Secret, opts ...grpc.CallOption) (*server.CommonResult, error) +} + +type secretServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSecretServiceClient(cc grpc.ClientConnInterface) SecretServiceClient { + return &secretServiceClient{cc} +} + +func (c *secretServiceClient) GetSecret(ctx context.Context, in *server.Secret, opts ...grpc.CallOption) (*server.Secret, error) { + out := new(server.Secret) + err := c.cc.Invoke(ctx, "/remote.SecretService/GetSecret", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *secretServiceClient) GetSecrets(ctx context.Context, in *server.Empty, opts ...grpc.CallOption) (*server.Secrets, error) { + out := new(server.Secrets) + err := c.cc.Invoke(ctx, "/remote.SecretService/GetSecrets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *secretServiceClient) CreateSecret(ctx context.Context, in *server.Secret, opts ...grpc.CallOption) (*server.CommonResult, error) { + out := new(server.CommonResult) + err := c.cc.Invoke(ctx, "/remote.SecretService/CreateSecret", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *secretServiceClient) DeleteSecret(ctx context.Context, in *server.Secret, opts ...grpc.CallOption) (*server.CommonResult, error) { + out := new(server.CommonResult) + err := c.cc.Invoke(ctx, "/remote.SecretService/DeleteSecret", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *secretServiceClient) UpdateSecret(ctx context.Context, in *server.Secret, opts ...grpc.CallOption) (*server.CommonResult, error) { + out := new(server.CommonResult) + err := c.cc.Invoke(ctx, "/remote.SecretService/UpdateSecret", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SecretServiceServer is the server API for SecretService service. +// All implementations must embed UnimplementedSecretServiceServer +// for forward compatibility +type SecretServiceServer interface { + GetSecret(context.Context, *server.Secret) (*server.Secret, error) + GetSecrets(context.Context, *server.Empty) (*server.Secrets, error) + CreateSecret(context.Context, *server.Secret) (*server.CommonResult, error) + DeleteSecret(context.Context, *server.Secret) (*server.CommonResult, error) + UpdateSecret(context.Context, *server.Secret) (*server.CommonResult, error) + mustEmbedUnimplementedSecretServiceServer() +} + +// UnimplementedSecretServiceServer must be embedded to have forward compatible implementations. +type UnimplementedSecretServiceServer struct { +} + +func (UnimplementedSecretServiceServer) GetSecret(context.Context, *server.Secret) (*server.Secret, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSecret not implemented") +} +func (UnimplementedSecretServiceServer) GetSecrets(context.Context, *server.Empty) (*server.Secrets, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSecrets not implemented") +} +func (UnimplementedSecretServiceServer) CreateSecret(context.Context, *server.Secret) (*server.CommonResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateSecret not implemented") +} +func (UnimplementedSecretServiceServer) DeleteSecret(context.Context, *server.Secret) (*server.CommonResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteSecret not implemented") +} +func (UnimplementedSecretServiceServer) UpdateSecret(context.Context, *server.Secret) (*server.CommonResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSecret not implemented") +} +func (UnimplementedSecretServiceServer) mustEmbedUnimplementedSecretServiceServer() {} + +// UnsafeSecretServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SecretServiceServer will +// result in compilation errors. +type UnsafeSecretServiceServer interface { + mustEmbedUnimplementedSecretServiceServer() +} + +func RegisterSecretServiceServer(s grpc.ServiceRegistrar, srv SecretServiceServer) { + s.RegisterService(&SecretService_ServiceDesc, srv) +} + +func _SecretService_GetSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(server.Secret) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SecretServiceServer).GetSecret(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/remote.SecretService/GetSecret", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SecretServiceServer).GetSecret(ctx, req.(*server.Secret)) + } + return interceptor(ctx, in, info, handler) +} + +func _SecretService_GetSecrets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(server.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SecretServiceServer).GetSecrets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/remote.SecretService/GetSecrets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SecretServiceServer).GetSecrets(ctx, req.(*server.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _SecretService_CreateSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(server.Secret) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SecretServiceServer).CreateSecret(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/remote.SecretService/CreateSecret", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SecretServiceServer).CreateSecret(ctx, req.(*server.Secret)) + } + return interceptor(ctx, in, info, handler) +} + +func _SecretService_DeleteSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(server.Secret) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SecretServiceServer).DeleteSecret(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/remote.SecretService/DeleteSecret", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SecretServiceServer).DeleteSecret(ctx, req.(*server.Secret)) + } + return interceptor(ctx, in, info, handler) +} + +func _SecretService_UpdateSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(server.Secret) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SecretServiceServer).UpdateSecret(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/remote.SecretService/UpdateSecret", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SecretServiceServer).UpdateSecret(ctx, req.(*server.Secret)) + } + return interceptor(ctx, in, info, handler) +} + +// SecretService_ServiceDesc is the grpc.ServiceDesc for SecretService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SecretService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "remote.SecretService", + HandlerType: (*SecretServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSecret", + Handler: _SecretService_GetSecret_Handler, + }, + { + MethodName: "GetSecrets", + Handler: _SecretService_GetSecrets_Handler, + }, + { + MethodName: "CreateSecret", + Handler: _SecretService_CreateSecret_Handler, + }, + { + MethodName: "DeleteSecret", + Handler: _SecretService_DeleteSecret_Handler, + }, + { + MethodName: "UpdateSecret", + Handler: _SecretService_UpdateSecret_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pkg/testing/remote/loader.proto", +} diff --git a/sample/argocd/simple.yaml b/sample/argocd/simple.yaml index 5998425b..7df095f8 100644 --- a/sample/argocd/simple.yaml +++ b/sample/argocd/simple.yaml @@ -9,7 +9,7 @@ spec: server: https://kubernetes.default.svc project: default source: - path: sample/kubernetes + path: sample/kubernetes/default repoURL: https://github.com/LinuxSuRen/api-testing targetRevision: master # see also https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/