From 074b35a1ec80a4e57c20d7a7d4c46bae05396c9f Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Tue, 5 Jan 2021 00:12:55 +0000 Subject: [PATCH] Renames. (#6) Signed-off-by: Bartlomiej Plotka --- .github/workflows/go.yaml | 4 +- Makefile | 6 +- README.md | 30 +- buf.yaml | 4 +- .../.errcheck_excludes.txt | 0 {golang => go}/Makefile | 26 +- {golang => go}/compatibility.go | 4 +- {golang => go}/configurable.go | 10 +- {golang => go}/configurator.go | 12 +- go/examples/README.md | 76 +++ {golang => go}/examples/doc.go | 0 {golang => go}/examples/go.mod | 6 +- {golang => go}/examples/go.sum | 0 {golang => go}/examples/helloworld/app.go | 0 .../configurable-kingpinv2-gen/main.go | 0 .../helloworld/configurable-kingpinv2/main.go | 6 +- .../examples/helloworld/configurable/main.go | 4 +- .../examples/helloworld/configurator/main.go | 34 +- .../examples/helloworld/helloworld.pb.go | 56 +- .../helloworld/helloworld_protoconfig.pb.go | 50 +- {golang => go}/extensions.pb.go | 242 ++++----- {golang => go}/go.mod | 2 +- {golang => go}/go.sum | 0 go/kingpinv2/extensions.pb.go | 509 ++++++++++++++++++ {golang => go}/kingpinv2/kingpinv2.go | 0 .../protoc-gen-go-protoconfig}/README.md | 4 +- .../protoc-gen-go-protoconfig}/go.mod | 6 +- .../protoc-gen-go-protoconfig}/go.sum | 0 .../protoc-gen-go-protoconfig}/main.go | 12 +- .../protoc-gen-go-protoconfig/protoconfig.go | 56 +- golang/examples/README.md | 76 --- golang/kingpinv2/extensions.pb.go | 509 ------------------ golang/protoc-gen-go-openconfig/.golangci.yml | 76 --- proto/examples/helloworld/v1/helloworld.proto | 28 +- .../go}/kingpinv2/v1/extensions.proto | 6 +- .../v1/extensions.proto | 16 +- specification.md | 20 +- 37 files changed, 907 insertions(+), 983 deletions(-) rename {golang/protoc-gen-go-openconfig => go}/.errcheck_excludes.txt (100%) rename {golang => go}/Makefile (72%) rename {golang => go}/compatibility.go (75%) rename {golang => go}/configurable.go (62%) rename {golang => go}/configurator.go (50%) create mode 100644 go/examples/README.md rename {golang => go}/examples/doc.go (100%) rename {golang => go}/examples/go.mod (64%) rename {golang => go}/examples/go.sum (100%) rename {golang => go}/examples/helloworld/app.go (100%) rename {golang => go}/examples/helloworld/configurable-kingpinv2-gen/main.go (100%) rename {golang => go}/examples/helloworld/configurable-kingpinv2/main.go (90%) rename {golang => go}/examples/helloworld/configurable/main.go (68%) rename {golang => go}/examples/helloworld/configurator/main.go (71%) rename {golang => go}/examples/helloworld/helloworld.pb.go (91%) rename golang/examples/helloworld/helloworld_openconfig.pb.go => go/examples/helloworld/helloworld_protoconfig.pb.go (57%) rename {golang => go}/extensions.pb.go (51%) rename {golang => go}/go.mod (66%) rename {golang => go}/go.sum (100%) create mode 100644 go/kingpinv2/extensions.pb.go rename {golang => go}/kingpinv2/kingpinv2.go (100%) rename {golang/protoc-gen-go-openconfig => go/protoc-gen-go-protoconfig}/README.md (60%) rename {golang/protoc-gen-go-openconfig => go/protoc-gen-go-protoconfig}/go.mod (53%) rename {golang/protoc-gen-go-openconfig => go/protoc-gen-go-protoconfig}/go.sum (100%) rename {golang/protoc-gen-go-openconfig => go/protoc-gen-go-protoconfig}/main.go (74%) rename golang/protoc-gen-go-openconfig/openconfig.go => go/protoc-gen-go-protoconfig/protoconfig.go (72%) delete mode 100644 golang/examples/README.md delete mode 100644 golang/kingpinv2/extensions.pb.go delete mode 100644 golang/protoc-gen-go-openconfig/.golangci.yml rename proto/{openconfig/golang => protoconfig/go}/kingpinv2/v1/extensions.proto (89%) rename proto/{openconfig => protoconfig}/v1/extensions.proto (82%) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 8d2a278..3aca609 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -28,7 +28,7 @@ jobs: - name: Linting & vetting. env: GOBIN: /tmp/.bin - run: cd golang && make lint + run: cd go && make lint tests: runs-on: ${{ matrix.platform }} strategy: @@ -55,4 +55,4 @@ jobs: - name: Run unit tests. env: GOBIN: /tmp/.bin - run: cd golang && make test \ No newline at end of file + run: cd go && make test \ No newline at end of file diff --git a/Makefile b/Makefile index 6b4eac4..788cd48 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,10 @@ lint: $(BUF) docs @echo ">> lint proto files" @$(BUF) check lint $(call require_clean_work_tree,"detected changed files - run make lint and commit changes.") - @echo ">> lint golang files" - @$(MAKE) -C golang lint + @echo ">> lint go files" + @$(MAKE) -C go lint $(call require_clean_work_tree,"detected changed files - run make lint and commit changes.") .PHONY: proto proto: - @$(MAKE) -C ./golang proto + @$(MAKE) -C ./go proto diff --git a/README.md b/README.md index 4c5dd9e..9f09985 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ -# OpenConfig 1.0 +# ProtoConfig 1.0 -[![golang docs](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/thanos-io/OpenConfig/golang) [![Latest Release](https://img.shields.io/github/release/thanos-io/OpenConfig.svg?style=flat-square)](https://github.com/thanos-io/OpenConfig/releases/latest) +[![golang docs](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/protoconfig/protoconfig/go) [![Latest Release](https://img.shields.io/github/release/protoconfig/protoconfig.svg?style=flat-square)](https://github.com/protoconfig/protoconfig/releases/latest) -The `OpenConfig 1.0` is a specification that describes a process of using, defining, and consuming software configuration input in a unified way. +The `ProtoConfig 1.0` is a specification that describes a process of using, defining, and consuming software configuration input in a unified way. *Like gRPC or OpenAPI but for Application (static or dynamic) Configuration.* ### TL;DR -The `OpenConfig 1.0` standardises application configuration, by describing the process as follows: +The `ProtoConfig 1.0` standardises application configuration, by describing the process as follows: 1. Application developer creates a [.proto](https://developers.google.com/protocol-buffers) file with `Configuration Proto Definition`, that defines what exactly options application has. 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). -* `OpenConfig` 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! -3. Following the `OpenConfig` 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! +* `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! +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! -`OpenConfig 1.0` standard specifies that every `OpenConfig 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). +`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). ![Open Config 1.0](https://docs.google.com/drawings/d/e/2PACX-1vSANZkljSiDgV-o0a-dL0ryZz19p3Hblt5V_qozhBcY5ILq8j3T2GEAdCCHFHoSGT9h2H4LDqJ9bCn_/pub?w=1440&h=1080) @@ -27,7 +27,7 @@ Configure software in a way that is: * **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.* * **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 * **Backward & Forward Compatible**: *Smooth version migrations, thanks to `protobuf` guarantee and safety checkers like [`buf check breaking`](https://docs.buf.build/breaking-usage)* -* **Extensible**: *On top of [**OpenConfig Proto Extensions Format 1.0.**](proto/openconfig/v1/extensions.proto) this specification allows CLI or language-specific extensions (e.g see [`kingpinv2` Go package](golang/kingpinv2) and its [extensions](golang/kingpinv2/proto/openconfig/kingpinv2/v1/extensions.proto))* +* **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))* ### Motivation @@ -43,7 +43,7 @@ See [./specification#why-protocol-buffers](specification.md#why-protocol-buffers ### Example -See [example in Go](golang/README.md). +See [example in Go](go/README.md). 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,11 +51,11 @@ If you are not familiar with Go, this is still a useful example, as the flow and | Item | What | Status | |--------|------|--------| -| [`proto/openconfig/v1/extensions.proto`](proto/openconfig/v1/extensions.proto) | *OpenConfig Proto Extensions Format 1.0* | Alpha | +| [`proto/protoconfig/v1/extensions.proto`](proto/protoconfig/v1/extensions.proto) | *Proto Config Extensions Format 1.0* | Alpha | | [`proto/examples/helloworld/v1/helloworld.proto`]( proto/examples/helloworld/v1/helloworld.proto) | Example *Configuration Proto Definitions (CPD)* | Alpha | -| [`golang/`](golang) | Go module with (optional) *OpenConfig Proto Extensions Format 1.0* bindings | Alpha | -| [`golang/protoc-gen-go-openconfig`](golang/protoc-gen-go-openconfig/README.md) | Go module with (optional) protogen go plugin supporting *OpenConfig Proto Extensions Format 1.0* Go language | Alpha | -| [`golang/examples`](golang/examples/README.md) | Go module with (optional) protogen go plugin supporting *OpenConfig Proto Extensions Format 1.0* Go language | Alpha | +| [`go/`](go) | Go module with (optional) *Proto Config Extensions Format 1.0* bindings | Alpha | +| [`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 | +| [`go/examples`](go/examples/README.md) | Go module with (optional) protogen go plugin supporting *Proto Config Extensions Format 1.0* Go language | Alpha | ### Contributing @@ -67,8 +67,8 @@ Put an issue on this repo, create PR or ping us on the CNCF Slack (`@bwplotka`, Help wanted! -* [ ] Documentation for using OpenConfig 1.0 by different language than supported by this repo. -* [ ] Documentation for writing OpenConfig 1.0 plugin for a different language than supported by this repo. +* [ ] Documentation for using ProtoConfig 1.0 by different language than supported by this repo. +* [ ] Documentation for writing ProtoConfig 1.0 plugin for a different language than supported by this repo. * [ ] Publish formal RFC-compatible specification, finish it, add recommendations (e.g package names). * [ ] Document extensibility. * [ ] Add example if any configuration templating engine. diff --git a/buf.yaml b/buf.yaml index 4d29cd0..2857fee 100644 --- a/buf.yaml +++ b/buf.yaml @@ -10,9 +10,9 @@ lint: ENUM_ZERO_VALUE_SUFFIX: - examples/helloworld/v1/helloworld.proto ignore: - # per the lint configuration docs, the paths for lint ignores have the root + # Per the lint configuration docs, the paths for lint ignores have the root # directory stripped so that this configuration works for both sources and images - # google/api and google/rpc are the directories within googleapis/ that we want to ignore + # google/api and google/rpc are the directories within googleapis/ that we want to ignore. - google/protobuf/descriptor.proto use: - DEFAULT \ No newline at end of file diff --git a/golang/protoc-gen-go-openconfig/.errcheck_excludes.txt b/go/.errcheck_excludes.txt similarity index 100% rename from golang/protoc-gen-go-openconfig/.errcheck_excludes.txt rename to go/.errcheck_excludes.txt diff --git a/golang/Makefile b/go/Makefile similarity index 72% rename from golang/Makefile rename to go/Makefile index ba892f7..73680a0 100644 --- a/golang/Makefile +++ b/go/Makefile @@ -2,7 +2,7 @@ include ../common.mk include ../.bingo/Variables.mk MODULE_EXAMPLES := examples -MODULE_GEN_GO := protoc-gen-go-openconfig +MODULE_GEN_GO := protoc-gen-go-protoconfig MODULE_KINGPINV2 := kingpinv2 FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print) @@ -17,9 +17,9 @@ GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin all: format build .PHONY: build -build: ## Build protoc-gen-go-openconfig. +build: ## Build protoc-gen-go-protoconfig. @echo ">> building $(MODULE_GEN_GO)" - @cd $(MODULE_GEN_GO) && GOBIN=$(GOBIN) go install github.com/thanos-io/OpenConfig/golang/protoc-gen-go-openconfig + @cd $(MODULE_GEN_GO) && GOBIN=$(GOBIN) go install github.com/protoconfig/protoconfig/go/protoc-gen-go-protoconfig .PHONY: deps deps: ## Ensures fresh go.mod and go.sum. @@ -48,25 +48,25 @@ test: PROTOC_GEN_GO_CURRENT := $(TMP_GOBIN)/protoc-gen-go .PHONY: proto -proto: ## Generated golang protobuf +proto: ## Generate protobufs for all modules proto: build $(BUF) $(PROTOC_GEN_GO) @mkdir -p $(TMP_GOBIN) @cp $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_CURRENT) - @echo ">> generating $(REPO_ROOT_DIR)/proto/openconfig/v1/extensions.proto in $(REPO_ROOT_DIR)/golang" + @echo ">> generating $(REPO_ROOT_DIR)/proto/protoconfig/v1/extensions.proto in $(REPO_ROOT_DIR)/go" @PATH=$(GOBIN):$(TMP_GOBIN) $(BUF) protoc \ -I $(REPO_ROOT_DIR)/proto \ - --go_out=$(REPO_ROOT_DIR)/golang --go_opt=module="github.com/thanos-io/OpenConfig/golang" \ - $(REPO_ROOT_DIR)/proto/openconfig/v1/extensions.proto - @echo ">> generating $(REPO_ROOT_DIR)/proto/openconfig/golang/kingpinv2/v1/extensions.proto in $(REPO_ROOT_DIR)/golang/kingpinv2" + --go_out=$(REPO_ROOT_DIR)/go --go_opt=module="github.com/protoconfig/protoconfig/go" \ + $(REPO_ROOT_DIR)/proto/protoconfig/v1/extensions.proto + @echo ">> generating $(REPO_ROOT_DIR)/proto/protoconfig/go/kingpinv2/v1/extensions.proto in $(REPO_ROOT_DIR)/go/kingpinv2" @PATH=$(GOBIN):$(TMP_GOBIN) $(BUF) protoc \ -I $(REPO_ROOT_DIR)/proto \ - --go_out=$(REPO_ROOT_DIR)/golang/kingpinv2 --go_opt=module="github.com/thanos-io/OpenConfig/golang/kingpinv2" \ - $(REPO_ROOT_DIR)/proto/openconfig/golang/kingpinv2/v1/extensions.proto - @echo ">> generating $(REPO_ROOT_DIR)/proto/examples/helloworld/v1/helloworld.proto in $(REPO_ROOT_DIR)/golang/examples/helloworld/" + --go_out=$(REPO_ROOT_DIR)/go/kingpinv2 --go_opt=module="github.com/protoconfig/protoconfig/go/kingpinv2" \ + $(REPO_ROOT_DIR)/proto/protoconfig/go/kingpinv2/v1/extensions.proto + @echo ">> generating $(REPO_ROOT_DIR)/proto/examples/helloworld/v1/helloworld.proto in $(REPO_ROOT_DIR)/go/examples/helloworld/" @PATH=$(GOBIN):$(TMP_GOBIN) $(BUF) protoc \ -I $(REPO_ROOT_DIR)/proto \ - --go_out=$(REPO_ROOT_DIR)/golang/examples/helloworld/ --go_opt=module="github.com/thanos-io/OpenConfig/golang/examples/helloworld" \ - --go-openconfig_out=$(REPO_ROOT_DIR)/golang/examples/helloworld/ --go-openconfig_opt=module="github.com/thanos-io/OpenConfig/golang/examples/helloworld" \ + --go_out=$(REPO_ROOT_DIR)/go/examples/helloworld/ --go_opt=module="github.com/protoconfig/protoconfig/go/examples/helloworld" \ + --go-protoconfig_out=$(REPO_ROOT_DIR)/go/examples/helloworld/ --go-protoconfig_opt=module="github.com/protoconfig/protoconfig/go/examples/helloworld" \ $(REPO_ROOT_DIR)/proto/examples/helloworld/v1/helloworld.proto .PHONY: check-git diff --git a/golang/compatibility.go b/go/compatibility.go similarity index 75% rename from golang/compatibility.go rename to go/compatibility.go index af654e7..ae7d19f 100644 --- a/golang/compatibility.go +++ b/go/compatibility.go @@ -1,7 +1,7 @@ -package openconfig +package protoconfig // The SupportPackageIsVersion variables are referenced from generated protocol -// buffer files to ensure compatibility with the OpenConfig version used. The latest +// buffer files to ensure compatibility with the ProtoConfig version used. The latest // support package version is 1. // // Older versions are kept for compatibility. They may be removed if diff --git a/golang/configurable.go b/go/configurable.go similarity index 62% rename from golang/configurable.go rename to go/configurable.go index d64a89f..c65160b 100644 --- a/golang/configurable.go +++ b/go/configurable.go @@ -1,14 +1,14 @@ -package openconfig +package protoconfig type Configurable interface { // Decode parses byte slice as `Encoded Configuration Message` in JSON or proto format and unmarshal it on - // the Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion + // the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion // (validation, default values etc). - // Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `OpenConfig 1.0` extension support. + // Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support. Decode(ecm []byte) error // DecodeString parses string `Encoded Configuration Message` in JSON or proto format and unmarshal it on - // the Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion + // the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion // (validation, default values etc). - // Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `OpenConfig 1.0` extension support. + // Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support. DecodeString(ecm string) error } diff --git a/golang/configurator.go b/go/configurator.go similarity index 50% rename from golang/configurator.go rename to go/configurator.go index d65d0a9..a5430ed 100644 --- a/golang/configurator.go +++ b/go/configurator.go @@ -1,17 +1,17 @@ -package openconfig +package protoconfig // Configurator allows to produce `Encoded Configuration Messages` from the `Configuration Proto Definition`. type Configurator interface { // Encode encodes self as `Encoded Configuration Message` in proto format so it can be understood and - // passed to Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion + // passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion // (validation, default values etc). - // Use `proto.Marshal` encoding without `OpenConfig 1.0` extension support. + // Use `proto.Marshal` encoding without `ProtoConfig 1.0` extension support. Encode() ([]byte, error) // EncodeJSON encodes self as `Encoded Configuration Message` in JSON format so it can be understood and - // passed to Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion - // Use `protojson.Marshal` encoding without `OpenConfig 1.0` extension support. + // passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion + // Use `protojson.Marshal` encoding without `ProtoConfig 1.0` extension support. EncodeJSON() ([]byte, error) - // Metadata returns metadata defined in `OpenConfig Proto Extensions Format 1.0`. + // Metadata returns metadata defined in `Proto Config Extensions Format 1.0`. Metadata() Metadata } diff --git a/go/examples/README.md b/go/examples/README.md new file mode 100644 index 0000000..3ad2c2b --- /dev/null +++ b/go/examples/README.md @@ -0,0 +1,76 @@ +## Go: OpenConfg 1.0 Examples + +### Prerequisites + +* [Go](https://golang.org/) + +For installation instructions, see [Go’s Getting Started guide](https://golang.org/doc/install). + +* [Protocol buffer compiler](https://developers.google.com/protocol-buffers) (`protoc`), [version 3](https://developers.google.com/protocol-buffers/docs/proto3). + +For installation instructions, see [Protocol Buffer Compiler Installation](https://grpc.io/docs/protoc-installation/). + +* Go plugins for the protocol compiler: + + 1. Install the protocol compiler plugins for Go and ProtoConfig using the following commands: + + ```bash + export GO111MODULE=on # Enable module mode + go get google.golang.org/protobuf/cmd/protoc-gen-go \ + github.com/protoconfig/protoconfig/go/protoc-gen-go-protoconfig + ``` + + 1. Update your PATH so that the protoc compiler can find the plugins: + + ```bash + export PATH="$PATH:$(go env GOPATH)/bin + ``` + +### Steps + +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) + +This file is just `.proto` with a couple of options from few extensions: + +* `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. +* `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! + +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. + +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, + it's not readable much. Check [go.dev](https://pkg.go.dev/github.com/protoconfig/protoconfig/go/examples) instead! (It's go code after all and supports `godoc`!) + +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. + +3. Change directory to our quick start example directory for Go `cd go/examples/helloworld` + +4. In this directory, on top of generated Go code for `helloworld` `Configuration Proto Definition` we see a couple of directories: + +* `./configurable` is an `ProtoConfig 1.0` compliant `helloword` application that just allows `ProtoConfig` for configuration. +* `./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. +* `./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. +* `./configurator` is `helloworld` application client that configures (by executing it in another process) in couple different ways in order +to get `(really!) Hello my world for "Alt C" in 2077 year!` string output. + +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: + +```bash +go run ./configurable-kingpinv2 hello --world="my" --year=2077 --name="Alt C" --lang=ENGLISH --add-really +``` + +But you can also use `ProtoConfig 1.0` convention!: + +```bash +go run ./configurable-kingpinv2 --protoconfigv1='{"hello": {"name": "Alt C", "year": 2077, "world": "my", "add_really": true}}' +``` + +All the above should print `(really!) Hello my world for "Alt C" in 2077 year!` + +6. Run configurator to check if all applications returns expected message by running: `go run ./configurator` + +7. Read [`./configurator`](/go/examples/helloworld/configurator/main.go) to check all different ways to configure `helloworld` `configurable` +with and without `ProtoConfig 1.0`! + +#### Updating Configuration Proto Definition + +TBD (tl;dr: `make proto`) \ No newline at end of file diff --git a/golang/examples/doc.go b/go/examples/doc.go similarity index 100% rename from golang/examples/doc.go rename to go/examples/doc.go diff --git a/golang/examples/go.mod b/go/examples/go.mod similarity index 64% rename from golang/examples/go.mod rename to go/examples/go.mod index 29da400..68a486c 100644 --- a/golang/examples/go.mod +++ b/go/examples/go.mod @@ -1,4 +1,4 @@ -module github.com/thanos-io/OpenConfig/golang/examples +module github.com/protoconfig/protoconfig/go/examples go 1.15 @@ -6,10 +6,10 @@ require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20201120081800-1786d5ef83d4 // indirect github.com/golang/protobuf v1.4.3 - github.com/thanos-io/OpenConfig/golang v0.0.0-00010101000000-000000000000 + github.com/protoconfig/protoconfig/go v0.0.0-00010101000000-000000000000 google.golang.org/protobuf v1.25.0 gopkg.in/alecthomas/kingpin.v2 v2.2.6 ) // TODO(bwplotka): Remove once dev period completes. -replace github.com/thanos-io/OpenConfig/golang => ../ +replace github.com/protoconfig/protoconfig/go => ../ diff --git a/golang/examples/go.sum b/go/examples/go.sum similarity index 100% rename from golang/examples/go.sum rename to go/examples/go.sum diff --git a/golang/examples/helloworld/app.go b/go/examples/helloworld/app.go similarity index 100% rename from golang/examples/helloworld/app.go rename to go/examples/helloworld/app.go diff --git a/golang/examples/helloworld/configurable-kingpinv2-gen/main.go b/go/examples/helloworld/configurable-kingpinv2-gen/main.go similarity index 100% rename from golang/examples/helloworld/configurable-kingpinv2-gen/main.go rename to go/examples/helloworld/configurable-kingpinv2-gen/main.go diff --git a/golang/examples/helloworld/configurable-kingpinv2/main.go b/go/examples/helloworld/configurable-kingpinv2/main.go similarity index 90% rename from golang/examples/helloworld/configurable-kingpinv2/main.go rename to go/examples/helloworld/configurable-kingpinv2/main.go index dc17a96..e7ef674 100644 --- a/golang/examples/helloworld/configurable-kingpinv2/main.go +++ b/go/examples/helloworld/configurable-kingpinv2/main.go @@ -5,7 +5,7 @@ import ( "log" "os" - helloworldpb "github.com/thanos-io/OpenConfig/golang/examples/helloworld" + helloworldpb "github.com/protoconfig/protoconfig/go/examples/helloworld" "gopkg.in/alecthomas/kingpin.v2" ) @@ -34,8 +34,8 @@ func main() { os.Exit(1) }) - // First input method: OpenConfig. - f.Flag("openconfigv1", "configuration protobuf compatible with OpenConfig 1.0 standard").StringVar(&configEncoded) + // First input method: protoconfig. + f.Flag("protoconfigv1", "configuration protobuf compatible with ProtoConfig 1.0 standard").StringVar(&configEncoded) // Second: Manually written CLI. It's a bit tedious and prone to errors, so see `configurable-kingpinv2-gen` for better approach. c := f.Command("hello", "TODO") diff --git a/golang/examples/helloworld/configurable/main.go b/go/examples/helloworld/configurable/main.go similarity index 68% rename from golang/examples/helloworld/configurable/main.go rename to go/examples/helloworld/configurable/main.go index 121de17..1104250 100644 --- a/golang/examples/helloworld/configurable/main.go +++ b/go/examples/helloworld/configurable/main.go @@ -5,7 +5,7 @@ import ( "log" "os" - helloworldpb "github.com/thanos-io/OpenConfig/golang/examples/helloworld" + helloworldpb "github.com/protoconfig/protoconfig/go/examples/helloworld" ) func main() { @@ -15,7 +15,7 @@ func main() { conf := &helloworldpb.HelloWorldConfiguration{} f := flag.NewFlagSet(conf.Metadata().Name, flag.ExitOnError) - f.StringVar(&configEncoded, "openconfigv1", "", "configuration protobuf compatible with OpenConfig 1.0 standard") + f.StringVar(&configEncoded, "protoconfigv1", "", "configuration protobuf compatible with ProtoConfig 1.0 standard") if err := f.Parse(os.Args[1:]); err != nil { log.Fatal(err) diff --git a/golang/examples/helloworld/configurator/main.go b/go/examples/helloworld/configurator/main.go similarity index 71% rename from golang/examples/helloworld/configurator/main.go rename to go/examples/helloworld/configurator/main.go index 64edf18..bb76e51 100644 --- a/golang/examples/helloworld/configurator/main.go +++ b/go/examples/helloworld/configurator/main.go @@ -6,8 +6,8 @@ import ( "os" "os/exec" - openconfig "github.com/thanos-io/OpenConfig/golang" - helloworldpb "github.com/thanos-io/OpenConfig/golang/examples/helloworld" + protoconfig "github.com/protoconfig/protoconfig/go" + helloworldpb "github.com/protoconfig/protoconfig/go/examples/helloworld" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" ) @@ -34,8 +34,8 @@ func main() { } runUsingArgs(pwd) - runUsingOpenConfig1_0_NoPlugin(pwd) - runUsingOpenConfig1_0(pwd) + runUsingProtoConfig1_0_NoPlugin(pwd) + runUsingProtoConfig1_0(pwd) } func runUsingArgs(dir string) { @@ -45,8 +45,8 @@ func runUsingArgs(dir string) { runCmdAndPrintResult(dir, "go", "run", "./configurable-kingpinv2", "hello", "--world=my", "--year=2077", "--name=Alt C", "--lang=ENGLISH", "--add-really") } -func runUsingOpenConfig1_0_NoPlugin(dir string) { - log.Println("invoking configurable using OpenConfig 1.0 (with just using native protogen-go nothing else!):") +func runUsingProtoConfig1_0_NoPlugin(dir string) { + log.Println("invoking configurable using ProtoConfig 1.0 (with just using native protogen-go nothing else!):") c := &helloworldpb.HelloWorldConfiguration{ Command: &helloworldpb.HelloWorldConfiguration_Hello{ @@ -61,18 +61,18 @@ func runUsingOpenConfig1_0_NoPlugin(dir string) { } // Prone to runtime errors, but better than args. - appName := proto.GetExtension(c.ProtoReflect().Descriptor().Options(), openconfig.E_Metadata).(*openconfig.Metadata).Name + appName := proto.GetExtension(c.ProtoReflect().Descriptor().Options(), protoconfig.E_Metadata).(*protoconfig.Metadata).Name b, err := protojson.Marshal(c) if err != nil { log.Fatal(err) } - runCmdAndPrintResult(dir, "go", "run", "./"+appName, "--openconfigv1="+string(b)) - runCmdAndPrintResult(dir, "go", "run", "./"+appName+"-kingpinv2", "--openconfigv1="+string(b)) + runCmdAndPrintResult(dir, "go", "run", "./"+appName, "--protoconfigv1="+string(b)) + runCmdAndPrintResult(dir, "go", "run", "./"+appName+"-kingpinv2", "--protoconfigv1="+string(b)) } -func runUsingOpenConfig1_0(dir string) { +func runUsingProtoConfig1_0(dir string) { c := &helloworldpb.HelloWorldConfiguration{ Command: helloworldpb.NewHelloCommand(&helloworldpb.HelloCommand{ World: "my", @@ -83,26 +83,26 @@ func runUsingOpenConfig1_0(dir string) { }), } - log.Println("invoking configurable using OpenConfig 1.0 (EncodeJSON):") + log.Println("invoking configurable using ProtoConfig 1.0 (EncodeJSON):") b, err := c.EncodeJSON() if err != nil { log.Fatal(err) } - runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name, "--openconfigv1="+string(b)) - runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name+"-kingpinv2", "--openconfigv1="+string(b)) + runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name, "--protoconfigv1="+string(b)) + runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name+"-kingpinv2", "--protoconfigv1="+string(b)) - log.Println("invoking configurable using OpenConfig 1.0 (Marshal):") + log.Println("invoking configurable using ProtoConfig 1.0 (Marshal):") b, err = c.Encode() if err != nil { log.Fatal(err) } - runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name, "--openconfigv1="+string(b)) - runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name+"-kingpinv2", "--openconfigv1="+string(b)) + runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name, "--protoconfigv1="+string(b)) + runCmdAndPrintResult(dir, "go", "run", "./"+c.Metadata().Name+"-kingpinv2", "--protoconfigv1="+string(b)) - log.Println("invoking configurable using OpenConfig 1.0 (CommandLineArgument()):") + log.Println("invoking configurable using ProtoConfig 1.0 (CommandLineArgument()):") arg, err := c.CommandLineArgument() if err != nil { diff --git a/golang/examples/helloworld/helloworld.pb.go b/go/examples/helloworld/helloworld.pb.go similarity index 91% rename from golang/examples/helloworld/helloworld.pb.go rename to go/examples/helloworld/helloworld.pb.go index a9ae579..c2b00bb 100644 --- a/golang/examples/helloworld/helloworld.pb.go +++ b/go/examples/helloworld/helloworld.pb.go @@ -8,8 +8,8 @@ package helloworldpb import ( proto "github.com/golang/protobuf/proto" - _ "github.com/thanos-io/OpenConfig/golang" - _ "github.com/thanos-io/OpenConfig/golang/kingpinv2" + _ "github.com/protoconfig/protoconfig/go" + _ "github.com/protoconfig/protoconfig/go/kingpinv2" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -538,26 +538,26 @@ var file_examples_helloworld_v1_helloworld_proto_rawDesc = []byte{ 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, - 0x31, 0x1a, 0x1e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, - 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, - 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2f, 0x76, + 0x31, 0x1a, 0x1f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xf9, 0x01, 0x0a, 0x17, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x57, 0x6f, 0x72, 0x6c, - 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3c, - 0x0a, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, - 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x36, 0x0a, 0x03, - 0x62, 0x79, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, - 0x76, 0x31, 0x2e, 0x42, 0x79, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, - 0x03, 0x62, 0x79, 0x65, 0x3a, 0x5d, 0xc2, 0xb8, 0x02, 0x59, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x05, 0x30, 0x2e, 0x31, 0x2e, 0x30, 0x1a, - 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x68, 0x6f, 0x77, 0x63, 0x61, 0x73, 0x65, - 0x20, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x20, 0x31, 0x2e, 0x30, 0x2e, - 0xb2, 0x06, 0x10, 0x0a, 0x0e, 0x2d, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x74, 0x6f, 0x1a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, + 0x67, 0x6f, 0x2f, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2f, 0x76, 0x31, 0x2f, + 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xfb, 0x01, 0x0a, 0x17, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3c, 0x0a, 0x05, + 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, + 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x48, 0x00, 0x52, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x36, 0x0a, 0x03, 0x62, 0x79, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, + 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, + 0x2e, 0x42, 0x79, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x03, 0x62, + 0x79, 0x65, 0x3a, 0x5f, 0xc2, 0xb8, 0x02, 0x5b, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x05, 0x30, 0x2e, 0x31, 0x2e, 0x30, 0x1a, 0x30, 0x65, + 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x68, 0x6f, 0x77, 0x63, 0x61, 0x73, 0x65, 0x20, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x20, 0x31, 0x2e, 0x30, 0x2e, 0xb2, + 0x06, 0x11, 0x0a, 0x0f, 0x2d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x76, 0x31, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0xf0, 0x01, 0x0a, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xd0, @@ -620,13 +620,13 @@ var file_examples_helloworld_v1_helloworld_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x4e, 0x47, 0x4c, 0x49, 0x53, 0x48, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x4f, 0x4c, 0x49, 0x53, 0x48, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x45, 0x52, 0x4d, - 0x41, 0x4e, 0x10, 0x03, 0x42, 0x87, 0x01, 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, - 0x6c, 0x64, 0x42, 0x0f, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x74, 0x68, 0x61, 0x6e, 0x6f, 0x73, 0x2d, 0x69, 0x6f, 0x2f, 0x4f, 0x70, 0x65, 0x6e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x65, 0x78, + 0x41, 0x4e, 0x10, 0x03, 0x42, 0x87, 0x01, 0x0a, 0x2a, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, + 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, + 0x72, 0x6c, 0x64, 0x42, 0x0f, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x3b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, diff --git a/golang/examples/helloworld/helloworld_openconfig.pb.go b/go/examples/helloworld/helloworld_protoconfig.pb.go similarity index 57% rename from golang/examples/helloworld/helloworld_openconfig.pb.go rename to go/examples/helloworld/helloworld_protoconfig.pb.go index aef22e2..0dbf96d 100644 --- a/golang/examples/helloworld/helloworld_openconfig.pb.go +++ b/go/examples/helloworld/helloworld_protoconfig.pb.go @@ -1,18 +1,18 @@ -// Code generated by protoc-gen-go-openconfig code. DO NOT EDIT. +// Code generated by protoc-gen-go-protoconfig code. DO NOT EDIT. package helloworldpb import ( bytes "bytes" fmt "fmt" - golang "github.com/thanos-io/OpenConfig/golang" + _go "github.com/protoconfig/protoconfig/go" protojson "google.golang.org/protobuf/encoding/protojson" proto "google.golang.org/protobuf/proto" ) // This is a compile-time assertion to ensure that this generated file -// is compatible with the OpenConfig golang package it is being compiled against. -const _ = golang.SupportPackageIsVersion1 +// is compatible with the ProtoConfig golang package it is being compiled against. +const _ = _go.SupportPackageIsVersion1 func NewHelloCommand(x *HelloCommand) *HelloWorldConfiguration_Hello { return &HelloWorldConfiguration_Hello{Hello: x} @@ -31,30 +31,30 @@ func NewByeConfigurableCommand(x *ByeConfigurableCommand) *ByeCommand_Configurab } // Encode encodes self as `Encoded Configuration Message` in proto format so it can be understood and -// passed to Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion +// passed to Configurable struct. It supports all `ProtoProto Config Extensions Format 1.0` extenstion // (validation, default values etc). -// Use `proto.Marshal` encoding without `OpenConfig 1.0` extension support. +// Use `proto.Marshal` encoding without `ProtoConfig 1.0` extension support. func (x *HelloWorldConfiguration) Encode() ([]byte, error) { - // TODO(bwplotka): Actually implement validation for `OpenConfig Proto Extensions Format 1.0` (: + // TODO(bwplotka): Actually implement validation for `ProtoProto Config Extensions Format 1.0` (: return proto.Marshal(x) } // EncodeJSON encodes self as `Encoded Configuration Message` in JSON format so it can be understood and -// passed to Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion +// passed to Configurable struct. It supports all `ProtoProto Config Extensions Format 1.0` extenstion // (validation, default values etc). -// Use `protojson.Marshal` encoding without `OpenConfig 1.0` extension support. +// Use `protojson.Marshal` encoding without `ProtoConfig 1.0` extension support. func (x *HelloWorldConfiguration) EncodeJSON() ([]byte, error) { - // TODO(bwplotka): Actually implement validation for `OpenConfig Proto Extensions Format 1.0` (: + // TODO(bwplotka): Actually implement validation for `ProtoProto Config Extensions Format 1.0` (: return protojson.Marshal(x) } -// Metadata returns metadata defined in `OpenConfig Proto Extensions Format 1.0`. -func (x *HelloWorldConfiguration) Metadata() golang.Metadata { - return golang.Metadata{ +// Metadata returns metadata defined in `ProtoProto Config Extensions Format 1.0`. +func (x *HelloWorldConfiguration) Metadata() _go.Metadata { + return _go.Metadata{ Name: "configurable", Version: "0.1.0", - Description: "example application to showcase OpenConfig 1.0.", - DeliveryMechanism: &golang.Metadata_FlagDelivery{FlagDelivery: &golang.FlagDelivery{Name: "--openconfigv1"}}, + Description: "example application to showcase ProtoConfig 1.0.", + DeliveryMechanism: &_go.Metadata_FlagDelivery{FlagDelivery: &_go.FlagDelivery{Name: "--protoconfigv1"}}, } } @@ -63,19 +63,19 @@ func (x *HelloWorldConfiguration) CommandLineArgument() (string, error) { if err != nil { return "", err } - return fmt.Sprintf("--openconfigv1=%s", b), nil + return fmt.Sprintf("--protoconfigv1=%s", b), nil } // This is a compile-time assertion to ensure that extended HelloWorldConfiguration implements -// golang.Configurator interface. -var _ golang.Configurator = &HelloWorldConfiguration{} +// _go.Configurator interface. +var _ _go.Configurator = &HelloWorldConfiguration{} // Decode parses byte slice as `Encoded Configuration Message` in JSON or proto format and unmarshal it on -// the Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion +// the Configurable struct. It supports all `ProtoProto Config Extensions Format 1.0` extenstion // (validation, default values etc). -// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `OpenConfig 1.0` extension support. +// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support. func (x *HelloWorldConfiguration) Decode(ecm []byte) error { - // TODO(bwplotka): Actually implement validation for `OpenConfig Proto Extensions Format 1.0` (: + // TODO(bwplotka): Actually implement validation for `ProtoProto Config Extensions Format 1.0` (: if isJSON(ecm) { return protojson.Unmarshal(ecm, x) } @@ -83,9 +83,9 @@ func (x *HelloWorldConfiguration) Decode(ecm []byte) error { } // DecodeString parses string as `Encoded Configuration Message` in JSON or proto format and unmarshal it on -// the Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion +// the Configurable struct. It supports all `ProtoProto Config Extensions Format 1.0` extenstion // (validation, default values etc). -// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `OpenConfig 1.0` extension support. +// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support. func (x *HelloWorldConfiguration) DecodeString(ecm string) error { return x.Decode([]byte(ecm)) } @@ -99,5 +99,5 @@ func isJSON(b []byte) bool { } // This is a compile-time assertion to ensure that extended HelloWorldConfiguration implements -// golang.Configurable interface. -var _ golang.Configurable = &HelloWorldConfiguration{} +// _go.Configurable interface. +var _ _go.Configurable = &HelloWorldConfiguration{} diff --git a/golang/extensions.pb.go b/go/extensions.pb.go similarity index 51% rename from golang/extensions.pb.go rename to go/extensions.pb.go index f3faf78..7434489 100644 --- a/golang/extensions.pb.go +++ b/go/extensions.pb.go @@ -2,21 +2,21 @@ // versions: // protoc-gen-go v1.25.0 // protoc v3.13.0 -// source: openconfig/v1/extensions.proto +// source: protoconfig/v1/extensions.proto -// OpenConfig Proto Extensions Format 1.0. +// ProtoProto Config Extensions Format 1.0. // // This defines extensions to protocol-buffer-compatible language that is build on proto version 3 with protobuf custom options. // -// OpenConfig Extensions allows software authors to define metadata about required configuration like default values or field +// ProtoConfig Extensions allows software authors to define metadata about required configuration like default values or field // optionality etc. // // Extension can be used as natively described in https://developers.google.com/protocol-buffers/docs/proto#customoptions // // Below extensions are not mandatory to use while defining your configuration, but mandatory to be implemented by -// OpenConfig 1.0 compatible parsers and generators. +// ProtoConfig 1.0 compatible parsers and generators. -package openconfig +package protoconfig import ( proto "github.com/golang/protobuf/proto" @@ -66,7 +66,7 @@ type Metadata struct { func (x *Metadata) Reset() { *x = Metadata{} if protoimpl.UnsafeEnabled { - mi := &file_openconfig_v1_extensions_proto_msgTypes[0] + mi := &file_protoconfig_v1_extensions_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79,7 +79,7 @@ func (x *Metadata) String() string { func (*Metadata) ProtoMessage() {} func (x *Metadata) ProtoReflect() protoreflect.Message { - mi := &file_openconfig_v1_extensions_proto_msgTypes[0] + mi := &file_protoconfig_v1_extensions_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92,7 +92,7 @@ func (x *Metadata) ProtoReflect() protoreflect.Message { // Deprecated: Use Metadata.ProtoReflect.Descriptor instead. func (*Metadata) Descriptor() ([]byte, []int) { - return file_openconfig_v1_extensions_proto_rawDescGZIP(), []int{0} + return file_protoconfig_v1_extensions_proto_rawDescGZIP(), []int{0} } func (x *Metadata) GetName() string { @@ -162,7 +162,7 @@ type StdinDelivery struct { func (x *StdinDelivery) Reset() { *x = StdinDelivery{} if protoimpl.UnsafeEnabled { - mi := &file_openconfig_v1_extensions_proto_msgTypes[1] + mi := &file_protoconfig_v1_extensions_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -175,7 +175,7 @@ func (x *StdinDelivery) String() string { func (*StdinDelivery) ProtoMessage() {} func (x *StdinDelivery) ProtoReflect() protoreflect.Message { - mi := &file_openconfig_v1_extensions_proto_msgTypes[1] + mi := &file_protoconfig_v1_extensions_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -188,7 +188,7 @@ func (x *StdinDelivery) ProtoReflect() protoreflect.Message { // Deprecated: Use StdinDelivery.ProtoReflect.Descriptor instead. func (*StdinDelivery) Descriptor() ([]byte, []int) { - return file_openconfig_v1_extensions_proto_rawDescGZIP(), []int{1} + return file_protoconfig_v1_extensions_proto_rawDescGZIP(), []int{1} } type FlagDelivery struct { @@ -197,14 +197,14 @@ type FlagDelivery struct { unknownFields protoimpl.UnknownFields /// name represents custom flag name (including `-` if any) for a flag that consumes bytes of `Encoded Configuration Message` - // OpenConfig 1.0 recommends `--openconfigv1` name. + // ProtoConfig 1.0 recommends `--protoconfigv1` name. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } func (x *FlagDelivery) Reset() { *x = FlagDelivery{} if protoimpl.UnsafeEnabled { - mi := &file_openconfig_v1_extensions_proto_msgTypes[2] + mi := &file_protoconfig_v1_extensions_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -217,7 +217,7 @@ func (x *FlagDelivery) String() string { func (*FlagDelivery) ProtoMessage() {} func (x *FlagDelivery) ProtoReflect() protoreflect.Message { - mi := &file_openconfig_v1_extensions_proto_msgTypes[2] + mi := &file_protoconfig_v1_extensions_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -230,7 +230,7 @@ func (x *FlagDelivery) ProtoReflect() protoreflect.Message { // Deprecated: Use FlagDelivery.ProtoReflect.Descriptor instead. func (*FlagDelivery) Descriptor() ([]byte, []int) { - return file_openconfig_v1_extensions_proto_rawDescGZIP(), []int{2} + return file_protoconfig_v1_extensions_proto_rawDescGZIP(), []int{2} } func (x *FlagDelivery) GetName() string { @@ -240,46 +240,46 @@ func (x *FlagDelivery) GetName() string { return "" } -var file_openconfig_v1_extensions_proto_extTypes = []protoimpl.ExtensionInfo{ +var file_protoconfig_v1_extensions_proto_extTypes = []protoimpl.ExtensionInfo{ { ExtendedType: (*descriptor.MessageOptions)(nil), ExtensionType: (*Metadata)(nil), Field: 5000, - Name: "openconfig.v1.metadata", + Name: "protoconfig.v1.metadata", Tag: "bytes,5000,opt,name=metadata", - Filename: "openconfig/v1/extensions.proto", + Filename: "protoconfig/v1/extensions.proto", }, { ExtendedType: (*descriptor.FieldOptions)(nil), ExtensionType: (*string)(nil), Field: 5000, - Name: "openconfig.v1.default", + Name: "protoconfig.v1.default", Tag: "bytes,5000,opt,name=default", - Filename: "openconfig/v1/extensions.proto", + Filename: "protoconfig/v1/extensions.proto", }, { ExtendedType: (*descriptor.FieldOptions)(nil), ExtensionType: (*bool)(nil), Field: 5001, - Name: "openconfig.v1.hidden", + Name: "protoconfig.v1.hidden", Tag: "varint,5001,opt,name=hidden", - Filename: "openconfig/v1/extensions.proto", + Filename: "protoconfig/v1/extensions.proto", }, { ExtendedType: (*descriptor.FieldOptions)(nil), ExtensionType: (*bool)(nil), Field: 5002, - Name: "openconfig.v1.required", + Name: "protoconfig.v1.required", Tag: "varint,5002,opt,name=required", - Filename: "openconfig/v1/extensions.proto", + Filename: "protoconfig/v1/extensions.proto", }, { ExtendedType: (*descriptor.FieldOptions)(nil), ExtensionType: (*bool)(nil), Field: 5003, - Name: "openconfig.v1.experimental", + Name: "protoconfig.v1.experimental", Tag: "varint,5003,opt,name=experimental", - Filename: "openconfig/v1/extensions.proto", + Filename: "protoconfig/v1/extensions.proto", }, } @@ -287,8 +287,8 @@ var file_openconfig_v1_extensions_proto_extTypes = []protoimpl.ExtensionInfo{ var ( /// metadata represents // - // optional openconfig.v1.Metadata metadata = 5000; - E_Metadata = &file_openconfig_v1_extensions_proto_extTypes[0] + // optional protoconfig.v1.Metadata metadata = 5000; + E_Metadata = &file_protoconfig_v1_extensions_proto_extTypes[0] ) // Extension fields to descriptor.FieldOptions. @@ -296,106 +296,106 @@ var ( /// default represents an option that sets a default value for the field. // // optional string default = 5000; - E_Default = &file_openconfig_v1_extensions_proto_extTypes[1] + E_Default = &file_protoconfig_v1_extensions_proto_extTypes[1] /// hidden represents an option that marks a field as hidden. What it actually causes is up to the Configurable. - /// OpenConfig 1.0 recommends hiding it from the documentation. + /// ProtoConfig 1.0 recommends hiding it from the documentation. // // optional bool hidden = 5001; - E_Hidden = &file_openconfig_v1_extensions_proto_extTypes[2] + E_Hidden = &file_protoconfig_v1_extensions_proto_extTypes[2] /// required represents an option that marks a field as mandatory and if empty, Configurable does not accept the whole configuration. // // optional bool required = 5002; - E_Required = &file_openconfig_v1_extensions_proto_extTypes[3] + E_Required = &file_protoconfig_v1_extensions_proto_extTypes[3] /// experimental represents an option that marks a field as experimental. What it actually causes is up to the Configurable. - /// OpenConfig 1.0 recommends warning in the documentation. + /// ProtoConfig 1.0 recommends warning in the documentation. // // optional bool experimental = 5003; - E_Experimental = &file_openconfig_v1_extensions_proto_extTypes[4] + E_Experimental = &file_protoconfig_v1_extensions_proto_extTypes[4] ) -var File_openconfig_v1_extensions_proto protoreflect.FileDescriptor - -var file_openconfig_v1_extensions_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, 0x2f, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0d, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x1a, - 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xfb, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x45, - 0x0a, 0x0e, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, - 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x69, - 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x44, 0x65, 0x6c, - 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x42, 0x0a, 0x0d, 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x64, 0x65, - 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, - 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, - 0x67, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0c, 0x66, 0x6c, 0x61, - 0x67, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x42, 0x14, 0x0a, 0x12, 0x64, 0x65, 0x6c, - 0x69, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x63, 0x68, 0x61, 0x6e, 0x69, 0x73, 0x6d, 0x22, - 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, - 0x22, 0x22, 0x0a, 0x0c, 0x46, 0x6c, 0x61, 0x67, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, +var File_protoconfig_v1_extensions_proto protoreflect.FileDescriptor + +var file_protoconfig_v1_extensions_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x31, + 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, + 0x31, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xfd, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x55, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x88, 0x27, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x38, 0x0a, 0x07, 0x64, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x3a, 0x36, 0x0a, 0x06, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x12, - 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x89, - 0x27, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x3a, 0x3a, 0x0a, - 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x8a, 0x27, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x3a, 0x42, 0x0a, 0x0c, 0x65, 0x78, 0x70, - 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x8b, 0x27, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x42, 0x33, 0x5a, - 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x68, 0x61, 0x6e, - 0x6f, 0x73, 0x2d, 0x69, 0x6f, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x3b, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, + 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x46, 0x0a, 0x0e, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, + 0x72, 0x79, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x44, + 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0d, 0x73, 0x74, 0x64, 0x69, 0x6e, + 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x43, 0x0a, 0x0d, 0x66, 0x6c, 0x61, 0x67, + 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, + 0x2e, 0x46, 0x6c, 0x61, 0x67, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, + 0x0c, 0x66, 0x6c, 0x61, 0x67, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x42, 0x14, 0x0a, + 0x12, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x63, 0x68, 0x61, 0x6e, + 0x69, 0x73, 0x6d, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x69, + 0x76, 0x65, 0x72, 0x79, 0x22, 0x22, 0x0a, 0x0c, 0x46, 0x6c, 0x61, 0x67, 0x44, 0x65, 0x6c, 0x69, + 0x76, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x56, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x27, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x3a, 0x38, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x27, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x3a, 0x36, 0x0a, 0x06, 0x68, 0x69, + 0x64, 0x64, 0x65, 0x6e, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x89, 0x27, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x69, 0x64, 0x64, + 0x65, 0x6e, 0x3a, 0x3a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x1d, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x8a, 0x27, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x3a, 0x42, + 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x12, 0x1d, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x8b, 0x27, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, + 0x61, 0x6c, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 0x3b, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_openconfig_v1_extensions_proto_rawDescOnce sync.Once - file_openconfig_v1_extensions_proto_rawDescData = file_openconfig_v1_extensions_proto_rawDesc + file_protoconfig_v1_extensions_proto_rawDescOnce sync.Once + file_protoconfig_v1_extensions_proto_rawDescData = file_protoconfig_v1_extensions_proto_rawDesc ) -func file_openconfig_v1_extensions_proto_rawDescGZIP() []byte { - file_openconfig_v1_extensions_proto_rawDescOnce.Do(func() { - file_openconfig_v1_extensions_proto_rawDescData = protoimpl.X.CompressGZIP(file_openconfig_v1_extensions_proto_rawDescData) +func file_protoconfig_v1_extensions_proto_rawDescGZIP() []byte { + file_protoconfig_v1_extensions_proto_rawDescOnce.Do(func() { + file_protoconfig_v1_extensions_proto_rawDescData = protoimpl.X.CompressGZIP(file_protoconfig_v1_extensions_proto_rawDescData) }) - return file_openconfig_v1_extensions_proto_rawDescData + return file_protoconfig_v1_extensions_proto_rawDescData } -var file_openconfig_v1_extensions_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_openconfig_v1_extensions_proto_goTypes = []interface{}{ - (*Metadata)(nil), // 0: openconfig.v1.Metadata - (*StdinDelivery)(nil), // 1: openconfig.v1.StdinDelivery - (*FlagDelivery)(nil), // 2: openconfig.v1.FlagDelivery +var file_protoconfig_v1_extensions_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_protoconfig_v1_extensions_proto_goTypes = []interface{}{ + (*Metadata)(nil), // 0: protoconfig.v1.Metadata + (*StdinDelivery)(nil), // 1: protoconfig.v1.StdinDelivery + (*FlagDelivery)(nil), // 2: protoconfig.v1.FlagDelivery (*descriptor.MessageOptions)(nil), // 3: google.protobuf.MessageOptions (*descriptor.FieldOptions)(nil), // 4: google.protobuf.FieldOptions } -var file_openconfig_v1_extensions_proto_depIdxs = []int32{ - 1, // 0: openconfig.v1.Metadata.stdin_delivery:type_name -> openconfig.v1.StdinDelivery - 2, // 1: openconfig.v1.Metadata.flag_delivery:type_name -> openconfig.v1.FlagDelivery - 3, // 2: openconfig.v1.metadata:extendee -> google.protobuf.MessageOptions - 4, // 3: openconfig.v1.default:extendee -> google.protobuf.FieldOptions - 4, // 4: openconfig.v1.hidden:extendee -> google.protobuf.FieldOptions - 4, // 5: openconfig.v1.required:extendee -> google.protobuf.FieldOptions - 4, // 6: openconfig.v1.experimental:extendee -> google.protobuf.FieldOptions - 0, // 7: openconfig.v1.metadata:type_name -> openconfig.v1.Metadata +var file_protoconfig_v1_extensions_proto_depIdxs = []int32{ + 1, // 0: protoconfig.v1.Metadata.stdin_delivery:type_name -> protoconfig.v1.StdinDelivery + 2, // 1: protoconfig.v1.Metadata.flag_delivery:type_name -> protoconfig.v1.FlagDelivery + 3, // 2: protoconfig.v1.metadata:extendee -> google.protobuf.MessageOptions + 4, // 3: protoconfig.v1.default:extendee -> google.protobuf.FieldOptions + 4, // 4: protoconfig.v1.hidden:extendee -> google.protobuf.FieldOptions + 4, // 5: protoconfig.v1.required:extendee -> google.protobuf.FieldOptions + 4, // 6: protoconfig.v1.experimental:extendee -> google.protobuf.FieldOptions + 0, // 7: protoconfig.v1.metadata:type_name -> protoconfig.v1.Metadata 8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method input_type 7, // [7:8] is the sub-list for extension type_name @@ -403,13 +403,13 @@ var file_openconfig_v1_extensions_proto_depIdxs = []int32{ 0, // [0:2] is the sub-list for field type_name } -func init() { file_openconfig_v1_extensions_proto_init() } -func file_openconfig_v1_extensions_proto_init() { - if File_openconfig_v1_extensions_proto != nil { +func init() { file_protoconfig_v1_extensions_proto_init() } +func file_protoconfig_v1_extensions_proto_init() { + if File_protoconfig_v1_extensions_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_openconfig_v1_extensions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_protoconfig_v1_extensions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Metadata); i { case 0: return &v.state @@ -421,7 +421,7 @@ func file_openconfig_v1_extensions_proto_init() { return nil } } - file_openconfig_v1_extensions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_protoconfig_v1_extensions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StdinDelivery); i { case 0: return &v.state @@ -433,7 +433,7 @@ func file_openconfig_v1_extensions_proto_init() { return nil } } - file_openconfig_v1_extensions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_protoconfig_v1_extensions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlagDelivery); i { case 0: return &v.state @@ -446,7 +446,7 @@ func file_openconfig_v1_extensions_proto_init() { } } } - file_openconfig_v1_extensions_proto_msgTypes[0].OneofWrappers = []interface{}{ + file_protoconfig_v1_extensions_proto_msgTypes[0].OneofWrappers = []interface{}{ (*Metadata_StdinDelivery)(nil), (*Metadata_FlagDelivery)(nil), } @@ -454,19 +454,19 @@ func file_openconfig_v1_extensions_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_openconfig_v1_extensions_proto_rawDesc, + RawDescriptor: file_protoconfig_v1_extensions_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 5, NumServices: 0, }, - GoTypes: file_openconfig_v1_extensions_proto_goTypes, - DependencyIndexes: file_openconfig_v1_extensions_proto_depIdxs, - MessageInfos: file_openconfig_v1_extensions_proto_msgTypes, - ExtensionInfos: file_openconfig_v1_extensions_proto_extTypes, + GoTypes: file_protoconfig_v1_extensions_proto_goTypes, + DependencyIndexes: file_protoconfig_v1_extensions_proto_depIdxs, + MessageInfos: file_protoconfig_v1_extensions_proto_msgTypes, + ExtensionInfos: file_protoconfig_v1_extensions_proto_extTypes, }.Build() - File_openconfig_v1_extensions_proto = out.File - file_openconfig_v1_extensions_proto_rawDesc = nil - file_openconfig_v1_extensions_proto_goTypes = nil - file_openconfig_v1_extensions_proto_depIdxs = nil + File_protoconfig_v1_extensions_proto = out.File + file_protoconfig_v1_extensions_proto_rawDesc = nil + file_protoconfig_v1_extensions_proto_goTypes = nil + file_protoconfig_v1_extensions_proto_depIdxs = nil } diff --git a/golang/go.mod b/go/go.mod similarity index 66% rename from golang/go.mod rename to go/go.mod index 8e85c30..bfcab54 100644 --- a/golang/go.mod +++ b/go/go.mod @@ -1,4 +1,4 @@ -module github.com/thanos-io/OpenConfig/golang +module github.com/protoconfig/protoconfig/go go 1.15 diff --git a/golang/go.sum b/go/go.sum similarity index 100% rename from golang/go.sum rename to go/go.sum diff --git a/go/kingpinv2/extensions.pb.go b/go/kingpinv2/extensions.pb.go new file mode 100644 index 0000000..da594bd --- /dev/null +++ b/go/kingpinv2/extensions.pb.go @@ -0,0 +1,509 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.13.0 +// source: protoconfig/go/kingpinv2/v1/extensions.proto + +// Extensions based on https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2 + +package kingpinv2 + +import ( + proto "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + any "github.com/golang/protobuf/ptypes/any" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// Content is byte steam created from PathOrContent flag, a custom extension built on top of kingpin.v2 flags type. +type Content struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Content *any.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` // any proto.Message +} + +func (x *Content) Reset() { + *x = Content{} + if protoimpl.UnsafeEnabled { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Content) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Content) ProtoMessage() {} + +func (x *Content) ProtoReflect() protoreflect.Message { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Content.ProtoReflect.Descriptor instead. +func (*Content) Descriptor() ([]byte, []int) { + return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{0} +} + +func (x *Content) GetContent() *any.Any { + if x != nil { + return x.Content + } + return nil +} + +// ExistingFile represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.ExistingFile. +// repeated ExistingFile represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.ExistingFiles. +type ExistingFile struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + File *any.Any `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"` // *os.File +} + +func (x *ExistingFile) Reset() { + *x = ExistingFile{} + if protoimpl.UnsafeEnabled { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExistingFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExistingFile) ProtoMessage() {} + +func (x *ExistingFile) ProtoReflect() protoreflect.Message { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExistingFile.ProtoReflect.Descriptor instead. +func (*ExistingFile) Descriptor() ([]byte, []int) { + return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{1} +} + +func (x *ExistingFile) GetFile() *any.Any { + if x != nil { + return x.File + } + return nil +} + +// IP represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.IP. +// repeated IP represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.IPList. +type IP struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ip *any.Any `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` // *net.IP +} + +func (x *IP) Reset() { + *x = IP{} + if protoimpl.UnsafeEnabled { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IP) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IP) ProtoMessage() {} + +func (x *IP) ProtoReflect() protoreflect.Message { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IP.ProtoReflect.Descriptor instead. +func (*IP) Descriptor() ([]byte, []int) { + return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{2} +} + +func (x *IP) GetIp() *any.Any { + if x != nil { + return x.Ip + } + return nil +} + +// Regexp represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.Regexp. +// repeated Regexp represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.RegexpList. +type Regexp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Regexp *any.Any `protobuf:"bytes,1,opt,name=regexp,proto3" json:"regexp,omitempty"` // **regexp.Regexp +} + +func (x *Regexp) Reset() { + *x = Regexp{} + if protoimpl.UnsafeEnabled { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Regexp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Regexp) ProtoMessage() {} + +func (x *Regexp) ProtoReflect() protoreflect.Message { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Regexp.ProtoReflect.Descriptor instead. +func (*Regexp) Descriptor() ([]byte, []int) { + return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{3} +} + +func (x *Regexp) GetRegexp() *any.Any { + if x != nil { + return x.Regexp + } + return nil +} + +type Command struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Command) Reset() { + *x = Command{} + if protoimpl.UnsafeEnabled { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Command) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Command) ProtoMessage() {} + +func (x *Command) ProtoReflect() protoreflect.Message { + mi := &file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Command.ProtoReflect.Descriptor instead. +func (*Command) Descriptor() ([]byte, []int) { + return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{4} +} + +func (x *Command) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 6000, + Name: "protoconfig.golang.kingpinv2.v1.placeholder", + Tag: "bytes,6000,opt,name=placeholder", + Filename: "protoconfig/go/kingpinv2/v1/extensions.proto", + }, + { + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 6001, + Name: "protoconfig.golang.kingpinv2.v1.envvar", + Tag: "bytes,6001,opt,name=envvar", + Filename: "protoconfig/go/kingpinv2/v1/extensions.proto", + }, + { + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 6002, + Name: "protoconfig.golang.kingpinv2.v1.argument", + Tag: "varint,6002,opt,name=argument", + Filename: "protoconfig/go/kingpinv2/v1/extensions.proto", + }, + { + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*Command)(nil), + Field: 6002, + Name: "protoconfig.golang.kingpinv2.v1.command", + Tag: "bytes,6002,opt,name=command", + Filename: "protoconfig/go/kingpinv2/v1/extensions.proto", + }, +} + +// Extension fields to descriptor.FieldOptions. +var ( + // optional string placeholder = 6000; + E_Placeholder = &file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes[0] + // optional string envvar = 6001; + E_Envvar = &file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes[1] + // By default field represents a flag. + // + // optional bool argument = 6002; + E_Argument = &file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes[2] +) + +// Extension fields to descriptor.MessageOptions. +var ( + // By default message represents just complex configuration type. If command_name is specified + // such message becomes a kingpin.v2 command. + // Name has to be unique within single protoconfig.Configuration type. + // + // optional protoconfig.golang.kingpinv2.v1.Command command = 6002; + E_Command = &file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes[3] +) + +var File_protoconfig_go_kingpinv2_v1_extensions_proto protoreflect.FileDescriptor + +var file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDesc = []byte{ + 0x0a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, + 0x2f, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x67, 0x6f, 0x6c, 0x61, + 0x6e, 0x67, 0x2e, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2e, 0x76, 0x31, 0x1a, + 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x07, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x38, 0x0a, 0x0c, 0x45, 0x78, 0x69, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x66, 0x69, 0x6c, + 0x65, 0x22, 0x2a, 0x0a, 0x02, 0x49, 0x50, 0x12, 0x24, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x02, 0x69, 0x70, 0x22, 0x36, 0x0a, + 0x06, 0x52, 0x65, 0x67, 0x65, 0x78, 0x70, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, + 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x72, + 0x65, 0x67, 0x65, 0x78, 0x70, 0x22, 0x1d, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x40, 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0xf0, 0x2e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, + 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x3a, 0x36, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x76, 0x61, 0x72, + 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0xf1, 0x2e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x76, 0x76, 0x61, 0x72, 0x3a, 0x3a, + 0x0a, 0x08, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf2, 0x2e, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x3a, 0x64, 0x0a, 0x07, 0x63, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf2, 0x2e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x67, 0x6f, 0x6c, 0x61, + 0x6e, 0x67, 0x2e, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x42, 0x3b, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 0x2f, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, + 0x6e, 0x76, 0x32, 0x3b, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescOnce sync.Once + file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescData = file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDesc +) + +func file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescGZIP() []byte { + file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescOnce.Do(func() { + file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescData = protoimpl.X.CompressGZIP(file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescData) + }) + return file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDescData +} + +var file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_protoconfig_go_kingpinv2_v1_extensions_proto_goTypes = []interface{}{ + (*Content)(nil), // 0: protoconfig.golang.kingpinv2.v1.Content + (*ExistingFile)(nil), // 1: protoconfig.golang.kingpinv2.v1.ExistingFile + (*IP)(nil), // 2: protoconfig.golang.kingpinv2.v1.IP + (*Regexp)(nil), // 3: protoconfig.golang.kingpinv2.v1.Regexp + (*Command)(nil), // 4: protoconfig.golang.kingpinv2.v1.Command + (*any.Any)(nil), // 5: google.protobuf.Any + (*descriptor.FieldOptions)(nil), // 6: google.protobuf.FieldOptions + (*descriptor.MessageOptions)(nil), // 7: google.protobuf.MessageOptions +} +var file_protoconfig_go_kingpinv2_v1_extensions_proto_depIdxs = []int32{ + 5, // 0: protoconfig.golang.kingpinv2.v1.Content.content:type_name -> google.protobuf.Any + 5, // 1: protoconfig.golang.kingpinv2.v1.ExistingFile.file:type_name -> google.protobuf.Any + 5, // 2: protoconfig.golang.kingpinv2.v1.IP.ip:type_name -> google.protobuf.Any + 5, // 3: protoconfig.golang.kingpinv2.v1.Regexp.regexp:type_name -> google.protobuf.Any + 6, // 4: protoconfig.golang.kingpinv2.v1.placeholder:extendee -> google.protobuf.FieldOptions + 6, // 5: protoconfig.golang.kingpinv2.v1.envvar:extendee -> google.protobuf.FieldOptions + 6, // 6: protoconfig.golang.kingpinv2.v1.argument:extendee -> google.protobuf.FieldOptions + 7, // 7: protoconfig.golang.kingpinv2.v1.command:extendee -> google.protobuf.MessageOptions + 4, // 8: protoconfig.golang.kingpinv2.v1.command:type_name -> protoconfig.golang.kingpinv2.v1.Command + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 8, // [8:9] is the sub-list for extension type_name + 4, // [4:8] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_protoconfig_go_kingpinv2_v1_extensions_proto_init() } +func file_protoconfig_go_kingpinv2_v1_extensions_proto_init() { + if File_protoconfig_go_kingpinv2_v1_extensions_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Content); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExistingFile); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IP); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Regexp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Command); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 4, + NumServices: 0, + }, + GoTypes: file_protoconfig_go_kingpinv2_v1_extensions_proto_goTypes, + DependencyIndexes: file_protoconfig_go_kingpinv2_v1_extensions_proto_depIdxs, + MessageInfos: file_protoconfig_go_kingpinv2_v1_extensions_proto_msgTypes, + ExtensionInfos: file_protoconfig_go_kingpinv2_v1_extensions_proto_extTypes, + }.Build() + File_protoconfig_go_kingpinv2_v1_extensions_proto = out.File + file_protoconfig_go_kingpinv2_v1_extensions_proto_rawDesc = nil + file_protoconfig_go_kingpinv2_v1_extensions_proto_goTypes = nil + file_protoconfig_go_kingpinv2_v1_extensions_proto_depIdxs = nil +} diff --git a/golang/kingpinv2/kingpinv2.go b/go/kingpinv2/kingpinv2.go similarity index 100% rename from golang/kingpinv2/kingpinv2.go rename to go/kingpinv2/kingpinv2.go diff --git a/golang/protoc-gen-go-openconfig/README.md b/go/protoc-gen-go-protoconfig/README.md similarity index 60% rename from golang/protoc-gen-go-openconfig/README.md rename to go/protoc-gen-go-protoconfig/README.md index d14de79..e9061dd 100644 --- a/golang/protoc-gen-go-openconfig/README.md +++ b/go/protoc-gen-go-protoconfig/README.md @@ -1,6 +1,6 @@ -# protoc-gen-go-openconfig +# protoc-gen-go-protoconfig -This tool generates Go language bindings of `configuration`s in protobuf definition files for OpenConfig. For usage information, please see our [quick start guide](../../README.md#go). +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). ## Credits diff --git a/golang/protoc-gen-go-openconfig/go.mod b/go/protoc-gen-go-protoconfig/go.mod similarity index 53% rename from golang/protoc-gen-go-openconfig/go.mod rename to go/protoc-gen-go-protoconfig/go.mod index 0c1eda9..2373dcb 100644 --- a/golang/protoc-gen-go-openconfig/go.mod +++ b/go/protoc-gen-go-protoconfig/go.mod @@ -1,13 +1,13 @@ -module github.com/thanos-io/OpenConfig/golang/protoc-gen-go-openconfig +module github.com/protoconfig/protoconfig/go/protoc-gen-go-protoconfig go 1.15 require ( github.com/pkg/errors v0.9.1 - github.com/thanos-io/OpenConfig/golang v0.0.0-00010101000000-000000000000 + github.com/protoconfig/protoconfig/go v0.0.0-00010101000000-000000000000 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/protobuf v1.25.0 ) // TODO(bwplotka): Remove once dev period completes. -replace github.com/thanos-io/OpenConfig/golang => ../ +replace github.com/protoconfig/protoconfig/go => ../ diff --git a/golang/protoc-gen-go-openconfig/go.sum b/go/protoc-gen-go-protoconfig/go.sum similarity index 100% rename from golang/protoc-gen-go-openconfig/go.sum rename to go/protoc-gen-go-protoconfig/go.sum diff --git a/golang/protoc-gen-go-openconfig/main.go b/go/protoc-gen-go-protoconfig/main.go similarity index 74% rename from golang/protoc-gen-go-openconfig/main.go rename to go/protoc-gen-go-protoconfig/main.go index ed3abb3..8ddca84 100644 --- a/golang/protoc-gen-go-openconfig/main.go +++ b/go/protoc-gen-go-protoconfig/main.go @@ -1,14 +1,14 @@ -// protoc-gen-go-openconfig is a plugin for the Google protocol buffer compiler to +// protoc-gen-go-protoconfig is a plugin for the Google protocol buffer compiler to // generate Go code. Install it by building this program and making it // accessible within your PATH with the name: -// protoc-gen-go-openconfig +// protoc-gen-go-protoconfig // -// The 'go-openconfig' suffix becomes part of the argument for the protocol compiler, +// The 'go-protoconfig' suffix becomes part of the argument for the protocol compiler, // such that it can be invoked as: -// protoc --go-openconfig_out=. path/to/file.proto +// protoc --go-protoconfig_out=. path/to/file.proto // // This generates Go configuration definitions for the protocol buffer defined by -// file.proto. With that input, the output will be written to path/to/file_openconfig.pb.go +// file.proto. With that input, the output will be written to path/to/file_protoconfig.pb.go package main import ( @@ -39,7 +39,7 @@ func main() { if !f.Generate { continue } - if err := generateGoOpenConfig(gen, f); err != nil { + if err := generateGoProtoConfig(gen, f); err != nil { return err } } diff --git a/golang/protoc-gen-go-openconfig/openconfig.go b/go/protoc-gen-go-protoconfig/protoconfig.go similarity index 72% rename from golang/protoc-gen-go-openconfig/openconfig.go rename to go/protoc-gen-go-protoconfig/protoconfig.go index 2e16ab3..1bef643 100644 --- a/golang/protoc-gen-go-openconfig/openconfig.go +++ b/go/protoc-gen-go-protoconfig/protoconfig.go @@ -2,7 +2,7 @@ package main import ( "github.com/pkg/errors" - openconfig "github.com/thanos-io/OpenConfig/golang" + protoconfig "github.com/protoconfig/protoconfig/go" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" @@ -14,22 +14,22 @@ const ( ioPackage = protogen.GoImportPath("io") protoPackage = protogen.GoImportPath("google.golang.org/protobuf/proto") protojsonPackage = protogen.GoImportPath("google.golang.org/protobuf/encoding/protojson") - openConfigPackage = protogen.GoImportPath("github.com/thanos-io/OpenConfig/golang") + openConfigPackage = protogen.GoImportPath("github.com/protoconfig/protoconfig/go") ) -// generateGoOpenConfig generates a _openconfig.pb.go file containing a code of Congfigurator and Configurable (based on https://github.com/urfave/cli/), based -// OpenConfig 1.0 specification. -func generateGoOpenConfig(gen *protogen.Plugin, file *protogen.File) error { +// generateGoProtoConfig generates a _protoconfig.pb.go file containing a code of Congfigurator and Configurable (based on https://github.com/urfave/cli/), based +// ProtoConfig 1.0 specification. +func generateGoProtoConfig(gen *protogen.Plugin, file *protogen.File) error { var ( - ocEntryPoints []*openconfig.Metadata + ocEntryPoints []*protoconfig.Metadata fEntryPoints []*protogen.Message ) for _, f := range file.Messages { - e := proto.GetExtension(f.Desc.Options().(*descriptorpb.MessageOptions), openconfig.E_Metadata) - c, ok := e.(*openconfig.Metadata) + e := proto.GetExtension(f.Desc.Options().(*descriptorpb.MessageOptions), protoconfig.E_Metadata) + c, ok := e.(*protoconfig.Metadata) if !ok { - return errors.Errorf("unexpected type; got %T expected openconfig.Configuration", e) + return errors.Errorf("unexpected type; got %T expected protoconfig.Configuration", e) } // Such extension is not specified. if c == nil { @@ -45,16 +45,16 @@ func generateGoOpenConfig(gen *protogen.Plugin, file *protogen.File) error { return nil } - filename := file.GeneratedFilenamePrefix + "_openconfig.pb.go" + filename := file.GeneratedFilenamePrefix + "_protoconfig.pb.go" g := gen.NewGeneratedFile(filename, file.GoImportPath) - g.P("// Code generated by protoc-gen-go-openconfig code. DO NOT EDIT.") + g.P("// Code generated by protoc-gen-go-protoconfig code. DO NOT EDIT.") g.P() g.P("package ", file.GoPackageName) g.P() // NOTE: Imports will be added automatically by protogen. g.P("// This is a compile-time assertion to ensure that this generated file") - g.P("// is compatible with the OpenConfig golang package it is being compiled against.") + g.P("// is compatible with the ProtoConfig golang package it is being compiled against.") g.P("const _ = ", openConfigPackage.Ident("SupportPackageIsVersion1")) g.P() @@ -91,27 +91,27 @@ func generateOneOfHelper(g *protogen.GeneratedFile, root *protogen.Message, dup generateOneOfHelper(g, m, dup) } } -func generateConfiguratorSide(g *protogen.GeneratedFile, c *openconfig.Metadata, root *protogen.Message) { +func generateConfiguratorSide(g *protogen.GeneratedFile, c *protoconfig.Metadata, root *protogen.Message) { g.P("// Encode encodes self as `Encoded Configuration Message` in proto format so it can be understood and") - g.P("// passed to Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion") + g.P("// passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion") g.P("// (validation, default values etc).") - g.P("// Use `proto.Marshal` encoding without `OpenConfig 1.0` extension support.") + g.P("// Use `proto.Marshal` encoding without `ProtoConfig 1.0` extension support.") g.P("func (x *", root.GoIdent.GoName, ") Encode() ([]byte, error) {") - g.P("// TODO(bwplotka): Actually implement validation for `OpenConfig Proto Extensions Format 1.0` (: ") + g.P("// TODO(bwplotka): Actually implement validation for `Proto Config Extensions Format 1.0` (: ") g.P("return ", protoPackage.Ident("Marshal"), "(x)") g.P("}") g.P() // TODO(bwplotka): Ideally get this from interface comment directly? (parse interface code?) g.P("// EncodeJSON encodes self as `Encoded Configuration Message` in JSON format so it can be understood and") - g.P("// passed to Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion") + g.P("// passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion") g.P("// (validation, default values etc).") - g.P("// Use `protojson.Marshal` encoding without `OpenConfig 1.0` extension support.") + g.P("// Use `protojson.Marshal` encoding without `ProtoConfig 1.0` extension support.") g.P("func (x *", root.GoIdent.GoName, ") EncodeJSON() ([]byte, error) {") - g.P("// TODO(bwplotka): Actually implement validation for `OpenConfig Proto Extensions Format 1.0` (: ") + g.P("// TODO(bwplotka): Actually implement validation for `Proto Config Extensions Format 1.0` (: ") g.P("return ", protojsonPackage.Ident("Marshal"), "(x)") g.P("}") g.P() - g.P("// Metadata returns metadata defined in `OpenConfig Proto Extensions Format 1.0`.") + g.P("// Metadata returns metadata defined in `Proto Config Extensions Format 1.0`.") g.P("func (x *", root.GoIdent.GoName, ") Metadata() ", openConfigPackage.Ident("Metadata"), " {") // TODO(bwplotka): Generate, but not manually, find better way. g.P("return ", openConfigPackage.Ident("Metadata"), "{") @@ -156,25 +156,25 @@ func generateConfiguratorSide(g *protogen.GeneratedFile, c *openconfig.Metadata, } -// While it's not mandatory, OpenConfig 1.0 generates stub for defining Go CLI application that user might or might not use. -// In order to use it external CLI builder is necessary. For example kingpin.v2 implementation see github.com/thanos-io/OpenConfig/golang/kingpinv2. +// While it's not mandatory, ProtoConfig 1.0 generates stub for defining Go CLI application that user might or might not use. +// In order to use it external CLI builder is necessary. For example kingpin.v2 implementation see github.com/protoconfig/protoconfig/go/kingpinv2. // // Such app will be compatible with defined configuration and will output such filled typed after parsing. -func generateConfigurableSide(g *protogen.GeneratedFile, _ *openconfig.Metadata, root *protogen.Message) { +func generateConfigurableSide(g *protogen.GeneratedFile, _ *protoconfig.Metadata, root *protogen.Message) { g.P("// Decode parses byte slice as `Encoded Configuration Message` in JSON or proto format and unmarshal it on") - g.P("// the Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion") + g.P("// the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion") g.P("// (validation, default values etc).") - g.P("// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `OpenConfig 1.0` extension support.") + g.P("// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support.") g.P("func (x *", root.GoIdent.GoName, ") Decode(ecm []byte) error {") - g.P("// TODO(bwplotka): Actually implement validation for `OpenConfig Proto Extensions Format 1.0` (: ") + g.P("// TODO(bwplotka): Actually implement validation for `Proto Config Extensions Format 1.0` (: ") g.P("if isJSON(ecm) { return ", protojsonPackage.Ident("Unmarshal"), "(ecm, x) }") g.P("return ", protoPackage.Ident("Unmarshal"), "(ecm, x)") g.P("}") g.P() g.P("// DecodeString parses string as `Encoded Configuration Message` in JSON or proto format and unmarshal it on") - g.P("// the Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion") + g.P("// the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion") g.P("// (validation, default values etc).") - g.P("// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `OpenConfig 1.0` extension support.") + g.P("// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support.") g.P("func (x *", root.GoIdent.GoName, ") DecodeString(ecm string) error {") g.P("return x.Decode([]byte(ecm))") g.P("}") diff --git a/golang/examples/README.md b/golang/examples/README.md deleted file mode 100644 index 9c30e57..0000000 --- a/golang/examples/README.md +++ /dev/null @@ -1,76 +0,0 @@ -## Go: OpenConfg 1.0 Examples - -### Prerequisites - -* [Go](https://golang.org/) - -For installation instructions, see [Go’s Getting Started guide](https://golang.org/doc/install). - -* [Protocol buffer compiler](https://developers.google.com/protocol-buffers) (`protoc`), [version 3](https://developers.google.com/protocol-buffers/docs/proto3). - -For installation instructions, see [Protocol Buffer Compiler Installation](https://grpc.io/docs/protoc-installation/). - -* Go plugins for the protocol compiler: - - 1. Install the protocol compiler plugins for Go and OpenConfig using the following commands: - - ```bash - export GO111MODULE=on # Enable module mode - go get google.golang.org/protobuf/cmd/protoc-gen-go \ - github.com/thanos-io/OpenConfig/golang/protoc-gen-go-openconfig - ``` - - 1. Update your PATH so that the protoc compiler can find the plugins: - - ```bash - export PATH="$PATH:$(go env GOPATH)/bin - ``` - -### Steps - -1. Start by reading example application `Configuration Proto Definition` complainant with `OpenConfig 1.0` (from repo root): [`proto/examples/helloworld/v1/helloworld.proto`](/proto/examples/helloworld/v1/helloworld.proto) - -This file is just `.proto` with a couple of options from few extensions: - -* `openconfig` defined in [`proto/openconfig/v1/extensions.proto`](/proto/openconfig/v1/extensions.proto) is an `OpenConfig 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. -* `kingpin` defined in [`proto/golang/kingpinv2/v1/extensions.proto`](/proto/golang/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! - -The power of `OpenConfig 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. - -2. This example has already generated Go code from this `helloworld` application `Configuration Proto Definition`, and you can see it [golang/examples/helloworld/helloworld.pb.go](/golang/examples/helloworld/helloworld.pb.go) and [golang/examples/helloworld/helloworld_openconfig.pb.go](/golang/examples/helloworld/helloworld_openconfig.pb.go). Since it's generated code, - it's not readable much. Check [go.dev](https://pkg.go.dev/github.com/thanos-io/OpenConfig/golang/examples) instead! (It's go code after all and supports `godoc`!) - -What you see is the `protobuf` Go code that allows to marshal and unmarshal filled types in to `OpenConfig 1.0` (and proto) compliant encoding. - -3. Change directory to our quick start example directory for Go `cd golang/examples/helloworld` - -4. In this directory, on top of generated Go code for `helloworld` `Configuration Proto Definition` we see a couple of directories: - -* `./configurable` is an `OpenConfig 1.0` compliant `helloword` application that just allows `OpenConfig` for configuration. -* `./configurable-kingpinv2` is an `OpenConfig 1.0` compliant `helloword` application that allows `OpenConfig` as well as standard POSIX flags (that were manually implemented based on [`kingpin`](https://github.com/alecthomas/kingpin) library ) for configuration. -* `./configurable-kingpinv2-gen` is an `OpenConfig 1.0` compliant `helloword` application that allows `OpenConfig` as well as standard POSIX flags that were generated thanks to [`../kingpinv2/`](/golang/kingpinv2) extension. -* `./configurator` is `helloworld` application client that configures (by executing it in another process) in couple different ways in order -to get `(really!) Hello my world for "Alt C" in 2077 year!` string output. - -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: - -```bash -go run ./configurable-kingpinv2 hello --world="my" --year=2077 --name="Alt C" --lang=ENGLISH --add-really -``` - -But you can also use `OpenConfig 1.0` convention!: - -```bash -go run ./configurable-kingpinv2 --openconfigv1='{"hello": {"name": "Alt C", "year": 2077, "world": "my", "add_really": true}}' -``` - -All the above should print `(really!) Hello my world for "Alt C" in 2077 year!` - -6. Run configurator to check if all applications returns expected message by running: `go run ./configurator` - -7. Read [`./configurator`](/golang/examples/helloworld/configurator/main.go) to check all different ways to configure `helloworld` `configurable` -with and without `OpenConfig 1.0`! - -#### Updating Configuration Proto Definition - -TBD (tl;dr: `make proto`) \ No newline at end of file diff --git a/golang/kingpinv2/extensions.pb.go b/golang/kingpinv2/extensions.pb.go deleted file mode 100644 index 6082362..0000000 --- a/golang/kingpinv2/extensions.pb.go +++ /dev/null @@ -1,509 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0 -// protoc v3.13.0 -// source: openconfig/golang/kingpinv2/v1/extensions.proto - -// Extensions based on https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2 - -package kingpinv2 - -import ( - proto "github.com/golang/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - any "github.com/golang/protobuf/ptypes/any" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Content is byte steam created from PathOrContent flag, a custom extension built on top of kingpin.v2 flags type. -type Content struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Content *any.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` // any proto.Message -} - -func (x *Content) Reset() { - *x = Content{} - if protoimpl.UnsafeEnabled { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Content) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Content) ProtoMessage() {} - -func (x *Content) ProtoReflect() protoreflect.Message { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Content.ProtoReflect.Descriptor instead. -func (*Content) Descriptor() ([]byte, []int) { - return file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{0} -} - -func (x *Content) GetContent() *any.Any { - if x != nil { - return x.Content - } - return nil -} - -// ExistingFile represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.ExistingFile. -// repeated ExistingFile represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.ExistingFiles. -type ExistingFile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - File *any.Any `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"` // *os.File -} - -func (x *ExistingFile) Reset() { - *x = ExistingFile{} - if protoimpl.UnsafeEnabled { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExistingFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExistingFile) ProtoMessage() {} - -func (x *ExistingFile) ProtoReflect() protoreflect.Message { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExistingFile.ProtoReflect.Descriptor instead. -func (*ExistingFile) Descriptor() ([]byte, []int) { - return file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{1} -} - -func (x *ExistingFile) GetFile() *any.Any { - if x != nil { - return x.File - } - return nil -} - -// IP represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.IP. -// repeated IP represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.IPList. -type IP struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ip *any.Any `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` // *net.IP -} - -func (x *IP) Reset() { - *x = IP{} - if protoimpl.UnsafeEnabled { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IP) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IP) ProtoMessage() {} - -func (x *IP) ProtoReflect() protoreflect.Message { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IP.ProtoReflect.Descriptor instead. -func (*IP) Descriptor() ([]byte, []int) { - return file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{2} -} - -func (x *IP) GetIp() *any.Any { - if x != nil { - return x.Ip - } - return nil -} - -// Regexp represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.Regexp. -// repeated Regexp represents https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2#ArgClause.RegexpList. -type Regexp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Regexp *any.Any `protobuf:"bytes,1,opt,name=regexp,proto3" json:"regexp,omitempty"` // **regexp.Regexp -} - -func (x *Regexp) Reset() { - *x = Regexp{} - if protoimpl.UnsafeEnabled { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Regexp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Regexp) ProtoMessage() {} - -func (x *Regexp) ProtoReflect() protoreflect.Message { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Regexp.ProtoReflect.Descriptor instead. -func (*Regexp) Descriptor() ([]byte, []int) { - return file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{3} -} - -func (x *Regexp) GetRegexp() *any.Any { - if x != nil { - return x.Regexp - } - return nil -} - -type Command struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *Command) Reset() { - *x = Command{} - if protoimpl.UnsafeEnabled { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Command) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Command) ProtoMessage() {} - -func (x *Command) ProtoReflect() protoreflect.Message { - mi := &file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Command.ProtoReflect.Descriptor instead. -func (*Command) Descriptor() ([]byte, []int) { - return file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescGZIP(), []int{4} -} - -func (x *Command) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -var file_openconfig_golang_kingpinv2_v1_extensions_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 6000, - Name: "openconfig.golang.kingpinv2.v1.placeholder", - Tag: "bytes,6000,opt,name=placeholder", - Filename: "openconfig/golang/kingpinv2/v1/extensions.proto", - }, - { - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 6001, - Name: "openconfig.golang.kingpinv2.v1.envvar", - Tag: "bytes,6001,opt,name=envvar", - Filename: "openconfig/golang/kingpinv2/v1/extensions.proto", - }, - { - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 6002, - Name: "openconfig.golang.kingpinv2.v1.argument", - Tag: "varint,6002,opt,name=argument", - Filename: "openconfig/golang/kingpinv2/v1/extensions.proto", - }, - { - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*Command)(nil), - Field: 6002, - Name: "openconfig.golang.kingpinv2.v1.command", - Tag: "bytes,6002,opt,name=command", - Filename: "openconfig/golang/kingpinv2/v1/extensions.proto", - }, -} - -// Extension fields to descriptor.FieldOptions. -var ( - // optional string placeholder = 6000; - E_Placeholder = &file_openconfig_golang_kingpinv2_v1_extensions_proto_extTypes[0] - // optional string envvar = 6001; - E_Envvar = &file_openconfig_golang_kingpinv2_v1_extensions_proto_extTypes[1] - // By default field represents a flag. - // - // optional bool argument = 6002; - E_Argument = &file_openconfig_golang_kingpinv2_v1_extensions_proto_extTypes[2] -) - -// Extension fields to descriptor.MessageOptions. -var ( - // By default message represents just complex configuration type. If command_name is specified - // such message becomes a kingpin.v2 command. - // Name has to be unique within single openconfig.Configuration type. - // - // optional openconfig.golang.kingpinv2.v1.Command command = 6002; - E_Command = &file_openconfig_golang_kingpinv2_v1_extensions_proto_extTypes[3] -) - -var File_openconfig_golang_kingpinv2_v1_extensions_proto protoreflect.FileDescriptor - -var file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDesc = []byte{ - 0x0a, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2f, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2f, 0x76, 0x31, - 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x1e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x67, 0x6f, - 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2e, 0x76, - 0x31, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, - 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, - 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x38, 0x0a, 0x0c, 0x45, 0x78, 0x69, - 0x73, 0x74, 0x69, 0x6e, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x66, 0x69, 0x6c, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x66, - 0x69, 0x6c, 0x65, 0x22, 0x2a, 0x0a, 0x02, 0x49, 0x50, 0x12, 0x24, 0x0a, 0x02, 0x69, 0x70, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x02, 0x69, 0x70, 0x22, - 0x36, 0x0a, 0x06, 0x52, 0x65, 0x67, 0x65, 0x78, 0x70, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x67, - 0x65, 0x78, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x22, 0x1d, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x3a, 0x40, 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, - 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0x2e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, - 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x3a, 0x36, 0x0a, 0x06, 0x65, 0x6e, 0x76, 0x76, - 0x61, 0x72, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0xf1, 0x2e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x76, 0x76, 0x61, 0x72, - 0x3a, 0x3a, 0x0a, 0x08, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf2, 0x2e, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x08, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x3a, 0x63, 0x0a, 0x07, - 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf2, 0x2e, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2e, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x2e, 0x76, 0x31, - 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, - 0x64, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x74, 0x68, 0x61, 0x6e, 0x6f, 0x73, 0x2d, 0x69, 0x6f, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x6b, 0x69, 0x6e, 0x67, - 0x70, 0x69, 0x6e, 0x76, 0x32, 0x3b, 0x6b, 0x69, 0x6e, 0x67, 0x70, 0x69, 0x6e, 0x76, 0x32, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescOnce sync.Once - file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescData = file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDesc -) - -func file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescGZIP() []byte { - file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescOnce.Do(func() { - file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescData = protoimpl.X.CompressGZIP(file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescData) - }) - return file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDescData -} - -var file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_openconfig_golang_kingpinv2_v1_extensions_proto_goTypes = []interface{}{ - (*Content)(nil), // 0: openconfig.golang.kingpinv2.v1.Content - (*ExistingFile)(nil), // 1: openconfig.golang.kingpinv2.v1.ExistingFile - (*IP)(nil), // 2: openconfig.golang.kingpinv2.v1.IP - (*Regexp)(nil), // 3: openconfig.golang.kingpinv2.v1.Regexp - (*Command)(nil), // 4: openconfig.golang.kingpinv2.v1.Command - (*any.Any)(nil), // 5: google.protobuf.Any - (*descriptor.FieldOptions)(nil), // 6: google.protobuf.FieldOptions - (*descriptor.MessageOptions)(nil), // 7: google.protobuf.MessageOptions -} -var file_openconfig_golang_kingpinv2_v1_extensions_proto_depIdxs = []int32{ - 5, // 0: openconfig.golang.kingpinv2.v1.Content.content:type_name -> google.protobuf.Any - 5, // 1: openconfig.golang.kingpinv2.v1.ExistingFile.file:type_name -> google.protobuf.Any - 5, // 2: openconfig.golang.kingpinv2.v1.IP.ip:type_name -> google.protobuf.Any - 5, // 3: openconfig.golang.kingpinv2.v1.Regexp.regexp:type_name -> google.protobuf.Any - 6, // 4: openconfig.golang.kingpinv2.v1.placeholder:extendee -> google.protobuf.FieldOptions - 6, // 5: openconfig.golang.kingpinv2.v1.envvar:extendee -> google.protobuf.FieldOptions - 6, // 6: openconfig.golang.kingpinv2.v1.argument:extendee -> google.protobuf.FieldOptions - 7, // 7: openconfig.golang.kingpinv2.v1.command:extendee -> google.protobuf.MessageOptions - 4, // 8: openconfig.golang.kingpinv2.v1.command:type_name -> openconfig.golang.kingpinv2.v1.Command - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 8, // [8:9] is the sub-list for extension type_name - 4, // [4:8] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_openconfig_golang_kingpinv2_v1_extensions_proto_init() } -func file_openconfig_golang_kingpinv2_v1_extensions_proto_init() { - if File_openconfig_golang_kingpinv2_v1_extensions_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Content); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExistingFile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IP); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Regexp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Command); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 4, - NumServices: 0, - }, - GoTypes: file_openconfig_golang_kingpinv2_v1_extensions_proto_goTypes, - DependencyIndexes: file_openconfig_golang_kingpinv2_v1_extensions_proto_depIdxs, - MessageInfos: file_openconfig_golang_kingpinv2_v1_extensions_proto_msgTypes, - ExtensionInfos: file_openconfig_golang_kingpinv2_v1_extensions_proto_extTypes, - }.Build() - File_openconfig_golang_kingpinv2_v1_extensions_proto = out.File - file_openconfig_golang_kingpinv2_v1_extensions_proto_rawDesc = nil - file_openconfig_golang_kingpinv2_v1_extensions_proto_goTypes = nil - file_openconfig_golang_kingpinv2_v1_extensions_proto_depIdxs = nil -} diff --git a/golang/protoc-gen-go-openconfig/.golangci.yml b/golang/protoc-gen-go-openconfig/.golangci.yml deleted file mode 100644 index 3b1ea1f..0000000 --- a/golang/protoc-gen-go-openconfig/.golangci.yml +++ /dev/null @@ -1,76 +0,0 @@ -# This file contains all available configuration options -# with their default values. - -# options for analysis running -run: - # timeout for analysis, e.g. 30s, 5m, default is 1m - deadline: 5m - - # exit code when at least one issue was found, default is 1 - issues-exit-code: 1 - - # which dirs to skip: they won't be analyzed; - # can use regexp here: generated.*, regexp is applied on full path; - # default value is empty list, but next dirs are always skipped independently - # from this option's value: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs: vendor - -# output configuration options -output: - # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number" - format: colored-line-number - - # print lines of code with issue, default is true - print-issued-lines: true - - # print linter name in the end of issue text, default is true - print-linter-name: true - -linters: - enable: - # Sorted alphabetically. - - deadcode - - errcheck - - goconst - - godot - - gofmt - - goimports - - gosimple - - govet - - ineffassign - - misspell - - staticcheck - - structcheck - - typecheck - - unparam - - unused - - varcheck - -linters-settings: - errcheck: - exclude: ./.errcheck_excludes.txt - misspell: - locale: US - goconst: - min-occurrences: 5 - -issues: - exclude-rules: - # These are not being checked since these methods exist - # so that no one else could implement them. - - linters: - - unused - text: "SourceStoreAPI.implementsStoreAPI" - - linters: - - unused - text: "SourceStoreAPI.producesBlocks" - - linters: - - unused - text: "Source.producesBlocks" - - linters: - - unused - text: "newMockAlertmanager" - - linters: - - unused - text: "ruleAndAssert" diff --git a/proto/examples/helloworld/v1/helloworld.proto b/proto/examples/helloworld/v1/helloworld.proto index 3926c4c..3a32eee 100644 --- a/proto/examples/helloworld/v1/helloworld.proto +++ b/proto/examples/helloworld/v1/helloworld.proto @@ -1,22 +1,22 @@ syntax = "proto3"; -import "openconfig/v1/extensions.proto"; -import "openconfig/golang/kingpinv2/v1/extensions.proto"; +import "protoconfig/v1/extensions.proto"; +import "protoconfig/go/kingpinv2/v1/extensions.proto"; -option go_package = "github.com/thanos-io/OpenConfig/golang/examples/helloworld;helloworldpb"; +option go_package = "github.com/protoconfig/protoconfig/go/examples/helloworld;helloworldpb"; option java_multiple_files = true; -option java_package = "com.github.openconfig.examples.helloworld"; +option java_package = "com.github.protoconfig.examples.helloworld"; option java_outer_classname = "HelloWorldProto"; package examples.helloworld.v1; message HelloWorldConfiguration { - option (openconfig.v1.metadata) = { + option (protoconfig.v1.metadata) = { name: "configurable" version: "0.1.0" - description: "example application to showcase OpenConfig 1.0." + description: "example application to showcase ProtoConfig 1.0." - flag_delivery: { name: "--openconfigv1" } + flag_delivery: { name: "--protoconfigv1" } }; oneof command { @@ -33,19 +33,19 @@ enum Lang { } message HelloCommand { - option (openconfig.golang.kingpinv2.v1.command) = {name :"hello" }; + option (protoconfig.golang.kingpinv2.v1.command) = {name :"hello" }; - string name = 1 [(openconfig.v1.required) = true]; - int64 year = 2 [(openconfig.v1.default) = "2021"]; + string name = 1 [(protoconfig.v1.required) = true]; + int64 year = 2 [(protoconfig.v1.default) = "2021"]; string world = 3; Lang lang = 4; bool please_add_really = 5 [deprecated = true]; - bool add_really = 6 [(openconfig.v1.hidden) = true]; + bool add_really = 6 [(protoconfig.v1.hidden) = true]; } message ByeCommand { - option (openconfig.golang.kingpinv2.v1.command) = {name :"bye" }; + option (protoconfig.golang.kingpinv2.v1.command) = {name :"bye" }; Lang lang = 1; oneof command { @@ -55,11 +55,11 @@ message ByeCommand { } message ByeJustCommand { - option (openconfig.golang.kingpinv2.v1.command) = {name :"just" }; + option (protoconfig.golang.kingpinv2.v1.command) = {name :"just" }; } message ByeConfigurableCommand { - option (openconfig.golang.kingpinv2.v1.command) = {name :"configurable" }; + option (protoconfig.golang.kingpinv2.v1.command) = {name :"configurable" }; string config_id = 1; ByeConfiguration config = 2; diff --git a/proto/openconfig/golang/kingpinv2/v1/extensions.proto b/proto/protoconfig/go/kingpinv2/v1/extensions.proto similarity index 89% rename from proto/openconfig/golang/kingpinv2/v1/extensions.proto rename to proto/protoconfig/go/kingpinv2/v1/extensions.proto index c77f1e0..4580fa5 100644 --- a/proto/openconfig/golang/kingpinv2/v1/extensions.proto +++ b/proto/protoconfig/go/kingpinv2/v1/extensions.proto @@ -1,9 +1,9 @@ syntax = "proto3"; // Extensions based on https://pkg.go.dev/gopkg.in/alecthomas/kingpin.v2 -package openconfig.golang.kingpinv2.v1; +package protoconfig.golang.kingpinv2.v1; -option go_package = "github.com/thanos-io/OpenConfig/golang/kingpinv2;kingpinv2"; +option go_package = "github.com/protoconfig/protoconfig/go/kingpinv2;kingpinv2"; import "google/protobuf/descriptor.proto"; import "google/protobuf/any.proto"; @@ -48,6 +48,6 @@ message Command { extend google.protobuf.MessageOptions { // By default message represents just complex configuration type. If command_name is specified // such message becomes a kingpin.v2 command. - // Name has to be unique within single openconfig.Configuration type. + // Name has to be unique within single protoconfig.Configuration type. Command command = 6002; } diff --git a/proto/openconfig/v1/extensions.proto b/proto/protoconfig/v1/extensions.proto similarity index 82% rename from proto/openconfig/v1/extensions.proto rename to proto/protoconfig/v1/extensions.proto index 9aa3d18..f8cce0f 100644 --- a/proto/openconfig/v1/extensions.proto +++ b/proto/protoconfig/v1/extensions.proto @@ -1,19 +1,19 @@ syntax = "proto3"; -// OpenConfig Proto Extensions Format 1.0. +// Proto Config Extensions Format 1.0. // // This defines extensions to protocol-buffer-compatible language that is build on proto version 3 with protobuf custom options. // -// OpenConfig Extensions allows software authors to define metadata about required configuration like default values or field +// ProtoConfig Extensions allows software authors to define metadata about required configuration like default values or field // optionality etc. // // Extension can be used as natively described in https://developers.google.com/protocol-buffers/docs/proto#customoptions // // Below extensions are not mandatory to use while defining your configuration, but mandatory to be implemented by -// OpenConfig 1.0 compatible parsers and generators. -package openconfig.v1; +// ProtoConfig 1.0 compatible parsers and generators. +package protoconfig.v1; -option go_package = "github.com/thanos-io/OpenConfig/golang;openconfig"; +option go_package = "github.com/protoconfig/protoconfig/go;protoconfig"; import "google/protobuf/descriptor.proto"; @@ -42,7 +42,7 @@ message StdinDelivery {} message FlagDelivery { /// name represents custom flag name (including `-` if any) for a flag that consumes bytes of `Encoded Configuration Message` - // OpenConfig 1.0 recommends `--openconfigv1` name. + // ProtoConfig 1.0 recommends `--protoconfigv1` name. string name = 1; } @@ -55,12 +55,12 @@ extend google.protobuf.FieldOptions { /// default represents an option that sets a default value for the field. string default = 5000; /// hidden represents an option that marks a field as hidden. What it actually causes is up to the Configurable. - /// OpenConfig 1.0 recommends hiding it from the documentation. + /// ProtoConfig 1.0 recommends hiding it from the documentation. bool hidden = 5001; /// required represents an option that marks a field as mandatory and if empty, Configurable does not accept the whole configuration. bool required = 5002; /// experimental represents an option that marks a field as experimental. What it actually causes is up to the Configurable. - /// OpenConfig 1.0 recommends warning in the documentation. + /// ProtoConfig 1.0 recommends warning in the documentation. bool experimental = 5003; } \ No newline at end of file diff --git a/specification.md b/specification.md index 1e05e94..2fa267a 100644 --- a/specification.md +++ b/specification.md @@ -1,4 +1,4 @@ -# OpenConfig, a software configuration convention +# `ProtoConfig` 1.0, an open, language agnostic software configuration specification **Status**: `Alpha`. @@ -11,21 +11,21 @@ Two main sides exist during the software configuration process: * `Configurable`: Software we want to configure, statically (during startup) or dynamically (on the run) * `Configurator`: Another software or human user that desires to configure the `Configurable` automatically or manually (human). -The key element of `OpenConfig` specification is a strict format and rules of the `Configuration Definition`. This definition is the true single language that both `Configurator` and `Configurable` can use as shown in the below diagram: +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: -![OpenConfig](https://docs.google.com/drawings/d/e/2PACX-1vSANZkljSiDgV-o0a-dL0ryZz19p3Hblt5V_qozhBcY5ILq8j3T2GEAdCCHFHoSGT9h2H4LDqJ9bCn_/pub?w=1440&h=1080) +![ProtoConfig](https://docs.google.com/drawings/d/e/2PACX-1vSANZkljSiDgV-o0a-dL0ryZz19p3Hblt5V_qozhBcY5ILq8j3T2GEAdCCHFHoSGT9h2H4LDqJ9bCn_/pub?w=1440&h=1080) -The `OpenConfig 1.0` standard specifies that, in order for a `Configurable` (Software) to be `OpenConfig 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: +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: * Shall be stored and versioned together with the software itself (e.g in the same repository). * Shall be compatible with [Protocol Buffer Version 3](https://developers.google.com/protocol-buffers/docs/reference/proto3-spec) specification. * Shall define all the configuration options the `Configurable` exposes. -* Can use [**OpenConfig Proto Extensions Format 1.0.**](proto/openconfig/v1/extensions.proto) which might be useful for more advanced configuration options. +* Can use [**Proto Config Extensions Format 1.0.**](proto/protoconfig/v1/extensions.proto) which might be useful for more advanced configuration options. * Can use any other [proto](https://developers.google.com/protocol-buffers) extension or important one or more `CPD` from other software. -Furthermore, additionally, to `CPD`, the `OpenConfig 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)`. +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)`. -`OpenConfig 1.0` specifies `Configuration Process` as passing the `Encoded Configuration Message (ECM)` to `Configurable` in order to control programmed options it exposes. +`ProtoConfig 1.0` specifies `Configuration Process` as passing the `Encoded Configuration Message (ECM)` to `Configurable` in order to control programmed options it exposes. 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`. The `Configurable` shall implement either `SCP` or `DCP` or both. `SCP` is recommended for simplicity, explicitness, and lower complexity on `Configurable` side reasons. @@ -37,7 +37,7 @@ Additionally: * [`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). * `Configurable` should accept empty or partially empty `ECM` by providing safe and minimalistic defaults. -Overall, `OpenConfig 1.0` recommends allowing `SCP` rather `SPD`, by accepting `json` based `ECM` through the `--openconfig.v1` CLI flag. +Overall, `ProtoConfig 1.0` recommends allowing `SCP` rather `SPD`, by accepting `json` based `ECM` through the `--protoconfig.v1` CLI flag. ## Why Protocol Buffers? @@ -59,10 +59,10 @@ Configure software in a way that is: * **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.* * **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 * **Backward & Forward Compatible**: *Smooth version migrations, thanks to `protobuf` guarantee and safety checkers like [`buf check breaking`](https://docs.buf.build/breaking-usage)* -* **Extensible**: *On top of [**OpenConfig Proto Extensions Format 1.0.**](proto/openconfig/v1/extensions.proto) this specification allows CLI or language-specific extensions (e.g see [`kingpinv2` Go package](golang/kingpinv2) and its [extensions](golang/kingpinv2/proto/openconfig/kingpinv2/v1/extensions.proto))* +* **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))* ## Not in the scope * Runtime APIs, RPCs, and Invocation semantics (e.g error codes, output, input). -* Configuration or Invocation API that will accept (e.g dynamically or statically) for configuration in `OpenConfig` format. +* Configuration or Invocation API that will accept (e.g dynamically or statically) for configuration in `ProtoConfig` format. * Discoverability of `Configuration Proto Definitions` details.