diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c7c247d --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +.npmrc diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..50905fe --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Maksym Trofimenko + +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f28710e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +## Module +All-in-one library to run and build Tiny Systems modules. diff --git a/cli/build.go b/cli/build.go new file mode 100644 index 0000000..6b48df2 --- /dev/null +++ b/cli/build.go @@ -0,0 +1,103 @@ +package cli + +import ( + "fmt" + "github.com/rs/zerolog/log" + "github.com/spf13/cobra" + "github.com/spf13/viper" + tinymodule "github.com/tiny-systems/module/pkg/api/module-go" + "github.com/tiny-systems/module/pkg/utils" + "github.com/tiny-systems/module/registry" + "github.com/tiny-systems/module/tools/build" + "github.com/tiny-systems/module/tools/readme" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "os" +) + +var ( + devKey string + pathToMain string +) + +var buildCmd = &cobra.Command{ + Use: "build", + Short: "build module", + Long: `Run from module's root folder (go.mod && README.md files should exist there) If your main's package path differ from ./cmd please specify path parameter'`, + Run: func(cmd *cobra.Command, args []string) { + ctx := cmd.Context() + + cwd, err := os.Getwd() + if err != nil { + log.Fatal().Err(err).Msgf("unable to get current path: %v", err) + } + + info, err := readme.GetReadme(cwd) + if err != nil { + log.Fatal().Err(err).Msgf("unable to get README.md by path %s: %v", cwd, err) + } + + var opts []grpc.DialOption + + if viper.GetBool("insecure") || grpcServerInsecureConnect { + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) + } + + conn, err := grpc.Dial(grpcConnStr, opts...) + if err != nil { + log.Fatal().Err(err).Msg("unable to connect to platform gRPC server") + } + defer conn.Close() + + platformClient := tinymodule.NewPlatformServiceClient(conn) + + componentsApi := make([]*tinymodule.Component, 0) + for _, c := range registry.Get() { + cmpApi, err := utils.GetComponentApi(c) + if err != nil { + log.Error().Err(err).Msg("component to api") + continue + } + componentsApi = append(componentsApi, cmpApi) + } + + resp, err := platformClient.PublishModule(ctx, &tinymodule.PublishModuleRequest{ + Name: name, + Info: info, + Version: version, + DeveloperKey: devKey, + Components: componentsApi, + }) + if err != nil { + log.Fatal().Err(err).Msg("unable to publish module") + } + if resp.Module == nil { + log.Fatal().Err(err).Msg("invalid server response") + } + + buildOpts := build.Options{ + Repo: resp.Options.Repo, + Tag: resp.Options.Tag, + VersionID: resp.Module.ID, + } + if err := build.Build(ctx, cwd, pathToMain, buildOpts); err != nil { + log.Fatal().Err(err).Msg("unable to build") + } + image := fmt.Sprintf("%s:%s", resp.Options.Repo, resp.Options.Tag) + + if err = build.Push(ctx, image, resp.Options.Username, resp.Options.Password); err != nil { + log.Fatal().Err(err).Str("image", image).Msg("unable to push") + } + + _, err = platformClient.UpdateModuleVersion(ctx, &tinymodule.UpdateModuleVersionRequest{ + ID: resp.Module.ID, + Repo: resp.Options.Repo, + Tag: resp.Options.Tag, + }) + if err != nil { + log.Fatal().Err(err).Str("image", image).Msg("unable to update server") + } + + log.Info().Str("image", image).Msg("pushed") + }, +} diff --git a/cli/cli.go b/cli/cli.go new file mode 100644 index 0000000..e4c4565 --- /dev/null +++ b/cli/cli.go @@ -0,0 +1,38 @@ +package cli + +import "github.com/spf13/cobra" + +var ( + serverKey string + grpcServerInsecureConnect bool + grpcConnStr string +) + +func RegisterCommands(root *cobra.Command) { + runCmd.Flags().StringVarP(&serverKey, "key", "k", "", "Server key") + applyCommonBuildFlags(runCmd) + + applyConnFlags(runCmd) + root.AddCommand(runCmd) + // + root.AddCommand(infoCmd) + // + buildCmd.Flags().StringVarP(&pathToMain, "path", "p", "./cmd", "path to main package regarding to the root") + applyCommonBuildFlags(buildCmd) + // + buildCmd.Flags().StringVarP(&devKey, "devkey", "d", "", "developer key") + buildCmd.MarkFlagRequired("devkey") + + applyConnFlags(buildCmd) + root.AddCommand(buildCmd) +} + +func applyConnFlags(cmd *cobra.Command) { + cmd.Flags().BoolVarP(&grpcServerInsecureConnect, "insecure", "i", false, "gRPC connect with insecure credentials") + cmd.Flags().StringVarP(&grpcConnStr, "conn", "c", "localhost:50189", "gRPC server connection string") +} + +func applyCommonBuildFlags(cmd *cobra.Command) { + cmd.Flags().StringVarP(&version, "version", "v", "0.0.0", "version") + cmd.Flags().StringVarP(&name, "name", "n", "main", "module name") +} diff --git a/cli/info.go b/cli/info.go new file mode 100644 index 0000000..cf5439e --- /dev/null +++ b/cli/info.go @@ -0,0 +1,20 @@ +package cli + +import ( + "github.com/rs/zerolog/log" + "github.com/spf13/cobra" + "github.com/tiny-systems/module/registry" +) + +var infoCmd = &cobra.Command{ + Use: "info", + Short: "get components info", + Long: ``, + Run: func(cmd *cobra.Command, args []string) { + components := registry.Get() + log.Info().Int("components", len(components)).Msg("registered") + for _, c := range registry.Get() { + log.Info().Msgf("%s - %s\n", c.GetInfo().Name, c.GetInfo().Description) + } + }, +} diff --git a/cli/run.go b/cli/run.go new file mode 100644 index 0000000..1381275 --- /dev/null +++ b/cli/run.go @@ -0,0 +1,125 @@ +package cli + +import ( + "context" + "github.com/nats-io/nats.go" + "github.com/rs/zerolog/log" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/tiny-systems/module" + tinyserver "github.com/tiny-systems/module/pkg/api/module-go" + m "github.com/tiny-systems/module/pkg/module" + "github.com/tiny-systems/module/pkg/service-discovery/client" + "github.com/tiny-systems/module/pkg/service-discovery/discovery" + "github.com/tiny-systems/module/registry" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "sync" +) + +// override by ldflags +var ( + version string + name string + versionID string // ldflags +) + +var runCmd = &cobra.Command{ + Use: "run", + Short: "run module", + Long: ``, + Run: func(cmd *cobra.Command, args []string) { + + log.Info().Str("versionID", versionID).Msg("starting...") + // run all modules + ctx, cancel := context.WithCancel(cmd.Context()) + defer cancel() + if serverKey == "" { + serverKey = viper.GetString("server_key") + } + + if serverKey == "" { + log.Fatal().Msg("no server key defined") + } + + natsConnStr := viper.GetString("nats_conn_str") + if natsConnStr == "" { + natsConnStr = nats.DefaultURL + } + nc, err := nats.Connect(natsConnStr) + if err != nil { + log.Fatal().Err(err).Msg("unable to connect to NATS") + } + + discovery, err := client.NewClient(nc, discovery.DefaultLivecycle) + if err != nil { + log.Fatal().Err(err).Msg("unable to connect to NATS") + } + defer nc.Close() + + var opts []grpc.DialOption + + if viper.GetBool("insecure") || grpcServerInsecureConnect { + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) + } + + conn, err := grpc.Dial(grpcConnStr, opts...) + if err != nil { + log.Fatal().Err(err).Msg("unable to connect to platform gRPC server") + } + defer conn.Close() + + platformClient := tinyserver.NewPlatformServiceClient(conn) + manifestResp, err := platformClient.GetManifest(ctx, &tinyserver.GetManifestRequest{ + ServerKey: serverKey, + ModuleVersionID: versionID, + Version: version, + }) + if err != nil { + log.Fatal().Err(err).Msg("manifest error") + } + + errChan := make(chan error) + defer close(errChan) + go func() { + for err := range errChan { + log.Error().Err(err).Msg("") + } + }() + + serv := module.New(manifestResp.RunnerConfig, errChan) + + serv.SetLogger(log.Logger) + serv.SetDiscovery(discovery) + serv.SetNats(nc) + + wg := &sync.WaitGroup{} + wg.Add(1) + + go func() { + defer wg.Done() + if err := serv.Run(ctx); err != nil { + log.Error().Err(err).Msg("unable to run server") + } + }() + + info := m.Info{ + Version: version, + Name: name, + VersionID: versionID, + } + + for _, cmp := range registry.Get() { + if err = serv.InstallComponent(ctx, info, cmp); err != nil { + log.Error().Err(err).Str("component", cmp.GetInfo().Name).Msg("unable to install component") + } + } + + for _, instance := range manifestResp.Instances { + serv.RunInstance(instance) + } + + wg.Wait() + log.Info().Msg("all done") + }, +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..bdfbd77 --- /dev/null +++ b/go.mod @@ -0,0 +1,71 @@ +module github.com/tiny-systems/module + +go 1.20 + +require ( + github.com/davecgh/go-spew v1.1.1 + github.com/goccy/go-json v0.10.2 + github.com/google/uuid v1.3.0 + github.com/hashicorp/go-version v1.6.0 + github.com/nats-io/nats.go v1.25.0 + github.com/orcaman/concurrent-map/v2 v2.0.1 + github.com/pkg/errors v0.9.1 + github.com/rs/zerolog v1.29.1 + github.com/spf13/cobra v1.7.0 + github.com/spf13/viper v1.15.0 + github.com/spyzhov/ajson v0.8.0 + github.com/swaggest/jsonschema-go v0.3.49 + github.com/tiny-systems/errorpanic v0.0.0-20221030084151-d2ff93361ac4 + golang.org/x/sync v0.1.0 + google.golang.org/grpc v1.54.0 + google.golang.org/protobuf v1.30.0 +) + +require ( + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/containerd/containerd v1.7.0 // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/docker v23.0.4+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-units v0.5.0 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/klauspost/compress v1.16.4 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.18 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/moby/patternmatcher v0.5.0 // indirect + github.com/moby/sys/sequential v0.5.0 // indirect + github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect + github.com/morikuni/aec v1.0.0 // indirect + github.com/nats-io/nats-server/v2 v2.9.16 // indirect + github.com/nats-io/nkeys v0.4.4 // indirect + github.com/nats-io/nuid v1.0.1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect + github.com/opencontainers/runc v1.1.6 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/rogpeppe/go-internal v1.8.1 // indirect + github.com/sirupsen/logrus v1.9.0 // indirect + github.com/spf13/afero v1.9.3 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.4.2 // indirect + github.com/swaggest/refl v1.1.0 // indirect + golang.org/x/crypto v0.8.0 // indirect + golang.org/x/mod v0.10.0 // indirect + golang.org/x/net v0.9.0 // indirect + golang.org/x/sys v0.7.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/tools v0.6.0 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.4.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..122aeaf --- /dev/null +++ b/go.sum @@ -0,0 +1,603 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/hcsshim v0.10.0-rc.7 h1:HBytQPxcv8Oy4244zbQbe6hnOnx544eL5QPUqhJldz8= +github.com/bool64/dev v0.2.27 h1:mFT+B74mFVgUeUmm/EbfM6ELPA55lEXBjQ/AOHCwCOc= +github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/containerd/containerd v1.7.0 h1:G/ZQr3gMZs6ZT0qPUZ15znx5QSdQdASW11nXTLTM2Pg= +github.com/containerd/containerd v1.7.0/go.mod h1:QfR7Efgb/6X2BDpTPJRvPTYDE9rsF0FsXX9J8sIs/sc= +github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v23.0.4+incompatible h1:Kd3Bh9V/rO+XpTP/BLqM+gx8z7+Yb0AA2Ibj+nNo4ek= +github.com/docker/docker v23.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.16.4 h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU= +github.com/klauspost/compress v1.16.4/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= +github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= +github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= +github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/nats-io/jwt/v2 v2.4.1 h1:Y35W1dgbbz2SQUYDPCaclXcuqleVmpbRa7646Jf2EX4= +github.com/nats-io/nats-server/v2 v2.9.16 h1:SuNe6AyCcVy0g5326wtyU8TdqYmcPqzTjhkHojAjprc= +github.com/nats-io/nats-server/v2 v2.9.16/go.mod h1:z1cc5Q+kqJkz9mLUdlcSsdYnId4pyImHjNgoh6zxSC0= +github.com/nats-io/nats.go v1.25.0 h1:t5/wCPGciR7X3Mu8QOi4jiJaXaWM8qtkLu4lzGZvYHE= +github.com/nats-io/nats.go v1.25.0/go.mod h1:D2WALIhz7V8M0pH8Scx8JZXlg6Oqz5VG+nQkK8nJdvg= +github.com/nats-io/nkeys v0.4.4 h1:xvBJ8d69TznjcQl9t6//Q5xXuVhyYiSos6RPtvQNTwA= +github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= +github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8= +github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= +github.com/opencontainers/runc v1.1.6 h1:XbhB8IfG/EsnhNvZtNdLB0GBw92GYEFvKlhaJk9jUgA= +github.com/opencontainers/runc v1.1.6/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= +github.com/orcaman/concurrent-map/v2 v2.0.1 h1:jOJ5Pg2w1oeB6PeDurIYf6k9PQ+aTITr/6lP/L/zp6c= +github.com/orcaman/concurrent-map/v2 v2.0.1/go.mod h1:9Eq3TG2oBe5FirmYWQfYO5iH1q0Jv47PLaNK++uCdOM= +github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= +github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= +github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= +github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= +github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= +github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= +github.com/spyzhov/ajson v0.8.0 h1:sFXyMbi4Y/BKjrsfkUZHSjA2JM1184enheSjjoT/zCc= +github.com/spyzhov/ajson v0.8.0/go.mod h1:63V+CGM6f1Bu/p4nLIN8885ojBdt88TbLoSFzyqMuVA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= +github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/swaggest/assertjson v1.7.0 h1:SKw5Rn0LQs6UvmGrIdaKQbMR1R3ncXm5KNon+QJ7jtw= +github.com/swaggest/jsonschema-go v0.3.49 h1:0dB6+6/uuU9lH41evLVum9Ui1b1Pkm1mjtsHWYL+y30= +github.com/swaggest/jsonschema-go v0.3.49/go.mod h1:fZmC8juuqFTMe4Fc9tHJXwG+Uaf9BKYvF8ygL+asOuY= +github.com/swaggest/refl v1.1.0 h1:a+9a75Kv6ciMozPjVbOfcVTEQe81t2R3emvaD9oGQGc= +github.com/swaggest/refl v1.1.0/go.mod h1:g3Qa6ki0A/L2yxiuUpT+cuBURuRaltF5SDQpg1kMZSY= +github.com/tiny-systems/errorpanic v0.0.0-20221030084151-d2ff93361ac4 h1:f/hcs7rnUer+My/tkHlFCjJgaJ5n13MB/Xxw2CHJVZU= +github.com/tiny-systems/errorpanic v0.0.0-20221030084151-d2ff93361ac4/go.mod h1:AQobicdSB/J3RzN81pTG4dqgcULaEIrEOvNC8TpSgxw= +github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/input.go b/input.go new file mode 100644 index 0000000..5cc00f7 --- /dev/null +++ b/input.go @@ -0,0 +1,63 @@ +package module + +import ( + "context" + "fmt" + "github.com/tiny-systems/module/internal/instance" + "github.com/tiny-systems/module/pkg/api/module-go" + m "github.com/tiny-systems/module/pkg/module" + "github.com/tiny-systems/module/pkg/service-discovery/discovery" +) + +func (s *Server) InstallComponent(ctx context.Context, info m.Info, c m.Component) error { + + installID, err := m.GetComponentID(info, c.GetInfo()) + if err != nil { + return err + } + data := map[string]interface{}{ + "name": "", // no actual Flow scope instance name + "run": false, + "component": installID, + } + s.installComponentsCh <- &installComponentMsg{ + id: installID, + component: c.Instance(), + module: info, + data: data, + } + return err +} + +func (s *Server) RunInstance(conf *module.ConfigureInstanceRequest) { + s.newInstanceCh <- instance.NewMsgWithSubject(conf.ComponentID, conf, func(data interface{}) error { + return nil + }) +} + +// spinNewInstance async to avoid slow consumer +func (s *Server) spinNewInstance(ctx context.Context, runConfigMsg *instance.Msg, cmp *installComponentMsg, inputCh chan *instance.Msg, outputCh chan *instance.Msg) error { + // make new instance discoverable + // deploy instance + + // create component runner + runner := instance.NewRunner(cmp.component.Instance(), cmp.module). + SetLogger(s.log). + SetConfig(s.runnerConfig) + + // deploy + runCtx, runCancel := context.WithCancel(ctx) + defer runCancel() + + go func() { + if err := s.discovery.KeepAlive(runCtx, func() discovery.Node { + node := runner.Discovery(runCtx) + node.ServerID = s.runnerConfig.ServerID + node.WorkspaceID = s.runnerConfig.WorkspaceID + return node + }); err != nil { + s.errorCh <- fmt.Errorf("discovery keep alive error: %v", err) + } + }() + return runner.Run(runCtx, runConfigMsg, inputCh, outputCh) +} diff --git a/internal/instance/README.md b/internal/instance/README.md new file mode 100644 index 0000000..f641423 --- /dev/null +++ b/internal/instance/README.md @@ -0,0 +1 @@ +### Component Runner diff --git a/internal/instance/conf.go b/internal/instance/conf.go new file mode 100644 index 0000000..28b1822 --- /dev/null +++ b/internal/instance/conf.go @@ -0,0 +1,60 @@ +package instance + +import ( + "sync" +) + +type MapPort struct { + From string + To string + EdgeID string +} + +type PortConfig struct { + FromNode string + Configuration []byte + Schema []byte +} + +type Configuration struct { + sync.RWMutex + ID string // uuid + // for nats subject + FlowID string + //Label string + //Name string + // where send message next + DestinationMap map[string][]MapPort + // fromNode => string => PortConfig + PortConfigMap map[string]map[string]PortConfig + Revision int64 + // asked to be running + Run bool + ComponentID string + Data map[string]interface{} +} + +func (c *Configuration) ShouldRun() bool { + c.Lock() + defer c.Unlock() + return c.Run +} + +func (c *Configuration) GetPortConfig(portName string, from *string) *PortConfig { + var fromStr = "" // no from + if from != nil { + fromStr = *from + } + if conf, ok := c.PortConfigMap[fromStr]; ok { + if confPort, ok := conf[portName]; ok { + return &confPort + } + } + // if not found specific to the sender settings - use node's own + if conf, ok := c.PortConfigMap[""]; ok { + if confPort, ok := conf[portName]; ok { + return &confPort + } + } + return nil +} diff --git a/internal/instance/metrics.go b/internal/instance/metrics.go new file mode 100644 index 0000000..7cdbb09 --- /dev/null +++ b/internal/instance/metrics.go @@ -0,0 +1,50 @@ +package instance + +import ( + "fmt" + "strconv" + "strings" +) + +type Metric int + +func (m Metric) String() string { + return fmt.Sprintf("%v", int(m)) +} + +const prevMetricPrefix = "prev" + +const ( + MetricNodeRunning Metric = iota + MetricEdgeMessageSent + MetricEdgeMessageReceived + MetricNodeMessageSent + MetricNodeMessageReceived + MetricEdgeActive +) +const metricSeparator = "|" + +func GetMetricKey(entityID string, m Metric) string { + return fmt.Sprintf("%s%s%d", entityID, metricSeparator, m) +} + +func GetPrevMetricKey(entityID string, m Metric) string { + return fmt.Sprintf("%s%s%s%d", prevMetricPrefix, entityID, metricSeparator, m) +} + +func GetEntityAndMetric(key string) (string, Metric, bool, error) { + var prev bool + if strings.HasPrefix(key, prevMetricPrefix) { + prev = true + key = strings.TrimPrefix(key, prevMetricPrefix) + } + parts := strings.Split(key, metricSeparator) + if len(parts) != 2 { + return "", 0, prev, fmt.Errorf("invalid key") + } + m, err := strconv.Atoi(parts[1]) + if err != nil { + return "", 0, prev, fmt.Errorf("invalid key") + } + return parts[0], Metric(m), prev, nil +} diff --git a/internal/instance/msgs.go b/internal/instance/msgs.go new file mode 100644 index 0000000..0b14c20 --- /dev/null +++ b/internal/instance/msgs.go @@ -0,0 +1,25 @@ +package instance + +// Msg being sent via instances edges +type Msg struct { + Subject string + Data interface{} + clb func(data interface{}) error +} + +func NewMsg(data interface{}, clb func(data interface{}) error) *Msg { + return &Msg{Data: data, clb: clb} +} + +func NewMsgWithSubject(subj string, data interface{}, clb func(data interface{}) error) *Msg { + m := NewMsg(data, clb) + m.Subject = subj + return m +} + +func (m *Msg) Respond(data interface{}) error { + if m.clb == nil { + return nil + } + return m.clb(data) +} diff --git a/internal/instance/runner.go b/internal/instance/runner.go new file mode 100644 index 0000000..68c8119 --- /dev/null +++ b/internal/instance/runner.go @@ -0,0 +1,713 @@ +package instance + +import ( + "context" + "encoding/json" + "fmt" + "github.com/google/uuid" + "github.com/orcaman/concurrent-map/v2" + "github.com/pkg/errors" + "github.com/rs/zerolog" + "github.com/spyzhov/ajson" + "github.com/tiny-systems/errorpanic" + "github.com/tiny-systems/module/pkg/api/module-go" + "github.com/tiny-systems/module/pkg/evaluator" + m "github.com/tiny-systems/module/pkg/module" + "github.com/tiny-systems/module/pkg/service-discovery/discovery" + "github.com/tiny-systems/module/pkg/utils" + "google.golang.org/protobuf/types/known/structpb" + "reflect" + "sort" + "sync/atomic" + "time" +) + +type Runner struct { + config *Configuration + + cmpID string + + runnerConfig *module.RunnerConfig + // + component m.Component + module m.Info + // + + log zerolog.Logger + + startStopCtx context.Context + startStopCancelFunc context.CancelFunc + // + errors cmap.ConcurrentMap[string, error] + stats cmap.ConcurrentMap[string, *int64] +} + +func NewRunner(component m.Component, module m.Info) *Runner { + return &Runner{ + component: component, + module: module, + errors: cmap.New[error](), + stats: cmap.New[*int64](), + config: new(Configuration), + } +} + +func (c *Runner) SetConfig(config *module.RunnerConfig) *Runner { + c.runnerConfig = config + return c +} + +func (c *Runner) SetLogger(l zerolog.Logger) *Runner { + c.log = l + return c +} + +func (c *Runner) IsRunning() bool { + if c.startStopCtx == nil || c.startStopCtx.Err() != nil { + return false + } + select { + case <-c.startStopCtx.Done(): + default: + return true + } + return false +} + +// Run component makes its operational +// subject := utils.GetInstanceInputSubject(c.serverConfig.ID, c.config.FlowID, c.config.ID, "*") + +func (c *Runner) Run(ctx context.Context, runConfigMsg *Msg, inputCh chan *Msg, outputCh chan *Msg) error { + if err := c.updateConfiguration(runConfigMsg.Data); err != nil { + c.sendConfigureResponse(runConfigMsg, err) + return err + } + + if err := c.applyConfigurationToComponent(ctx); err != nil { + c.log.Error().Err(err).Msg("apply component conf error") + c.sendConfigureResponse(runConfigMsg, err) + return err + } + + // send success response + c.sendConfigureResponse(runConfigMsg, nil, &module.GraphChange{ + Op: module.GraphChangeOp_UPDATE, + Elements: c.renderElements(), + // to make platform know which server acquired this instance + Server: c.getServerMsg(), + // and module info of this instance + Module: c.getModuleMsg(), + }) + + if c.config.ShouldRun() { + // should run at start + // @todo check which context it should be + go c.run(ctx, runConfigMsg, outputCh) + } + + for { + select { + case msg := <-inputCh: + c.log.Debug().Str("port", msg.Subject).Msg("incoming request") + + switch msg.Subject { + case m.RunPort: + c.run(ctx, msg, outputCh) + case m.ConfigurePort: + c.Configure(ctx, msg) + case m.DestroyPort: + c.destroy(ctx, msg) + return nil + case m.StopPort: + c.stop(ctx, msg) + default: + c.input(ctx, msg.Subject, msg, outputCh) + } + /// + case <-ctx.Done(): + return nil + } + } +} + +func (c *Runner) renderNode(configuration *Configuration) *module.Node { + node, err := NewApiNode(c.component, configuration) + if err != nil { + c.log.Error().Err(err).Msg("render node error") + } + + //node.Component = c.renderComponent() + node.PortConfigs = make([]*module.PortConfig, 0) + node.Destinations = make([]*module.MapPort, 0) + // update port configs how node sees it + node.ComponentID = configuration.ComponentID + + ports := node.Ports + // sort ports from high priority to less + sort.Slice(ports, func(i, j int) bool { + if ports[i].IsSettings != ports[j].IsSettings { + return true + } + return ports[i].Source == ports[j].Source + }) + + var configurableDefinitions = make(map[string]*ajson.Node) + + for _, np := range ports { + // processing settings port first, then source, then target + for from, configs := range c.config.PortConfigMap { + // for own configs from is empty + + for portName, config := range configs { + if np.PortName != portName { + continue + } + + pc := &module.PortConfig{ + From: from, + PortName: portName, + Configuration: config.Configuration, + Schema: config.Schema, + } + + // get default port schema and value from runtime + // each request use to actualise knowledge of manager about defaults of a node + pc.ConfigurationDefault = np.ConfigurationDefault + pc.SchemaDefault = np.SchemaDefault + + if len(pc.Schema) > 0 { + // our schema is original re-generated schema + updatable (configurable) definitions + updatedSchema, err := UpdateWithConfigurableDefinitions(portName, pc.SchemaDefault, pc.Schema, configurableDefinitions) + if err != nil { + c.log.Error().Err(err).Msg("update schema") + } else { + pc.Schema = updatedSchema + } + } + node.PortConfigs = append(node.PortConfigs, pc) + } + } + } + + for from, destinations := range c.config.DestinationMap { + for _, d := range destinations { + node.Destinations = append(node.Destinations, &module.MapPort{ + From: from, + To: d.To, + EdgeID: d.EdgeID, + }) + } + } + return node +} + +func (c *Runner) getServerMsg() *module.GraphChangeServer { + return &module.GraphChangeServer{ + ID: c.runnerConfig.ServerID, + } +} + +func (c *Runner) getModuleMsg() *module.GraphChangeModule { + return &module.GraphChangeModule{ + Name: c.module.Name, + Version: c.module.Version, + VersionID: c.module.VersionID, + } +} + +func (c *Runner) renderElements() []*module.GraphElement { + c.config.RLock() + defer c.config.RUnlock() + configuration := c.config + return []*module.GraphElement{ + { + ID: configuration.ID, + //FlowID: config.FlowID, + Node: c.renderNode(configuration), + }, + } +} + +func (c *Runner) input(ctx context.Context, port string, msg *Msg, outputCh chan *Msg) { + // non a system port, find settings and pass to the node + // execute config for the given port + // check if node has such port + // new instance to avoid data confuse types @todo check this + nodePort := m.GetPortByName(c.component.Ports(), port) + if nodePort == nil { + c.sendMessageResponse(msg, fmt.Errorf("port %s is unknown", port), nil) + return + } + // parse input data + requestData, ok := msg.Data.(*module.MessageRequest) + if !ok { + c.sendMessageResponse(msg, fmt.Errorf("invalid input request"), nil) + return + } + // find specific config for a port + + var i int64 + key := GetMetricKey(requestData.EdgeID, MetricEdgeMessageReceived) + c.stats.SetIfAbsent(key, &i) + counter, _ := c.stats.Get(key) + atomic.AddInt64(counter, 1) + + c.config.RLock() + defer c.config.RUnlock() + + var y int64 + key = GetMetricKey(c.config.ID, MetricNodeMessageReceived) + c.stats.SetIfAbsent(key, &y) + counter, _ = c.stats.Get(key) + atomic.AddInt64(counter, 1) + + portEdgeSettings := c.config.GetPortConfig(port, &requestData.From) + if portEdgeSettings == nil { + err := fmt.Errorf("port settings are missing for %s", requestData.From) + c.addErr(requestData.EdgeID, err) + c.sendMessageResponse(msg, err, nil) + return + } + + if len(portEdgeSettings.Configuration) == 0 { + err := fmt.Errorf("port '%s' (from '%v') config is empty", port, portEdgeSettings.FromNode) + c.addErr(requestData.EdgeID, err) + c.sendMessageResponse(msg, err, nil) + return + } + // create config + portInputData := reflect.New(reflect.TypeOf(nodePort.Message)).Elem() + + requestDataNode, err := ajson.Unmarshal(requestData.Payload) + if err != nil { + c.sendMessageResponse(msg, errors.Wrap(err, "ajson parse requestData payload error"), nil) + return + } + + eval := evaluator.NewEvaluator(func(expression string) (interface{}, error) { + if expression == "" { + return nil, fmt.Errorf("expression is empty") + } + jsonPathResult, err := ajson.Eval(requestDataNode, expression) + if err != nil { + return nil, err + } + resultUnpack, err := jsonPathResult.Unpack() + if err != nil { + return nil, err + } + return resultUnpack, nil + }) + + //c.log.ComponentInfo().RawJSON("conf", portEdgeSettings.Configuration).Msg("eval") + + configurationMap, err := eval.Eval(portEdgeSettings.Configuration) + if err != nil { + c.addErr(requestData.EdgeID, err) + c.sendMessageResponse(msg, errors.Wrap(err, "evel port edge settings config"), nil) + return + } + c.log.Info().Interface("result", configurationMap).Msg("result") + + err = c.jsonEncodeDecode(configurationMap, portInputData.Addr().Interface()) + if err != nil { + c.addErr(requestData.EdgeID, err) + c.sendMessageResponse(msg, errors.Wrap(err, "map decode from config map to port input type"), nil) + return + } + // to avoid nats timeout + c.sendMessageResponse(msg, nil, nil) + + err = errorpanic.Wrap(func() error { + return c.component.Handle(ctx, func(port string, data interface{}) error { + if err = c.outputHandler(ctx, port, data, outputCh); err != nil { + c.addErr(port, err) + } + return nil + }, port, portInputData.Interface()) + }) + if err != nil { + c.log.Error().Str("id", c.config.ID).Err(err).Str("port", port).Msg("invoke component") + } +} + +func (c *Runner) stop(ctx context.Context, msg *Msg) { + if !c.IsRunning() { + c.sendConfigureResponse(msg, nil, &module.GraphChange{ + Op: module.GraphChangeOp_UPDATE, + Elements: c.renderElements(), + }) + return + } + if c.startStopCancelFunc != nil { + c.startStopCancelFunc() + } + _ = c.cleanRuntimePorts() + time.Sleep(time.Millisecond * 300) + // stopping is always a success (at-least so far) + c.sendConfigureResponse(msg, nil, &module.GraphChange{ + Op: module.GraphChangeOp_UPDATE, + Elements: c.renderElements(), + }) +} + +func (c *Runner) cleanRuntimePorts() error { + //var err error + //if c.runtime == nil { + // return nil + //} + //for _, p := range c.component.Node().Ports { + // err = c.runtime.Purge(utils.GetPortFullName(c.config.ID, p.Name)) + //} + //return err + return nil +} + +func (c *Runner) destroy(ctx context.Context, msg *Msg) { + if c.startStopCancelFunc != nil { + c.startStopCancelFunc() + } + _ = c.cleanRuntimePorts() + // destroying is always a success (at-least so far) + c.sendConfigureResponse(msg, nil, &module.GraphChange{ + Op: module.GraphChangeOp_DELETE, + Elements: c.renderElements(), + }) +} + +func (c *Runner) Configure(ctx context.Context, msg *Msg) { + if err := c.updateConfiguration(msg.Data); err != nil { + c.sendConfigureResponse(msg, err) + return + } + if err := c.applyConfigurationToComponent(ctx); err != nil { + c.log.Error().Err(err).Msg("apply component conf error") + c.sendConfigureResponse(msg, err) + return + } + c.sendConfigureResponse(msg, nil, &module.GraphChange{ + Op: module.GraphChangeOp_UPDATE, + Elements: c.renderElements(), + }) +} + +func (c *Runner) run(ctx context.Context, msg *Msg, outputCh chan *Msg) { + runnableComponent, ok := c.component.(m.Runnable) + if !ok { + c.sendConfigureResponse(msg, fmt.Errorf("component is not runnable")) + return + } + if c.IsRunning() { + c.sendConfigureResponse(msg, nil, &module.GraphChange{ + Op: module.GraphChangeOp_UPDATE, + Elements: c.renderElements(), + }) + return + } + if err := c.updateConfiguration(msg.Data); err != nil { + c.sendConfigureResponse(msg, err) + return + } + if err := c.applyConfigurationToComponent(ctx); err != nil { + c.sendConfigureResponse(msg, err) + return + } + + go func() { + if c.startStopCancelFunc != nil { + c.startStopCancelFunc() + } + c.startStopCtx, c.startStopCancelFunc = context.WithCancel(ctx) + defer func() { + c.startStopCancelFunc() + }() + c.sendConfigureResponse(msg, runnableComponent.Run(c.startStopCtx, func(port string, data interface{}) error { + return c.outputHandler(ctx, port, data, outputCh) + })) + }() + // give some time to fail + time.Sleep(time.Millisecond * 300) + + c.sendConfigureResponse(msg, nil, &module.GraphChange{ + Op: module.GraphChangeOp_UPDATE, + Elements: c.renderElements(), + }) + +} + +func (c *Runner) outputHandler(ctx context.Context, port string, data interface{}, outputCh chan *Msg) (err error) { + c.config.RLock() + defer c.config.RUnlock() + + defer func() { + if rErr := recover(); rErr != nil { + err = fmt.Errorf("%v", rErr) + } + }() + + portFullName := utils.GetPortFullName(c.config.ID, port) + dataBytes, err := json.Marshal(data) + if err != nil { + return err + } + + //_, err = c.runtime.Put(portFullName, dataBytes) + destinations, ok := c.config.DestinationMap[portFullName] + if !ok { + return nil + } + + id, err := uuid.NewUUID() + if err != nil { + return err + } + for _, d := range destinations { + req := &module.MessageRequest{ + ID: id.String(), + From: portFullName, + Payload: dataBytes, + EdgeID: d.EdgeID, + } + + // track how many messages component send + var y int64 + key := GetMetricKey(c.config.ID, MetricNodeMessageSent) + c.stats.SetIfAbsent(key, &y) + counter, _ := c.stats.Get(key) + atomic.AddInt64(counter, 1) + + // track how many message sedge passed + var i int64 + key = GetMetricKey(req.EdgeID, MetricEdgeMessageSent) + c.stats.SetIfAbsent(key, &i) + counter, _ = c.stats.Get(key) + atomic.AddInt64(counter, 1) + select { + case <-ctx.Done(): + return nil + case outputCh <- NewMsgWithSubject(d.To, req, nil): + } + } + return nil +} + +func (c *Runner) jsonEncodeDecode(input interface{}, output interface{}) error { + b, err := json.Marshal(input) + if err != nil { + return err + } + return json.Unmarshal(b, output) +} + +func (c *Runner) applyConfigurationToComponent(ctx context.Context) error { + c.config.RLock() + defer c.config.RUnlock() + var ( + // new instance to avoid data confuse types @todo check this + settingsPort = m.GetPortByName(c.component.Ports(), m.SettingsPort) + settings = c.config.GetPortConfig(m.SettingsPort, nil) + ) + + if settings == nil || settingsPort == nil { + return nil + } + + v := reflect.New(reflect.TypeOf(settingsPort.Message)).Elem() + // adapt first + var err error + + // just get values, does not care about expression cause there should be none for + e := evaluator.NewEvaluator(evaluator.DefaultCallback) + + c.log.Info().RawJSON("conf", settings.Configuration).Msg("config") + conf, err := e.Eval(settings.Configuration) + if err != nil { + c.log.Error().Err(err).Msg("config eval error") + return err + } + c.log.Info().Interface("result", conf).Msg("result") + err = c.jsonEncodeDecode(conf, v.Addr().Interface()) + if err != nil { + return err + } + + err = errorpanic.Wrap(func() error { + return c.component.Handle(ctx, func(port string, data interface{}) error { + // fake response handler + // we don't care how component respond to settings port + return nil + }, m.SettingsPort, v.Interface()) + }) + return err +} + +func (c *Runner) updateConfiguration(data interface{}) error { + conf, ok := data.(*module.ConfigureInstanceRequest) + if !ok { + return fmt.Errorf("invalid configuration request") + } + sourcePortsMap := make(map[string]struct{}) + for _, p := range c.component.Ports() { + if p.Source { + sourcePortsMap[p.Name] = struct{}{} + continue + } + } + + c.config.Lock() + defer c.config.Unlock() + + if conf.InstanceID != "" { + c.config.ID = conf.InstanceID + } + if conf.Data != nil { + c.config.Data = conf.Data.AsMap() + } + + if conf.ComponentID != "" { + c.config.ComponentID = conf.ComponentID + } + + if conf.FlowID != "" { + c.config.FlowID = conf.FlowID + } + // let runner know where send messages next + c.config.DestinationMap = make(map[string][]MapPort) + for _, v := range conf.Destinations { + if _, ok := c.config.DestinationMap[v.From]; !ok { + c.config.DestinationMap[v.From] = []MapPort{} + } + c.config.DestinationMap[v.From] = append(c.config.DestinationMap[v.From], MapPort{ + From: v.From, + EdgeID: v.EdgeID, + To: v.To, + }) + } + // configurations of the node's port, may be different depend on FROM + if len(conf.PortConfigs) > 0 { + // apply port config only if ports presented + // reset + c.config.PortConfigMap = make(map[string]map[string]PortConfig) + for _, pc := range conf.PortConfigs { + if c.config.PortConfigMap[pc.From] == nil { + c.config.PortConfigMap[pc.From] = make(map[string]PortConfig) + } + c.config.PortConfigMap[pc.From][pc.PortName] = PortConfig{ + Configuration: pc.Configuration, + Schema: pc.Schema, + FromNode: pc.From, + } + } + } + c.config.Run = conf.Run + c.config.Revision = conf.Revision + return nil +} + +// addErr elementID could be Edge or Port or NodeID +func (c *Runner) addErr(elementID string, err error) { + c.errors.Set(elementID, err) +} + +func (c *Runner) sendMessageResponse(msg *Msg, err error, data []byte) { + if err != nil { + c.log.Error().Err(err).Msg("send message response") + } + resp := &module.MessageResponse{ + Data: data, + } + if err != nil { + resp.HasError = true + resp.Error = err.Error() + } + + if err = msg.Respond(resp); err != nil { + c.log.Error().Err(err).Msg("message response") + } +} + +func (c *Runner) sendConfigureResponse(msg *Msg, err error, changes ...*module.GraphChange) { + resp := &module.ConfigureInstanceResponse{ + IsRunning: c.IsRunning(), + Changes: changes, + //ServerID: c.serverConfig.ID, + } + if err != nil { + resp.HasError = true + resp.Error = err.Error() + } + if err = msg.Respond(resp); err != nil { + c.log.Error().Err(err).Msg("configure response") + } +} + +func (c *Runner) Discovery(ctx context.Context) discovery.Node { + + // read statistics + statsMap := map[string]interface{}{} + c.config.RLock() + defer c.config.RUnlock() + + for _, k := range c.stats.Keys() { + counter, _ := c.stats.Get(k) + if counter == nil { + continue + } + val := *counter + entityID, metric, isPrev, err := GetEntityAndMetric(k) + if err != nil { + continue + } + var prevVal int64 + + if !isPrev { + // current metric is not previous + // get prev + prevMetricKey := GetPrevMetricKey(entityID, metric) + if prevCounter, ok := c.stats.Get(prevMetricKey); ok { + prevVal = *prevCounter + } + // update prev + c.stats.Set(prevMetricKey, &val) + } + + if statsMap[entityID] == nil { + statsMap[entityID] = map[string]interface{}{} + } + if statsMapSub, ok := statsMap[entityID].(map[string]interface{}); ok { + statsMapSub[metric.String()] = val + if !isPrev { + // current metric is not prev + // add special metric + if metric == MetricEdgeMessageReceived && val > prevVal { + statsMapSub[MetricEdgeActive.String()] = 1 + } + } + } + } + + if _, ok := c.component.(m.Runnable); ok { + if statsMap[c.config.ID] == nil { + statsMap[c.config.ID] = map[string]interface{}{} + } + if statsMapSub, ok := statsMap[c.config.ID].(map[string]interface{}); ok { + if c.IsRunning() { + statsMapSub[MetricNodeRunning.String()] = 1 + } else { + statsMapSub[MetricNodeRunning.String()] = 0 + } + } + } + + stats, err := structpb.NewStruct(statsMap) + if err != nil { + c.log.Error().Err(err).Msg("stats struct error") + } + return discovery.Node{ + ID: c.config.ID, + FlowID: &c.config.FlowID, + WorkspaceID: c.runnerConfig.WorkspaceID, + //Component: c.renderComponent(), + Stats: stats, + } +} diff --git a/internal/instance/utils.go b/internal/instance/utils.go new file mode 100644 index 0000000..0b12aa8 --- /dev/null +++ b/internal/instance/utils.go @@ -0,0 +1,343 @@ +package instance + +import ( + "encoding/json" + "fmt" + "github.com/pkg/errors" + "github.com/spyzhov/ajson" + "github.com/swaggest/jsonschema-go" + "github.com/tiny-systems/module/pkg/api/module-go" + m "github.com/tiny-systems/module/pkg/module" + "google.golang.org/protobuf/types/known/structpb" + "reflect" + "strconv" + "strings" +) + +var scalarCustomProps = []string{ + "requiredWhen", "propertyOrder", "optionalWhen", "colSpan", "configurable", "$ref", "type", "readonly", "format", +} + +var arrayCustomProps = []string{ + "enumTitles", +} + +type TagDefinition struct { + Path string + Definition string +} + +func createSchema(m interface{}) (jsonschema.Schema, error) { + r := jsonschema.Reflector{DefaultOptions: make([]func(ctx *jsonschema.ReflectContext), 0)} + + var ( + defs = make(map[string]jsonschema.Schema) + confDefs = make(map[string]jsonschema.Schema) + ) + + sh, _ := r.Reflect(m, + jsonschema.RootRef, + jsonschema.DefinitionsPrefix("#/$defs/"), + jsonschema.CollectDefinitions(func(name string, schema jsonschema.Schema) { + defs[name] = schema + }), + jsonschema.InterceptProperty(func(name string, field reflect.StructField, propertySchema *jsonschema.Schema) error { + for _, cp := range scalarCustomProps { + if prop, ok := field.Tag.Lookup(cp); ok { + var propVal interface{} + if prop == "true" || prop == "false" { + propVal, _ = strconv.ParseBool(prop) + } else if f, err := strconv.ParseFloat(prop, 64); err == nil { + // looks like its float + propVal = f + } else if i, err := strconv.Atoi(prop); err == nil { + // looks like its int + propVal = i + } else { + // as is + propVal = prop + } + propertySchema.WithExtraPropertiesItem(cp, propVal) + } + } + + for _, cp := range arrayCustomProps { + if prop, ok := field.Tag.Lookup(cp); ok { + propertySchema.WithExtraPropertiesItem(cp, strings.Split(prop, ",")) + } + } + // + if b, ok := propertySchema.ExtraProperties["configurable"]; !ok || b != true { + return nil + } + + //tag with here configurable, we need to update definition with title and description, only info we know from tags + // problem here I solve is that tags affect on inline schema and not the one in $ref + // copy from inline to ref definition + if propertySchema.Ref == nil { + return nil + } + // make sure types with configurable tags always has own def + // update defs with everything except ref + + ref := *propertySchema.Ref + defID := strings.TrimPrefix(ref, "#/$defs/") + + propertySchema.Ref = nil + propertyOrder := propertySchema.ExtraProperties["propertyOrder"] + confDefs[defID] = *propertySchema + + refOnly := jsonschema.Schema{} + refOnly.Ref = &ref + refOnly.WithExtraPropertiesItem("propertyOrder", propertyOrder) + *propertySchema = refOnly + return nil + }), + jsonschema.InterceptNullability(func(params jsonschema.InterceptNullabilityParams) { + if params.Type.Kind() == reflect.Array || params.Type.Kind() == reflect.Slice { + a := jsonschema.Array.Type() + params.Schema.Type = &a + } + }), + ) + + // build json path for each definition how it's related to node's root + definitionPaths := make(map[string]TagDefinition) + for defName, schema := range defs { + for k, v := range schema.Properties { + var typ jsonschema.SimpleType + if v.TypeObject != nil && v.TypeObject.Type != nil && v.TypeObject.Type.SimpleTypes != nil { + typ = *v.TypeObject.Type.SimpleTypes + } + path := k + ref := v.TypeObject.Ref + if typ == jsonschema.Array { + path = fmt.Sprintf("%s[0]", path) + ref = v.TypeObject.ItemsEns().SchemaOrBoolEns().TypeObjectEns().Ref + } + if ref == nil { + continue + } + from := strings.TrimPrefix(*ref, "#/$defs/") + if defName == from { + // avoid dead loop + continue + } + t := TagDefinition{ + Path: path, + Definition: defName, + } + definitionPaths[from] = t + } + } + for k, d := range defs { + if c, ok := confDefs[k]; ok { + // definition is configurable + d.Title = c.Title + d.Description = c.Description + if d.Type == nil { + d.Type = c.Type + } + d.WithExtraPropertiesItem("configurable", true) + } + + pathParts := append(getPath(k, definitionPaths, []string{}), "$") + path := strings.Join(reverse(pathParts), ".") + // add json path to each definition + updated := d.WithExtraPropertiesItem("path", path) + defs[k] = *updated + } + + sh.WithExtraPropertiesItem("$defs", defs) + return sh, nil +} + +func NewApiNode(instance m.Component, conf *Configuration) (*module.Node, error) { + + ports := instance.Ports() + node := &module.Node{ + Ports: make([]*module.NodePort, len(ports)), + } + + var data map[string]interface{} + if conf != nil { + data = conf.Data + node.ComponentID = conf.ComponentID + } + if data == nil { + data = map[string]interface{}{} + } + data["component_name"] = instance.GetInfo().Name + data["component_info"] = instance.GetInfo().Info + data["component_description"] = instance.GetInfo().Description + + dataStruct, err := structpb.NewStruct(data) + if err != nil { + return nil, fmt.Errorf("data struct error: %v", err) + } + node.Data = dataStruct + + if _, ok := instance.(m.Runnable); ok { + node.Runnable = true + } + + // settings then source ports then destination ports + for k, port := range ports { + nodePort := &module.NodePort{ + PortName: port.Name, + Label: port.Label, + Position: int32(port.Position), + IsSettings: port.Settings, + Status: port.Status, + Source: port.Source, + } + if port.Message == nil { + return nil, fmt.Errorf("port DTO message is nil") + } + + // define default schema and config using reflection + schema, err := createSchema(port.Message) + if err != nil { + return nil, err + } + + schemaData, _ := schema.MarshalJSON() + nodePort.SchemaDefault = schemaData + + confData, _ := json.Marshal(port.Message) + nodePort.ConfigurationDefault = confData + node.Ports[k] = nodePort + } + return node, nil +} + +func UpdateWithConfigurableDefinitions(portName string, original []byte, updateWith []byte, configurableDefinitions map[string]*ajson.Node) ([]byte, error) { + originalNode, err := ajson.Unmarshal(original) + if err != nil { + return nil, errors.Wrap(err, "error reading original schema") + } + + updateWithNode, err := ajson.Unmarshal(updateWith) + if err != nil { + return nil, errors.Wrap(err, "error reading updatedWith schema") + } + originalNodeDefs, err := originalNode.GetKey("$defs") + if err != nil { + return nil, err + } + updateWithNodeDefs, err := updateWithNode.GetKey("$defs") + if err != nil { + return nil, err + } + + for _, defKey := range originalNodeDefs.Keys() { + v, err := originalNodeDefs.GetKey(defKey) + + if err != nil { + return nil, errors.Wrapf(err, "unable to get original key: %s", defKey) + } + if v == nil { + continue + } + if r, ok := configurableDefinitions[defKey]; ok { + // replace this def with configurable one + // store important props before replace + configurable := getBool("configurable", v) + path := getStr("path", v) + propertyOrder := getInt("propertyOrder", v) + + // + _ = setStr("path", path, r) + _ = setBool("configurable", configurable, r) + _ = setInt("propertyOrder", propertyOrder, r) + + if err = v.SetNode(r); err != nil { + return nil, err + } + continue + } + + if !getBool("configurable", v) { + continue + } + updated, err := updateWithNodeDefs.GetKey(defKey) + if updated == nil { + // in user's customised schema definition is not presented, skipping + continue + } + if err = v.SetNode(updated); err != nil { + return nil, err + } + configurableDefinitions[defKey] = updated + } + + return ajson.Marshal(originalNode) +} + +func setStr(param string, val string, v *ajson.Node) error { + if c, err := v.GetKey(param); err == nil { + return c.SetNode(ajson.StringNode("", val)) + } + return v.AppendObject(param, ajson.StringNode("", val)) +} + +func setBool(param string, val bool, v *ajson.Node) error { + if c, err := v.GetKey(param); err == nil { + return c.SetNode(ajson.BoolNode("", val)) + } + return v.AppendObject(param, ajson.BoolNode("", val)) +} + +func setInt(param string, val int, v *ajson.Node) error { + if c, err := v.GetKey(param); err == nil { + return c.SetNode(ajson.NumericNode("", float64(val))) + } + return v.AppendObject(param, ajson.NumericNode("", float64(val))) +} + +func getStr(param string, v *ajson.Node) string { + c, _ := v.GetKey(param) + if c != nil { + // if node has override + b, _ := c.GetString() + return b + } + return "" +} + +func getInt(param string, v *ajson.Node) int { + c, _ := v.GetKey(param) + if c != nil { + // if node has override + b, _ := c.GetNumeric() + return int(b) + } + return 0 +} + +func getBool(param string, v *ajson.Node) bool { + c, _ := v.GetKey(param) + if c != nil { + // if node has override + b, _ := c.GetBool() + return b + } + return false +} + +func getPath(defName string, all map[string]TagDefinition, path []string) []string { + if p, ok := all[defName]; ok { + // check parent + return getPath(p.Definition, all, append(path, p.Path)) + } + return path +} + +func reverse(s []string) []string { + n := reflect.ValueOf(s).Len() + swap := reflect.Swapper(s) + for i, j := 0, n-1; i < j; i, j = i+1, j-1 { + swap(i, j) + } + return s +} diff --git a/pkg/api/module-go/cmp.pb.go b/pkg/api/module-go/cmp.pb.go new file mode 100644 index 0000000..c4b2a17 --- /dev/null +++ b/pkg/api/module-go/cmp.pb.go @@ -0,0 +1,170 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: cmp.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Component struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=Description,proto3" json:"Description,omitempty"` + Info string `protobuf:"bytes,4,opt,name=Info,proto3" json:"Info,omitempty"` + Tags []string `protobuf:"bytes,5,rep,name=Tags,proto3" json:"Tags,omitempty"` +} + +func (x *Component) Reset() { + *x = Component{} + if protoimpl.UnsafeEnabled { + mi := &file_cmp_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Component) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Component) ProtoMessage() {} + +func (x *Component) ProtoReflect() protoreflect.Message { + mi := &file_cmp_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Component.ProtoReflect.Descriptor instead. +func (*Component) Descriptor() ([]byte, []int) { + return file_cmp_proto_rawDescGZIP(), []int{0} +} + +func (x *Component) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Component) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Component) GetInfo() string { + if x != nil { + return x.Info + } + return "" +} + +func (x *Component) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +var File_cmp_proto protoreflect.FileDescriptor + +var file_cmp_proto_rawDesc = []byte{ + 0x0a, 0x09, 0x63, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x22, 0x69, 0x0a, 0x09, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x4e, 0x61, 0x6d, 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, 0x12, 0x12, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x61, + 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x54, 0x61, 0x67, 0x73, 0x42, 0x14, + 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x67, 0x6f, 0x3b, 0x6d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cmp_proto_rawDescOnce sync.Once + file_cmp_proto_rawDescData = file_cmp_proto_rawDesc +) + +func file_cmp_proto_rawDescGZIP() []byte { + file_cmp_proto_rawDescOnce.Do(func() { + file_cmp_proto_rawDescData = protoimpl.X.CompressGZIP(file_cmp_proto_rawDescData) + }) + return file_cmp_proto_rawDescData +} + +var file_cmp_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cmp_proto_goTypes = []interface{}{ + (*Component)(nil), // 0: server.Component +} +var file_cmp_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_cmp_proto_init() } +func file_cmp_proto_init() { + if File_cmp_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cmp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Component); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cmp_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cmp_proto_goTypes, + DependencyIndexes: file_cmp_proto_depIdxs, + MessageInfos: file_cmp_proto_msgTypes, + }.Build() + File_cmp_proto = out.File + file_cmp_proto_rawDesc = nil + file_cmp_proto_goTypes = nil + file_cmp_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/graph.pb.go b/pkg/api/module-go/graph.pb.go new file mode 100644 index 0000000..51d8fbc --- /dev/null +++ b/pkg/api/module-go/graph.pb.go @@ -0,0 +1,426 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: graph.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GraphChangeServer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` +} + +func (x *GraphChangeServer) Reset() { + *x = GraphChangeServer{} + if protoimpl.UnsafeEnabled { + mi := &file_graph_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GraphChangeServer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphChangeServer) ProtoMessage() {} + +func (x *GraphChangeServer) ProtoReflect() protoreflect.Message { + mi := &file_graph_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphChangeServer.ProtoReflect.Descriptor instead. +func (*GraphChangeServer) Descriptor() ([]byte, []int) { + return file_graph_proto_rawDescGZIP(), []int{0} +} + +func (x *GraphChangeServer) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +type GraphChangeModule struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Version string `protobuf:"bytes,2,opt,name=Version,proto3" json:"Version,omitempty"` + VersionID string `protobuf:"bytes,3,opt,name=VersionID,proto3" json:"VersionID,omitempty"` +} + +func (x *GraphChangeModule) Reset() { + *x = GraphChangeModule{} + if protoimpl.UnsafeEnabled { + mi := &file_graph_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GraphChangeModule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphChangeModule) ProtoMessage() {} + +func (x *GraphChangeModule) ProtoReflect() protoreflect.Message { + mi := &file_graph_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphChangeModule.ProtoReflect.Descriptor instead. +func (*GraphChangeModule) Descriptor() ([]byte, []int) { + return file_graph_proto_rawDescGZIP(), []int{1} +} + +func (x *GraphChangeModule) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GraphChangeModule) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *GraphChangeModule) GetVersionID() string { + if x != nil { + return x.VersionID + } + return "" +} + +type GraphChange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Elements []*GraphElement `protobuf:"bytes,1,rep,name=Elements,proto3" json:"Elements,omitempty"` + Op GraphChangeOp `protobuf:"varint,2,opt,name=Op,proto3,enum=server.GraphChangeOp" json:"Op,omitempty"` + Server *GraphChangeServer `protobuf:"bytes,3,opt,name=Server,proto3" json:"Server,omitempty"` + Module *GraphChangeModule `protobuf:"bytes,4,opt,name=Module,proto3" json:"Module,omitempty"` +} + +func (x *GraphChange) Reset() { + *x = GraphChange{} + if protoimpl.UnsafeEnabled { + mi := &file_graph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GraphChange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphChange) ProtoMessage() {} + +func (x *GraphChange) ProtoReflect() protoreflect.Message { + mi := &file_graph_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphChange.ProtoReflect.Descriptor instead. +func (*GraphChange) Descriptor() ([]byte, []int) { + return file_graph_proto_rawDescGZIP(), []int{2} +} + +func (x *GraphChange) GetElements() []*GraphElement { + if x != nil { + return x.Elements + } + return nil +} + +func (x *GraphChange) GetOp() GraphChangeOp { + if x != nil { + return x.Op + } + return GraphChangeOp_UPDATE +} + +func (x *GraphChange) GetServer() *GraphChangeServer { + if x != nil { + return x.Server + } + return nil +} + +func (x *GraphChange) GetModule() *GraphChangeModule { + if x != nil { + return x.Module + } + return nil +} + +// any element of an element of the graph (using for storage) +type GraphElement struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + //string FlowID = 2; + Node *Node `protobuf:"bytes,3,opt,name=Node,proto3" json:"Node,omitempty"` + Edge *Edge `protobuf:"bytes,4,opt,name=Edge,proto3" json:"Edge,omitempty"` + Revision int64 `protobuf:"varint,5,opt,name=Revision,proto3" json:"Revision,omitempty"` +} + +func (x *GraphElement) Reset() { + *x = GraphElement{} + if protoimpl.UnsafeEnabled { + mi := &file_graph_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GraphElement) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphElement) ProtoMessage() {} + +func (x *GraphElement) ProtoReflect() protoreflect.Message { + mi := &file_graph_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphElement.ProtoReflect.Descriptor instead. +func (*GraphElement) Descriptor() ([]byte, []int) { + return file_graph_proto_rawDescGZIP(), []int{3} +} + +func (x *GraphElement) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +func (x *GraphElement) GetNode() *Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *GraphElement) GetEdge() *Edge { + if x != nil { + return x.Edge + } + return nil +} + +func (x *GraphElement) GetRevision() int64 { + if x != nil { + return x.Revision + } + return 0 +} + +var File_graph_proto protoreflect.FileDescriptor + +var file_graph_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x67, 0x72, 0x61, 0x70, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x1a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x23, 0x0a, 0x11, 0x47, 0x72, 0x61, 0x70, 0x68, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x22, 0x5f, 0x0a, 0x11, 0x47, 0x72, 0x61, 0x70, 0x68, 0x43, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x22, 0xcc, 0x01, 0x0a, 0x0b, 0x47, 0x72, 0x61, 0x70, + 0x68, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, + 0x08, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x02, 0x4f, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, + 0x72, 0x61, 0x70, 0x68, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x52, 0x02, 0x4f, 0x70, + 0x12, 0x31, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x43, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x72, 0x61, + 0x70, 0x68, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x06, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x22, 0x7e, 0x0a, 0x0c, 0x47, 0x72, 0x61, 0x70, 0x68, 0x45, + 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4e, 0x6f, + 0x64, 0x65, 0x52, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x04, 0x45, 0x64, 0x67, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x45, 0x64, 0x67, 0x65, 0x52, 0x04, 0x45, 0x64, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x65, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x2d, 0x67, 0x6f, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_graph_proto_rawDescOnce sync.Once + file_graph_proto_rawDescData = file_graph_proto_rawDesc +) + +func file_graph_proto_rawDescGZIP() []byte { + file_graph_proto_rawDescOnce.Do(func() { + file_graph_proto_rawDescData = protoimpl.X.CompressGZIP(file_graph_proto_rawDescData) + }) + return file_graph_proto_rawDescData +} + +var file_graph_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_graph_proto_goTypes = []interface{}{ + (*GraphChangeServer)(nil), // 0: server.GraphChangeServer + (*GraphChangeModule)(nil), // 1: server.GraphChangeModule + (*GraphChange)(nil), // 2: server.GraphChange + (*GraphElement)(nil), // 3: server.GraphElement + (GraphChangeOp)(0), // 4: server.GraphChangeOp + (*Node)(nil), // 5: server.Node + (*Edge)(nil), // 6: server.Edge +} +var file_graph_proto_depIdxs = []int32{ + 3, // 0: server.GraphChange.Elements:type_name -> server.GraphElement + 4, // 1: server.GraphChange.Op:type_name -> server.GraphChangeOp + 0, // 2: server.GraphChange.Server:type_name -> server.GraphChangeServer + 1, // 3: server.GraphChange.Module:type_name -> server.GraphChangeModule + 5, // 4: server.GraphElement.Node:type_name -> server.Node + 6, // 5: server.GraphElement.Edge:type_name -> server.Edge + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_graph_proto_init() } +func file_graph_proto_init() { + if File_graph_proto != nil { + return + } + file_node_proto_init() + if !protoimpl.UnsafeEnabled { + file_graph_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GraphChangeServer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_graph_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GraphChangeModule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_graph_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GraphChange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_graph_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GraphElement); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_graph_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_graph_proto_goTypes, + DependencyIndexes: file_graph_proto_depIdxs, + MessageInfos: file_graph_proto_msgTypes, + }.Build() + File_graph_proto = out.File + file_graph_proto_rawDesc = nil + file_graph_proto_goTypes = nil + file_graph_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/instance.pb.go b/pkg/api/module-go/instance.pb.go new file mode 100644 index 0000000..6cb74f1 --- /dev/null +++ b/pkg/api/module-go/instance.pb.go @@ -0,0 +1,328 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: instance.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ConfigureInstanceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FlowID string `protobuf:"bytes,1,opt,name=FlowID,proto3" json:"FlowID,omitempty"` + ComponentID string `protobuf:"bytes,2,opt,name=ComponentID,proto3" json:"ComponentID,omitempty"` + //string InstanceName = 3; + InstanceID string `protobuf:"bytes,4,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // list of port mapping with nats subjects + Destinations []*MapPort `protobuf:"bytes,6,rep,name=Destinations,proto3" json:"Destinations,omitempty"` + Revision int64 `protobuf:"varint,7,opt,name=Revision,proto3" json:"Revision,omitempty"` + //string InstanceLabel = 8; + PortConfigs []*PortConfig `protobuf:"bytes,9,rep,name=PortConfigs,proto3" json:"PortConfigs,omitempty"` + Run bool `protobuf:"varint,10,opt,name=Run,proto3" json:"Run,omitempty"` + Data *structpb.Struct `protobuf:"bytes,11,opt,name=Data,proto3" json:"Data,omitempty"` +} + +func (x *ConfigureInstanceRequest) Reset() { + *x = ConfigureInstanceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_instance_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigureInstanceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigureInstanceRequest) ProtoMessage() {} + +func (x *ConfigureInstanceRequest) ProtoReflect() protoreflect.Message { + mi := &file_instance_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigureInstanceRequest.ProtoReflect.Descriptor instead. +func (*ConfigureInstanceRequest) Descriptor() ([]byte, []int) { + return file_instance_proto_rawDescGZIP(), []int{0} +} + +func (x *ConfigureInstanceRequest) GetFlowID() string { + if x != nil { + return x.FlowID + } + return "" +} + +func (x *ConfigureInstanceRequest) GetComponentID() string { + if x != nil { + return x.ComponentID + } + return "" +} + +func (x *ConfigureInstanceRequest) GetInstanceID() string { + if x != nil { + return x.InstanceID + } + return "" +} + +func (x *ConfigureInstanceRequest) GetDestinations() []*MapPort { + if x != nil { + return x.Destinations + } + return nil +} + +func (x *ConfigureInstanceRequest) GetRevision() int64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *ConfigureInstanceRequest) GetPortConfigs() []*PortConfig { + if x != nil { + return x.PortConfigs + } + return nil +} + +func (x *ConfigureInstanceRequest) GetRun() bool { + if x != nil { + return x.Run + } + return false +} + +func (x *ConfigureInstanceRequest) GetData() *structpb.Struct { + if x != nil { + return x.Data + } + return nil +} + +type ConfigureInstanceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsRunning bool `protobuf:"varint,2,opt,name=IsRunning,proto3" json:"IsRunning,omitempty"` + HasError bool `protobuf:"varint,3,opt,name=HasError,proto3" json:"HasError,omitempty"` + Error string `protobuf:"bytes,4,opt,name=Error,proto3" json:"Error,omitempty"` + Changes []*GraphChange `protobuf:"bytes,5,rep,name=Changes,proto3" json:"Changes,omitempty"` +} + +func (x *ConfigureInstanceResponse) Reset() { + *x = ConfigureInstanceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_instance_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigureInstanceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigureInstanceResponse) ProtoMessage() {} + +func (x *ConfigureInstanceResponse) ProtoReflect() protoreflect.Message { + mi := &file_instance_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigureInstanceResponse.ProtoReflect.Descriptor instead. +func (*ConfigureInstanceResponse) Descriptor() ([]byte, []int) { + return file_instance_proto_rawDescGZIP(), []int{1} +} + +func (x *ConfigureInstanceResponse) GetIsRunning() bool { + if x != nil { + return x.IsRunning + } + return false +} + +func (x *ConfigureInstanceResponse) GetHasError() bool { + if x != nil { + return x.HasError + } + return false +} + +func (x *ConfigureInstanceResponse) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +func (x *ConfigureInstanceResponse) GetChanges() []*GraphChange { + if x != nil { + return x.Changes + } + return nil +} + +var File_instance_proto protoreflect.FileDescriptor + +var file_instance_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x1a, 0x0d, 0x6d, 0x61, 0x70, 0x70, 0x6f, 0x72, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x70, 0x6f, 0x72, 0x74, 0x2d, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x67, 0x72, 0x61, 0x70, + 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 0x02, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x75, 0x72, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x0c, + 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x70, 0x50, + 0x6f, 0x72, 0x74, 0x52, 0x0c, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, + 0x0b, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x09, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x6f, 0x72, 0x74, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x52, 0x75, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x03, 0x52, 0x75, 0x6e, 0x12, 0x2b, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x44, 0x61, + 0x74, 0x61, 0x22, 0x9a, 0x01, 0x0a, 0x19, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x73, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x49, 0x73, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x1a, + 0x0a, 0x08, 0x48, 0x61, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x48, 0x61, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x12, 0x2d, 0x0a, 0x07, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x07, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x42, + 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x67, 0x6f, 0x3b, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_instance_proto_rawDescOnce sync.Once + file_instance_proto_rawDescData = file_instance_proto_rawDesc +) + +func file_instance_proto_rawDescGZIP() []byte { + file_instance_proto_rawDescOnce.Do(func() { + file_instance_proto_rawDescData = protoimpl.X.CompressGZIP(file_instance_proto_rawDescData) + }) + return file_instance_proto_rawDescData +} + +var file_instance_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_instance_proto_goTypes = []interface{}{ + (*ConfigureInstanceRequest)(nil), // 0: server.ConfigureInstanceRequest + (*ConfigureInstanceResponse)(nil), // 1: server.ConfigureInstanceResponse + (*MapPort)(nil), // 2: server.MapPort + (*PortConfig)(nil), // 3: server.PortConfig + (*structpb.Struct)(nil), // 4: google.protobuf.Struct + (*GraphChange)(nil), // 5: server.GraphChange +} +var file_instance_proto_depIdxs = []int32{ + 2, // 0: server.ConfigureInstanceRequest.Destinations:type_name -> server.MapPort + 3, // 1: server.ConfigureInstanceRequest.PortConfigs:type_name -> server.PortConfig + 4, // 2: server.ConfigureInstanceRequest.Data:type_name -> google.protobuf.Struct + 5, // 3: server.ConfigureInstanceResponse.Changes:type_name -> server.GraphChange + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] 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 +} + +func init() { file_instance_proto_init() } +func file_instance_proto_init() { + if File_instance_proto != nil { + return + } + file_mapport_proto_init() + file_port_config_proto_init() + file_graph_proto_init() + if !protoimpl.UnsafeEnabled { + file_instance_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConfigureInstanceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_instance_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConfigureInstanceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_instance_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_instance_proto_goTypes, + DependencyIndexes: file_instance_proto_depIdxs, + MessageInfos: file_instance_proto_msgTypes, + }.Build() + File_instance_proto = out.File + file_instance_proto_rawDesc = nil + file_instance_proto_goTypes = nil + file_instance_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/mapport.pb.go b/pkg/api/module-go/mapport.pb.go new file mode 100644 index 0000000..4e14f73 --- /dev/null +++ b/pkg/api/module-go/mapport.pb.go @@ -0,0 +1,160 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: mapport.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type MapPort struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + From string `protobuf:"bytes,1,opt,name=From,proto3" json:"From,omitempty"` // full port name name + To string `protobuf:"bytes,2,opt,name=To,proto3" json:"To,omitempty"` + EdgeID string `protobuf:"bytes,3,opt,name=EdgeID,proto3" json:"EdgeID,omitempty"` +} + +func (x *MapPort) Reset() { + *x = MapPort{} + if protoimpl.UnsafeEnabled { + mi := &file_mapport_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MapPort) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MapPort) ProtoMessage() {} + +func (x *MapPort) ProtoReflect() protoreflect.Message { + mi := &file_mapport_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MapPort.ProtoReflect.Descriptor instead. +func (*MapPort) Descriptor() ([]byte, []int) { + return file_mapport_proto_rawDescGZIP(), []int{0} +} + +func (x *MapPort) GetFrom() string { + if x != nil { + return x.From + } + return "" +} + +func (x *MapPort) GetTo() string { + if x != nil { + return x.To + } + return "" +} + +func (x *MapPort) GetEdgeID() string { + if x != nil { + return x.EdgeID + } + return "" +} + +var File_mapport_proto protoreflect.FileDescriptor + +var file_mapport_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x6d, 0x61, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x45, 0x0a, 0x07, 0x4d, 0x61, 0x70, 0x50, 0x6f, + 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x6f, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x54, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x45, 0x64, 0x67, 0x65, 0x49, 0x44, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x45, 0x64, 0x67, 0x65, 0x49, 0x44, 0x42, 0x14, + 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x67, 0x6f, 0x3b, 0x6d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_mapport_proto_rawDescOnce sync.Once + file_mapport_proto_rawDescData = file_mapport_proto_rawDesc +) + +func file_mapport_proto_rawDescGZIP() []byte { + file_mapport_proto_rawDescOnce.Do(func() { + file_mapport_proto_rawDescData = protoimpl.X.CompressGZIP(file_mapport_proto_rawDescData) + }) + return file_mapport_proto_rawDescData +} + +var file_mapport_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_mapport_proto_goTypes = []interface{}{ + (*MapPort)(nil), // 0: server.MapPort +} +var file_mapport_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_mapport_proto_init() } +func file_mapport_proto_init() { + if File_mapport_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_mapport_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MapPort); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_mapport_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_mapport_proto_goTypes, + DependencyIndexes: file_mapport_proto_depIdxs, + MessageInfos: file_mapport_proto_msgTypes, + }.Build() + File_mapport_proto = out.File + file_mapport_proto_rawDesc = nil + file_mapport_proto_goTypes = nil + file_mapport_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/message.pb.go b/pkg/api/module-go/message.pb.go new file mode 100644 index 0000000..731885b --- /dev/null +++ b/pkg/api/module-go/message.pb.go @@ -0,0 +1,270 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: message.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type MessageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + From string `protobuf:"bytes,2,opt,name=From,proto3" json:"From,omitempty"` + Metadata map[string]string `protobuf:"bytes,4,rep,name=Metadata,proto3" json:"Metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Payload []byte `protobuf:"bytes,5,opt,name=Payload,proto3" json:"Payload,omitempty"` + EdgeID string `protobuf:"bytes,6,opt,name=EdgeID,proto3" json:"EdgeID,omitempty"` +} + +func (x *MessageRequest) Reset() { + *x = MessageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_message_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageRequest) ProtoMessage() {} + +func (x *MessageRequest) ProtoReflect() protoreflect.Message { + mi := &file_message_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageRequest.ProtoReflect.Descriptor instead. +func (*MessageRequest) Descriptor() ([]byte, []int) { + return file_message_proto_rawDescGZIP(), []int{0} +} + +func (x *MessageRequest) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +func (x *MessageRequest) GetFrom() string { + if x != nil { + return x.From + } + return "" +} + +func (x *MessageRequest) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *MessageRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *MessageRequest) GetEdgeID() string { + if x != nil { + return x.EdgeID + } + return "" +} + +type MessageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []byte `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"` + HasError bool `protobuf:"varint,3,opt,name=HasError,proto3" json:"HasError,omitempty"` + Error string `protobuf:"bytes,4,opt,name=Error,proto3" json:"Error,omitempty"` +} + +func (x *MessageResponse) Reset() { + *x = MessageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_message_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageResponse) ProtoMessage() {} + +func (x *MessageResponse) ProtoReflect() protoreflect.Message { + mi := &file_message_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageResponse.ProtoReflect.Descriptor instead. +func (*MessageResponse) Descriptor() ([]byte, []int) { + return file_message_proto_rawDescGZIP(), []int{1} +} + +func (x *MessageResponse) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *MessageResponse) GetHasError() bool { + if x != nil { + return x.HasError + } + return false +} + +func (x *MessageResponse) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +var File_message_proto protoreflect.FileDescriptor + +var file_message_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0xe5, 0x01, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x72, + 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x40, + 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x45, 0x64, + 0x67, 0x65, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x45, 0x64, 0x67, 0x65, + 0x49, 0x44, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x57, 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x48, 0x61, 0x73, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x48, 0x61, 0x73, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x67, 0x6f, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_message_proto_rawDescOnce sync.Once + file_message_proto_rawDescData = file_message_proto_rawDesc +) + +func file_message_proto_rawDescGZIP() []byte { + file_message_proto_rawDescOnce.Do(func() { + file_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_message_proto_rawDescData) + }) + return file_message_proto_rawDescData +} + +var file_message_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_message_proto_goTypes = []interface{}{ + (*MessageRequest)(nil), // 0: server.MessageRequest + (*MessageResponse)(nil), // 1: server.MessageResponse + nil, // 2: server.MessageRequest.MetadataEntry +} +var file_message_proto_depIdxs = []int32{ + 2, // 0: server.MessageRequest.Metadata:type_name -> server.MessageRequest.MetadataEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_message_proto_init() } +func file_message_proto_init() { + if File_message_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_message_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_message_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_message_proto_goTypes, + DependencyIndexes: file_message_proto_depIdxs, + MessageInfos: file_message_proto_msgTypes, + }.Build() + File_message_proto = out.File + file_message_proto_rawDesc = nil + file_message_proto_goTypes = nil + file_message_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/module-version.pb.go b/pkg/api/module-go/module-version.pb.go new file mode 100644 index 0000000..2770453 --- /dev/null +++ b/pkg/api/module-go/module-version.pb.go @@ -0,0 +1,162 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: module-version.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ModuleVersion struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + ModuleName string `protobuf:"bytes,2,opt,name=ModuleName,proto3" json:"ModuleName,omitempty"` + Version string `protobuf:"bytes,3,opt,name=Version,proto3" json:"Version,omitempty"` +} + +func (x *ModuleVersion) Reset() { + *x = ModuleVersion{} + if protoimpl.UnsafeEnabled { + mi := &file_module_version_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ModuleVersion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ModuleVersion) ProtoMessage() {} + +func (x *ModuleVersion) ProtoReflect() protoreflect.Message { + mi := &file_module_version_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ModuleVersion.ProtoReflect.Descriptor instead. +func (*ModuleVersion) Descriptor() ([]byte, []int) { + return file_module_version_proto_rawDescGZIP(), []int{0} +} + +func (x *ModuleVersion) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +func (x *ModuleVersion) GetModuleName() string { + if x != nil { + return x.ModuleName + } + return "" +} + +func (x *ModuleVersion) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +var File_module_version_proto protoreflect.FileDescriptor + +var file_module_version_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x59, + 0x0a, 0x0d, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, + 0x1e, 0x0a, 0x0a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x67, 0x6f, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_module_version_proto_rawDescOnce sync.Once + file_module_version_proto_rawDescData = file_module_version_proto_rawDesc +) + +func file_module_version_proto_rawDescGZIP() []byte { + file_module_version_proto_rawDescOnce.Do(func() { + file_module_version_proto_rawDescData = protoimpl.X.CompressGZIP(file_module_version_proto_rawDescData) + }) + return file_module_version_proto_rawDescData +} + +var file_module_version_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_module_version_proto_goTypes = []interface{}{ + (*ModuleVersion)(nil), // 0: server.ModuleVersion +} +var file_module_version_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_module_version_proto_init() } +func file_module_version_proto_init() { + if File_module_version_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_module_version_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModuleVersion); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_module_version_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_module_version_proto_goTypes, + DependencyIndexes: file_module_version_proto_depIdxs, + MessageInfos: file_module_version_proto_msgTypes, + }.Build() + File_module_version_proto = out.File + file_module_version_proto_rawDesc = nil + file_module_version_proto_goTypes = nil + file_module_version_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/node.pb.go b/pkg/api/module-go/node.pb.go new file mode 100644 index 0000000..b3d3574 --- /dev/null +++ b/pkg/api/module-go/node.pb.go @@ -0,0 +1,595 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: node.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GraphChangeOp int32 + +const ( + GraphChangeOp_UPDATE GraphChangeOp = 0 + GraphChangeOp_DELETE GraphChangeOp = 1 +) + +// Enum value maps for GraphChangeOp. +var ( + GraphChangeOp_name = map[int32]string{ + 0: "UPDATE", + 1: "DELETE", + } + GraphChangeOp_value = map[string]int32{ + "UPDATE": 0, + "DELETE": 1, + } +) + +func (x GraphChangeOp) Enum() *GraphChangeOp { + p := new(GraphChangeOp) + *p = x + return p +} + +func (x GraphChangeOp) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GraphChangeOp) Descriptor() protoreflect.EnumDescriptor { + return file_node_proto_enumTypes[0].Descriptor() +} + +func (GraphChangeOp) Type() protoreflect.EnumType { + return &file_node_proto_enumTypes[0] +} + +func (x GraphChangeOp) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GraphChangeOp.Descriptor instead. +func (GraphChangeOp) EnumDescriptor() ([]byte, []int) { + return file_node_proto_rawDescGZIP(), []int{0} +} + +type Node struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + //string Label = 1; + // if implements runnable interface + Runnable bool `protobuf:"varint,2,opt,name=Runnable,proto3" json:"Runnable,omitempty"` + ComponentID string `protobuf:"bytes,5,opt,name=ComponentID,proto3" json:"ComponentID,omitempty"` + Position *Position `protobuf:"bytes,6,opt,name=Position,proto3" json:"Position,omitempty"` + Ports []*NodePort `protobuf:"bytes,7,rep,name=Ports,proto3" json:"Ports,omitempty"` + // if we want to see its running + Run bool `protobuf:"varint,8,opt,name=Run,proto3" json:"Run,omitempty"` // connection between other nodes + Destinations []*MapPort `protobuf:"bytes,9,rep,name=Destinations,proto3" json:"Destinations,omitempty"` + PortConfigs []*PortConfig `protobuf:"bytes,13,rep,name=PortConfigs,proto3" json:"PortConfigs,omitempty"` + //string Name = 10; + Data *structpb.Struct `protobuf:"bytes,11,opt,name=Data,proto3" json:"Data,omitempty"` +} + +func (x *Node) Reset() { + *x = Node{} + if protoimpl.UnsafeEnabled { + mi := &file_node_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Node) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Node) ProtoMessage() {} + +func (x *Node) ProtoReflect() protoreflect.Message { + mi := &file_node_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Node.ProtoReflect.Descriptor instead. +func (*Node) Descriptor() ([]byte, []int) { + return file_node_proto_rawDescGZIP(), []int{0} +} + +func (x *Node) GetRunnable() bool { + if x != nil { + return x.Runnable + } + return false +} + +func (x *Node) GetComponentID() string { + if x != nil { + return x.ComponentID + } + return "" +} + +func (x *Node) GetPosition() *Position { + if x != nil { + return x.Position + } + return nil +} + +func (x *Node) GetPorts() []*NodePort { + if x != nil { + return x.Ports + } + return nil +} + +func (x *Node) GetRun() bool { + if x != nil { + return x.Run + } + return false +} + +func (x *Node) GetDestinations() []*MapPort { + if x != nil { + return x.Destinations + } + return nil +} + +func (x *Node) GetPortConfigs() []*PortConfig { + if x != nil { + return x.PortConfigs + } + return nil +} + +func (x *Node) GetData() *structpb.Struct { + if x != nil { + return x.Data + } + return nil +} + +type Position struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + X int32 `protobuf:"varint,1,opt,name=X,proto3" json:"X,omitempty"` + Y int32 `protobuf:"varint,2,opt,name=Y,proto3" json:"Y,omitempty"` + Spin int32 `protobuf:"varint,3,opt,name=Spin,proto3" json:"Spin,omitempty"` +} + +func (x *Position) Reset() { + *x = Position{} + if protoimpl.UnsafeEnabled { + mi := &file_node_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Position) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Position) ProtoMessage() {} + +func (x *Position) ProtoReflect() protoreflect.Message { + mi := &file_node_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Position.ProtoReflect.Descriptor instead. +func (*Position) Descriptor() ([]byte, []int) { + return file_node_proto_rawDescGZIP(), []int{1} +} + +func (x *Position) GetX() int32 { + if x != nil { + return x.X + } + return 0 +} + +func (x *Position) GetY() int32 { + if x != nil { + return x.Y + } + return 0 +} + +func (x *Position) GetSpin() int32 { + if x != nil { + return x.Spin + } + return 0 +} + +type Edge struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Source string `protobuf:"bytes,1,opt,name=Source,proto3" json:"Source,omitempty"` + Target string `protobuf:"bytes,2,opt,name=Target,proto3" json:"Target,omitempty"` + SourceHandle string `protobuf:"bytes,3,opt,name=SourceHandle,proto3" json:"SourceHandle,omitempty"` + TargetHandle string `protobuf:"bytes,4,opt,name=TargetHandle,proto3" json:"TargetHandle,omitempty"` +} + +func (x *Edge) Reset() { + *x = Edge{} + if protoimpl.UnsafeEnabled { + mi := &file_node_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Edge) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Edge) ProtoMessage() {} + +func (x *Edge) ProtoReflect() protoreflect.Message { + mi := &file_node_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Edge.ProtoReflect.Descriptor instead. +func (*Edge) Descriptor() ([]byte, []int) { + return file_node_proto_rawDescGZIP(), []int{2} +} + +func (x *Edge) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *Edge) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + +func (x *Edge) GetSourceHandle() string { + if x != nil { + return x.SourceHandle + } + return "" +} + +func (x *Edge) GetTargetHandle() string { + if x != nil { + return x.TargetHandle + } + return "" +} + +type NodePort struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Source bool `protobuf:"varint,1,opt,name=Source,proto3" json:"Source,omitempty"` + Position int32 `protobuf:"varint,2,opt,name=Position,proto3" json:"Position,omitempty"` + PortName string `protobuf:"bytes,3,opt,name=PortName,proto3" json:"PortName,omitempty"` + Label string `protobuf:"bytes,4,opt,name=Label,proto3" json:"Label,omitempty"` + IsSettings bool `protobuf:"varint,5,opt,name=IsSettings,proto3" json:"IsSettings,omitempty"` + // schema generated from DTO + SchemaDefault []byte `protobuf:"bytes,6,opt,name=SchemaDefault,proto3" json:"SchemaDefault,omitempty"` + // schema with adjustments using schema editor + Status bool `protobuf:"varint,7,opt,name=Status,proto3" json:"Status,omitempty"` + // default setup of the port/handle + //bytes Configuration = 8; + ConfigurationDefault []byte `protobuf:"bytes,9,opt,name=ConfigurationDefault,proto3" json:"ConfigurationDefault,omitempty"` +} + +func (x *NodePort) Reset() { + *x = NodePort{} + if protoimpl.UnsafeEnabled { + mi := &file_node_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodePort) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodePort) ProtoMessage() {} + +func (x *NodePort) ProtoReflect() protoreflect.Message { + mi := &file_node_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NodePort.ProtoReflect.Descriptor instead. +func (*NodePort) Descriptor() ([]byte, []int) { + return file_node_proto_rawDescGZIP(), []int{3} +} + +func (x *NodePort) GetSource() bool { + if x != nil { + return x.Source + } + return false +} + +func (x *NodePort) GetPosition() int32 { + if x != nil { + return x.Position + } + return 0 +} + +func (x *NodePort) GetPortName() string { + if x != nil { + return x.PortName + } + return "" +} + +func (x *NodePort) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *NodePort) GetIsSettings() bool { + if x != nil { + return x.IsSettings + } + return false +} + +func (x *NodePort) GetSchemaDefault() []byte { + if x != nil { + return x.SchemaDefault + } + return nil +} + +func (x *NodePort) GetStatus() bool { + if x != nil { + return x.Status + } + return false +} + +func (x *NodePort) GetConfigurationDefault() []byte { + if x != nil { + return x.ConfigurationDefault + } + return nil +} + +var File_node_proto protoreflect.FileDescriptor + +var file_node_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x0d, 0x6d, 0x61, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x11, 0x70, 0x6f, 0x72, 0x74, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc4, 0x02, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x52, 0x75, 0x6e, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x52, 0x75, 0x6e, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x2c, 0x0a, 0x08, 0x50, + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x08, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x05, 0x50, 0x6f, 0x72, + 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x05, 0x50, 0x6f, 0x72, 0x74, + 0x73, 0x12, 0x10, 0x0a, 0x03, 0x52, 0x75, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, + 0x52, 0x75, 0x6e, 0x12, 0x33, 0x0a, 0x0c, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0c, 0x44, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, 0x0a, 0x0b, 0x50, 0x6f, 0x72, 0x74, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x0b, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x2b, + 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x3a, 0x0a, 0x08, 0x50, + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x0a, 0x01, 0x58, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x01, 0x58, 0x12, 0x0c, 0x0a, 0x01, 0x59, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x01, 0x59, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x70, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x04, 0x53, 0x70, 0x69, 0x6e, 0x22, 0x7e, 0x0a, 0x04, 0x45, 0x64, 0x67, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, + 0x22, 0x0a, 0x0c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x61, 0x6e, + 0x64, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x6e, + 0x64, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, + 0x50, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, + 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, + 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6f, 0x72, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6f, 0x72, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x73, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, + 0x49, 0x73, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0d, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x14, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x2a, 0x27, 0x0a, 0x0d, + 0x47, 0x72, 0x61, 0x70, 0x68, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x12, 0x0a, 0x0a, + 0x06, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, + 0x45, 0x54, 0x45, 0x10, 0x01, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2d, 0x67, 0x6f, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_node_proto_rawDescOnce sync.Once + file_node_proto_rawDescData = file_node_proto_rawDesc +) + +func file_node_proto_rawDescGZIP() []byte { + file_node_proto_rawDescOnce.Do(func() { + file_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_node_proto_rawDescData) + }) + return file_node_proto_rawDescData +} + +var file_node_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_node_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_node_proto_goTypes = []interface{}{ + (GraphChangeOp)(0), // 0: server.GraphChangeOp + (*Node)(nil), // 1: server.Node + (*Position)(nil), // 2: server.Position + (*Edge)(nil), // 3: server.Edge + (*NodePort)(nil), // 4: server.NodePort + (*MapPort)(nil), // 5: server.MapPort + (*PortConfig)(nil), // 6: server.PortConfig + (*structpb.Struct)(nil), // 7: google.protobuf.Struct +} +var file_node_proto_depIdxs = []int32{ + 2, // 0: server.Node.Position:type_name -> server.Position + 4, // 1: server.Node.Ports:type_name -> server.NodePort + 5, // 2: server.Node.Destinations:type_name -> server.MapPort + 6, // 3: server.Node.PortConfigs:type_name -> server.PortConfig + 7, // 4: server.Node.Data:type_name -> google.protobuf.Struct + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_node_proto_init() } +func file_node_proto_init() { + if File_node_proto != nil { + return + } + file_mapport_proto_init() + file_port_config_proto_init() + if !protoimpl.UnsafeEnabled { + file_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Node); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_node_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Position); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_node_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Edge); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_node_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodePort); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_node_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_node_proto_goTypes, + DependencyIndexes: file_node_proto_depIdxs, + EnumInfos: file_node_proto_enumTypes, + MessageInfos: file_node_proto_msgTypes, + }.Build() + File_node_proto = out.File + file_node_proto_rawDesc = nil + file_node_proto_goTypes = nil + file_node_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/platform.messages.pb.go b/pkg/api/module-go/platform.messages.pb.go new file mode 100644 index 0000000..9911f92 --- /dev/null +++ b/pkg/api/module-go/platform.messages.pb.go @@ -0,0 +1,706 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: platform.messages.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetManifestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerKey string `protobuf:"bytes,1,opt,name=ServerKey,proto3" json:"ServerKey,omitempty"` // from ags + DevMode bool `protobuf:"varint,2,opt,name=DevMode,proto3" json:"DevMode,omitempty"` // not sure about it + DeveloperKey string `protobuf:"bytes,3,opt,name=DeveloperKey,proto3" json:"DeveloperKey,omitempty"` //if dev mode is on, developer_key is required, maybe if no modVerID + Version string `protobuf:"bytes,6,opt,name=Version,proto3" json:"Version,omitempty"` + ModuleVersionID string `protobuf:"bytes,7,opt,name=ModuleVersionID,proto3" json:"ModuleVersionID,omitempty"` // from ldflags if any +} + +func (x *GetManifestRequest) Reset() { + *x = GetManifestRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_platform_messages_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetManifestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetManifestRequest) ProtoMessage() {} + +func (x *GetManifestRequest) ProtoReflect() protoreflect.Message { + mi := &file_platform_messages_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetManifestRequest.ProtoReflect.Descriptor instead. +func (*GetManifestRequest) Descriptor() ([]byte, []int) { + return file_platform_messages_proto_rawDescGZIP(), []int{0} +} + +func (x *GetManifestRequest) GetServerKey() string { + if x != nil { + return x.ServerKey + } + return "" +} + +func (x *GetManifestRequest) GetDevMode() bool { + if x != nil { + return x.DevMode + } + return false +} + +func (x *GetManifestRequest) GetDeveloperKey() string { + if x != nil { + return x.DeveloperKey + } + return "" +} + +func (x *GetManifestRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *GetManifestRequest) GetModuleVersionID() string { + if x != nil { + return x.ModuleVersionID + } + return "" +} + +// @todo - nats auth keys? +type GetManifestResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RunnerConfig *RunnerConfig `protobuf:"bytes,1,opt,name=RunnerConfig,proto3" json:"RunnerConfig,omitempty"` + Modules []*ModuleVersion `protobuf:"bytes,2,rep,name=Modules,proto3" json:"Modules,omitempty"` // empty if dev mode is on + Instances []*ConfigureInstanceRequest `protobuf:"bytes,3,rep,name=Instances,proto3" json:"Instances,omitempty"` // instances to bootstrap +} + +func (x *GetManifestResponse) Reset() { + *x = GetManifestResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_platform_messages_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetManifestResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetManifestResponse) ProtoMessage() {} + +func (x *GetManifestResponse) ProtoReflect() protoreflect.Message { + mi := &file_platform_messages_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetManifestResponse.ProtoReflect.Descriptor instead. +func (*GetManifestResponse) Descriptor() ([]byte, []int) { + return file_platform_messages_proto_rawDescGZIP(), []int{1} +} + +func (x *GetManifestResponse) GetRunnerConfig() *RunnerConfig { + if x != nil { + return x.RunnerConfig + } + return nil +} + +func (x *GetManifestResponse) GetModules() []*ModuleVersion { + if x != nil { + return x.Modules + } + return nil +} + +func (x *GetManifestResponse) GetInstances() []*ConfigureInstanceRequest { + if x != nil { + return x.Instances + } + return nil +} + +type PublishModuleRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` // by publisher from module info + Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` // by publisher from module info + Info string `protobuf:"bytes,3,opt,name=Info,proto3" json:"Info,omitempty"` // from readme.md + DeveloperKey string `protobuf:"bytes,4,opt,name=DeveloperKey,proto3" json:"DeveloperKey,omitempty"` // from CI + Version string `protobuf:"bytes,8,opt,name=Version,proto3" json:"Version,omitempty"` // by publisher + Components []*Component `protobuf:"bytes,13,rep,name=Components,proto3" json:"Components,omitempty"` +} + +func (x *PublishModuleRequest) Reset() { + *x = PublishModuleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_platform_messages_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublishModuleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublishModuleRequest) ProtoMessage() {} + +func (x *PublishModuleRequest) ProtoReflect() protoreflect.Message { + mi := &file_platform_messages_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PublishModuleRequest.ProtoReflect.Descriptor instead. +func (*PublishModuleRequest) Descriptor() ([]byte, []int) { + return file_platform_messages_proto_rawDescGZIP(), []int{2} +} + +func (x *PublishModuleRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PublishModuleRequest) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *PublishModuleRequest) GetInfo() string { + if x != nil { + return x.Info + } + return "" +} + +func (x *PublishModuleRequest) GetDeveloperKey() string { + if x != nil { + return x.DeveloperKey + } + return "" +} + +func (x *PublishModuleRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *PublishModuleRequest) GetComponents() []*Component { + if x != nil { + return x.Components + } + return nil +} + +type BuildPushOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=Username,proto3" json:"Username,omitempty"` + Password string `protobuf:"bytes,2,opt,name=Password,proto3" json:"Password,omitempty"` + Repo string `protobuf:"bytes,3,opt,name=Repo,proto3" json:"Repo,omitempty"` + Tag string `protobuf:"bytes,4,opt,name=Tag,proto3" json:"Tag,omitempty"` +} + +func (x *BuildPushOptions) Reset() { + *x = BuildPushOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_platform_messages_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BuildPushOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BuildPushOptions) ProtoMessage() {} + +func (x *BuildPushOptions) ProtoReflect() protoreflect.Message { + mi := &file_platform_messages_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BuildPushOptions.ProtoReflect.Descriptor instead. +func (*BuildPushOptions) Descriptor() ([]byte, []int) { + return file_platform_messages_proto_rawDescGZIP(), []int{3} +} + +func (x *BuildPushOptions) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *BuildPushOptions) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *BuildPushOptions) GetRepo() string { + if x != nil { + return x.Repo + } + return "" +} + +func (x *BuildPushOptions) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +type PublishModuleResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Module *ModuleVersion `protobuf:"bytes,1,opt,name=Module,proto3" json:"Module,omitempty"` + Options *BuildPushOptions `protobuf:"bytes,2,opt,name=Options,proto3" json:"Options,omitempty"` +} + +func (x *PublishModuleResponse) Reset() { + *x = PublishModuleResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_platform_messages_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublishModuleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublishModuleResponse) ProtoMessage() {} + +func (x *PublishModuleResponse) ProtoReflect() protoreflect.Message { + mi := &file_platform_messages_proto_msgTypes[4] + 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 PublishModuleResponse.ProtoReflect.Descriptor instead. +func (*PublishModuleResponse) Descriptor() ([]byte, []int) { + return file_platform_messages_proto_rawDescGZIP(), []int{4} +} + +func (x *PublishModuleResponse) GetModule() *ModuleVersion { + if x != nil { + return x.Module + } + return nil +} + +func (x *PublishModuleResponse) GetOptions() *BuildPushOptions { + if x != nil { + return x.Options + } + return nil +} + +type UpdateModuleVersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + Repo string `protobuf:"bytes,2,opt,name=Repo,proto3" json:"Repo,omitempty"` + Tag string `protobuf:"bytes,3,opt,name=Tag,proto3" json:"Tag,omitempty"` +} + +func (x *UpdateModuleVersionRequest) Reset() { + *x = UpdateModuleVersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_platform_messages_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateModuleVersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateModuleVersionRequest) ProtoMessage() {} + +func (x *UpdateModuleVersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_platform_messages_proto_msgTypes[5] + 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 UpdateModuleVersionRequest.ProtoReflect.Descriptor instead. +func (*UpdateModuleVersionRequest) Descriptor() ([]byte, []int) { + return file_platform_messages_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateModuleVersionRequest) GetID() string { + if x != nil { + return x.ID + } + return "" +} + +func (x *UpdateModuleVersionRequest) GetRepo() string { + if x != nil { + return x.Repo + } + return "" +} + +func (x *UpdateModuleVersionRequest) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +type UpdateModuleVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateModuleVersionResponse) Reset() { + *x = UpdateModuleVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_platform_messages_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateModuleVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateModuleVersionResponse) ProtoMessage() {} + +func (x *UpdateModuleVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_platform_messages_proto_msgTypes[6] + 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 UpdateModuleVersionResponse.ProtoReflect.Descriptor instead. +func (*UpdateModuleVersionResponse) Descriptor() ([]byte, []int) { + return file_platform_messages_proto_rawDescGZIP(), []int{6} +} + +var File_platform_messages_proto protoreflect.FileDescriptor + +var file_platform_messages_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x1a, 0x14, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2d, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0e, 0x69, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x09, 0x63, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb4, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, + 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, + 0x0a, 0x09, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, + 0x44, 0x65, 0x76, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x44, + 0x65, 0x76, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, + 0x70, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x44, 0x65, + 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x22, 0xc0, + 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0c, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x0c, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x2f, 0x0a, 0x07, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x09, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x73, 0x22, 0xd1, 0x01, 0x0a, 0x14, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x12, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0c, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, + 0x72, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x44, 0x65, 0x76, 0x65, + 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, + 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x43, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x70, 0x0a, 0x10, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x50, 0x75, + 0x73, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x65, 0x70, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x52, 0x65, 0x70, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x54, 0x61, 0x67, 0x22, 0x7a, 0x0a, 0x15, 0x50, 0x75, 0x62, 0x6c, 0x69, + 0x73, 0x68, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2d, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, + 0x32, 0x0a, 0x07, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x50, + 0x75, 0x73, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x22, 0x52, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, + 0x44, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x65, 0x70, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x52, 0x65, 0x70, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x54, 0x61, 0x67, 0x22, 0x1d, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x2d, 0x67, 0x6f, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_platform_messages_proto_rawDescOnce sync.Once + file_platform_messages_proto_rawDescData = file_platform_messages_proto_rawDesc +) + +func file_platform_messages_proto_rawDescGZIP() []byte { + file_platform_messages_proto_rawDescOnce.Do(func() { + file_platform_messages_proto_rawDescData = protoimpl.X.CompressGZIP(file_platform_messages_proto_rawDescData) + }) + return file_platform_messages_proto_rawDescData +} + +var file_platform_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_platform_messages_proto_goTypes = []interface{}{ + (*GetManifestRequest)(nil), // 0: server.GetManifestRequest + (*GetManifestResponse)(nil), // 1: server.GetManifestResponse + (*PublishModuleRequest)(nil), // 2: server.PublishModuleRequest + (*BuildPushOptions)(nil), // 3: server.BuildPushOptions + (*PublishModuleResponse)(nil), // 4: server.PublishModuleResponse + (*UpdateModuleVersionRequest)(nil), // 5: server.UpdateModuleVersionRequest + (*UpdateModuleVersionResponse)(nil), // 6: server.UpdateModuleVersionResponse + (*RunnerConfig)(nil), // 7: server.RunnerConfig + (*ModuleVersion)(nil), // 8: server.ModuleVersion + (*ConfigureInstanceRequest)(nil), // 9: server.ConfigureInstanceRequest + (*Component)(nil), // 10: server.Component +} +var file_platform_messages_proto_depIdxs = []int32{ + 7, // 0: server.GetManifestResponse.RunnerConfig:type_name -> server.RunnerConfig + 8, // 1: server.GetManifestResponse.Modules:type_name -> server.ModuleVersion + 9, // 2: server.GetManifestResponse.Instances:type_name -> server.ConfigureInstanceRequest + 10, // 3: server.PublishModuleRequest.Components:type_name -> server.Component + 8, // 4: server.PublishModuleResponse.Module:type_name -> server.ModuleVersion + 3, // 5: server.PublishModuleResponse.Options:type_name -> server.BuildPushOptions + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_platform_messages_proto_init() } +func file_platform_messages_proto_init() { + if File_platform_messages_proto != nil { + return + } + file_module_version_proto_init() + file_runner_config_proto_init() + file_instance_proto_init() + file_cmp_proto_init() + if !protoimpl.UnsafeEnabled { + file_platform_messages_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetManifestRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_platform_messages_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetManifestResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_platform_messages_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublishModuleRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_platform_messages_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BuildPushOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_platform_messages_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublishModuleResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_platform_messages_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateModuleVersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_platform_messages_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateModuleVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_platform_messages_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_platform_messages_proto_goTypes, + DependencyIndexes: file_platform_messages_proto_depIdxs, + MessageInfos: file_platform_messages_proto_msgTypes, + }.Build() + File_platform_messages_proto = out.File + file_platform_messages_proto_rawDesc = nil + file_platform_messages_proto_goTypes = nil + file_platform_messages_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/platform.service.pb.go b/pkg/api/module-go/platform.service.pb.go new file mode 100644 index 0000000..88ffb28 --- /dev/null +++ b/pkg/api/module-go/platform.service.pb.go @@ -0,0 +1,95 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: platform.service.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var File_platform_service_proto protoreflect.FileDescriptor + +var file_platform_service_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x1a, 0x17, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x87, 0x02, 0x0a, 0x0f, 0x50, 0x6c, + 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, 0x0a, + 0x0b, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, + 0x67, 0x6f, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var file_platform_service_proto_goTypes = []interface{}{ + (*GetManifestRequest)(nil), // 0: server.GetManifestRequest + (*PublishModuleRequest)(nil), // 1: server.PublishModuleRequest + (*UpdateModuleVersionRequest)(nil), // 2: server.UpdateModuleVersionRequest + (*GetManifestResponse)(nil), // 3: server.GetManifestResponse + (*PublishModuleResponse)(nil), // 4: server.PublishModuleResponse + (*UpdateModuleVersionResponse)(nil), // 5: server.UpdateModuleVersionResponse +} +var file_platform_service_proto_depIdxs = []int32{ + 0, // 0: server.PlatformService.GetManifest:input_type -> server.GetManifestRequest + 1, // 1: server.PlatformService.PublishModule:input_type -> server.PublishModuleRequest + 2, // 2: server.PlatformService.UpdateModuleVersion:input_type -> server.UpdateModuleVersionRequest + 3, // 3: server.PlatformService.GetManifest:output_type -> server.GetManifestResponse + 4, // 4: server.PlatformService.PublishModule:output_type -> server.PublishModuleResponse + 5, // 5: server.PlatformService.UpdateModuleVersion:output_type -> server.UpdateModuleVersionResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_platform_service_proto_init() } +func file_platform_service_proto_init() { + if File_platform_service_proto != nil { + return + } + file_platform_messages_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_platform_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_platform_service_proto_goTypes, + DependencyIndexes: file_platform_service_proto_depIdxs, + }.Build() + File_platform_service_proto = out.File + file_platform_service_proto_rawDesc = nil + file_platform_service_proto_goTypes = nil + file_platform_service_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/platform.service_grpc.pb.go b/pkg/api/module-go/platform.service_grpc.pb.go new file mode 100644 index 0000000..b6b3a8e --- /dev/null +++ b/pkg/api/module-go/platform.service_grpc.pb.go @@ -0,0 +1,173 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package module + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// PlatformServiceClient is the client API for PlatformService 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 PlatformServiceClient interface { + GetManifest(ctx context.Context, in *GetManifestRequest, opts ...grpc.CallOption) (*GetManifestResponse, error) + PublishModule(ctx context.Context, in *PublishModuleRequest, opts ...grpc.CallOption) (*PublishModuleResponse, error) + UpdateModuleVersion(ctx context.Context, in *UpdateModuleVersionRequest, opts ...grpc.CallOption) (*UpdateModuleVersionResponse, error) +} + +type platformServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPlatformServiceClient(cc grpc.ClientConnInterface) PlatformServiceClient { + return &platformServiceClient{cc} +} + +func (c *platformServiceClient) GetManifest(ctx context.Context, in *GetManifestRequest, opts ...grpc.CallOption) (*GetManifestResponse, error) { + out := new(GetManifestResponse) + err := c.cc.Invoke(ctx, "/server.PlatformService/GetManifest", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *platformServiceClient) PublishModule(ctx context.Context, in *PublishModuleRequest, opts ...grpc.CallOption) (*PublishModuleResponse, error) { + out := new(PublishModuleResponse) + err := c.cc.Invoke(ctx, "/server.PlatformService/PublishModule", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *platformServiceClient) UpdateModuleVersion(ctx context.Context, in *UpdateModuleVersionRequest, opts ...grpc.CallOption) (*UpdateModuleVersionResponse, error) { + out := new(UpdateModuleVersionResponse) + err := c.cc.Invoke(ctx, "/server.PlatformService/UpdateModuleVersion", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PlatformServiceServer is the server API for PlatformService service. +// All implementations must embed UnimplementedPlatformServiceServer +// for forward compatibility +type PlatformServiceServer interface { + GetManifest(context.Context, *GetManifestRequest) (*GetManifestResponse, error) + PublishModule(context.Context, *PublishModuleRequest) (*PublishModuleResponse, error) + UpdateModuleVersion(context.Context, *UpdateModuleVersionRequest) (*UpdateModuleVersionResponse, error) + mustEmbedUnimplementedPlatformServiceServer() +} + +// UnimplementedPlatformServiceServer must be embedded to have forward compatible implementations. +type UnimplementedPlatformServiceServer struct { +} + +func (UnimplementedPlatformServiceServer) GetManifest(context.Context, *GetManifestRequest) (*GetManifestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetManifest not implemented") +} +func (UnimplementedPlatformServiceServer) PublishModule(context.Context, *PublishModuleRequest) (*PublishModuleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PublishModule not implemented") +} +func (UnimplementedPlatformServiceServer) UpdateModuleVersion(context.Context, *UpdateModuleVersionRequest) (*UpdateModuleVersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateModuleVersion not implemented") +} +func (UnimplementedPlatformServiceServer) mustEmbedUnimplementedPlatformServiceServer() {} + +// UnsafePlatformServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PlatformServiceServer will +// result in compilation errors. +type UnsafePlatformServiceServer interface { + mustEmbedUnimplementedPlatformServiceServer() +} + +func RegisterPlatformServiceServer(s grpc.ServiceRegistrar, srv PlatformServiceServer) { + s.RegisterService(&PlatformService_ServiceDesc, srv) +} + +func _PlatformService_GetManifest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetManifestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlatformServiceServer).GetManifest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/server.PlatformService/GetManifest", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlatformServiceServer).GetManifest(ctx, req.(*GetManifestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlatformService_PublishModule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublishModuleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlatformServiceServer).PublishModule(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/server.PlatformService/PublishModule", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlatformServiceServer).PublishModule(ctx, req.(*PublishModuleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PlatformService_UpdateModuleVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateModuleVersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlatformServiceServer).UpdateModuleVersion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/server.PlatformService/UpdateModuleVersion", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlatformServiceServer).UpdateModuleVersion(ctx, req.(*UpdateModuleVersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PlatformService_ServiceDesc is the grpc.ServiceDesc for PlatformService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PlatformService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "server.PlatformService", + HandlerType: (*PlatformServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetManifest", + Handler: _PlatformService_GetManifest_Handler, + }, + { + MethodName: "PublishModule", + Handler: _PlatformService_PublishModule_Handler, + }, + { + MethodName: "UpdateModuleVersion", + Handler: _PlatformService_UpdateModuleVersion_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "platform.service.proto", +} diff --git a/pkg/api/module-go/port-config.pb.go b/pkg/api/module-go/port-config.pb.go new file mode 100644 index 0000000..db0cb86 --- /dev/null +++ b/pkg/api/module-go/port-config.pb.go @@ -0,0 +1,193 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: port-config.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type PortConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + From string `protobuf:"bytes,1,opt,name=From,proto3" json:"From,omitempty"` // full port name, may be empty for a node's own config + PortName string `protobuf:"bytes,2,opt,name=PortName,proto3" json:"PortName,omitempty"` // port name of a node being configured + Configuration []byte `protobuf:"bytes,3,opt,name=Configuration,proto3" json:"Configuration,omitempty"` // json encoded data, not necessarily an object + Schema []byte `protobuf:"bytes,5,opt,name=Schema,proto3" json:"Schema,omitempty"` // port schema which might be customized + SchemaDefault []byte `protobuf:"bytes,6,opt,name=SchemaDefault,proto3" json:"SchemaDefault,omitempty"` // default json schema of the port (for the reset) + ConfigurationDefault []byte `protobuf:"bytes,7,opt,name=ConfigurationDefault,proto3" json:"ConfigurationDefault,omitempty"` // default configuration of the port (for the reset) +} + +func (x *PortConfig) Reset() { + *x = PortConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_port_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PortConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PortConfig) ProtoMessage() {} + +func (x *PortConfig) ProtoReflect() protoreflect.Message { + mi := &file_port_config_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PortConfig.ProtoReflect.Descriptor instead. +func (*PortConfig) Descriptor() ([]byte, []int) { + return file_port_config_proto_rawDescGZIP(), []int{0} +} + +func (x *PortConfig) GetFrom() string { + if x != nil { + return x.From + } + return "" +} + +func (x *PortConfig) GetPortName() string { + if x != nil { + return x.PortName + } + return "" +} + +func (x *PortConfig) GetConfiguration() []byte { + if x != nil { + return x.Configuration + } + return nil +} + +func (x *PortConfig) GetSchema() []byte { + if x != nil { + return x.Schema + } + return nil +} + +func (x *PortConfig) GetSchemaDefault() []byte { + if x != nil { + return x.SchemaDefault + } + return nil +} + +func (x *PortConfig) GetConfigurationDefault() []byte { + if x != nil { + return x.ConfigurationDefault + } + return nil +} + +var File_port_config_proto protoreflect.FileDescriptor + +var file_port_config_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x70, 0x6f, 0x72, 0x74, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0xd4, 0x01, 0x0a, 0x0a, + 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x72, + 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x1a, + 0x0a, 0x08, 0x50, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x50, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x16, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x24, 0x0a, 0x0d, 0x53, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0d, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x32, + 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x14, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x61, 0x75, + 0x6c, 0x74, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x67, + 0x6f, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_port_config_proto_rawDescOnce sync.Once + file_port_config_proto_rawDescData = file_port_config_proto_rawDesc +) + +func file_port_config_proto_rawDescGZIP() []byte { + file_port_config_proto_rawDescOnce.Do(func() { + file_port_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_port_config_proto_rawDescData) + }) + return file_port_config_proto_rawDescData +} + +var file_port_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_port_config_proto_goTypes = []interface{}{ + (*PortConfig)(nil), // 0: server.PortConfig +} +var file_port_config_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_port_config_proto_init() } +func file_port_config_proto_init() { + if File_port_config_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_port_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PortConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_port_config_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_port_config_proto_goTypes, + DependencyIndexes: file_port_config_proto_depIdxs, + MessageInfos: file_port_config_proto_msgTypes, + }.Build() + File_port_config_proto = out.File + file_port_config_proto_rawDesc = nil + file_port_config_proto_goTypes = nil + file_port_config_proto_depIdxs = nil +} diff --git a/pkg/api/module-go/runner-config.pb.go b/pkg/api/module-go/runner-config.pb.go new file mode 100644 index 0000000..8b12c4f --- /dev/null +++ b/pkg/api/module-go/runner-config.pb.go @@ -0,0 +1,163 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.20.3 +// source: runner-config.proto + +package module + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type RunnerConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerID string `protobuf:"bytes,1,opt,name=ServerID,proto3" json:"ServerID,omitempty"` + DevMode bool `protobuf:"varint,2,opt,name=DevMode,proto3" json:"DevMode,omitempty"` + WorkspaceID string `protobuf:"bytes,4,opt,name=WorkspaceID,proto3" json:"WorkspaceID,omitempty"` +} + +func (x *RunnerConfig) Reset() { + *x = RunnerConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_runner_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RunnerConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RunnerConfig) ProtoMessage() {} + +func (x *RunnerConfig) ProtoReflect() protoreflect.Message { + mi := &file_runner_config_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RunnerConfig.ProtoReflect.Descriptor instead. +func (*RunnerConfig) Descriptor() ([]byte, []int) { + return file_runner_config_proto_rawDescGZIP(), []int{0} +} + +func (x *RunnerConfig) GetServerID() string { + if x != nil { + return x.ServerID + } + return "" +} + +func (x *RunnerConfig) GetDevMode() bool { + if x != nil { + return x.DevMode + } + return false +} + +func (x *RunnerConfig) GetWorkspaceID() string { + if x != nil { + return x.WorkspaceID + } + return "" +} + +var File_runner_config_proto protoreflect.FileDescriptor + +var file_runner_config_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x66, 0x0a, + 0x0c, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, + 0x08, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x65, 0x76, + 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x44, 0x65, 0x76, 0x4d, + 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x49, 0x44, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0x2d, 0x67, 0x6f, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_runner_config_proto_rawDescOnce sync.Once + file_runner_config_proto_rawDescData = file_runner_config_proto_rawDesc +) + +func file_runner_config_proto_rawDescGZIP() []byte { + file_runner_config_proto_rawDescOnce.Do(func() { + file_runner_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_runner_config_proto_rawDescData) + }) + return file_runner_config_proto_rawDescData +} + +var file_runner_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_runner_config_proto_goTypes = []interface{}{ + (*RunnerConfig)(nil), // 0: server.RunnerConfig +} +var file_runner_config_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_runner_config_proto_init() } +func file_runner_config_proto_init() { + if File_runner_config_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_runner_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RunnerConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_runner_config_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_runner_config_proto_goTypes, + DependencyIndexes: file_runner_config_proto_depIdxs, + MessageInfos: file_runner_config_proto_msgTypes, + }.Build() + File_runner_config_proto = out.File + file_runner_config_proto_rawDesc = nil + file_runner_config_proto_goTypes = nil + file_runner_config_proto_depIdxs = nil +} diff --git a/pkg/evaluator/README.md b/pkg/evaluator/README.md new file mode 100644 index 0000000..a01014d --- /dev/null +++ b/pkg/evaluator/README.md @@ -0,0 +1 @@ +### Evaluates JSON path expressions diff --git a/pkg/evaluator/evaluator.go b/pkg/evaluator/evaluator.go new file mode 100644 index 0000000..a5b44ba --- /dev/null +++ b/pkg/evaluator/evaluator.go @@ -0,0 +1,99 @@ +package evaluator + +import ( + "fmt" + "github.com/spyzhov/ajson" +) + +type Callback func(expression string) (interface{}, error) + +type Evaluator struct { + callback Callback +} + +var DefaultCallback Callback = func(expression string) (interface{}, error) { + return nil, fmt.Errorf("not implemented") +} + +func NewEvaluator(callback Callback) *Evaluator { + if callback == nil { + callback = DefaultCallback + } + return &Evaluator{callback: callback} +} + +func (c *Evaluator) calculateResult(valNode *ajson.Node) (interface{}, error) { + + if valNode.IsObject() { + o := valNode.MustObject() + if len(o) == 2 { + // our special node + // value key or expression or both should exist + if expression, ok := o["expression"]; ok { + if expr, _ := expression.GetString(); expr != "" { + // if expression exists - calculate it + res, err := c.callback(expr) + if err == nil { + // replace by callback + return res, nil + } + } + var ok bool + if valNode, ok = o["value"]; ok { + return c.calculateResult(valNode) + } + } + } + } + + if valNode == nil { + // something went wrong, current object has no value sub node, return root as it is + return nil, nil + } + // recreate structure + if valNode.IsObject() { + m := map[string]interface{}{} + for _, propName := range valNode.Keys() { + propNode, err := valNode.GetKey(propName) + if err != nil { + return nil, err + } + res, err := c.calculateResult(propNode) + if err != nil { + return nil, err + } + m[propName] = res + } + return m, nil + + } else if valNode.IsArray() { + inheritors := valNode.Inheritors() + m := make([]interface{}, len(inheritors)) + for idx, node := range inheritors { + val, err := c.calculateResult(node) + if err != nil { + return nil, err + } + m[idx] = val + } + return m, nil + } + return valNode.Unpack() +} + +func (c *Evaluator) Eval(data []byte) (interface{}, error) { + root, err := ajson.Unmarshal(data) + if err != nil { + return nil, err + } + if !root.IsObject() { + return nil, fmt.Errorf("node is not an object") + } + result, err := c.calculateResult(root) + if err != nil { + return nil, err + } + // if we fail maybe its not a "valued" object + // fallback to json unmarshal as it is + return result, nil +} diff --git a/pkg/evaluator/functions.go b/pkg/evaluator/functions.go new file mode 100644 index 0000000..140d307 --- /dev/null +++ b/pkg/evaluator/functions.go @@ -0,0 +1,109 @@ +package evaluator + +import ( + "fmt" + "github.com/spyzhov/ajson" + "time" +) + +func _strings(left, right *ajson.Node) (lnum, rnum string, err error) { + lnum, err = left.GetString() + if err != nil { + return + } + rnum, err = right.GetString() + return +} + +func _floats(left, right *ajson.Node) (lnum, rnum float64, err error) { + lnum, err = left.GetNumeric() + if err != nil { + return + } + rnum, err = right.GetNumeric() + return +} + +func init() { + ajson.AddOperation("-", 3, false, func(left *ajson.Node, right *ajson.Node) (result *ajson.Node, err error) { + if left.IsString() { + + fmt.Println("STRING") + lNum, rNum, err := _strings(left, right) + if err != nil { + return nil, err + } + + lDur, lDurErr := time.ParseDuration(lNum) + rDur, rDurErr := time.ParseDuration(rNum) + + if timeL, err := time.Parse(time.RFC3339, lNum); err == nil && rDurErr == nil { + // time is left, duration is right + return ajson.StringNode("sub", timeL.Add(-rDur).Format(time.RFC3339)), nil + } else if timeR, err := time.Parse(time.RFC3339, rNum); err == nil && lDurErr == nil { + // time is right, duration is left + return ajson.StringNode("sub", timeR.Add(-lDur).Format(time.RFC3339)), nil + } else if lDurErr == nil && rDurErr == nil { + // both sides durations + return ajson.StringNode("sub", fmt.Sprintf("%vs", lDur.Seconds()-rDur.Seconds())), nil + } + } + + lNum, rNum, err := _floats(left, right) + if err != nil { + return + } + return ajson.NumericNode("sub", lNum-rNum), nil + }) + ajson.AddOperation("+", 3, false, func(left *ajson.Node, right *ajson.Node) (result *ajson.Node, err error) { + if left.IsString() { + lNum, rNum, err := _strings(left, right) + if err != nil { + return nil, err + } + + lDur, lDurErr := time.ParseDuration(lNum) + rDur, rDurErr := time.ParseDuration(rNum) + + if timeL, err := time.Parse(time.RFC3339, lNum); err == nil && rDurErr == nil { + + // time is left, duration is right + return ajson.StringNode("sum", timeL.Add(rDur).Format(time.RFC3339)), nil + } else if timeR, err := time.Parse(time.RFC3339, rNum); err == nil && lDurErr == nil { + + // time is right, duration is left + return ajson.StringNode("sum", timeR.Add(lDur).Format(time.RFC3339)), nil + + } else if lDurErr == nil && rDurErr == nil { + // both sides durations + return ajson.StringNode("sum", fmt.Sprintf("%vs", lDur.Seconds()+rDur.Seconds())), nil + } + + return ajson.StringNode("sum", lNum+rNum), nil + } + + lNum, rNum, err := _floats(left, right) + if err != nil { + return nil, err + } + return ajson.NumericNode("sum", lNum+rNum), nil + }) + + ajson.AddFunction("string", func(node *ajson.Node) (result *ajson.Node, err error) { + var val string + switch { + case node.IsNumeric(): + val = fmt.Sprintf("%v", node.MustNumeric()) + case node.IsBool(): + val = "true" + if !node.MustBool() { + val = "false" + } + case node.IsObject(): + val = node.String() + default: + val = "unknown" + } + return ajson.StringNode("string", val), nil + }) +} diff --git a/pkg/module/README.md b/pkg/module/README.md new file mode 100644 index 0000000..3a56b7b --- /dev/null +++ b/pkg/module/README.md @@ -0,0 +1 @@ +### DTO diff --git a/pkg/module/component.go b/pkg/module/component.go new file mode 100644 index 0000000..cd0314b --- /dev/null +++ b/pkg/module/component.go @@ -0,0 +1,32 @@ +package module + +import ( + "context" +) + +type ComponentInfo struct { + Name string + Description string + Info string + Tags []string +} + +type Runnable interface { + Run(ctx context.Context, handler Handler) error +} + +type Component interface { + GetInfo() ComponentInfo + //Handle handles incoming requests + Handle(ctx context.Context, output Handler, port string, message interface{}) error + //Ports gets list of ports + Ports() []NodePort + //Instance creates new instance with default settings + Instance() Component +} + +// StatefulComponent WIP +type StatefulComponent interface { + GetState() ([]byte, error) + SetState(state []byte) error +} diff --git a/pkg/module/const.go b/pkg/module/const.go new file mode 100644 index 0000000..b623242 --- /dev/null +++ b/pkg/module/const.go @@ -0,0 +1,5 @@ +package module + +const ( + InformerNodeID = "_informer" +) diff --git a/pkg/module/handler.go b/pkg/module/handler.go new file mode 100644 index 0000000..b1d4968 --- /dev/null +++ b/pkg/module/handler.go @@ -0,0 +1,3 @@ +package module + +type Handler func(port string, data interface{}) error diff --git a/pkg/module/info.go b/pkg/module/info.go new file mode 100644 index 0000000..2d9c09c --- /dev/null +++ b/pkg/module/info.go @@ -0,0 +1,20 @@ +package module + +import ( + "fmt" + "github.com/hashicorp/go-version" +) + +type Info struct { + VersionID string // if module's build is registered + Version string + Name string +} + +func GetComponentID(moduleInfo Info, cmpInfo ComponentInfo) (string, error) { + ver, err := version.NewVersion(moduleInfo.Version) + if err != nil { + return "", fmt.Errorf("unable to parse module version: %v", err) + } + return fmt.Sprintf("%s_v%d_%s", moduleInfo.Name, ver.Segments()[0], cmpInfo.Name), nil +} diff --git a/pkg/module/node.go b/pkg/module/node.go new file mode 100644 index 0000000..5759bdf --- /dev/null +++ b/pkg/module/node.go @@ -0,0 +1,42 @@ +package module + +type ( + Position int +) + +const ( + SaveStatePort string = "_save-state" + GetStatePort string = "_get-state" + ConfigurePort string = "_configure" + RunPort string = "_run" + StopPort string = "_stop" + DestroyPort string = "_destroy" + SettingsPort string = "_settings" + StatusPort string = "_status" +) + +const ( + Top Position = iota + Right + Bottom + Left +) + +type NodePort struct { + Source bool + Status bool + Settings bool + Position Position + Name string + Label string + Message interface{} +} + +func GetPortByName(ports []NodePort, name string) *NodePort { + for _, p := range ports { + if p.Name == name { + return &p + } + } + return nil +} diff --git a/pkg/proto/module/README.md b/pkg/proto/module/README.md new file mode 100644 index 0000000..9e1146b --- /dev/null +++ b/pkg/proto/module/README.md @@ -0,0 +1 @@ +### TinySystem Server management objects and services diff --git a/pkg/proto/module/_codegen.sh b/pkg/proto/module/_codegen.sh new file mode 100755 index 0000000..6d5c1af --- /dev/null +++ b/pkg/proto/module/_codegen.sh @@ -0,0 +1,6 @@ +#!/bin/bash +mkdir -p ../../api +rm ../../api/server-go/*.pb.go 2>/dev/null +protoc --go_out=../../api/ *.proto +protoc --go-grpc_out=../../api/ *.proto +git add ../../api diff --git a/pkg/proto/module/cmp.proto b/pkg/proto/module/cmp.proto new file mode 100644 index 0000000..c02c0f6 --- /dev/null +++ b/pkg/proto/module/cmp.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; + +message Component { + string Name = 1; + string Description = 3; + string Info = 4; + repeated string Tags = 5; +} diff --git a/pkg/proto/module/graph.proto b/pkg/proto/module/graph.proto new file mode 100644 index 0000000..2c48b96 --- /dev/null +++ b/pkg/proto/module/graph.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; +import "node.proto"; + +message GraphChangeServer { + string ID = 1; +} +message GraphChangeModule { + string Name = 1; + string Version = 2; + string VersionID = 3; +} + +message GraphChange { + repeated GraphElement Elements = 1; + GraphChangeOp Op = 2; + GraphChangeServer Server = 3; + GraphChangeModule Module = 4; +} + +// any element of an element of the graph (using for storage) +message GraphElement { + string ID = 1; + //string FlowID = 2; + Node Node = 3; + Edge Edge = 4; + int64 Revision = 5; +} diff --git a/pkg/proto/module/instance.proto b/pkg/proto/module/instance.proto new file mode 100644 index 0000000..d98dc5f --- /dev/null +++ b/pkg/proto/module/instance.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; +import "mapport.proto"; +import "port-config.proto"; +import "graph.proto"; +import "google/protobuf/struct.proto"; + +message ConfigureInstanceRequest { + string FlowID = 1; + string ComponentID = 2; + //string InstanceName = 3; + string InstanceID = 4; // list of port mapping with nats subjects + repeated MapPort Destinations = 6; + int64 Revision = 7; + //string InstanceLabel = 8; + repeated PortConfig PortConfigs = 9; + bool Run = 10; + google.protobuf.Struct Data = 11; +} + +message ConfigureInstanceResponse { + bool IsRunning = 2; + bool HasError = 3; + string Error = 4; + repeated GraphChange Changes = 5; +} diff --git a/pkg/proto/module/mapport.proto b/pkg/proto/module/mapport.proto new file mode 100644 index 0000000..57a2a1d --- /dev/null +++ b/pkg/proto/module/mapport.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; + +message MapPort { + string From = 1; // full port name name + string To = 2; + string EdgeID = 3; +} diff --git a/pkg/proto/module/message.proto b/pkg/proto/module/message.proto new file mode 100644 index 0000000..ad44926 --- /dev/null +++ b/pkg/proto/module/message.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; + +message MessageRequest { + string ID = 1; + string From = 2; + map Metadata = 4; + bytes Payload = 5; + string EdgeID = 6; +} + +message MessageResponse { + bytes Data = 1; + bool HasError = 3; + string Error = 4; +} diff --git a/pkg/proto/module/module-version.proto b/pkg/proto/module/module-version.proto new file mode 100644 index 0000000..b71970e --- /dev/null +++ b/pkg/proto/module/module-version.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; +message ModuleVersion { + string ID = 1; + string ModuleName = 2; + string Version = 3; +} diff --git a/pkg/proto/module/node.proto b/pkg/proto/module/node.proto new file mode 100644 index 0000000..be53d0e --- /dev/null +++ b/pkg/proto/module/node.proto @@ -0,0 +1,57 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; +import "google/protobuf/struct.proto"; +import "mapport.proto"; +import "port-config.proto"; + +enum GraphChangeOp { + UPDATE = 0; + DELETE = 1; +} + +message Node { + //string Label = 1; + // if implements runnable interface + bool Runnable = 2; + + string ComponentID = 5; + Position Position = 6; + repeated NodePort Ports = 7; + // if we want to see its running + bool Run = 8; + // connection between other nodes + + repeated MapPort Destinations = 9; + repeated PortConfig PortConfigs = 13; + //string Name = 10; + google.protobuf.Struct Data = 11; +} + +message Position { + int32 X = 1; + int32 Y = 2; + int32 Spin = 3; +} + +message Edge { + string Source = 1; + string Target = 2; + string SourceHandle = 3; + string TargetHandle = 4; +} + +message NodePort { + bool Source = 1; + int32 Position = 2; + string PortName = 3; + string Label = 4; + bool IsSettings = 5; + // schema generated from DTO + bytes SchemaDefault = 6; + // schema with adjustments using schema editor + bool Status = 7; + // default setup of the port/handle + //bytes Configuration = 8; + bytes ConfigurationDefault = 9; +} diff --git a/pkg/proto/module/platform.messages.proto b/pkg/proto/module/platform.messages.proto new file mode 100644 index 0000000..4274756 --- /dev/null +++ b/pkg/proto/module/platform.messages.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; +import "module-version.proto"; +import "runner-config.proto"; +import "instance.proto"; +import "cmp.proto"; + +message GetManifestRequest { + string ServerKey = 1; // from ags + bool DevMode = 2; // not sure about it + string DeveloperKey = 3; //if dev mode is on, developer_key is required, maybe if no modVerID + string Version = 6; + string ModuleVersionID = 7; // from ldflags if any +} + +// @todo - nats auth keys? +message GetManifestResponse { + RunnerConfig RunnerConfig = 1; + repeated ModuleVersion Modules = 2; // empty if dev mode is on + repeated ConfigureInstanceRequest Instances = 3; // instances to bootstrap +} + + +message PublishModuleRequest { + string Name = 1; // by publisher from module info + string Description = 2; // by publisher from module info + string Info = 3; // from readme.md + string DeveloperKey = 4; // from CI + string Version = 8; // by publisher + repeated Component Components = 13; +} + +message BuildPushOptions { + string Username = 1; + string Password =2; + string Repo = 3; + string Tag = 4; +} + +message PublishModuleResponse { + ModuleVersion Module = 1; + BuildPushOptions Options = 2; +} + +message UpdateModuleVersionRequest { + string ID = 1; + string Repo = 2; + string Tag = 3; +} + +message UpdateModuleVersionResponse { + +} diff --git a/pkg/proto/module/platform.service.proto b/pkg/proto/module/platform.service.proto new file mode 100644 index 0000000..c970fe0 --- /dev/null +++ b/pkg/proto/module/platform.service.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; +import "platform.messages.proto"; + +service PlatformService { + rpc GetManifest(GetManifestRequest) returns (GetManifestResponse); + rpc PublishModule(PublishModuleRequest) returns (PublishModuleResponse); + rpc UpdateModuleVersion(UpdateModuleVersionRequest) returns (UpdateModuleVersionResponse); +} diff --git a/pkg/proto/module/port-config.proto b/pkg/proto/module/port-config.proto new file mode 100644 index 0000000..9253b3b --- /dev/null +++ b/pkg/proto/module/port-config.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; + +message PortConfig { + string From = 1; // full port name, may be empty for a node's own config + string PortName = 2; // port name of a node being configured + bytes Configuration = 3; // json encoded data, not necessarily an object + bytes Schema = 5; // port schema which might be customized + bytes SchemaDefault = 6; // default json schema of the port (for the reset) + bytes ConfigurationDefault = 7; // default configuration of the port (for the reset) +} diff --git a/pkg/proto/module/runner-config.proto b/pkg/proto/module/runner-config.proto new file mode 100644 index 0000000..bbc2abc --- /dev/null +++ b/pkg/proto/module/runner-config.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package server; +option go_package = "./module-go;module"; + +message RunnerConfig { + string ServerID = 1; + bool DevMode = 2; + string WorkspaceID = 4; +} + + diff --git a/pkg/service-discovery/client/client.go b/pkg/service-discovery/client/client.go new file mode 100644 index 0000000..9972753 --- /dev/null +++ b/pkg/service-discovery/client/client.go @@ -0,0 +1,98 @@ +package client + +import ( + "context" + "fmt" + "github.com/nats-io/nats.go" + "github.com/tiny-systems/module/pkg/service-discovery/discovery" + "github.com/tiny-systems/module/pkg/service-discovery/util" + "time" +) + +type NodeStateChangeCallback func(req discovery.Request) + +type Client struct { + nc *nats.Conn + liveCycle time.Duration +} + +// NewClient create a client instance +func NewClient(nc *nats.Conn, liveCycle time.Duration) (*Client, error) { + + c := &Client{ + nc: nc, + liveCycle: liveCycle, + } + + if c.liveCycle <= 0 { + c.liveCycle = discovery.DefaultExpire + } + + return c, nil +} + +func (c *Client) handleNatsMsg(msg *nats.Msg, callback NodeStateChangeCallback) error { + var event discovery.Request + err := util.Unmarshal(msg.Data, &event) + if err != nil { + return err + } + + switch event.Action { + case discovery.SaveAction, discovery.UpdateAction, discovery.DeleteAction: + callback(event) + default: + err = fmt.Errorf("unkonw message: %v", msg.Data) + return err + } + return nil +} + +func (c *Client) KeepAlive(ctx context.Context, getNode func() discovery.Node) error { + t := time.NewTicker(c.liveCycle) + + defer func() { + _ = c.sendAction(getNode, discovery.DeleteAction) + t.Stop() + }() + _ = c.sendAction(getNode, discovery.SaveAction) + for { + select { + case <-ctx.Done(): + return nil + case <-t.C: + _ = c.sendAction(getNode, discovery.UpdateAction) + } + } +} + +func (c *Client) sendAction(getNode func() discovery.Node, action discovery.Action) error { + node := getNode() + data, err := util.Marshal(&discovery.Request{ + Action: action, Node: node, + }) + if err != nil { + return err + } + subj := discovery.DefaultPublishPrefix + "." + node.FullID() + msg, err := c.nc.Request(subj, data, time.Second*15) + if err != nil { + return nil + } + + var resp discovery.Response + err = util.Unmarshal(msg.Data, &resp) + if err != nil { + return err + } + + if !resp.Success { + err := fmt.Errorf("[%v] response error %v", action, resp.Reason) + return err + } + return nil +} + +type Discovery interface { + KeepAlive(ctx context.Context, getNode func() discovery.Node) error +} diff --git a/pkg/service-discovery/discovery/discovery.go b/pkg/service-discovery/discovery/discovery.go new file mode 100644 index 0000000..6614333 --- /dev/null +++ b/pkg/service-discovery/discovery/discovery.go @@ -0,0 +1,62 @@ +package discovery + +import ( + "github.com/tiny-systems/module/pkg/api/module-go" + "google.golang.org/protobuf/types/known/structpb" + "time" +) + +// NodeState define the node state type +type NodeState int32 + +const ( + DefaultPublishPrefix = "node.publish" + DefaultDiscoveryPrefix = "node.discovery" + + DefaultLivecycle = 2 * time.Second + DefaultExpire = 5 * time.Second +) + +type Action string + +const ( + SaveAction Action = "save" + UpdateAction Action = "update" + DeleteAction Action = "delete" +) + +// Node represents a node info +type Node struct { + ID string + // + Component *module.Component //optional + + Module *module.ModuleVersion + // How node looks like + Graph *structpb.Struct + // Realtime stats + Stats *structpb.Struct + WorkspaceID string + // which server is running the node + ServerID string + + FlowID *string // optional +} + +// FullID return the node id with scheme prefix +func (n *Node) FullID() string { + if n.Component != nil { + return n.WorkspaceID + "." + n.Component.Name + "." + n.ID + } + return n.WorkspaceID + "." + n.ID +} + +type Request struct { + Action Action + Node Node +} + +type Response struct { + Success bool + Reason string +} diff --git a/pkg/service-discovery/registry/registry.go b/pkg/service-discovery/registry/registry.go new file mode 100644 index 0000000..94ecb80 --- /dev/null +++ b/pkg/service-discovery/registry/registry.go @@ -0,0 +1,195 @@ +package registry + +import ( + "context" + "fmt" + "github.com/nats-io/nats.go" + "github.com/tiny-systems/module/pkg/service-discovery/discovery" + "github.com/tiny-systems/module/pkg/service-discovery/util" + "io" + "strings" + "time" +) + +type NodeItem struct { + subj string + expire time.Duration + node discovery.Node +} + +type Registry struct { + nc *nats.Conn + expire time.Duration +} + +// NewRegistry create a service instance +func NewRegistry(nc *nats.Conn, expire time.Duration) (*Registry, error) { + s := &Registry{ + nc: nc, + expire: expire, + } + + if s.expire <= 0 { + s.expire = discovery.DefaultExpire + } + return s, nil +} + +func (s *Registry) checkExpires(nodes map[string]*NodeItem, now time.Duration, handleNodeAction func(discovery.Request) (bool, error)) error { + for key, item := range nodes { + if item.expire <= now { + discoverySubj := strings.ReplaceAll(item.subj, discovery.DefaultPublishPrefix, discovery.DefaultDiscoveryPrefix) + request := discovery.Request{ + Action: discovery.DeleteAction, + Node: item.node, + } + + d, err := util.Marshal(request) + if err != nil { + return err + } + + if err := s.nc.Publish(discoverySubj, d); err != nil { + return nil + } + _, err = handleNodeAction(request) + delete(nodes, key) + } + } + return nil +} + +func (s *Registry) Listen(ctx context.Context, handleNodeAction func(action discovery.Request) (bool, error)) error { + + ctx, cancel := context.WithCancel(ctx) + + defer cancel() + + if handleNodeAction == nil { + err := fmt.Errorf("listen callback must be set for registry.listen") + return err + } + + subj := discovery.DefaultPublishPrefix + ".>" + msgCh := make(chan *nats.Msg) + + sub, err := s.nc.Subscribe(subj, func(msg *nats.Msg) { + msgCh <- msg + }) + if err != nil { + return err + } + + defer func() { + sub.Unsubscribe() + sub.Drain() + close(msgCh) + }() + + nodes := make(map[string]*NodeItem) + + handleNatsMsg := func(msg *nats.Msg) error { + var req discovery.Request + err := util.Unmarshal(msg.Data, &req) + if err != nil { + return err + } + nid := req.Node.FullID() + + resp := discovery.Response{ + Success: true, + } + switch req.Action { + case discovery.SaveAction: + if _, ok := nodes[nid]; !ok { + // accept or reject + if ok, err := handleNodeAction(req); !ok { + resp.Success = false + resp.Reason = fmt.Sprint(err) + break + } + // notify all + discoverySubj := strings.ReplaceAll(msg.Subject, discovery.DefaultPublishPrefix, discovery.DefaultDiscoveryPrefix) + s.nc.Publish(discoverySubj, msg.Data) + + nodes[nid] = &NodeItem{ + expire: time.Duration(time.Now().UnixNano()) + s.expire, + node: req.Node, + subj: msg.Subject, + } + } + case discovery.UpdateAction: + if node, ok := nodes[nid]; ok { + // node is in a list + node.expire = time.Duration(time.Now().UnixNano()) + s.expire + if ok, err := handleNodeAction(req); !ok { + resp.Success = false + resp.Reason = fmt.Sprint(err) + } + + discoverySubj := strings.ReplaceAll(msg.Subject, discovery.DefaultPublishPrefix, discovery.DefaultDiscoveryPrefix) + s.nc.Publish(discoverySubj, msg.Data) + + } else { + req.Action = discovery.SaveAction + if ok, err := handleNodeAction(req); !ok { + resp.Success = false + resp.Reason = fmt.Sprint(err) + break + } + + // @todo check if state change + discoverySubj := strings.ReplaceAll(msg.Subject, discovery.DefaultPublishPrefix, discovery.DefaultDiscoveryPrefix) + s.nc.Publish(discoverySubj, msg.Data) + + nodes[nid] = &NodeItem{ + expire: time.Duration(time.Now().UnixNano()) + s.expire, + node: req.Node, + subj: msg.Subject, + } + } + case discovery.DeleteAction: + if _, ok := nodes[nid]; ok { + if ok, err := handleNodeAction(req); !ok { + resp.Success = false + resp.Reason = fmt.Sprint(err) + break + } + discoverySubj := strings.ReplaceAll(msg.Subject, discovery.DefaultPublishPrefix, discovery.DefaultDiscoveryPrefix) + s.nc.Publish(discoverySubj, msg.Data) + } + delete(nodes, nid) + default: + return fmt.Errorf("unkonw message: %v", msg.Data) + } + + data, err := util.Marshal(&resp) + if err != nil { + return err + } + s.nc.Publish(msg.Reply, data) + return nil + } + + t := time.NewTicker(s.expire / 2) + for { + select { + case <-ctx.Done(): + return ctx.Err() + case <-t.C: + if err := s.checkExpires(nodes, time.Duration(time.Now().UnixNano()), handleNodeAction); err != nil { + return err + } + case msg, ok := <-msgCh: + if ok { + err := handleNatsMsg(msg) + if err != nil { + return err + } + break + } + return io.EOF + } + } + +} diff --git a/pkg/service-discovery/util/util.go b/pkg/service-discovery/util/util.go new file mode 100644 index 0000000..a498548 --- /dev/null +++ b/pkg/service-discovery/util/util.go @@ -0,0 +1,24 @@ +package util + +import ( + "bytes" + "github.com/goccy/go-json" +) + +// Unmarshal parses the encoded data and stores the result +// in the value pointed to by v +func Unmarshal(data []byte, v interface{}) error { + dec := json.NewDecoder(bytes.NewBuffer(data)) + return dec.Decode(v) +} + +// Marshal encodes v and returns encoded data +func Marshal(v interface{}) ([]byte, error) { + buf := new(bytes.Buffer) + enc := json.NewEncoder(buf) + err := enc.Encode(v) + if err != nil { + return []byte{}, err + } + return buf.Bytes(), nil +} diff --git a/pkg/utils/bytes.go b/pkg/utils/bytes.go new file mode 100644 index 0000000..272c01f --- /dev/null +++ b/pkg/utils/bytes.go @@ -0,0 +1,9 @@ +package utils + +import "strings" + +func BytesToString(b []byte) string { + buf := strings.Builder{} + buf.Write(b) + return buf.String() +} diff --git a/pkg/utils/component.go b/pkg/utils/component.go new file mode 100644 index 0000000..732fd83 --- /dev/null +++ b/pkg/utils/component.go @@ -0,0 +1,17 @@ +package utils + +import ( + "github.com/tiny-systems/module/pkg/api/module-go" + m "github.com/tiny-systems/module/pkg/module" +) + +func GetComponentApi(c m.Component) (*module.Component, error) { + componentInfo := c.GetInfo() + + return &module.Component{ + Name: componentInfo.Name, + Description: componentInfo.Description, + Info: componentInfo.Info, + Tags: componentInfo.Tags, + }, nil +} diff --git a/pkg/utils/env.go b/pkg/utils/env.go new file mode 100644 index 0000000..2fe389a --- /dev/null +++ b/pkg/utils/env.go @@ -0,0 +1,13 @@ +package utils + +import "os" + +const DefaultEnvironment = "local" + +func GetEnvironmentName() string { + environment := os.Getenv("ENVIRONMENT") + if environment == "" { + environment = DefaultEnvironment + } + return environment +} diff --git a/pkg/utils/module.go b/pkg/utils/module.go new file mode 100644 index 0000000..5eee701 --- /dev/null +++ b/pkg/utils/module.go @@ -0,0 +1,14 @@ +package utils + +import ( + "github.com/tiny-systems/module/pkg/api/module-go" + m "github.com/tiny-systems/module/pkg/module" +) + +func GetModuleApi(i m.Info) (*module.ModuleVersion, error) { + return &module.ModuleVersion{ + ID: i.VersionID, + ModuleName: i.Name, + Version: i.Version, + }, nil +} diff --git a/pkg/utils/node.go b/pkg/utils/node.go new file mode 100644 index 0000000..6f9eaca --- /dev/null +++ b/pkg/utils/node.go @@ -0,0 +1,77 @@ +package utils + +import ( + "github.com/tiny-systems/module/pkg/api/module-go" + "math/rand" + "time" +) + +func NodeToMap(n *module.Node, data map[string]interface{}) map[string]interface{} { + ports := n.GetPorts() + handles := make([]interface{}, len(ports)) + spin := 0 + + m := map[string]interface{}{ + "type": "customNode", + } + + if n.Position != nil { + m["position"] = map[string]interface{}{ + "x": n.Position.X, + "y": n.Position.Y, + } + spin = int(n.Position.Spin) + + } else { + m["position"] = map[string]interface{}{ + "x": randFromRange(100, 300), // replace with faker + "y": randFromRange(100, 300), + } + } + for k, v := range ports { + var typ = "target" + if v.Source { + typ = "source" + } + ma := map[string]interface{}{ + "id": v.PortName, + "type": typ, + "style": map[string]interface{}{}, + "class": "", + "position": v.Position, + "rotated_position": (int(v.Position) + spin) % 4, + "label": v.Label, + "settings": v.IsSettings, + "status": v.Status, + "schema_default": BytesToString(v.SchemaDefault), + "configuration_default": BytesToString(v.ConfigurationDefault), + } + for _, pc := range n.PortConfigs { + if pc.From != "" || pc.PortName != v.PortName { + continue + } + ma["schema"] = BytesToString(pc.Schema) + ma["schema_default"] = BytesToString(pc.SchemaDefault) + ma["configuration"] = BytesToString(pc.Configuration) + ma["configuration_default"] = BytesToString(pc.ConfigurationDefault) + + } + handles[k] = ma + } + if data == nil { + data = map[string]interface{}{} + } + //data["component"] = n.Component.Name + data["handles"] = handles + data["runnable"] = n.Runnable + data["run"] = n.Run + data["spin"] = spin + + m["data"] = data + return m +} + +func randFromRange(min, max int) int { + rand.Seed(time.Now().UnixNano()) + return rand.Intn(max-min+1) + min +} diff --git a/pkg/utils/port.go b/pkg/utils/port.go new file mode 100644 index 0000000..212d1b3 --- /dev/null +++ b/pkg/utils/port.go @@ -0,0 +1,10 @@ +package utils + +import "fmt" + +func GetPortFullName(nodeID string, portName string) string { + if nodeID == "" && portName == "" { + return "" + } + return fmt.Sprintf("%s_%s", nodeID, portName) +} diff --git a/pkg/utils/subjects.go b/pkg/utils/subjects.go new file mode 100644 index 0000000..b4ffa17 --- /dev/null +++ b/pkg/utils/subjects.go @@ -0,0 +1,14 @@ +package utils + +import ( + "fmt" +) + +const StreamName = "tinycloud" + +func GetInstanceInputSubject(workspaceID, flowID string, ID string, port string) string { + return fmt.Sprintf("%s.%s.flow.%s.instance.%s.%s", StreamName, workspaceID, flowID, ID, port) +} +func CreateComponentSubject(workspaceID, componentName string) string { + return fmt.Sprintf("%s.%s.component.%s", StreamName, workspaceID, componentName) +} diff --git a/registry/collection.go b/registry/collection.go new file mode 100644 index 0000000..2c67640 --- /dev/null +++ b/registry/collection.go @@ -0,0 +1,15 @@ +package registry + +import ( + "github.com/tiny-systems/module/pkg/module" +) + +var defaultCollection []module.Component + +func Register(c module.Component) { + defaultCollection = append(defaultCollection, c) +} + +func Get() []module.Component { + return defaultCollection +} diff --git a/run.go b/run.go new file mode 100644 index 0000000..2d8714c --- /dev/null +++ b/run.go @@ -0,0 +1,348 @@ +package module + +import ( + "context" + "fmt" + "github.com/nats-io/nats.go" + "github.com/tiny-systems/module/internal/instance" + "github.com/tiny-systems/module/pkg/api/module-go" + m "github.com/tiny-systems/module/pkg/module" + "github.com/tiny-systems/module/pkg/service-discovery/discovery" + "github.com/tiny-systems/module/pkg/utils" + "golang.org/x/sync/errgroup" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/structpb" + "strings" + "sync" + "time" +) + +func (s *Server) newInstance(ctx context.Context, configMsg *instance.Msg) error { + if configMsg.Data == nil { + s.errorCh <- fmt.Errorf("new instance message has no data") + // do not return error to avoid failing all server + return nil + } + // + installedComponent, ok := s.installedComponentsMap[configMsg.Subject] + if !ok { + s.errorCh <- fmt.Errorf("component %s is not installed", configMsg.Subject) + // do not return error to avoid failing all server + return nil + } + + conf, ok := configMsg.Data.(*module.ConfigureInstanceRequest) + if !ok { + s.errorCh <- fmt.Errorf("new instance message is invalid") + // do not return error to avoid failing all server + return nil + } + + subj := utils.GetInstanceInputSubject(s.runnerConfig.WorkspaceID, conf.FlowID, conf.InstanceID, "*") + + inputCh := make(chan *instance.Msg) + defer close(inputCh) + + instanceID := getInstanceIDFromSubject(subj) + + s.communicationChLock.Lock() + + _, exists := s.communicationCh[instanceID] + if !exists { + s.communicationCh[instanceID] = inputCh + } + s.communicationChLock.Unlock() + + if exists { + s.errorCh <- fmt.Errorf("instance already spinning") + return nil + } + + defer func() { + // delete instance from map of channels + s.communicationChLock.Lock() + delete(s.communicationCh, instanceID) + s.communicationChLock.Unlock() + }() + + outputCh := make(chan *instance.Msg) + defer close(outputCh) + + subscription, err := s.nats.Subscribe(subj, func(msg *nats.Msg) { + // process incoming messages + var payload interface{} + port, isCustom := getPort(msg.Subject) + + // because we use different DTO we need this switch + if isCustom { + var msgIn = &module.MessageRequest{} + if err := proto.Unmarshal(msg.Data, msgIn); err != nil { + s.errorCh <- err + return + } + payload = msgIn + } else { + var msgIn = &module.ConfigureInstanceRequest{} + if err := proto.Unmarshal(msg.Data, msgIn); err != nil { + s.errorCh <- err + return + } + payload = msgIn + } + + // writing dto into instance's input + inputCh <- instance.NewMsgWithSubject(port, payload, func(data interface{}) error { + p, isCustomPort := getPort(port) + var bytes []byte + var err error + + if isCustomPort { + resp, ok := data.(*module.MessageResponse) + if !ok { + return fmt.Errorf("invalid input's custom response, port: %s", p) + } + bytes, err = proto.Marshal(resp) + } else { + resp, ok := data.(*module.ConfigureInstanceResponse) + if !ok { + return fmt.Errorf("invalid input's response, port: %s", p) + } + bytes, err = proto.Marshal(resp) + } + if err != nil { + return err + } + return msg.Respond(bytes) + }) + }) + + if err != nil { + s.errorCh <- fmt.Errorf("failed to subscribe nats subject: %s", subj) + // do not return error to avoid failing all server + return nil + } + + // instance's runtime context + sCtx, cancel := context.WithCancel(ctx) + // cancel + defer cancel() + + // read output component may send back + go func() { + defer func() { + if r := recover(); r != nil { + s.log.Error().Str("recovery", fmt.Sprintf("%v", r)).Msg("output channel read") + } + }() + + for { + // read instance's output + select { + case <-sCtx.Done(): + return + case output, ok := <-outputCh: + if !ok { + // closed channel + return + } + // send each message async + // check if instance is running locally + s.communicationChLock.RLock() + localInputCh, isLocal := s.communicationCh[getInstanceIDFromSubject(output.Subject)] + s.communicationChLock.RUnlock() + + if isLocal { + output.Subject, _ = getPort(output.Subject) + localInputCh <- output + } else { + // not local, use nats + if payload, ok := output.Data.(*module.MessageRequest); ok { + bytes, err := proto.Marshal(payload) + if err != nil { + s.errorCh <- err + continue + } + if _, err := s.nats.Request(output.Subject, bytes, time.Second*3); err != nil { + s.errorCh <- fmt.Errorf("nats request error: %v", err) + } + } + } + } + } + }() + + s.log.Info().Str("cmp", installedComponent.component.GetInfo().Name). + Str("workspace", s.runnerConfig.WorkspaceID).Msg("run new instance") + + // waiting here until instance is running + if err := s.spinNewInstance(sCtx, configMsg, installedComponent, inputCh, outputCh); err != nil { + s.errorCh <- err + } + + s.log.Info().Str("subj", subscription.Subject).Msg("unsubscribe") + if err = subscription.Unsubscribe(); err != nil { + s.log.Error().Err(err).Msg("unsubscribe error") + } + s.log.Info().Str("cmp", installedComponent.component.GetInfo().Name). + Str("serverId", s.runnerConfig.ServerID). + Str("workspace", s.runnerConfig.WorkspaceID).Msg("instance destroyed") + return nil +} + +func (s *Server) Run(ctx context.Context) error { + + var subscriptions = make([]*nats.Subscription, 0) + wg, ctx := errgroup.WithContext(ctx) + + wg.Go(func() error { + // make this server discoverable without any component/module running + serverDiscoveryNode := discovery.Node{ + ServerID: s.runnerConfig.ServerID, + WorkspaceID: s.runnerConfig.WorkspaceID, + ID: s.runnerConfig.ServerID, + } + return s.discovery.KeepAlive(ctx, func() discovery.Node { + return serverDiscoveryNode + }) + }) + + wg.Go(func() error { + <-ctx.Done() + // when context done - close all component subscriptions + for _, sub := range subscriptions { + s.unsubscribe(sub) + } + return nil + }) + + defer func() { + // close all control channels + close(s.newInstanceCh) + close(s.installComponentsCh) + }() + +loop: + for { + select { + case configMsg := <-s.newInstanceCh: + wg.Go(func() error { + return s.newInstance(ctx, configMsg) + }) + + case installMsg := <-s.installComponentsCh: + // install component + s.log.Debug().Str("id", installMsg.id).Msg("installing") + s.installedComponentsMap[installMsg.id] = installMsg + + wg.Go(func() error { + var once sync.Once + var node discovery.Node + var install = *installMsg + + return s.discovery.KeepAlive(ctx, func() discovery.Node { + once.Do(func() { + // discovery of available type of node (for new node dialog) + node, _ = getInformerDiscoveryNode(&install) + node.WorkspaceID = s.runnerConfig.WorkspaceID + node.ServerID = s.runnerConfig.ServerID + }) + return node + }) + }) + + subj := utils.CreateComponentSubject(s.runnerConfig.WorkspaceID, installMsg.id) + s.log.Info().Str("subject", subj).Msg("subscribe") + + subscription, err := s.nats.QueueSubscribe(subj, installMsg.id, func(msg *nats.Msg) { + //decode from nats msg + var conf = &module.ConfigureInstanceRequest{} + if err := proto.Unmarshal(msg.Data, conf); err != nil { + s.errorCh <- err + return + } + s.newInstanceCh <- instance.NewMsgWithSubject(installMsg.id, conf, func(data interface{}) error { + resp, ok := data.(*module.ConfigureInstanceResponse) + if !ok { + return fmt.Errorf("invalid new instance's response") + } + bytes, err := proto.Marshal(resp) + if err != nil { + return err + } + return msg.Respond(bytes) + }) + }) + if err != nil { + return err + } + subscriptions = append(subscriptions, subscription) + case <-ctx.Done(): + break loop + } + } + + _ = wg.Wait() + s.log.Info().Msg("server stopped") + return nil +} + +func (s *Server) unsubscribe(sub *nats.Subscription) { + s.log.Info().Str("subj", sub.Subject).Msg("unsubscribe") + + if err := sub.Drain(); err != nil { + s.errorCh <- fmt.Errorf("drain sub error: %v", err) + return + } + if err := sub.Unsubscribe(); err != nil { + s.errorCh <- fmt.Errorf("unsubscribe error: %v", err) + } +} + +func getInformerDiscoveryNode(install *installComponentMsg) (discovery.Node, error) { + var node = discovery.Node{ + ID: m.InformerNodeID, + } + graphNode, err := instance.NewApiNode(install.component, nil) + if err != nil { + return node, err + } + + cmpApi, err := utils.GetComponentApi(install.component) + if err != nil { + return discovery.Node{}, err + } + cmpApi.Name = install.id + //cmpApi.Version = install.module.Version + + install.data["label"] = cmpApi.Description + + nodeMap := utils.NodeToMap(graphNode, install.data) + + node.Graph, err = structpb.NewStruct(nodeMap) + if err != nil { + return node, err + } + + node.Component = cmpApi + modApi, err := utils.GetModuleApi(install.module) + if err != nil { + return node, err + } + node.Module = modApi + return node, nil +} + +func getPort(s string) (string, bool) { + // + parts := strings.Split(s, ".") + port := parts[len(parts)-1] + if port == m.RunPort || port == m.ConfigurePort || port == m.DestroyPort || port == m.StopPort { + return port, false + } + return port, true +} + +func getInstanceIDFromSubject(s string) string { + parts := strings.Split(s, ".") + return strings.Join(parts[:len(parts)-1], ".") +} diff --git a/server.go b/server.go new file mode 100644 index 0000000..987b958 --- /dev/null +++ b/server.go @@ -0,0 +1,61 @@ +package module + +import ( + "github.com/nats-io/nats.go" + "github.com/rs/zerolog" + "github.com/tiny-systems/module/internal/instance" + "github.com/tiny-systems/module/pkg/api/module-go" + m "github.com/tiny-systems/module/pkg/module" + "github.com/tiny-systems/module/pkg/service-discovery/client" + "sync" +) + +type installComponentMsg struct { + id string + component m.Component + module m.Info + data map[string]interface{} +} + +type Server struct { + log zerolog.Logger + nats *nats.Conn + discovery client.Discovery + runnerConfig *module.RunnerConfig + + installComponentsCh chan *installComponentMsg // dev only purposes + newInstanceCh chan *instance.Msg + installedComponentsMap map[string]*installComponentMsg + + errorCh chan error + communicationCh map[string]chan *instance.Msg + communicationChLock sync.RWMutex +} + +func New(config *module.RunnerConfig, errChan chan error) *Server { + return &Server{ + runnerConfig: config, + // + installComponentsCh: make(chan *installComponentMsg), + // + installedComponentsMap: make(map[string]*installComponentMsg), + // + newInstanceCh: make(chan *instance.Msg), + errorCh: errChan, + // + communicationCh: make(map[string]chan *instance.Msg), + communicationChLock: sync.RWMutex{}, + } +} + +func (s *Server) SetLogger(l zerolog.Logger) { + s.log = l +} + +func (s *Server) SetDiscovery(d client.Discovery) { + s.discovery = d +} + +func (s *Server) SetNats(n *nats.Conn) { + s.nats = n +} diff --git a/tools/build/Dockerfile b/tools/build/Dockerfile new file mode 100644 index 0000000..d602555 --- /dev/null +++ b/tools/build/Dockerfile @@ -0,0 +1,16 @@ +# Step 1: Modules caching +FROM --platform=%PLATFORM% golang:1.20.3-alpine3.17 as builder +COPY go.mod go.sum /app/ +COPY __replaces /app/__replaces + +WORKDIR /app +COPY . . +%MOD_PREPARE% +RUN go mod download +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X github.com/tiny-systems/module/cli.versionID=%VERSION_ID%" -o /bin/app %MAIN_PATH% + +# Step 3: Final +FROM --platform=%PLATFORM% scratch +COPY --from=builder /bin/app /app +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +CMD ["/app", "run"] diff --git a/tools/build/build.go b/tools/build/build.go new file mode 100644 index 0000000..3ea8440 --- /dev/null +++ b/tools/build/build.go @@ -0,0 +1,193 @@ +package build + +import ( + "archive/tar" + "bufio" + "bytes" + "context" + _ "embed" + "fmt" + "github.com/docker/docker/api/types" + "github.com/docker/docker/client" + "github.com/google/uuid" + "github.com/pkg/errors" + "golang.org/x/mod/modfile" + "io" + "os" + "path" + "path/filepath" + "strings" +) + +const ( + goModFile = "go.mod" + replaceDir = "__replaces" + platform = "linux/arm64" +) + +var ( + //go:embed Dockerfile + dockerfile string +) + +func Build(ctx context.Context, cwd string, pathToMain string, bOpts Options) error { + + _, err := os.Stat(pathToMain) + if err != nil { + return errors.Wrap(err, "unable to locate main package") + } + + goModData, err := os.ReadFile(path.Join(cwd, goModFile)) + if err != nil { + return errors.Wrap(err, "unable to find go.mod file") + } + + goMod, err := modfile.Parse("go.mod", goModData, nil) + if err != nil { + return err + } + + dockerClient, err := getClient() + if err != nil { + return err + } + defer dockerClient.Close() + + u, err := uuid.NewUUID() + if err != nil { + return err + } + + var prepare []string + + var buf bytes.Buffer + tarWriter := tar.NewWriter(&buf) + + //write tar files + if err = addTar(cwd, "", tarWriter); err != nil { + return err + } + + for _, r := range goMod.Replace { + // copy to context + if r.New.Version != "" { + // skip non local replaces + continue + } + replaceTarPath := fmt.Sprintf("%s/%s", replaceDir, path.Base(r.New.Path)) + if err = addTar(r.New.Path, replaceTarPath, tarWriter); err != nil { + return err + } + prepare = append(prepare, fmt.Sprintf("RUN go mod edit -replace %s=%s", r.Old.Path, fmt.Sprintf("./%s", replaceTarPath))) + } + + dockerfile = + strings.ReplaceAll( + strings.ReplaceAll( + strings.ReplaceAll( + strings.ReplaceAll(dockerfile, + "%VERSION_ID%", bOpts.VersionID), + "%MAIN_PATH%", pathToMain), + "%MOD_PREPARE%", strings.Join(prepare, "\n")), + "%PLATFORM%", platform, + ) + + dockerFileName := fmt.Sprintf("Dockerfile.%s", u.String()) + + if err = appendFile(dockerFileName, []byte(dockerfile), tarWriter); err != nil { + return err + } + if err := tarWriter.Close(); err != nil { + return err + } + + imgOpts := types.ImageBuildOptions{ + Dockerfile: dockerFileName, + Remove: true, + Platform: platform, + Tags: []string{fmt.Sprintf("%s:%s", bOpts.Repo, bOpts.Tag)}, + } + + res, err := dockerClient.ImageBuild(ctx, bytes.NewReader(buf.Bytes()), imgOpts) + if err != nil { + return err + } + scanner := bufio.NewScanner(res.Body) + for scanner.Scan() { + fmt.Println(scanner.Text()) + } + return nil +} + +func appendFile(filename string, data []byte, tw *tar.Writer) error { + hdr := &tar.Header{ + Name: filename, + Mode: 0600, + Size: int64(len(data)), + } + if err := tw.WriteHeader(hdr); err != nil { + return err + } + if _, err := tw.Write(data); err != nil { + return err + } + return nil +} + +func addTar(src string, dst string, tw *tar.Writer) error { + + // ensure the src actually exists before trying to tar it + if _, err := os.Stat(src); err != nil { + return fmt.Errorf("unable to tar files - %v", err.Error()) + } + // walk path + return filepath.Walk(src, func(file string, fi os.FileInfo, err error) error { + // return on any error + if err != nil { + return err + } + // return on non-regular files (thanks to [kumo](https://medium.com/@komuw/just-like-you-did-fbdd7df829d3) for this suggested update) + if !fi.Mode().IsRegular() { + return nil + } + // create a new dir/file header + header, err := tar.FileInfoHeader(fi, fi.Name()) + if err != nil { + return err + } + // update the name to correctly reflect the desired destination when untaring + header.Name = strings.TrimPrefix(path.Join(dst, strings.Replace(file, src, "", -1)), string(filepath.Separator)) + + // write the header + if err := tw.WriteHeader(header); err != nil { + return err + } + // open files for taring + f, err := os.Open(file) + if err != nil { + return err + } + // copy file data into tar writer + if _, err := io.Copy(tw, f); err != nil { + return err + } + // manually close here after each file operation; defering would cause each file close + // to wait until all operations have completed. + f.Close() + return nil + }) +} + +type Options struct { + Repo string + Tag string + VersionID string +} + +func getClient() (*client.Client, error) { + client, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) + if err != nil { + return nil, err + } + return client, err +} diff --git a/tools/build/push.go b/tools/build/push.go new file mode 100644 index 0000000..14cb68f --- /dev/null +++ b/tools/build/push.go @@ -0,0 +1,40 @@ +package build + +import ( + "context" + "encoding/base64" + "encoding/json" + "github.com/docker/docker/api/types" + "io" + "os" +) + +func Push(ctx context.Context, image string, username string, password string) error { + dockerClient, err := getClient() + if err != nil { + return err + } + defer dockerClient.Close() + + auth := types.AuthConfig{ + Username: username, + Password: password, + } + authBytes, err := json.Marshal(auth) + if err != nil { + return err + } + + out, err := dockerClient.ImagePush(ctx, image, types.ImagePushOptions{ + RegistryAuth: base64.URLEncoding.EncodeToString(authBytes), + Platform: platform, + }) + if err != nil { + return err + } + defer out.Close() + + _, err = io.Copy(os.Stdout, out) + + return err +} diff --git a/tools/readme/readme.go b/tools/readme/readme.go new file mode 100644 index 0000000..cb32b96 --- /dev/null +++ b/tools/readme/readme.go @@ -0,0 +1,17 @@ +package readme + +import ( + "os" + "path" + "strings" +) + +func GetReadme(p string) (string, error) { + data, err := os.ReadFile(path.Join(p, "README.md")) + if err != nil { + return "", err + } + b := strings.Builder{} + b.Write(data) + return b.String(), err +}