├── go ├── examples │ ├── doc.go │ ├── helloworld │ │ ├── configurable-kingpinv2-gen │ │ │ └── main.go │ │ ├── configurable │ │ │ └── main.go │ │ ├── app.go │ │ ├── configurable-kingpinv2 │ │ │ └── main.go │ │ ├── configurator │ │ │ └── main.go │ │ ├── helloworld_protoconfig.pb.go │ │ └── helloworld.pb.go │ ├── go.mod │ ├── README.md │ └── go.sum ├── .errcheck_excludes.txt ├── go.mod ├── protoc-gen-go-protoconfig │ ├── README.md │ ├── go.mod │ ├── main.go │ ├── go.sum │ └── protoconfig.go ├── compatibility.go ├── configurable.go ├── configurator.go ├── kingpinv2 │ ├── pathorcontent.go │ └── extensions.pb.go ├── Makefile ├── go.sum └── extensions.pb.go ├── .github ├── dependabot.yml └── workflows │ └── go.yaml ├── .bingo ├── go.mod ├── mdox.mod ├── faillint.mod ├── buf.mod ├── misspell.mod ├── .gitignore ├── protoc-gen-go.mod ├── golangci-lint.mod ├── goimports.mod ├── variables.env ├── README.md └── Variables.mk ├── .gitignore ├── buf.yaml ├── Makefile ├── common.mk ├── proto ├── protoconfig │ ├── go │ │ └── kingpinv2 │ │ │ └── v1 │ │ │ └── extensions.proto │ └── v1 │ │ └── extensions.proto └── examples │ └── helloworld │ └── v1 │ └── helloworld.proto ├── README.md ├── specification.md └── LICENSE /go/examples/doc.go: -------------------------------------------------------------------------------- 1 | package examples 2 | -------------------------------------------------------------------------------- /go/.errcheck_excludes.txt: -------------------------------------------------------------------------------- 1 | (github.com/go-kit/kit/log.Logger).Log 2 | fmt.Fprintln 3 | fmt.Fprint 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gomod" 4 | directory: "/go" 5 | schedule: 6 | interval: "monthly" 7 | -------------------------------------------------------------------------------- /.bingo/go.mod: -------------------------------------------------------------------------------- 1 | module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files. -------------------------------------------------------------------------------- /.bingo/mdox.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.15 4 | 5 | require github.com/bwplotka/mdox v0.2.0 6 | -------------------------------------------------------------------------------- /.bingo/faillint.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.14 4 | 5 | require github.com/fatih/faillint v1.5.0 6 | -------------------------------------------------------------------------------- /.bingo/buf.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.15 4 | 5 | require github.com/bufbuild/buf v0.33.0 // cmd/buf 6 | -------------------------------------------------------------------------------- /go/examples/helloworld/configurable-kingpinv2-gen/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "log" 4 | 5 | func main() { 6 | log.SetFlags(0) 7 | // TODO(bwplotka): Planned (: 8 | } 9 | -------------------------------------------------------------------------------- /.bingo/misspell.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.14 4 | 5 | require github.com/client9/misspell v0.3.4 // cmd/misspell 6 | -------------------------------------------------------------------------------- /.bingo/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Ignore everything 3 | * 4 | 5 | # But not these files: 6 | !.gitignore 7 | !*.mod 8 | !README.md 9 | !Variables.mk 10 | !variables.env 11 | 12 | *tmp.mod 13 | -------------------------------------------------------------------------------- /.bingo/protoc-gen-go.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.15 4 | 5 | require google.golang.org/protobuf v1.25.0 // cmd/protoc-gen-go 6 | -------------------------------------------------------------------------------- /.bingo/golangci-lint.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.14 4 | 5 | require github.com/golangci/golangci-lint v1.26.0 // cmd/golangci-lint 6 | -------------------------------------------------------------------------------- /.bingo/goimports.mod: -------------------------------------------------------------------------------- 1 | module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT 2 | 3 | go 1.14 4 | 5 | require ( 6 | golang.org/x/mod v0.3.0 // indirect 7 | golang.org/x/tools v0.0.0-20200519204825-e64124511800 // cmd/goimports 8 | ) 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Dependency directories (remove the comment below to include it) 15 | vendor/ 16 | .bin 17 | .idea 18 | .envrc -------------------------------------------------------------------------------- /go/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/openproto/protoconfig/go 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/alecthomas/kingpin/v2 v2.3.2 7 | github.com/golang/protobuf v1.4.3 8 | github.com/pkg/errors v0.9.1 9 | google.golang.org/protobuf v1.25.0 10 | ) 11 | 12 | require ( 13 | github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect 14 | github.com/xhit/go-str2duration/v2 v2.1.0 // indirect 15 | ) 16 | -------------------------------------------------------------------------------- /go/examples/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/openproto/protoconfig/go/examples 2 | 3 | go 1.15 4 | 5 | require ( 6 | github.com/golang/protobuf v1.4.3 7 | github.com/openproto/protoconfig/go v0.0.0-00010101000000-000000000000 8 | google.golang.org/protobuf v1.25.0 9 | gopkg.in/alecthomas/kingpin.v2 v2.2.6 10 | ) 11 | 12 | // TODO(bwplotka): Remove once dev period completes. 13 | replace github.com/openproto/protoconfig/go => ../ 14 | -------------------------------------------------------------------------------- /go/protoc-gen-go-protoconfig/README.md: -------------------------------------------------------------------------------- 1 | # protoc-gen-go-protoconfig 2 | 3 | This tool generates Go language bindings of `configuration`s in protobuf definition files for ProtoConfig. For usage information, please see our [quick start guide](../../README.md#go). 4 | 5 | ## Credits 6 | 7 | This binary is highly inspired by https://github.com/grpc/grpc-go/tree/8f3cc6cc26958590a64f12d80fb48f601204b63f/cmd/protoc-gen-go-grpc, kudos to gRPC Team! -------------------------------------------------------------------------------- /go/protoc-gen-go-protoconfig/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/openproto/protoconfig/go/protoc-gen-go-protoconfig 2 | 3 | go 1.15 4 | 5 | require ( 6 | github.com/openproto/protoconfig/go v0.0.0-00010101000000-000000000000 7 | github.com/pkg/errors v0.9.1 8 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect 9 | google.golang.org/protobuf v1.25.0 10 | ) 11 | 12 | // TODO(bwplotka): Remove once dev period completes. 13 | replace github.com/openproto/protoconfig/go => ../ 14 | -------------------------------------------------------------------------------- /go/compatibility.go: -------------------------------------------------------------------------------- 1 | package protoconfig 2 | 3 | // The SupportPackageIsVersion variables are referenced from generated protocol 4 | // buffer files to ensure compatibility with the ProtoConfig version used. The latest 5 | // support package version is 1. 6 | // 7 | // Older versions are kept for compatibility. They may be removed if 8 | // compatibility cannot be maintained. 9 | // 10 | // These constants should not be referenced from any other code. 11 | const SupportPackageIsVersion1 = true 12 | -------------------------------------------------------------------------------- /buf.yaml: -------------------------------------------------------------------------------- 1 | version: v1beta1 2 | build: 3 | roots: 4 | - proto 5 | lint: 6 | ignore_only: 7 | # Note recommended but Go looks nicer with this. 8 | ENUM_VALUE_PREFIX: 9 | - examples/helloworld/v1/helloworld.proto 10 | ENUM_ZERO_VALUE_SUFFIX: 11 | - examples/helloworld/v1/helloworld.proto 12 | ignore: 13 | # Per the lint configuration docs, the paths for lint ignores have the root 14 | # directory stripped so that this configuration works for both sources and images 15 | # google/api and google/rpc are the directories within googleapis/ that we want to ignore. 16 | - google/protobuf/descriptor.proto 17 | use: 18 | - DEFAULT -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include common.mk 2 | include .bingo/Variables.mk 3 | 4 | .PHONY: all 5 | all: docs 6 | 7 | .PHONY: docs 8 | docs: $(MDOX) ## Generates config snippets and doc formatting. 9 | @echo ">> generating & formatting docs" 10 | #@$(MDOX) fmt -l $(shell find . -name "*.md" -type f | xargs) 11 | 12 | .PHONY: lint 13 | lint: $(BUF) docs 14 | @echo ">> lint proto files" 15 | @$(BUF) check lint 16 | $(call require_clean_work_tree,"detected changed files - run make lint and commit changes.") 17 | @echo ">> lint go files" 18 | @$(MAKE) -C go lint 19 | $(call require_clean_work_tree,"detected changed files - run make lint and commit changes.") 20 | 21 | .PHONY: proto 22 | proto: 23 | @$(MAKE) -C ./go proto 24 | -------------------------------------------------------------------------------- /go/examples/helloworld/configurable/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "log" 6 | "os" 7 | 8 | helloworldpb "github.com/openproto/protoconfig/go/examples/helloworld" 9 | ) 10 | 11 | func main() { 12 | log.SetFlags(0) 13 | 14 | var configEncoded string 15 | 16 | conf := &helloworldpb.HelloWorldConfiguration{} 17 | f := flag.NewFlagSet(conf.Metadata().Name, flag.ExitOnError) 18 | f.StringVar(&configEncoded, "protoconfigv1", "", "configuration protobuf compatible with ProtoConfig 1.0 standard") 19 | 20 | if err := f.Parse(os.Args[1:]); err != nil { 21 | log.Fatal(err) 22 | } 23 | 24 | if err := conf.DecodeString(configEncoded); err != nil { 25 | log.Fatal(err) 26 | } 27 | 28 | log.Println(helloworldpb.PrepareMessage(conf)) 29 | } 30 | -------------------------------------------------------------------------------- /.bingo/variables.env: -------------------------------------------------------------------------------- 1 | # Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.5. DO NOT EDIT. 2 | # All tools are designed to be build inside $GOBIN. 3 | # Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk. 4 | GOBIN=${GOBIN:=$(go env GOBIN)} 5 | 6 | if [ -z "$GOBIN" ]; then 7 | GOBIN="$(go env GOPATH)/bin" 8 | fi 9 | 10 | 11 | BUF="${GOBIN}/buf-v0.33.0" 12 | 13 | FAILLINT="${GOBIN}/faillint-v1.5.0" 14 | 15 | GOIMPORTS="${GOBIN}/goimports-v0.0.0-20200519204825-e64124511800" 16 | 17 | GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.26.0" 18 | 19 | MDOX="${GOBIN}/mdox-v0.2.0" 20 | 21 | MISSPELL="${GOBIN}/misspell-v0.3.4" 22 | 23 | PROTOC_GEN_GO="${GOBIN}/protoc-gen-go-v1.25.0" 24 | 25 | -------------------------------------------------------------------------------- /.bingo/README.md: -------------------------------------------------------------------------------- 1 | # Project Development Dependencies. 2 | 3 | This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo. 4 | 5 | * Run `bingo get` to install all tools having each own module file in this directory. 6 | * Run `bingo get ` to install that have own module file in this directory. 7 | * For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $() variable where is the .bingo/.mod. 8 | * For shell: Run `source .bingo/variables.env` to source all environment variable for each tool 9 | * See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies. 10 | 11 | ## Requirements 12 | 13 | * Go 1.14+ 14 | -------------------------------------------------------------------------------- /go/configurable.go: -------------------------------------------------------------------------------- 1 | package protoconfig 2 | 3 | type Configurable interface { 4 | // Decode parses byte slice as `Encoded Configuration Message` in JSON or proto format and unmarshal it on 5 | // the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion 6 | // (validation, default values etc). 7 | // Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support. 8 | Decode(ecm []byte) error 9 | // DecodeString parses string `Encoded Configuration Message` in JSON or proto format and unmarshal it on 10 | // the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion 11 | // (validation, default values etc). 12 | // Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support. 13 | DecodeString(ecm string) error 14 | } 15 | -------------------------------------------------------------------------------- /go/configurator.go: -------------------------------------------------------------------------------- 1 | package protoconfig 2 | 3 | // Configurator allows to produce `Encoded Configuration Messages` from the `Configuration Proto Definition`. 4 | type Configurator interface { 5 | // Encode encodes self as `Encoded Configuration Message` in proto format so it can be understood and 6 | // passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion 7 | // (validation, default values etc). 8 | // Use `proto.Marshal` encoding without `ProtoConfig 1.0` extension support. 9 | Encode() ([]byte, error) 10 | // EncodeJSON encodes self as `Encoded Configuration Message` in JSON format so it can be understood and 11 | // passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion 12 | // Use `protojson.Marshal` encoding without `ProtoConfig 1.0` extension support. 13 | EncodeJSON() ([]byte, error) 14 | 15 | // Metadata returns metadata defined in `Proto Config Extensions Format 1.0`. 16 | Metadata() Metadata 17 | } 18 | -------------------------------------------------------------------------------- /common.mk: -------------------------------------------------------------------------------- 1 | REPO_ROOT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) 2 | 3 | GIT ?= $(shell which git) 4 | TMP_PATH ?= /tmp 5 | 6 | # Support gsed on OSX (installed via brew), falling back to sed. On Linux 7 | # systems gsed won't be installed, so will use sed as expected. 8 | SED ?= $(shell which gsed 2>/dev/null || which sed) 9 | 10 | define require_clean_work_tree 11 | @git update-index -q --ignore-submodules --refresh 12 | 13 | @if ! git diff-files --quiet --ignore-submodules --; then \ 14 | echo >&2 "cannot $1: you have unstaged changes."; \ 15 | git diff-files --name-status -r --ignore-submodules -- >&2; \ 16 | echo >&2 "Please commit or stash them."; \ 17 | exit 1; \ 18 | fi 19 | 20 | @if ! git diff-index --cached --quiet HEAD --ignore-submodules --; then \ 21 | echo >&2 "cannot $1: your index contains uncommitted changes."; \ 22 | git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2; \ 23 | echo >&2 "Please commit or stash them."; \ 24 | exit 1; \ 25 | fi 26 | 27 | endef 28 | 29 | help: ## Displays help. 30 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) 31 | -------------------------------------------------------------------------------- /go/protoc-gen-go-protoconfig/main.go: -------------------------------------------------------------------------------- 1 | // protoc-gen-go-protoconfig is a plugin for the Google protocol buffer compiler to 2 | // generate Go code. Install it by building this program and making it 3 | // accessible within your PATH with the name: 4 | // protoc-gen-go-protoconfig 5 | // 6 | // The 'go-protoconfig' suffix becomes part of the argument for the protocol compiler, 7 | // such that it can be invoked as: 8 | // protoc --go-protoconfig_out=. path/to/file.proto 9 | // 10 | // This generates Go configuration definitions for the protocol buffer defined by 11 | // file.proto. With that input, the output will be written to path/to/file_protoconfig.pb.go 12 | package main 13 | 14 | import ( 15 | "flag" 16 | "fmt" 17 | "os" 18 | 19 | "google.golang.org/protobuf/compiler/protogen" 20 | "google.golang.org/protobuf/types/pluginpb" 21 | ) 22 | 23 | const version = "0.1.0" 24 | 25 | func main() { 26 | showVersion := flag.Bool("version", false, "print the version and exit") 27 | flag.Parse() 28 | if *showVersion { 29 | fmt.Fprintf(os.Stdout, "protoc-gen-go-grpc %v\n", version) 30 | return 31 | } 32 | 33 | var flags flag.FlagSet 34 | protogen.Options{ 35 | ParamFunc: flags.Set, 36 | }.Run(func(gen *protogen.Plugin) error { 37 | gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) 38 | for _, f := range gen.Files { 39 | if !f.Generate { 40 | continue 41 | } 42 | if err := generateGoProtoConfig(gen, f); err != nil { 43 | return err 44 | } 45 | } 46 | return nil 47 | }) 48 | } 49 | -------------------------------------------------------------------------------- /.github/workflows/go.yaml: -------------------------------------------------------------------------------- 1 | name: go 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | tags: 8 | pull_request: 9 | 10 | jobs: 11 | lint: 12 | runs-on: ubuntu-latest 13 | name: Linters (Static Analysis) for Go 14 | steps: 15 | - name: Checkout code into the Go module directory. 16 | uses: actions/checkout@v2 17 | 18 | - name: Install Go 19 | uses: actions/setup-go@v2 20 | with: 21 | go-version: 1.15.x 22 | 23 | - uses: actions/cache@v1 24 | with: 25 | path: ~/go/pkg/mod 26 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 27 | 28 | - name: Linting & vetting. 29 | env: 30 | GOBIN: /tmp/.bin 31 | run: cd go && make lint 32 | tests: 33 | runs-on: ${{ matrix.platform }} 34 | strategy: 35 | fail-fast: false 36 | matrix: 37 | go: [ '1.15.x'] 38 | platform: [ubuntu-latest, macos-latest] 39 | 40 | name: Unit tests on Go ${{ matrix.go }} ${{ matrix.platform }} 41 | steps: 42 | - name: Checkout code into the Go module directory. 43 | uses: actions/checkout@v2 44 | 45 | - name: Install Go 46 | uses: actions/setup-go@v2 47 | with: 48 | go-version: ${{ matrix.go }} 49 | 50 | - uses: actions/cache@v1 51 | with: 52 | path: ~/go/pkg/mod 53 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 54 | 55 | - name: Run unit tests. 56 | env: 57 | GOBIN: /tmp/.bin 58 | run: cd go && make test -------------------------------------------------------------------------------- /go/examples/helloworld/app.go: -------------------------------------------------------------------------------- 1 | package helloworldpb 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | func PrepareMessage(c *HelloWorldConfiguration) string { 9 | if h := c.GetHello(); h != nil { 10 | return prepareHello(h) 11 | } 12 | if b := c.GetBye(); b != nil { 13 | return prepareBye(b) 14 | } 15 | return "Not command specified: This should not happen due to validation that has to happen on consumer side." 16 | } 17 | 18 | func prepareHello(c *HelloCommand) string { 19 | switch c.Lang { 20 | case Lang_POLISH: 21 | msg := fmt.Sprintf("Witam %s świat dla %q w %v roku!", c.World, c.Name, c.Year) 22 | if c.PleaseAddReally || c.AddReally { 23 | return "(naprawdę!) " + msg 24 | } 25 | return msg 26 | case Lang_GERMAN: 27 | return "can't speak German really, contributions welcome ):" 28 | default: 29 | fallthrough 30 | case Lang_ENGLISH: 31 | msg := fmt.Sprintf("Hello %s world for %q in %v year!", c.World, c.Name, c.Year) 32 | if c.PleaseAddReally || c.AddReally { 33 | return "(really!) " + msg 34 | } 35 | return msg 36 | } 37 | } 38 | 39 | func prepareJustBye(l Lang) string { 40 | switch l { 41 | case Lang_POLISH: 42 | return "Pa pa świat!" 43 | case Lang_GERMAN: 44 | return "can't speak German really, contributions welcome ):" 45 | default: 46 | fallthrough 47 | case Lang_ENGLISH: 48 | return "See Ya world!" 49 | } 50 | } 51 | 52 | func prepareBye(c *ByeCommand) string { 53 | s := prepareJustBye(c.Lang) 54 | 55 | if b := c.GetConfigurable(); b != nil { 56 | for _, e := range b.Extra { 57 | s += fmt.Sprint(e) 58 | } 59 | // YOLO 60 | if b.Config.Configs[b.ConfigId].Capitalized { 61 | return strings.ToUpper(s) 62 | } 63 | } 64 | return s 65 | } 66 | -------------------------------------------------------------------------------- /proto/protoconfig/go/kingpinv2/v1/extensions.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | // Extensions based on https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2 4 | package protoconfig.go.kingpinv2.v1; 5 | 6 | option go_package = "github.com/openproto/protoconfig/go/kingpinv2;kingpinv2"; 7 | 8 | import "google/protobuf/descriptor.proto"; 9 | import "google/protobuf/any.proto"; 10 | 11 | // TODO(bwplotka): Add more kingpin.v2 flag types https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2 12 | // TODO: Add more. 13 | 14 | // Content is byte steam created from PathOrContent flag, a custom extension built on top of kingpin.v2 flags type. 15 | message Content { 16 | google.protobuf.Any content = 1; // any proto.Message 17 | } 18 | 19 | // ExistingFile represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.ExistingFile. 20 | // repeated ExistingFile represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.ExistingFiles. 21 | message ExistingFile { 22 | google.protobuf.Any file = 1; // *os.File 23 | } 24 | 25 | // IP represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.IP. 26 | // repeated IP represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.IPList. 27 | message IP { 28 | google.protobuf.Any ip = 1; // *net.IP 29 | } 30 | 31 | // Regexp represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.Regexp. 32 | // repeated Regexp represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.RegexpList. 33 | message Regexp { 34 | google.protobuf.Any regexp = 1; // **regexp.Regexp 35 | } 36 | 37 | extend google.protobuf.FieldOptions { 38 | string placeholder = 6000; 39 | string envvar = 6001; 40 | // By default field represents a flag. 41 | bool argument = 6002; 42 | } 43 | 44 | message Command { 45 | string name = 1; 46 | } 47 | 48 | extend google.protobuf.MessageOptions { 49 | // By default message represents just complex configuration type. If command_name is specified 50 | // such message becomes a kingpin.v2 command. 51 | // Name has to be unique within single protoconfig.Configuration type. 52 | Command command = 6002; 53 | } 54 | -------------------------------------------------------------------------------- /proto/examples/helloworld/v1/helloworld.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | import "protoconfig/v1/extensions.proto"; 4 | import "protoconfig/go/kingpinv2/v1/extensions.proto"; 5 | 6 | option go_package = "github.com/openproto/protoconfig/go/examples/helloworld;helloworldpb"; 7 | option java_multiple_files = true; 8 | option java_package = "com.github.protoconfig.examples.helloworld"; 9 | option java_outer_classname = "HelloWorldProto"; 10 | 11 | package examples.helloworld.v1; 12 | 13 | message HelloWorldConfiguration { 14 | option (protoconfig.v1.metadata) = { 15 | name: "configurable" 16 | version: "0.1.0" 17 | description: "example application to showcase ProtoConfig 1.0." 18 | 19 | flag_delivery: { name: "--protoconfigv1" } 20 | }; 21 | 22 | oneof command { 23 | HelloCommand hello = 2; 24 | ByeCommand bye = 3; 25 | } 26 | } 27 | 28 | enum Lang { 29 | UNSPECIFIED = 0; 30 | ENGLISH = 1; 31 | POLISH = 2; 32 | GERMAN = 3; 33 | } 34 | 35 | message HelloCommand { 36 | option (protoconfig.go.kingpinv2.v1.command) = {name :"hello" }; 37 | 38 | string name = 1 [(protoconfig.v1.required) = true]; 39 | int64 year = 2 [(protoconfig.v1.default) = "2021"]; 40 | string world = 3; 41 | Lang lang = 4; 42 | 43 | bool please_add_really = 5 [deprecated = true]; 44 | bool add_really = 6 [(protoconfig.v1.hidden) = true]; 45 | } 46 | 47 | message ByeCommand { 48 | option (protoconfig.go.kingpinv2.v1.command) = {name :"bye" }; 49 | 50 | Lang lang = 1; 51 | oneof command { 52 | ByeJustCommand just = 2; 53 | ByeConfigurableCommand configurable = 3; 54 | } 55 | } 56 | 57 | message ByeJustCommand { 58 | option (protoconfig.go.kingpinv2.v1.command) = {name :"just" }; 59 | } 60 | 61 | message ByeConfigurableCommand { 62 | option (protoconfig.go.kingpinv2.v1.command) = {name :"configurable" }; 63 | 64 | string config_id = 1; 65 | ByeConfiguration config = 2; 66 | repeated string extra = 3; 67 | } 68 | 69 | message ByeResponse { 70 | bool capitalized = 1; 71 | } 72 | 73 | message ByeConfiguration { 74 | map configs = 2; 75 | } -------------------------------------------------------------------------------- /go/examples/helloworld/configurable-kingpinv2/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "log" 6 | "os" 7 | 8 | helloworldpb "github.com/openproto/protoconfig/go/examples/helloworld" 9 | "github.com/alecthomas/kingpin/v2" 10 | ) 11 | 12 | func main() { 13 | log.SetFlags(0) 14 | 15 | var ( 16 | configEncoded string 17 | helloCmd helloworldpb.HelloCommand 18 | byeConfigurableCmd helloworldpb.ByeConfigurableCommand 19 | langEnum string 20 | usage bytes.Buffer 21 | ) 22 | 23 | conf := &helloworldpb.HelloWorldConfiguration{} 24 | f := kingpin.New(conf.Metadata().Name, conf.Metadata().Description) 25 | f.UsageWriter(&usage) 26 | f.Terminate(func(i int) { 27 | if configEncoded != "" { 28 | if err := conf.DecodeString(configEncoded); err != nil { 29 | log.Fatal(err) 30 | } 31 | log.Println(helloworldpb.PrepareMessage(conf)) 32 | os.Exit(0) 33 | } 34 | os.Exit(1) 35 | }) 36 | 37 | // First input method: protoconfig. 38 | f.Flag("protoconfigv1", "configuration protobuf compatible with ProtoConfig 1.0 standard").StringVar(&configEncoded) 39 | 40 | // Second: Manually written CLI. It's a bit tedious and prone to errors, so see `configurable-kingpinv2-gen` for better approach. 41 | c := f.Command("hello", "TODO") 42 | c.Flag("name", "TODO").StringVar(&helloCmd.Name) 43 | c.Flag("year", "TODO").Int64Var(&helloCmd.Year) 44 | c.Flag("world", "TODO").StringVar(&helloCmd.World) 45 | c.Flag("lang", "TODO").EnumVar(&langEnum, "ENGLISH", "POLISH", "GERMAN", "UNSPECIFIED") 46 | c.Flag("please-add-really", "TODO").BoolVar(&helloCmd.PleaseAddReally) //nolint (deprecated, but we want to be backward compatible). 47 | c.Flag("add-really", "TODO").BoolVar(&helloCmd.AddReally) 48 | 49 | b := f.Command("bye", "TODO") 50 | b.Flag("lang", "TODO").EnumVar(&langEnum, "ENGLISH", "POLISH", "GERMAN", "UNSPECIFIED") 51 | _ = b.Command("just", "TODO") 52 | 53 | // TODO(bwplotka): Actually implement. 54 | _ = b.Command("configurable", "TODO") 55 | 56 | cmd, err := f.Parse(os.Args[1:]) 57 | if err != nil { 58 | log.Println(usage) 59 | log.Fatal(err) 60 | } 61 | 62 | switch cmd { 63 | case "hello": 64 | // YOLO! 65 | helloCmd.Lang = helloworldpb.Lang(helloworldpb.Lang_value[langEnum]) 66 | conf.Command = helloworldpb.NewHelloCommand(&helloCmd) 67 | case "bye just": 68 | conf.Command = helloworldpb.NewByeCommand(&helloworldpb.ByeCommand{ 69 | Lang: helloworldpb.Lang(helloworldpb.Lang_value[langEnum]), 70 | Command: helloworldpb.NewByeJustCommand(&helloworldpb.ByeJustCommand{}), 71 | }) 72 | case "bye configurable": 73 | conf.Command = helloworldpb.NewByeCommand(&helloworldpb.ByeCommand{ 74 | Lang: helloworldpb.Lang(helloworldpb.Lang_value[langEnum]), 75 | Command: helloworldpb.NewByeConfigurableCommand(&byeConfigurableCmd), 76 | }) 77 | } 78 | 79 | log.Println(helloworldpb.PrepareMessage(conf)) 80 | } 81 | -------------------------------------------------------------------------------- /proto/protoconfig/v1/extensions.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | // Proto Config Extensions Format 1.0. 4 | // 5 | // This defines extensions to protocol-buffer-compatible language that is build on proto version 3 with protobuf custom options. 6 | // 7 | // ProtoConfig Extensions allows software authors to define metadata about required configuration like default values or field 8 | // optionality etc. 9 | // 10 | // Extension can be used as natively described in https://developers.google.com/protocol-buffers/docs/proto#customoptions 11 | // 12 | // Below extensions are not mandatory to use while defining your configuration, but mandatory to be implemented by 13 | // ProtoConfig 1.0 compatible parsers and generators. 14 | package protoconfig.v1; 15 | 16 | option go_package = "github.com/openproto/protoconfig/go;protoconfig"; 17 | 18 | import "google/protobuf/descriptor.proto"; 19 | 20 | /// Metadata is an Message option that when put on message indicates an entry point for certain configuration. 21 | /// One `Configuration Proto Definition` can have many structs marked as this option. 22 | /// TODO(bwplotka): Make it non pointers (in Go). 23 | message Metadata { 24 | /// name represents name of annotated configuration entry point. 25 | /// It's recommended to use executable name here. 26 | string name = 1; 27 | /// version is the semantic version of the annotated configuration. 28 | string version = 2; 29 | string description = 3; 30 | 31 | /// delivery_mechanism optionally specifies the delivery that is implemented by configurable that consumes this 32 | /// configuration. This allows `Configurator` to discover how to pass the `Encoded Configuration Message` 33 | /// without extra information outside of definition. 34 | // TODO(bwplotka): This might be blocking reusability. Rethink? 35 | oneof delivery_mechanism { 36 | StdinDelivery stdin_delivery = 101; 37 | FlagDelivery flag_delivery = 102; 38 | } 39 | } 40 | 41 | message StdinDelivery {} 42 | 43 | message FlagDelivery { 44 | /// name represents custom flag name (including `-` if any) for a flag that consumes bytes of `Encoded Configuration Message` 45 | // ProtoConfig 1.0 recommends `--protoconfigv1` name. 46 | string name = 1; 47 | } 48 | 49 | extend google.protobuf.MessageOptions { 50 | /// metadata represents 51 | Metadata metadata = 5000; 52 | } 53 | 54 | extend google.protobuf.FieldOptions { 55 | /// default represents an option that sets a default value for the field. 56 | string default = 5000; 57 | /// hidden represents an option that marks a field as hidden. What it actually causes is up to the Configurable. 58 | /// ProtoConfig 1.0 recommends hiding it from the documentation. 59 | bool hidden = 5001; 60 | /// required represents an option that marks a field as mandatory and if empty, Configurable does not accept the whole configuration. 61 | bool required = 5002; 62 | /// experimental represents an option that marks a field as experimental. What it actually causes is up to the Configurable. 63 | /// ProtoConfig 1.0 recommends warning in the documentation. 64 | bool experimental = 5003; 65 | 66 | } -------------------------------------------------------------------------------- /.bingo/Variables.mk: -------------------------------------------------------------------------------- 1 | # Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.5. DO NOT EDIT. 2 | # All tools are designed to be build inside $GOBIN. 3 | BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST))) 4 | GOPATH ?= $(shell go env GOPATH) 5 | GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin 6 | GO ?= $(shell which go) 7 | 8 | # Bellow generated variables ensure that every time a tool under each variable is invoked, the correct version 9 | # will be used; reinstalling only if needed. 10 | # For example for buf variable: 11 | # 12 | # In your main Makefile (for non array binaries): 13 | # 14 | #include .bingo/Variables.mk # Assuming -dir was set to .bingo . 15 | # 16 | #command: $(BUF) 17 | # @echo "Running buf" 18 | # @$(BUF) 19 | # 20 | BUF := $(GOBIN)/buf-v0.33.0 21 | $(BUF): $(BINGO_DIR)/buf.mod 22 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 23 | @echo "(re)installing $(GOBIN)/buf-v0.33.0" 24 | @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=buf.mod -o=$(GOBIN)/buf-v0.33.0 "github.com/bufbuild/buf/cmd/buf" 25 | 26 | FAILLINT := $(GOBIN)/faillint-v1.5.0 27 | $(FAILLINT): $(BINGO_DIR)/faillint.mod 28 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 29 | @echo "(re)installing $(GOBIN)/faillint-v1.5.0" 30 | @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=faillint.mod -o=$(GOBIN)/faillint-v1.5.0 "github.com/fatih/faillint" 31 | 32 | GOIMPORTS := $(GOBIN)/goimports-v0.0.0-20200519204825-e64124511800 33 | $(GOIMPORTS): $(BINGO_DIR)/goimports.mod 34 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 35 | @echo "(re)installing $(GOBIN)/goimports-v0.0.0-20200519204825-e64124511800" 36 | @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=goimports.mod -o=$(GOBIN)/goimports-v0.0.0-20200519204825-e64124511800 "golang.org/x/tools/cmd/goimports" 37 | 38 | GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.26.0 39 | $(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod 40 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 41 | @echo "(re)installing $(GOBIN)/golangci-lint-v1.26.0" 42 | @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.26.0 "github.com/golangci/golangci-lint/cmd/golangci-lint" 43 | 44 | MDOX := $(GOBIN)/mdox-v0.2.0 45 | $(MDOX): $(BINGO_DIR)/mdox.mod 46 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 47 | @echo "(re)installing $(GOBIN)/mdox-v0.2.0" 48 | @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=mdox.mod -o=$(GOBIN)/mdox-v0.2.0 "github.com/bwplotka/mdox" 49 | 50 | MISSPELL := $(GOBIN)/misspell-v0.3.4 51 | $(MISSPELL): $(BINGO_DIR)/misspell.mod 52 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 53 | @echo "(re)installing $(GOBIN)/misspell-v0.3.4" 54 | @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=misspell.mod -o=$(GOBIN)/misspell-v0.3.4 "github.com/client9/misspell/cmd/misspell" 55 | 56 | PROTOC_GEN_GO := $(GOBIN)/protoc-gen-go-v1.25.0 57 | $(PROTOC_GEN_GO): $(BINGO_DIR)/protoc-gen-go.mod 58 | @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. 59 | @echo "(re)installing $(GOBIN)/protoc-gen-go-v1.25.0" 60 | @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=protoc-gen-go.mod -o=$(GOBIN)/protoc-gen-go-v1.25.0 "google.golang.org/protobuf/cmd/protoc-gen-go" 61 | 62 | -------------------------------------------------------------------------------- /go/examples/helloworld/configurator/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "log" 6 | "os" 7 | "os/exec" 8 | 9 | protoconfig "github.com/openproto/protoconfig/go" 10 | helloworldpb "github.com/openproto/protoconfig/go/examples/helloworld" 11 | "google.golang.org/protobuf/encoding/protojson" 12 | "google.golang.org/protobuf/proto" 13 | ) 14 | 15 | func runCmdAndPrintResult(dir string, args ...string) { 16 | c := exec.Command(args[0], args[1:]...) 17 | c.Dir = dir 18 | b := bytes.Buffer{} 19 | c.Stdout = &b 20 | c.Stderr = &b 21 | if err := c.Run(); err != nil { 22 | log.Fatal(err, b.String()) 23 | } 24 | log.Printf("[%v] => %s\n", args, b.String()) 25 | } 26 | 27 | // Command invoking go run ./configurable-kingpinv2 hello --world="my" --year=2077 --name="Alt C" --lang=ENGLISH --add-really 28 | // using a few different methods. 29 | func main() { 30 | log.SetFlags(0) 31 | pwd, err := os.Getwd() 32 | if err != nil { 33 | log.Fatal(err) 34 | } 35 | 36 | runUsingArgs(pwd) 37 | runUsingProtoConfig1_0_NoPlugin(pwd) 38 | runUsingProtoConfig1_0(pwd) 39 | } 40 | 41 | func runUsingArgs(dir string) { 42 | log.Println("invoking configurable using args:") 43 | 44 | // Prone to errors, not generated, not maintainable, not safely typed, etc.. 45 | runCmdAndPrintResult(dir, "go", "run", "./configurable-kingpinv2", "hello", "--world=my", "--year=2077", "--name=Alt C", "--lang=ENGLISH", "--add-really") 46 | } 47 | 48 | func runUsingProtoConfig1_0_NoPlugin(dir string) { 49 | log.Println("invoking configurable using ProtoConfig 1.0 (with just using native protogen-go nothing else!):") 50 | 51 | c := &helloworldpb.HelloWorldConfiguration{ 52 | Command: &helloworldpb.HelloWorldConfiguration_Hello{ 53 | Hello: &helloworldpb.HelloCommand{ 54 | World: "my", 55 | Year: 2077, 56 | Name: "Alt C", 57 | Lang: helloworldpb.Lang_ENGLISH, 58 | AddReally: true, 59 | }, 60 | }, 61 | } 62 | 63 | // Prone to runtime errors, but better than args. 64 | appName := proto.GetExtension(c.ProtoReflect().Descriptor().Options(), protoconfig.E_Metadata).(*protoconfig.Metadata).Name 65 | 66 | b, err := protojson.Marshal(c) 67 | if err != nil { 68 | log.Fatal(err) 69 | } 70 | 71 | runCmdAndPrintResult(dir, "go", "run", "./"+appName, "--protoconfigv1="+string(b)) 72 | runCmdAndPrintResult(dir, "go", "run", "./"+appName+"-kingpinv2", "--protoconfigv1="+string(b)) 73 | } 74 | 75 | func runUsingProtoConfig1_0(dir string) { 76 | c := &helloworldpb.HelloWorldConfiguration{ 77 | Command: helloworldpb.NewHelloCommand(&helloworldpb.HelloCommand{ 78 | World: "my", 79 | Year: 2077, 80 | Name: "Alt C", 81 | Lang: helloworldpb.Lang_ENGLISH, 82 | AddReally: true, 83 | }), 84 | } 85 | 86 | log.Println("invoking configurable using ProtoConfig 1.0 (EncodeJSON):") 87 | b, err := c.EncodeJSON() 88 | if err != nil { 89 | log.Fatal(err) 90 | } 91 | 92 | runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name, "--protoconfigv1="+string(b)) 93 | runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name+"-kingpinv2", "--protoconfigv1="+string(b)) 94 | 95 | log.Println("invoking configurable using ProtoConfig 1.0 (Marshal):") 96 | 97 | b, err = c.Encode() 98 | if err != nil { 99 | log.Fatal(err) 100 | } 101 | 102 | runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name, "--protoconfigv1="+string(b)) 103 | runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name+"-kingpinv2", "--protoconfigv1="+string(b)) 104 | 105 | log.Println("invoking configurable using ProtoConfig 1.0 (CommandLineArgument()):") 106 | 107 | arg, err := c.CommandLineArgument() 108 | if err != nil { 109 | log.Fatal(err) 110 | } 111 | 112 | runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name, arg) 113 | runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name+"-kingpinv2", arg) 114 | } 115 | -------------------------------------------------------------------------------- /go/kingpinv2/pathorcontent.go: -------------------------------------------------------------------------------- 1 | package kingpinv2 2 | 3 | import ( 4 | "fmt" 5 | "io/ioutil" 6 | 7 | "github.com/alecthomas/kingpin/v2" 8 | "github.com/pkg/errors" 9 | ) 10 | 11 | // Clause is a fluid interface used to build extended flags. 12 | // This is useful for flags that are a bit of uncommon logic extension like fileOrContent. 13 | type Clause struct { 14 | cmd FlagClause 15 | name string 16 | help string 17 | required bool 18 | 19 | hiddenPath bool 20 | defaultPath string 21 | 22 | hiddenContent bool 23 | defaultContent string 24 | } 25 | 26 | type FlagClause interface { 27 | Flag(name, help string) *kingpin.FlagClause 28 | } 29 | 30 | type AllClause interface { 31 | Required() AllClause 32 | HiddenPath() AllClause 33 | HiddenContent() AllClause 34 | DefaultPath(values string) PathOrContentClause 35 | DefaultContent(values string) PathOrContentClause 36 | PathOrContentClause 37 | } 38 | 39 | type PathOrContentClause interface { 40 | PathOrContent() *PathOrContent 41 | } 42 | 43 | func Flag(cmd FlagClause, flagName string, help string) AllClause { 44 | return &Clause{cmd: cmd, name: flagName, help: help} 45 | } 46 | 47 | func (f *Clause) DefaultPath(value string) PathOrContentClause { 48 | f.defaultPath = value 49 | return f 50 | } 51 | 52 | func (f *Clause) DefaultContent(value string) PathOrContentClause { 53 | f.defaultContent = value 54 | return f 55 | } 56 | 57 | // HiddenContent hides a flag from usage but still allows it to be used. 58 | func (f *Clause) HiddenContent() AllClause { 59 | f.hiddenContent = true 60 | return f 61 | } 62 | 63 | // HiddenPath hides a -file flag from usage but still allows it to be used. 64 | func (f *Clause) HiddenPath() AllClause { 65 | f.hiddenPath = true 66 | return f 67 | } 68 | 69 | // Required makes the flag required. You can not provide a Default() value to a Required() flag. 70 | func (f *Clause) Required() AllClause { 71 | f.required = true 72 | return f 73 | } 74 | 75 | // PathOrContent is a flag type that defines two flags to fetch bytes. Either from file (*-file flag) or content (* flag). 76 | type PathOrContent struct { 77 | flagName string 78 | 79 | required bool 80 | 81 | path *string 82 | content *string 83 | } 84 | 85 | func (f *Clause) PathOrContent() *PathOrContent { 86 | pathFlagName := fmt.Sprintf("%s-file", f.name) 87 | contentFlagName := f.name 88 | 89 | c := f.cmd.Flag(pathFlagName, fmt.Sprintf("Path to %s", f.help)) 90 | if f.hiddenPath { 91 | c = c.Hidden() 92 | } 93 | if f.defaultPath != "" { 94 | // TODO(bwplotka): Add default to help. 95 | c = c.Default(f.defaultPath) 96 | } 97 | pathFlag := c.PlaceHolder("").String() 98 | 99 | c = f.cmd.Flag(contentFlagName, fmt.Sprintf("Alternative to '%s' flag (lower priority). Content of %s", pathFlagName, f.help)) 100 | if f.hiddenContent { 101 | c = c.Hidden() 102 | } 103 | if f.defaultContent != "" { 104 | // TODO(bwplotka): Add default to help. 105 | c = c.Default(f.defaultContent) 106 | } 107 | contentFlag := c.PlaceHolder("").String() 108 | 109 | return &PathOrContent{ 110 | flagName: f.name, 111 | required: f.required, 112 | path: pathFlag, 113 | content: contentFlag, 114 | } 115 | } 116 | 117 | // Content returns content of the file. Flag that specifies path has priority. 118 | // It returns error if the content is empty and required flag is set to true. 119 | func (p *PathOrContent) Content() ([]byte, error) { 120 | contentFlagName := p.flagName 121 | fileFlagName := fmt.Sprintf("%s-file", p.flagName) 122 | 123 | if len(*p.path) > 0 && len(*p.content) > 0 { 124 | return nil, errors.Errorf("both %s and %s flags set.", fileFlagName, contentFlagName) 125 | } 126 | 127 | var content []byte 128 | if len(*p.path) > 0 { 129 | c, err := ioutil.ReadFile(*p.path) 130 | if err != nil { 131 | return nil, errors.Wrapf(err, "loading YAML file %s for %s", *p.path, fileFlagName) 132 | } 133 | content = c 134 | } else { 135 | content = []byte(*p.content) 136 | } 137 | 138 | if len(content) == 0 && p.required { 139 | return nil, errors.Errorf("flag %s or %s is required for running this command and content cannot be empty.", fileFlagName, contentFlagName) 140 | } 141 | 142 | return content, nil 143 | } 144 | -------------------------------------------------------------------------------- /go/examples/helloworld/helloworld_protoconfig.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go-protoconfig code. DO NOT EDIT. 2 | 3 | package helloworldpb 4 | 5 | import ( 6 | bytes "bytes" 7 | fmt "fmt" 8 | _go "github.com/openproto/protoconfig/go" 9 | protojson "google.golang.org/protobuf/encoding/protojson" 10 | proto "google.golang.org/protobuf/proto" 11 | ) 12 | 13 | // This is a compile-time assertion to ensure that this generated file 14 | // is compatible with the ProtoConfig golang package it is being compiled against. 15 | const _ = _go.SupportPackageIsVersion1 16 | 17 | func NewHelloCommand(x *HelloCommand) *HelloWorldConfiguration_Hello { 18 | return &HelloWorldConfiguration_Hello{Hello: x} 19 | } 20 | 21 | func NewByeCommand(x *ByeCommand) *HelloWorldConfiguration_Bye { 22 | return &HelloWorldConfiguration_Bye{Bye: x} 23 | } 24 | 25 | func NewByeJustCommand(x *ByeJustCommand) *ByeCommand_Just { 26 | return &ByeCommand_Just{Just: x} 27 | } 28 | 29 | func NewByeConfigurableCommand(x *ByeConfigurableCommand) *ByeCommand_Configurable { 30 | return &ByeCommand_Configurable{Configurable: x} 31 | } 32 | 33 | // Encode encodes self as `Encoded Configuration Message` in proto format so it can be understood and 34 | // passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion 35 | // (validation, default values etc). 36 | // Use `proto.Marshal` encoding without `ProtoConfig 1.0` extension support. 37 | func (x *HelloWorldConfiguration) Encode() ([]byte, error) { 38 | // TODO(bwplotka): Actually implement validation for `Proto Config Extensions Format 1.0` (: 39 | return proto.Marshal(x) 40 | } 41 | 42 | // EncodeJSON encodes self as `Encoded Configuration Message` in JSON format so it can be understood and 43 | // passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion 44 | // (validation, default values etc). 45 | // Use `protojson.Marshal` encoding without `ProtoConfig 1.0` extension support. 46 | func (x *HelloWorldConfiguration) EncodeJSON() ([]byte, error) { 47 | // TODO(bwplotka): Actually implement validation for `Proto Config Extensions Format 1.0` (: 48 | return protojson.Marshal(x) 49 | } 50 | 51 | // Metadata returns metadata defined in `Proto Config Extensions Format 1.0`. 52 | func (x *HelloWorldConfiguration) Metadata() _go.Metadata { 53 | return _go.Metadata{ 54 | Name: "configurable", 55 | Version: "0.1.0", 56 | Description: "example application to showcase ProtoConfig 1.0.", 57 | DeliveryMechanism: &_go.Metadata_FlagDelivery{FlagDelivery: &_go.FlagDelivery{Name: "--protoconfigv1"}}, 58 | } 59 | } 60 | 61 | func (x *HelloWorldConfiguration) CommandLineArgument() (string, error) { 62 | b, err := x.Encode() 63 | if err != nil { 64 | return "", err 65 | } 66 | return fmt.Sprintf("--protoconfigv1=%s", b), nil 67 | } 68 | 69 | // This is a compile-time assertion to ensure that extended HelloWorldConfiguration implements 70 | // _go.Configurator interface. 71 | var _ _go.Configurator = &HelloWorldConfiguration{} 72 | 73 | // Decode parses byte slice as `Encoded Configuration Message` in JSON or proto format and unmarshal it on 74 | // the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion 75 | // (validation, default values etc). 76 | // Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support. 77 | func (x *HelloWorldConfiguration) Decode(ecm []byte) error { 78 | // TODO(bwplotka): Actually implement validation for `Proto Config Extensions Format 1.0` (: 79 | if isJSON(ecm) { 80 | return protojson.Unmarshal(ecm, x) 81 | } 82 | return proto.Unmarshal(ecm, x) 83 | } 84 | 85 | // DecodeString parses string as `Encoded Configuration Message` in JSON or proto format and unmarshal it on 86 | // the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion 87 | // (validation, default values etc). 88 | // Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support. 89 | func (x *HelloWorldConfiguration) DecodeString(ecm string) error { 90 | return x.Decode([]byte(ecm)) 91 | } 92 | 93 | func isJSON(b []byte) bool { 94 | bb := bytes.TrimSpace(b) 95 | if len(bb) == 0 { 96 | return false 97 | } 98 | return bb[0] == '{' 99 | } 100 | 101 | // This is a compile-time assertion to ensure that extended HelloWorldConfiguration implements 102 | // _go.Configurable interface. 103 | var _ _go.Configurable = &HelloWorldConfiguration{} 104 | -------------------------------------------------------------------------------- /go/Makefile: -------------------------------------------------------------------------------- 1 | include ../common.mk 2 | include ../.bingo/Variables.mk 3 | 4 | MODULE_EXAMPLES := examples 5 | MODULE_GEN_GO := protoc-gen-go-protoconfig 6 | MODULE_KINGPINV2 := kingpinv2 7 | 8 | FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print) 9 | TMP_GOBIN ?= $(TMP_PATH)/gobin 10 | 11 | GO111MODULE ?= on 12 | export GO111MODULE 13 | 14 | GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin 15 | 16 | .PHONY: all 17 | all: format build 18 | 19 | .PHONY: build 20 | build: ## Build protoc-gen-go-protoconfig. 21 | @echo ">> building $(MODULE_GEN_GO)" 22 | @cd $(MODULE_GEN_GO) && GOBIN=$(GOBIN) go install github.com/openproto/protoconfig/go/protoc-gen-go-protoconfig 23 | 24 | .PHONY: deps 25 | deps: ## Ensures fresh go.mod and go.sum. 26 | @go mod tidy && go mod verify 27 | @cd $(MODULE_EXAMPLES) && go mod tidy && go mod verify 28 | @cd $(MODULE_GEN_GO) && go mod tidy && go mod verify 29 | @cd $(MODULE_KINGPINV2) && go mod tidy && go mod verify 30 | 31 | .PHONY: format 32 | format: ## Formats Go code. 33 | format: $(GOIMPORTS) 34 | @echo ">> formatting code" 35 | @$(GOIMPORTS) -w $(FILES_TO_FMT) 36 | 37 | .PHONY: test 38 | test: ## Runs all Go unit tests. 39 | export GOCACHE=/tmp/cache 40 | test: 41 | @echo ">> running unit tests" 42 | @go mod tidy && go test -v -timeout=30m ./... 43 | @cd $(MODULE_EXAMPLES) && go test -v -timeout=30m ./... 44 | @cd $(MODULE_GEN_GO) && go test -v -timeout=30m ./... 45 | @cd $(MODULE_KINGPINV2) && go test -v -timeout=30m ./... 46 | 47 | # For protoc naming matters. 48 | PROTOC_GEN_GO_CURRENT := $(TMP_GOBIN)/protoc-gen-go 49 | 50 | .PHONY: proto 51 | proto: ## Generate protobufs for all modules 52 | proto: build $(BUF) $(PROTOC_GEN_GO) 53 | @mkdir -p $(TMP_GOBIN) 54 | @cp $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_CURRENT) 55 | @echo ">> generating $(REPO_ROOT_DIR)/proto/protoconfig/v1/extensions.proto in $(REPO_ROOT_DIR)/go" 56 | @PATH=$(GOBIN):$(TMP_GOBIN) $(BUF) protoc \ 57 | -I $(REPO_ROOT_DIR)/proto \ 58 | --go_out=$(REPO_ROOT_DIR)/go --go_opt=module="github.com/openproto/protoconfig/go" \ 59 | $(REPO_ROOT_DIR)/proto/protoconfig/v1/extensions.proto 60 | @echo ">> generating $(REPO_ROOT_DIR)/proto/protoconfig/go/kingpinv2/v1/extensions.proto in $(REPO_ROOT_DIR)/go/kingpinv2" 61 | @PATH=$(GOBIN):$(TMP_GOBIN) $(BUF) protoc \ 62 | -I $(REPO_ROOT_DIR)/proto \ 63 | --go_out=$(REPO_ROOT_DIR)/go/kingpinv2 --go_opt=module="github.com/openproto/protoconfig/go/kingpinv2" \ 64 | $(REPO_ROOT_DIR)/proto/protoconfig/go/kingpinv2/v1/extensions.proto 65 | @echo ">> generating $(REPO_ROOT_DIR)/proto/examples/helloworld/v1/helloworld.proto in $(REPO_ROOT_DIR)/go/examples/helloworld/" 66 | @PATH=$(GOBIN):$(TMP_GOBIN) $(BUF) protoc \ 67 | -I $(REPO_ROOT_DIR)/proto \ 68 | --go_out=$(REPO_ROOT_DIR)/go/examples/helloworld/ --go_opt=module="github.com/openproto/protoconfig/go/examples/helloworld" \ 69 | --go-protoconfig_out=$(REPO_ROOT_DIR)/go/examples/helloworld/ --go-protoconfig_opt=module="github.com/openproto/protoconfig/go/examples/helloworld" \ 70 | $(REPO_ROOT_DIR)/proto/examples/helloworld/v1/helloworld.proto 71 | 72 | .PHONY: check-git 73 | check-git: 74 | ifneq ($(GIT),) 75 | @test -x $(GIT) || (echo >&2 "No git executable binary found at $(GIT)."; exit 1) 76 | else 77 | @echo >&2 "No git binary found."; exit 1 78 | endif 79 | 80 | .PHONY: lint 81 | lint: ## Runs various static analysis against our code. 82 | lint: $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL) format proto check-git deps build 83 | @DIR="." $(MAKE) lint_module 84 | @DIR=$(MODULE_EXAMPLES) $(MAKE) lint_module 85 | @DIR=$(MODULE_GEN_GO) $(MAKE) lint_module 86 | @DIR=$(MODULE_KINGPINV2) $(MAKE) lint_module 87 | @echo ">> detecting misspells" 88 | @find . -type f | grep -v vendor/ | grep -vE '\./\..*' | xargs $(MISSPELL) -error 89 | $(call require_clean_work_tree,"detected files change during formar/lint process - run make lint and commit changes.") 90 | 91 | .PHONY: lint_module 92 | # PROTIP: 93 | # Add 94 | # --cpu-profile-path string Path to CPU profile output file 95 | # --mem-profile-path string Path to memory profile output file 96 | # to debug big allocations during linting. 97 | lint_module: ## Runs various static analysis against our code. 98 | lint_module: 99 | @echo ">> verifying modules being imported" 100 | @cd $(DIR) && $(FAILLINT) -paths "errors=github.com/pkg/errors" ./... 101 | @cd $(DIR) && $(FAILLINT) -paths "fmt.{Print,Printf,Println}" -ignore-tests ./... 102 | @echo ">> examining all of the Go files" 103 | @cd $(DIR) && go vet -stdmethods=false ./... 104 | @echo ">> linting all of the Go files GOGC=${GOGC}" 105 | @cd $(DIR) && $(GOLANGCI_LINT) run 106 | -------------------------------------------------------------------------------- /go/examples/README.md: -------------------------------------------------------------------------------- 1 | ## Go: OpenConfg 1.0 Examples 2 | 3 | ### Prerequisites 4 | 5 | * [Go](https://golang.org/) 6 | 7 | For installation instructions, see [Go’s Getting Started guide](https://golang.org/doc/install). 8 | 9 | * [Protocol buffer compiler](https://developers.google.com/protocol-buffers) (`protoc`), [version 3](https://developers.google.com/protocol-buffers/docs/proto3). 10 | 11 | For installation instructions, see [Protocol Buffer Compiler Installation](https://grpc.io/docs/protoc-installation/). 12 | 13 | * Go plugins for the protocol compiler: 14 | 15 | 1. Install the protocol compiler plugins for Go and ProtoConfig using the following commands: 16 | 17 | ```bash 18 | export GO111MODULE=on # Enable module mode 19 | go get google.golang.org/protobuf/cmd/protoc-gen-go \ 20 | github.com/openproto/protoconfig/go/protoc-gen-go-protoconfig 21 | ``` 22 | 23 | 1. Update your PATH so that the protoc compiler can find the plugins: 24 | 25 | ```bash 26 | export PATH="$PATH:$(go env GOPATH)/bin 27 | ``` 28 | 29 | ### Steps 30 | 31 | 1. Start by reading example application `Configuration Proto Definition` complainant with `ProtoConfig 1.0` (from repo root): [`proto/examples/helloworld/v1/helloworld.proto`](/proto/examples/helloworld/v1/helloworld.proto) 32 | 33 | This file is just `.proto` with a couple of options from few extensions: 34 | 35 | * `protoconfig` defined in [`proto/protoconfig/v1/extensions.proto`](/proto/protoconfig/v1/extensions.proto) is an `ProtoConfig 1.0` extension which adds optional context for given data fields like: `required` `hidden` `default` and allows to add metadata that indicates the entry point(s) for the configuration. 36 | * `kingpin` defined in [`proto/go/kingpinv2/v1/extensions.proto`](/proto/go/kingpinv2/v1/extensions.proto) which adds `Go`, `kingpin` specific options allowing even more Go or [`kingpin`](https://github.com/alecthomas/kingpin) library specific context like custom types (existing file, regexp, IP) etc! 37 | 38 | The power of `ProtoConfig 1.0` comes from `protobuf` superpowers: Those options are fully ignored if your `protoc` does not have plugins supporting them (for example you generate data structures for C++ or Java!). This allows ultimate extensibility. 39 | 40 | 2. This example has already generated Go code from this `helloworld` application `Configuration Proto Definition`, and you can see it [go/examples/helloworld/helloworld.pb.go](/go/examples/helloworld/helloworld.pb.go) and [go/examples/helloworld/helloworld_protoconfig.pb.go](/go/examples/helloworld/helloworld_protoconfig.pb.go). Since it's generated code, 41 | it's not readable much. Check [go.dev](https://pkg.go.dev/github.com/openproto/protoconfig/go/examples) instead! (It's go code after all and supports `godoc`!) 42 | 43 | What you see is the `protobuf` Go code that allows to marshal and unmarshal filled types in to `ProtoConfig 1.0` (and proto) compliant encoding. 44 | 45 | 3. Change directory to our quick start example directory for Go `cd go/examples/helloworld` 46 | 47 | 4. In this directory, on top of generated Go code for `helloworld` `Configuration Proto Definition` we see a couple of directories: 48 | 49 | * `./configurable` is an `ProtoConfig 1.0` compliant `helloword` application that just allows `ProtoConfig` for configuration. 50 | * `./configurable-kingpinv2` is an `ProtoConfig 1.0` compliant `helloword` application that allows `ProtoConfig` as well as standard POSIX flags (that were manually implemented based on [`kingpin`](https://github.com/alecthomas/kingpin) library ) for configuration. 51 | * `./configurable-kingpinv2-gen` is an `ProtoConfig 1.0` compliant `helloword` application that allows `ProtoConfig` as well as standard POSIX flags that were generated thanks to [`../kingpinv2/`](/go/kingpinv2) extension. 52 | * `./configurator` is `helloworld` application client that configures (by executing it in another process) in couple different ways in order 53 | to get `(really!) Hello my world for "Alt C" in 2077 year!` string output. 54 | 55 | 5. Feel free to run `./configurable-kingpinv2` with any parameters you want. Check all flags via `go run ./configurable-kingpinv2 --help` Executable will execute all as `Configuration Proto Definition` defines and help specifies. For example you can run: 56 | 57 | ```bash 58 | go run ./configurable-kingpinv2 hello --world="my" --year=2077 --name="Alt C" --lang=ENGLISH --add-really 59 | ``` 60 | 61 | But you can also use `ProtoConfig 1.0` convention!: 62 | 63 | ```bash 64 | go run ./configurable-kingpinv2 --protoconfigv1='{"hello": {"name": "Alt C", "year": 2077, "world": "my", "add_really": true}}' 65 | ``` 66 | 67 | All the above should print `(really!) Hello my world for "Alt C" in 2077 year!` 68 | 69 | 6. Run configurator to check if all applications returns expected message by running: `go run ./configurator` 70 | 71 | 7. Read [`./configurator`](/go/examples/helloworld/configurator/main.go) to check all different ways to configure `helloworld` `configurable` 72 | with and without `ProtoConfig 1.0`! 73 | 74 | #### Updating Configuration Proto Definition 75 | 76 | TBD (tl;dr: `make proto`) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProtoConfig 1.0 2 | 3 | [![golang docs](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/openproto/protoconfig/go) [![Latest Release](https://img.shields.io/github/release/openproto/protoconfig.svg?style=flat-square)](https://github.com/openproto/protoconfig/releases/latest) 4 | 5 | The `ProtoConfig 1.0` is an open, language agnostic specification that describes a process of using, defining, and consuming software configuration input in a unified way. 6 | 7 | *Like OpenAPI but for Configuration!* 8 | 9 | Designed to support all popular configuration patterns: Cloud Native `Configuration as a Code`, robust command line interfaces (CLI), static or dynamic configurability as well as remote configuration APIs. 10 | 11 | ### TL;DR 12 | 13 | The `ProtoConfig 1.0` standardises application configuration, by describing the process as follows: 14 | 15 | 1. Application developer creates a [.proto](https://developers.google.com/protocol-buffers) file with `Configuration Proto Definition`, that defines what exactly options application has. 16 | 2. Thanks to the single source of truth for your app configuration, a developer can generate a data structure in the language they need. Such structs/classes can be then used to parse incoming input in native proto or JSON encoding (for example from `stdin`, CLI flag or HTTP API, etc). 17 | * `ProtoConfig` allows generation extensibility, so such definition can be also used to generate documentation, `--help`, `man`, custom types, or even whole CLI flag & args parsing code. Options are unlimited! 18 | 3. Following the `ProtoConfig` convention, a human or program can now configure the application either by specifying JSON manually or by generating (again) data structure from `Configuration Proto Definition` in the programming language they want. Such struct/class is typed (if a language is typed), have a valid format, have help commentaries and can be encoded to `protobuf` supported format and passed to the `configurable` application! 19 | 20 | `ProtoConfig 1.0` standard specifies that every `ProtoConfig 1.0` compatible application accepts encoded `protobuf` in proto or JSON format as the way of configuring itself. Either as the only way or in addition to other conventions (e.g args and flags). 21 | 22 | ![Open Config 1.0](https://docs.google.com/drawings/d/e/2PACX-1vSANZkljSiDgV-o0a-dL0ryZz19p3Hblt5V_qozhBcY5ILq8j3T2GEAdCCHFHoSGT9h2H4LDqJ9bCn_/pub?w=1440&h=1080) 23 | 24 | ### Goals 25 | 26 | Configure software in a way that is: 27 | 28 | * **Discoverable** and **Type-Safe**: *We don't need to guess or read complex documentations to know application configuration format, invariants, and assumptions Configuration is defined by a single, typed [proto](https://developers.google.com/protocol-buffers) package.* 29 | * **Allows Auto Generation**: *We don't need to manually implement application client or data format to encode and similarly data format to parse. All can be safely generated thanks to `protobuf` in almost any programming language, thanks to the wide plugin ecosystem. Additionally, you can generate a full CLI flag paring code or even documentation(!). It also means the smallest, possible impact in the event of application upgrade or modification. Type, Default, or even Help changed can be easily tracked in any language.* 30 | * **Easy to Verify**: *Non-semantic verification and validation (e.g ) do not require executable participation. No need for CLI --dry-run logic, or even invoking anything external. All can be validated from the point of `protobuf`.* https://github.com/envoyproxy/protoc-gen-validate 31 | * **Backward & Forward Compatible**: *Smooth version migrations, thanks to `protobuf` guarantee and safety checkers like [`buf check breaking`](https://docs.buf.build/breaking-usage)* 32 | * **Extensible**: *On top of [**Proto Config Extensions Format 1.0.**](proto/protoconfig/v1/extensions.proto) this specification allows CLI or language-specific extensions (e.g see [`kingpinv2` Go package](go/kingpinv2) and its [extensions](go/kingpinv2/proto/protoconfig/kingpinv2/v1/extensions.proto))* 33 | 34 | ### Motivation 35 | 36 | See "Configuration in 2021 is still broken" blog post (TBD). 37 | 38 | ### Principles 39 | 40 | See [./specification#principles](specification.md#principles). 41 | 42 | ### Why Protocol Buffers and What is it 43 | 44 | See [./specification#why-protocol-buffers](specification.md#why-protocol-buffers) 45 | 46 | ### Example 47 | 48 | See [example in Go](go/examples/README.md). 49 | 50 | If you are not familiar with Go, this is still a useful example, as the flow and pattern will be similar to any language. 51 | 52 | ## This Repository 53 | 54 | | Item | What | Status | 55 | |--------|------|--------| 56 | | [`proto/protoconfig/v1/extensions.proto`](proto/protoconfig/v1/extensions.proto) | *Proto Config Extensions Format 1.0* | Alpha | 57 | | [`proto/examples/helloworld/v1/helloworld.proto`]( proto/examples/helloworld/v1/helloworld.proto) | Example *Configuration Proto Definitions (CPD)* | Alpha | 58 | | [`go/`](go) | Go module with (optional) *Proto Config Extensions Format 1.0* bindings | Alpha | 59 | | [`go/protoc-gen-go-protoconfig`](go/protoc-gen-go-protoconfig/README.md) | Go module with (optional) protogen go plugin supporting *Proto Config Extensions Format 1.0* Go language | Alpha | 60 | | [`go/examples`](go/examples/README.md) | Go module with (optional) protogen go plugin supporting *Proto Config Extensions Format 1.0* Go language | Alpha | 61 | 62 | ### Contributing 63 | 64 | Any help wanted. Do you have an idea, want to help, don't know how to start helping? 65 | 66 | Put an issue on this repo, create PR or ping us on the CNCF Slack (`@bwplotka`, `@brancz`)! 🤗 67 | 68 | ## Other related projects 69 | 70 | * [OpenConfig](https://www.openconfig.net/): OpenConfig aims for something very similar, however aimed for network management configuration. Defined in `YANG` (some sort of `XML`) instead of more modern `protobuf` which was designed for code generation and IDL. 71 | * [protoconf](https://github.com/protoconf/protoconf): Amazing project inspired by Facebook's Configurator. While sounding similar it's essentially a protobuf based dynamic configuration with its own GitOps pipeline. `ProtoConfig` does not specify how to 72 | do dynamic configuration, leaving that to extensions that can be added to specification itself (e.g language specific generator that generates lib for dynamic reloading). 73 | * [OpenAPI/Swagger](https://swagger.io/specification/): OpenAPI aims for API definitions. Configuration can be treated as some part of the API (payload?), however scoping definition purely for configuration, simplifies the whole topic a lot. `ProtoConfig` does not need to care about status codes, HTTP specifics or actually even OS/Process details. `ProtoConfig` can be applied 74 | 75 | ### Roadmap 76 | 77 | Help wanted! 78 | 79 | * [ ] Documentation for using ProtoConfig 1.0 by different language than supported by this repo. 80 | * [ ] Documentation for writing ProtoConfig 1.0 plugin for a different language than supported by this repo. 81 | * [ ] Publish formal RFC-compatible specification, finish it, add recommendations (e.g package names). 82 | * [ ] Document extensibility. 83 | * [ ] Add example if any configuration templating engine. 84 | * [ ] Large `protobuf` are hard to use. Standard should specify some solution when `Encoded Configuration Message` is larger than Megabytes. 85 | * [ ] Unit tests. 86 | 87 | ## Initial Authors 88 | 89 | * Bartek Płotka @bwplotka 90 | * Frederic Branczyk @brancz 91 | -------------------------------------------------------------------------------- /specification.md: -------------------------------------------------------------------------------- 1 | # `ProtoConfig` 1.0, an open, language agnostic software configuration specification 2 | 3 | **Status**: `Alpha`. 4 | 5 | ## Principles 6 | 7 | Software `configuration` is a process of passing information to the software in order to change its behavior without recompilation or sometimes even without restarting (dynamic configuration). 8 | 9 | Two main sides exist during the software configuration process: 10 | 11 | * `Configurable`: Software we want to configure, statically (during startup) or dynamically (on the run) 12 | * `Configurator`: Another software or human user that desires to configure the `Configurable` automatically or manually (human). 13 | 14 | The key element of `ProtoConfig 1.0` specification is a strict format and rules of the `Configuration Proto Definition`. This definition is the true single language that both `Configurator` and `Configurable` can use as shown in the below diagram: 15 | 16 | ![ProtoConfig](https://docs.google.com/drawings/d/e/2PACX-1vSANZkljSiDgV-o0a-dL0ryZz19p3Hblt5V_qozhBcY5ILq8j3T2GEAdCCHFHoSGT9h2H4LDqJ9bCn_/pub?w=1440&h=1080) 17 | 18 | The `ProtoConfig 1.0` standard specifies that, in order for a `Configurable` (Software) to be `ProtoConfig 1.0` compliant, it shall have one `Configuration Proto Definition`, which shall be the [source of truth](https://en.wikipedia.org/wiki/Single_source_of_truth) of its configuration input. Such a `Configuration Proto Definition` (called further `CPD`) shall meet the following requirements: 19 | 20 | * Shall be stored and versioned together with the software itself (e.g in the same repository). 21 | * Shall be compatible with [Protocol Buffer Version 3](https://developers.google.com/protocol-buffers/docs/reference/proto3-spec) specification. 22 | * Shall define all the configuration options the `Configurable` exposes. 23 | * Can use [**Proto Config Extensions Format 1.0.**](proto/protoconfig/v1/extensions.proto) which might be useful for more advanced configuration options. 24 | * Can use any other [proto](https://developers.google.com/protocol-buffers) extension or important one or more `CPD` from other software. 25 | 26 | Furthermore, additionally, to `CPD`, the `ProtoConfig 1.0` specifies the `Encoded Configuration Message` (called further `ECM`), which is a configuration information serialized into the stream of bytes in [`protobuf "byte" encoding`](https://developers.google.com/protocol-buffers/docs/encoding) or [`JSON encoding`](https://developers.google.com/protocol-buffers/docs/proto3#json) format based on specific `Configuration Proto Definition (CPD)`. 27 | 28 | `ProtoConfig 1.0` specifies `Configuration Process` as passing the `Encoded Configuration Message (ECM)` to `Configurable` in order to control programmed options it exposes. 29 | If the `ECM` is passed and parsed at the start of the application before anything else (e.g starting functionalities) it's called `Static Configuration Process (SCP)`. For example, reading `ECM` from a file on start or reading `ECM` from the CLI flag. If `ECM` is passed and configuration is performed during further execution of the `Configurable` execution it's called `Dynamic Configuration Process (DCP)` Watching the file with `ECM` for modifying events and reloading internal components when those occur based on new `ECM` input, or accepting `ECM` on HTTP endpoint are examples of `DCP`. 30 | 31 | The `Configurable` shall implement either `SCP` or `DCP` or both. `SCP` is recommended for simplicity, explicitness, and lower complexity on `Configurable` side reasons. 32 | In any case, the `Configurable` shall accept the `ECM` based on its `CPD`, decode it based on its `CPD`, and use parsed data to control programmed options. Note that this specification does not force any consumption mechanism as long as there is one. 33 | 34 | Additionally: 35 | 36 | * [`JSON encoding`](https://developers.google.com/protocol-buffers/docs/proto3#json) shall be supported. 37 | * [`protobuf "byte" encoding`](https://developers.google.com/protocol-buffers/docs/encoding) can be supported, but it's recommended to not use it for most of the cases. The reason is that configuration has to be verbose, simple, and explicit. Ideally, the software is configured statically on the start and all its configuration is visible with a quick glance on CLI invocation. See further rationales [here](https://www.bwplotka.dev/2020/flagarize/#flags-ftw). 38 | * `Configurable` should accept empty or partially empty `ECM` by providing safe and minimalistic defaults. 39 | 40 | Overall, `ProtoConfig 1.0` recommends allowing `SCP` rather `SPD`, by accepting `json` based `ECM` through the `--protoconfig.v1` CLI flag. 41 | 42 | ## Why Protocol Buffers? 43 | 44 | > Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. 45 | 46 | On top of incredibly efficient and fast serialization capabilities it also works well [Interface Definition Language](https://en.wikipedia.org/wiki/Interface_description_language) and it is the most used and widely adopted IDL in the industry. For example, protobuf is the definition of language and serialization format for [gRPC](https://grpc.io/). 47 | 48 | The main reasons are that `proto` (version 3) language is **strongly typed, simple, consistent**, but also **backward and forward compatible**. In addition to its stable and fast binary serialization format, it is also easily decoded or encoded into human-readable formats like YAML or JSON. 49 | 50 | Last, but the least there exists a variety of encoders for almost every coding language. You can read more [here](https://developers.google.com/protocol-buffers/docs/cpptutorial). 51 | 52 | If that is not enough, `protobuf` ecosystem is [constantly evolving](https://twitter.com/bwplotka/status/1345076383190556676). 53 | 54 | ## Scope 55 | 56 | Configure software in a way that is: 57 | 58 | * **Discoverable** and **Type-Safe**: *We don't need to guess or read complex documentations to know application configuration format, invariants, and assumptions Configuration is defined by a single, typed [proto](https://developers.google.com/protocol-buffers) package.* 59 | * **Allows Auto Generation**: *We don't need to manually implement application client or data format to encode and similarly data format to parse. All can be safely generated thanks to `protobuf` in almost any programming language, thanks to the wide plugin ecosystem. Additionally, you can generate a full CLI flag paring code or even documentation(!). It also means the smallest, possible impact in the event of application upgrade or modification. Type, Default, or even Help changed can be easily tracked in any language.* 60 | * **Easy to Verify**: *Non-semantic verification and validation (e.g ) do not require executable participation. No need for CLI --dry-run logic, or even invoking anything external. All can be validated from the point of `protobuf`.* https://github.com/envoyproxy/protoc-gen-validate 61 | * **Backward & Forward Compatible**: *Smooth version migrations, thanks to `protobuf` guarantee and safety checkers like [`buf check breaking`](https://docs.buf.build/breaking-usage)* 62 | * **Extensible**: *On top of [**Proto Config Extensions Format 1.0.**](proto/protoconfig/v1/extensions.proto) this specification allows CLI or language-specific extensions (e.g see [`kingpinv2` Go package](go/kingpinv2) and its [extensions](go/kingpinv2/proto/protoconfig/kingpinv2/v1/extensions.proto))* 63 | 64 | ## Not in the scope 65 | 66 | * Runtime APIs, RPCs, and Invocation semantics (e.g error codes, output, input). 67 | * Configuration or Invocation API that will accept (e.g dynamically or statically) for configuration in `ProtoConfig` format. 68 | * Discoverability of `Configuration Proto Definitions` details. 69 | -------------------------------------------------------------------------------- /go/protoc-gen-go-protoconfig/go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 3 | github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= 4 | github.com/alecthomas/units v0.0.0-20201120081800-1786d5ef83d4/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= 5 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 6 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 7 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 8 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 9 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 10 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 11 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 12 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 13 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 14 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 15 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 16 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 17 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 18 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 19 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 20 | github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= 21 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 22 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 23 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 24 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 25 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 26 | github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= 27 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 28 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 29 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 30 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 31 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 32 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 33 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 34 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 35 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 36 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 37 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 38 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 39 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 40 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 41 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 42 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 43 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 44 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 45 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 46 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 47 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 48 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 49 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 50 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 51 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 52 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 53 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 54 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 55 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 56 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= 57 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 58 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 59 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 60 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 61 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 62 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 63 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 64 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 65 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 66 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 67 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 68 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 69 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 70 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 71 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 72 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 73 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 74 | google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= 75 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 76 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 77 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 78 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 79 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 80 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 81 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 82 | -------------------------------------------------------------------------------- /go/go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 3 | github.com/alecthomas/kingpin/v2 v2.3.2 h1:H0aULhgmSzN8xQ3nX1uxtdlTHYoPLu5AhHxWrKI6ocU= 4 | github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= 5 | github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= 6 | github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= 7 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 8 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 9 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 10 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 11 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 12 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 13 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 14 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 15 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 16 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 17 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 18 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 19 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 20 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 21 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 22 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 23 | github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= 24 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 25 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 26 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 27 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 28 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 29 | github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= 30 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 31 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 32 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 33 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 34 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 35 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 36 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 37 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 38 | github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= 39 | github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= 40 | github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= 41 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 42 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 43 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 44 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 45 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 46 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 47 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 48 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 49 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 50 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 51 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 52 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 53 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 54 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 55 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 56 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 57 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 58 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 59 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 60 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 61 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 62 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 63 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 64 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 65 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 66 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 67 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 68 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 69 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 70 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 71 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 72 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 73 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 74 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 75 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 76 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 77 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 78 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 79 | google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= 80 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 81 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 82 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 83 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 84 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 85 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 86 | -------------------------------------------------------------------------------- /go/examples/go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 3 | github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= 4 | github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= 5 | github.com/alecthomas/units v0.0.0-20201120081800-1786d5ef83d4 h1:EBTWhcAX7rNQ80RLwLCpHZBBrJuzallFHnF+yMXo928= 6 | github.com/alecthomas/units v0.0.0-20201120081800-1786d5ef83d4/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= 7 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 8 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 9 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 10 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 11 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 12 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 13 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 14 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 15 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 16 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 17 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 18 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 19 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 20 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 21 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 22 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 23 | github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= 24 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 25 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 26 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 27 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 28 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 29 | github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= 30 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 31 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 32 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 33 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 34 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 35 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 36 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 37 | github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= 38 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 39 | github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= 40 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 41 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 42 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 43 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 44 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 45 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 46 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 47 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 48 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 49 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 50 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 51 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 52 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 53 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 54 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 55 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 56 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 57 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 58 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 59 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 60 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 61 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 62 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 63 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 64 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 65 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 66 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 67 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 68 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 69 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 70 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 71 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 72 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 73 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 74 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 75 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 76 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 77 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 78 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 79 | google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= 80 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 81 | gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= 82 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 83 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 84 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 85 | gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= 86 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 87 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 88 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 89 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 90 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 91 | -------------------------------------------------------------------------------- /go/protoc-gen-go-protoconfig/protoconfig.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | protoconfig "github.com/openproto/protoconfig/go" 5 | "github.com/pkg/errors" 6 | "google.golang.org/protobuf/compiler/protogen" 7 | "google.golang.org/protobuf/proto" 8 | "google.golang.org/protobuf/types/descriptorpb" 9 | ) 10 | 11 | const ( 12 | bytesPackage = protogen.GoImportPath("bytes") 13 | fmtPackage = protogen.GoImportPath("fmt") 14 | ioPackage = protogen.GoImportPath("io") 15 | protoPackage = protogen.GoImportPath("google.golang.org/protobuf/proto") 16 | protojsonPackage = protogen.GoImportPath("google.golang.org/protobuf/encoding/protojson") 17 | openConfigPackage = protogen.GoImportPath("github.com/openproto/protoconfig/go") 18 | ) 19 | 20 | // generateGoProtoConfig generates a _protoconfig.pb.go file containing a code of Congfigurator and Configurable (based on https://github.com/urfave/cli/), based 21 | // ProtoConfig 1.0 specification. 22 | func generateGoProtoConfig(gen *protogen.Plugin, file *protogen.File) error { 23 | var ( 24 | ocEntryPoints []*protoconfig.Metadata 25 | fEntryPoints []*protogen.Message 26 | ) 27 | 28 | for _, f := range file.Messages { 29 | e := proto.GetExtension(f.Desc.Options().(*descriptorpb.MessageOptions), protoconfig.E_Metadata) 30 | c, ok := e.(*protoconfig.Metadata) 31 | if !ok { 32 | return errors.Errorf("unexpected type; got %T expected protoconfig.Configuration", e) 33 | } 34 | // Such extension is not specified. 35 | if c == nil { 36 | continue 37 | } 38 | 39 | ocEntryPoints = append(ocEntryPoints, c) 40 | fEntryPoints = append(fEntryPoints, f) 41 | } 42 | 43 | if len(ocEntryPoints) == 0 { 44 | // Nothing to generate. 45 | return nil 46 | } 47 | 48 | filename := file.GeneratedFilenamePrefix + "_protoconfig.pb.go" 49 | g := gen.NewGeneratedFile(filename, file.GoImportPath) 50 | g.P("// Code generated by protoc-gen-go-protoconfig code. DO NOT EDIT.") 51 | g.P() 52 | g.P("package ", file.GoPackageName) 53 | g.P() 54 | // NOTE: Imports will be added automatically by protogen. 55 | 56 | g.P("// This is a compile-time assertion to ensure that this generated file") 57 | g.P("// is compatible with the ProtoConfig golang package it is being compiled against.") 58 | g.P("const _ = ", openConfigPackage.Ident("SupportPackageIsVersion1")) 59 | g.P() 60 | 61 | // Configure nice helpers for oneofs. Always missing in default protogen-go. 62 | // TODO(bwplotka): Upstream this idea. 63 | dup := map[string]struct{}{} 64 | for _, f := range file.Messages { 65 | generateOneOfHelper(g, f, dup) 66 | } 67 | 68 | for i, c := range ocEntryPoints { 69 | generateConfiguratorSide(g, c, fEntryPoints[i]) 70 | generateConfigurableSide(g, c, fEntryPoints[i]) 71 | } 72 | return nil 73 | } 74 | 75 | func generateOneOfHelper(g *protogen.GeneratedFile, root *protogen.Message, dup map[string]struct{}) { 76 | for _, o := range root.Oneofs { 77 | for _, f := range o.Fields { 78 | helper := "New" + f.Message.GoIdent.GoName 79 | if _, ok := dup[helper]; ok { 80 | continue 81 | } 82 | dup[helper] = struct{}{} 83 | 84 | g.P("func ", helper, "(x *", f.Message.GoIdent, ") *", f.GoIdent, " {") 85 | g.P("return &", f.GoIdent, "{", f.GoName, ": x}") 86 | g.P("}") 87 | g.P() 88 | } 89 | } 90 | for _, m := range root.Messages { 91 | generateOneOfHelper(g, m, dup) 92 | } 93 | } 94 | func generateConfiguratorSide(g *protogen.GeneratedFile, c *protoconfig.Metadata, root *protogen.Message) { 95 | g.P("// Encode encodes self as `Encoded Configuration Message` in proto format so it can be understood and") 96 | g.P("// passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion") 97 | g.P("// (validation, default values etc).") 98 | g.P("// Use `proto.Marshal` encoding without `ProtoConfig 1.0` extension support.") 99 | g.P("func (x *", root.GoIdent.GoName, ") Encode() ([]byte, error) {") 100 | g.P("// TODO(bwplotka): Actually implement validation for `Proto Config Extensions Format 1.0` (: ") 101 | g.P("return ", protoPackage.Ident("Marshal"), "(x)") 102 | g.P("}") 103 | g.P() 104 | // TODO(bwplotka): Ideally get this from interface comment directly? (parse interface code?) 105 | g.P("// EncodeJSON encodes self as `Encoded Configuration Message` in JSON format so it can be understood and") 106 | g.P("// passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion") 107 | g.P("// (validation, default values etc).") 108 | g.P("// Use `protojson.Marshal` encoding without `ProtoConfig 1.0` extension support.") 109 | g.P("func (x *", root.GoIdent.GoName, ") EncodeJSON() ([]byte, error) {") 110 | g.P("// TODO(bwplotka): Actually implement validation for `Proto Config Extensions Format 1.0` (: ") 111 | g.P("return ", protojsonPackage.Ident("Marshal"), "(x)") 112 | g.P("}") 113 | g.P() 114 | g.P("// Metadata returns metadata defined in `Proto Config Extensions Format 1.0`.") 115 | g.P("func (x *", root.GoIdent.GoName, ") Metadata() ", openConfigPackage.Ident("Metadata"), " {") 116 | // TODO(bwplotka): Generate, but not manually, find better way. 117 | g.P("return ", openConfigPackage.Ident("Metadata"), "{") 118 | g.P(`Name: "`, c.Name, `",`) 119 | g.P(`Version: "`, c.Version, `",`) 120 | g.P(`Description: "`, c.Description, `",`) 121 | switch { 122 | case c.GetFlagDelivery() != nil: 123 | g.P(`DeliveryMechanism: &`, openConfigPackage.Ident("Metadata_FlagDelivery"), `{FlagDelivery: &`, openConfigPackage.Ident("FlagDelivery"), `{Name: "`, c.GetFlagDelivery().Name, `"}},`) 124 | case c.GetStdinDelivery() != nil: 125 | g.P(`DeliveryMechanism: &`, openConfigPackage.Ident("Metadata_StdinDelivery"), `{StdinDelivery: &`, openConfigPackage.Ident("StdinDelivery"), `{}},`) 126 | } 127 | g.P("}") 128 | g.P("}") 129 | g.P() 130 | 131 | switch { 132 | case c.GetFlagDelivery() != nil: 133 | g.P("func (x *", root.GoIdent.GoName, ") CommandLineArgument() (string, error) {") 134 | g.P("b, err := x.Encode()") 135 | g.P("if err != nil {") 136 | g.P(`return "", err`) 137 | g.P("}") 138 | g.P(`return `, fmtPackage.Ident("Sprintf"), `("`, c.GetFlagDelivery().Name, `=%s", b), nil`) 139 | g.P("}") 140 | g.P() 141 | case c.GetStdinDelivery() != nil: 142 | g.P("func (x *", root.GoIdent.GoName, ") CommandLineInput() (*", ioPackage.Ident("Reader"), ", error) {") 143 | g.P("b, err := x.Encode()") 144 | g.P("if err != nil {") 145 | g.P("return nil, err") 146 | g.P("}") 147 | g.P("return ", bytesPackage.Ident("NewReader"), "(b), nil") 148 | g.P("}") 149 | g.P() 150 | } 151 | 152 | g.P("// This is a compile-time assertion to ensure that extended ", root.GoIdent, " implements") 153 | g.P("// ", openConfigPackage.Ident("Configurator"), " interface.") 154 | g.P("var _ ", openConfigPackage.Ident("Configurator"), " = &", root.GoIdent.GoName, "{}") 155 | g.P() 156 | 157 | } 158 | 159 | // While it's not mandatory, ProtoConfig 1.0 generates stub for defining Go CLI application that user might or might not use. 160 | // In order to use it external CLI builder is necessary. For example kingpin.v2 implementation see github.com/openproto/protoconfig/go/kingpinv2. 161 | // 162 | // Such app will be compatible with defined configuration and will output such filled typed after parsing. 163 | func generateConfigurableSide(g *protogen.GeneratedFile, _ *protoconfig.Metadata, root *protogen.Message) { 164 | g.P("// Decode parses byte slice as `Encoded Configuration Message` in JSON or proto format and unmarshal it on") 165 | g.P("// the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion") 166 | g.P("// (validation, default values etc).") 167 | g.P("// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support.") 168 | g.P("func (x *", root.GoIdent.GoName, ") Decode(ecm []byte) error {") 169 | g.P("// TODO(bwplotka): Actually implement validation for `Proto Config Extensions Format 1.0` (: ") 170 | g.P("if isJSON(ecm) { return ", protojsonPackage.Ident("Unmarshal"), "(ecm, x) }") 171 | g.P("return ", protoPackage.Ident("Unmarshal"), "(ecm, x)") 172 | g.P("}") 173 | g.P() 174 | g.P("// DecodeString parses string as `Encoded Configuration Message` in JSON or proto format and unmarshal it on") 175 | g.P("// the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion") 176 | g.P("// (validation, default values etc).") 177 | g.P("// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support.") 178 | g.P("func (x *", root.GoIdent.GoName, ") DecodeString(ecm string) error {") 179 | g.P("return x.Decode([]byte(ecm))") 180 | g.P("}") 181 | g.P() 182 | g.P("func isJSON(b []byte) bool {") 183 | g.P("bb := ", bytesPackage.Ident("TrimSpace"), "(b)") 184 | g.P("if len(bb) == 0 { return false }") 185 | // TODO(bwplotka): Yolo. Improve. 186 | g.P("return bb[0] == '{'") 187 | g.P("}") 188 | g.P() 189 | g.P("// This is a compile-time assertion to ensure that extended ", root.GoIdent, " implements") 190 | g.P("// ", openConfigPackage.Ident("Configurable"), " interface.") 191 | g.P("var _ ", openConfigPackage.Ident("Configurable"), " = &", root.GoIdent.GoName, "{}") 192 | g.P() 193 | 194 | // TODO(bwplotka): There are useful cli.App features that users might want to add on its program. Create generic CLI parser. 195 | // All except changing commands and flags should be accepted as option. 196 | } 197 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /go/extensions.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.25.0 4 | // protoc v3.13.0 5 | // source: protoconfig/v1/extensions.proto 6 | 7 | // Proto Config Extensions Format 1.0. 8 | // 9 | // This defines extensions to protocol-buffer-compatible language that is build on proto version 3 with protobuf custom options. 10 | // 11 | // ProtoConfig Extensions allows software authors to define metadata about required configuration like default values or field 12 | // optionality etc. 13 | // 14 | // Extension can be used as natively described in https://developers.google.com/protocol-buffers/docs/proto#customoptions 15 | // 16 | // Below extensions are not mandatory to use while defining your configuration, but mandatory to be implemented by 17 | // ProtoConfig 1.0 compatible parsers and generators. 18 | 19 | package protoconfig 20 | 21 | import ( 22 | proto "github.com/golang/protobuf/proto" 23 | descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" 24 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 25 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 26 | reflect "reflect" 27 | sync "sync" 28 | ) 29 | 30 | const ( 31 | // Verify that this generated code is sufficiently up-to-date. 32 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 33 | // Verify that runtime/protoimpl is sufficiently up-to-date. 34 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 35 | ) 36 | 37 | // This is a compile-time assertion that a sufficiently up-to-date version 38 | // of the legacy proto package is being used. 39 | const _ = proto.ProtoPackageIsVersion4 40 | 41 | // / Metadata is an Message option that when put on message indicates an entry point for certain configuration. 42 | // / One `Configuration Proto Definition` can have many structs marked as this option. 43 | // / TODO(bwplotka): Make it non pointers (in Go). 44 | type Metadata struct { 45 | state protoimpl.MessageState 46 | sizeCache protoimpl.SizeCache 47 | unknownFields protoimpl.UnknownFields 48 | 49 | /// name represents name of annotated configuration entry point. 50 | /// It's recommended to use executable name here. 51 | Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` 52 | /// version is the semantic version of the annotated configuration. 53 | Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` 54 | Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` 55 | /// delivery_mechanism optionally specifies the delivery that is implemented by configurable that consumes this 56 | /// configuration. This allows `Configurator` to discover how to pass the `Encoded Configuration Message` 57 | /// without extra information outside of definition. 58 | // TODO(bwplotka): This might be blocking reusability. Rethink? 59 | // 60 | // Types that are assignable to DeliveryMechanism: 61 | // *Metadata_StdinDelivery 62 | // *Metadata_FlagDelivery 63 | DeliveryMechanism isMetadata_DeliveryMechanism `protobuf_oneof:"delivery_mechanism"` 64 | } 65 | 66 | func (x *Metadata) Reset() { 67 | *x = Metadata{} 68 | if protoimpl.UnsafeEnabled { 69 | mi := &file_protoconfig_v1_extensions_proto_msgTypes[0] 70 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 71 | ms.StoreMessageInfo(mi) 72 | } 73 | } 74 | 75 | func (x *Metadata) String() string { 76 | return protoimpl.X.MessageStringOf(x) 77 | } 78 | 79 | func (*Metadata) ProtoMessage() {} 80 | 81 | func (x *Metadata) ProtoReflect() protoreflect.Message { 82 | mi := &file_protoconfig_v1_extensions_proto_msgTypes[0] 83 | if protoimpl.UnsafeEnabled && x != nil { 84 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 85 | if ms.LoadMessageInfo() == nil { 86 | ms.StoreMessageInfo(mi) 87 | } 88 | return ms 89 | } 90 | return mi.MessageOf(x) 91 | } 92 | 93 | // Deprecated: Use Metadata.ProtoReflect.Descriptor instead. 94 | func (*Metadata) Descriptor() ([]byte, []int) { 95 | return file_protoconfig_v1_extensions_proto_rawDescGZIP(), []int{0} 96 | } 97 | 98 | func (x *Metadata) GetName() string { 99 | if x != nil { 100 | return x.Name 101 | } 102 | return "" 103 | } 104 | 105 | func (x *Metadata) GetVersion() string { 106 | if x != nil { 107 | return x.Version 108 | } 109 | return "" 110 | } 111 | 112 | func (x *Metadata) GetDescription() string { 113 | if x != nil { 114 | return x.Description 115 | } 116 | return "" 117 | } 118 | 119 | func (m *Metadata) GetDeliveryMechanism() isMetadata_DeliveryMechanism { 120 | if m != nil { 121 | return m.DeliveryMechanism 122 | } 123 | return nil 124 | } 125 | 126 | func (x *Metadata) GetStdinDelivery() *StdinDelivery { 127 | if x, ok := x.GetDeliveryMechanism().(*Metadata_StdinDelivery); ok { 128 | return x.StdinDelivery 129 | } 130 | return nil 131 | } 132 | 133 | func (x *Metadata) GetFlagDelivery() *FlagDelivery { 134 | if x, ok := x.GetDeliveryMechanism().(*Metadata_FlagDelivery); ok { 135 | return x.FlagDelivery 136 | } 137 | return nil 138 | } 139 | 140 | type isMetadata_DeliveryMechanism interface { 141 | isMetadata_DeliveryMechanism() 142 | } 143 | 144 | type Metadata_StdinDelivery struct { 145 | StdinDelivery *StdinDelivery `protobuf:"bytes,101,opt,name=stdin_delivery,json=stdinDelivery,proto3,oneof"` 146 | } 147 | 148 | type Metadata_FlagDelivery struct { 149 | FlagDelivery *FlagDelivery `protobuf:"bytes,102,opt,name=flag_delivery,json=flagDelivery,proto3,oneof"` 150 | } 151 | 152 | func (*Metadata_StdinDelivery) isMetadata_DeliveryMechanism() {} 153 | 154 | func (*Metadata_FlagDelivery) isMetadata_DeliveryMechanism() {} 155 | 156 | type StdinDelivery struct { 157 | state protoimpl.MessageState 158 | sizeCache protoimpl.SizeCache 159 | unknownFields protoimpl.UnknownFields 160 | } 161 | 162 | func (x *StdinDelivery) Reset() { 163 | *x = StdinDelivery{} 164 | if protoimpl.UnsafeEnabled { 165 | mi := &file_protoconfig_v1_extensions_proto_msgTypes[1] 166 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 167 | ms.StoreMessageInfo(mi) 168 | } 169 | } 170 | 171 | func (x *StdinDelivery) String() string { 172 | return protoimpl.X.MessageStringOf(x) 173 | } 174 | 175 | func (*StdinDelivery) ProtoMessage() {} 176 | 177 | func (x *StdinDelivery) ProtoReflect() protoreflect.Message { 178 | mi := &file_protoconfig_v1_extensions_proto_msgTypes[1] 179 | if protoimpl.UnsafeEnabled && x != nil { 180 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 181 | if ms.LoadMessageInfo() == nil { 182 | ms.StoreMessageInfo(mi) 183 | } 184 | return ms 185 | } 186 | return mi.MessageOf(x) 187 | } 188 | 189 | // Deprecated: Use StdinDelivery.ProtoReflect.Descriptor instead. 190 | func (*StdinDelivery) Descriptor() ([]byte, []int) { 191 | return file_protoconfig_v1_extensions_proto_rawDescGZIP(), []int{1} 192 | } 193 | 194 | type FlagDelivery struct { 195 | state protoimpl.MessageState 196 | sizeCache protoimpl.SizeCache 197 | unknownFields protoimpl.UnknownFields 198 | 199 | /// name represents custom flag name (including `-` if any) for a flag that consumes bytes of `Encoded Configuration Message` 200 | // ProtoConfig 1.0 recommends `--protoconfigv1` name. 201 | Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` 202 | } 203 | 204 | func (x *FlagDelivery) Reset() { 205 | *x = FlagDelivery{} 206 | if protoimpl.UnsafeEnabled { 207 | mi := &file_protoconfig_v1_extensions_proto_msgTypes[2] 208 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 209 | ms.StoreMessageInfo(mi) 210 | } 211 | } 212 | 213 | func (x *FlagDelivery) String() string { 214 | return protoimpl.X.MessageStringOf(x) 215 | } 216 | 217 | func (*FlagDelivery) ProtoMessage() {} 218 | 219 | func (x *FlagDelivery) ProtoReflect() protoreflect.Message { 220 | mi := &file_protoconfig_v1_extensions_proto_msgTypes[2] 221 | if protoimpl.UnsafeEnabled && x != nil { 222 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 223 | if ms.LoadMessageInfo() == nil { 224 | ms.StoreMessageInfo(mi) 225 | } 226 | return ms 227 | } 228 | return mi.MessageOf(x) 229 | } 230 | 231 | // Deprecated: Use FlagDelivery.ProtoReflect.Descriptor instead. 232 | func (*FlagDelivery) Descriptor() ([]byte, []int) { 233 | return file_protoconfig_v1_extensions_proto_rawDescGZIP(), []int{2} 234 | } 235 | 236 | func (x *FlagDelivery) GetName() string { 237 | if x != nil { 238 | return x.Name 239 | } 240 | return "" 241 | } 242 | 243 | var file_protoconfig_v1_extensions_proto_extTypes = []protoimpl.ExtensionInfo{ 244 | { 245 | ExtendedType: (*descriptor.MessageOptions)(nil), 246 | ExtensionType: (*Metadata)(nil), 247 | Field: 5000, 248 | Name: "protoconfig.v1.metadata", 249 | Tag: "bytes,5000,opt,name=metadata", 250 | Filename: "protoconfig/v1/extensions.proto", 251 | }, 252 | { 253 | ExtendedType: (*descriptor.FieldOptions)(nil), 254 | ExtensionType: (*string)(nil), 255 | Field: 5000, 256 | Name: "protoconfig.v1.default", 257 | Tag: "bytes,5000,opt,name=default", 258 | Filename: "protoconfig/v1/extensions.proto", 259 | }, 260 | { 261 | ExtendedType: (*descriptor.FieldOptions)(nil), 262 | ExtensionType: (*bool)(nil), 263 | Field: 5001, 264 | Name: "protoconfig.v1.hidden", 265 | Tag: "varint,5001,opt,name=hidden", 266 | Filename: "protoconfig/v1/extensions.proto", 267 | }, 268 | { 269 | ExtendedType: (*descriptor.FieldOptions)(nil), 270 | ExtensionType: (*bool)(nil), 271 | Field: 5002, 272 | Name: "protoconfig.v1.required", 273 | Tag: "varint,5002,opt,name=required", 274 | Filename: "protoconfig/v1/extensions.proto", 275 | }, 276 | { 277 | ExtendedType: (*descriptor.FieldOptions)(nil), 278 | ExtensionType: (*bool)(nil), 279 | Field: 5003, 280 | Name: "protoconfig.v1.experimental", 281 | Tag: "varint,5003,opt,name=experimental", 282 | Filename: "protoconfig/v1/extensions.proto", 283 | }, 284 | } 285 | 286 | // Extension fields to descriptor.MessageOptions. 287 | var ( 288 | /// metadata represents 289 | // 290 | // optional protoconfig.v1.Metadata metadata = 5000; 291 | E_Metadata = &file_protoconfig_v1_extensions_proto_extTypes[0] 292 | ) 293 | 294 | // Extension fields to descriptor.FieldOptions. 295 | var ( 296 | /// default represents an option that sets a default value for the field. 297 | // 298 | // optional string default = 5000; 299 | E_Default = &file_protoconfig_v1_extensions_proto_extTypes[1] 300 | /// hidden represents an option that marks a field as hidden. What it actually causes is up to the Configurable. 301 | /// ProtoConfig 1.0 recommends hiding it from the documentation. 302 | // 303 | // optional bool hidden = 5001; 304 | E_Hidden = &file_protoconfig_v1_extensions_proto_extTypes[2] 305 | /// required represents an option that marks a field as mandatory and if empty, Configurable does not accept the whole configuration. 306 | // 307 | // optional bool required = 5002; 308 | E_Required = &file_protoconfig_v1_extensions_proto_extTypes[3] 309 | /// experimental represents an option that marks a field as experimental. What it actually causes is up to the Configurable. 310 | /// ProtoConfig 1.0 recommends warning in the documentation. 311 | // 312 | // optional bool experimental = 5003; 313 | E_Experimental = &file_protoconfig_v1_extensions_proto_extTypes[4] 314 | ) 315 | 316 | var File_protoconfig_v1_extensions_proto protoreflect.FileDescriptor 317 | 318 | var file_protoconfig_v1_extensions_proto_rawDesc = []byte{ 319 | 0x0a, 0x1f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, 320 | 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 321 | 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 322 | 0x31, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 323 | 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 324 | 0x6f, 0x74, 0x6f, 0x22, 0xfd, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 325 | 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 326 | 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 327 | 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 328 | 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 329 | 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 330 | 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 331 | 0x72, 0x79, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 332 | 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x44, 333 | 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x74, 0x64, 0x69, 0x6e, 334 | 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x43, 0x0a, 0x0d, 0x66, 0x6c, 0x61, 0x67, 335 | 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 336 | 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 337 | 0x2e, 0x46, 0x6c, 0x61, 0x67, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 338 | 0x0c, 0x66, 0x6c, 0x61, 0x67, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x42, 0x14, 0x0a, 339 | 0x12, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x63, 0x68, 0x61, 0x6e, 340 | 0x69, 0x73, 0x6d, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x69, 341 | 0x76, 0x65, 0x72, 0x79, 0x22, 0x22, 0x0a, 0x0c, 0x46, 0x6c, 0x61, 0x67, 0x44, 0x65, 0x6c, 0x69, 342 | 0x76, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 343 | 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x56, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 344 | 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 345 | 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 346 | 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x27, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 347 | 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 348 | 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 349 | 0x3a, 0x38, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 350 | 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 351 | 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x27, 0x20, 0x01, 0x28, 352 | 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x3a, 0x36, 0x0a, 0x06, 0x68, 0x69, 353 | 0x64, 0x64, 0x65, 0x6e, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 354 | 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 355 | 0x6f, 0x6e, 0x73, 0x18, 0x89, 0x27, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x69, 0x64, 0x64, 356 | 0x65, 0x6e, 0x3a, 0x3a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x1d, 357 | 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 358 | 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x8a, 0x27, 359 | 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x3a, 0x42, 360 | 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x12, 0x1d, 361 | 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 362 | 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x8b, 0x27, 363 | 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 364 | 0x61, 0x6c, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 365 | 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 366 | 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 367 | 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 368 | } 369 | 370 | var ( 371 | file_protoconfig_v1_extensions_proto_rawDescOnce sync.Once 372 | file_protoconfig_v1_extensions_proto_rawDescData = file_protoconfig_v1_extensions_proto_rawDesc 373 | ) 374 | 375 | func file_protoconfig_v1_extensions_proto_rawDescGZIP() []byte { 376 | file_protoconfig_v1_extensions_proto_rawDescOnce.Do(func() { 377 | file_protoconfig_v1_extensions_proto_rawDescData = protoimpl.X.CompressGZIP(file_protoconfig_v1_extensions_proto_rawDescData) 378 | }) 379 | return file_protoconfig_v1_extensions_proto_rawDescData 380 | } 381 | 382 | var file_protoconfig_v1_extensions_proto_msgTypes = make([]protoimpl.MessageInfo, 3) 383 | var file_protoconfig_v1_extensions_proto_goTypes = []interface{}{ 384 | (*Metadata)(nil), // 0: protoconfig.v1.Metadata 385 | (*StdinDelivery)(nil), // 1: protoconfig.v1.StdinDelivery 386 | (*FlagDelivery)(nil), // 2: protoconfig.v1.FlagDelivery 387 | (*descriptor.MessageOptions)(nil), // 3: google.protobuf.MessageOptions 388 | (*descriptor.FieldOptions)(nil), // 4: google.protobuf.FieldOptions 389 | } 390 | var file_protoconfig_v1_extensions_proto_depIdxs = []int32{ 391 | 1, // 0: protoconfig.v1.Metadata.stdin_delivery:type_name -> protoconfig.v1.StdinDelivery 392 | 2, // 1: protoconfig.v1.Metadata.flag_delivery:type_name -> protoconfig.v1.FlagDelivery 393 | 3, // 2: protoconfig.v1.metadata:extendee -> google.protobuf.MessageOptions 394 | 4, // 3: protoconfig.v1.default:extendee -> google.protobuf.FieldOptions 395 | 4, // 4: protoconfig.v1.hidden:extendee -> google.protobuf.FieldOptions 396 | 4, // 5: protoconfig.v1.required:extendee -> google.protobuf.FieldOptions 397 | 4, // 6: protoconfig.v1.experimental:extendee -> google.protobuf.FieldOptions 398 | 0, // 7: protoconfig.v1.metadata:type_name -> protoconfig.v1.Metadata 399 | 8, // [8:8] is the sub-list for method output_type 400 | 8, // [8:8] is the sub-list for method input_type 401 | 7, // [7:8] is the sub-list for extension type_name 402 | 2, // [2:7] is the sub-list for extension extendee 403 | 0, // [0:2] is the sub-list for field type_name 404 | } 405 | 406 | func init() { file_protoconfig_v1_extensions_proto_init() } 407 | func file_protoconfig_v1_extensions_proto_init() { 408 | if File_protoconfig_v1_extensions_proto != nil { 409 | return 410 | } 411 | if !protoimpl.UnsafeEnabled { 412 | file_protoconfig_v1_extensions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { 413 | switch v := v.(*Metadata); i { 414 | case 0: 415 | return &v.state 416 | case 1: 417 | return &v.sizeCache 418 | case 2: 419 | return &v.unknownFields 420 | default: 421 | return nil 422 | } 423 | } 424 | file_protoconfig_v1_extensions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { 425 | switch v := v.(*StdinDelivery); i { 426 | case 0: 427 | return &v.state 428 | case 1: 429 | return &v.sizeCache 430 | case 2: 431 | return &v.unknownFields 432 | default: 433 | return nil 434 | } 435 | } 436 | file_protoconfig_v1_extensions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { 437 | switch v := v.(*FlagDelivery); i { 438 | case 0: 439 | return &v.state 440 | case 1: 441 | return &v.sizeCache 442 | case 2: 443 | return &v.unknownFields 444 | default: 445 | return nil 446 | } 447 | } 448 | } 449 | file_protoconfig_v1_extensions_proto_msgTypes[0].OneofWrappers = []interface{}{ 450 | (*Metadata_StdinDelivery)(nil), 451 | (*Metadata_FlagDelivery)(nil), 452 | } 453 | type x struct{} 454 | out := protoimpl.TypeBuilder{ 455 | File: protoimpl.DescBuilder{ 456 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 457 | RawDescriptor: file_protoconfig_v1_extensions_proto_rawDesc, 458 | NumEnums: 0, 459 | NumMessages: 3, 460 | NumExtensions: 5, 461 | NumServices: 0, 462 | }, 463 | GoTypes: file_protoconfig_v1_extensions_proto_goTypes, 464 | DependencyIndexes: file_protoconfig_v1_extensions_proto_depIdxs, 465 | MessageInfos: file_protoconfig_v1_extensions_proto_msgTypes, 466 | ExtensionInfos: file_protoconfig_v1_extensions_proto_extTypes, 467 | }.Build() 468 | File_protoconfig_v1_extensions_proto = out.File 469 | file_protoconfig_v1_extensions_proto_rawDesc = nil 470 | file_protoconfig_v1_extensions_proto_goTypes = nil 471 | file_protoconfig_v1_extensions_proto_depIdxs = nil 472 | } 473 | -------------------------------------------------------------------------------- /go/kingpinv2/extensions.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.25.0 4 | // protoc v3.13.0 5 | // source: protoconfig/go/kingpinv2/v1/extensions.proto 6 | 7 | // Extensions based on https://pkg.go.dev/github.com/alecthomas/kingpin/v2 8 | 9 | package kingpinv2 10 | 11 | import ( 12 | proto "github.com/golang/protobuf/proto" 13 | descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" 14 | any "github.com/golang/protobuf/ptypes/any" 15 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 16 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 17 | reflect "reflect" 18 | sync "sync" 19 | ) 20 | 21 | const ( 22 | // Verify that this generated code is sufficiently up-to-date. 23 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 24 | // Verify that runtime/protoimpl is sufficiently up-to-date. 25 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 26 | ) 27 | 28 | // This is a compile-time assertion that a sufficiently up-to-date version 29 | // of the legacy proto package is being used. 30 | const _ = proto.ProtoPackageIsVersion4 31 | 32 | // Content is byte steam created from PathOrContent flag, a custom extension built on top of kingpin.v2 flags type. 33 | type Content struct { 34 | state protoimpl.MessageState 35 | sizeCache protoimpl.SizeCache 36 | unknownFields protoimpl.UnknownFields 37 | 38 | Content *any.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` // any proto.Message 39 | } 40 | 41 | func (x *Content) Reset() { 42 | *x = Content{} 43 | if protoimpl.UnsafeEnabled { 44 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[0] 45 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 46 | ms.StoreMessageInfo(mi) 47 | } 48 | } 49 | 50 | func (x *Content) String() string { 51 | return protoimpl.X.MessageStringOf(x) 52 | } 53 | 54 | func (*Content) ProtoMessage() {} 55 | 56 | func (x *Content) ProtoReflect() protoreflect.Message { 57 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[0] 58 | if protoimpl.UnsafeEnabled && x != nil { 59 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 60 | if ms.LoadMessageInfo() == nil { 61 | ms.StoreMessageInfo(mi) 62 | } 63 | return ms 64 | } 65 | return mi.MessageOf(x) 66 | } 67 | 68 | // Deprecated: Use Content.ProtoReflect.Descriptor instead. 69 | func (*Content) Descriptor() ([]byte, []int) { 70 | return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{0} 71 | } 72 | 73 | func (x *Content) GetContent() *any.Any { 74 | if x != nil { 75 | return x.Content 76 | } 77 | return nil 78 | } 79 | 80 | // ExistingFile represents https://pkg.go.dev/github.com/alecthomas/kingpin/v2#ArgClause.ExistingFile. 81 | // repeated ExistingFile represents https://pkg.go.dev/github.com/alecthomas/kingpin/v2#ArgClause.ExistingFiles. 82 | type ExistingFile struct { 83 | state protoimpl.MessageState 84 | sizeCache protoimpl.SizeCache 85 | unknownFields protoimpl.UnknownFields 86 | 87 | File *any.Any `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"` // *os.File 88 | } 89 | 90 | func (x *ExistingFile) Reset() { 91 | *x = ExistingFile{} 92 | if protoimpl.UnsafeEnabled { 93 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[1] 94 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 95 | ms.StoreMessageInfo(mi) 96 | } 97 | } 98 | 99 | func (x *ExistingFile) String() string { 100 | return protoimpl.X.MessageStringOf(x) 101 | } 102 | 103 | func (*ExistingFile) ProtoMessage() {} 104 | 105 | func (x *ExistingFile) ProtoReflect() protoreflect.Message { 106 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[1] 107 | if protoimpl.UnsafeEnabled && x != nil { 108 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 109 | if ms.LoadMessageInfo() == nil { 110 | ms.StoreMessageInfo(mi) 111 | } 112 | return ms 113 | } 114 | return mi.MessageOf(x) 115 | } 116 | 117 | // Deprecated: Use ExistingFile.ProtoReflect.Descriptor instead. 118 | func (*ExistingFile) Descriptor() ([]byte, []int) { 119 | return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{1} 120 | } 121 | 122 | func (x *ExistingFile) GetFile() *any.Any { 123 | if x != nil { 124 | return x.File 125 | } 126 | return nil 127 | } 128 | 129 | // IP represents https://pkg.go.dev/github.com/alecthomas/kingpin/v2#ArgClause.IP. 130 | // repeated IP represents https://pkg.go.dev/github.com/alecthomas/kingpin/v2#ArgClause.IPList. 131 | type IP struct { 132 | state protoimpl.MessageState 133 | sizeCache protoimpl.SizeCache 134 | unknownFields protoimpl.UnknownFields 135 | 136 | Ip *any.Any `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` // *net.IP 137 | } 138 | 139 | func (x *IP) Reset() { 140 | *x = IP{} 141 | if protoimpl.UnsafeEnabled { 142 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[2] 143 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 144 | ms.StoreMessageInfo(mi) 145 | } 146 | } 147 | 148 | func (x *IP) String() string { 149 | return protoimpl.X.MessageStringOf(x) 150 | } 151 | 152 | func (*IP) ProtoMessage() {} 153 | 154 | func (x *IP) ProtoReflect() protoreflect.Message { 155 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[2] 156 | if protoimpl.UnsafeEnabled && x != nil { 157 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 158 | if ms.LoadMessageInfo() == nil { 159 | ms.StoreMessageInfo(mi) 160 | } 161 | return ms 162 | } 163 | return mi.MessageOf(x) 164 | } 165 | 166 | // Deprecated: Use IP.ProtoReflect.Descriptor instead. 167 | func (*IP) Descriptor() ([]byte, []int) { 168 | return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{2} 169 | } 170 | 171 | func (x *IP) GetIp() *any.Any { 172 | if x != nil { 173 | return x.Ip 174 | } 175 | return nil 176 | } 177 | 178 | // Regexp represents https://pkg.go.dev/github.com/alecthomas/kingpin/v2#ArgClause.Regexp. 179 | // repeated Regexp represents https://pkg.go.dev/github.com/alecthomas/kingpin/v2#ArgClause.RegexpList. 180 | type Regexp struct { 181 | state protoimpl.MessageState 182 | sizeCache protoimpl.SizeCache 183 | unknownFields protoimpl.UnknownFields 184 | 185 | Regexp *any.Any `protobuf:"bytes,1,opt,name=regexp,proto3" json:"regexp,omitempty"` // **regexp.Regexp 186 | } 187 | 188 | func (x *Regexp) Reset() { 189 | *x = Regexp{} 190 | if protoimpl.UnsafeEnabled { 191 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[3] 192 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 193 | ms.StoreMessageInfo(mi) 194 | } 195 | } 196 | 197 | func (x *Regexp) String() string { 198 | return protoimpl.X.MessageStringOf(x) 199 | } 200 | 201 | func (*Regexp) ProtoMessage() {} 202 | 203 | func (x *Regexp) ProtoReflect() protoreflect.Message { 204 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[3] 205 | if protoimpl.UnsafeEnabled && x != nil { 206 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 207 | if ms.LoadMessageInfo() == nil { 208 | ms.StoreMessageInfo(mi) 209 | } 210 | return ms 211 | } 212 | return mi.MessageOf(x) 213 | } 214 | 215 | // Deprecated: Use Regexp.ProtoReflect.Descriptor instead. 216 | func (*Regexp) Descriptor() ([]byte, []int) { 217 | return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{3} 218 | } 219 | 220 | func (x *Regexp) GetRegexp() *any.Any { 221 | if x != nil { 222 | return x.Regexp 223 | } 224 | return nil 225 | } 226 | 227 | type Command struct { 228 | state protoimpl.MessageState 229 | sizeCache protoimpl.SizeCache 230 | unknownFields protoimpl.UnknownFields 231 | 232 | Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` 233 | } 234 | 235 | func (x *Command) Reset() { 236 | *x = Command{} 237 | if protoimpl.UnsafeEnabled { 238 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[4] 239 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 240 | ms.StoreMessageInfo(mi) 241 | } 242 | } 243 | 244 | func (x *Command) String() string { 245 | return protoimpl.X.MessageStringOf(x) 246 | } 247 | 248 | func (*Command) ProtoMessage() {} 249 | 250 | func (x *Command) ProtoReflect() protoreflect.Message { 251 | mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[4] 252 | if protoimpl.UnsafeEnabled && x != nil { 253 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 254 | if ms.LoadMessageInfo() == nil { 255 | ms.StoreMessageInfo(mi) 256 | } 257 | return ms 258 | } 259 | return mi.MessageOf(x) 260 | } 261 | 262 | // Deprecated: Use Command.ProtoReflect.Descriptor instead. 263 | func (*Command) Descriptor() ([]byte, []int) { 264 | return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{4} 265 | } 266 | 267 | func (x *Command) GetName() string { 268 | if x != nil { 269 | return x.Name 270 | } 271 | return "" 272 | } 273 | 274 | var file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes = []protoimpl.ExtensionInfo{ 275 | { 276 | ExtendedType: (*descriptor.FieldOptions)(nil), 277 | ExtensionType: (*string)(nil), 278 | Field: 6000, 279 | Name: "protoconfig.go.kingpinv2.v1.placeholder", 280 | Tag: "bytes,6000,opt,name=placeholder", 281 | Filename: "protoconfig/go/kingpinv2/v1/extensions.proto", 282 | }, 283 | { 284 | ExtendedType: (*descriptor.FieldOptions)(nil), 285 | ExtensionType: (*string)(nil), 286 | Field: 6001, 287 | Name: "protoconfig.go.kingpinv2.v1.envvar", 288 | Tag: "bytes,6001,opt,name=envvar", 289 | Filename: "protoconfig/go/kingpinv2/v1/extensions.proto", 290 | }, 291 | { 292 | ExtendedType: (*descriptor.FieldOptions)(nil), 293 | ExtensionType: (*bool)(nil), 294 | Field: 6002, 295 | Name: "protoconfig.go.kingpinv2.v1.argument", 296 | Tag: "varint,6002,opt,name=argument", 297 | Filename: "protoconfig/go/kingpinv2/v1/extensions.proto", 298 | }, 299 | { 300 | ExtendedType: (*descriptor.MessageOptions)(nil), 301 | ExtensionType: (*Command)(nil), 302 | Field: 6002, 303 | Name: "protoconfig.go.kingpinv2.v1.command", 304 | Tag: "bytes,6002,opt,name=command", 305 | Filename: "protoconfig/go/kingpinv2/v1/extensions.proto", 306 | }, 307 | } 308 | 309 | // Extension fields to descriptor.FieldOptions. 310 | var ( 311 | // optional string placeholder = 6000; 312 | E_Placeholder = &file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes[0] 313 | // optional string envvar = 6001; 314 | E_Envvar = &file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes[1] 315 | // By default field represents a flag. 316 | // 317 | // optional bool argument = 6002; 318 | E_Argument = &file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes[2] 319 | ) 320 | 321 | // Extension fields to descriptor.MessageOptions. 322 | var ( 323 | // By default message represents just complex configuration type. If command_name is specified 324 | // such message becomes a kingpin.v2 command. 325 | // Name has to be unique within single protoconfig.Configuration type. 326 | // 327 | // optional protoconfig.go.kingpinv2.v1.Command command = 6002; 328 | E_Command = &file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes[3] 329 | ) 330 | 331 | var File_protoconfig_go_kingpinv2_v1_extensions_proto protoreflect.FileDescriptor 332 | 333 | var file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDesc = []byte{ 334 | 0x0a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 335 | 0x2f, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 336 | 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 337 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x67, 0x6f, 0x2e, 0x6b, 338 | 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 339 | 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 340 | 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 341 | 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 342 | 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 343 | 0x65, 0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 344 | 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 345 | 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 346 | 0x65, 0x6e, 0x74, 0x22, 0x38, 0x0a, 0x0c, 0x45, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x46, 347 | 0x69, 0x6c, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 348 | 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 349 | 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x2a, 0x0a, 350 | 0x02, 0x49, 0x50, 0x12, 0x24, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 351 | 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 352 | 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x02, 0x69, 0x70, 0x22, 0x36, 0x0a, 0x06, 0x52, 0x65, 0x67, 353 | 0x65, 0x78, 0x70, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 354 | 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 355 | 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 356 | 0x70, 0x22, 0x1d, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 357 | 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 358 | 0x3a, 0x40, 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 359 | 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 360 | 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf0, 361 | 0x2e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 362 | 0x65, 0x72, 0x3a, 0x36, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x76, 0x61, 0x72, 0x12, 0x1d, 0x2e, 0x67, 363 | 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 364 | 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf1, 0x2e, 0x20, 0x01, 365 | 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x76, 0x76, 0x61, 0x72, 0x3a, 0x3a, 0x0a, 0x08, 0x61, 0x72, 366 | 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 367 | 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 368 | 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf2, 0x2e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x72, 369 | 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x3a, 0x60, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 370 | 0x64, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 371 | 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 372 | 0x6e, 0x73, 0x18, 0xf2, 0x2e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 373 | 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x67, 0x6f, 0x2e, 0x6b, 0x69, 0x6e, 0x67, 0x70, 374 | 0x69, 0x6e, 0x76, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 375 | 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 376 | 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 377 | 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 0x2f, 378 | 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x3b, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 379 | 0x6e, 0x76, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 380 | } 381 | 382 | var ( 383 | file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescOnce sync.Once 384 | file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescData = file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDesc 385 | ) 386 | 387 | func file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP() []byte { 388 | file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescOnce.Do(func() { 389 | file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescData = protoimpl.X.CompressGZIP(file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescData) 390 | }) 391 | return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescData 392 | } 393 | 394 | var file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes = make([]protoimpl.MessageInfo, 5) 395 | var file_protoconfig_go_kingpinv2_v1_extensions_proto_goTypes = []interface{}{ 396 | (*Content)(nil), // 0: protoconfig.go.kingpinv2.v1.Content 397 | (*ExistingFile)(nil), // 1: protoconfig.go.kingpinv2.v1.ExistingFile 398 | (*IP)(nil), // 2: protoconfig.go.kingpinv2.v1.IP 399 | (*Regexp)(nil), // 3: protoconfig.go.kingpinv2.v1.Regexp 400 | (*Command)(nil), // 4: protoconfig.go.kingpinv2.v1.Command 401 | (*any.Any)(nil), // 5: google.protobuf.Any 402 | (*descriptor.FieldOptions)(nil), // 6: google.protobuf.FieldOptions 403 | (*descriptor.MessageOptions)(nil), // 7: google.protobuf.MessageOptions 404 | } 405 | var file_protoconfig_go_kingpinv2_v1_extensions_proto_depIdxs = []int32{ 406 | 5, // 0: protoconfig.go.kingpinv2.v1.Content.content:type_name -> google.protobuf.Any 407 | 5, // 1: protoconfig.go.kingpinv2.v1.ExistingFile.file:type_name -> google.protobuf.Any 408 | 5, // 2: protoconfig.go.kingpinv2.v1.IP.ip:type_name -> google.protobuf.Any 409 | 5, // 3: protoconfig.go.kingpinv2.v1.Regexp.regexp:type_name -> google.protobuf.Any 410 | 6, // 4: protoconfig.go.kingpinv2.v1.placeholder:extendee -> google.protobuf.FieldOptions 411 | 6, // 5: protoconfig.go.kingpinv2.v1.envvar:extendee -> google.protobuf.FieldOptions 412 | 6, // 6: protoconfig.go.kingpinv2.v1.argument:extendee -> google.protobuf.FieldOptions 413 | 7, // 7: protoconfig.go.kingpinv2.v1.command:extendee -> google.protobuf.MessageOptions 414 | 4, // 8: protoconfig.go.kingpinv2.v1.command:type_name -> protoconfig.go.kingpinv2.v1.Command 415 | 9, // [9:9] is the sub-list for method output_type 416 | 9, // [9:9] is the sub-list for method input_type 417 | 8, // [8:9] is the sub-list for extension type_name 418 | 4, // [4:8] is the sub-list for extension extendee 419 | 0, // [0:4] is the sub-list for field type_name 420 | } 421 | 422 | func init() { file_protoconfig_go_kingpinv2_v1_extensions_proto_init() } 423 | func file_protoconfig_go_kingpinv2_v1_extensions_proto_init() { 424 | if File_protoconfig_go_kingpinv2_v1_extensions_proto != nil { 425 | return 426 | } 427 | if !protoimpl.UnsafeEnabled { 428 | file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { 429 | switch v := v.(*Content); i { 430 | case 0: 431 | return &v.state 432 | case 1: 433 | return &v.sizeCache 434 | case 2: 435 | return &v.unknownFields 436 | default: 437 | return nil 438 | } 439 | } 440 | file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { 441 | switch v := v.(*ExistingFile); i { 442 | case 0: 443 | return &v.state 444 | case 1: 445 | return &v.sizeCache 446 | case 2: 447 | return &v.unknownFields 448 | default: 449 | return nil 450 | } 451 | } 452 | file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { 453 | switch v := v.(*IP); i { 454 | case 0: 455 | return &v.state 456 | case 1: 457 | return &v.sizeCache 458 | case 2: 459 | return &v.unknownFields 460 | default: 461 | return nil 462 | } 463 | } 464 | file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { 465 | switch v := v.(*Regexp); i { 466 | case 0: 467 | return &v.state 468 | case 1: 469 | return &v.sizeCache 470 | case 2: 471 | return &v.unknownFields 472 | default: 473 | return nil 474 | } 475 | } 476 | file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { 477 | switch v := v.(*Command); i { 478 | case 0: 479 | return &v.state 480 | case 1: 481 | return &v.sizeCache 482 | case 2: 483 | return &v.unknownFields 484 | default: 485 | return nil 486 | } 487 | } 488 | } 489 | type x struct{} 490 | out := protoimpl.TypeBuilder{ 491 | File: protoimpl.DescBuilder{ 492 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 493 | RawDescriptor: file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDesc, 494 | NumEnums: 0, 495 | NumMessages: 5, 496 | NumExtensions: 4, 497 | NumServices: 0, 498 | }, 499 | GoTypes: file_protoconfig_go_kingpinv2_v1_extensions_proto_goTypes, 500 | DependencyIndexes: file_protoconfig_go_kingpinv2_v1_extensions_proto_depIdxs, 501 | MessageInfos: file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes, 502 | ExtensionInfos: file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes, 503 | }.Build() 504 | File_protoconfig_go_kingpinv2_v1_extensions_proto = out.File 505 | file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDesc = nil 506 | file_protoconfig_go_kingpinv2_v1_extensions_proto_goTypes = nil 507 | file_protoconfig_go_kingpinv2_v1_extensions_proto_depIdxs = nil 508 | } 509 | -------------------------------------------------------------------------------- /go/examples/helloworld/helloworld.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // versions: 3 | // protoc-gen-go v1.25.0 4 | // protoc v3.13.0 5 | // source: examples/helloworld/v1/helloworld.proto 6 | 7 | package helloworldpb 8 | 9 | import ( 10 | proto "github.com/golang/protobuf/proto" 11 | _ "github.com/openproto/protoconfig/go" 12 | _ "github.com/openproto/protoconfig/go/kingpinv2" 13 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" 14 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" 15 | reflect "reflect" 16 | sync "sync" 17 | ) 18 | 19 | const ( 20 | // Verify that this generated code is sufficiently up-to-date. 21 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 22 | // Verify that runtime/protoimpl is sufficiently up-to-date. 23 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 24 | ) 25 | 26 | // This is a compile-time assertion that a sufficiently up-to-date version 27 | // of the legacy proto package is being used. 28 | const _ = proto.ProtoPackageIsVersion4 29 | 30 | type Lang int32 31 | 32 | const ( 33 | Lang_UNSPECIFIED Lang = 0 34 | Lang_ENGLISH Lang = 1 35 | Lang_POLISH Lang = 2 36 | Lang_GERMAN Lang = 3 37 | ) 38 | 39 | // Enum value maps for Lang. 40 | var ( 41 | Lang_name = map[int32]string{ 42 | 0: "UNSPECIFIED", 43 | 1: "ENGLISH", 44 | 2: "POLISH", 45 | 3: "GERMAN", 46 | } 47 | Lang_value = map[string]int32{ 48 | "UNSPECIFIED": 0, 49 | "ENGLISH": 1, 50 | "POLISH": 2, 51 | "GERMAN": 3, 52 | } 53 | ) 54 | 55 | func (x Lang) Enum() *Lang { 56 | p := new(Lang) 57 | *p = x 58 | return p 59 | } 60 | 61 | func (x Lang) String() string { 62 | return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) 63 | } 64 | 65 | func (Lang) Descriptor() protoreflect.EnumDescriptor { 66 | return file_examples_helloworld_v1_helloworld_proto_enumTypes[0].Descriptor() 67 | } 68 | 69 | func (Lang) Type() protoreflect.EnumType { 70 | return &file_examples_helloworld_v1_helloworld_proto_enumTypes[0] 71 | } 72 | 73 | func (x Lang) Number() protoreflect.EnumNumber { 74 | return protoreflect.EnumNumber(x) 75 | } 76 | 77 | // Deprecated: Use Lang.Descriptor instead. 78 | func (Lang) EnumDescriptor() ([]byte, []int) { 79 | return file_examples_helloworld_v1_helloworld_proto_rawDescGZIP(), []int{0} 80 | } 81 | 82 | type HelloWorldConfiguration struct { 83 | state protoimpl.MessageState 84 | sizeCache protoimpl.SizeCache 85 | unknownFields protoimpl.UnknownFields 86 | 87 | // Types that are assignable to Command: 88 | // *HelloWorldConfiguration_Hello 89 | // *HelloWorldConfiguration_Bye 90 | Command isHelloWorldConfiguration_Command `protobuf_oneof:"command"` 91 | } 92 | 93 | func (x *HelloWorldConfiguration) Reset() { 94 | *x = HelloWorldConfiguration{} 95 | if protoimpl.UnsafeEnabled { 96 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[0] 97 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 98 | ms.StoreMessageInfo(mi) 99 | } 100 | } 101 | 102 | func (x *HelloWorldConfiguration) String() string { 103 | return protoimpl.X.MessageStringOf(x) 104 | } 105 | 106 | func (*HelloWorldConfiguration) ProtoMessage() {} 107 | 108 | func (x *HelloWorldConfiguration) ProtoReflect() protoreflect.Message { 109 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[0] 110 | if protoimpl.UnsafeEnabled && x != nil { 111 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 112 | if ms.LoadMessageInfo() == nil { 113 | ms.StoreMessageInfo(mi) 114 | } 115 | return ms 116 | } 117 | return mi.MessageOf(x) 118 | } 119 | 120 | // Deprecated: Use HelloWorldConfiguration.ProtoReflect.Descriptor instead. 121 | func (*HelloWorldConfiguration) Descriptor() ([]byte, []int) { 122 | return file_examples_helloworld_v1_helloworld_proto_rawDescGZIP(), []int{0} 123 | } 124 | 125 | func (m *HelloWorldConfiguration) GetCommand() isHelloWorldConfiguration_Command { 126 | if m != nil { 127 | return m.Command 128 | } 129 | return nil 130 | } 131 | 132 | func (x *HelloWorldConfiguration) GetHello() *HelloCommand { 133 | if x, ok := x.GetCommand().(*HelloWorldConfiguration_Hello); ok { 134 | return x.Hello 135 | } 136 | return nil 137 | } 138 | 139 | func (x *HelloWorldConfiguration) GetBye() *ByeCommand { 140 | if x, ok := x.GetCommand().(*HelloWorldConfiguration_Bye); ok { 141 | return x.Bye 142 | } 143 | return nil 144 | } 145 | 146 | type isHelloWorldConfiguration_Command interface { 147 | isHelloWorldConfiguration_Command() 148 | } 149 | 150 | type HelloWorldConfiguration_Hello struct { 151 | Hello *HelloCommand `protobuf:"bytes,2,opt,name=hello,proto3,oneof"` 152 | } 153 | 154 | type HelloWorldConfiguration_Bye struct { 155 | Bye *ByeCommand `protobuf:"bytes,3,opt,name=bye,proto3,oneof"` 156 | } 157 | 158 | func (*HelloWorldConfiguration_Hello) isHelloWorldConfiguration_Command() {} 159 | 160 | func (*HelloWorldConfiguration_Bye) isHelloWorldConfiguration_Command() {} 161 | 162 | type HelloCommand struct { 163 | state protoimpl.MessageState 164 | sizeCache protoimpl.SizeCache 165 | unknownFields protoimpl.UnknownFields 166 | 167 | Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` 168 | Year int64 `protobuf:"varint,2,opt,name=year,proto3" json:"year,omitempty"` 169 | World string `protobuf:"bytes,3,opt,name=world,proto3" json:"world,omitempty"` 170 | Lang Lang `protobuf:"varint,4,opt,name=lang,proto3,enum=examples.helloworld.v1.Lang" json:"lang,omitempty"` 171 | // Deprecated: Do not use. 172 | PleaseAddReally bool `protobuf:"varint,5,opt,name=please_add_really,json=pleaseAddReally,proto3" json:"please_add_really,omitempty"` 173 | AddReally bool `protobuf:"varint,6,opt,name=add_really,json=addReally,proto3" json:"add_really,omitempty"` 174 | } 175 | 176 | func (x *HelloCommand) Reset() { 177 | *x = HelloCommand{} 178 | if protoimpl.UnsafeEnabled { 179 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[1] 180 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 181 | ms.StoreMessageInfo(mi) 182 | } 183 | } 184 | 185 | func (x *HelloCommand) String() string { 186 | return protoimpl.X.MessageStringOf(x) 187 | } 188 | 189 | func (*HelloCommand) ProtoMessage() {} 190 | 191 | func (x *HelloCommand) ProtoReflect() protoreflect.Message { 192 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[1] 193 | if protoimpl.UnsafeEnabled && x != nil { 194 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 195 | if ms.LoadMessageInfo() == nil { 196 | ms.StoreMessageInfo(mi) 197 | } 198 | return ms 199 | } 200 | return mi.MessageOf(x) 201 | } 202 | 203 | // Deprecated: Use HelloCommand.ProtoReflect.Descriptor instead. 204 | func (*HelloCommand) Descriptor() ([]byte, []int) { 205 | return file_examples_helloworld_v1_helloworld_proto_rawDescGZIP(), []int{1} 206 | } 207 | 208 | func (x *HelloCommand) GetName() string { 209 | if x != nil { 210 | return x.Name 211 | } 212 | return "" 213 | } 214 | 215 | func (x *HelloCommand) GetYear() int64 { 216 | if x != nil { 217 | return x.Year 218 | } 219 | return 0 220 | } 221 | 222 | func (x *HelloCommand) GetWorld() string { 223 | if x != nil { 224 | return x.World 225 | } 226 | return "" 227 | } 228 | 229 | func (x *HelloCommand) GetLang() Lang { 230 | if x != nil { 231 | return x.Lang 232 | } 233 | return Lang_UNSPECIFIED 234 | } 235 | 236 | // Deprecated: Do not use. 237 | func (x *HelloCommand) GetPleaseAddReally() bool { 238 | if x != nil { 239 | return x.PleaseAddReally 240 | } 241 | return false 242 | } 243 | 244 | func (x *HelloCommand) GetAddReally() bool { 245 | if x != nil { 246 | return x.AddReally 247 | } 248 | return false 249 | } 250 | 251 | type ByeCommand struct { 252 | state protoimpl.MessageState 253 | sizeCache protoimpl.SizeCache 254 | unknownFields protoimpl.UnknownFields 255 | 256 | Lang Lang `protobuf:"varint,1,opt,name=lang,proto3,enum=examples.helloworld.v1.Lang" json:"lang,omitempty"` 257 | // Types that are assignable to Command: 258 | // *ByeCommand_Just 259 | // *ByeCommand_Configurable 260 | Command isByeCommand_Command `protobuf_oneof:"command"` 261 | } 262 | 263 | func (x *ByeCommand) Reset() { 264 | *x = ByeCommand{} 265 | if protoimpl.UnsafeEnabled { 266 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[2] 267 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 268 | ms.StoreMessageInfo(mi) 269 | } 270 | } 271 | 272 | func (x *ByeCommand) String() string { 273 | return protoimpl.X.MessageStringOf(x) 274 | } 275 | 276 | func (*ByeCommand) ProtoMessage() {} 277 | 278 | func (x *ByeCommand) ProtoReflect() protoreflect.Message { 279 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[2] 280 | if protoimpl.UnsafeEnabled && x != nil { 281 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 282 | if ms.LoadMessageInfo() == nil { 283 | ms.StoreMessageInfo(mi) 284 | } 285 | return ms 286 | } 287 | return mi.MessageOf(x) 288 | } 289 | 290 | // Deprecated: Use ByeCommand.ProtoReflect.Descriptor instead. 291 | func (*ByeCommand) Descriptor() ([]byte, []int) { 292 | return file_examples_helloworld_v1_helloworld_proto_rawDescGZIP(), []int{2} 293 | } 294 | 295 | func (x *ByeCommand) GetLang() Lang { 296 | if x != nil { 297 | return x.Lang 298 | } 299 | return Lang_UNSPECIFIED 300 | } 301 | 302 | func (m *ByeCommand) GetCommand() isByeCommand_Command { 303 | if m != nil { 304 | return m.Command 305 | } 306 | return nil 307 | } 308 | 309 | func (x *ByeCommand) GetJust() *ByeJustCommand { 310 | if x, ok := x.GetCommand().(*ByeCommand_Just); ok { 311 | return x.Just 312 | } 313 | return nil 314 | } 315 | 316 | func (x *ByeCommand) GetConfigurable() *ByeConfigurableCommand { 317 | if x, ok := x.GetCommand().(*ByeCommand_Configurable); ok { 318 | return x.Configurable 319 | } 320 | return nil 321 | } 322 | 323 | type isByeCommand_Command interface { 324 | isByeCommand_Command() 325 | } 326 | 327 | type ByeCommand_Just struct { 328 | Just *ByeJustCommand `protobuf:"bytes,2,opt,name=just,proto3,oneof"` 329 | } 330 | 331 | type ByeCommand_Configurable struct { 332 | Configurable *ByeConfigurableCommand `protobuf:"bytes,3,opt,name=configurable,proto3,oneof"` 333 | } 334 | 335 | func (*ByeCommand_Just) isByeCommand_Command() {} 336 | 337 | func (*ByeCommand_Configurable) isByeCommand_Command() {} 338 | 339 | type ByeJustCommand struct { 340 | state protoimpl.MessageState 341 | sizeCache protoimpl.SizeCache 342 | unknownFields protoimpl.UnknownFields 343 | } 344 | 345 | func (x *ByeJustCommand) Reset() { 346 | *x = ByeJustCommand{} 347 | if protoimpl.UnsafeEnabled { 348 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[3] 349 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 350 | ms.StoreMessageInfo(mi) 351 | } 352 | } 353 | 354 | func (x *ByeJustCommand) String() string { 355 | return protoimpl.X.MessageStringOf(x) 356 | } 357 | 358 | func (*ByeJustCommand) ProtoMessage() {} 359 | 360 | func (x *ByeJustCommand) ProtoReflect() protoreflect.Message { 361 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[3] 362 | if protoimpl.UnsafeEnabled && x != nil { 363 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 364 | if ms.LoadMessageInfo() == nil { 365 | ms.StoreMessageInfo(mi) 366 | } 367 | return ms 368 | } 369 | return mi.MessageOf(x) 370 | } 371 | 372 | // Deprecated: Use ByeJustCommand.ProtoReflect.Descriptor instead. 373 | func (*ByeJustCommand) Descriptor() ([]byte, []int) { 374 | return file_examples_helloworld_v1_helloworld_proto_rawDescGZIP(), []int{3} 375 | } 376 | 377 | type ByeConfigurableCommand struct { 378 | state protoimpl.MessageState 379 | sizeCache protoimpl.SizeCache 380 | unknownFields protoimpl.UnknownFields 381 | 382 | ConfigId string `protobuf:"bytes,1,opt,name=config_id,json=configId,proto3" json:"config_id,omitempty"` 383 | Config *ByeConfiguration `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` 384 | Extra []string `protobuf:"bytes,3,rep,name=extra,proto3" json:"extra,omitempty"` 385 | } 386 | 387 | func (x *ByeConfigurableCommand) Reset() { 388 | *x = ByeConfigurableCommand{} 389 | if protoimpl.UnsafeEnabled { 390 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[4] 391 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 392 | ms.StoreMessageInfo(mi) 393 | } 394 | } 395 | 396 | func (x *ByeConfigurableCommand) String() string { 397 | return protoimpl.X.MessageStringOf(x) 398 | } 399 | 400 | func (*ByeConfigurableCommand) ProtoMessage() {} 401 | 402 | func (x *ByeConfigurableCommand) ProtoReflect() protoreflect.Message { 403 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[4] 404 | if protoimpl.UnsafeEnabled && x != nil { 405 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 406 | if ms.LoadMessageInfo() == nil { 407 | ms.StoreMessageInfo(mi) 408 | } 409 | return ms 410 | } 411 | return mi.MessageOf(x) 412 | } 413 | 414 | // Deprecated: Use ByeConfigurableCommand.ProtoReflect.Descriptor instead. 415 | func (*ByeConfigurableCommand) Descriptor() ([]byte, []int) { 416 | return file_examples_helloworld_v1_helloworld_proto_rawDescGZIP(), []int{4} 417 | } 418 | 419 | func (x *ByeConfigurableCommand) GetConfigId() string { 420 | if x != nil { 421 | return x.ConfigId 422 | } 423 | return "" 424 | } 425 | 426 | func (x *ByeConfigurableCommand) GetConfig() *ByeConfiguration { 427 | if x != nil { 428 | return x.Config 429 | } 430 | return nil 431 | } 432 | 433 | func (x *ByeConfigurableCommand) GetExtra() []string { 434 | if x != nil { 435 | return x.Extra 436 | } 437 | return nil 438 | } 439 | 440 | type ByeResponse struct { 441 | state protoimpl.MessageState 442 | sizeCache protoimpl.SizeCache 443 | unknownFields protoimpl.UnknownFields 444 | 445 | Capitalized bool `protobuf:"varint,1,opt,name=capitalized,proto3" json:"capitalized,omitempty"` 446 | } 447 | 448 | func (x *ByeResponse) Reset() { 449 | *x = ByeResponse{} 450 | if protoimpl.UnsafeEnabled { 451 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[5] 452 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 453 | ms.StoreMessageInfo(mi) 454 | } 455 | } 456 | 457 | func (x *ByeResponse) String() string { 458 | return protoimpl.X.MessageStringOf(x) 459 | } 460 | 461 | func (*ByeResponse) ProtoMessage() {} 462 | 463 | func (x *ByeResponse) ProtoReflect() protoreflect.Message { 464 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[5] 465 | if protoimpl.UnsafeEnabled && x != nil { 466 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 467 | if ms.LoadMessageInfo() == nil { 468 | ms.StoreMessageInfo(mi) 469 | } 470 | return ms 471 | } 472 | return mi.MessageOf(x) 473 | } 474 | 475 | // Deprecated: Use ByeResponse.ProtoReflect.Descriptor instead. 476 | func (*ByeResponse) Descriptor() ([]byte, []int) { 477 | return file_examples_helloworld_v1_helloworld_proto_rawDescGZIP(), []int{5} 478 | } 479 | 480 | func (x *ByeResponse) GetCapitalized() bool { 481 | if x != nil { 482 | return x.Capitalized 483 | } 484 | return false 485 | } 486 | 487 | type ByeConfiguration struct { 488 | state protoimpl.MessageState 489 | sizeCache protoimpl.SizeCache 490 | unknownFields protoimpl.UnknownFields 491 | 492 | Configs map[string]*ByeResponse `protobuf:"bytes,2,rep,name=configs,proto3" json:"configs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` 493 | } 494 | 495 | func (x *ByeConfiguration) Reset() { 496 | *x = ByeConfiguration{} 497 | if protoimpl.UnsafeEnabled { 498 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[6] 499 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 500 | ms.StoreMessageInfo(mi) 501 | } 502 | } 503 | 504 | func (x *ByeConfiguration) String() string { 505 | return protoimpl.X.MessageStringOf(x) 506 | } 507 | 508 | func (*ByeConfiguration) ProtoMessage() {} 509 | 510 | func (x *ByeConfiguration) ProtoReflect() protoreflect.Message { 511 | mi := &file_examples_helloworld_v1_helloworld_proto_msgTypes[6] 512 | if protoimpl.UnsafeEnabled && x != nil { 513 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 514 | if ms.LoadMessageInfo() == nil { 515 | ms.StoreMessageInfo(mi) 516 | } 517 | return ms 518 | } 519 | return mi.MessageOf(x) 520 | } 521 | 522 | // Deprecated: Use ByeConfiguration.ProtoReflect.Descriptor instead. 523 | func (*ByeConfiguration) Descriptor() ([]byte, []int) { 524 | return file_examples_helloworld_v1_helloworld_proto_rawDescGZIP(), []int{6} 525 | } 526 | 527 | func (x *ByeConfiguration) GetConfigs() map[string]*ByeResponse { 528 | if x != nil { 529 | return x.Configs 530 | } 531 | return nil 532 | } 533 | 534 | var File_examples_helloworld_v1_helloworld_proto protoreflect.FileDescriptor 535 | 536 | var file_examples_helloworld_v1_helloworld_proto_rawDesc = []byte{ 537 | 0x0a, 0x27, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 538 | 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 539 | 0x72, 0x6c, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x65, 0x78, 0x61, 0x6d, 0x70, 540 | 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 541 | 0x31, 0x1a, 0x1f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 542 | 0x31, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 543 | 0x74, 0x6f, 0x1a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 544 | 0x67, 0x6f, 0x2f, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2f, 0x76, 0x31, 0x2f, 545 | 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 546 | 0x22, 0xfb, 0x01, 0x0a, 0x17, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x43, 547 | 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3c, 0x0a, 0x05, 548 | 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x78, 549 | 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 550 | 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 551 | 0x64, 0x48, 0x00, 0x52, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x36, 0x0a, 0x03, 0x62, 0x79, 552 | 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 553 | 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 554 | 0x2e, 0x42, 0x79, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x03, 0x62, 555 | 0x79, 0x65, 0x3a, 0x5f, 0xc2, 0xb8, 0x02, 0x5b, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 556 | 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x05, 0x30, 0x2e, 0x31, 0x2e, 0x30, 0x1a, 0x30, 0x65, 557 | 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 558 | 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x68, 0x6f, 0x77, 0x63, 0x61, 0x73, 0x65, 0x20, 0x50, 559 | 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x20, 0x31, 0x2e, 0x30, 0x2e, 0xb2, 560 | 0x06, 0x11, 0x0a, 0x0f, 0x2d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 561 | 0x67, 0x76, 0x31, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0xf0, 562 | 0x01, 0x0a, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 563 | 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xd0, 564 | 0xb8, 0x02, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x04, 0x79, 0x65, 0x61, 565 | 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x08, 0xc2, 0xb8, 0x02, 0x04, 0x32, 0x30, 0x32, 566 | 0x31, 0x52, 0x04, 0x79, 0x65, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x6f, 0x72, 0x6c, 0x64, 567 | 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x12, 0x30, 0x0a, 568 | 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x65, 0x78, 569 | 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 570 | 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x61, 0x6e, 0x67, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 571 | 0x2e, 0x0a, 0x11, 0x70, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x5f, 0x72, 0x65, 572 | 0x61, 0x6c, 0x6c, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0f, 573 | 0x70, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x64, 0x64, 0x52, 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x12, 574 | 0x23, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x5f, 0x72, 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x18, 0x06, 0x20, 575 | 0x01, 0x28, 0x08, 0x42, 0x04, 0xc8, 0xb8, 0x02, 0x01, 0x52, 0x09, 0x61, 0x64, 0x64, 0x52, 0x65, 576 | 0x61, 0x6c, 0x6c, 0x79, 0x3a, 0x0b, 0x92, 0xf7, 0x02, 0x07, 0x0a, 0x05, 0x68, 0x65, 0x6c, 0x6c, 577 | 0x6f, 0x22, 0xe8, 0x01, 0x0a, 0x0a, 0x42, 0x79, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 578 | 0x12, 0x30, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 579 | 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 580 | 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x61, 0x6e, 0x67, 0x52, 0x04, 0x6c, 0x61, 581 | 0x6e, 0x67, 0x12, 0x3c, 0x0a, 0x04, 0x6a, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 582 | 0x32, 0x26, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 583 | 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x79, 0x65, 0x4a, 0x75, 0x73, 584 | 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x04, 0x6a, 0x75, 0x73, 0x74, 585 | 0x12, 0x54, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 586 | 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 587 | 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 588 | 0x42, 0x79, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x43, 589 | 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 590 | 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x3a, 0x09, 0x92, 0xf7, 0x02, 0x05, 0x0a, 0x03, 0x62, 0x79, 591 | 0x65, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0x1c, 0x0a, 0x0e, 592 | 0x42, 0x79, 0x65, 0x4a, 0x75, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x3a, 0x0a, 593 | 0x92, 0xf7, 0x02, 0x06, 0x0a, 0x04, 0x6a, 0x75, 0x73, 0x74, 0x22, 0xa1, 0x01, 0x0a, 0x16, 0x42, 594 | 0x79, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 595 | 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 596 | 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 597 | 0x49, 0x64, 0x12, 0x40, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 598 | 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 599 | 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x79, 0x65, 0x43, 600 | 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x63, 0x6f, 601 | 0x6e, 0x66, 0x69, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x03, 0x20, 602 | 0x03, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x3a, 0x12, 0x92, 0xf7, 0x02, 0x0e, 603 | 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x2f, 604 | 0x0a, 0x0b, 0x42, 0x79, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 605 | 0x0b, 0x63, 0x61, 0x70, 0x69, 0x74, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 606 | 0x28, 0x08, 0x52, 0x0b, 0x63, 0x61, 0x70, 0x69, 0x74, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x22, 607 | 0xc4, 0x01, 0x0a, 0x10, 0x42, 0x79, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 608 | 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4f, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 609 | 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 610 | 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x42, 611 | 0x79, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 612 | 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x63, 0x6f, 613 | 0x6e, 0x66, 0x69, 0x67, 0x73, 0x1a, 0x5f, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 614 | 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 615 | 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x39, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 616 | 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 617 | 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 618 | 0x42, 0x79, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 619 | 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x3c, 0x0a, 0x04, 0x4c, 0x61, 0x6e, 0x67, 0x12, 0x0f, 620 | 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 621 | 0x0b, 0x0a, 0x07, 0x45, 0x4e, 0x47, 0x4c, 0x49, 0x53, 0x48, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 622 | 0x50, 0x4f, 0x4c, 0x49, 0x53, 0x48, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x45, 0x52, 0x4d, 623 | 0x41, 0x4e, 0x10, 0x03, 0x42, 0x85, 0x01, 0x0a, 0x2a, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 624 | 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 625 | 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 626 | 0x72, 0x6c, 0x64, 0x42, 0x0f, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x50, 627 | 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 628 | 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 629 | 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 630 | 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x3b, 631 | 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 632 | 0x6f, 0x74, 0x6f, 0x33, 633 | } 634 | 635 | var ( 636 | file_examples_helloworld_v1_helloworld_proto_rawDescOnce sync.Once 637 | file_examples_helloworld_v1_helloworld_proto_rawDescData = file_examples_helloworld_v1_helloworld_proto_rawDesc 638 | ) 639 | 640 | func file_examples_helloworld_v1_helloworld_proto_rawDescGZIP() []byte { 641 | file_examples_helloworld_v1_helloworld_proto_rawDescOnce.Do(func() { 642 | file_examples_helloworld_v1_helloworld_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_helloworld_v1_helloworld_proto_rawDescData) 643 | }) 644 | return file_examples_helloworld_v1_helloworld_proto_rawDescData 645 | } 646 | 647 | var file_examples_helloworld_v1_helloworld_proto_enumTypes = make([]protoimpl.EnumInfo, 1) 648 | var file_examples_helloworld_v1_helloworld_proto_msgTypes = make([]protoimpl.MessageInfo, 8) 649 | var file_examples_helloworld_v1_helloworld_proto_goTypes = []interface{}{ 650 | (Lang)(0), // 0: examples.helloworld.v1.Lang 651 | (*HelloWorldConfiguration)(nil), // 1: examples.helloworld.v1.HelloWorldConfiguration 652 | (*HelloCommand)(nil), // 2: examples.helloworld.v1.HelloCommand 653 | (*ByeCommand)(nil), // 3: examples.helloworld.v1.ByeCommand 654 | (*ByeJustCommand)(nil), // 4: examples.helloworld.v1.ByeJustCommand 655 | (*ByeConfigurableCommand)(nil), // 5: examples.helloworld.v1.ByeConfigurableCommand 656 | (*ByeResponse)(nil), // 6: examples.helloworld.v1.ByeResponse 657 | (*ByeConfiguration)(nil), // 7: examples.helloworld.v1.ByeConfiguration 658 | nil, // 8: examples.helloworld.v1.ByeConfiguration.ConfigsEntry 659 | } 660 | var file_examples_helloworld_v1_helloworld_proto_depIdxs = []int32{ 661 | 2, // 0: examples.helloworld.v1.HelloWorldConfiguration.hello:type_name -> examples.helloworld.v1.HelloCommand 662 | 3, // 1: examples.helloworld.v1.HelloWorldConfiguration.bye:type_name -> examples.helloworld.v1.ByeCommand 663 | 0, // 2: examples.helloworld.v1.HelloCommand.lang:type_name -> examples.helloworld.v1.Lang 664 | 0, // 3: examples.helloworld.v1.ByeCommand.lang:type_name -> examples.helloworld.v1.Lang 665 | 4, // 4: examples.helloworld.v1.ByeCommand.just:type_name -> examples.helloworld.v1.ByeJustCommand 666 | 5, // 5: examples.helloworld.v1.ByeCommand.configurable:type_name -> examples.helloworld.v1.ByeConfigurableCommand 667 | 7, // 6: examples.helloworld.v1.ByeConfigurableCommand.config:type_name -> examples.helloworld.v1.ByeConfiguration 668 | 8, // 7: examples.helloworld.v1.ByeConfiguration.configs:type_name -> examples.helloworld.v1.ByeConfiguration.ConfigsEntry 669 | 6, // 8: examples.helloworld.v1.ByeConfiguration.ConfigsEntry.value:type_name -> examples.helloworld.v1.ByeResponse 670 | 9, // [9:9] is the sub-list for method output_type 671 | 9, // [9:9] is the sub-list for method input_type 672 | 9, // [9:9] is the sub-list for extension type_name 673 | 9, // [9:9] is the sub-list for extension extendee 674 | 0, // [0:9] is the sub-list for field type_name 675 | } 676 | 677 | func init() { file_examples_helloworld_v1_helloworld_proto_init() } 678 | func file_examples_helloworld_v1_helloworld_proto_init() { 679 | if File_examples_helloworld_v1_helloworld_proto != nil { 680 | return 681 | } 682 | if !protoimpl.UnsafeEnabled { 683 | file_examples_helloworld_v1_helloworld_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { 684 | switch v := v.(*HelloWorldConfiguration); i { 685 | case 0: 686 | return &v.state 687 | case 1: 688 | return &v.sizeCache 689 | case 2: 690 | return &v.unknownFields 691 | default: 692 | return nil 693 | } 694 | } 695 | file_examples_helloworld_v1_helloworld_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { 696 | switch v := v.(*HelloCommand); i { 697 | case 0: 698 | return &v.state 699 | case 1: 700 | return &v.sizeCache 701 | case 2: 702 | return &v.unknownFields 703 | default: 704 | return nil 705 | } 706 | } 707 | file_examples_helloworld_v1_helloworld_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { 708 | switch v := v.(*ByeCommand); i { 709 | case 0: 710 | return &v.state 711 | case 1: 712 | return &v.sizeCache 713 | case 2: 714 | return &v.unknownFields 715 | default: 716 | return nil 717 | } 718 | } 719 | file_examples_helloworld_v1_helloworld_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { 720 | switch v := v.(*ByeJustCommand); i { 721 | case 0: 722 | return &v.state 723 | case 1: 724 | return &v.sizeCache 725 | case 2: 726 | return &v.unknownFields 727 | default: 728 | return nil 729 | } 730 | } 731 | file_examples_helloworld_v1_helloworld_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { 732 | switch v := v.(*ByeConfigurableCommand); i { 733 | case 0: 734 | return &v.state 735 | case 1: 736 | return &v.sizeCache 737 | case 2: 738 | return &v.unknownFields 739 | default: 740 | return nil 741 | } 742 | } 743 | file_examples_helloworld_v1_helloworld_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { 744 | switch v := v.(*ByeResponse); i { 745 | case 0: 746 | return &v.state 747 | case 1: 748 | return &v.sizeCache 749 | case 2: 750 | return &v.unknownFields 751 | default: 752 | return nil 753 | } 754 | } 755 | file_examples_helloworld_v1_helloworld_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { 756 | switch v := v.(*ByeConfiguration); i { 757 | case 0: 758 | return &v.state 759 | case 1: 760 | return &v.sizeCache 761 | case 2: 762 | return &v.unknownFields 763 | default: 764 | return nil 765 | } 766 | } 767 | } 768 | file_examples_helloworld_v1_helloworld_proto_msgTypes[0].OneofWrappers = []interface{}{ 769 | (*HelloWorldConfiguration_Hello)(nil), 770 | (*HelloWorldConfiguration_Bye)(nil), 771 | } 772 | file_examples_helloworld_v1_helloworld_proto_msgTypes[2].OneofWrappers = []interface{}{ 773 | (*ByeCommand_Just)(nil), 774 | (*ByeCommand_Configurable)(nil), 775 | } 776 | type x struct{} 777 | out := protoimpl.TypeBuilder{ 778 | File: protoimpl.DescBuilder{ 779 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 780 | RawDescriptor: file_examples_helloworld_v1_helloworld_proto_rawDesc, 781 | NumEnums: 1, 782 | NumMessages: 8, 783 | NumExtensions: 0, 784 | NumServices: 0, 785 | }, 786 | GoTypes: file_examples_helloworld_v1_helloworld_proto_goTypes, 787 | DependencyIndexes: file_examples_helloworld_v1_helloworld_proto_depIdxs, 788 | EnumInfos: file_examples_helloworld_v1_helloworld_proto_enumTypes, 789 | MessageInfos: file_examples_helloworld_v1_helloworld_proto_msgTypes, 790 | }.Build() 791 | File_examples_helloworld_v1_helloworld_proto = out.File 792 | file_examples_helloworld_v1_helloworld_proto_rawDesc = nil 793 | file_examples_helloworld_v1_helloworld_proto_goTypes = nil 794 | file_examples_helloworld_v1_helloworld_proto_depIdxs = nil 795 | } 796 | --------------------------------------------------------------------------------