├── LICENSE
├── OWNERS
├── README.md
└── grpc-transcoder
├── .gitignore
├── Gopkg.lock
├── Gopkg.toml
├── Makefile
├── README.md
├── main.go
└── protos
├── Makefile
├── echo.proto
├── helloworld.proto
├── onebig.proto-descriptor
├── test.proto
└── third_party
└── google
├── api
├── annotations.proto
└── http.proto
└── protobuf
├── any.proto
├── api.proto
├── descriptor.proto
├── duration.proto
├── empty.proto
├── field_mask.proto
├── source_context.proto
├── struct.proto
├── timestamp.proto
├── type.proto
└── wrappers.proto
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/OWNERS:
--------------------------------------------------------------------------------
1 | # Please add your github ID alphabetically.
2 | reviewers:
3 | - lizan
4 | - saigs
5 | - zackbutcher
6 | approvers:
7 | - lizan
8 | - saigs
9 | - zackbutcher
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Istio Tools
2 | =========
3 | Tools that Tetrate has developed to smooth over Istio's rough spots.
4 |
5 | Tools in the repo:
6 | ---------
7 | - [**grpc-transcoder**](/grpc-transcoder): use Istio's sidecar as a ["gRPC Gateway"](https://github.com/grpc-ecosystem/grpc-gateway). Takes a proto descriptor and produces the Istio configuration to enable Envoy's gRPC-to-JSON trancoding filter.
8 |
--------------------------------------------------------------------------------
/grpc-transcoder/.gitignore:
--------------------------------------------------------------------------------
1 | istio-*
2 | gen-grpc-transcoder
3 | gen-transcoder
4 | vendor
5 | .idea
6 |
--------------------------------------------------------------------------------
/grpc-transcoder/Gopkg.lock:
--------------------------------------------------------------------------------
1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
2 |
3 |
4 | [[projects]]
5 | digest = "1:5d1b5a25486fc7d4e133646d834f6fca7ba1cef9903d40e7aa786c41b89e9e91"
6 | name = "github.com/golang/protobuf"
7 | packages = [
8 | "proto",
9 | "protoc-gen-go/descriptor",
10 | "ptypes",
11 | "ptypes/any",
12 | "ptypes/duration",
13 | "ptypes/timestamp",
14 | ]
15 | pruneopts = "UT"
16 | revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
17 | version = "v1.2.0"
18 |
19 | [[projects]]
20 | digest = "1:0ade334594e69404d80d9d323445d2297ff8161637f9b2d347cc6973d2d6f05b"
21 | name = "github.com/hashicorp/errwrap"
22 | packages = ["."]
23 | pruneopts = "UT"
24 | revision = "8a6fb523712970c966eefc6b39ed2c5e74880354"
25 | version = "v1.0.0"
26 |
27 | [[projects]]
28 | digest = "1:f668349b83f7d779567c880550534addeca7ebadfdcf44b0b9c39be61864b4b7"
29 | name = "github.com/hashicorp/go-multierror"
30 | packages = ["."]
31 | pruneopts = "UT"
32 | revision = "886a7fbe3eb1c874d46f623bfa70af45f425b3d1"
33 | version = "v1.0.0"
34 |
35 | [[projects]]
36 | digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be"
37 | name = "github.com/inconshreveable/mousetrap"
38 | packages = ["."]
39 | pruneopts = "UT"
40 | revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
41 | version = "v1.0"
42 |
43 | [[projects]]
44 | digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747"
45 | name = "github.com/pkg/errors"
46 | packages = ["."]
47 | pruneopts = "UT"
48 | revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
49 | version = "v0.8.0"
50 |
51 | [[projects]]
52 | digest = "1:645cabccbb4fa8aab25a956cbcbdf6a6845ca736b2c64e197ca7cbb9d210b939"
53 | name = "github.com/spf13/cobra"
54 | packages = ["."]
55 | pruneopts = "UT"
56 | revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385"
57 | version = "v0.0.3"
58 |
59 | [[projects]]
60 | digest = "1:9424f440bba8f7508b69414634aef3b2b3a877e522d8a4624692412805407bb7"
61 | name = "github.com/spf13/pflag"
62 | packages = ["."]
63 | pruneopts = "UT"
64 | revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
65 | version = "v1.0.1"
66 |
67 | [[projects]]
68 | branch = "master"
69 | digest = "1:edb6e15d08296b91f0cd5b8b24d3778e122258e38493cb576094aa4764f3c826"
70 | name = "golang.org/x/net"
71 | packages = [
72 | "context",
73 | "http/httpguts",
74 | "http2",
75 | "http2/hpack",
76 | "idna",
77 | "internal/timeseries",
78 | "trace",
79 | ]
80 | pruneopts = "UT"
81 | revision = "e11730110bbd884bbf19550bfafe9d69519ce29e"
82 |
83 | [[projects]]
84 | branch = "master"
85 | digest = "1:35560529f5721d65f36dc23aa15fbf7306c5091cdc3f29f65881af5031b80cc8"
86 | name = "golang.org/x/sys"
87 | packages = ["unix"]
88 | pruneopts = "UT"
89 | revision = "9b800f95dbbc54abff0acf7ee32d88ba4e328c89"
90 |
91 | [[projects]]
92 | digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
93 | name = "golang.org/x/text"
94 | packages = [
95 | "collate",
96 | "collate/build",
97 | "internal/colltab",
98 | "internal/gen",
99 | "internal/tag",
100 | "internal/triegen",
101 | "internal/ucd",
102 | "language",
103 | "secure/bidirule",
104 | "transform",
105 | "unicode/bidi",
106 | "unicode/cldr",
107 | "unicode/norm",
108 | "unicode/rangetable",
109 | ]
110 | pruneopts = "UT"
111 | revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
112 | version = "v0.3.0"
113 |
114 | [[projects]]
115 | branch = "master"
116 | digest = "1:56b0bca90b7e5d1facf5fbdacba23e4e0ce069d25381b8e2f70ef1e7ebfb9c1a"
117 | name = "google.golang.org/genproto"
118 | packages = ["googleapis/rpc/status"]
119 | pruneopts = "UT"
120 | revision = "b69ba1387ce2108ac9bc8e8e5e5a46e7d5c72313"
121 |
122 | [[projects]]
123 | digest = "1:c3ad9841823db6da420a5625b367913b4ff54bbe60e8e3c98bd20e243e62e2d2"
124 | name = "google.golang.org/grpc"
125 | packages = [
126 | ".",
127 | "balancer",
128 | "balancer/base",
129 | "balancer/roundrobin",
130 | "codes",
131 | "connectivity",
132 | "credentials",
133 | "encoding",
134 | "encoding/proto",
135 | "grpclog",
136 | "internal",
137 | "internal/backoff",
138 | "internal/channelz",
139 | "internal/envconfig",
140 | "internal/grpcrand",
141 | "internal/transport",
142 | "keepalive",
143 | "metadata",
144 | "naming",
145 | "peer",
146 | "resolver",
147 | "resolver/dns",
148 | "resolver/passthrough",
149 | "stats",
150 | "status",
151 | "tap",
152 | ]
153 | pruneopts = "UT"
154 | revision = "2e463a05d100327ca47ac218281906921038fd95"
155 | version = "v1.16.0"
156 |
157 | [solve-meta]
158 | analyzer-name = "dep"
159 | analyzer-version = 1
160 | input-imports = [
161 | "github.com/golang/protobuf/proto",
162 | "github.com/golang/protobuf/protoc-gen-go/descriptor",
163 | "github.com/hashicorp/go-multierror",
164 | "github.com/pkg/errors",
165 | "github.com/spf13/cobra",
166 | "golang.org/x/net/context",
167 | "google.golang.org/grpc",
168 | ]
169 | solver-name = "gps-cdcl"
170 | solver-version = 1
171 |
--------------------------------------------------------------------------------
/grpc-transcoder/Gopkg.toml:
--------------------------------------------------------------------------------
1 | # Gopkg.toml example
2 | #
3 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
4 | # for detailed Gopkg.toml documentation.
5 | #
6 | # required = ["github.com/user/thing/cmd/thing"]
7 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
8 | #
9 | # [[constraint]]
10 | # name = "github.com/user/project"
11 | # version = "1.0.0"
12 | #
13 | # [[constraint]]
14 | # name = "github.com/user/project2"
15 | # branch = "dev"
16 | # source = "github.com/myfork/project2"
17 | #
18 | # [[override]]
19 | # name = "github.com/x/y"
20 | # version = "2.4.0"
21 | #
22 | # [prune]
23 | # non-go = false
24 | # go-tests = true
25 | # unused-packages = true
26 |
27 |
28 | [[constraint]]
29 | name = "github.com/spf13/cobra"
30 | version = "0.0.3"
31 |
32 | [prune]
33 | go-tests = true
34 | unused-packages = true
35 |
--------------------------------------------------------------------------------
/grpc-transcoder/Makefile:
--------------------------------------------------------------------------------
1 | ## Copyright 2018 Tetrate.io, Inc.
2 | ##
3 | ## Licensed under the Apache License, Version 2.0 (the "License");
4 | ## you may not use this file except in compliance with the License.
5 | ## You may obtain a copy of the License at
6 | ##
7 | ## http://www.apache.org/licenses/LICENSE-2.0
8 | ##
9 | ## Unless required by applicable law or agreed to in writing, software
10 | ## distributed under the License is distributed on an "AS IS" BASIS,
11 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | ## See the License for the specific language governing permissions and
13 | ## limitations under the License.
14 |
15 | PROTO_DIR := protos
16 |
17 | build: dep
18 | @go build -o gen-transcoder main.go
19 |
20 | proto:
21 | @$(MAKE) -C $(PROTO_DIR) all
22 |
23 | dep:
24 | @dep ensure
25 |
26 | all: proto build
27 | @echo "Done $@"
28 |
29 | clean:
30 | @$(MAKE) -C $(PROTO_DIR) $@
31 | @rm -f gen-transcoder
32 | @echo "Done $@"
33 |
34 | .PHONY: all
35 |
--------------------------------------------------------------------------------
/grpc-transcoder/README.md:
--------------------------------------------------------------------------------
1 | # gRPC-JSON Transcoder Config Generator
2 |
3 | A simple utility to generate an Istio [EnvoyFilter](https://preliminary.istio.io/docs/reference/config/istio.networking.v1alpha3/#EnvoyFilter) CRD configuring Envoy's [gRPC-JSON transcoder filter](https://www.envoyproxy.io/docs/envoy/latest/configuration/http_filters/grpc_json_transcoder_filter). This filter allows a gRPC server to serve JSON HTTP requests without any additional work on the server's part, regardless of the language the gRPC server is written in. Envoy transcodes the client JSON requests into gRPC before handing the request to the server, and transcodes the server's response from gRPC back into JSON before sending it to the client. Even better, it can do this while still serving gRPC clients on the same port!
4 |
5 | ## Usage
6 |
7 | 1. Build by binary via `make build` which creates a binary named `gen-transcoder`.
8 | > Alternatively, use `go run github.com/tetratelabs/istio-tools/grpc-transcoder` and pass the same CLI arguments as we use in the other examples.
9 |
10 | 1. Build your protobuf API definitions with [`protoc`](https://github.com/google/protobuf/releases), instructing the compiler to produce _descriptors_, a binary file that describes the runtime format of protobufs alongside their metadata. These descriptors are used to perform transocoding at runtime. Note that your gRPC service's need to use `google.api.http` options to describe their mapping to a REST API.
11 |
12 | > [Google's Cloud Endpoints' documentation](https://cloud.google.com/endpoints/docs/grpc/transcoding) provides an overview of using these proto/gRPC features, as well as how generate descriptors.
13 |
14 | ```sh
15 | protoc \
16 | -I path/to/google/protobufs \
17 | -I path/to/your/protos \
18 | --descriptor_set_out=path/to/output/dir/YOUR_SERVICE_NAME.proto-descriptor \
19 | --include_imports \
20 | --go_out=plugins=grpc:. \
21 | path/to/your/protos/service.proto
22 | ```
23 |
24 | 1. Note the fully qualified name of your gRPC service's protobuf, i.e. `proto.package.name.Service`. You may choose to provide prefix of matching package names e.g. `--packages proto.package`. If none provided, all packages will be chosen, and listed.
25 |
26 | 1. You may choose to match services using comma-separated regular expressions e.g. `--services http.*,echo.*`. If none provided, all services will be chosen and listed.
27 |
28 | 1. Find the `app` label of the Kubernetes Service you want to enable transcoding for. For our example, we'll assume our Kubernetes uses the label `app: foo`.
29 |
30 | 1. Note the port your gRPC server is running on; for our example we'll assume the gRPC server listens on port `9080`.
31 |
32 | 1. Use `gen-transcoder` to generate your configuration for Istio:
33 |
34 | ```sh
35 | gen-transcoder \
36 | --port 9080 \
37 | [--service foo] \
38 | [--packages proto.package.name] \
39 | [--services 'Service.*'] \
40 | --descriptor path/to/output/dir/YOUR_SERVICE_NAME.proto-descriptor
41 | ```
42 |
43 | Which will spit out config looking like:
44 |
45 | ```yaml
46 | # Created by github.com/tetratelabs/istio-tools/grpc-transcoder
47 | apiVersion: networking.istio.io/v1alpha3
48 | kind: EnvoyFilter
49 | metadata:
50 | name: foo
51 | spec:
52 | workloadLabels:
53 | app: foo
54 | filters:
55 | - listenerMatch:
56 | portNumber: 9080
57 | listenerType: SIDECAR_INBOUND
58 | insertPosition:
59 | index: BEFORE
60 | relativeTo: envoy.router
61 | filterName: envoy.grpc_json_transcoder
62 | filterType: HTTP
63 | filterConfig:
64 | protoDescriptorBin:
65 | services:
66 | - proto.package.name.Service1
67 | - proto.package.name.Service2
68 | printOptions:
69 | alwaysPrintPrimitiveFields: True
70 | ```
71 | -------
72 |
73 | We have included a few [sample proto services](/grpc-transcoder/protos), compiled into a single proto descriptor that you can use in the following way:
74 |
75 | ```sh
76 | gen-transcoder \
77 | --port 9080 \
78 | --service echo \
79 | --packages proto \
80 | --services 'Echo.*' \
81 | --descriptor proto/onebig.proto-descriptor
82 | ```
83 |
84 | Which spits out the config below:
85 |
86 | ```yaml
87 | # Created by github.com/tetratelabs/istio-tools/grpc-transcoder
88 | apiVersion: networking.istio.io/v1alpha3
89 | kind: EnvoyFilter
90 | metadata:
91 | name: echo
92 | spec:
93 | workloadLabels:
94 | app: echo
95 | filters:
96 | - listenerMatch:
97 | portNumber: 9080
98 | listenerType: SIDECAR_INBOUND
99 | insertPosition:
100 | index: BEFORE
101 | relativeTo: envoy.router
102 | filterName: envoy.grpc_json_transcoder
103 | filterType: HTTP
104 | filterConfig:
105 | services:
106 | - proto.EchoService
107 | protoDescriptorBin: Cs0BCgplY2hvLnByb3RvEgVwcm90byIxCgtFY2hvUmVxdWVzdBIOCgJpZBgBIAEoCVICaWQSEgoEYm9keRgCIAEoDFIEYm9keSIyCgxFY2hvUmVzcG9uc2USDgoCaWQYASABKAlSAmlkEhIKBGJvZHkYAiABKAxSBGJvZHkyQAoLRWNob1NlcnZpY2USMQoERWNobxISLnByb3RvLkVjaG9SZXF1ZXN0GhMucHJvdG8uRWNob1Jlc3BvbnNlIgBCB1oFcHJvdG9iBnByb3RvMwrvAQoQaGVsbG93b3JsZC5wcm90bxIKaGVsbG93b3JsZCIiCgxIZWxsb1JlcXVlc3QSEgoEbmFtZRgBIAEoCVIEbmFtZSImCgpIZWxsb1JlcGx5EhgKB21lc3NhZ2UYASABKAlSB21lc3NhZ2UySQoHR3JlZXRlchI+CghTYXlIZWxsbxIYLmhlbGxvd29ybGQuSGVsbG9SZXF1ZXN0GhYuaGVsbG93b3JsZC5IZWxsb1JlcGx5IgBCMAobaW8uZ3JwYy5leGFtcGxlcy5oZWxsb3dvcmxkQg9IZWxsb1dvcmxkUHJvdG9QAWIGcHJvdG8zCswBCgp0ZXN0LnByb3RvEgVwcm90byIxCgtUZXN0UmVxdWVzdBIOCgJpZBgBIAEoCVICaWQSEgoEYm9keRgCIAEoDFIEYm9keSIyCgxUZXN0UmVzcG9uc2USDgoCaWQYASABKAlSAmlkEhIKBGJvZHkYAiABKAxSBGJvZHkyPwoLVGVzdFNlcnZpY2USMAoDR2V0EhIucHJvdG8uVGVzdFJlcXVlc3QaEy5wcm90by5UZXN0UmVzcG9uc2UiAEIHWgVwcm90b2IGcHJvdG8z
108 | printOptions:
109 | alwaysPrintPrimitiveFields: True
110 | ```
111 |
112 | #### TODO: full example including protos, k8s service + deployment definition showing full e2e setup
113 |
--------------------------------------------------------------------------------
/grpc-transcoder/main.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 Tetrate.io, Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package main
16 |
17 | import (
18 | "encoding/base64"
19 | "fmt"
20 | "io/ioutil"
21 | "log"
22 | "os"
23 | "regexp"
24 | "sort"
25 | "strings"
26 | "text/template"
27 |
28 | "github.com/golang/protobuf/proto"
29 | descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor"
30 | "github.com/hashicorp/go-multierror"
31 | "github.com/pkg/errors"
32 |
33 | "github.com/spf13/cobra"
34 | )
35 |
36 | var tmpl = template.Must(template.New("grpc json transcoder filter").Parse(
37 | `# Created by github.com/tetratelabs/istio-tools/grpc-transcoder
38 | apiVersion: networking.istio.io/v1alpha3
39 | kind: EnvoyFilter
40 | metadata:
41 | name: {{ .ServiceName }}
42 | spec:
43 | workloadLabels:
44 | app: {{ .ServiceName }}
45 | filters:
46 | - listenerMatch:
47 | portNumber: {{ .PortNumber }}
48 | listenerType: SIDECAR_INBOUND
49 | insertPosition:
50 | index: BEFORE
51 | relativeTo: envoy.router
52 | filterName: envoy.grpc_json_transcoder
53 | filterType: HTTP
54 | filterConfig:
55 | services: {{ range .ProtoServices }}
56 | - {{ . }}{{end}}
57 | protoDescriptorBin: {{ .DescriptorBinary }}
58 | printOptions:
59 | alwaysPrintPrimitiveFields: True
60 | ---
61 | `))
62 |
63 | // k8s CRDs only a megabyte of data; descriptors can be larger than this, and if they are they cannot be delivered.
64 | const megabyte = 1000000
65 |
66 | // getServices returns a list of matching services found in matching packages
67 | func getServices(b *[]byte, packages []string, services []string) ([]string, error) {
68 | var (
69 | fds descriptor.FileDescriptorSet
70 | out []string
71 | rexp []*regexp.Regexp
72 | errs error
73 | )
74 | if err := proto.Unmarshal(*b, &fds); err != nil {
75 | return out, errors.Wrapf(err, "error proto unmarshall to FileDescriptorSet")
76 | }
77 | rexp = make([]*regexp.Regexp, 0)
78 | for _, r := range services {
79 | re, err := regexp.Compile(r)
80 | if err != nil {
81 | errs = multierror.Append(errs, err)
82 | } else {
83 | rexp = append(rexp, re)
84 | }
85 | }
86 |
87 | // package
88 | findPkg := func(name string) bool {
89 | for _, p := range packages {
90 | if strings.HasPrefix(name, p) {
91 | return true
92 | }
93 | }
94 | return len(packages) == 0
95 | }
96 |
97 | // service
98 | findSvc := func(s string) bool {
99 | for _, r := range rexp {
100 | if r.MatchString(s) {
101 | return true
102 | }
103 | }
104 | return len(rexp) == 0
105 | }
106 |
107 | for _, f := range fds.GetFile() {
108 | if !findPkg(f.GetPackage()) {
109 | continue
110 | }
111 | for _, s := range f.GetService() {
112 | if findSvc(s.GetName()) {
113 | out = append(out, fmt.Sprintf("%s.%s", f.GetPackage(), s.GetName()))
114 | }
115 | }
116 | }
117 | return out, errs
118 | }
119 |
120 | func main() {
121 | var (
122 | service string
123 | packages []string
124 | services []string
125 | protoServices []string
126 | descriptorFilePath string
127 | port int
128 | )
129 |
130 | cmd := &cobra.Command{
131 | Short: "gen-transcoder",
132 | Example: "gen-transcoder [--port 80] [--service foo] [--packages acme.example] [--services 'http.*,echo.*'] --descriptor /path/to/descriptor",
133 | RunE: func(cmd *cobra.Command, args []string) error {
134 | if _, err := os.Stat(descriptorFilePath); os.IsNotExist(err) {
135 | log.Printf("error opening descriptor file %q\n", descriptorFilePath)
136 | return err
137 | }
138 |
139 | descriptorBytes, err := ioutil.ReadFile(descriptorFilePath)
140 | if err != nil {
141 | log.Printf("error reading descriptor file %q\n", descriptorFilePath)
142 | return err
143 | }
144 | // TODO: support outputting a file based CRD when descriptor is too large.
145 | if len(descriptorBytes) > megabyte {
146 | return fmt.Errorf("descriptor file is too large (%d bytes); CRDs cannot be larger than a megabyte", len(descriptorBytes))
147 | }
148 |
149 | protoServices, err = getServices(&descriptorBytes, packages, services)
150 | if err != nil {
151 | log.Printf("error extracting services from descriptor: %v\n", err)
152 | return err
153 | }
154 | sort.Strings(protoServices)
155 |
156 | encoded := base64.StdEncoding.EncodeToString(descriptorBytes)
157 | params := map[string]interface{}{
158 | "ServiceName": service,
159 | "PortNumber": port,
160 | "DescriptorBinary": encoded,
161 | "ProtoServices": protoServices,
162 | }
163 | return tmpl.Execute(os.Stdout, params)
164 | },
165 | }
166 |
167 | cmd.PersistentFlags().IntVarP(&port, "port", "p", 80, "Port that the HTTP/JSON -> gRPC transcoding filter should be attached to.")
168 | cmd.PersistentFlags().StringVarP(&service, "service", "s", "grpc-transcoder",
169 | "The value of the `app` label for EnvoyFilter's workloadLabels config; see https://github.com/istio/api/blob/master/networking/v1alpha3/envoy_filter.proto#L59-L68")
170 | cmd.PersistentFlags().StringSliceVar(&packages, "packages", []string{},
171 | "Comma separated list of the proto package prefix names contained in the descriptor files. These must be fully qualified names, i.e. package_name.package_prefix")
172 | cmd.PersistentFlags().StringSliceVar(&services, "services", []string{},
173 | "Comma separated list of the proto service names contained in the descriptor files. These must be fully qualified names, i.e. package_name.service_name")
174 | cmd.PersistentFlags().StringVarP(&descriptorFilePath, "descriptor", "d", "", "Location of proto descriptor files relative to the server.")
175 |
176 | if err := cmd.Execute(); err != nil {
177 | log.Fatal(err)
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/Makefile:
--------------------------------------------------------------------------------
1 | ## Copyright 2018 Tetrate.io, Inc.
2 | ##
3 | ## Licensed under the Apache License, Version 2.0 (the "License");
4 | ## you may not use this file except in compliance with the License.
5 | ## You may obtain a copy of the License at
6 | ##
7 | ## http://www.apache.org/licenses/LICENSE-2.0
8 | ##
9 | ## Unless required by applicable law or agreed to in writing, software
10 | ## distributed under the License is distributed on an "AS IS" BASIS,
11 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | ## See the License for the specific language governing permissions and
13 | ## limitations under the License.
14 |
15 | TOPDIR := ${PWD}
16 | PROTO_SOURCES = $(wildcard *.proto)
17 | PROTO_GO_SOURCES = $(patsubst %.proto,%.pb.go,$(PROTO_SOURCES))
18 | DESCRIPTOR = onebig.proto-descriptor
19 |
20 | $(DESCRIPTOR): $(PROTO_GO_SOURCES)
21 | ${PROTO_GO_SOURCES}: ${PROTO_SOURCES}
22 | @protoc \
23 | -I ./ \
24 | -I third_party/ \
25 | --go_out=plugins=grpc:. \
26 | --descriptor_set_out=$(DESCRIPTOR) --include_imports \
27 | $?
28 |
29 | all: ${PROTO_GO_SOURCES}
30 | @echo "All protos done"
31 |
32 | .PHONY: all
33 |
34 | clean:
35 | @rm -f ${PROTO_GO_SOURCES}
36 | @echo "Cleaned ${PROTO_GO_SOURCES}"
37 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/echo.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2018 Tetrate.io, Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package proto;
18 | option go_package = "proto";
19 |
20 | import "google/api/annotations.proto";
21 |
22 | service EchoService {
23 | rpc Echo(EchoRequest) returns (EchoResponse) {
24 | option (google.api.http) = {
25 | post: "/echo"
26 | body: "*"
27 | };
28 | };
29 | }
30 |
31 | message EchoRequest {
32 | string id = 1;
33 | bytes body = 2;
34 | }
35 |
36 | message EchoResponse {
37 | string id = 1;
38 | bytes body = 2;
39 | }
40 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/helloworld.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package helloworld;
18 |
19 | import "google/api/annotations.proto";
20 |
21 | option java_multiple_files = true;
22 | option java_package = "io.grpc.examples.helloworld";
23 | option java_outer_classname = "HelloWorldProto";
24 |
25 | // The greeting service definition.
26 | service Greeter {
27 | // Sends a greeting
28 | rpc SayHello (HelloRequest) returns (HelloReply) {
29 | option (google.api.http).get = "/hello/{name}";
30 | }
31 | }
32 |
33 | // The request message containing the user's name.
34 | message HelloRequest {
35 | string name = 1;
36 | }
37 |
38 | // The response message containing the greetings
39 | message HelloReply {
40 | string message = 1;
41 | }
42 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/onebig.proto-descriptor:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tetratelabs/istio-tools/aec86181becd4ae981904ace9841ef090e936de7/grpc-transcoder/protos/onebig.proto-descriptor
--------------------------------------------------------------------------------
/grpc-transcoder/protos/test.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2018 Tetrate.io, Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package proto;
18 | option go_package = "proto";
19 |
20 | import "google/api/annotations.proto";
21 |
22 | service TestService {
23 | rpc Get(TestRequest) returns (TestResponse) {
24 | option (google.api.http) = {
25 | post: "/test/{id}"
26 | body: "*"
27 | };
28 | };
29 | }
30 |
31 | message TestRequest {
32 | string id = 1;
33 | bytes body = 2;
34 | }
35 |
36 | message TestResponse {
37 | string id = 1;
38 | bytes body = 2;
39 | }
40 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/api/annotations.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package google.api;
18 |
19 | import "google/api/http.proto";
20 | import "google/protobuf/descriptor.proto";
21 |
22 | option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
23 | option java_multiple_files = true;
24 | option java_outer_classname = "AnnotationsProto";
25 | option java_package = "com.google.api";
26 | option objc_class_prefix = "GAPI";
27 |
28 | extend google.protobuf.MethodOptions {
29 | // See `HttpRule`.
30 | HttpRule http = 72295728;
31 | }
32 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/api/http.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2018 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package google.api;
18 |
19 | option cc_enable_arenas = true;
20 | option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
21 | option java_multiple_files = true;
22 | option java_outer_classname = "HttpProto";
23 | option java_package = "com.google.api";
24 | option objc_class_prefix = "GAPI";
25 |
26 |
27 | // Defines the HTTP configuration for an API service. It contains a list of
28 | // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
29 | // to one or more HTTP REST API methods.
30 | message Http {
31 | // A list of HTTP configuration rules that apply to individual API methods.
32 | //
33 | // **NOTE:** All service configuration rules follow "last one wins" order.
34 | repeated HttpRule rules = 1;
35 |
36 | // When set to true, URL path parmeters will be fully URI-decoded except in
37 | // cases of single segment matches in reserved expansion, where "%2F" will be
38 | // left encoded.
39 | //
40 | // The default behavior is to not decode RFC 6570 reserved characters in multi
41 | // segment matches.
42 | bool fully_decode_reserved_expansion = 2;
43 | }
44 |
45 | // `HttpRule` defines the mapping of an RPC method to one or more HTTP
46 | // REST API methods. The mapping specifies how different portions of the RPC
47 | // request message are mapped to URL path, URL query parameters, and
48 | // HTTP request body. The mapping is typically specified as an
49 | // `google.api.http` annotation on the RPC method,
50 | // see "google/api/annotations.proto" for details.
51 | //
52 | // The mapping consists of a field specifying the path template and
53 | // method kind. The path template can refer to fields in the request
54 | // message, as in the example below which describes a REST GET
55 | // operation on a resource collection of messages:
56 | //
57 | //
58 | // service Messaging {
59 | // rpc GetMessage(GetMessageRequest) returns (Message) {
60 | // option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
61 | // }
62 | // }
63 | // message GetMessageRequest {
64 | // message SubMessage {
65 | // string subfield = 1;
66 | // }
67 | // string message_id = 1; // mapped to the URL
68 | // SubMessage sub = 2; // `sub.subfield` is url-mapped
69 | // }
70 | // message Message {
71 | // string text = 1; // content of the resource
72 | // }
73 | //
74 | // The same http annotation can alternatively be expressed inside the
75 | // `GRPC API Configuration` YAML file.
76 | //
77 | // http:
78 | // rules:
79 | // - selector: .Messaging.GetMessage
80 | // get: /v1/messages/{message_id}/{sub.subfield}
81 | //
82 | // This definition enables an automatic, bidrectional mapping of HTTP
83 | // JSON to RPC. Example:
84 | //
85 | // HTTP | RPC
86 | // -----|-----
87 | // `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
88 | //
89 | // In general, not only fields but also field paths can be referenced
90 | // from a path pattern. Fields mapped to the path pattern cannot be
91 | // repeated and must have a primitive (non-message) type.
92 | //
93 | // Any fields in the request message which are not bound by the path
94 | // pattern automatically become (optional) HTTP query
95 | // parameters. Assume the following definition of the request message:
96 | //
97 | //
98 | // service Messaging {
99 | // rpc GetMessage(GetMessageRequest) returns (Message) {
100 | // option (google.api.http).get = "/v1/messages/{message_id}";
101 | // }
102 | // }
103 | // message GetMessageRequest {
104 | // message SubMessage {
105 | // string subfield = 1;
106 | // }
107 | // string message_id = 1; // mapped to the URL
108 | // int64 revision = 2; // becomes a parameter
109 | // SubMessage sub = 3; // `sub.subfield` becomes a parameter
110 | // }
111 | //
112 | //
113 | // This enables a HTTP JSON to RPC mapping as below:
114 | //
115 | // HTTP | RPC
116 | // -----|-----
117 | // `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
118 | //
119 | // Note that fields which are mapped to HTTP parameters must have a
120 | // primitive type or a repeated primitive type. Message types are not
121 | // allowed. In the case of a repeated type, the parameter can be
122 | // repeated in the URL, as in `...?param=A¶m=B`.
123 | //
124 | // For HTTP method kinds which allow a request body, the `body` field
125 | // specifies the mapping. Consider a REST update method on the
126 | // message resource collection:
127 | //
128 | //
129 | // service Messaging {
130 | // rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
131 | // option (google.api.http) = {
132 | // put: "/v1/messages/{message_id}"
133 | // body: "message"
134 | // };
135 | // }
136 | // }
137 | // message UpdateMessageRequest {
138 | // string message_id = 1; // mapped to the URL
139 | // Message message = 2; // mapped to the body
140 | // }
141 | //
142 | //
143 | // The following HTTP JSON to RPC mapping is enabled, where the
144 | // representation of the JSON in the request body is determined by
145 | // protos JSON encoding:
146 | //
147 | // HTTP | RPC
148 | // -----|-----
149 | // `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
150 | //
151 | // The special name `*` can be used in the body mapping to define that
152 | // every field not bound by the path template should be mapped to the
153 | // request body. This enables the following alternative definition of
154 | // the update method:
155 | //
156 | // service Messaging {
157 | // rpc UpdateMessage(Message) returns (Message) {
158 | // option (google.api.http) = {
159 | // put: "/v1/messages/{message_id}"
160 | // body: "*"
161 | // };
162 | // }
163 | // }
164 | // message Message {
165 | // string message_id = 1;
166 | // string text = 2;
167 | // }
168 | //
169 | //
170 | // The following HTTP JSON to RPC mapping is enabled:
171 | //
172 | // HTTP | RPC
173 | // -----|-----
174 | // `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
175 | //
176 | // Note that when using `*` in the body mapping, it is not possible to
177 | // have HTTP parameters, as all fields not bound by the path end in
178 | // the body. This makes this option more rarely used in practice of
179 | // defining REST APIs. The common usage of `*` is in custom methods
180 | // which don't use the URL at all for transferring data.
181 | //
182 | // It is possible to define multiple HTTP methods for one RPC by using
183 | // the `additional_bindings` option. Example:
184 | //
185 | // service Messaging {
186 | // rpc GetMessage(GetMessageRequest) returns (Message) {
187 | // option (google.api.http) = {
188 | // get: "/v1/messages/{message_id}"
189 | // additional_bindings {
190 | // get: "/v1/users/{user_id}/messages/{message_id}"
191 | // }
192 | // };
193 | // }
194 | // }
195 | // message GetMessageRequest {
196 | // string message_id = 1;
197 | // string user_id = 2;
198 | // }
199 | //
200 | //
201 | // This enables the following two alternative HTTP JSON to RPC
202 | // mappings:
203 | //
204 | // HTTP | RPC
205 | // -----|-----
206 | // `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
207 | // `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
208 | //
209 | // # Rules for HTTP mapping
210 | //
211 | // The rules for mapping HTTP path, query parameters, and body fields
212 | // to the request message are as follows:
213 | //
214 | // 1. The `body` field specifies either `*` or a field path, or is
215 | // omitted. If omitted, it indicates there is no HTTP request body.
216 | // 2. Leaf fields (recursive expansion of nested messages in the
217 | // request) can be classified into three types:
218 | // (a) Matched in the URL template.
219 | // (b) Covered by body (if body is `*`, everything except (a) fields;
220 | // else everything under the body field)
221 | // (c) All other fields.
222 | // 3. URL query parameters found in the HTTP request are mapped to (c) fields.
223 | // 4. Any body sent with an HTTP request can contain only (b) fields.
224 | //
225 | // The syntax of the path template is as follows:
226 | //
227 | // Template = "/" Segments [ Verb ] ;
228 | // Segments = Segment { "/" Segment } ;
229 | // Segment = "*" | "**" | LITERAL | Variable ;
230 | // Variable = "{" FieldPath [ "=" Segments ] "}" ;
231 | // FieldPath = IDENT { "." IDENT } ;
232 | // Verb = ":" LITERAL ;
233 | //
234 | // The syntax `*` matches a single path segment. The syntax `**` matches zero
235 | // or more path segments, which must be the last part of the path except the
236 | // `Verb`. The syntax `LITERAL` matches literal text in the path.
237 | //
238 | // The syntax `Variable` matches part of the URL path as specified by its
239 | // template. A variable template must not contain other variables. If a variable
240 | // matches a single path segment, its template may be omitted, e.g. `{var}`
241 | // is equivalent to `{var=*}`.
242 | //
243 | // If a variable contains exactly one path segment, such as `"{var}"` or
244 | // `"{var=*}"`, when such a variable is expanded into a URL path, all characters
245 | // except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
246 | // Discovery Document as `{var}`.
247 | //
248 | // If a variable contains one or more path segments, such as `"{var=foo/*}"`
249 | // or `"{var=**}"`, when such a variable is expanded into a URL path, all
250 | // characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
251 | // show up in the Discovery Document as `{+var}`.
252 | //
253 | // NOTE: While the single segment variable matches the semantics of
254 | // [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
255 | // Simple String Expansion, the multi segment variable **does not** match
256 | // RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
257 | // does not expand special characters like `?` and `#`, which would lead
258 | // to invalid URLs.
259 | //
260 | // NOTE: the field paths in variables and in the `body` must not refer to
261 | // repeated fields or map fields.
262 | message HttpRule {
263 | // Selects methods to which this rule applies.
264 | //
265 | // Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
266 | string selector = 1;
267 |
268 | // Determines the URL pattern is matched by this rules. This pattern can be
269 | // used with any of the {get|put|post|delete|patch} methods. A custom method
270 | // can be defined using the 'custom' field.
271 | oneof pattern {
272 | // Used for listing and getting information about resources.
273 | string get = 2;
274 |
275 | // Used for updating a resource.
276 | string put = 3;
277 |
278 | // Used for creating a resource.
279 | string post = 4;
280 |
281 | // Used for deleting a resource.
282 | string delete = 5;
283 |
284 | // Used for updating a resource.
285 | string patch = 6;
286 |
287 | // The custom pattern is used for specifying an HTTP method that is not
288 | // included in the `pattern` field, such as HEAD, or "*" to leave the
289 | // HTTP method unspecified for this rule. The wild-card rule is useful
290 | // for services that provide content to Web (HTML) clients.
291 | CustomHttpPattern custom = 8;
292 | }
293 |
294 | // The name of the request field whose value is mapped to the HTTP body, or
295 | // `*` for mapping all fields not captured by the path pattern to the HTTP
296 | // body. NOTE: the referred field must not be a repeated field and must be
297 | // present at the top-level of request message type.
298 | string body = 7;
299 |
300 | // Additional HTTP bindings for the selector. Nested bindings must
301 | // not contain an `additional_bindings` field themselves (that is,
302 | // the nesting may only be one level deep).
303 | repeated HttpRule additional_bindings = 11;
304 | }
305 |
306 | // A custom pattern is used for defining custom HTTP verb.
307 | message CustomHttpPattern {
308 | // The name of this custom HTTP verb.
309 | string kind = 1;
310 |
311 | // The path matched by this custom verb.
312 | string path = 2;
313 | }
314 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/any.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option go_package = "github.com/golang/protobuf/ptypes/any";
37 | option java_package = "com.google.protobuf";
38 | option java_outer_classname = "AnyProto";
39 | option java_multiple_files = true;
40 | option objc_class_prefix = "GPB";
41 |
42 | // `Any` contains an arbitrary serialized protocol buffer message along with a
43 | // URL that describes the type of the serialized message.
44 | //
45 | // Protobuf library provides support to pack/unpack Any values in the form
46 | // of utility functions or additional generated methods of the Any type.
47 | //
48 | // Example 1: Pack and unpack a message in C++.
49 | //
50 | // Foo foo = ...;
51 | // Any any;
52 | // any.PackFrom(foo);
53 | // ...
54 | // if (any.UnpackTo(&foo)) {
55 | // ...
56 | // }
57 | //
58 | // Example 2: Pack and unpack a message in Java.
59 | //
60 | // Foo foo = ...;
61 | // Any any = Any.pack(foo);
62 | // ...
63 | // if (any.is(Foo.class)) {
64 | // foo = any.unpack(Foo.class);
65 | // }
66 | //
67 | // Example 3: Pack and unpack a message in Python.
68 | //
69 | // foo = Foo(...)
70 | // any = Any()
71 | // any.Pack(foo)
72 | // ...
73 | // if any.Is(Foo.DESCRIPTOR):
74 | // any.Unpack(foo)
75 | // ...
76 | //
77 | // Example 4: Pack and unpack a message in Go
78 | //
79 | // foo := &pb.Foo{...}
80 | // any, err := ptypes.MarshalAny(foo)
81 | // ...
82 | // foo := &pb.Foo{}
83 | // if err := ptypes.UnmarshalAny(any, foo); err != nil {
84 | // ...
85 | // }
86 | //
87 | // The pack methods provided by protobuf library will by default use
88 | // 'type.googleapis.com/full.type.name' as the type URL and the unpack
89 | // methods only use the fully qualified type name after the last '/'
90 | // in the type URL, for example "foo.bar.com/x/y.z" will yield type
91 | // name "y.z".
92 | //
93 | //
94 | // JSON
95 | // ====
96 | // The JSON representation of an `Any` value uses the regular
97 | // representation of the deserialized, embedded message, with an
98 | // additional field `@type` which contains the type URL. Example:
99 | //
100 | // package google.profile;
101 | // message Person {
102 | // string first_name = 1;
103 | // string last_name = 2;
104 | // }
105 | //
106 | // {
107 | // "@type": "type.googleapis.com/google.profile.Person",
108 | // "firstName": ,
109 | // "lastName":
110 | // }
111 | //
112 | // If the embedded message type is well-known and has a custom JSON
113 | // representation, that representation will be embedded adding a field
114 | // `value` which holds the custom JSON in addition to the `@type`
115 | // field. Example (for message [google.protobuf.Duration][]):
116 | //
117 | // {
118 | // "@type": "type.googleapis.com/google.protobuf.Duration",
119 | // "value": "1.212s"
120 | // }
121 | //
122 | message Any {
123 | // A URL/resource name that uniquely identifies the type of the serialized
124 | // protocol buffer message. The last segment of the URL's path must represent
125 | // the fully qualified name of the type (as in
126 | // `path/google.protobuf.Duration`). The name should be in a canonical form
127 | // (e.g., leading "." is not accepted).
128 | //
129 | // In practice, teams usually precompile into the binary all types that they
130 | // expect it to use in the context of Any. However, for URLs which use the
131 | // scheme `http`, `https`, or no scheme, one can optionally set up a type
132 | // server that maps type URLs to message definitions as follows:
133 | //
134 | // * If no scheme is provided, `https` is assumed.
135 | // * An HTTP GET on the URL must yield a [google.protobuf.Type][]
136 | // value in binary format, or produce an error.
137 | // * Applications are allowed to cache lookup results based on the
138 | // URL, or have them precompiled into a binary to avoid any
139 | // lookup. Therefore, binary compatibility needs to be preserved
140 | // on changes to types. (Use versioned type names to manage
141 | // breaking changes.)
142 | //
143 | // Note: this functionality is not currently available in the official
144 | // protobuf release, and it is not used for type URLs beginning with
145 | // type.googleapis.com.
146 | //
147 | // Schemes other than `http`, `https` (or the empty scheme) might be
148 | // used with implementation specific semantics.
149 | //
150 | string type_url = 1;
151 |
152 | // Must be a valid serialized protocol buffer of the above specified type.
153 | bytes value = 2;
154 | }
155 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/api.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | import "google/protobuf/source_context.proto";
36 | import "google/protobuf/type.proto";
37 |
38 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
39 | option java_package = "com.google.protobuf";
40 | option java_outer_classname = "ApiProto";
41 | option java_multiple_files = true;
42 | option objc_class_prefix = "GPB";
43 | option go_package = "google.golang.org/genproto/protobuf/api;api";
44 |
45 | // Api is a light-weight descriptor for an API Interface.
46 | //
47 | // Interfaces are also described as "protocol buffer services" in some contexts,
48 | // such as by the "service" keyword in a .proto file, but they are different
49 | // from API Services, which represent a concrete implementation of an interface
50 | // as opposed to simply a description of methods and bindings. They are also
51 | // sometimes simply referred to as "APIs" in other contexts, such as the name of
52 | // this message itself. See https://cloud.google.com/apis/design/glossary for
53 | // detailed terminology.
54 | message Api {
55 |
56 | // The fully qualified name of this interface, including package name
57 | // followed by the interface's simple name.
58 | string name = 1;
59 |
60 | // The methods of this interface, in unspecified order.
61 | repeated Method methods = 2;
62 |
63 | // Any metadata attached to the interface.
64 | repeated Option options = 3;
65 |
66 | // A version string for this interface. If specified, must have the form
67 | // `major-version.minor-version`, as in `1.10`. If the minor version is
68 | // omitted, it defaults to zero. If the entire version field is empty, the
69 | // major version is derived from the package name, as outlined below. If the
70 | // field is not empty, the version in the package name will be verified to be
71 | // consistent with what is provided here.
72 | //
73 | // The versioning schema uses [semantic
74 | // versioning](http://semver.org) where the major version number
75 | // indicates a breaking change and the minor version an additive,
76 | // non-breaking change. Both version numbers are signals to users
77 | // what to expect from different versions, and should be carefully
78 | // chosen based on the product plan.
79 | //
80 | // The major version is also reflected in the package name of the
81 | // interface, which must end in `v`, as in
82 | // `google.feature.v1`. For major versions 0 and 1, the suffix can
83 | // be omitted. Zero major versions must only be used for
84 | // experimental, non-GA interfaces.
85 | //
86 | //
87 | string version = 4;
88 |
89 | // Source context for the protocol buffer service represented by this
90 | // message.
91 | SourceContext source_context = 5;
92 |
93 | // Included interfaces. See [Mixin][].
94 | repeated Mixin mixins = 6;
95 |
96 | // The source syntax of the service.
97 | Syntax syntax = 7;
98 | }
99 |
100 | // Method represents a method of an API interface.
101 | message Method {
102 |
103 | // The simple name of this method.
104 | string name = 1;
105 |
106 | // A URL of the input message type.
107 | string request_type_url = 2;
108 |
109 | // If true, the request is streamed.
110 | bool request_streaming = 3;
111 |
112 | // The URL of the output message type.
113 | string response_type_url = 4;
114 |
115 | // If true, the response is streamed.
116 | bool response_streaming = 5;
117 |
118 | // Any metadata attached to the method.
119 | repeated Option options = 6;
120 |
121 | // The source syntax of this method.
122 | Syntax syntax = 7;
123 | }
124 |
125 | // Declares an API Interface to be included in this interface. The including
126 | // interface must redeclare all the methods from the included interface, but
127 | // documentation and options are inherited as follows:
128 | //
129 | // - If after comment and whitespace stripping, the documentation
130 | // string of the redeclared method is empty, it will be inherited
131 | // from the original method.
132 | //
133 | // - Each annotation belonging to the service config (http,
134 | // visibility) which is not set in the redeclared method will be
135 | // inherited.
136 | //
137 | // - If an http annotation is inherited, the path pattern will be
138 | // modified as follows. Any version prefix will be replaced by the
139 | // version of the including interface plus the [root][] path if
140 | // specified.
141 | //
142 | // Example of a simple mixin:
143 | //
144 | // package google.acl.v1;
145 | // service AccessControl {
146 | // // Get the underlying ACL object.
147 | // rpc GetAcl(GetAclRequest) returns (Acl) {
148 | // option (google.api.http).get = "/v1/{resource=**}:getAcl";
149 | // }
150 | // }
151 | //
152 | // package google.storage.v2;
153 | // service Storage {
154 | // rpc GetAcl(GetAclRequest) returns (Acl);
155 | //
156 | // // Get a data record.
157 | // rpc GetData(GetDataRequest) returns (Data) {
158 | // option (google.api.http).get = "/v2/{resource=**}";
159 | // }
160 | // }
161 | //
162 | // Example of a mixin configuration:
163 | //
164 | // apis:
165 | // - name: google.storage.v2.Storage
166 | // mixins:
167 | // - name: google.acl.v1.AccessControl
168 | //
169 | // The mixin construct implies that all methods in `AccessControl` are
170 | // also declared with same name and request/response types in
171 | // `Storage`. A documentation generator or annotation processor will
172 | // see the effective `Storage.GetAcl` method after inherting
173 | // documentation and annotations as follows:
174 | //
175 | // service Storage {
176 | // // Get the underlying ACL object.
177 | // rpc GetAcl(GetAclRequest) returns (Acl) {
178 | // option (google.api.http).get = "/v2/{resource=**}:getAcl";
179 | // }
180 | // ...
181 | // }
182 | //
183 | // Note how the version in the path pattern changed from `v1` to `v2`.
184 | //
185 | // If the `root` field in the mixin is specified, it should be a
186 | // relative path under which inherited HTTP paths are placed. Example:
187 | //
188 | // apis:
189 | // - name: google.storage.v2.Storage
190 | // mixins:
191 | // - name: google.acl.v1.AccessControl
192 | // root: acls
193 | //
194 | // This implies the following inherited HTTP annotation:
195 | //
196 | // service Storage {
197 | // // Get the underlying ACL object.
198 | // rpc GetAcl(GetAclRequest) returns (Acl) {
199 | // option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
200 | // }
201 | // ...
202 | // }
203 | message Mixin {
204 | // The fully qualified name of the interface which is included.
205 | string name = 1;
206 |
207 | // If non-empty specifies a path under which inherited HTTP paths
208 | // are rooted.
209 | string root = 2;
210 | }
211 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/descriptor.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Author: kenton@google.com (Kenton Varda)
32 | // Based on original Protocol Buffers design by
33 | // Sanjay Ghemawat, Jeff Dean, and others.
34 | //
35 | // The messages in this file describe the definitions found in .proto files.
36 | // A valid .proto file can be translated directly to a FileDescriptorProto
37 | // without any other information (e.g. without reading its imports).
38 |
39 |
40 | syntax = "proto2";
41 |
42 | package google.protobuf;
43 | option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor";
44 | option java_package = "com.google.protobuf";
45 | option java_outer_classname = "DescriptorProtos";
46 | option csharp_namespace = "Google.Protobuf.Reflection";
47 | option objc_class_prefix = "GPB";
48 | option cc_enable_arenas = true;
49 |
50 | // descriptor.proto must be optimized for speed because reflection-based
51 | // algorithms don't work during bootstrapping.
52 | option optimize_for = SPEED;
53 |
54 | // The protocol compiler can output a FileDescriptorSet containing the .proto
55 | // files it parses.
56 | message FileDescriptorSet {
57 | repeated FileDescriptorProto file = 1;
58 | }
59 |
60 | // Describes a complete .proto file.
61 | message FileDescriptorProto {
62 | optional string name = 1; // file name, relative to root of source tree
63 | optional string package = 2; // e.g. "foo", "foo.bar", etc.
64 |
65 | // Names of files imported by this file.
66 | repeated string dependency = 3;
67 | // Indexes of the public imported files in the dependency list above.
68 | repeated int32 public_dependency = 10;
69 | // Indexes of the weak imported files in the dependency list.
70 | // For Google-internal migration only. Do not use.
71 | repeated int32 weak_dependency = 11;
72 |
73 | // All top-level definitions in this file.
74 | repeated DescriptorProto message_type = 4;
75 | repeated EnumDescriptorProto enum_type = 5;
76 | repeated ServiceDescriptorProto service = 6;
77 | repeated FieldDescriptorProto extension = 7;
78 |
79 | optional FileOptions options = 8;
80 |
81 | // This field contains optional information about the original source code.
82 | // You may safely remove this entire field without harming runtime
83 | // functionality of the descriptors -- the information is needed only by
84 | // development tools.
85 | optional SourceCodeInfo source_code_info = 9;
86 |
87 | // The syntax of the proto file.
88 | // The supported values are "proto2" and "proto3".
89 | optional string syntax = 12;
90 | }
91 |
92 | // Describes a message type.
93 | message DescriptorProto {
94 | optional string name = 1;
95 |
96 | repeated FieldDescriptorProto field = 2;
97 | repeated FieldDescriptorProto extension = 6;
98 |
99 | repeated DescriptorProto nested_type = 3;
100 | repeated EnumDescriptorProto enum_type = 4;
101 |
102 | message ExtensionRange {
103 | optional int32 start = 1;
104 | optional int32 end = 2;
105 |
106 | optional ExtensionRangeOptions options = 3;
107 | }
108 | repeated ExtensionRange extension_range = 5;
109 |
110 | repeated OneofDescriptorProto oneof_decl = 8;
111 |
112 | optional MessageOptions options = 7;
113 |
114 | // Range of reserved tag numbers. Reserved tag numbers may not be used by
115 | // fields or extension ranges in the same message. Reserved ranges may
116 | // not overlap.
117 | message ReservedRange {
118 | optional int32 start = 1; // Inclusive.
119 | optional int32 end = 2; // Exclusive.
120 | }
121 | repeated ReservedRange reserved_range = 9;
122 | // Reserved field names, which may not be used by fields in the same message.
123 | // A given name may only be reserved once.
124 | repeated string reserved_name = 10;
125 | }
126 |
127 | message ExtensionRangeOptions {
128 | // The parser stores options it doesn't recognize here. See above.
129 | repeated UninterpretedOption uninterpreted_option = 999;
130 |
131 | // Clients can define custom options in extensions of this message. See above.
132 | extensions 1000 to max;
133 | }
134 |
135 | // Describes a field within a message.
136 | message FieldDescriptorProto {
137 | enum Type {
138 | // 0 is reserved for errors.
139 | // Order is weird for historical reasons.
140 | TYPE_DOUBLE = 1;
141 | TYPE_FLOAT = 2;
142 | // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
143 | // negative values are likely.
144 | TYPE_INT64 = 3;
145 | TYPE_UINT64 = 4;
146 | // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
147 | // negative values are likely.
148 | TYPE_INT32 = 5;
149 | TYPE_FIXED64 = 6;
150 | TYPE_FIXED32 = 7;
151 | TYPE_BOOL = 8;
152 | TYPE_STRING = 9;
153 | // Tag-delimited aggregate.
154 | // Group type is deprecated and not supported in proto3. However, Proto3
155 | // implementations should still be able to parse the group wire format and
156 | // treat group fields as unknown fields.
157 | TYPE_GROUP = 10;
158 | TYPE_MESSAGE = 11; // Length-delimited aggregate.
159 |
160 | // New in version 2.
161 | TYPE_BYTES = 12;
162 | TYPE_UINT32 = 13;
163 | TYPE_ENUM = 14;
164 | TYPE_SFIXED32 = 15;
165 | TYPE_SFIXED64 = 16;
166 | TYPE_SINT32 = 17; // Uses ZigZag encoding.
167 | TYPE_SINT64 = 18; // Uses ZigZag encoding.
168 | };
169 |
170 | enum Label {
171 | // 0 is reserved for errors
172 | LABEL_OPTIONAL = 1;
173 | LABEL_REQUIRED = 2;
174 | LABEL_REPEATED = 3;
175 | };
176 |
177 | optional string name = 1;
178 | optional int32 number = 3;
179 | optional Label label = 4;
180 |
181 | // If type_name is set, this need not be set. If both this and type_name
182 | // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
183 | optional Type type = 5;
184 |
185 | // For message and enum types, this is the name of the type. If the name
186 | // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
187 | // rules are used to find the type (i.e. first the nested types within this
188 | // message are searched, then within the parent, on up to the root
189 | // namespace).
190 | optional string type_name = 6;
191 |
192 | // For extensions, this is the name of the type being extended. It is
193 | // resolved in the same manner as type_name.
194 | optional string extendee = 2;
195 |
196 | // For numeric types, contains the original text representation of the value.
197 | // For booleans, "true" or "false".
198 | // For strings, contains the default text contents (not escaped in any way).
199 | // For bytes, contains the C escaped value. All bytes >= 128 are escaped.
200 | // TODO(kenton): Base-64 encode?
201 | optional string default_value = 7;
202 |
203 | // If set, gives the index of a oneof in the containing type's oneof_decl
204 | // list. This field is a member of that oneof.
205 | optional int32 oneof_index = 9;
206 |
207 | // JSON name of this field. The value is set by protocol compiler. If the
208 | // user has set a "json_name" option on this field, that option's value
209 | // will be used. Otherwise, it's deduced from the field's name by converting
210 | // it to camelCase.
211 | optional string json_name = 10;
212 |
213 | optional FieldOptions options = 8;
214 | }
215 |
216 | // Describes a oneof.
217 | message OneofDescriptorProto {
218 | optional string name = 1;
219 | optional OneofOptions options = 2;
220 | }
221 |
222 | // Describes an enum type.
223 | message EnumDescriptorProto {
224 | optional string name = 1;
225 |
226 | repeated EnumValueDescriptorProto value = 2;
227 |
228 | optional EnumOptions options = 3;
229 |
230 | // Range of reserved numeric values. Reserved values may not be used by
231 | // entries in the same enum. Reserved ranges may not overlap.
232 | //
233 | // Note that this is distinct from DescriptorProto.ReservedRange in that it
234 | // is inclusive such that it can appropriately represent the entire int32
235 | // domain.
236 | message EnumReservedRange {
237 | optional int32 start = 1; // Inclusive.
238 | optional int32 end = 2; // Inclusive.
239 | }
240 |
241 | // Range of reserved numeric values. Reserved numeric values may not be used
242 | // by enum values in the same enum declaration. Reserved ranges may not
243 | // overlap.
244 | repeated EnumReservedRange reserved_range = 4;
245 |
246 | // Reserved enum value names, which may not be reused. A given name may only
247 | // be reserved once.
248 | repeated string reserved_name = 5;
249 | }
250 |
251 | // Describes a value within an enum.
252 | message EnumValueDescriptorProto {
253 | optional string name = 1;
254 | optional int32 number = 2;
255 |
256 | optional EnumValueOptions options = 3;
257 | }
258 |
259 | // Describes a service.
260 | message ServiceDescriptorProto {
261 | optional string name = 1;
262 | repeated MethodDescriptorProto method = 2;
263 |
264 | optional ServiceOptions options = 3;
265 | }
266 |
267 | // Describes a method of a service.
268 | message MethodDescriptorProto {
269 | optional string name = 1;
270 |
271 | // Input and output type names. These are resolved in the same way as
272 | // FieldDescriptorProto.type_name, but must refer to a message type.
273 | optional string input_type = 2;
274 | optional string output_type = 3;
275 |
276 | optional MethodOptions options = 4;
277 |
278 | // Identifies if client streams multiple client messages
279 | optional bool client_streaming = 5 [default=false];
280 | // Identifies if server streams multiple server messages
281 | optional bool server_streaming = 6 [default=false];
282 | }
283 |
284 |
285 | // ===================================================================
286 | // Options
287 |
288 | // Each of the definitions above may have "options" attached. These are
289 | // just annotations which may cause code to be generated slightly differently
290 | // or may contain hints for code that manipulates protocol messages.
291 | //
292 | // Clients may define custom options as extensions of the *Options messages.
293 | // These extensions may not yet be known at parsing time, so the parser cannot
294 | // store the values in them. Instead it stores them in a field in the *Options
295 | // message called uninterpreted_option. This field must have the same name
296 | // across all *Options messages. We then use this field to populate the
297 | // extensions when we build a descriptor, at which point all protos have been
298 | // parsed and so all extensions are known.
299 | //
300 | // Extension numbers for custom options may be chosen as follows:
301 | // * For options which will only be used within a single application or
302 | // organization, or for experimental options, use field numbers 50000
303 | // through 99999. It is up to you to ensure that you do not use the
304 | // same number for multiple options.
305 | // * For options which will be published and used publicly by multiple
306 | // independent entities, e-mail protobuf-global-extension-registry@google.com
307 | // to reserve extension numbers. Simply provide your project name (e.g.
308 | // Objective-C plugin) and your project website (if available) -- there's no
309 | // need to explain how you intend to use them. Usually you only need one
310 | // extension number. You can declare multiple options with only one extension
311 | // number by putting them in a sub-message. See the Custom Options section of
312 | // the docs for examples:
313 | // https://developers.google.com/protocol-buffers/docs/proto#options
314 | // If this turns out to be popular, a web service will be set up
315 | // to automatically assign option numbers.
316 |
317 |
318 | message FileOptions {
319 |
320 | // Sets the Java package where classes generated from this .proto will be
321 | // placed. By default, the proto package is used, but this is often
322 | // inappropriate because proto packages do not normally start with backwards
323 | // domain names.
324 | optional string java_package = 1;
325 |
326 |
327 | // If set, all the classes from the .proto file are wrapped in a single
328 | // outer class with the given name. This applies to both Proto1
329 | // (equivalent to the old "--one_java_file" option) and Proto2 (where
330 | // a .proto always translates to a single class, but you may want to
331 | // explicitly choose the class name).
332 | optional string java_outer_classname = 8;
333 |
334 | // If set true, then the Java code generator will generate a separate .java
335 | // file for each top-level message, enum, and service defined in the .proto
336 | // file. Thus, these types will *not* be nested inside the outer class
337 | // named by java_outer_classname. However, the outer class will still be
338 | // generated to contain the file's getDescriptor() method as well as any
339 | // top-level extensions defined in the file.
340 | optional bool java_multiple_files = 10 [default=false];
341 |
342 | // This option does nothing.
343 | optional bool java_generate_equals_and_hash = 20 [deprecated=true];
344 |
345 | // If set true, then the Java2 code generator will generate code that
346 | // throws an exception whenever an attempt is made to assign a non-UTF-8
347 | // byte sequence to a string field.
348 | // Message reflection will do the same.
349 | // However, an extension field still accepts non-UTF-8 byte sequences.
350 | // This option has no effect on when used with the lite runtime.
351 | optional bool java_string_check_utf8 = 27 [default=false];
352 |
353 |
354 | // Generated classes can be optimized for speed or code size.
355 | enum OptimizeMode {
356 | SPEED = 1; // Generate complete code for parsing, serialization,
357 | // etc.
358 | CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
359 | LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
360 | }
361 | optional OptimizeMode optimize_for = 9 [default=SPEED];
362 |
363 | // Sets the Go package where structs generated from this .proto will be
364 | // placed. If omitted, the Go package will be derived from the following:
365 | // - The basename of the package import path, if provided.
366 | // - Otherwise, the package statement in the .proto file, if present.
367 | // - Otherwise, the basename of the .proto file, without extension.
368 | optional string go_package = 11;
369 |
370 |
371 |
372 | // Should generic services be generated in each language? "Generic" services
373 | // are not specific to any particular RPC system. They are generated by the
374 | // main code generators in each language (without additional plugins).
375 | // Generic services were the only kind of service generation supported by
376 | // early versions of google.protobuf.
377 | //
378 | // Generic services are now considered deprecated in favor of using plugins
379 | // that generate code specific to your particular RPC system. Therefore,
380 | // these default to false. Old code which depends on generic services should
381 | // explicitly set them to true.
382 | optional bool cc_generic_services = 16 [default=false];
383 | optional bool java_generic_services = 17 [default=false];
384 | optional bool py_generic_services = 18 [default=false];
385 | optional bool php_generic_services = 42 [default=false];
386 |
387 | // Is this file deprecated?
388 | // Depending on the target platform, this can emit Deprecated annotations
389 | // for everything in the file, or it will be completely ignored; in the very
390 | // least, this is a formalization for deprecating files.
391 | optional bool deprecated = 23 [default=false];
392 |
393 | // Enables the use of arenas for the proto messages in this file. This applies
394 | // only to generated classes for C++.
395 | optional bool cc_enable_arenas = 31 [default=false];
396 |
397 |
398 | // Sets the objective c class prefix which is prepended to all objective c
399 | // generated classes from this .proto. There is no default.
400 | optional string objc_class_prefix = 36;
401 |
402 | // Namespace for generated classes; defaults to the package.
403 | optional string csharp_namespace = 37;
404 |
405 | // By default Swift generators will take the proto package and CamelCase it
406 | // replacing '.' with underscore and use that to prefix the types/symbols
407 | // defined. When this options is provided, they will use this value instead
408 | // to prefix the types/symbols defined.
409 | optional string swift_prefix = 39;
410 |
411 | // Sets the php class prefix which is prepended to all php generated classes
412 | // from this .proto. Default is empty.
413 | optional string php_class_prefix = 40;
414 |
415 | // Use this option to change the namespace of php generated classes. Default
416 | // is empty. When this option is empty, the package name will be used for
417 | // determining the namespace.
418 | optional string php_namespace = 41;
419 |
420 |
421 | // Use this option to change the namespace of php generated metadata classes.
422 | // Default is empty. When this option is empty, the proto file name will be used
423 | // for determining the namespace.
424 | optional string php_metadata_namespace = 44;
425 |
426 | // Use this option to change the package of ruby generated classes. Default
427 | // is empty. When this option is not set, the package name will be used for
428 | // determining the ruby package.
429 | optional string ruby_package = 45;
430 |
431 | // The parser stores options it doesn't recognize here.
432 | // See the documentation for the "Options" section above.
433 | repeated UninterpretedOption uninterpreted_option = 999;
434 |
435 | // Clients can define custom options in extensions of this message.
436 | // See the documentation for the "Options" section above.
437 | extensions 1000 to max;
438 |
439 | reserved 38;
440 | }
441 |
442 | message MessageOptions {
443 | // Set true to use the old proto1 MessageSet wire format for extensions.
444 | // This is provided for backwards-compatibility with the MessageSet wire
445 | // format. You should not use this for any other reason: It's less
446 | // efficient, has fewer features, and is more complicated.
447 | //
448 | // The message must be defined exactly as follows:
449 | // message Foo {
450 | // option message_set_wire_format = true;
451 | // extensions 4 to max;
452 | // }
453 | // Note that the message cannot have any defined fields; MessageSets only
454 | // have extensions.
455 | //
456 | // All extensions of your type must be singular messages; e.g. they cannot
457 | // be int32s, enums, or repeated messages.
458 | //
459 | // Because this is an option, the above two restrictions are not enforced by
460 | // the protocol compiler.
461 | optional bool message_set_wire_format = 1 [default=false];
462 |
463 | // Disables the generation of the standard "descriptor()" accessor, which can
464 | // conflict with a field of the same name. This is meant to make migration
465 | // from proto1 easier; new code should avoid fields named "descriptor".
466 | optional bool no_standard_descriptor_accessor = 2 [default=false];
467 |
468 | // Is this message deprecated?
469 | // Depending on the target platform, this can emit Deprecated annotations
470 | // for the message, or it will be completely ignored; in the very least,
471 | // this is a formalization for deprecating messages.
472 | optional bool deprecated = 3 [default=false];
473 |
474 | // Whether the message is an automatically generated map entry type for the
475 | // maps field.
476 | //
477 | // For maps fields:
478 | // map map_field = 1;
479 | // The parsed descriptor looks like:
480 | // message MapFieldEntry {
481 | // option map_entry = true;
482 | // optional KeyType key = 1;
483 | // optional ValueType value = 2;
484 | // }
485 | // repeated MapFieldEntry map_field = 1;
486 | //
487 | // Implementations may choose not to generate the map_entry=true message, but
488 | // use a native map in the target language to hold the keys and values.
489 | // The reflection APIs in such implementions still need to work as
490 | // if the field is a repeated message field.
491 | //
492 | // NOTE: Do not set the option in .proto files. Always use the maps syntax
493 | // instead. The option should only be implicitly set by the proto compiler
494 | // parser.
495 | optional bool map_entry = 7;
496 |
497 | reserved 8; // javalite_serializable
498 | reserved 9; // javanano_as_lite
499 |
500 | // The parser stores options it doesn't recognize here. See above.
501 | repeated UninterpretedOption uninterpreted_option = 999;
502 |
503 | // Clients can define custom options in extensions of this message. See above.
504 | extensions 1000 to max;
505 | }
506 |
507 | message FieldOptions {
508 | // The ctype option instructs the C++ code generator to use a different
509 | // representation of the field than it normally would. See the specific
510 | // options below. This option is not yet implemented in the open source
511 | // release -- sorry, we'll try to include it in a future version!
512 | optional CType ctype = 1 [default = STRING];
513 | enum CType {
514 | // Default mode.
515 | STRING = 0;
516 |
517 | CORD = 1;
518 |
519 | STRING_PIECE = 2;
520 | }
521 | // The packed option can be enabled for repeated primitive fields to enable
522 | // a more efficient representation on the wire. Rather than repeatedly
523 | // writing the tag and type for each element, the entire array is encoded as
524 | // a single length-delimited blob. In proto3, only explicit setting it to
525 | // false will avoid using packed encoding.
526 | optional bool packed = 2;
527 |
528 | // The jstype option determines the JavaScript type used for values of the
529 | // field. The option is permitted only for 64 bit integral and fixed types
530 | // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
531 | // is represented as JavaScript string, which avoids loss of precision that
532 | // can happen when a large value is converted to a floating point JavaScript.
533 | // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
534 | // use the JavaScript "number" type. The behavior of the default option
535 | // JS_NORMAL is implementation dependent.
536 | //
537 | // This option is an enum to permit additional types to be added, e.g.
538 | // goog.math.Integer.
539 | optional JSType jstype = 6 [default = JS_NORMAL];
540 | enum JSType {
541 | // Use the default type.
542 | JS_NORMAL = 0;
543 |
544 | // Use JavaScript strings.
545 | JS_STRING = 1;
546 |
547 | // Use JavaScript numbers.
548 | JS_NUMBER = 2;
549 | }
550 |
551 | // Should this field be parsed lazily? Lazy applies only to message-type
552 | // fields. It means that when the outer message is initially parsed, the
553 | // inner message's contents will not be parsed but instead stored in encoded
554 | // form. The inner message will actually be parsed when it is first accessed.
555 | //
556 | // This is only a hint. Implementations are free to choose whether to use
557 | // eager or lazy parsing regardless of the value of this option. However,
558 | // setting this option true suggests that the protocol author believes that
559 | // using lazy parsing on this field is worth the additional bookkeeping
560 | // overhead typically needed to implement it.
561 | //
562 | // This option does not affect the public interface of any generated code;
563 | // all method signatures remain the same. Furthermore, thread-safety of the
564 | // interface is not affected by this option; const methods remain safe to
565 | // call from multiple threads concurrently, while non-const methods continue
566 | // to require exclusive access.
567 | //
568 | //
569 | // Note that implementations may choose not to check required fields within
570 | // a lazy sub-message. That is, calling IsInitialized() on the outer message
571 | // may return true even if the inner message has missing required fields.
572 | // This is necessary because otherwise the inner message would have to be
573 | // parsed in order to perform the check, defeating the purpose of lazy
574 | // parsing. An implementation which chooses not to check required fields
575 | // must be consistent about it. That is, for any particular sub-message, the
576 | // implementation must either *always* check its required fields, or *never*
577 | // check its required fields, regardless of whether or not the message has
578 | // been parsed.
579 | optional bool lazy = 5 [default=false];
580 |
581 | // Is this field deprecated?
582 | // Depending on the target platform, this can emit Deprecated annotations
583 | // for accessors, or it will be completely ignored; in the very least, this
584 | // is a formalization for deprecating fields.
585 | optional bool deprecated = 3 [default=false];
586 |
587 | // For Google-internal migration only. Do not use.
588 | optional bool weak = 10 [default=false];
589 |
590 |
591 | // The parser stores options it doesn't recognize here. See above.
592 | repeated UninterpretedOption uninterpreted_option = 999;
593 |
594 | // Clients can define custom options in extensions of this message. See above.
595 | extensions 1000 to max;
596 |
597 | reserved 4; // removed jtype
598 | }
599 |
600 | message OneofOptions {
601 | // The parser stores options it doesn't recognize here. See above.
602 | repeated UninterpretedOption uninterpreted_option = 999;
603 |
604 | // Clients can define custom options in extensions of this message. See above.
605 | extensions 1000 to max;
606 | }
607 |
608 | message EnumOptions {
609 |
610 | // Set this option to true to allow mapping different tag names to the same
611 | // value.
612 | optional bool allow_alias = 2;
613 |
614 | // Is this enum deprecated?
615 | // Depending on the target platform, this can emit Deprecated annotations
616 | // for the enum, or it will be completely ignored; in the very least, this
617 | // is a formalization for deprecating enums.
618 | optional bool deprecated = 3 [default=false];
619 |
620 | reserved 5; // javanano_as_lite
621 |
622 | // The parser stores options it doesn't recognize here. See above.
623 | repeated UninterpretedOption uninterpreted_option = 999;
624 |
625 | // Clients can define custom options in extensions of this message. See above.
626 | extensions 1000 to max;
627 | }
628 |
629 | message EnumValueOptions {
630 | // Is this enum value deprecated?
631 | // Depending on the target platform, this can emit Deprecated annotations
632 | // for the enum value, or it will be completely ignored; in the very least,
633 | // this is a formalization for deprecating enum values.
634 | optional bool deprecated = 1 [default=false];
635 |
636 | // The parser stores options it doesn't recognize here. See above.
637 | repeated UninterpretedOption uninterpreted_option = 999;
638 |
639 | // Clients can define custom options in extensions of this message. See above.
640 | extensions 1000 to max;
641 | }
642 |
643 | message ServiceOptions {
644 |
645 | // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
646 | // framework. We apologize for hoarding these numbers to ourselves, but
647 | // we were already using them long before we decided to release Protocol
648 | // Buffers.
649 |
650 | // Is this service deprecated?
651 | // Depending on the target platform, this can emit Deprecated annotations
652 | // for the service, or it will be completely ignored; in the very least,
653 | // this is a formalization for deprecating services.
654 | optional bool deprecated = 33 [default=false];
655 |
656 | // The parser stores options it doesn't recognize here. See above.
657 | repeated UninterpretedOption uninterpreted_option = 999;
658 |
659 | // Clients can define custom options in extensions of this message. See above.
660 | extensions 1000 to max;
661 | }
662 |
663 | message MethodOptions {
664 |
665 | // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
666 | // framework. We apologize for hoarding these numbers to ourselves, but
667 | // we were already using them long before we decided to release Protocol
668 | // Buffers.
669 |
670 | // Is this method deprecated?
671 | // Depending on the target platform, this can emit Deprecated annotations
672 | // for the method, or it will be completely ignored; in the very least,
673 | // this is a formalization for deprecating methods.
674 | optional bool deprecated = 33 [default=false];
675 |
676 | // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
677 | // or neither? HTTP based RPC implementation may choose GET verb for safe
678 | // methods, and PUT verb for idempotent methods instead of the default POST.
679 | enum IdempotencyLevel {
680 | IDEMPOTENCY_UNKNOWN = 0;
681 | NO_SIDE_EFFECTS = 1; // implies idempotent
682 | IDEMPOTENT = 2; // idempotent, but may have side effects
683 | }
684 | optional IdempotencyLevel idempotency_level =
685 | 34 [default=IDEMPOTENCY_UNKNOWN];
686 |
687 | // The parser stores options it doesn't recognize here. See above.
688 | repeated UninterpretedOption uninterpreted_option = 999;
689 |
690 | // Clients can define custom options in extensions of this message. See above.
691 | extensions 1000 to max;
692 | }
693 |
694 |
695 | // A message representing a option the parser does not recognize. This only
696 | // appears in options protos created by the compiler::Parser class.
697 | // DescriptorPool resolves these when building Descriptor objects. Therefore,
698 | // options protos in descriptor objects (e.g. returned by Descriptor::options(),
699 | // or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
700 | // in them.
701 | message UninterpretedOption {
702 | // The name of the uninterpreted option. Each string represents a segment in
703 | // a dot-separated name. is_extension is true iff a segment represents an
704 | // extension (denoted with parentheses in options specs in .proto files).
705 | // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
706 | // "foo.(bar.baz).qux".
707 | message NamePart {
708 | required string name_part = 1;
709 | required bool is_extension = 2;
710 | }
711 | repeated NamePart name = 2;
712 |
713 | // The value of the uninterpreted option, in whatever type the tokenizer
714 | // identified it as during parsing. Exactly one of these should be set.
715 | optional string identifier_value = 3;
716 | optional uint64 positive_int_value = 4;
717 | optional int64 negative_int_value = 5;
718 | optional double double_value = 6;
719 | optional bytes string_value = 7;
720 | optional string aggregate_value = 8;
721 | }
722 |
723 | // ===================================================================
724 | // Optional source code info
725 |
726 | // Encapsulates information about the original source file from which a
727 | // FileDescriptorProto was generated.
728 | message SourceCodeInfo {
729 | // A Location identifies a piece of source code in a .proto file which
730 | // corresponds to a particular definition. This information is intended
731 | // to be useful to IDEs, code indexers, documentation generators, and similar
732 | // tools.
733 | //
734 | // For example, say we have a file like:
735 | // message Foo {
736 | // optional string foo = 1;
737 | // }
738 | // Let's look at just the field definition:
739 | // optional string foo = 1;
740 | // ^ ^^ ^^ ^ ^^^
741 | // a bc de f ghi
742 | // We have the following locations:
743 | // span path represents
744 | // [a,i) [ 4, 0, 2, 0 ] The whole field definition.
745 | // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
746 | // [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
747 | // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
748 | // [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
749 | //
750 | // Notes:
751 | // - A location may refer to a repeated field itself (i.e. not to any
752 | // particular index within it). This is used whenever a set of elements are
753 | // logically enclosed in a single code segment. For example, an entire
754 | // extend block (possibly containing multiple extension definitions) will
755 | // have an outer location whose path refers to the "extensions" repeated
756 | // field without an index.
757 | // - Multiple locations may have the same path. This happens when a single
758 | // logical declaration is spread out across multiple places. The most
759 | // obvious example is the "extend" block again -- there may be multiple
760 | // extend blocks in the same scope, each of which will have the same path.
761 | // - A location's span is not always a subset of its parent's span. For
762 | // example, the "extendee" of an extension declaration appears at the
763 | // beginning of the "extend" block and is shared by all extensions within
764 | // the block.
765 | // - Just because a location's span is a subset of some other location's span
766 | // does not mean that it is a descendent. For example, a "group" defines
767 | // both a type and a field in a single declaration. Thus, the locations
768 | // corresponding to the type and field and their components will overlap.
769 | // - Code which tries to interpret locations should probably be designed to
770 | // ignore those that it doesn't understand, as more types of locations could
771 | // be recorded in the future.
772 | repeated Location location = 1;
773 | message Location {
774 | // Identifies which part of the FileDescriptorProto was defined at this
775 | // location.
776 | //
777 | // Each element is a field number or an index. They form a path from
778 | // the root FileDescriptorProto to the place where the definition. For
779 | // example, this path:
780 | // [ 4, 3, 2, 7, 1 ]
781 | // refers to:
782 | // file.message_type(3) // 4, 3
783 | // .field(7) // 2, 7
784 | // .name() // 1
785 | // This is because FileDescriptorProto.message_type has field number 4:
786 | // repeated DescriptorProto message_type = 4;
787 | // and DescriptorProto.field has field number 2:
788 | // repeated FieldDescriptorProto field = 2;
789 | // and FieldDescriptorProto.name has field number 1:
790 | // optional string name = 1;
791 | //
792 | // Thus, the above path gives the location of a field name. If we removed
793 | // the last element:
794 | // [ 4, 3, 2, 7 ]
795 | // this path refers to the whole field declaration (from the beginning
796 | // of the label to the terminating semicolon).
797 | repeated int32 path = 1 [packed=true];
798 |
799 | // Always has exactly three or four elements: start line, start column,
800 | // end line (optional, otherwise assumed same as start line), end column.
801 | // These are packed into a single field for efficiency. Note that line
802 | // and column numbers are zero-based -- typically you will want to add
803 | // 1 to each before displaying to a user.
804 | repeated int32 span = 2 [packed=true];
805 |
806 | // If this SourceCodeInfo represents a complete declaration, these are any
807 | // comments appearing before and after the declaration which appear to be
808 | // attached to the declaration.
809 | //
810 | // A series of line comments appearing on consecutive lines, with no other
811 | // tokens appearing on those lines, will be treated as a single comment.
812 | //
813 | // leading_detached_comments will keep paragraphs of comments that appear
814 | // before (but not connected to) the current element. Each paragraph,
815 | // separated by empty lines, will be one comment element in the repeated
816 | // field.
817 | //
818 | // Only the comment content is provided; comment markers (e.g. //) are
819 | // stripped out. For block comments, leading whitespace and an asterisk
820 | // will be stripped from the beginning of each line other than the first.
821 | // Newlines are included in the output.
822 | //
823 | // Examples:
824 | //
825 | // optional int32 foo = 1; // Comment attached to foo.
826 | // // Comment attached to bar.
827 | // optional int32 bar = 2;
828 | //
829 | // optional string baz = 3;
830 | // // Comment attached to baz.
831 | // // Another line attached to baz.
832 | //
833 | // // Comment attached to qux.
834 | // //
835 | // // Another line attached to qux.
836 | // optional double qux = 4;
837 | //
838 | // // Detached comment for corge. This is not leading or trailing comments
839 | // // to qux or corge because there are blank lines separating it from
840 | // // both.
841 | //
842 | // // Detached comment for corge paragraph 2.
843 | //
844 | // optional string corge = 5;
845 | // /* Block comment attached
846 | // * to corge. Leading asterisks
847 | // * will be removed. */
848 | // /* Block comment attached to
849 | // * grault. */
850 | // optional int32 grault = 6;
851 | //
852 | // // ignored detached comments.
853 | optional string leading_comments = 3;
854 | optional string trailing_comments = 4;
855 | repeated string leading_detached_comments = 6;
856 | }
857 | }
858 |
859 | // Describes the relationship between generated code and its original source
860 | // file. A GeneratedCodeInfo message is associated with only one generated
861 | // source file, but may contain references to different source .proto files.
862 | message GeneratedCodeInfo {
863 | // An Annotation connects some span of text in generated code to an element
864 | // of its generating .proto file.
865 | repeated Annotation annotation = 1;
866 | message Annotation {
867 | // Identifies the element in the original source .proto file. This field
868 | // is formatted the same as SourceCodeInfo.Location.path.
869 | repeated int32 path = 1 [packed=true];
870 |
871 | // Identifies the filesystem path to the original source .proto.
872 | optional string source_file = 2;
873 |
874 | // Identifies the starting offset in bytes in the generated code
875 | // that relates to the identified object.
876 | optional int32 begin = 3;
877 |
878 | // Identifies the ending offset in bytes in the generated code that
879 | // relates to the identified offset. The end offset should be one past
880 | // the last relevant byte (so the length of the text = end - begin).
881 | optional int32 end = 4;
882 | }
883 | }
884 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/duration.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option cc_enable_arenas = true;
37 | option go_package = "github.com/golang/protobuf/ptypes/duration";
38 | option java_package = "com.google.protobuf";
39 | option java_outer_classname = "DurationProto";
40 | option java_multiple_files = true;
41 | option objc_class_prefix = "GPB";
42 |
43 | // A Duration represents a signed, fixed-length span of time represented
44 | // as a count of seconds and fractions of seconds at nanosecond
45 | // resolution. It is independent of any calendar and concepts like "day"
46 | // or "month". It is related to Timestamp in that the difference between
47 | // two Timestamp values is a Duration and it can be added or subtracted
48 | // from a Timestamp. Range is approximately +-10,000 years.
49 | //
50 | // # Examples
51 | //
52 | // Example 1: Compute Duration from two Timestamps in pseudo code.
53 | //
54 | // Timestamp start = ...;
55 | // Timestamp end = ...;
56 | // Duration duration = ...;
57 | //
58 | // duration.seconds = end.seconds - start.seconds;
59 | // duration.nanos = end.nanos - start.nanos;
60 | //
61 | // if (duration.seconds < 0 && duration.nanos > 0) {
62 | // duration.seconds += 1;
63 | // duration.nanos -= 1000000000;
64 | // } else if (durations.seconds > 0 && duration.nanos < 0) {
65 | // duration.seconds -= 1;
66 | // duration.nanos += 1000000000;
67 | // }
68 | //
69 | // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
70 | //
71 | // Timestamp start = ...;
72 | // Duration duration = ...;
73 | // Timestamp end = ...;
74 | //
75 | // end.seconds = start.seconds + duration.seconds;
76 | // end.nanos = start.nanos + duration.nanos;
77 | //
78 | // if (end.nanos < 0) {
79 | // end.seconds -= 1;
80 | // end.nanos += 1000000000;
81 | // } else if (end.nanos >= 1000000000) {
82 | // end.seconds += 1;
83 | // end.nanos -= 1000000000;
84 | // }
85 | //
86 | // Example 3: Compute Duration from datetime.timedelta in Python.
87 | //
88 | // td = datetime.timedelta(days=3, minutes=10)
89 | // duration = Duration()
90 | // duration.FromTimedelta(td)
91 | //
92 | // # JSON Mapping
93 | //
94 | // In JSON format, the Duration type is encoded as a string rather than an
95 | // object, where the string ends in the suffix "s" (indicating seconds) and
96 | // is preceded by the number of seconds, with nanoseconds expressed as
97 | // fractional seconds. For example, 3 seconds with 0 nanoseconds should be
98 | // encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
99 | // be expressed in JSON format as "3.000000001s", and 3 seconds and 1
100 | // microsecond should be expressed in JSON format as "3.000001s".
101 | //
102 | //
103 | message Duration {
104 |
105 | // Signed seconds of the span of time. Must be from -315,576,000,000
106 | // to +315,576,000,000 inclusive. Note: these bounds are computed from:
107 | // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
108 | int64 seconds = 1;
109 |
110 | // Signed fractions of a second at nanosecond resolution of the span
111 | // of time. Durations less than one second are represented with a 0
112 | // `seconds` field and a positive or negative `nanos` field. For durations
113 | // of one second or more, a non-zero value for the `nanos` field must be
114 | // of the same sign as the `seconds` field. Must be from -999,999,999
115 | // to +999,999,999 inclusive.
116 | int32 nanos = 2;
117 | }
118 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/empty.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option go_package = "github.com/golang/protobuf/ptypes/empty";
37 | option java_package = "com.google.protobuf";
38 | option java_outer_classname = "EmptyProto";
39 | option java_multiple_files = true;
40 | option objc_class_prefix = "GPB";
41 | option cc_enable_arenas = true;
42 |
43 | // A generic empty message that you can re-use to avoid defining duplicated
44 | // empty messages in your APIs. A typical example is to use it as the request
45 | // or the response type of an API method. For instance:
46 | //
47 | // service Foo {
48 | // rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
49 | // }
50 | //
51 | // The JSON representation for `Empty` is empty JSON object `{}`.
52 | message Empty {}
53 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/field_mask.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option java_package = "com.google.protobuf";
37 | option java_outer_classname = "FieldMaskProto";
38 | option java_multiple_files = true;
39 | option objc_class_prefix = "GPB";
40 | option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask";
41 |
42 | // `FieldMask` represents a set of symbolic field paths, for example:
43 | //
44 | // paths: "f.a"
45 | // paths: "f.b.d"
46 | //
47 | // Here `f` represents a field in some root message, `a` and `b`
48 | // fields in the message found in `f`, and `d` a field found in the
49 | // message in `f.b`.
50 | //
51 | // Field masks are used to specify a subset of fields that should be
52 | // returned by a get operation or modified by an update operation.
53 | // Field masks also have a custom JSON encoding (see below).
54 | //
55 | // # Field Masks in Projections
56 | //
57 | // When used in the context of a projection, a response message or
58 | // sub-message is filtered by the API to only contain those fields as
59 | // specified in the mask. For example, if the mask in the previous
60 | // example is applied to a response message as follows:
61 | //
62 | // f {
63 | // a : 22
64 | // b {
65 | // d : 1
66 | // x : 2
67 | // }
68 | // y : 13
69 | // }
70 | // z: 8
71 | //
72 | // The result will not contain specific values for fields x,y and z
73 | // (their value will be set to the default, and omitted in proto text
74 | // output):
75 | //
76 | //
77 | // f {
78 | // a : 22
79 | // b {
80 | // d : 1
81 | // }
82 | // }
83 | //
84 | // A repeated field is not allowed except at the last position of a
85 | // paths string.
86 | //
87 | // If a FieldMask object is not present in a get operation, the
88 | // operation applies to all fields (as if a FieldMask of all fields
89 | // had been specified).
90 | //
91 | // Note that a field mask does not necessarily apply to the
92 | // top-level response message. In case of a REST get operation, the
93 | // field mask applies directly to the response, but in case of a REST
94 | // list operation, the mask instead applies to each individual message
95 | // in the returned resource list. In case of a REST custom method,
96 | // other definitions may be used. Where the mask applies will be
97 | // clearly documented together with its declaration in the API. In
98 | // any case, the effect on the returned resource/resources is required
99 | // behavior for APIs.
100 | //
101 | // # Field Masks in Update Operations
102 | //
103 | // A field mask in update operations specifies which fields of the
104 | // targeted resource are going to be updated. The API is required
105 | // to only change the values of the fields as specified in the mask
106 | // and leave the others untouched. If a resource is passed in to
107 | // describe the updated values, the API ignores the values of all
108 | // fields not covered by the mask.
109 | //
110 | // If a repeated field is specified for an update operation, the existing
111 | // repeated values in the target resource will be overwritten by the new values.
112 | // Note that a repeated field is only allowed in the last position of a `paths`
113 | // string.
114 | //
115 | // If a sub-message is specified in the last position of the field mask for an
116 | // update operation, then the existing sub-message in the target resource is
117 | // overwritten. Given the target message:
118 | //
119 | // f {
120 | // b {
121 | // d : 1
122 | // x : 2
123 | // }
124 | // c : 1
125 | // }
126 | //
127 | // And an update message:
128 | //
129 | // f {
130 | // b {
131 | // d : 10
132 | // }
133 | // }
134 | //
135 | // then if the field mask is:
136 | //
137 | // paths: "f.b"
138 | //
139 | // then the result will be:
140 | //
141 | // f {
142 | // b {
143 | // d : 10
144 | // }
145 | // c : 1
146 | // }
147 | //
148 | // However, if the update mask was:
149 | //
150 | // paths: "f.b.d"
151 | //
152 | // then the result would be:
153 | //
154 | // f {
155 | // b {
156 | // d : 10
157 | // x : 2
158 | // }
159 | // c : 1
160 | // }
161 | //
162 | // In order to reset a field's value to the default, the field must
163 | // be in the mask and set to the default value in the provided resource.
164 | // Hence, in order to reset all fields of a resource, provide a default
165 | // instance of the resource and set all fields in the mask, or do
166 | // not provide a mask as described below.
167 | //
168 | // If a field mask is not present on update, the operation applies to
169 | // all fields (as if a field mask of all fields has been specified).
170 | // Note that in the presence of schema evolution, this may mean that
171 | // fields the client does not know and has therefore not filled into
172 | // the request will be reset to their default. If this is unwanted
173 | // behavior, a specific service may require a client to always specify
174 | // a field mask, producing an error if not.
175 | //
176 | // As with get operations, the location of the resource which
177 | // describes the updated values in the request message depends on the
178 | // operation kind. In any case, the effect of the field mask is
179 | // required to be honored by the API.
180 | //
181 | // ## Considerations for HTTP REST
182 | //
183 | // The HTTP kind of an update operation which uses a field mask must
184 | // be set to PATCH instead of PUT in order to satisfy HTTP semantics
185 | // (PUT must only be used for full updates).
186 | //
187 | // # JSON Encoding of Field Masks
188 | //
189 | // In JSON, a field mask is encoded as a single string where paths are
190 | // separated by a comma. Fields name in each path are converted
191 | // to/from lower-camel naming conventions.
192 | //
193 | // As an example, consider the following message declarations:
194 | //
195 | // message Profile {
196 | // User user = 1;
197 | // Photo photo = 2;
198 | // }
199 | // message User {
200 | // string display_name = 1;
201 | // string address = 2;
202 | // }
203 | //
204 | // In proto a field mask for `Profile` may look as such:
205 | //
206 | // mask {
207 | // paths: "user.display_name"
208 | // paths: "photo"
209 | // }
210 | //
211 | // In JSON, the same mask is represented as below:
212 | //
213 | // {
214 | // mask: "user.displayName,photo"
215 | // }
216 | //
217 | // # Field Masks and Oneof Fields
218 | //
219 | // Field masks treat fields in oneofs just as regular fields. Consider the
220 | // following message:
221 | //
222 | // message SampleMessage {
223 | // oneof test_oneof {
224 | // string name = 4;
225 | // SubMessage sub_message = 9;
226 | // }
227 | // }
228 | //
229 | // The field mask can be:
230 | //
231 | // mask {
232 | // paths: "name"
233 | // }
234 | //
235 | // Or:
236 | //
237 | // mask {
238 | // paths: "sub_message"
239 | // }
240 | //
241 | // Note that oneof type names ("test_oneof" in this case) cannot be used in
242 | // paths.
243 | //
244 | // ## Field Mask Verification
245 | //
246 | // The implementation of any API method which has a FieldMask type field in the
247 | // request should verify the included field paths, and return an
248 | // `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
249 | message FieldMask {
250 | // The set of field mask paths.
251 | repeated string paths = 1;
252 | }
253 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/source_context.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option java_package = "com.google.protobuf";
37 | option java_outer_classname = "SourceContextProto";
38 | option java_multiple_files = true;
39 | option objc_class_prefix = "GPB";
40 | option go_package = "google.golang.org/genproto/protobuf/source_context;source_context";
41 |
42 | // `SourceContext` represents information about the source of a
43 | // protobuf element, like the file in which it is defined.
44 | message SourceContext {
45 | // The path-qualified name of the .proto file that contained the associated
46 | // protobuf element. For example: `"google/protobuf/source_context.proto"`.
47 | string file_name = 1;
48 | }
49 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/struct.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option cc_enable_arenas = true;
37 | option go_package = "github.com/golang/protobuf/ptypes/struct;structpb";
38 | option java_package = "com.google.protobuf";
39 | option java_outer_classname = "StructProto";
40 | option java_multiple_files = true;
41 | option objc_class_prefix = "GPB";
42 |
43 |
44 | // `Struct` represents a structured data value, consisting of fields
45 | // which map to dynamically typed values. In some languages, `Struct`
46 | // might be supported by a native representation. For example, in
47 | // scripting languages like JS a struct is represented as an
48 | // object. The details of that representation are described together
49 | // with the proto support for the language.
50 | //
51 | // The JSON representation for `Struct` is JSON object.
52 | message Struct {
53 | // Unordered map of dynamically typed values.
54 | map fields = 1;
55 | }
56 |
57 | // `Value` represents a dynamically typed value which can be either
58 | // null, a number, a string, a boolean, a recursive struct value, or a
59 | // list of values. A producer of value is expected to set one of that
60 | // variants, absence of any variant indicates an error.
61 | //
62 | // The JSON representation for `Value` is JSON value.
63 | message Value {
64 | // The kind of value.
65 | oneof kind {
66 | // Represents a null value.
67 | NullValue null_value = 1;
68 | // Represents a double value.
69 | double number_value = 2;
70 | // Represents a string value.
71 | string string_value = 3;
72 | // Represents a boolean value.
73 | bool bool_value = 4;
74 | // Represents a structured value.
75 | Struct struct_value = 5;
76 | // Represents a repeated `Value`.
77 | ListValue list_value = 6;
78 | }
79 | }
80 |
81 | // `NullValue` is a singleton enumeration to represent the null value for the
82 | // `Value` type union.
83 | //
84 | // The JSON representation for `NullValue` is JSON `null`.
85 | enum NullValue {
86 | // Null value.
87 | NULL_VALUE = 0;
88 | }
89 |
90 | // `ListValue` is a wrapper around a repeated field of values.
91 | //
92 | // The JSON representation for `ListValue` is JSON array.
93 | message ListValue {
94 | // Repeated field of dynamically typed values.
95 | repeated Value values = 1;
96 | }
97 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/timestamp.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36 | option cc_enable_arenas = true;
37 | option go_package = "github.com/golang/protobuf/ptypes/timestamp";
38 | option java_package = "com.google.protobuf";
39 | option java_outer_classname = "TimestampProto";
40 | option java_multiple_files = true;
41 | option objc_class_prefix = "GPB";
42 |
43 | // A Timestamp represents a point in time independent of any time zone
44 | // or calendar, represented as seconds and fractions of seconds at
45 | // nanosecond resolution in UTC Epoch time. It is encoded using the
46 | // Proleptic Gregorian Calendar which extends the Gregorian calendar
47 | // backwards to year one. It is encoded assuming all minutes are 60
48 | // seconds long, i.e. leap seconds are "smeared" so that no leap second
49 | // table is needed for interpretation. Range is from
50 | // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
51 | // By restricting to that range, we ensure that we can convert to
52 | // and from RFC 3339 date strings.
53 | // See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
54 | //
55 | // # Examples
56 | //
57 | // Example 1: Compute Timestamp from POSIX `time()`.
58 | //
59 | // Timestamp timestamp;
60 | // timestamp.set_seconds(time(NULL));
61 | // timestamp.set_nanos(0);
62 | //
63 | // Example 2: Compute Timestamp from POSIX `gettimeofday()`.
64 | //
65 | // struct timeval tv;
66 | // gettimeofday(&tv, NULL);
67 | //
68 | // Timestamp timestamp;
69 | // timestamp.set_seconds(tv.tv_sec);
70 | // timestamp.set_nanos(tv.tv_usec * 1000);
71 | //
72 | // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
73 | //
74 | // FILETIME ft;
75 | // GetSystemTimeAsFileTime(&ft);
76 | // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
77 | //
78 | // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
79 | // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
80 | // Timestamp timestamp;
81 | // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
82 | // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
83 | //
84 | // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
85 | //
86 | // long millis = System.currentTimeMillis();
87 | //
88 | // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
89 | // .setNanos((int) ((millis % 1000) * 1000000)).build();
90 | //
91 | //
92 | // Example 5: Compute Timestamp from current time in Python.
93 | //
94 | // timestamp = Timestamp()
95 | // timestamp.GetCurrentTime()
96 | //
97 | // # JSON Mapping
98 | //
99 | // In JSON format, the Timestamp type is encoded as a string in the
100 | // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
101 | // format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
102 | // where {year} is always expressed using four digits while {month}, {day},
103 | // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
104 | // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
105 | // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
106 | // is required. A proto3 JSON serializer should always use UTC (as indicated by
107 | // "Z") when printing the Timestamp type and a proto3 JSON parser should be
108 | // able to accept both UTC and other timezones (as indicated by an offset).
109 | //
110 | // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
111 | // 01:30 UTC on January 15, 2017.
112 | //
113 | // In JavaScript, one can convert a Date object to this format using the
114 | // standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
115 | // method. In Python, a standard `datetime.datetime` object can be converted
116 | // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
117 | // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
118 | // can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
119 | // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
120 | // ) to obtain a formatter capable of generating timestamps in this format.
121 | //
122 | //
123 | message Timestamp {
124 |
125 | // Represents seconds of UTC time since Unix epoch
126 | // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
127 | // 9999-12-31T23:59:59Z inclusive.
128 | int64 seconds = 1;
129 |
130 | // Non-negative fractions of a second at nanosecond resolution. Negative
131 | // second values with fractions must still have non-negative nanos values
132 | // that count forward in time. Must be from 0 to 999,999,999
133 | // inclusive.
134 | int32 nanos = 2;
135 | }
136 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/type.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | syntax = "proto3";
32 |
33 | package google.protobuf;
34 |
35 | import "google/protobuf/any.proto";
36 | import "google/protobuf/source_context.proto";
37 |
38 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
39 | option cc_enable_arenas = true;
40 | option java_package = "com.google.protobuf";
41 | option java_outer_classname = "TypeProto";
42 | option java_multiple_files = true;
43 | option objc_class_prefix = "GPB";
44 | option go_package = "google.golang.org/genproto/protobuf/ptype;ptype";
45 |
46 | // A protocol buffer message type.
47 | message Type {
48 | // The fully qualified message name.
49 | string name = 1;
50 | // The list of fields.
51 | repeated Field fields = 2;
52 | // The list of types appearing in `oneof` definitions in this type.
53 | repeated string oneofs = 3;
54 | // The protocol buffer options.
55 | repeated Option options = 4;
56 | // The source context.
57 | SourceContext source_context = 5;
58 | // The source syntax.
59 | Syntax syntax = 6;
60 | }
61 |
62 | // A single field of a message type.
63 | message Field {
64 | // Basic field types.
65 | enum Kind {
66 | // Field type unknown.
67 | TYPE_UNKNOWN = 0;
68 | // Field type double.
69 | TYPE_DOUBLE = 1;
70 | // Field type float.
71 | TYPE_FLOAT = 2;
72 | // Field type int64.
73 | TYPE_INT64 = 3;
74 | // Field type uint64.
75 | TYPE_UINT64 = 4;
76 | // Field type int32.
77 | TYPE_INT32 = 5;
78 | // Field type fixed64.
79 | TYPE_FIXED64 = 6;
80 | // Field type fixed32.
81 | TYPE_FIXED32 = 7;
82 | // Field type bool.
83 | TYPE_BOOL = 8;
84 | // Field type string.
85 | TYPE_STRING = 9;
86 | // Field type group. Proto2 syntax only, and deprecated.
87 | TYPE_GROUP = 10;
88 | // Field type message.
89 | TYPE_MESSAGE = 11;
90 | // Field type bytes.
91 | TYPE_BYTES = 12;
92 | // Field type uint32.
93 | TYPE_UINT32 = 13;
94 | // Field type enum.
95 | TYPE_ENUM = 14;
96 | // Field type sfixed32.
97 | TYPE_SFIXED32 = 15;
98 | // Field type sfixed64.
99 | TYPE_SFIXED64 = 16;
100 | // Field type sint32.
101 | TYPE_SINT32 = 17;
102 | // Field type sint64.
103 | TYPE_SINT64 = 18;
104 | };
105 |
106 | // Whether a field is optional, required, or repeated.
107 | enum Cardinality {
108 | // For fields with unknown cardinality.
109 | CARDINALITY_UNKNOWN = 0;
110 | // For optional fields.
111 | CARDINALITY_OPTIONAL = 1;
112 | // For required fields. Proto2 syntax only.
113 | CARDINALITY_REQUIRED = 2;
114 | // For repeated fields.
115 | CARDINALITY_REPEATED = 3;
116 | };
117 |
118 | // The field type.
119 | Kind kind = 1;
120 | // The field cardinality.
121 | Cardinality cardinality = 2;
122 | // The field number.
123 | int32 number = 3;
124 | // The field name.
125 | string name = 4;
126 | // The field type URL, without the scheme, for message or enumeration
127 | // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
128 | string type_url = 6;
129 | // The index of the field type in `Type.oneofs`, for message or enumeration
130 | // types. The first type has index 1; zero means the type is not in the list.
131 | int32 oneof_index = 7;
132 | // Whether to use alternative packed wire representation.
133 | bool packed = 8;
134 | // The protocol buffer options.
135 | repeated Option options = 9;
136 | // The field JSON name.
137 | string json_name = 10;
138 | // The string value of the default value of this field. Proto2 syntax only.
139 | string default_value = 11;
140 | }
141 |
142 | // Enum type definition.
143 | message Enum {
144 | // Enum type name.
145 | string name = 1;
146 | // Enum value definitions.
147 | repeated EnumValue enumvalue = 2;
148 | // Protocol buffer options.
149 | repeated Option options = 3;
150 | // The source context.
151 | SourceContext source_context = 4;
152 | // The source syntax.
153 | Syntax syntax = 5;
154 | }
155 |
156 | // Enum value definition.
157 | message EnumValue {
158 | // Enum value name.
159 | string name = 1;
160 | // Enum value number.
161 | int32 number = 2;
162 | // Protocol buffer options.
163 | repeated Option options = 3;
164 | }
165 |
166 | // A protocol buffer option, which can be attached to a message, field,
167 | // enumeration, etc.
168 | message Option {
169 | // The option's name. For protobuf built-in options (options defined in
170 | // descriptor.proto), this is the short name. For example, `"map_entry"`.
171 | // For custom options, it should be the fully-qualified name. For example,
172 | // `"google.api.http"`.
173 | string name = 1;
174 | // The option's value packed in an Any message. If the value is a primitive,
175 | // the corresponding wrapper type defined in google/protobuf/wrappers.proto
176 | // should be used. If the value is an enum, it should be stored as an int32
177 | // value using the google.protobuf.Int32Value type.
178 | Any value = 2;
179 | }
180 |
181 | // The syntax in which a protocol buffer element is defined.
182 | enum Syntax {
183 | // Syntax `proto2`.
184 | SYNTAX_PROTO2 = 0;
185 | // Syntax `proto3`.
186 | SYNTAX_PROTO3 = 1;
187 | }
188 |
--------------------------------------------------------------------------------
/grpc-transcoder/protos/third_party/google/protobuf/wrappers.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | // https://developers.google.com/protocol-buffers/
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions are
7 | // met:
8 | //
9 | // * Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | // * Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following disclaimer
13 | // in the documentation and/or other materials provided with the
14 | // distribution.
15 | // * Neither the name of Google Inc. nor the names of its
16 | // contributors may be used to endorse or promote products derived from
17 | // this software without specific prior written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | // Wrappers for primitive (non-message) types. These types are useful
32 | // for embedding primitives in the `google.protobuf.Any` type and for places
33 | // where we need to distinguish between the absence of a primitive
34 | // typed field and its default value.
35 |
36 | syntax = "proto3";
37 |
38 | package google.protobuf;
39 |
40 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
41 | option cc_enable_arenas = true;
42 | option go_package = "github.com/golang/protobuf/ptypes/wrappers";
43 | option java_package = "com.google.protobuf";
44 | option java_outer_classname = "WrappersProto";
45 | option java_multiple_files = true;
46 | option objc_class_prefix = "GPB";
47 |
48 | // Wrapper message for `double`.
49 | //
50 | // The JSON representation for `DoubleValue` is JSON number.
51 | message DoubleValue {
52 | // The double value.
53 | double value = 1;
54 | }
55 |
56 | // Wrapper message for `float`.
57 | //
58 | // The JSON representation for `FloatValue` is JSON number.
59 | message FloatValue {
60 | // The float value.
61 | float value = 1;
62 | }
63 |
64 | // Wrapper message for `int64`.
65 | //
66 | // The JSON representation for `Int64Value` is JSON string.
67 | message Int64Value {
68 | // The int64 value.
69 | int64 value = 1;
70 | }
71 |
72 | // Wrapper message for `uint64`.
73 | //
74 | // The JSON representation for `UInt64Value` is JSON string.
75 | message UInt64Value {
76 | // The uint64 value.
77 | uint64 value = 1;
78 | }
79 |
80 | // Wrapper message for `int32`.
81 | //
82 | // The JSON representation for `Int32Value` is JSON number.
83 | message Int32Value {
84 | // The int32 value.
85 | int32 value = 1;
86 | }
87 |
88 | // Wrapper message for `uint32`.
89 | //
90 | // The JSON representation for `UInt32Value` is JSON number.
91 | message UInt32Value {
92 | // The uint32 value.
93 | uint32 value = 1;
94 | }
95 |
96 | // Wrapper message for `bool`.
97 | //
98 | // The JSON representation for `BoolValue` is JSON `true` and `false`.
99 | message BoolValue {
100 | // The bool value.
101 | bool value = 1;
102 | }
103 |
104 | // Wrapper message for `string`.
105 | //
106 | // The JSON representation for `StringValue` is JSON string.
107 | message StringValue {
108 | // The string value.
109 | string value = 1;
110 | }
111 |
112 | // Wrapper message for `bytes`.
113 | //
114 | // The JSON representation for `BytesValue` is JSON string.
115 | message BytesValue {
116 | // The bytes value.
117 | bytes value = 1;
118 | }
119 |
--------------------------------------------------------------------------------