parent
4b8062a487
commit
8b2ca4bfc3
@ -0,0 +1,38 @@
|
|||||||
|
# Reference https://github.com/github/gitignore/blob/master/Go.gitignore
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# Dependency directories (remove the comment below to include it)
|
||||||
|
vendor/
|
||||||
|
|
||||||
|
# Go workspace file
|
||||||
|
go.work
|
||||||
|
|
||||||
|
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# OS General
|
||||||
|
Thumbs.db
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# project
|
||||||
|
*.cert
|
||||||
|
*.key
|
||||||
|
*.log
|
||||||
|
bin/
|
||||||
|
|
||||||
|
# Develop tools
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
@ -0,0 +1,24 @@
|
|||||||
|
FROM golang:1.16 AS builder
|
||||||
|
|
||||||
|
COPY . /src
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
RUN GOPROXY=https://goproxy.cn make build
|
||||||
|
|
||||||
|
FROM debian:stable-slim
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
|
netbase \
|
||||||
|
&& rm -rf /var/lib/apt/lists/ \
|
||||||
|
&& apt-get autoremove -y && apt-get autoclean -y
|
||||||
|
|
||||||
|
COPY --from=builder /src/bin /app
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
EXPOSE 9000
|
||||||
|
VOLUME /data/conf
|
||||||
|
|
||||||
|
CMD ["./server", "-conf", "/data/conf"]
|
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 go-kratos
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -0,0 +1,83 @@
|
|||||||
|
GOHOSTOS:=$(shell go env GOHOSTOS)
|
||||||
|
GOPATH:=$(shell go env GOPATH)
|
||||||
|
VERSION=$(shell git describe --tags --always)
|
||||||
|
|
||||||
|
ifeq ($(GOHOSTOS), windows)
|
||||||
|
#the `find.exe` is different from `find` in bash/shell.
|
||||||
|
#to see https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/find.
|
||||||
|
#changed to use git-bash.exe to run find cli or other cli friendly, caused of every developer has a Git.
|
||||||
|
#Git_Bash= $(subst cmd\,bin\bash.exe,$(dir $(shell where git)))
|
||||||
|
Git_Bash=$(subst \,/,$(subst cmd\,bin\bash.exe,$(dir $(shell where git))))
|
||||||
|
INTERNAL_PROTO_FILES=$(shell $(Git_Bash) -c "find internal -name *.proto")
|
||||||
|
API_PROTO_FILES=$(shell $(Git_Bash) -c "find api -name *.proto")
|
||||||
|
else
|
||||||
|
INTERNAL_PROTO_FILES=$(shell find internal -name *.proto)
|
||||||
|
API_PROTO_FILES=$(shell find api -name *.proto)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: init
|
||||||
|
# init env
|
||||||
|
init:
|
||||||
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||||
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||||
|
go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
|
||||||
|
go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest
|
||||||
|
go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest
|
||||||
|
go install github.com/google/wire/cmd/wire@latest
|
||||||
|
|
||||||
|
.PHONY: config
|
||||||
|
# generate internal proto
|
||||||
|
config:
|
||||||
|
protoc --proto_path=./internal \
|
||||||
|
--proto_path=./third_party \
|
||||||
|
--go_out=paths=source_relative:./internal \
|
||||||
|
$(INTERNAL_PROTO_FILES)
|
||||||
|
|
||||||
|
.PHONY: api
|
||||||
|
# generate api proto
|
||||||
|
api:
|
||||||
|
protoc --proto_path=./api \
|
||||||
|
--proto_path=./third_party \
|
||||||
|
--go_out=paths=source_relative:./api \
|
||||||
|
--go-http_out=paths=source_relative:./api \
|
||||||
|
--go-grpc_out=paths=source_relative:./api \
|
||||||
|
--openapi_out=fq_schema_naming=true,default_response=false:. \
|
||||||
|
$(API_PROTO_FILES)
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
# build
|
||||||
|
build:
|
||||||
|
mkdir -p bin/ && go build -ldflags "-X main.Version=$(VERSION)" -o ./bin/ ./...
|
||||||
|
|
||||||
|
.PHONY: generate
|
||||||
|
# generate
|
||||||
|
generate:
|
||||||
|
go mod tidy
|
||||||
|
go get github.com/google/wire/cmd/wire@latest
|
||||||
|
go generate ./...
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
# generate all
|
||||||
|
all:
|
||||||
|
make api;
|
||||||
|
make config;
|
||||||
|
make generate;
|
||||||
|
|
||||||
|
# show help
|
||||||
|
help:
|
||||||
|
@echo ''
|
||||||
|
@echo 'Usage:'
|
||||||
|
@echo ' make [target]'
|
||||||
|
@echo ''
|
||||||
|
@echo 'Targets:'
|
||||||
|
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
|
||||||
|
helpMessage = match(lastLine, /^# (.*)/); \
|
||||||
|
if (helpMessage) { \
|
||||||
|
helpCommand = substr($$1, 0, index($$1, ":")-1); \
|
||||||
|
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
|
||||||
|
printf "\033[36m%-22s\033[0m %s\n", helpCommand,helpMessage; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
{ lastLine = $$0 }' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := help
|
@ -0,0 +1,51 @@
|
|||||||
|
# Kratos Project Template
|
||||||
|
|
||||||
|
## Install Kratos
|
||||||
|
```
|
||||||
|
go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
|
||||||
|
```
|
||||||
|
## Create a service
|
||||||
|
```
|
||||||
|
# Create a template project
|
||||||
|
kratos new server
|
||||||
|
|
||||||
|
cd server
|
||||||
|
# Add a proto template
|
||||||
|
kratos proto add api/server/server.proto
|
||||||
|
# Generate the proto code
|
||||||
|
kratos proto client api/server/server.proto
|
||||||
|
# Generate the source code of service by proto file
|
||||||
|
kratos proto server api/server/server.proto -t internal/service
|
||||||
|
|
||||||
|
go generate ./...
|
||||||
|
go build -o ./bin/ ./...
|
||||||
|
./bin/server -conf ./configs
|
||||||
|
```
|
||||||
|
## Generate other auxiliary files by Makefile
|
||||||
|
```
|
||||||
|
# Download and update dependencies
|
||||||
|
make init
|
||||||
|
# Generate API files (include: pb.go, http, grpc, validate, swagger) by proto file
|
||||||
|
make api
|
||||||
|
# Generate all files
|
||||||
|
make all
|
||||||
|
```
|
||||||
|
## Automated Initialization (wire)
|
||||||
|
```
|
||||||
|
# install wire
|
||||||
|
go get github.com/google/wire/cmd/wire
|
||||||
|
|
||||||
|
# generate wire
|
||||||
|
cd cmd/server
|
||||||
|
wire
|
||||||
|
```
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
```bash
|
||||||
|
# build
|
||||||
|
docker build -t <your-docker-image-name> .
|
||||||
|
|
||||||
|
# run
|
||||||
|
docker run --rm -p 8000:8000 -p 9000:9000 -v </path/to/your/configs>:/data/conf <your-docker-image-name>
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,135 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.27.1
|
||||||
|
// protoc v3.19.3
|
||||||
|
// source: helloworld/v1/error_reason.proto
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type ErrorReason int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
ErrorReason_GEETER_UNSPECIFIED ErrorReason = 0
|
||||||
|
ErrorReason_USER_NOT_FOUND ErrorReason = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for ErrorReason.
|
||||||
|
var (
|
||||||
|
ErrorReason_name = map[int32]string{
|
||||||
|
0: "GEETER_UNSPECIFIED",
|
||||||
|
1: "USER_NOT_FOUND",
|
||||||
|
}
|
||||||
|
ErrorReason_value = map[string]int32{
|
||||||
|
"GEETER_UNSPECIFIED": 0,
|
||||||
|
"USER_NOT_FOUND": 1,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x ErrorReason) Enum() *ErrorReason {
|
||||||
|
p := new(ErrorReason)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x ErrorReason) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ErrorReason) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_helloworld_v1_error_reason_proto_enumTypes[0].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ErrorReason) Type() protoreflect.EnumType {
|
||||||
|
return &file_helloworld_v1_error_reason_proto_enumTypes[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x ErrorReason) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ErrorReason.Descriptor instead.
|
||||||
|
func (ErrorReason) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_helloworld_v1_error_reason_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_helloworld_v1_error_reason_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_helloworld_v1_error_reason_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x20, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2f, 0x76, 0x31, 0x2f,
|
||||||
|
0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x12, 0x0d, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76,
|
||||||
|
0x31, 0x2a, 0x39, 0x0a, 0x0b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e,
|
||||||
|
0x12, 0x16, 0x0a, 0x12, 0x47, 0x45, 0x45, 0x54, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,
|
||||||
|
0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x53, 0x45, 0x52,
|
||||||
|
0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x42, 0x5c, 0x0a, 0x0d,
|
||||||
|
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x50, 0x01, 0x5a,
|
||||||
|
0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x6b,
|
||||||
|
0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x6c, 0x61, 0x79,
|
||||||
|
0x6f, 0x75, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72,
|
||||||
|
0x6c, 0x64, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0xa2, 0x02, 0x0f, 0x41, 0x50, 0x49, 0x48, 0x65,
|
||||||
|
0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_helloworld_v1_error_reason_proto_rawDescOnce sync.Once
|
||||||
|
file_helloworld_v1_error_reason_proto_rawDescData = file_helloworld_v1_error_reason_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_helloworld_v1_error_reason_proto_rawDescGZIP() []byte {
|
||||||
|
file_helloworld_v1_error_reason_proto_rawDescOnce.Do(func() {
|
||||||
|
file_helloworld_v1_error_reason_proto_rawDescData = protoimpl.X.CompressGZIP(file_helloworld_v1_error_reason_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_helloworld_v1_error_reason_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_helloworld_v1_error_reason_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
|
var file_helloworld_v1_error_reason_proto_goTypes = []interface{}{
|
||||||
|
(ErrorReason)(0), // 0: helloworld.v1.ErrorReason
|
||||||
|
}
|
||||||
|
var file_helloworld_v1_error_reason_proto_depIdxs = []int32{
|
||||||
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
0, // [0:0] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_helloworld_v1_error_reason_proto_init() }
|
||||||
|
func file_helloworld_v1_error_reason_proto_init() {
|
||||||
|
if File_helloworld_v1_error_reason_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_helloworld_v1_error_reason_proto_rawDesc,
|
||||||
|
NumEnums: 1,
|
||||||
|
NumMessages: 0,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_helloworld_v1_error_reason_proto_goTypes,
|
||||||
|
DependencyIndexes: file_helloworld_v1_error_reason_proto_depIdxs,
|
||||||
|
EnumInfos: file_helloworld_v1_error_reason_proto_enumTypes,
|
||||||
|
}.Build()
|
||||||
|
File_helloworld_v1_error_reason_proto = out.File
|
||||||
|
file_helloworld_v1_error_reason_proto_rawDesc = nil
|
||||||
|
file_helloworld_v1_error_reason_proto_goTypes = nil
|
||||||
|
file_helloworld_v1_error_reason_proto_depIdxs = nil
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package helloworld.v1;
|
||||||
|
|
||||||
|
option go_package = "map/api/helloworld/v1;v1";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option java_package = "helloworld.v1";
|
||||||
|
option objc_class_prefix = "APIHelloworldV1";
|
||||||
|
|
||||||
|
enum ErrorReason {
|
||||||
|
GREETER_UNSPECIFIED = 0;
|
||||||
|
USER_NOT_FOUND = 1;
|
||||||
|
}
|
@ -0,0 +1,225 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.27.1
|
||||||
|
// protoc v3.19.3
|
||||||
|
// source: helloworld/v1/greeter.proto
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// The request message containing the user's name.
|
||||||
|
type HelloRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HelloRequest) Reset() {
|
||||||
|
*x = HelloRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_helloworld_v1_greeter_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HelloRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HelloRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HelloRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_helloworld_v1_greeter_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*HelloRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_helloworld_v1_greeter_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HelloRequest) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// The response message containing the greetings
|
||||||
|
type HelloReply struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HelloReply) Reset() {
|
||||||
|
*x = HelloReply{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_helloworld_v1_greeter_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HelloReply) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HelloReply) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HelloReply) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_helloworld_v1_greeter_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.
|
||||||
|
func (*HelloReply) Descriptor() ([]byte, []int) {
|
||||||
|
return file_helloworld_v1_greeter_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HelloReply) GetMessage() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Message
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_helloworld_v1_greeter_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_helloworld_v1_greeter_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x1b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2f, 0x76, 0x31, 0x2f,
|
||||||
|
0x67, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x68,
|
||||||
|
0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f,
|
||||||
|
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74,
|
||||||
|
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x22, 0x0a, 0x0c, 0x48, 0x65,
|
||||||
|
0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
|
||||||
|
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x26,
|
||||||
|
0x0a, 0x0a, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07,
|
||||||
|
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
|
||||||
|
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x69, 0x0a, 0x07, 0x47, 0x72, 0x65, 0x65, 0x74, 0x65,
|
||||||
|
0x72, 0x12, 0x5e, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x1b, 0x2e,
|
||||||
|
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65,
|
||||||
|
0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x65, 0x6c,
|
||||||
|
0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f,
|
||||||
|
0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f,
|
||||||
|
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,
|
||||||
|
0x7d, 0x42, 0x6c, 0x0a, 0x1c, 0x64, 0x65, 0x76, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e,
|
||||||
|
0x61, 0x70, 0x69, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x76,
|
||||||
|
0x31, 0x42, 0x11, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x50, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x56, 0x31, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
|
||||||
|
0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x6b, 0x72, 0x61,
|
||||||
|
0x74, 0x6f, 0x73, 0x2d, 0x6c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68,
|
||||||
|
0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62,
|
||||||
|
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_helloworld_v1_greeter_proto_rawDescOnce sync.Once
|
||||||
|
file_helloworld_v1_greeter_proto_rawDescData = file_helloworld_v1_greeter_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_helloworld_v1_greeter_proto_rawDescGZIP() []byte {
|
||||||
|
file_helloworld_v1_greeter_proto_rawDescOnce.Do(func() {
|
||||||
|
file_helloworld_v1_greeter_proto_rawDescData = protoimpl.X.CompressGZIP(file_helloworld_v1_greeter_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_helloworld_v1_greeter_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_helloworld_v1_greeter_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
|
var file_helloworld_v1_greeter_proto_goTypes = []interface{}{
|
||||||
|
(*HelloRequest)(nil), // 0: helloworld.v1.HelloRequest
|
||||||
|
(*HelloReply)(nil), // 1: helloworld.v1.HelloReply
|
||||||
|
}
|
||||||
|
var file_helloworld_v1_greeter_proto_depIdxs = []int32{
|
||||||
|
0, // 0: helloworld.v1.Greeter.SayHello:input_type -> helloworld.v1.HelloRequest
|
||||||
|
1, // 1: helloworld.v1.Greeter.SayHello:output_type -> helloworld.v1.HelloReply
|
||||||
|
1, // [1:2] is the sub-list for method output_type
|
||||||
|
0, // [0:1] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_helloworld_v1_greeter_proto_init() }
|
||||||
|
func file_helloworld_v1_greeter_proto_init() {
|
||||||
|
if File_helloworld_v1_greeter_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_helloworld_v1_greeter_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HelloRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_helloworld_v1_greeter_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HelloReply); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_helloworld_v1_greeter_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 2,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 1,
|
||||||
|
},
|
||||||
|
GoTypes: file_helloworld_v1_greeter_proto_goTypes,
|
||||||
|
DependencyIndexes: file_helloworld_v1_greeter_proto_depIdxs,
|
||||||
|
MessageInfos: file_helloworld_v1_greeter_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_helloworld_v1_greeter_proto = out.File
|
||||||
|
file_helloworld_v1_greeter_proto_rawDesc = nil
|
||||||
|
file_helloworld_v1_greeter_proto_goTypes = nil
|
||||||
|
file_helloworld_v1_greeter_proto_depIdxs = nil
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package helloworld.v1;
|
||||||
|
|
||||||
|
import "google/api/annotations.proto";
|
||||||
|
|
||||||
|
option go_package = "map/api/helloworld/v1;v1";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option java_package = "dev.kratos.api.helloworld.v1";
|
||||||
|
option java_outer_classname = "HelloworldProtoV1";
|
||||||
|
|
||||||
|
// The greeting service definition.
|
||||||
|
service Greeter {
|
||||||
|
// Sends a greeting
|
||||||
|
rpc SayHello (HelloRequest) returns (HelloReply) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
get: "/helloworld/{name}"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The request message containing the user's name.
|
||||||
|
message HelloRequest {
|
||||||
|
string name = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The response message containing the greetings
|
||||||
|
message HelloReply {
|
||||||
|
string message = 1;
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.2.0
|
||||||
|
// - protoc v3.19.3
|
||||||
|
// source: helloworld/v1/greeter.proto
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
|
// GreeterClient is the client API for Greeter service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type GreeterClient interface {
|
||||||
|
// Sends a greeting
|
||||||
|
SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type greeterClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient {
|
||||||
|
return &greeterClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
|
||||||
|
out := new(HelloReply)
|
||||||
|
err := c.cc.Invoke(ctx, "/helloworld.v1.Greeter/SayHello", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GreeterServer is the server API for Greeter service.
|
||||||
|
// All implementations must embed UnimplementedGreeterServer
|
||||||
|
// for forward compatibility
|
||||||
|
type GreeterServer interface {
|
||||||
|
// Sends a greeting
|
||||||
|
SayHello(context.Context, *HelloRequest) (*HelloReply, error)
|
||||||
|
mustEmbedUnimplementedGreeterServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedGreeterServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedGreeterServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedGreeterServer) mustEmbedUnimplementedGreeterServer() {}
|
||||||
|
|
||||||
|
// UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to GreeterServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeGreeterServer interface {
|
||||||
|
mustEmbedUnimplementedGreeterServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) {
|
||||||
|
s.RegisterService(&Greeter_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(HelloRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(GreeterServer).SayHello(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/helloworld.v1.Greeter/SayHello",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var Greeter_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "helloworld.v1.Greeter",
|
||||||
|
HandlerType: (*GreeterServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "SayHello",
|
||||||
|
Handler: _Greeter_SayHello_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "helloworld/v1/greeter.proto",
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
// Code generated by protoc-gen-go-http. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go-http v2.1.3
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
http "github.com/go-kratos/kratos/v2/transport/http"
|
||||||
|
binding "github.com/go-kratos/kratos/v2/transport/http/binding"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the kratos package it is being compiled against.
|
||||||
|
var _ = new(context.Context)
|
||||||
|
var _ = binding.EncodeURL
|
||||||
|
|
||||||
|
const _ = http.SupportPackageIsVersion1
|
||||||
|
|
||||||
|
type GreeterHTTPServer interface {
|
||||||
|
SayHello(context.Context, *HelloRequest) (*HelloReply, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterGreeterHTTPServer(s *http.Server, srv GreeterHTTPServer) {
|
||||||
|
r := s.Route("/")
|
||||||
|
r.GET("/helloworld/{name}", _Greeter_SayHello0_HTTP_Handler(srv))
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Greeter_SayHello0_HTTP_Handler(srv GreeterHTTPServer) func(ctx http.Context) error {
|
||||||
|
return func(ctx http.Context) error {
|
||||||
|
var in HelloRequest
|
||||||
|
if err := ctx.BindQuery(&in); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := ctx.BindVars(&in); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
http.SetOperation(ctx, "/helloworld.v1.Greeter/SayHello")
|
||||||
|
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.SayHello(ctx, req.(*HelloRequest))
|
||||||
|
})
|
||||||
|
out, err := h(ctx, &in)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
reply := out.(*HelloReply)
|
||||||
|
return ctx.Result(200, reply)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type GreeterHTTPClient interface {
|
||||||
|
SayHello(ctx context.Context, req *HelloRequest, opts ...http.CallOption) (rsp *HelloReply, err error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type GreeterHTTPClientImpl struct {
|
||||||
|
cc *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGreeterHTTPClient(client *http.Client) GreeterHTTPClient {
|
||||||
|
return &GreeterHTTPClientImpl{client}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *GreeterHTTPClientImpl) SayHello(ctx context.Context, in *HelloRequest, opts ...http.CallOption) (*HelloReply, error) {
|
||||||
|
var out HelloReply
|
||||||
|
pattern := "/helloworld/{name}"
|
||||||
|
path := binding.EncodeURL(pattern, in, true)
|
||||||
|
opts = append(opts, http.Operation("/helloworld.v1.Greeter/SayHello"))
|
||||||
|
opts = append(opts, http.PathTemplate(pattern))
|
||||||
|
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &out, err
|
||||||
|
}
|
@ -0,0 +1,256 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.29.0
|
||||||
|
// protoc v3.14.0
|
||||||
|
// source: api/mapService/mapService.proto
|
||||||
|
|
||||||
|
package mapService
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetDrivingInfoReq struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Origin string `protobuf:"bytes,1,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||||
|
Destination string `protobuf:"bytes,2,opt,name=destination,proto3" json:"destination,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReq) Reset() {
|
||||||
|
*x = GetDrivingInfoReq{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_api_mapService_mapService_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetDrivingInfoReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_api_mapService_mapService_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetDrivingInfoReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetDrivingInfoReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_api_mapService_mapService_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReq) GetOrigin() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Origin
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReq) GetDestination() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Destination
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetDrivingInfoReply struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Origin string `protobuf:"bytes,1,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||||
|
Destination string `protobuf:"bytes,2,opt,name=destination,proto3" json:"destination,omitempty"`
|
||||||
|
Distance string `protobuf:"bytes,3,opt,name=distance,proto3" json:"distance,omitempty"`
|
||||||
|
Duration string `protobuf:"bytes,4,opt,name=duration,proto3" json:"duration,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReply) Reset() {
|
||||||
|
*x = GetDrivingInfoReply{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_api_mapService_mapService_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReply) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetDrivingInfoReply) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReply) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_api_mapService_mapService_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetDrivingInfoReply.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetDrivingInfoReply) Descriptor() ([]byte, []int) {
|
||||||
|
return file_api_mapService_mapService_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReply) GetOrigin() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Origin
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReply) GetDestination() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Destination
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReply) GetDistance() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Distance
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetDrivingInfoReply) GetDuration() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Duration
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_api_mapService_mapService_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_api_mapService_mapService_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
|
0x2f, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x12, 0x0e, 0x61, 0x70, 0x69, 0x2e, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||||
|
0x65, 0x22, 0x4d, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x49,
|
||||||
|
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e,
|
||||||
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x20,
|
||||||
|
0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20,
|
||||||
|
0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||||
|
0x22, 0x87, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x49,
|
||||||
|
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67,
|
||||||
|
0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e,
|
||||||
|
0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18,
|
||||||
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69,
|
||||||
|
0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a,
|
||||||
|
0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
||||||
|
0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x66, 0x0a, 0x0a, 0x4d, 0x61,
|
||||||
|
0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x44,
|
||||||
|
0x72, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69,
|
||||||
|
0x2e, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x44,
|
||||||
|
0x72, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x23, 0x2e,
|
||||||
|
0x61, 0x70, 0x69, 0x2e, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47,
|
||||||
|
0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70,
|
||||||
|
0x6c, 0x79, 0x42, 0x1f, 0x5a, 0x1d, 0x6d, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61,
|
||||||
|
0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3b, 0x6d, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76,
|
||||||
|
0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_api_mapService_mapService_proto_rawDescOnce sync.Once
|
||||||
|
file_api_mapService_mapService_proto_rawDescData = file_api_mapService_mapService_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_api_mapService_mapService_proto_rawDescGZIP() []byte {
|
||||||
|
file_api_mapService_mapService_proto_rawDescOnce.Do(func() {
|
||||||
|
file_api_mapService_mapService_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_mapService_mapService_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_api_mapService_mapService_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_api_mapService_mapService_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
|
var file_api_mapService_mapService_proto_goTypes = []interface{}{
|
||||||
|
(*GetDrivingInfoReq)(nil), // 0: api.mapService.GetDrivingInfoReq
|
||||||
|
(*GetDrivingInfoReply)(nil), // 1: api.mapService.GetDrivingInfoReply
|
||||||
|
}
|
||||||
|
var file_api_mapService_mapService_proto_depIdxs = []int32{
|
||||||
|
0, // 0: api.mapService.MapService.GetDrivingInfo:input_type -> api.mapService.GetDrivingInfoReq
|
||||||
|
1, // 1: api.mapService.MapService.GetDrivingInfo:output_type -> api.mapService.GetDrivingInfoReply
|
||||||
|
1, // [1:2] is the sub-list for method output_type
|
||||||
|
0, // [0:1] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_api_mapService_mapService_proto_init() }
|
||||||
|
func file_api_mapService_mapService_proto_init() {
|
||||||
|
if File_api_mapService_mapService_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_api_mapService_mapService_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GetDrivingInfoReq); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_api_mapService_mapService_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GetDrivingInfoReply); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_api_mapService_mapService_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 2,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 1,
|
||||||
|
},
|
||||||
|
GoTypes: file_api_mapService_mapService_proto_goTypes,
|
||||||
|
DependencyIndexes: file_api_mapService_mapService_proto_depIdxs,
|
||||||
|
MessageInfos: file_api_mapService_mapService_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_api_mapService_mapService_proto = out.File
|
||||||
|
file_api_mapService_mapService_proto_rawDesc = nil
|
||||||
|
file_api_mapService_mapService_proto_goTypes = nil
|
||||||
|
file_api_mapService_mapService_proto_depIdxs = nil
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package api.mapService;
|
||||||
|
|
||||||
|
option go_package = "map/api/mapService;mapService";
|
||||||
|
|
||||||
|
service MapService {
|
||||||
|
rpc GetDrivingInfo (GetDrivingInfoReq) returns (GetDrivingInfoReply);
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDrivingInfoReq {
|
||||||
|
string origin = 1;
|
||||||
|
string destination = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetDrivingInfoReply {
|
||||||
|
string origin = 1;
|
||||||
|
string destination = 2;
|
||||||
|
string distance = 3;
|
||||||
|
string duration = 4;
|
||||||
|
}
|
@ -0,0 +1,109 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.3.0
|
||||||
|
// - protoc v3.14.0
|
||||||
|
// source: api/mapService/mapService.proto
|
||||||
|
|
||||||
|
package mapService
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
|
const (
|
||||||
|
MapService_GetDrivingInfo_FullMethodName = "/api.mapService.MapService/GetDrivingInfo"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MapServiceClient is the client API for MapService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type MapServiceClient interface {
|
||||||
|
GetDrivingInfo(ctx context.Context, in *GetDrivingInfoReq, opts ...grpc.CallOption) (*GetDrivingInfoReply, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type mapServiceClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMapServiceClient(cc grpc.ClientConnInterface) MapServiceClient {
|
||||||
|
return &mapServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *mapServiceClient) GetDrivingInfo(ctx context.Context, in *GetDrivingInfoReq, opts ...grpc.CallOption) (*GetDrivingInfoReply, error) {
|
||||||
|
out := new(GetDrivingInfoReply)
|
||||||
|
err := c.cc.Invoke(ctx, MapService_GetDrivingInfo_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapServiceServer is the server API for MapService service.
|
||||||
|
// All implementations must embed UnimplementedMapServiceServer
|
||||||
|
// for forward compatibility
|
||||||
|
type MapServiceServer interface {
|
||||||
|
GetDrivingInfo(context.Context, *GetDrivingInfoReq) (*GetDrivingInfoReply, error)
|
||||||
|
mustEmbedUnimplementedMapServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedMapServiceServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedMapServiceServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedMapServiceServer) GetDrivingInfo(context.Context, *GetDrivingInfoReq) (*GetDrivingInfoReply, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetDrivingInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedMapServiceServer) mustEmbedUnimplementedMapServiceServer() {}
|
||||||
|
|
||||||
|
// UnsafeMapServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to MapServiceServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeMapServiceServer interface {
|
||||||
|
mustEmbedUnimplementedMapServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterMapServiceServer(s grpc.ServiceRegistrar, srv MapServiceServer) {
|
||||||
|
s.RegisterService(&MapService_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _MapService_GetDrivingInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetDrivingInfoReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(MapServiceServer).GetDrivingInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: MapService_GetDrivingInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(MapServiceServer).GetDrivingInfo(ctx, req.(*GetDrivingInfoReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapService_ServiceDesc is the grpc.ServiceDesc for MapService service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var MapService_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "api.mapService.MapService",
|
||||||
|
HandlerType: (*MapServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "GetDrivingInfo",
|
||||||
|
Handler: _MapService_GetDrivingInfo_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "api/mapService/mapService.proto",
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"map/internal/conf"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2"
|
||||||
|
"github.com/go-kratos/kratos/v2/config"
|
||||||
|
"github.com/go-kratos/kratos/v2/config/file"
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
"github.com/go-kratos/kratos/v2/middleware/tracing"
|
||||||
|
"github.com/go-kratos/kratos/v2/transport/grpc"
|
||||||
|
"github.com/go-kratos/kratos/v2/transport/http"
|
||||||
|
|
||||||
|
_ "go.uber.org/automaxprocs"
|
||||||
|
)
|
||||||
|
|
||||||
|
// go build -ldflags "-X main.Version=x.y.z"
|
||||||
|
var (
|
||||||
|
// Name is the name of the compiled software.
|
||||||
|
Name string
|
||||||
|
// Version is the version of the compiled software.
|
||||||
|
Version string
|
||||||
|
// flagconf is the config flag.
|
||||||
|
flagconf string
|
||||||
|
|
||||||
|
id, _ = os.Hostname()
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.StringVar(&flagconf, "conf", "../../configs", "config path, eg: -conf config.yaml")
|
||||||
|
}
|
||||||
|
|
||||||
|
func newApp(logger log.Logger, gs *grpc.Server, hs *http.Server) *kratos.App {
|
||||||
|
return kratos.New(
|
||||||
|
kratos.ID(id),
|
||||||
|
kratos.Name(Name),
|
||||||
|
kratos.Version(Version),
|
||||||
|
kratos.Metadata(map[string]string{}),
|
||||||
|
kratos.Logger(logger),
|
||||||
|
kratos.Server(
|
||||||
|
gs,
|
||||||
|
hs,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
logger := log.With(log.NewStdLogger(os.Stdout),
|
||||||
|
"ts", log.DefaultTimestamp,
|
||||||
|
"caller", log.DefaultCaller,
|
||||||
|
"service.id", id,
|
||||||
|
"service.name", Name,
|
||||||
|
"service.version", Version,
|
||||||
|
"trace.id", tracing.TraceID(),
|
||||||
|
"span.id", tracing.SpanID(),
|
||||||
|
)
|
||||||
|
c := config.New(
|
||||||
|
config.WithSource(
|
||||||
|
file.NewSource(flagconf),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
defer c.Close()
|
||||||
|
|
||||||
|
if err := c.Load(); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var bc conf.Bootstrap
|
||||||
|
if err := c.Scan(&bc); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
app, cleanup, err := wireApp(bc.Server, bc.Data, logger)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer cleanup()
|
||||||
|
|
||||||
|
// start and wait for stop signal
|
||||||
|
if err := app.Run(); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
//go:build wireinject
|
||||||
|
// +build wireinject
|
||||||
|
|
||||||
|
// The build tag makes sure the stub is not built in the final build.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"map/internal/biz"
|
||||||
|
"map/internal/conf"
|
||||||
|
"map/internal/data"
|
||||||
|
"map/internal/server"
|
||||||
|
"map/internal/service"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2"
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
"github.com/google/wire"
|
||||||
|
)
|
||||||
|
|
||||||
|
// wireApp init kratos application.
|
||||||
|
func wireApp(*conf.Server, *conf.Data, log.Logger) (*kratos.App, func(), error) {
|
||||||
|
panic(wire.Build(server.ProviderSet, data.ProviderSet, biz.ProviderSet, service.ProviderSet, newApp))
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
// Code generated by Wire. DO NOT EDIT.
|
||||||
|
|
||||||
|
//go:generate go run github.com/google/wire/cmd/wire
|
||||||
|
//go:build !wireinject
|
||||||
|
// +build !wireinject
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-kratos/kratos/v2"
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
"map/internal/biz"
|
||||||
|
"map/internal/conf"
|
||||||
|
"map/internal/data"
|
||||||
|
"map/internal/server"
|
||||||
|
"map/internal/service"
|
||||||
|
)
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "go.uber.org/automaxprocs"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Injectors from wire.go:
|
||||||
|
|
||||||
|
// wireApp init kratos application.
|
||||||
|
func wireApp(confServer *conf.Server, confData *conf.Data, logger log.Logger) (*kratos.App, func(), error) {
|
||||||
|
dataData, cleanup, err := data.NewData(confData, logger)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
greeterRepo := data.NewGreeterRepo(dataData, logger)
|
||||||
|
greeterUsecase := biz.NewGreeterUsecase(greeterRepo, logger)
|
||||||
|
greeterService := service.NewGreeterService(greeterUsecase)
|
||||||
|
mapServiceBiz := biz.NewMapServiceBiz(logger)
|
||||||
|
mapServiceService := service.NewMapServiceService(mapServiceBiz)
|
||||||
|
grpcServer := server.NewGRPCServer(confServer, greeterService, mapServiceService, logger)
|
||||||
|
httpServer := server.NewHTTPServer(confServer, greeterService, logger)
|
||||||
|
app := newApp(logger, grpcServer, httpServer)
|
||||||
|
return app, func() {
|
||||||
|
cleanup()
|
||||||
|
}, nil
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
server:
|
||||||
|
http:
|
||||||
|
addr: 0.0.0.0:8200
|
||||||
|
timeout: 1s
|
||||||
|
grpc:
|
||||||
|
addr: 0.0.0.0:9200
|
||||||
|
timeout: 1s
|
||||||
|
data:
|
||||||
|
database:
|
||||||
|
driver: mysql
|
||||||
|
source: root:root@tcp(127.0.0.1:3306)/test
|
||||||
|
redis:
|
||||||
|
addr: 127.0.0.1:6379
|
||||||
|
read_timeout: 0.2s
|
||||||
|
write_timeout: 0.2s
|
@ -0,0 +1,34 @@
|
|||||||
|
module map
|
||||||
|
|
||||||
|
go 1.17
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/go-kratos/kratos/v2 v2.4.1
|
||||||
|
github.com/google/wire v0.5.0
|
||||||
|
go.uber.org/automaxprocs v1.5.1
|
||||||
|
google.golang.org/genproto v0.0.0-20220524023933-508584e28198
|
||||||
|
google.golang.org/grpc v1.46.2
|
||||||
|
google.golang.org/protobuf v1.28.0
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||||
|
github.com/go-logr/logr v1.2.3 // indirect
|
||||||
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
|
github.com/go-playground/form/v4 v4.2.0 // indirect
|
||||||
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
|
github.com/google/subcommands v1.0.1 // indirect
|
||||||
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
|
github.com/gorilla/mux v1.8.0 // indirect
|
||||||
|
github.com/imdario/mergo v0.3.12 // indirect
|
||||||
|
github.com/kr/text v0.2.0 // indirect
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
go.opentelemetry.io/otel v1.7.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/trace v1.7.0 // indirect
|
||||||
|
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
|
||||||
|
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
|
||||||
|
golang.org/x/text v0.3.7 // indirect
|
||||||
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.0 // indirect
|
||||||
|
)
|
@ -0,0 +1,211 @@
|
|||||||
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
|
||||||
|
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||||
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
|
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||||
|
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||||
|
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
|
||||||
|
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
|
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
|
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||||
|
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
|
||||||
|
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||||
|
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
|
||||||
|
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
|
||||||
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
|
github.com/go-kratos/aegis v0.1.2/go.mod h1:jYeSQ3Gesba478zEnujOiG5QdsyF3Xk/8owFUeKcHxw=
|
||||||
|
github.com/go-kratos/kratos/v2 v2.4.1 h1:NFQy8Ha4Xu6T3Q40JlKzspvlMa5IGvIHhJw5+sqyV4c=
|
||||||
|
github.com/go-kratos/kratos/v2 v2.4.1/go.mod h1:5acyLj4EgY428AJnZl2EwCrMV1OVlttQFBum+SghMiA=
|
||||||
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
|
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
|
||||||
|
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
|
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
|
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||||
|
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
|
github.com/go-playground/form/v4 v4.2.0 h1:N1wh+Goz61e6w66vo8vJkQt+uwZSoLz50kZPJWR8eic=
|
||||||
|
github.com/go-playground/form/v4 v4.2.0/go.mod h1:q1a2BY+AQUUzhl6xA/6hBetay6dEIhMHjgvJiGo6K7U=
|
||||||
|
github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||||
|
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||||
|
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||||
|
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||||
|
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
|
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
|
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||||
|
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
|
||||||
|
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||||
|
github.com/google/subcommands v1.0.1 h1:/eqq+otEXm5vhfBrbREPCSVQbvofip6kIz+mX5TUH7k=
|
||||||
|
github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
|
||||||
|
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||||
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/google/wire v0.5.0 h1:I7ELFeVBr3yfPIcc8+MWvrjk+3VjbcSzoXm3JVa+jD8=
|
||||||
|
github.com/google/wire v0.5.0/go.mod h1:ngWDr9Qvq3yZA10YrxfyGELY/AFWGVpy9c1LTRi1EoU=
|
||||||
|
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
||||||
|
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||||
|
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
|
||||||
|
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
|
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
|
||||||
|
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
|
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||||
|
github.com/shirou/gopsutil/v3 v3.21.8/go.mod h1:YWp/H8Qs5fVmf17v7JNZzA0mPJ+mS2e9JdiUF9LlKzQ=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
|
||||||
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
|
||||||
|
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
|
||||||
|
go.opentelemetry.io/otel v1.7.0 h1:Z2lA3Tdch0iDcrhJXDIlC94XE+bxok1F9B+4Lz/lGsM=
|
||||||
|
go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.7.0 h1:4OmStpcKVOfvDOgCt7UriAPtKolwIhxpnSNI/yK+1B0=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU=
|
||||||
|
go.opentelemetry.io/otel/trace v1.7.0 h1:O37Iogk1lEkMRXewVtZ1BBTVn5JEp8GrJvP92bJqC6o=
|
||||||
|
go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
|
||||||
|
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||||
|
go.uber.org/automaxprocs v1.5.1 h1:e1YG66Lrk73dn4qhg8WFSvhF0JuFQF0ERIp4rpuV8Qk=
|
||||||
|
go.uber.org/automaxprocs v1.5.1/go.mod h1:BF4eumQw0P9GtnuxxovUd06vwm1o18oMzFtK66vU6XU=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||||
|
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y=
|
||||||
|
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 h1:w8s32wxx3sY+OjLlv9qltkLU5yvJzxjjgiHWLjdIcw4=
|
||||||
|
golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
|
||||||
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||||
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||||
|
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A=
|
||||||
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||||
|
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
|
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
||||||
|
google.golang.org/genproto v0.0.0-20220524023933-508584e28198 h1:a1g7i05I2vUwq5eYrmxBJy6rPbw/yo7WzzwPJmcC0P4=
|
||||||
|
google.golang.org/genproto v0.0.0-20220524023933-508584e28198/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
||||||
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
|
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||||
|
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||||
|
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
|
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||||
|
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||||
|
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
|
google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ=
|
||||||
|
google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||||
|
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||||
|
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
|
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||||
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
|
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
||||||
|
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||||
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
@ -0,0 +1 @@
|
|||||||
|
# Biz
|
@ -0,0 +1,6 @@
|
|||||||
|
package biz
|
||||||
|
|
||||||
|
import "github.com/google/wire"
|
||||||
|
|
||||||
|
// ProviderSet is biz providers.
|
||||||
|
var ProviderSet = wire.NewSet(NewGreeterUsecase, NewMapServiceBiz)
|
@ -0,0 +1,46 @@
|
|||||||
|
package biz
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
v1 "map/api/helloworld/v1"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/errors"
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ErrUserNotFound is user not found.
|
||||||
|
ErrUserNotFound = errors.NotFound(v1.ErrorReason_USER_NOT_FOUND.String(), "user not found")
|
||||||
|
)
|
||||||
|
|
||||||
|
// Greeter is a Greeter model.
|
||||||
|
type Greeter struct {
|
||||||
|
Hello string
|
||||||
|
}
|
||||||
|
|
||||||
|
// GreeterRepo is a Greater repo.
|
||||||
|
type GreeterRepo interface {
|
||||||
|
Save(context.Context, *Greeter) (*Greeter, error)
|
||||||
|
Update(context.Context, *Greeter) (*Greeter, error)
|
||||||
|
FindByID(context.Context, int64) (*Greeter, error)
|
||||||
|
ListByHello(context.Context, string) ([]*Greeter, error)
|
||||||
|
ListAll(context.Context) ([]*Greeter, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GreeterUsecase is a Greeter usecase.
|
||||||
|
type GreeterUsecase struct {
|
||||||
|
repo GreeterRepo
|
||||||
|
log *log.Helper
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGreeterUsecase new a Greeter usecase.
|
||||||
|
func NewGreeterUsecase(repo GreeterRepo, logger log.Logger) *GreeterUsecase {
|
||||||
|
return &GreeterUsecase{repo: repo, log: log.NewHelper(logger)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateGreeter creates a Greeter, and returns the new Greeter.
|
||||||
|
func (uc *GreeterUsecase) CreateGreeter(ctx context.Context, g *Greeter) (*Greeter, error) {
|
||||||
|
uc.log.WithContext(ctx).Infof("CreateGreeter: %v", g.Hello)
|
||||||
|
return uc.repo.Save(ctx, g)
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package biz
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MapServiceBiz struct {
|
||||||
|
log *log.Helper
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMapServiceBiz(logger log.Logger) *MapServiceBiz {
|
||||||
|
return &MapServiceBiz{log: log.NewHelper(logger)}
|
||||||
|
}
|
||||||
|
|
||||||
|
type DirectionDrivingResp struct {
|
||||||
|
Status string `json:"status,omitempty"`
|
||||||
|
Info string `json:"info,omitempty"`
|
||||||
|
Infocode string `json:"infocode,omitempty"`
|
||||||
|
Count string `json:"count,omitempty"`
|
||||||
|
Route struct {
|
||||||
|
Origin string `json:"origin,omitempty"`
|
||||||
|
Destination string `json:"destination,omitempty"`
|
||||||
|
Paths []Path `json:"paths,omitempty"`
|
||||||
|
} `json:"route"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Path struct {
|
||||||
|
Distance string `json:"distance,omitempty"`
|
||||||
|
Duration string `json:"duration,omitempty"`
|
||||||
|
Strategy string `json:"strategy,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msbiz *MapServiceBiz) GetDriverInfo(origin, destination string) (string, string, error) {
|
||||||
|
key := "bf898b32c1748a2668684e4bcbe4c496"
|
||||||
|
api := "https://restapi.amap.com/v3/direction/driving"
|
||||||
|
parameters := fmt.Sprintf("origin=%s&destination=%s&extensions=base&output=json&key=%s", origin, destination, key)
|
||||||
|
url := api + "?" + parameters
|
||||||
|
resp, err := http.Get(url)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
_ = resp.Body.Close()
|
||||||
|
}()
|
||||||
|
body, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", err
|
||||||
|
}
|
||||||
|
ddResp := DirectionDrivingResp{}
|
||||||
|
if err := json.Unmarshal(body, &ddResp); err != nil {
|
||||||
|
return "", "", err
|
||||||
|
}
|
||||||
|
if ddResp.Status == "0" {
|
||||||
|
return "", "", errors.New(ddResp.Info)
|
||||||
|
}
|
||||||
|
path := ddResp.Route.Paths[0]
|
||||||
|
return path.Distance, path.Duration, nil
|
||||||
|
}
|
@ -0,0 +1,652 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.27.1
|
||||||
|
// protoc v3.19.3
|
||||||
|
// source: conf/conf.proto
|
||||||
|
|
||||||
|
package conf
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
durationpb "google.golang.org/protobuf/types/known/durationpb"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type Bootstrap struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Server *Server `protobuf:"bytes,1,opt,name=server,proto3" json:"server,omitempty"`
|
||||||
|
Data *Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Bootstrap) Reset() {
|
||||||
|
*x = Bootstrap{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Bootstrap) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Bootstrap) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Bootstrap) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Bootstrap.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Bootstrap) Descriptor() ([]byte, []int) {
|
||||||
|
return file_conf_conf_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Bootstrap) GetServer() *Server {
|
||||||
|
if x != nil {
|
||||||
|
return x.Server
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Bootstrap) GetData() *Data {
|
||||||
|
if x != nil {
|
||||||
|
return x.Data
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Server struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Http *Server_HTTP `protobuf:"bytes,1,opt,name=http,proto3" json:"http,omitempty"`
|
||||||
|
Grpc *Server_GRPC `protobuf:"bytes,2,opt,name=grpc,proto3" json:"grpc,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server) Reset() {
|
||||||
|
*x = Server{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Server) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Server) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Server.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Server) Descriptor() ([]byte, []int) {
|
||||||
|
return file_conf_conf_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server) GetHttp() *Server_HTTP {
|
||||||
|
if x != nil {
|
||||||
|
return x.Http
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server) GetGrpc() *Server_GRPC {
|
||||||
|
if x != nil {
|
||||||
|
return x.Grpc
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Data struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Database *Data_Database `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
|
||||||
|
Redis *Data_Redis `protobuf:"bytes,2,opt,name=redis,proto3" json:"redis,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data) Reset() {
|
||||||
|
*x = Data{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Data) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Data) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Data.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Data) Descriptor() ([]byte, []int) {
|
||||||
|
return file_conf_conf_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data) GetDatabase() *Data_Database {
|
||||||
|
if x != nil {
|
||||||
|
return x.Database
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data) GetRedis() *Data_Redis {
|
||||||
|
if x != nil {
|
||||||
|
return x.Redis
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Server_HTTP struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"`
|
||||||
|
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
|
||||||
|
Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_HTTP) Reset() {
|
||||||
|
*x = Server_HTTP{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_HTTP) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Server_HTTP) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Server_HTTP) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[3]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Server_HTTP.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Server_HTTP) Descriptor() ([]byte, []int) {
|
||||||
|
return file_conf_conf_proto_rawDescGZIP(), []int{1, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_HTTP) GetNetwork() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Network
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_HTTP) GetAddr() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Addr
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_HTTP) GetTimeout() *durationpb.Duration {
|
||||||
|
if x != nil {
|
||||||
|
return x.Timeout
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Server_GRPC struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"`
|
||||||
|
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
|
||||||
|
Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_GRPC) Reset() {
|
||||||
|
*x = Server_GRPC{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_GRPC) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Server_GRPC) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Server_GRPC) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[4]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Server_GRPC.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Server_GRPC) Descriptor() ([]byte, []int) {
|
||||||
|
return file_conf_conf_proto_rawDescGZIP(), []int{1, 1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_GRPC) GetNetwork() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Network
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_GRPC) GetAddr() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Addr
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server_GRPC) GetTimeout() *durationpb.Duration {
|
||||||
|
if x != nil {
|
||||||
|
return x.Timeout
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Data_Database struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Driver string `protobuf:"bytes,1,opt,name=driver,proto3" json:"driver,omitempty"`
|
||||||
|
Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Database) Reset() {
|
||||||
|
*x = Data_Database{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Database) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Data_Database) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Data_Database) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[5]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Data_Database.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Data_Database) Descriptor() ([]byte, []int) {
|
||||||
|
return file_conf_conf_proto_rawDescGZIP(), []int{2, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Database) GetDriver() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Driver
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Database) GetSource() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Source
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type Data_Redis struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"`
|
||||||
|
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
|
||||||
|
ReadTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"`
|
||||||
|
WriteTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=write_timeout,json=writeTimeout,proto3" json:"write_timeout,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Redis) Reset() {
|
||||||
|
*x = Data_Redis{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Redis) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Data_Redis) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Data_Redis) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_conf_conf_proto_msgTypes[6]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Data_Redis.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Data_Redis) Descriptor() ([]byte, []int) {
|
||||||
|
return file_conf_conf_proto_rawDescGZIP(), []int{2, 1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Redis) GetNetwork() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Network
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Redis) GetAddr() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Addr
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Redis) GetReadTimeout() *durationpb.Duration {
|
||||||
|
if x != nil {
|
||||||
|
return x.ReadTimeout
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Data_Redis) GetWriteTimeout() *durationpb.Duration {
|
||||||
|
if x != nil {
|
||||||
|
return x.WriteTimeout
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_conf_conf_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_conf_conf_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x12, 0x0a, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x1e, 0x67,
|
||||||
|
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64,
|
||||||
|
0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5d, 0x0a,
|
||||||
|
0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x65,
|
||||||
|
0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6b, 0x72, 0x61,
|
||||||
|
0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06,
|
||||||
|
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02,
|
||||||
|
0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70,
|
||||||
|
0x69, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xb8, 0x02, 0x0a,
|
||||||
|
0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x04, 0x68, 0x74, 0x74, 0x70, 0x18,
|
||||||
|
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61,
|
||||||
|
0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x52, 0x04,
|
||||||
|
0x68, 0x74, 0x74, 0x70, 0x12, 0x2b, 0x0a, 0x04, 0x67, 0x72, 0x70, 0x63, 0x18, 0x02, 0x20, 0x01,
|
||||||
|
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e,
|
||||||
|
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x52, 0x50, 0x43, 0x52, 0x04, 0x67, 0x72, 0x70,
|
||||||
|
0x63, 0x1a, 0x69, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74,
|
||||||
|
0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77,
|
||||||
|
0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f,
|
||||||
|
0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
|
||||||
|
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74,
|
||||||
|
0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x1a, 0x69, 0x0a, 0x04,
|
||||||
|
0x47, 0x52, 0x50, 0x43, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18,
|
||||||
|
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12,
|
||||||
|
0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64,
|
||||||
|
0x64, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20,
|
||||||
|
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07,
|
||||||
|
0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0xdd, 0x02, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61,
|
||||||
|
0x12, 0x35, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||||
|
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e,
|
||||||
|
0x44, 0x61, 0x74, 0x61, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x08, 0x64,
|
||||||
|
0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x05, 0x72, 0x65, 0x64, 0x69, 0x73,
|
||||||
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e,
|
||||||
|
0x61, 0x70, 0x69, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x52, 0x05,
|
||||||
|
0x72, 0x65, 0x64, 0x69, 0x73, 0x1a, 0x3a, 0x0a, 0x08, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73,
|
||||||
|
0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75,
|
||||||
|
0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63,
|
||||||
|
0x65, 0x1a, 0xb3, 0x01, 0x0a, 0x05, 0x52, 0x65, 0x64, 0x69, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6e,
|
||||||
|
0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65,
|
||||||
|
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20,
|
||||||
|
0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x3c, 0x0a, 0x0c, 0x72, 0x65, 0x61,
|
||||||
|
0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||||
|
0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||||
|
0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x72, 0x65, 0x61, 0x64,
|
||||||
|
0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3e, 0x0a, 0x0d, 0x77, 0x72, 0x69, 0x74, 0x65,
|
||||||
|
0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
|
||||||
|
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||||
|
0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65,
|
||||||
|
0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75,
|
||||||
|
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f,
|
||||||
|
0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x6c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x2f, 0x69, 0x6e,
|
||||||
|
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x3b, 0x63, 0x6f, 0x6e, 0x66,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_conf_conf_proto_rawDescOnce sync.Once
|
||||||
|
file_conf_conf_proto_rawDescData = file_conf_conf_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_conf_conf_proto_rawDescGZIP() []byte {
|
||||||
|
file_conf_conf_proto_rawDescOnce.Do(func() {
|
||||||
|
file_conf_conf_proto_rawDescData = protoimpl.X.CompressGZIP(file_conf_conf_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_conf_conf_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_conf_conf_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||||
|
var file_conf_conf_proto_goTypes = []interface{}{
|
||||||
|
(*Bootstrap)(nil), // 0: kratos.api.Bootstrap
|
||||||
|
(*Server)(nil), // 1: kratos.api.Server
|
||||||
|
(*Data)(nil), // 2: kratos.api.Data
|
||||||
|
(*Server_HTTP)(nil), // 3: kratos.api.Server.HTTP
|
||||||
|
(*Server_GRPC)(nil), // 4: kratos.api.Server.GRPC
|
||||||
|
(*Data_Database)(nil), // 5: kratos.api.Data.Database
|
||||||
|
(*Data_Redis)(nil), // 6: kratos.api.Data.Redis
|
||||||
|
(*durationpb.Duration)(nil), // 7: google.protobuf.Duration
|
||||||
|
}
|
||||||
|
var file_conf_conf_proto_depIdxs = []int32{
|
||||||
|
1, // 0: kratos.api.Bootstrap.server:type_name -> kratos.api.Server
|
||||||
|
2, // 1: kratos.api.Bootstrap.data:type_name -> kratos.api.Data
|
||||||
|
3, // 2: kratos.api.Server.http:type_name -> kratos.api.Server.HTTP
|
||||||
|
4, // 3: kratos.api.Server.grpc:type_name -> kratos.api.Server.GRPC
|
||||||
|
5, // 4: kratos.api.Data.database:type_name -> kratos.api.Data.Database
|
||||||
|
6, // 5: kratos.api.Data.redis:type_name -> kratos.api.Data.Redis
|
||||||
|
7, // 6: kratos.api.Server.HTTP.timeout:type_name -> google.protobuf.Duration
|
||||||
|
7, // 7: kratos.api.Server.GRPC.timeout:type_name -> google.protobuf.Duration
|
||||||
|
7, // 8: kratos.api.Data.Redis.read_timeout:type_name -> google.protobuf.Duration
|
||||||
|
7, // 9: kratos.api.Data.Redis.write_timeout:type_name -> google.protobuf.Duration
|
||||||
|
10, // [10:10] is the sub-list for method output_type
|
||||||
|
10, // [10:10] is the sub-list for method input_type
|
||||||
|
10, // [10:10] is the sub-list for extension type_name
|
||||||
|
10, // [10:10] is the sub-list for extension extendee
|
||||||
|
0, // [0:10] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_conf_conf_proto_init() }
|
||||||
|
func file_conf_conf_proto_init() {
|
||||||
|
if File_conf_conf_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_conf_conf_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Bootstrap); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_conf_conf_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Server); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_conf_conf_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Data); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_conf_conf_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Server_HTTP); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_conf_conf_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Server_GRPC); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_conf_conf_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Data_Database); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_conf_conf_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Data_Redis); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_conf_conf_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 7,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_conf_conf_proto_goTypes,
|
||||||
|
DependencyIndexes: file_conf_conf_proto_depIdxs,
|
||||||
|
MessageInfos: file_conf_conf_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_conf_conf_proto = out.File
|
||||||
|
file_conf_conf_proto_rawDesc = nil
|
||||||
|
file_conf_conf_proto_goTypes = nil
|
||||||
|
file_conf_conf_proto_depIdxs = nil
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
package kratos.api;
|
||||||
|
|
||||||
|
option go_package = "map/internal/conf;conf";
|
||||||
|
|
||||||
|
import "google/protobuf/duration.proto";
|
||||||
|
|
||||||
|
message Bootstrap {
|
||||||
|
Server server = 1;
|
||||||
|
Data data = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Server {
|
||||||
|
message HTTP {
|
||||||
|
string network = 1;
|
||||||
|
string addr = 2;
|
||||||
|
google.protobuf.Duration timeout = 3;
|
||||||
|
}
|
||||||
|
message GRPC {
|
||||||
|
string network = 1;
|
||||||
|
string addr = 2;
|
||||||
|
google.protobuf.Duration timeout = 3;
|
||||||
|
}
|
||||||
|
HTTP http = 1;
|
||||||
|
GRPC grpc = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Data {
|
||||||
|
message Database {
|
||||||
|
string driver = 1;
|
||||||
|
string source = 2;
|
||||||
|
}
|
||||||
|
message Redis {
|
||||||
|
string network = 1;
|
||||||
|
string addr = 2;
|
||||||
|
google.protobuf.Duration read_timeout = 3;
|
||||||
|
google.protobuf.Duration write_timeout = 4;
|
||||||
|
}
|
||||||
|
Database database = 1;
|
||||||
|
Redis redis = 2;
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
# Data
|
@ -0,0 +1,24 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
import (
|
||||||
|
"map/internal/conf"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
"github.com/google/wire"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProviderSet is data providers.
|
||||||
|
var ProviderSet = wire.NewSet(NewData, NewGreeterRepo)
|
||||||
|
|
||||||
|
// Data .
|
||||||
|
type Data struct {
|
||||||
|
// TODO wrapped database client
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewData .
|
||||||
|
func NewData(c *conf.Data, logger log.Logger) (*Data, func(), error) {
|
||||||
|
cleanup := func() {
|
||||||
|
log.NewHelper(logger).Info("closing the data resources")
|
||||||
|
}
|
||||||
|
return &Data{}, cleanup, nil
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"map/internal/biz"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
type greeterRepo struct {
|
||||||
|
data *Data
|
||||||
|
log *log.Helper
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGreeterRepo .
|
||||||
|
func NewGreeterRepo(data *Data, logger log.Logger) biz.GreeterRepo {
|
||||||
|
return &greeterRepo{
|
||||||
|
data: data,
|
||||||
|
log: log.NewHelper(logger),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *greeterRepo) Save(ctx context.Context, g *biz.Greeter) (*biz.Greeter, error) {
|
||||||
|
return g, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *greeterRepo) Update(ctx context.Context, g *biz.Greeter) (*biz.Greeter, error) {
|
||||||
|
return g, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *greeterRepo) FindByID(context.Context, int64) (*biz.Greeter, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *greeterRepo) ListByHello(context.Context, string) ([]*biz.Greeter, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *greeterRepo) ListAll(context.Context) ([]*biz.Greeter, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "map/api/helloworld/v1"
|
||||||
|
mapService2 "map/api/mapService"
|
||||||
|
"map/internal/conf"
|
||||||
|
"map/internal/service"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
"github.com/go-kratos/kratos/v2/middleware/recovery"
|
||||||
|
"github.com/go-kratos/kratos/v2/transport/grpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewGRPCServer new a gRPC server.
|
||||||
|
func NewGRPCServer(
|
||||||
|
c *conf.Server,
|
||||||
|
greeter *service.GreeterService,
|
||||||
|
mapService *service.MapServiceService,
|
||||||
|
logger log.Logger,
|
||||||
|
) *grpc.Server {
|
||||||
|
var opts = []grpc.ServerOption{
|
||||||
|
grpc.Middleware(
|
||||||
|
recovery.Recovery(),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
if c.Grpc.Network != "" {
|
||||||
|
opts = append(opts, grpc.Network(c.Grpc.Network))
|
||||||
|
}
|
||||||
|
if c.Grpc.Addr != "" {
|
||||||
|
opts = append(opts, grpc.Address(c.Grpc.Addr))
|
||||||
|
}
|
||||||
|
if c.Grpc.Timeout != nil {
|
||||||
|
opts = append(opts, grpc.Timeout(c.Grpc.Timeout.AsDuration()))
|
||||||
|
}
|
||||||
|
srv := grpc.NewServer(opts...)
|
||||||
|
v1.RegisterGreeterServer(srv, greeter)
|
||||||
|
mapService2.RegisterMapServiceServer(srv, mapService)
|
||||||
|
return srv
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
v1 "map/api/helloworld/v1"
|
||||||
|
"map/internal/conf"
|
||||||
|
"map/internal/service"
|
||||||
|
|
||||||
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
|
"github.com/go-kratos/kratos/v2/middleware/recovery"
|
||||||
|
"github.com/go-kratos/kratos/v2/transport/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewHTTPServer new an HTTP server.
|
||||||
|
func NewHTTPServer(c *conf.Server, greeter *service.GreeterService, logger log.Logger) *http.Server {
|
||||||
|
var opts = []http.ServerOption{
|
||||||
|
http.Middleware(
|
||||||
|
recovery.Recovery(),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
if c.Http.Network != "" {
|
||||||
|
opts = append(opts, http.Network(c.Http.Network))
|
||||||
|
}
|
||||||
|
if c.Http.Addr != "" {
|
||||||
|
opts = append(opts, http.Address(c.Http.Addr))
|
||||||
|
}
|
||||||
|
if c.Http.Timeout != nil {
|
||||||
|
opts = append(opts, http.Timeout(c.Http.Timeout.AsDuration()))
|
||||||
|
}
|
||||||
|
srv := http.NewServer(opts...)
|
||||||
|
v1.RegisterGreeterHTTPServer(srv, greeter)
|
||||||
|
return srv
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/google/wire"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProviderSet is server providers.
|
||||||
|
var ProviderSet = wire.NewSet(NewGRPCServer, NewHTTPServer)
|
@ -0,0 +1 @@
|
|||||||
|
# Service
|
@ -0,0 +1,29 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
v1 "map/api/helloworld/v1"
|
||||||
|
"map/internal/biz"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GreeterService is a greeter service.
|
||||||
|
type GreeterService struct {
|
||||||
|
v1.UnimplementedGreeterServer
|
||||||
|
|
||||||
|
uc *biz.GreeterUsecase
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewGreeterService new a greeter service.
|
||||||
|
func NewGreeterService(uc *biz.GreeterUsecase) *GreeterService {
|
||||||
|
return &GreeterService{uc: uc}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SayHello implements helloworld.GreeterServer.
|
||||||
|
func (s *GreeterService) SayHello(ctx context.Context, in *v1.HelloRequest) (*v1.HelloReply, error) {
|
||||||
|
g, err := s.uc.CreateGreeter(ctx, &biz.Greeter{Hello: in.Name})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &v1.HelloReply{Message: "Hello " + g.Hello}, nil
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/go-kratos/kratos/v2/errors"
|
||||||
|
"map/internal/biz"
|
||||||
|
|
||||||
|
pb "map/api/mapService"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MapServiceService struct {
|
||||||
|
pb.UnimplementedMapServiceServer
|
||||||
|
msbiz *biz.MapServiceBiz
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMapServiceService(mz *biz.MapServiceBiz) *MapServiceService {
|
||||||
|
return &MapServiceService{
|
||||||
|
msbiz: mz,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *MapServiceService) GetDrivingInfo(ctx context.Context, req *pb.GetDrivingInfoReq) (*pb.GetDrivingInfoReply, error) {
|
||||||
|
distance, duration, err := this.msbiz.GetDriverInfo(req.Origin, req.Destination)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New(200, "LBS_ERROR", "lbs api error")
|
||||||
|
}
|
||||||
|
return &pb.GetDrivingInfoReply{
|
||||||
|
Origin: req.Origin,
|
||||||
|
Destination: req.Destination,
|
||||||
|
Distance: distance,
|
||||||
|
Duration: duration,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import "github.com/google/wire"
|
||||||
|
|
||||||
|
// ProviderSet is service providers.
|
||||||
|
var ProviderSet = wire.NewSet(NewGreeterService, NewMapServiceService)
|
@ -0,0 +1,10 @@
|
|||||||
|
# Generated with protoc-gen-openapi
|
||||||
|
# https://github.com/google/gnostic/tree/master/cmd/protoc-gen-openapi
|
||||||
|
|
||||||
|
openapi: 3.0.3
|
||||||
|
info:
|
||||||
|
title: ""
|
||||||
|
version: 0.0.1
|
||||||
|
paths: {}
|
||||||
|
components:
|
||||||
|
schemas: {}
|
@ -0,0 +1 @@
|
|||||||
|
# third_party
|
@ -0,0 +1,18 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package errors;
|
||||||
|
|
||||||
|
option go_package = "github.com/go-kratos/kratos/v2/errors;errors";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option java_package = "com.github.kratos.errors";
|
||||||
|
option objc_class_prefix = "KratosErrors";
|
||||||
|
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
|
||||||
|
extend google.protobuf.EnumOptions {
|
||||||
|
int32 default_code = 1108;
|
||||||
|
}
|
||||||
|
|
||||||
|
extend google.protobuf.EnumValueOptions {
|
||||||
|
int32 code = 1109;
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (c) 2015, Google Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.api;
|
||||||
|
|
||||||
|
import "google/api/http.proto";
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
|
||||||
|
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option java_outer_classname = "AnnotationsProto";
|
||||||
|
option java_package = "com.google.api";
|
||||||
|
option objc_class_prefix = "GAPI";
|
||||||
|
|
||||||
|
extend google.protobuf.MethodOptions {
|
||||||
|
// See `HttpRule`.
|
||||||
|
HttpRule http = 72295728;
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
// Copyright 2019 Google LLC.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.api;
|
||||||
|
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
|
||||||
|
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option java_outer_classname = "ClientProto";
|
||||||
|
option java_package = "com.google.api";
|
||||||
|
option objc_class_prefix = "GAPI";
|
||||||
|
|
||||||
|
|
||||||
|
extend google.protobuf.ServiceOptions {
|
||||||
|
// The hostname for this service.
|
||||||
|
// This should be specified with no prefix or protocol.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// service Foo {
|
||||||
|
// option (google.api.default_host) = "foo.googleapi.com";
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
string default_host = 1049;
|
||||||
|
|
||||||
|
// OAuth scopes needed for the client.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// service Foo {
|
||||||
|
// option (google.api.oauth_scopes) = \
|
||||||
|
// "https://www.googleapis.com/auth/cloud-platform";
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// If there is more than one scope, use a comma-separated string:
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// service Foo {
|
||||||
|
// option (google.api.oauth_scopes) = \
|
||||||
|
// "https://www.googleapis.com/auth/cloud-platform,"
|
||||||
|
// "https://www.googleapis.com/auth/monitoring";
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
string oauth_scopes = 1050;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extend google.protobuf.MethodOptions {
|
||||||
|
// A definition of a client library method signature.
|
||||||
|
//
|
||||||
|
// In client libraries, each proto RPC corresponds to one or more methods
|
||||||
|
// which the end user is able to call, and calls the underlying RPC.
|
||||||
|
// Normally, this method receives a single argument (a struct or instance
|
||||||
|
// corresponding to the RPC request object). Defining this field will
|
||||||
|
// add one or more overloads providing flattened or simpler method signatures
|
||||||
|
// in some languages.
|
||||||
|
//
|
||||||
|
// The fields on the method signature are provided as a comma-separated
|
||||||
|
// string.
|
||||||
|
//
|
||||||
|
// For example, the proto RPC and annotation:
|
||||||
|
//
|
||||||
|
// rpc CreateSubscription(CreateSubscriptionRequest)
|
||||||
|
// returns (Subscription) {
|
||||||
|
// option (google.api.method_signature) = "name,topic";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Would add the following Java overload (in addition to the method accepting
|
||||||
|
// the request object):
|
||||||
|
//
|
||||||
|
// public final Subscription createSubscription(String name, String topic)
|
||||||
|
//
|
||||||
|
// The following backwards-compatibility guidelines apply:
|
||||||
|
//
|
||||||
|
// * Adding this annotation to an unannotated method is backwards
|
||||||
|
// compatible.
|
||||||
|
// * Adding this annotation to a method which already has existing
|
||||||
|
// method signature annotations is backwards compatible if and only if
|
||||||
|
// the new method signature annotation is last in the sequence.
|
||||||
|
// * Modifying or removing an existing method signature annotation is
|
||||||
|
// a breaking change.
|
||||||
|
// * Re-ordering existing method signature annotations is a breaking
|
||||||
|
// change.
|
||||||
|
repeated string method_signature = 1051;
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
// Copyright 2019 Google LLC.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.api;
|
||||||
|
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
|
||||||
|
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option java_outer_classname = "FieldBehaviorProto";
|
||||||
|
option java_package = "com.google.api";
|
||||||
|
option objc_class_prefix = "GAPI";
|
||||||
|
|
||||||
|
|
||||||
|
// An indicator of the behavior of a given field (for example, that a field
|
||||||
|
// is required in requests, or given as output but ignored as input).
|
||||||
|
// This **does not** change the behavior in protocol buffers itself; it only
|
||||||
|
// denotes the behavior and may affect how API tooling handles the field.
|
||||||
|
//
|
||||||
|
// Note: This enum **may** receive new values in the future.
|
||||||
|
enum FieldBehavior {
|
||||||
|
// Conventional default for enums. Do not use this.
|
||||||
|
FIELD_BEHAVIOR_UNSPECIFIED = 0;
|
||||||
|
|
||||||
|
// Specifically denotes a field as optional.
|
||||||
|
// While all fields in protocol buffers are optional, this may be specified
|
||||||
|
// for emphasis if appropriate.
|
||||||
|
OPTIONAL = 1;
|
||||||
|
|
||||||
|
// Denotes a field as required.
|
||||||
|
// This indicates that the field **must** be provided as part of the request,
|
||||||
|
// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
|
||||||
|
REQUIRED = 2;
|
||||||
|
|
||||||
|
// Denotes a field as output only.
|
||||||
|
// This indicates that the field is provided in responses, but including the
|
||||||
|
// field in a request does nothing (the server *must* ignore it and
|
||||||
|
// *must not* throw an error as a result of the field's presence).
|
||||||
|
OUTPUT_ONLY = 3;
|
||||||
|
|
||||||
|
// Denotes a field as input only.
|
||||||
|
// This indicates that the field is provided in requests, and the
|
||||||
|
// corresponding field is not included in output.
|
||||||
|
INPUT_ONLY = 4;
|
||||||
|
|
||||||
|
// Denotes a field as immutable.
|
||||||
|
// This indicates that the field may be set once in a request to create a
|
||||||
|
// resource, but may not be changed thereafter.
|
||||||
|
IMMUTABLE = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extend google.protobuf.FieldOptions {
|
||||||
|
// A designation of a specific field behavior (required, output only, etc.)
|
||||||
|
// in protobuf messages.
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
//
|
||||||
|
// string name = 1 [(google.api.field_behavior) = REQUIRED];
|
||||||
|
// State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||||
|
// google.protobuf.Duration ttl = 1
|
||||||
|
// [(google.api.field_behavior) = INPUT_ONLY];
|
||||||
|
// google.protobuf.Timestamp expire_time = 1
|
||||||
|
// [(google.api.field_behavior) = OUTPUT_ONLY,
|
||||||
|
// (google.api.field_behavior) = IMMUTABLE];
|
||||||
|
repeated FieldBehavior field_behavior = 1052;
|
||||||
|
}
|
@ -0,0 +1,375 @@
|
|||||||
|
// Copyright 2020 Google LLC
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.api;
|
||||||
|
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option java_outer_classname = "HttpProto";
|
||||||
|
option java_package = "com.google.api";
|
||||||
|
option objc_class_prefix = "GAPI";
|
||||||
|
|
||||||
|
// Defines the HTTP configuration for an API service. It contains a list of
|
||||||
|
// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
|
||||||
|
// to one or more HTTP REST API methods.
|
||||||
|
message Http {
|
||||||
|
// A list of HTTP configuration rules that apply to individual API methods.
|
||||||
|
//
|
||||||
|
// **NOTE:** All service configuration rules follow "last one wins" order.
|
||||||
|
repeated HttpRule rules = 1;
|
||||||
|
|
||||||
|
// When set to true, URL path parameters will be fully URI-decoded except in
|
||||||
|
// cases of single segment matches in reserved expansion, where "%2F" will be
|
||||||
|
// left encoded.
|
||||||
|
//
|
||||||
|
// The default behavior is to not decode RFC 6570 reserved characters in multi
|
||||||
|
// segment matches.
|
||||||
|
bool fully_decode_reserved_expansion = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// # gRPC Transcoding
|
||||||
|
//
|
||||||
|
// gRPC Transcoding is a feature for mapping between a gRPC method and one or
|
||||||
|
// more HTTP REST endpoints. It allows developers to build a single API service
|
||||||
|
// that supports both gRPC APIs and REST APIs. Many systems, including [Google
|
||||||
|
// APIs](https://github.com/googleapis/googleapis),
|
||||||
|
// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
|
||||||
|
// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
|
||||||
|
// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
|
||||||
|
// and use it for large scale production services.
|
||||||
|
//
|
||||||
|
// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
|
||||||
|
// how different portions of the gRPC request message are mapped to the URL
|
||||||
|
// path, URL query parameters, and HTTP request body. It also controls how the
|
||||||
|
// gRPC response message is mapped to the HTTP response body. `HttpRule` is
|
||||||
|
// typically specified as an `google.api.http` annotation on the gRPC method.
|
||||||
|
//
|
||||||
|
// Each mapping specifies a URL path template and an HTTP method. The path
|
||||||
|
// template may refer to one or more fields in the gRPC request message, as long
|
||||||
|
// as each field is a non-repeated field with a primitive (non-message) type.
|
||||||
|
// The path template controls how fields of the request message are mapped to
|
||||||
|
// the URL path.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// service Messaging {
|
||||||
|
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||||
|
// option (google.api.http) = {
|
||||||
|
// get: "/v1/{name=messages/*}"
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// message GetMessageRequest {
|
||||||
|
// string name = 1; // Mapped to URL path.
|
||||||
|
// }
|
||||||
|
// message Message {
|
||||||
|
// string text = 1; // The resource content.
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// This enables an HTTP REST to gRPC mapping as below:
|
||||||
|
//
|
||||||
|
// HTTP | gRPC
|
||||||
|
// -----|-----
|
||||||
|
// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
|
||||||
|
//
|
||||||
|
// Any fields in the request message which are not bound by the path template
|
||||||
|
// automatically become HTTP query parameters if there is no HTTP request body.
|
||||||
|
// For example:
|
||||||
|
//
|
||||||
|
// service Messaging {
|
||||||
|
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||||
|
// option (google.api.http) = {
|
||||||
|
// get:"/v1/messages/{message_id}"
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// message GetMessageRequest {
|
||||||
|
// message SubMessage {
|
||||||
|
// string subfield = 1;
|
||||||
|
// }
|
||||||
|
// string message_id = 1; // Mapped to URL path.
|
||||||
|
// int64 revision = 2; // Mapped to URL query parameter `revision`.
|
||||||
|
// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// This enables a HTTP JSON to RPC mapping as below:
|
||||||
|
//
|
||||||
|
// HTTP | gRPC
|
||||||
|
// -----|-----
|
||||||
|
// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
|
||||||
|
// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
|
||||||
|
// "foo"))`
|
||||||
|
//
|
||||||
|
// Note that fields which are mapped to URL query parameters must have a
|
||||||
|
// primitive type or a repeated primitive type or a non-repeated message type.
|
||||||
|
// In the case of a repeated type, the parameter can be repeated in the URL
|
||||||
|
// as `...?param=A¶m=B`. In the case of a message type, each field of the
|
||||||
|
// message is mapped to a separate parameter, such as
|
||||||
|
// `...?foo.a=A&foo.b=B&foo.c=C`.
|
||||||
|
//
|
||||||
|
// For HTTP methods that allow a request body, the `body` field
|
||||||
|
// specifies the mapping. Consider a REST update method on the
|
||||||
|
// message resource collection:
|
||||||
|
//
|
||||||
|
// service Messaging {
|
||||||
|
// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
|
||||||
|
// option (google.api.http) = {
|
||||||
|
// patch: "/v1/messages/{message_id}"
|
||||||
|
// body: "message"
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// message UpdateMessageRequest {
|
||||||
|
// string message_id = 1; // mapped to the URL
|
||||||
|
// Message message = 2; // mapped to the body
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// The following HTTP JSON to RPC mapping is enabled, where the
|
||||||
|
// representation of the JSON in the request body is determined by
|
||||||
|
// protos JSON encoding:
|
||||||
|
//
|
||||||
|
// HTTP | gRPC
|
||||||
|
// -----|-----
|
||||||
|
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
||||||
|
// "123456" message { text: "Hi!" })`
|
||||||
|
//
|
||||||
|
// The special name `*` can be used in the body mapping to define that
|
||||||
|
// every field not bound by the path template should be mapped to the
|
||||||
|
// request body. This enables the following alternative definition of
|
||||||
|
// the update method:
|
||||||
|
//
|
||||||
|
// service Messaging {
|
||||||
|
// rpc UpdateMessage(Message) returns (Message) {
|
||||||
|
// option (google.api.http) = {
|
||||||
|
// patch: "/v1/messages/{message_id}"
|
||||||
|
// body: "*"
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// message Message {
|
||||||
|
// string message_id = 1;
|
||||||
|
// string text = 2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// The following HTTP JSON to RPC mapping is enabled:
|
||||||
|
//
|
||||||
|
// HTTP | gRPC
|
||||||
|
// -----|-----
|
||||||
|
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
|
||||||
|
// "123456" text: "Hi!")`
|
||||||
|
//
|
||||||
|
// Note that when using `*` in the body mapping, it is not possible to
|
||||||
|
// have HTTP parameters, as all fields not bound by the path end in
|
||||||
|
// the body. This makes this option more rarely used in practice when
|
||||||
|
// defining REST APIs. The common usage of `*` is in custom methods
|
||||||
|
// which don't use the URL at all for transferring data.
|
||||||
|
//
|
||||||
|
// It is possible to define multiple HTTP methods for one RPC by using
|
||||||
|
// the `additional_bindings` option. Example:
|
||||||
|
//
|
||||||
|
// service Messaging {
|
||||||
|
// rpc GetMessage(GetMessageRequest) returns (Message) {
|
||||||
|
// option (google.api.http) = {
|
||||||
|
// get: "/v1/messages/{message_id}"
|
||||||
|
// additional_bindings {
|
||||||
|
// get: "/v1/users/{user_id}/messages/{message_id}"
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// message GetMessageRequest {
|
||||||
|
// string message_id = 1;
|
||||||
|
// string user_id = 2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// This enables the following two alternative HTTP JSON to RPC mappings:
|
||||||
|
//
|
||||||
|
// HTTP | gRPC
|
||||||
|
// -----|-----
|
||||||
|
// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
|
||||||
|
// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
|
||||||
|
// "123456")`
|
||||||
|
//
|
||||||
|
// ## Rules for HTTP mapping
|
||||||
|
//
|
||||||
|
// 1. Leaf request fields (recursive expansion nested messages in the request
|
||||||
|
// message) are classified into three categories:
|
||||||
|
// - Fields referred by the path template. They are passed via the URL path.
|
||||||
|
// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP
|
||||||
|
// request body.
|
||||||
|
// - All other fields are passed via the URL query parameters, and the
|
||||||
|
// parameter name is the field path in the request message. A repeated
|
||||||
|
// field can be represented as multiple query parameters under the same
|
||||||
|
// name.
|
||||||
|
// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields
|
||||||
|
// are passed via URL path and HTTP request body.
|
||||||
|
// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all
|
||||||
|
// fields are passed via URL path and URL query parameters.
|
||||||
|
//
|
||||||
|
// ### Path template syntax
|
||||||
|
//
|
||||||
|
// Template = "/" Segments [ Verb ] ;
|
||||||
|
// Segments = Segment { "/" Segment } ;
|
||||||
|
// Segment = "*" | "**" | LITERAL | Variable ;
|
||||||
|
// Variable = "{" FieldPath [ "=" Segments ] "}" ;
|
||||||
|
// FieldPath = IDENT { "." IDENT } ;
|
||||||
|
// Verb = ":" LITERAL ;
|
||||||
|
//
|
||||||
|
// The syntax `*` matches a single URL path segment. The syntax `**` matches
|
||||||
|
// zero or more URL path segments, which must be the last part of the URL path
|
||||||
|
// except the `Verb`.
|
||||||
|
//
|
||||||
|
// The syntax `Variable` matches part of the URL path as specified by its
|
||||||
|
// template. A variable template must not contain other variables. If a variable
|
||||||
|
// matches a single path segment, its template may be omitted, e.g. `{var}`
|
||||||
|
// is equivalent to `{var=*}`.
|
||||||
|
//
|
||||||
|
// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
|
||||||
|
// contains any reserved character, such characters should be percent-encoded
|
||||||
|
// before the matching.
|
||||||
|
//
|
||||||
|
// If a variable contains exactly one path segment, such as `"{var}"` or
|
||||||
|
// `"{var=*}"`, when such a variable is expanded into a URL path on the client
|
||||||
|
// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
|
||||||
|
// server side does the reverse decoding. Such variables show up in the
|
||||||
|
// [Discovery
|
||||||
|
// Document](https://developers.google.com/discovery/v1/reference/apis) as
|
||||||
|
// `{var}`.
|
||||||
|
//
|
||||||
|
// If a variable contains multiple path segments, such as `"{var=foo/*}"`
|
||||||
|
// or `"{var=**}"`, when such a variable is expanded into a URL path on the
|
||||||
|
// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
|
||||||
|
// The server side does the reverse decoding, except "%2F" and "%2f" are left
|
||||||
|
// unchanged. Such variables show up in the
|
||||||
|
// [Discovery
|
||||||
|
// Document](https://developers.google.com/discovery/v1/reference/apis) as
|
||||||
|
// `{+var}`.
|
||||||
|
//
|
||||||
|
// ## Using gRPC API Service Configuration
|
||||||
|
//
|
||||||
|
// gRPC API Service Configuration (service config) is a configuration language
|
||||||
|
// for configuring a gRPC service to become a user-facing product. The
|
||||||
|
// service config is simply the YAML representation of the `google.api.Service`
|
||||||
|
// proto message.
|
||||||
|
//
|
||||||
|
// As an alternative to annotating your proto file, you can configure gRPC
|
||||||
|
// transcoding in your service config YAML files. You do this by specifying a
|
||||||
|
// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
|
||||||
|
// effect as the proto annotation. This can be particularly useful if you
|
||||||
|
// have a proto that is reused in multiple services. Note that any transcoding
|
||||||
|
// specified in the service config will override any matching transcoding
|
||||||
|
// configuration in the proto.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// http:
|
||||||
|
// rules:
|
||||||
|
// # Selects a gRPC method and applies HttpRule to it.
|
||||||
|
// - selector: example.v1.Messaging.GetMessage
|
||||||
|
// get: /v1/messages/{message_id}/{sub.subfield}
|
||||||
|
//
|
||||||
|
// ## Special notes
|
||||||
|
//
|
||||||
|
// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
|
||||||
|
// proto to JSON conversion must follow the [proto3
|
||||||
|
// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
|
||||||
|
//
|
||||||
|
// While the single segment variable follows the semantics of
|
||||||
|
// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
|
||||||
|
// Expansion, the multi segment variable **does not** follow RFC 6570 Section
|
||||||
|
// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
|
||||||
|
// does not expand special characters like `?` and `#`, which would lead
|
||||||
|
// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
|
||||||
|
// for multi segment variables.
|
||||||
|
//
|
||||||
|
// The path variables **must not** refer to any repeated or mapped field,
|
||||||
|
// because client libraries are not capable of handling such variable expansion.
|
||||||
|
//
|
||||||
|
// The path variables **must not** capture the leading "/" character. The reason
|
||||||
|
// is that the most common use case "{var}" does not capture the leading "/"
|
||||||
|
// character. For consistency, all path variables must share the same behavior.
|
||||||
|
//
|
||||||
|
// Repeated message fields must not be mapped to URL query parameters, because
|
||||||
|
// no client library can support such complicated mapping.
|
||||||
|
//
|
||||||
|
// If an API needs to use a JSON array for request or response body, it can map
|
||||||
|
// the request or response body to a repeated field. However, some gRPC
|
||||||
|
// Transcoding implementations may not support this feature.
|
||||||
|
message HttpRule {
|
||||||
|
// Selects a method to which this rule applies.
|
||||||
|
//
|
||||||
|
// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
|
||||||
|
string selector = 1;
|
||||||
|
|
||||||
|
// Determines the URL pattern is matched by this rules. This pattern can be
|
||||||
|
// used with any of the {get|put|post|delete|patch} methods. A custom method
|
||||||
|
// can be defined using the 'custom' field.
|
||||||
|
oneof pattern {
|
||||||
|
// Maps to HTTP GET. Used for listing and getting information about
|
||||||
|
// resources.
|
||||||
|
string get = 2;
|
||||||
|
|
||||||
|
// Maps to HTTP PUT. Used for replacing a resource.
|
||||||
|
string put = 3;
|
||||||
|
|
||||||
|
// Maps to HTTP POST. Used for creating a resource or performing an action.
|
||||||
|
string post = 4;
|
||||||
|
|
||||||
|
// Maps to HTTP DELETE. Used for deleting a resource.
|
||||||
|
string delete = 5;
|
||||||
|
|
||||||
|
// Maps to HTTP PATCH. Used for updating a resource.
|
||||||
|
string patch = 6;
|
||||||
|
|
||||||
|
// The custom pattern is used for specifying an HTTP method that is not
|
||||||
|
// included in the `pattern` field, such as HEAD, or "*" to leave the
|
||||||
|
// HTTP method unspecified for this rule. The wild-card rule is useful
|
||||||
|
// for services that provide content to Web (HTML) clients.
|
||||||
|
CustomHttpPattern custom = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The name of the request field whose value is mapped to the HTTP request
|
||||||
|
// body, or `*` for mapping all request fields not captured by the path
|
||||||
|
// pattern to the HTTP body, or omitted for not having any HTTP request body.
|
||||||
|
//
|
||||||
|
// NOTE: the referred field must be present at the top-level of the request
|
||||||
|
// message type.
|
||||||
|
string body = 7;
|
||||||
|
|
||||||
|
// Optional. The name of the response field whose value is mapped to the HTTP
|
||||||
|
// response body. When omitted, the entire response message will be used
|
||||||
|
// as the HTTP response body.
|
||||||
|
//
|
||||||
|
// NOTE: The referred field must be present at the top-level of the response
|
||||||
|
// message type.
|
||||||
|
string response_body = 12;
|
||||||
|
|
||||||
|
// Additional HTTP bindings for the selector. Nested bindings must
|
||||||
|
// not contain an `additional_bindings` field themselves (that is,
|
||||||
|
// the nesting may only be one level deep).
|
||||||
|
repeated HttpRule additional_bindings = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A custom pattern is used for defining custom HTTP verb.
|
||||||
|
message CustomHttpPattern {
|
||||||
|
// The name of this custom HTTP verb.
|
||||||
|
string kind = 1;
|
||||||
|
|
||||||
|
// The path matched by this custom verb.
|
||||||
|
string path = 2;
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
// Copyright 2020 Google LLC
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.api;
|
||||||
|
|
||||||
|
import "google/protobuf/any.proto";
|
||||||
|
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option java_outer_classname = "HttpBodyProto";
|
||||||
|
option java_package = "com.google.api";
|
||||||
|
option objc_class_prefix = "GAPI";
|
||||||
|
|
||||||
|
// Message that represents an arbitrary HTTP body. It should only be used for
|
||||||
|
// payload formats that can't be represented as JSON, such as raw binary or
|
||||||
|
// an HTML page.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// This message can be used both in streaming and non-streaming API methods in
|
||||||
|
// the request as well as the response.
|
||||||
|
//
|
||||||
|
// It can be used as a top-level request field, which is convenient if one
|
||||||
|
// wants to extract parameters from either the URL or HTTP template into the
|
||||||
|
// request fields and also want access to the raw HTTP body.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// message GetResourceRequest {
|
||||||
|
// // A unique request id.
|
||||||
|
// string request_id = 1;
|
||||||
|
//
|
||||||
|
// // The raw HTTP body is bound to this field.
|
||||||
|
// google.api.HttpBody http_body = 2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// service ResourceService {
|
||||||
|
// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);
|
||||||
|
// rpc UpdateResource(google.api.HttpBody) returns
|
||||||
|
// (google.protobuf.Empty);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example with streaming methods:
|
||||||
|
//
|
||||||
|
// service CaldavService {
|
||||||
|
// rpc GetCalendar(stream google.api.HttpBody)
|
||||||
|
// returns (stream google.api.HttpBody);
|
||||||
|
// rpc UpdateCalendar(stream google.api.HttpBody)
|
||||||
|
// returns (stream google.api.HttpBody);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Use of this type only changes how the request and response bodies are
|
||||||
|
// handled, all other features will continue to work unchanged.
|
||||||
|
message HttpBody {
|
||||||
|
// The HTTP Content-Type header value specifying the content type of the body.
|
||||||
|
string content_type = 1;
|
||||||
|
|
||||||
|
// The HTTP request/response body as raw binary.
|
||||||
|
bytes data = 2;
|
||||||
|
|
||||||
|
// Application specific response metadata. Must be set in the first response
|
||||||
|
// for streaming APIs.
|
||||||
|
repeated google.protobuf.Any extensions = 3;
|
||||||
|
}
|
@ -0,0 +1,158 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/anypb";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "AnyProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
// `Any` contains an arbitrary serialized protocol buffer message along with a
|
||||||
|
// URL that describes the type of the serialized message.
|
||||||
|
//
|
||||||
|
// Protobuf library provides support to pack/unpack Any values in the form
|
||||||
|
// of utility functions or additional generated methods of the Any type.
|
||||||
|
//
|
||||||
|
// Example 1: Pack and unpack a message in C++.
|
||||||
|
//
|
||||||
|
// Foo foo = ...;
|
||||||
|
// Any any;
|
||||||
|
// any.PackFrom(foo);
|
||||||
|
// ...
|
||||||
|
// if (any.UnpackTo(&foo)) {
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 2: Pack and unpack a message in Java.
|
||||||
|
//
|
||||||
|
// Foo foo = ...;
|
||||||
|
// Any any = Any.pack(foo);
|
||||||
|
// ...
|
||||||
|
// if (any.is(Foo.class)) {
|
||||||
|
// foo = any.unpack(Foo.class);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 3: Pack and unpack a message in Python.
|
||||||
|
//
|
||||||
|
// foo = Foo(...)
|
||||||
|
// any = Any()
|
||||||
|
// any.Pack(foo)
|
||||||
|
// ...
|
||||||
|
// if any.Is(Foo.DESCRIPTOR):
|
||||||
|
// any.Unpack(foo)
|
||||||
|
// ...
|
||||||
|
//
|
||||||
|
// Example 4: Pack and unpack a message in Go
|
||||||
|
//
|
||||||
|
// foo := &pb.Foo{...}
|
||||||
|
// any, err := anypb.New(foo)
|
||||||
|
// if err != nil {
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
// ...
|
||||||
|
// foo := &pb.Foo{}
|
||||||
|
// if err := any.UnmarshalTo(foo); err != nil {
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// The pack methods provided by protobuf library will by default use
|
||||||
|
// 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
||||||
|
// methods only use the fully qualified type name after the last '/'
|
||||||
|
// in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
||||||
|
// name "y.z".
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// JSON
|
||||||
|
//
|
||||||
|
// The JSON representation of an `Any` value uses the regular
|
||||||
|
// representation of the deserialized, embedded message, with an
|
||||||
|
// additional field `@type` which contains the type URL. Example:
|
||||||
|
//
|
||||||
|
// package google.profile;
|
||||||
|
// message Person {
|
||||||
|
// string first_name = 1;
|
||||||
|
// string last_name = 2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "@type": "type.googleapis.com/google.profile.Person",
|
||||||
|
// "firstName": <string>,
|
||||||
|
// "lastName": <string>
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// If the embedded message type is well-known and has a custom JSON
|
||||||
|
// representation, that representation will be embedded adding a field
|
||||||
|
// `value` which holds the custom JSON in addition to the `@type`
|
||||||
|
// field. Example (for message [google.protobuf.Duration][]):
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "@type": "type.googleapis.com/google.protobuf.Duration",
|
||||||
|
// "value": "1.212s"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
message Any {
|
||||||
|
// A URL/resource name that uniquely identifies the type of the serialized
|
||||||
|
// protocol buffer message. This string must contain at least
|
||||||
|
// one "/" character. The last segment of the URL's path must represent
|
||||||
|
// the fully qualified name of the type (as in
|
||||||
|
// `path/google.protobuf.Duration`). The name should be in a canonical form
|
||||||
|
// (e.g., leading "." is not accepted).
|
||||||
|
//
|
||||||
|
// In practice, teams usually precompile into the binary all types that they
|
||||||
|
// expect it to use in the context of Any. However, for URLs which use the
|
||||||
|
// scheme `http`, `https`, or no scheme, one can optionally set up a type
|
||||||
|
// server that maps type URLs to message definitions as follows:
|
||||||
|
//
|
||||||
|
// * If no scheme is provided, `https` is assumed.
|
||||||
|
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
||||||
|
// value in binary format, or produce an error.
|
||||||
|
// * Applications are allowed to cache lookup results based on the
|
||||||
|
// URL, or have them precompiled into a binary to avoid any
|
||||||
|
// lookup. Therefore, binary compatibility needs to be preserved
|
||||||
|
// on changes to types. (Use versioned type names to manage
|
||||||
|
// breaking changes.)
|
||||||
|
//
|
||||||
|
// Note: this functionality is not currently available in the official
|
||||||
|
// protobuf release, and it is not used for type URLs beginning with
|
||||||
|
// type.googleapis.com.
|
||||||
|
//
|
||||||
|
// Schemes other than `http`, `https` (or the empty scheme) might be
|
||||||
|
// used with implementation specific semantics.
|
||||||
|
//
|
||||||
|
string type_url = 1;
|
||||||
|
|
||||||
|
// Must be a valid serialized protocol buffer of the above specified type.
|
||||||
|
bytes value = 2;
|
||||||
|
}
|
@ -0,0 +1,208 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
import "google/protobuf/source_context.proto";
|
||||||
|
import "google/protobuf/type.proto";
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "ApiProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/apipb";
|
||||||
|
|
||||||
|
// Api is a light-weight descriptor for an API Interface.
|
||||||
|
//
|
||||||
|
// Interfaces are also described as "protocol buffer services" in some contexts,
|
||||||
|
// such as by the "service" keyword in a .proto file, but they are different
|
||||||
|
// from API Services, which represent a concrete implementation of an interface
|
||||||
|
// as opposed to simply a description of methods and bindings. They are also
|
||||||
|
// sometimes simply referred to as "APIs" in other contexts, such as the name of
|
||||||
|
// this message itself. See https://cloud.google.com/apis/design/glossary for
|
||||||
|
// detailed terminology.
|
||||||
|
message Api {
|
||||||
|
// The fully qualified name of this interface, including package name
|
||||||
|
// followed by the interface's simple name.
|
||||||
|
string name = 1;
|
||||||
|
|
||||||
|
// The methods of this interface, in unspecified order.
|
||||||
|
repeated Method methods = 2;
|
||||||
|
|
||||||
|
// Any metadata attached to the interface.
|
||||||
|
repeated Option options = 3;
|
||||||
|
|
||||||
|
// A version string for this interface. If specified, must have the form
|
||||||
|
// `major-version.minor-version`, as in `1.10`. If the minor version is
|
||||||
|
// omitted, it defaults to zero. If the entire version field is empty, the
|
||||||
|
// major version is derived from the package name, as outlined below. If the
|
||||||
|
// field is not empty, the version in the package name will be verified to be
|
||||||
|
// consistent with what is provided here.
|
||||||
|
//
|
||||||
|
// The versioning schema uses [semantic
|
||||||
|
// versioning](http://semver.org) where the major version number
|
||||||
|
// indicates a breaking change and the minor version an additive,
|
||||||
|
// non-breaking change. Both version numbers are signals to users
|
||||||
|
// what to expect from different versions, and should be carefully
|
||||||
|
// chosen based on the product plan.
|
||||||
|
//
|
||||||
|
// The major version is also reflected in the package name of the
|
||||||
|
// interface, which must end in `v<major-version>`, as in
|
||||||
|
// `google.feature.v1`. For major versions 0 and 1, the suffix can
|
||||||
|
// be omitted. Zero major versions must only be used for
|
||||||
|
// experimental, non-GA interfaces.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
string version = 4;
|
||||||
|
|
||||||
|
// Source context for the protocol buffer service represented by this
|
||||||
|
// message.
|
||||||
|
SourceContext source_context = 5;
|
||||||
|
|
||||||
|
// Included interfaces. See [Mixin][].
|
||||||
|
repeated Mixin mixins = 6;
|
||||||
|
|
||||||
|
// The source syntax of the service.
|
||||||
|
Syntax syntax = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Method represents a method of an API interface.
|
||||||
|
message Method {
|
||||||
|
// The simple name of this method.
|
||||||
|
string name = 1;
|
||||||
|
|
||||||
|
// A URL of the input message type.
|
||||||
|
string request_type_url = 2;
|
||||||
|
|
||||||
|
// If true, the request is streamed.
|
||||||
|
bool request_streaming = 3;
|
||||||
|
|
||||||
|
// The URL of the output message type.
|
||||||
|
string response_type_url = 4;
|
||||||
|
|
||||||
|
// If true, the response is streamed.
|
||||||
|
bool response_streaming = 5;
|
||||||
|
|
||||||
|
// Any metadata attached to the method.
|
||||||
|
repeated Option options = 6;
|
||||||
|
|
||||||
|
// The source syntax of this method.
|
||||||
|
Syntax syntax = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Declares an API Interface to be included in this interface. The including
|
||||||
|
// interface must redeclare all the methods from the included interface, but
|
||||||
|
// documentation and options are inherited as follows:
|
||||||
|
//
|
||||||
|
// - If after comment and whitespace stripping, the documentation
|
||||||
|
// string of the redeclared method is empty, it will be inherited
|
||||||
|
// from the original method.
|
||||||
|
//
|
||||||
|
// - Each annotation belonging to the service config (http,
|
||||||
|
// visibility) which is not set in the redeclared method will be
|
||||||
|
// inherited.
|
||||||
|
//
|
||||||
|
// - If an http annotation is inherited, the path pattern will be
|
||||||
|
// modified as follows. Any version prefix will be replaced by the
|
||||||
|
// version of the including interface plus the [root][] path if
|
||||||
|
// specified.
|
||||||
|
//
|
||||||
|
// Example of a simple mixin:
|
||||||
|
//
|
||||||
|
// package google.acl.v1;
|
||||||
|
// service AccessControl {
|
||||||
|
// // Get the underlying ACL object.
|
||||||
|
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||||
|
// option (google.api.http).get = "/v1/{resource=**}:getAcl";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// package google.storage.v2;
|
||||||
|
// service Storage {
|
||||||
|
// rpc GetAcl(GetAclRequest) returns (Acl);
|
||||||
|
//
|
||||||
|
// // Get a data record.
|
||||||
|
// rpc GetData(GetDataRequest) returns (Data) {
|
||||||
|
// option (google.api.http).get = "/v2/{resource=**}";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example of a mixin configuration:
|
||||||
|
//
|
||||||
|
// apis:
|
||||||
|
// - name: google.storage.v2.Storage
|
||||||
|
// mixins:
|
||||||
|
// - name: google.acl.v1.AccessControl
|
||||||
|
//
|
||||||
|
// The mixin construct implies that all methods in `AccessControl` are
|
||||||
|
// also declared with same name and request/response types in
|
||||||
|
// `Storage`. A documentation generator or annotation processor will
|
||||||
|
// see the effective `Storage.GetAcl` method after inheriting
|
||||||
|
// documentation and annotations as follows:
|
||||||
|
//
|
||||||
|
// service Storage {
|
||||||
|
// // Get the underlying ACL object.
|
||||||
|
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||||
|
// option (google.api.http).get = "/v2/{resource=**}:getAcl";
|
||||||
|
// }
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Note how the version in the path pattern changed from `v1` to `v2`.
|
||||||
|
//
|
||||||
|
// If the `root` field in the mixin is specified, it should be a
|
||||||
|
// relative path under which inherited HTTP paths are placed. Example:
|
||||||
|
//
|
||||||
|
// apis:
|
||||||
|
// - name: google.storage.v2.Storage
|
||||||
|
// mixins:
|
||||||
|
// - name: google.acl.v1.AccessControl
|
||||||
|
// root: acls
|
||||||
|
//
|
||||||
|
// This implies the following inherited HTTP annotation:
|
||||||
|
//
|
||||||
|
// service Storage {
|
||||||
|
// // Get the underlying ACL object.
|
||||||
|
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||||
|
// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
|
||||||
|
// }
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
message Mixin {
|
||||||
|
// The fully qualified name of the interface which is included.
|
||||||
|
string name = 1;
|
||||||
|
|
||||||
|
// If non-empty specifies a path under which inherited HTTP paths
|
||||||
|
// are rooted.
|
||||||
|
string root = 2;
|
||||||
|
}
|
@ -0,0 +1,183 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
// Author: kenton@google.com (Kenton Varda)
|
||||||
|
//
|
||||||
|
// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to
|
||||||
|
// change.
|
||||||
|
//
|
||||||
|
// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
|
||||||
|
// just a program that reads a CodeGeneratorRequest from stdin and writes a
|
||||||
|
// CodeGeneratorResponse to stdout.
|
||||||
|
//
|
||||||
|
// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead
|
||||||
|
// of dealing with the raw protocol defined here.
|
||||||
|
//
|
||||||
|
// A plugin executable needs only to be placed somewhere in the path. The
|
||||||
|
// plugin should be named "protoc-gen-$NAME", and will then be used when the
|
||||||
|
// flag "--${NAME}_out" is passed to protoc.
|
||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
package google.protobuf.compiler;
|
||||||
|
option java_package = "com.google.protobuf.compiler";
|
||||||
|
option java_outer_classname = "PluginProtos";
|
||||||
|
|
||||||
|
option go_package = "google.golang.org/protobuf/types/pluginpb";
|
||||||
|
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
|
||||||
|
// The version number of protocol compiler.
|
||||||
|
message Version {
|
||||||
|
optional int32 major = 1;
|
||||||
|
optional int32 minor = 2;
|
||||||
|
optional int32 patch = 3;
|
||||||
|
// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
|
||||||
|
// be empty for mainline stable releases.
|
||||||
|
optional string suffix = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// An encoded CodeGeneratorRequest is written to the plugin's stdin.
|
||||||
|
message CodeGeneratorRequest {
|
||||||
|
// The .proto files that were explicitly listed on the command-line. The
|
||||||
|
// code generator should generate code only for these files. Each file's
|
||||||
|
// descriptor will be included in proto_file, below.
|
||||||
|
repeated string file_to_generate = 1;
|
||||||
|
|
||||||
|
// The generator parameter passed on the command-line.
|
||||||
|
optional string parameter = 2;
|
||||||
|
|
||||||
|
// FileDescriptorProtos for all files in files_to_generate and everything
|
||||||
|
// they import. The files will appear in topological order, so each file
|
||||||
|
// appears before any file that imports it.
|
||||||
|
//
|
||||||
|
// protoc guarantees that all proto_files will be written after
|
||||||
|
// the fields above, even though this is not technically guaranteed by the
|
||||||
|
// protobuf wire format. This theoretically could allow a plugin to stream
|
||||||
|
// in the FileDescriptorProtos and handle them one by one rather than read
|
||||||
|
// the entire set into memory at once. However, as of this writing, this
|
||||||
|
// is not similarly optimized on protoc's end -- it will store all fields in
|
||||||
|
// memory at once before sending them to the plugin.
|
||||||
|
//
|
||||||
|
// Type names of fields and extensions in the FileDescriptorProto are always
|
||||||
|
// fully qualified.
|
||||||
|
repeated FileDescriptorProto proto_file = 15;
|
||||||
|
|
||||||
|
// The version number of protocol compiler.
|
||||||
|
optional Version compiler_version = 3;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// The plugin writes an encoded CodeGeneratorResponse to stdout.
|
||||||
|
message CodeGeneratorResponse {
|
||||||
|
// Error message. If non-empty, code generation failed. The plugin process
|
||||||
|
// should exit with status code zero even if it reports an error in this way.
|
||||||
|
//
|
||||||
|
// This should be used to indicate errors in .proto files which prevent the
|
||||||
|
// code generator from generating correct code. Errors which indicate a
|
||||||
|
// problem in protoc itself -- such as the input CodeGeneratorRequest being
|
||||||
|
// unparseable -- should be reported by writing a message to stderr and
|
||||||
|
// exiting with a non-zero status code.
|
||||||
|
optional string error = 1;
|
||||||
|
|
||||||
|
// A bitmask of supported features that the code generator supports.
|
||||||
|
// This is a bitwise "or" of values from the Feature enum.
|
||||||
|
optional uint64 supported_features = 2;
|
||||||
|
|
||||||
|
// Sync with code_generator.h.
|
||||||
|
enum Feature {
|
||||||
|
FEATURE_NONE = 0;
|
||||||
|
FEATURE_PROTO3_OPTIONAL = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Represents a single generated file.
|
||||||
|
message File {
|
||||||
|
// The file name, relative to the output directory. The name must not
|
||||||
|
// contain "." or ".." components and must be relative, not be absolute (so,
|
||||||
|
// the file cannot lie outside the output directory). "/" must be used as
|
||||||
|
// the path separator, not "\".
|
||||||
|
//
|
||||||
|
// If the name is omitted, the content will be appended to the previous
|
||||||
|
// file. This allows the generator to break large files into small chunks,
|
||||||
|
// and allows the generated text to be streamed back to protoc so that large
|
||||||
|
// files need not reside completely in memory at one time. Note that as of
|
||||||
|
// this writing protoc does not optimize for this -- it will read the entire
|
||||||
|
// CodeGeneratorResponse before writing files to disk.
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
// If non-empty, indicates that the named file should already exist, and the
|
||||||
|
// content here is to be inserted into that file at a defined insertion
|
||||||
|
// point. This feature allows a code generator to extend the output
|
||||||
|
// produced by another code generator. The original generator may provide
|
||||||
|
// insertion points by placing special annotations in the file that look
|
||||||
|
// like:
|
||||||
|
// @@protoc_insertion_point(NAME)
|
||||||
|
// The annotation can have arbitrary text before and after it on the line,
|
||||||
|
// which allows it to be placed in a comment. NAME should be replaced with
|
||||||
|
// an identifier naming the point -- this is what other generators will use
|
||||||
|
// as the insertion_point. Code inserted at this point will be placed
|
||||||
|
// immediately above the line containing the insertion point (thus multiple
|
||||||
|
// insertions to the same point will come out in the order they were added).
|
||||||
|
// The double-@ is intended to make it unlikely that the generated code
|
||||||
|
// could contain things that look like insertion points by accident.
|
||||||
|
//
|
||||||
|
// For example, the C++ code generator places the following line in the
|
||||||
|
// .pb.h files that it generates:
|
||||||
|
// // @@protoc_insertion_point(namespace_scope)
|
||||||
|
// This line appears within the scope of the file's package namespace, but
|
||||||
|
// outside of any particular class. Another plugin can then specify the
|
||||||
|
// insertion_point "namespace_scope" to generate additional classes or
|
||||||
|
// other declarations that should be placed in this scope.
|
||||||
|
//
|
||||||
|
// Note that if the line containing the insertion point begins with
|
||||||
|
// whitespace, the same whitespace will be added to every line of the
|
||||||
|
// inserted text. This is useful for languages like Python, where
|
||||||
|
// indentation matters. In these languages, the insertion point comment
|
||||||
|
// should be indented the same amount as any inserted code will need to be
|
||||||
|
// in order to work correctly in that context.
|
||||||
|
//
|
||||||
|
// The code generator that generates the initial file and the one which
|
||||||
|
// inserts into it must both run as part of a single invocation of protoc.
|
||||||
|
// Code generators are executed in the order in which they appear on the
|
||||||
|
// command line.
|
||||||
|
//
|
||||||
|
// If |insertion_point| is present, |name| must also be present.
|
||||||
|
optional string insertion_point = 2;
|
||||||
|
|
||||||
|
// The file contents.
|
||||||
|
optional string content = 15;
|
||||||
|
|
||||||
|
// Information describing the file content being inserted. If an insertion
|
||||||
|
// point is used, this information will be appropriately offset and inserted
|
||||||
|
// into the code generation metadata for the generated files.
|
||||||
|
optional GeneratedCodeInfo generated_code_info = 16;
|
||||||
|
}
|
||||||
|
repeated File file = 15;
|
||||||
|
}
|
@ -0,0 +1,921 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
// Author: kenton@google.com (Kenton Varda)
|
||||||
|
// Based on original Protocol Buffers design by
|
||||||
|
// Sanjay Ghemawat, Jeff Dean, and others.
|
||||||
|
//
|
||||||
|
// The messages in this file describe the definitions found in .proto files.
|
||||||
|
// A valid .proto file can be translated directly to a FileDescriptorProto
|
||||||
|
// without any other information (e.g. without reading its imports).
|
||||||
|
|
||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option go_package = "google.golang.org/protobuf/types/descriptorpb";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "DescriptorProtos";
|
||||||
|
option csharp_namespace = "Google.Protobuf.Reflection";
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
|
||||||
|
// descriptor.proto must be optimized for speed because reflection-based
|
||||||
|
// algorithms don't work during bootstrapping.
|
||||||
|
option optimize_for = SPEED;
|
||||||
|
|
||||||
|
// The protocol compiler can output a FileDescriptorSet containing the .proto
|
||||||
|
// files it parses.
|
||||||
|
message FileDescriptorSet {
|
||||||
|
repeated FileDescriptorProto file = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a complete .proto file.
|
||||||
|
message FileDescriptorProto {
|
||||||
|
optional string name = 1; // file name, relative to root of source tree
|
||||||
|
optional string package = 2; // e.g. "foo", "foo.bar", etc.
|
||||||
|
|
||||||
|
// Names of files imported by this file.
|
||||||
|
repeated string dependency = 3;
|
||||||
|
// Indexes of the public imported files in the dependency list above.
|
||||||
|
repeated int32 public_dependency = 10;
|
||||||
|
// Indexes of the weak imported files in the dependency list.
|
||||||
|
// For Google-internal migration only. Do not use.
|
||||||
|
repeated int32 weak_dependency = 11;
|
||||||
|
|
||||||
|
// All top-level definitions in this file.
|
||||||
|
repeated DescriptorProto message_type = 4;
|
||||||
|
repeated EnumDescriptorProto enum_type = 5;
|
||||||
|
repeated ServiceDescriptorProto service = 6;
|
||||||
|
repeated FieldDescriptorProto extension = 7;
|
||||||
|
|
||||||
|
optional FileOptions options = 8;
|
||||||
|
|
||||||
|
// This field contains optional information about the original source code.
|
||||||
|
// You may safely remove this entire field without harming runtime
|
||||||
|
// functionality of the descriptors -- the information is needed only by
|
||||||
|
// development tools.
|
||||||
|
optional SourceCodeInfo source_code_info = 9;
|
||||||
|
|
||||||
|
// The syntax of the proto file.
|
||||||
|
// The supported values are "proto2" and "proto3".
|
||||||
|
optional string syntax = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a message type.
|
||||||
|
message DescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
repeated FieldDescriptorProto field = 2;
|
||||||
|
repeated FieldDescriptorProto extension = 6;
|
||||||
|
|
||||||
|
repeated DescriptorProto nested_type = 3;
|
||||||
|
repeated EnumDescriptorProto enum_type = 4;
|
||||||
|
|
||||||
|
message ExtensionRange {
|
||||||
|
optional int32 start = 1; // Inclusive.
|
||||||
|
optional int32 end = 2; // Exclusive.
|
||||||
|
|
||||||
|
optional ExtensionRangeOptions options = 3;
|
||||||
|
}
|
||||||
|
repeated ExtensionRange extension_range = 5;
|
||||||
|
|
||||||
|
repeated OneofDescriptorProto oneof_decl = 8;
|
||||||
|
|
||||||
|
optional MessageOptions options = 7;
|
||||||
|
|
||||||
|
// Range of reserved tag numbers. Reserved tag numbers may not be used by
|
||||||
|
// fields or extension ranges in the same message. Reserved ranges may
|
||||||
|
// not overlap.
|
||||||
|
message ReservedRange {
|
||||||
|
optional int32 start = 1; // Inclusive.
|
||||||
|
optional int32 end = 2; // Exclusive.
|
||||||
|
}
|
||||||
|
repeated ReservedRange reserved_range = 9;
|
||||||
|
// Reserved field names, which may not be used by fields in the same message.
|
||||||
|
// A given name may only be reserved once.
|
||||||
|
repeated string reserved_name = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExtensionRangeOptions {
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a field within a message.
|
||||||
|
message FieldDescriptorProto {
|
||||||
|
enum Type {
|
||||||
|
// 0 is reserved for errors.
|
||||||
|
// Order is weird for historical reasons.
|
||||||
|
TYPE_DOUBLE = 1;
|
||||||
|
TYPE_FLOAT = 2;
|
||||||
|
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
||||||
|
// negative values are likely.
|
||||||
|
TYPE_INT64 = 3;
|
||||||
|
TYPE_UINT64 = 4;
|
||||||
|
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
||||||
|
// negative values are likely.
|
||||||
|
TYPE_INT32 = 5;
|
||||||
|
TYPE_FIXED64 = 6;
|
||||||
|
TYPE_FIXED32 = 7;
|
||||||
|
TYPE_BOOL = 8;
|
||||||
|
TYPE_STRING = 9;
|
||||||
|
// Tag-delimited aggregate.
|
||||||
|
// Group type is deprecated and not supported in proto3. However, Proto3
|
||||||
|
// implementations should still be able to parse the group wire format and
|
||||||
|
// treat group fields as unknown fields.
|
||||||
|
TYPE_GROUP = 10;
|
||||||
|
TYPE_MESSAGE = 11; // Length-delimited aggregate.
|
||||||
|
|
||||||
|
// New in version 2.
|
||||||
|
TYPE_BYTES = 12;
|
||||||
|
TYPE_UINT32 = 13;
|
||||||
|
TYPE_ENUM = 14;
|
||||||
|
TYPE_SFIXED32 = 15;
|
||||||
|
TYPE_SFIXED64 = 16;
|
||||||
|
TYPE_SINT32 = 17; // Uses ZigZag encoding.
|
||||||
|
TYPE_SINT64 = 18; // Uses ZigZag encoding.
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Label {
|
||||||
|
// 0 is reserved for errors
|
||||||
|
LABEL_OPTIONAL = 1;
|
||||||
|
LABEL_REQUIRED = 2;
|
||||||
|
LABEL_REPEATED = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
optional string name = 1;
|
||||||
|
optional int32 number = 3;
|
||||||
|
optional Label label = 4;
|
||||||
|
|
||||||
|
// If type_name is set, this need not be set. If both this and type_name
|
||||||
|
// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
|
||||||
|
optional Type type = 5;
|
||||||
|
|
||||||
|
// For message and enum types, this is the name of the type. If the name
|
||||||
|
// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
|
||||||
|
// rules are used to find the type (i.e. first the nested types within this
|
||||||
|
// message are searched, then within the parent, on up to the root
|
||||||
|
// namespace).
|
||||||
|
optional string type_name = 6;
|
||||||
|
|
||||||
|
// For extensions, this is the name of the type being extended. It is
|
||||||
|
// resolved in the same manner as type_name.
|
||||||
|
optional string extendee = 2;
|
||||||
|
|
||||||
|
// For numeric types, contains the original text representation of the value.
|
||||||
|
// For booleans, "true" or "false".
|
||||||
|
// For strings, contains the default text contents (not escaped in any way).
|
||||||
|
// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
|
||||||
|
optional string default_value = 7;
|
||||||
|
|
||||||
|
// If set, gives the index of a oneof in the containing type's oneof_decl
|
||||||
|
// list. This field is a member of that oneof.
|
||||||
|
optional int32 oneof_index = 9;
|
||||||
|
|
||||||
|
// JSON name of this field. The value is set by protocol compiler. If the
|
||||||
|
// user has set a "json_name" option on this field, that option's value
|
||||||
|
// will be used. Otherwise, it's deduced from the field's name by converting
|
||||||
|
// it to camelCase.
|
||||||
|
optional string json_name = 10;
|
||||||
|
|
||||||
|
optional FieldOptions options = 8;
|
||||||
|
|
||||||
|
// If true, this is a proto3 "optional". When a proto3 field is optional, it
|
||||||
|
// tracks presence regardless of field type.
|
||||||
|
//
|
||||||
|
// When proto3_optional is true, this field must be belong to a oneof to
|
||||||
|
// signal to old proto3 clients that presence is tracked for this field. This
|
||||||
|
// oneof is known as a "synthetic" oneof, and this field must be its sole
|
||||||
|
// member (each proto3 optional field gets its own synthetic oneof). Synthetic
|
||||||
|
// oneofs exist in the descriptor only, and do not generate any API. Synthetic
|
||||||
|
// oneofs must be ordered after all "real" oneofs.
|
||||||
|
//
|
||||||
|
// For message fields, proto3_optional doesn't create any semantic change,
|
||||||
|
// since non-repeated message fields always track presence. However it still
|
||||||
|
// indicates the semantic detail of whether the user wrote "optional" or not.
|
||||||
|
// This can be useful for round-tripping the .proto file. For consistency we
|
||||||
|
// give message fields a synthetic oneof also, even though it is not required
|
||||||
|
// to track presence. This is especially important because the parser can't
|
||||||
|
// tell if a field is a message or an enum, so it must always create a
|
||||||
|
// synthetic oneof.
|
||||||
|
//
|
||||||
|
// Proto2 optional fields do not set this flag, because they already indicate
|
||||||
|
// optional with `LABEL_OPTIONAL`.
|
||||||
|
optional bool proto3_optional = 17;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a oneof.
|
||||||
|
message OneofDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
optional OneofOptions options = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes an enum type.
|
||||||
|
message EnumDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
repeated EnumValueDescriptorProto value = 2;
|
||||||
|
|
||||||
|
optional EnumOptions options = 3;
|
||||||
|
|
||||||
|
// Range of reserved numeric values. Reserved values may not be used by
|
||||||
|
// entries in the same enum. Reserved ranges may not overlap.
|
||||||
|
//
|
||||||
|
// Note that this is distinct from DescriptorProto.ReservedRange in that it
|
||||||
|
// is inclusive such that it can appropriately represent the entire int32
|
||||||
|
// domain.
|
||||||
|
message EnumReservedRange {
|
||||||
|
optional int32 start = 1; // Inclusive.
|
||||||
|
optional int32 end = 2; // Inclusive.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Range of reserved numeric values. Reserved numeric values may not be used
|
||||||
|
// by enum values in the same enum declaration. Reserved ranges may not
|
||||||
|
// overlap.
|
||||||
|
repeated EnumReservedRange reserved_range = 4;
|
||||||
|
|
||||||
|
// Reserved enum value names, which may not be reused. A given name may only
|
||||||
|
// be reserved once.
|
||||||
|
repeated string reserved_name = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a value within an enum.
|
||||||
|
message EnumValueDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
optional int32 number = 2;
|
||||||
|
|
||||||
|
optional EnumValueOptions options = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a service.
|
||||||
|
message ServiceDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
repeated MethodDescriptorProto method = 2;
|
||||||
|
|
||||||
|
optional ServiceOptions options = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a method of a service.
|
||||||
|
message MethodDescriptorProto {
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
// Input and output type names. These are resolved in the same way as
|
||||||
|
// FieldDescriptorProto.type_name, but must refer to a message type.
|
||||||
|
optional string input_type = 2;
|
||||||
|
optional string output_type = 3;
|
||||||
|
|
||||||
|
optional MethodOptions options = 4;
|
||||||
|
|
||||||
|
// Identifies if client streams multiple client messages
|
||||||
|
optional bool client_streaming = 5 [default = false];
|
||||||
|
// Identifies if server streams multiple server messages
|
||||||
|
optional bool server_streaming = 6 [default = false];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
// Options
|
||||||
|
|
||||||
|
// Each of the definitions above may have "options" attached. These are
|
||||||
|
// just annotations which may cause code to be generated slightly differently
|
||||||
|
// or may contain hints for code that manipulates protocol messages.
|
||||||
|
//
|
||||||
|
// Clients may define custom options as extensions of the *Options messages.
|
||||||
|
// These extensions may not yet be known at parsing time, so the parser cannot
|
||||||
|
// store the values in them. Instead it stores them in a field in the *Options
|
||||||
|
// message called uninterpreted_option. This field must have the same name
|
||||||
|
// across all *Options messages. We then use this field to populate the
|
||||||
|
// extensions when we build a descriptor, at which point all protos have been
|
||||||
|
// parsed and so all extensions are known.
|
||||||
|
//
|
||||||
|
// Extension numbers for custom options may be chosen as follows:
|
||||||
|
// * For options which will only be used within a single application or
|
||||||
|
// organization, or for experimental options, use field numbers 50000
|
||||||
|
// through 99999. It is up to you to ensure that you do not use the
|
||||||
|
// same number for multiple options.
|
||||||
|
// * For options which will be published and used publicly by multiple
|
||||||
|
// independent entities, e-mail protobuf-global-extension-registry@google.com
|
||||||
|
// to reserve extension numbers. Simply provide your project name (e.g.
|
||||||
|
// Objective-C plugin) and your project website (if available) -- there's no
|
||||||
|
// need to explain how you intend to use them. Usually you only need one
|
||||||
|
// extension number. You can declare multiple options with only one extension
|
||||||
|
// number by putting them in a sub-message. See the Custom Options section of
|
||||||
|
// the docs for examples:
|
||||||
|
// https://developers.google.com/protocol-buffers/docs/proto#options
|
||||||
|
// If this turns out to be popular, a web service will be set up
|
||||||
|
// to automatically assign option numbers.
|
||||||
|
|
||||||
|
message FileOptions {
|
||||||
|
|
||||||
|
// Sets the Java package where classes generated from this .proto will be
|
||||||
|
// placed. By default, the proto package is used, but this is often
|
||||||
|
// inappropriate because proto packages do not normally start with backwards
|
||||||
|
// domain names.
|
||||||
|
optional string java_package = 1;
|
||||||
|
|
||||||
|
|
||||||
|
// Controls the name of the wrapper Java class generated for the .proto file.
|
||||||
|
// That class will always contain the .proto file's getDescriptor() method as
|
||||||
|
// well as any top-level extensions defined in the .proto file.
|
||||||
|
// If java_multiple_files is disabled, then all the other classes from the
|
||||||
|
// .proto file will be nested inside the single wrapper outer class.
|
||||||
|
optional string java_outer_classname = 8;
|
||||||
|
|
||||||
|
// If enabled, then the Java code generator will generate a separate .java
|
||||||
|
// file for each top-level message, enum, and service defined in the .proto
|
||||||
|
// file. Thus, these types will *not* be nested inside the wrapper class
|
||||||
|
// named by java_outer_classname. However, the wrapper class will still be
|
||||||
|
// generated to contain the file's getDescriptor() method as well as any
|
||||||
|
// top-level extensions defined in the file.
|
||||||
|
optional bool java_multiple_files = 10 [default = false];
|
||||||
|
|
||||||
|
// This option does nothing.
|
||||||
|
optional bool java_generate_equals_and_hash = 20 [deprecated=true];
|
||||||
|
|
||||||
|
// If set true, then the Java2 code generator will generate code that
|
||||||
|
// throws an exception whenever an attempt is made to assign a non-UTF-8
|
||||||
|
// byte sequence to a string field.
|
||||||
|
// Message reflection will do the same.
|
||||||
|
// However, an extension field still accepts non-UTF-8 byte sequences.
|
||||||
|
// This option has no effect on when used with the lite runtime.
|
||||||
|
optional bool java_string_check_utf8 = 27 [default = false];
|
||||||
|
|
||||||
|
|
||||||
|
// Generated classes can be optimized for speed or code size.
|
||||||
|
enum OptimizeMode {
|
||||||
|
SPEED = 1; // Generate complete code for parsing, serialization,
|
||||||
|
// etc.
|
||||||
|
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
|
||||||
|
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
|
||||||
|
}
|
||||||
|
optional OptimizeMode optimize_for = 9 [default = SPEED];
|
||||||
|
|
||||||
|
// Sets the Go package where structs generated from this .proto will be
|
||||||
|
// placed. If omitted, the Go package will be derived from the following:
|
||||||
|
// - The basename of the package import path, if provided.
|
||||||
|
// - Otherwise, the package statement in the .proto file, if present.
|
||||||
|
// - Otherwise, the basename of the .proto file, without extension.
|
||||||
|
optional string go_package = 11;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Should generic services be generated in each language? "Generic" services
|
||||||
|
// are not specific to any particular RPC system. They are generated by the
|
||||||
|
// main code generators in each language (without additional plugins).
|
||||||
|
// Generic services were the only kind of service generation supported by
|
||||||
|
// early versions of google.protobuf.
|
||||||
|
//
|
||||||
|
// Generic services are now considered deprecated in favor of using plugins
|
||||||
|
// that generate code specific to your particular RPC system. Therefore,
|
||||||
|
// these default to false. Old code which depends on generic services should
|
||||||
|
// explicitly set them to true.
|
||||||
|
optional bool cc_generic_services = 16 [default = false];
|
||||||
|
optional bool java_generic_services = 17 [default = false];
|
||||||
|
optional bool py_generic_services = 18 [default = false];
|
||||||
|
optional bool php_generic_services = 42 [default = false];
|
||||||
|
|
||||||
|
// Is this file deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for everything in the file, or it will be completely ignored; in the very
|
||||||
|
// least, this is a formalization for deprecating files.
|
||||||
|
optional bool deprecated = 23 [default = false];
|
||||||
|
|
||||||
|
// Enables the use of arenas for the proto messages in this file. This applies
|
||||||
|
// only to generated classes for C++.
|
||||||
|
optional bool cc_enable_arenas = 31 [default = true];
|
||||||
|
|
||||||
|
|
||||||
|
// Sets the objective c class prefix which is prepended to all objective c
|
||||||
|
// generated classes from this .proto. There is no default.
|
||||||
|
optional string objc_class_prefix = 36;
|
||||||
|
|
||||||
|
// Namespace for generated classes; defaults to the package.
|
||||||
|
optional string csharp_namespace = 37;
|
||||||
|
|
||||||
|
// By default Swift generators will take the proto package and CamelCase it
|
||||||
|
// replacing '.' with underscore and use that to prefix the types/symbols
|
||||||
|
// defined. When this options is provided, they will use this value instead
|
||||||
|
// to prefix the types/symbols defined.
|
||||||
|
optional string swift_prefix = 39;
|
||||||
|
|
||||||
|
// Sets the php class prefix which is prepended to all php generated classes
|
||||||
|
// from this .proto. Default is empty.
|
||||||
|
optional string php_class_prefix = 40;
|
||||||
|
|
||||||
|
// Use this option to change the namespace of php generated classes. Default
|
||||||
|
// is empty. When this option is empty, the package name will be used for
|
||||||
|
// determining the namespace.
|
||||||
|
optional string php_namespace = 41;
|
||||||
|
|
||||||
|
// Use this option to change the namespace of php generated metadata classes.
|
||||||
|
// Default is empty. When this option is empty, the proto file name will be
|
||||||
|
// used for determining the namespace.
|
||||||
|
optional string php_metadata_namespace = 44;
|
||||||
|
|
||||||
|
// Use this option to change the package of ruby generated classes. Default
|
||||||
|
// is empty. When this option is not set, the package name will be used for
|
||||||
|
// determining the ruby package.
|
||||||
|
optional string ruby_package = 45;
|
||||||
|
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here.
|
||||||
|
// See the documentation for the "Options" section above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message.
|
||||||
|
// See the documentation for the "Options" section above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
|
||||||
|
reserved 38;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MessageOptions {
|
||||||
|
// Set true to use the old proto1 MessageSet wire format for extensions.
|
||||||
|
// This is provided for backwards-compatibility with the MessageSet wire
|
||||||
|
// format. You should not use this for any other reason: It's less
|
||||||
|
// efficient, has fewer features, and is more complicated.
|
||||||
|
//
|
||||||
|
// The message must be defined exactly as follows:
|
||||||
|
// message Foo {
|
||||||
|
// option message_set_wire_format = true;
|
||||||
|
// extensions 4 to max;
|
||||||
|
// }
|
||||||
|
// Note that the message cannot have any defined fields; MessageSets only
|
||||||
|
// have extensions.
|
||||||
|
//
|
||||||
|
// All extensions of your type must be singular messages; e.g. they cannot
|
||||||
|
// be int32s, enums, or repeated messages.
|
||||||
|
//
|
||||||
|
// Because this is an option, the above two restrictions are not enforced by
|
||||||
|
// the protocol compiler.
|
||||||
|
optional bool message_set_wire_format = 1 [default = false];
|
||||||
|
|
||||||
|
// Disables the generation of the standard "descriptor()" accessor, which can
|
||||||
|
// conflict with a field of the same name. This is meant to make migration
|
||||||
|
// from proto1 easier; new code should avoid fields named "descriptor".
|
||||||
|
optional bool no_standard_descriptor_accessor = 2 [default = false];
|
||||||
|
|
||||||
|
// Is this message deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the message, or it will be completely ignored; in the very least,
|
||||||
|
// this is a formalization for deprecating messages.
|
||||||
|
optional bool deprecated = 3 [default = false];
|
||||||
|
|
||||||
|
reserved 4, 5, 6;
|
||||||
|
|
||||||
|
// Whether the message is an automatically generated map entry type for the
|
||||||
|
// maps field.
|
||||||
|
//
|
||||||
|
// For maps fields:
|
||||||
|
// map<KeyType, ValueType> map_field = 1;
|
||||||
|
// The parsed descriptor looks like:
|
||||||
|
// message MapFieldEntry {
|
||||||
|
// option map_entry = true;
|
||||||
|
// optional KeyType key = 1;
|
||||||
|
// optional ValueType value = 2;
|
||||||
|
// }
|
||||||
|
// repeated MapFieldEntry map_field = 1;
|
||||||
|
//
|
||||||
|
// Implementations may choose not to generate the map_entry=true message, but
|
||||||
|
// use a native map in the target language to hold the keys and values.
|
||||||
|
// The reflection APIs in such implementations still need to work as
|
||||||
|
// if the field is a repeated message field.
|
||||||
|
//
|
||||||
|
// NOTE: Do not set the option in .proto files. Always use the maps syntax
|
||||||
|
// instead. The option should only be implicitly set by the proto compiler
|
||||||
|
// parser.
|
||||||
|
optional bool map_entry = 7;
|
||||||
|
|
||||||
|
reserved 8; // javalite_serializable
|
||||||
|
reserved 9; // javanano_as_lite
|
||||||
|
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FieldOptions {
|
||||||
|
// The ctype option instructs the C++ code generator to use a different
|
||||||
|
// representation of the field than it normally would. See the specific
|
||||||
|
// options below. This option is not yet implemented in the open source
|
||||||
|
// release -- sorry, we'll try to include it in a future version!
|
||||||
|
optional CType ctype = 1 [default = STRING];
|
||||||
|
enum CType {
|
||||||
|
// Default mode.
|
||||||
|
STRING = 0;
|
||||||
|
|
||||||
|
CORD = 1;
|
||||||
|
|
||||||
|
STRING_PIECE = 2;
|
||||||
|
}
|
||||||
|
// The packed option can be enabled for repeated primitive fields to enable
|
||||||
|
// a more efficient representation on the wire. Rather than repeatedly
|
||||||
|
// writing the tag and type for each element, the entire array is encoded as
|
||||||
|
// a single length-delimited blob. In proto3, only explicit setting it to
|
||||||
|
// false will avoid using packed encoding.
|
||||||
|
optional bool packed = 2;
|
||||||
|
|
||||||
|
// The jstype option determines the JavaScript type used for values of the
|
||||||
|
// field. The option is permitted only for 64 bit integral and fixed types
|
||||||
|
// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
|
||||||
|
// is represented as JavaScript string, which avoids loss of precision that
|
||||||
|
// can happen when a large value is converted to a floating point JavaScript.
|
||||||
|
// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
|
||||||
|
// use the JavaScript "number" type. The behavior of the default option
|
||||||
|
// JS_NORMAL is implementation dependent.
|
||||||
|
//
|
||||||
|
// This option is an enum to permit additional types to be added, e.g.
|
||||||
|
// goog.math.Integer.
|
||||||
|
optional JSType jstype = 6 [default = JS_NORMAL];
|
||||||
|
enum JSType {
|
||||||
|
// Use the default type.
|
||||||
|
JS_NORMAL = 0;
|
||||||
|
|
||||||
|
// Use JavaScript strings.
|
||||||
|
JS_STRING = 1;
|
||||||
|
|
||||||
|
// Use JavaScript numbers.
|
||||||
|
JS_NUMBER = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should this field be parsed lazily? Lazy applies only to message-type
|
||||||
|
// fields. It means that when the outer message is initially parsed, the
|
||||||
|
// inner message's contents will not be parsed but instead stored in encoded
|
||||||
|
// form. The inner message will actually be parsed when it is first accessed.
|
||||||
|
//
|
||||||
|
// This is only a hint. Implementations are free to choose whether to use
|
||||||
|
// eager or lazy parsing regardless of the value of this option. However,
|
||||||
|
// setting this option true suggests that the protocol author believes that
|
||||||
|
// using lazy parsing on this field is worth the additional bookkeeping
|
||||||
|
// overhead typically needed to implement it.
|
||||||
|
//
|
||||||
|
// This option does not affect the public interface of any generated code;
|
||||||
|
// all method signatures remain the same. Furthermore, thread-safety of the
|
||||||
|
// interface is not affected by this option; const methods remain safe to
|
||||||
|
// call from multiple threads concurrently, while non-const methods continue
|
||||||
|
// to require exclusive access.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Note that implementations may choose not to check required fields within
|
||||||
|
// a lazy sub-message. That is, calling IsInitialized() on the outer message
|
||||||
|
// may return true even if the inner message has missing required fields.
|
||||||
|
// This is necessary because otherwise the inner message would have to be
|
||||||
|
// parsed in order to perform the check, defeating the purpose of lazy
|
||||||
|
// parsing. An implementation which chooses not to check required fields
|
||||||
|
// must be consistent about it. That is, for any particular sub-message, the
|
||||||
|
// implementation must either *always* check its required fields, or *never*
|
||||||
|
// check its required fields, regardless of whether or not the message has
|
||||||
|
// been parsed.
|
||||||
|
//
|
||||||
|
// As of 2021, lazy does no correctness checks on the byte stream during
|
||||||
|
// parsing. This may lead to crashes if and when an invalid byte stream is
|
||||||
|
// finally parsed upon access.
|
||||||
|
//
|
||||||
|
// TODO(b/211906113): Enable validation on lazy fields.
|
||||||
|
optional bool lazy = 5 [default = false];
|
||||||
|
|
||||||
|
// unverified_lazy does no correctness checks on the byte stream. This should
|
||||||
|
// only be used where lazy with verification is prohibitive for performance
|
||||||
|
// reasons.
|
||||||
|
optional bool unverified_lazy = 15 [default = false];
|
||||||
|
|
||||||
|
// Is this field deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for accessors, or it will be completely ignored; in the very least, this
|
||||||
|
// is a formalization for deprecating fields.
|
||||||
|
optional bool deprecated = 3 [default = false];
|
||||||
|
|
||||||
|
// For Google-internal migration only. Do not use.
|
||||||
|
optional bool weak = 10 [default = false];
|
||||||
|
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
|
||||||
|
reserved 4; // removed jtype
|
||||||
|
}
|
||||||
|
|
||||||
|
message OneofOptions {
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message EnumOptions {
|
||||||
|
|
||||||
|
// Set this option to true to allow mapping different tag names to the same
|
||||||
|
// value.
|
||||||
|
optional bool allow_alias = 2;
|
||||||
|
|
||||||
|
// Is this enum deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the enum, or it will be completely ignored; in the very least, this
|
||||||
|
// is a formalization for deprecating enums.
|
||||||
|
optional bool deprecated = 3 [default = false];
|
||||||
|
|
||||||
|
reserved 5; // javanano_as_lite
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message EnumValueOptions {
|
||||||
|
// Is this enum value deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the enum value, or it will be completely ignored; in the very least,
|
||||||
|
// this is a formalization for deprecating enum values.
|
||||||
|
optional bool deprecated = 1 [default = false];
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ServiceOptions {
|
||||||
|
|
||||||
|
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||||
|
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||||
|
// we were already using them long before we decided to release Protocol
|
||||||
|
// Buffers.
|
||||||
|
|
||||||
|
// Is this service deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the service, or it will be completely ignored; in the very least,
|
||||||
|
// this is a formalization for deprecating services.
|
||||||
|
optional bool deprecated = 33 [default = false];
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MethodOptions {
|
||||||
|
|
||||||
|
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
|
||||||
|
// framework. We apologize for hoarding these numbers to ourselves, but
|
||||||
|
// we were already using them long before we decided to release Protocol
|
||||||
|
// Buffers.
|
||||||
|
|
||||||
|
// Is this method deprecated?
|
||||||
|
// Depending on the target platform, this can emit Deprecated annotations
|
||||||
|
// for the method, or it will be completely ignored; in the very least,
|
||||||
|
// this is a formalization for deprecating methods.
|
||||||
|
optional bool deprecated = 33 [default = false];
|
||||||
|
|
||||||
|
// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
|
||||||
|
// or neither? HTTP based RPC implementation may choose GET verb for safe
|
||||||
|
// methods, and PUT verb for idempotent methods instead of the default POST.
|
||||||
|
enum IdempotencyLevel {
|
||||||
|
IDEMPOTENCY_UNKNOWN = 0;
|
||||||
|
NO_SIDE_EFFECTS = 1; // implies idempotent
|
||||||
|
IDEMPOTENT = 2; // idempotent, but may have side effects
|
||||||
|
}
|
||||||
|
optional IdempotencyLevel idempotency_level = 34
|
||||||
|
[default = IDEMPOTENCY_UNKNOWN];
|
||||||
|
|
||||||
|
// The parser stores options it doesn't recognize here. See above.
|
||||||
|
repeated UninterpretedOption uninterpreted_option = 999;
|
||||||
|
|
||||||
|
// Clients can define custom options in extensions of this message. See above.
|
||||||
|
extensions 1000 to max;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// A message representing a option the parser does not recognize. This only
|
||||||
|
// appears in options protos created by the compiler::Parser class.
|
||||||
|
// DescriptorPool resolves these when building Descriptor objects. Therefore,
|
||||||
|
// options protos in descriptor objects (e.g. returned by Descriptor::options(),
|
||||||
|
// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
|
||||||
|
// in them.
|
||||||
|
message UninterpretedOption {
|
||||||
|
// The name of the uninterpreted option. Each string represents a segment in
|
||||||
|
// a dot-separated name. is_extension is true iff a segment represents an
|
||||||
|
// extension (denoted with parentheses in options specs in .proto files).
|
||||||
|
// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
|
||||||
|
// "foo.(bar.baz).qux".
|
||||||
|
message NamePart {
|
||||||
|
required string name_part = 1;
|
||||||
|
required bool is_extension = 2;
|
||||||
|
}
|
||||||
|
repeated NamePart name = 2;
|
||||||
|
|
||||||
|
// The value of the uninterpreted option, in whatever type the tokenizer
|
||||||
|
// identified it as during parsing. Exactly one of these should be set.
|
||||||
|
optional string identifier_value = 3;
|
||||||
|
optional uint64 positive_int_value = 4;
|
||||||
|
optional int64 negative_int_value = 5;
|
||||||
|
optional double double_value = 6;
|
||||||
|
optional bytes string_value = 7;
|
||||||
|
optional string aggregate_value = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
// Optional source code info
|
||||||
|
|
||||||
|
// Encapsulates information about the original source file from which a
|
||||||
|
// FileDescriptorProto was generated.
|
||||||
|
message SourceCodeInfo {
|
||||||
|
// A Location identifies a piece of source code in a .proto file which
|
||||||
|
// corresponds to a particular definition. This information is intended
|
||||||
|
// to be useful to IDEs, code indexers, documentation generators, and similar
|
||||||
|
// tools.
|
||||||
|
//
|
||||||
|
// For example, say we have a file like:
|
||||||
|
// message Foo {
|
||||||
|
// optional string foo = 1;
|
||||||
|
// }
|
||||||
|
// Let's look at just the field definition:
|
||||||
|
// optional string foo = 1;
|
||||||
|
// ^ ^^ ^^ ^ ^^^
|
||||||
|
// a bc de f ghi
|
||||||
|
// We have the following locations:
|
||||||
|
// span path represents
|
||||||
|
// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
|
||||||
|
// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
|
||||||
|
// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
|
||||||
|
// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
|
||||||
|
// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
// - A location may refer to a repeated field itself (i.e. not to any
|
||||||
|
// particular index within it). This is used whenever a set of elements are
|
||||||
|
// logically enclosed in a single code segment. For example, an entire
|
||||||
|
// extend block (possibly containing multiple extension definitions) will
|
||||||
|
// have an outer location whose path refers to the "extensions" repeated
|
||||||
|
// field without an index.
|
||||||
|
// - Multiple locations may have the same path. This happens when a single
|
||||||
|
// logical declaration is spread out across multiple places. The most
|
||||||
|
// obvious example is the "extend" block again -- there may be multiple
|
||||||
|
// extend blocks in the same scope, each of which will have the same path.
|
||||||
|
// - A location's span is not always a subset of its parent's span. For
|
||||||
|
// example, the "extendee" of an extension declaration appears at the
|
||||||
|
// beginning of the "extend" block and is shared by all extensions within
|
||||||
|
// the block.
|
||||||
|
// - Just because a location's span is a subset of some other location's span
|
||||||
|
// does not mean that it is a descendant. For example, a "group" defines
|
||||||
|
// both a type and a field in a single declaration. Thus, the locations
|
||||||
|
// corresponding to the type and field and their components will overlap.
|
||||||
|
// - Code which tries to interpret locations should probably be designed to
|
||||||
|
// ignore those that it doesn't understand, as more types of locations could
|
||||||
|
// be recorded in the future.
|
||||||
|
repeated Location location = 1;
|
||||||
|
message Location {
|
||||||
|
// Identifies which part of the FileDescriptorProto was defined at this
|
||||||
|
// location.
|
||||||
|
//
|
||||||
|
// Each element is a field number or an index. They form a path from
|
||||||
|
// the root FileDescriptorProto to the place where the definition occurs.
|
||||||
|
// For example, this path:
|
||||||
|
// [ 4, 3, 2, 7, 1 ]
|
||||||
|
// refers to:
|
||||||
|
// file.message_type(3) // 4, 3
|
||||||
|
// .field(7) // 2, 7
|
||||||
|
// .name() // 1
|
||||||
|
// This is because FileDescriptorProto.message_type has field number 4:
|
||||||
|
// repeated DescriptorProto message_type = 4;
|
||||||
|
// and DescriptorProto.field has field number 2:
|
||||||
|
// repeated FieldDescriptorProto field = 2;
|
||||||
|
// and FieldDescriptorProto.name has field number 1:
|
||||||
|
// optional string name = 1;
|
||||||
|
//
|
||||||
|
// Thus, the above path gives the location of a field name. If we removed
|
||||||
|
// the last element:
|
||||||
|
// [ 4, 3, 2, 7 ]
|
||||||
|
// this path refers to the whole field declaration (from the beginning
|
||||||
|
// of the label to the terminating semicolon).
|
||||||
|
repeated int32 path = 1 [packed = true];
|
||||||
|
|
||||||
|
// Always has exactly three or four elements: start line, start column,
|
||||||
|
// end line (optional, otherwise assumed same as start line), end column.
|
||||||
|
// These are packed into a single field for efficiency. Note that line
|
||||||
|
// and column numbers are zero-based -- typically you will want to add
|
||||||
|
// 1 to each before displaying to a user.
|
||||||
|
repeated int32 span = 2 [packed = true];
|
||||||
|
|
||||||
|
// If this SourceCodeInfo represents a complete declaration, these are any
|
||||||
|
// comments appearing before and after the declaration which appear to be
|
||||||
|
// attached to the declaration.
|
||||||
|
//
|
||||||
|
// A series of line comments appearing on consecutive lines, with no other
|
||||||
|
// tokens appearing on those lines, will be treated as a single comment.
|
||||||
|
//
|
||||||
|
// leading_detached_comments will keep paragraphs of comments that appear
|
||||||
|
// before (but not connected to) the current element. Each paragraph,
|
||||||
|
// separated by empty lines, will be one comment element in the repeated
|
||||||
|
// field.
|
||||||
|
//
|
||||||
|
// Only the comment content is provided; comment markers (e.g. //) are
|
||||||
|
// stripped out. For block comments, leading whitespace and an asterisk
|
||||||
|
// will be stripped from the beginning of each line other than the first.
|
||||||
|
// Newlines are included in the output.
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
//
|
||||||
|
// optional int32 foo = 1; // Comment attached to foo.
|
||||||
|
// // Comment attached to bar.
|
||||||
|
// optional int32 bar = 2;
|
||||||
|
//
|
||||||
|
// optional string baz = 3;
|
||||||
|
// // Comment attached to baz.
|
||||||
|
// // Another line attached to baz.
|
||||||
|
//
|
||||||
|
// // Comment attached to qux.
|
||||||
|
// //
|
||||||
|
// // Another line attached to qux.
|
||||||
|
// optional double qux = 4;
|
||||||
|
//
|
||||||
|
// // Detached comment for corge. This is not leading or trailing comments
|
||||||
|
// // to qux or corge because there are blank lines separating it from
|
||||||
|
// // both.
|
||||||
|
//
|
||||||
|
// // Detached comment for corge paragraph 2.
|
||||||
|
//
|
||||||
|
// optional string corge = 5;
|
||||||
|
// /* Block comment attached
|
||||||
|
// * to corge. Leading asterisks
|
||||||
|
// * will be removed. */
|
||||||
|
// /* Block comment attached to
|
||||||
|
// * grault. */
|
||||||
|
// optional int32 grault = 6;
|
||||||
|
//
|
||||||
|
// // ignored detached comments.
|
||||||
|
optional string leading_comments = 3;
|
||||||
|
optional string trailing_comments = 4;
|
||||||
|
repeated string leading_detached_comments = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes the relationship between generated code and its original source
|
||||||
|
// file. A GeneratedCodeInfo message is associated with only one generated
|
||||||
|
// source file, but may contain references to different source .proto files.
|
||||||
|
message GeneratedCodeInfo {
|
||||||
|
// An Annotation connects some span of text in generated code to an element
|
||||||
|
// of its generating .proto file.
|
||||||
|
repeated Annotation annotation = 1;
|
||||||
|
message Annotation {
|
||||||
|
// Identifies the element in the original source .proto file. This field
|
||||||
|
// is formatted the same as SourceCodeInfo.Location.path.
|
||||||
|
repeated int32 path = 1 [packed = true];
|
||||||
|
|
||||||
|
// Identifies the filesystem path to the original source .proto.
|
||||||
|
optional string source_file = 2;
|
||||||
|
|
||||||
|
// Identifies the starting offset in bytes in the generated code
|
||||||
|
// that relates to the identified object.
|
||||||
|
optional int32 begin = 3;
|
||||||
|
|
||||||
|
// Identifies the ending offset in bytes in the generated code that
|
||||||
|
// relates to the identified offset. The end offset should be one past
|
||||||
|
// the last relevant byte (so the length of the text = end - begin).
|
||||||
|
optional int32 end = 4;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/durationpb";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "DurationProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
// A Duration represents a signed, fixed-length span of time represented
|
||||||
|
// as a count of seconds and fractions of seconds at nanosecond
|
||||||
|
// resolution. It is independent of any calendar and concepts like "day"
|
||||||
|
// or "month". It is related to Timestamp in that the difference between
|
||||||
|
// two Timestamp values is a Duration and it can be added or subtracted
|
||||||
|
// from a Timestamp. Range is approximately +-10,000 years.
|
||||||
|
//
|
||||||
|
// # Examples
|
||||||
|
//
|
||||||
|
// Example 1: Compute Duration from two Timestamps in pseudo code.
|
||||||
|
//
|
||||||
|
// Timestamp start = ...;
|
||||||
|
// Timestamp end = ...;
|
||||||
|
// Duration duration = ...;
|
||||||
|
//
|
||||||
|
// duration.seconds = end.seconds - start.seconds;
|
||||||
|
// duration.nanos = end.nanos - start.nanos;
|
||||||
|
//
|
||||||
|
// if (duration.seconds < 0 && duration.nanos > 0) {
|
||||||
|
// duration.seconds += 1;
|
||||||
|
// duration.nanos -= 1000000000;
|
||||||
|
// } else if (duration.seconds > 0 && duration.nanos < 0) {
|
||||||
|
// duration.seconds -= 1;
|
||||||
|
// duration.nanos += 1000000000;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
||||||
|
//
|
||||||
|
// Timestamp start = ...;
|
||||||
|
// Duration duration = ...;
|
||||||
|
// Timestamp end = ...;
|
||||||
|
//
|
||||||
|
// end.seconds = start.seconds + duration.seconds;
|
||||||
|
// end.nanos = start.nanos + duration.nanos;
|
||||||
|
//
|
||||||
|
// if (end.nanos < 0) {
|
||||||
|
// end.seconds -= 1;
|
||||||
|
// end.nanos += 1000000000;
|
||||||
|
// } else if (end.nanos >= 1000000000) {
|
||||||
|
// end.seconds += 1;
|
||||||
|
// end.nanos -= 1000000000;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Example 3: Compute Duration from datetime.timedelta in Python.
|
||||||
|
//
|
||||||
|
// td = datetime.timedelta(days=3, minutes=10)
|
||||||
|
// duration = Duration()
|
||||||
|
// duration.FromTimedelta(td)
|
||||||
|
//
|
||||||
|
// # JSON Mapping
|
||||||
|
//
|
||||||
|
// In JSON format, the Duration type is encoded as a string rather than an
|
||||||
|
// object, where the string ends in the suffix "s" (indicating seconds) and
|
||||||
|
// is preceded by the number of seconds, with nanoseconds expressed as
|
||||||
|
// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
||||||
|
// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
||||||
|
// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
||||||
|
// microsecond should be expressed in JSON format as "3.000001s".
|
||||||
|
//
|
||||||
|
//
|
||||||
|
message Duration {
|
||||||
|
// Signed seconds of the span of time. Must be from -315,576,000,000
|
||||||
|
// to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
||||||
|
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
||||||
|
int64 seconds = 1;
|
||||||
|
|
||||||
|
// Signed fractions of a second at nanosecond resolution of the span
|
||||||
|
// of time. Durations less than one second are represented with a 0
|
||||||
|
// `seconds` field and a positive or negative `nanos` field. For durations
|
||||||
|
// of one second or more, a non-zero value for the `nanos` field must be
|
||||||
|
// of the same sign as the `seconds` field. Must be from -999,999,999
|
||||||
|
// to +999,999,999 inclusive.
|
||||||
|
int32 nanos = 2;
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/emptypb";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "EmptyProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
|
||||||
|
// A generic empty message that you can re-use to avoid defining duplicated
|
||||||
|
// empty messages in your APIs. A typical example is to use it as the request
|
||||||
|
// or the response type of an API method. For instance:
|
||||||
|
//
|
||||||
|
// service Foo {
|
||||||
|
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// The JSON representation for `Empty` is empty JSON object `{}`.
|
||||||
|
message Empty {}
|
@ -0,0 +1,245 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "FieldMaskProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/fieldmaskpb";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
|
||||||
|
// `FieldMask` represents a set of symbolic field paths, for example:
|
||||||
|
//
|
||||||
|
// paths: "f.a"
|
||||||
|
// paths: "f.b.d"
|
||||||
|
//
|
||||||
|
// Here `f` represents a field in some root message, `a` and `b`
|
||||||
|
// fields in the message found in `f`, and `d` a field found in the
|
||||||
|
// message in `f.b`.
|
||||||
|
//
|
||||||
|
// Field masks are used to specify a subset of fields that should be
|
||||||
|
// returned by a get operation or modified by an update operation.
|
||||||
|
// Field masks also have a custom JSON encoding (see below).
|
||||||
|
//
|
||||||
|
// # Field Masks in Projections
|
||||||
|
//
|
||||||
|
// When used in the context of a projection, a response message or
|
||||||
|
// sub-message is filtered by the API to only contain those fields as
|
||||||
|
// specified in the mask. For example, if the mask in the previous
|
||||||
|
// example is applied to a response message as follows:
|
||||||
|
//
|
||||||
|
// f {
|
||||||
|
// a : 22
|
||||||
|
// b {
|
||||||
|
// d : 1
|
||||||
|
// x : 2
|
||||||
|
// }
|
||||||
|
// y : 13
|
||||||
|
// }
|
||||||
|
// z: 8
|
||||||
|
//
|
||||||
|
// The result will not contain specific values for fields x,y and z
|
||||||
|
// (their value will be set to the default, and omitted in proto text
|
||||||
|
// output):
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// f {
|
||||||
|
// a : 22
|
||||||
|
// b {
|
||||||
|
// d : 1
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// A repeated field is not allowed except at the last position of a
|
||||||
|
// paths string.
|
||||||
|
//
|
||||||
|
// If a FieldMask object is not present in a get operation, the
|
||||||
|
// operation applies to all fields (as if a FieldMask of all fields
|
||||||
|
// had been specified).
|
||||||
|
//
|
||||||
|
// Note that a field mask does not necessarily apply to the
|
||||||
|
// top-level response message. In case of a REST get operation, the
|
||||||
|
// field mask applies directly to the response, but in case of a REST
|
||||||
|
// list operation, the mask instead applies to each individual message
|
||||||
|
// in the returned resource list. In case of a REST custom method,
|
||||||
|
// other definitions may be used. Where the mask applies will be
|
||||||
|
// clearly documented together with its declaration in the API. In
|
||||||
|
// any case, the effect on the returned resource/resources is required
|
||||||
|
// behavior for APIs.
|
||||||
|
//
|
||||||
|
// # Field Masks in Update Operations
|
||||||
|
//
|
||||||
|
// A field mask in update operations specifies which fields of the
|
||||||
|
// targeted resource are going to be updated. The API is required
|
||||||
|
// to only change the values of the fields as specified in the mask
|
||||||
|
// and leave the others untouched. If a resource is passed in to
|
||||||
|
// describe the updated values, the API ignores the values of all
|
||||||
|
// fields not covered by the mask.
|
||||||
|
//
|
||||||
|
// If a repeated field is specified for an update operation, new values will
|
||||||
|
// be appended to the existing repeated field in the target resource. Note that
|
||||||
|
// a repeated field is only allowed in the last position of a `paths` string.
|
||||||
|
//
|
||||||
|
// If a sub-message is specified in the last position of the field mask for an
|
||||||
|
// update operation, then new value will be merged into the existing sub-message
|
||||||
|
// in the target resource.
|
||||||
|
//
|
||||||
|
// For example, given the target message:
|
||||||
|
//
|
||||||
|
// f {
|
||||||
|
// b {
|
||||||
|
// d: 1
|
||||||
|
// x: 2
|
||||||
|
// }
|
||||||
|
// c: [1]
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// And an update message:
|
||||||
|
//
|
||||||
|
// f {
|
||||||
|
// b {
|
||||||
|
// d: 10
|
||||||
|
// }
|
||||||
|
// c: [2]
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// then if the field mask is:
|
||||||
|
//
|
||||||
|
// paths: ["f.b", "f.c"]
|
||||||
|
//
|
||||||
|
// then the result will be:
|
||||||
|
//
|
||||||
|
// f {
|
||||||
|
// b {
|
||||||
|
// d: 10
|
||||||
|
// x: 2
|
||||||
|
// }
|
||||||
|
// c: [1, 2]
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// An implementation may provide options to override this default behavior for
|
||||||
|
// repeated and message fields.
|
||||||
|
//
|
||||||
|
// In order to reset a field's value to the default, the field must
|
||||||
|
// be in the mask and set to the default value in the provided resource.
|
||||||
|
// Hence, in order to reset all fields of a resource, provide a default
|
||||||
|
// instance of the resource and set all fields in the mask, or do
|
||||||
|
// not provide a mask as described below.
|
||||||
|
//
|
||||||
|
// If a field mask is not present on update, the operation applies to
|
||||||
|
// all fields (as if a field mask of all fields has been specified).
|
||||||
|
// Note that in the presence of schema evolution, this may mean that
|
||||||
|
// fields the client does not know and has therefore not filled into
|
||||||
|
// the request will be reset to their default. If this is unwanted
|
||||||
|
// behavior, a specific service may require a client to always specify
|
||||||
|
// a field mask, producing an error if not.
|
||||||
|
//
|
||||||
|
// As with get operations, the location of the resource which
|
||||||
|
// describes the updated values in the request message depends on the
|
||||||
|
// operation kind. In any case, the effect of the field mask is
|
||||||
|
// required to be honored by the API.
|
||||||
|
//
|
||||||
|
// ## Considerations for HTTP REST
|
||||||
|
//
|
||||||
|
// The HTTP kind of an update operation which uses a field mask must
|
||||||
|
// be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
||||||
|
// (PUT must only be used for full updates).
|
||||||
|
//
|
||||||
|
// # JSON Encoding of Field Masks
|
||||||
|
//
|
||||||
|
// In JSON, a field mask is encoded as a single string where paths are
|
||||||
|
// separated by a comma. Fields name in each path are converted
|
||||||
|
// to/from lower-camel naming conventions.
|
||||||
|
//
|
||||||
|
// As an example, consider the following message declarations:
|
||||||
|
//
|
||||||
|
// message Profile {
|
||||||
|
// User user = 1;
|
||||||
|
// Photo photo = 2;
|
||||||
|
// }
|
||||||
|
// message User {
|
||||||
|
// string display_name = 1;
|
||||||
|
// string address = 2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// In proto a field mask for `Profile` may look as such:
|
||||||
|
//
|
||||||
|
// mask {
|
||||||
|
// paths: "user.display_name"
|
||||||
|
// paths: "photo"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// In JSON, the same mask is represented as below:
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// mask: "user.displayName,photo"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// # Field Masks and Oneof Fields
|
||||||
|
//
|
||||||
|
// Field masks treat fields in oneofs just as regular fields. Consider the
|
||||||
|
// following message:
|
||||||
|
//
|
||||||
|
// message SampleMessage {
|
||||||
|
// oneof test_oneof {
|
||||||
|
// string name = 4;
|
||||||
|
// SubMessage sub_message = 9;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// The field mask can be:
|
||||||
|
//
|
||||||
|
// mask {
|
||||||
|
// paths: "name"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Or:
|
||||||
|
//
|
||||||
|
// mask {
|
||||||
|
// paths: "sub_message"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Note that oneof type names ("test_oneof" in this case) cannot be used in
|
||||||
|
// paths.
|
||||||
|
//
|
||||||
|
// ## Field Mask Verification
|
||||||
|
//
|
||||||
|
// The implementation of any API method which has a FieldMask type field in the
|
||||||
|
// request should verify the included field paths, and return an
|
||||||
|
// `INVALID_ARGUMENT` error if any path is unmappable.
|
||||||
|
message FieldMask {
|
||||||
|
// The set of field mask paths.
|
||||||
|
repeated string paths = 1;
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "SourceContextProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/sourcecontextpb";
|
||||||
|
|
||||||
|
// `SourceContext` represents information about the source of a
|
||||||
|
// protobuf element, like the file in which it is defined.
|
||||||
|
message SourceContext {
|
||||||
|
// The path-qualified name of the .proto file that contained the associated
|
||||||
|
// protobuf element. For example: `"google/protobuf/source_context.proto"`.
|
||||||
|
string file_name = 1;
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/structpb";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "StructProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
// `Struct` represents a structured data value, consisting of fields
|
||||||
|
// which map to dynamically typed values. In some languages, `Struct`
|
||||||
|
// might be supported by a native representation. For example, in
|
||||||
|
// scripting languages like JS a struct is represented as an
|
||||||
|
// object. The details of that representation are described together
|
||||||
|
// with the proto support for the language.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Struct` is JSON object.
|
||||||
|
message Struct {
|
||||||
|
// Unordered map of dynamically typed values.
|
||||||
|
map<string, Value> fields = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// `Value` represents a dynamically typed value which can be either
|
||||||
|
// null, a number, a string, a boolean, a recursive struct value, or a
|
||||||
|
// list of values. A producer of value is expected to set one of these
|
||||||
|
// variants. Absence of any variant indicates an error.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Value` is JSON value.
|
||||||
|
message Value {
|
||||||
|
// The kind of value.
|
||||||
|
oneof kind {
|
||||||
|
// Represents a null value.
|
||||||
|
NullValue null_value = 1;
|
||||||
|
// Represents a double value.
|
||||||
|
double number_value = 2;
|
||||||
|
// Represents a string value.
|
||||||
|
string string_value = 3;
|
||||||
|
// Represents a boolean value.
|
||||||
|
bool bool_value = 4;
|
||||||
|
// Represents a structured value.
|
||||||
|
Struct struct_value = 5;
|
||||||
|
// Represents a repeated `Value`.
|
||||||
|
ListValue list_value = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// `NullValue` is a singleton enumeration to represent the null value for the
|
||||||
|
// `Value` type union.
|
||||||
|
//
|
||||||
|
// The JSON representation for `NullValue` is JSON `null`.
|
||||||
|
enum NullValue {
|
||||||
|
// Null value.
|
||||||
|
NULL_VALUE = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// `ListValue` is a wrapper around a repeated field of values.
|
||||||
|
//
|
||||||
|
// The JSON representation for `ListValue` is JSON array.
|
||||||
|
message ListValue {
|
||||||
|
// Repeated field of dynamically typed values.
|
||||||
|
repeated Value values = 1;
|
||||||
|
}
|
@ -0,0 +1,147 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/timestamppb";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "TimestampProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
// A Timestamp represents a point in time independent of any time zone or local
|
||||||
|
// calendar, encoded as a count of seconds and fractions of seconds at
|
||||||
|
// nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
||||||
|
// January 1, 1970, in the proleptic Gregorian calendar which extends the
|
||||||
|
// Gregorian calendar backwards to year one.
|
||||||
|
//
|
||||||
|
// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
||||||
|
// second table is needed for interpretation, using a [24-hour linear
|
||||||
|
// smear](https://developers.google.com/time/smear).
|
||||||
|
//
|
||||||
|
// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
||||||
|
// restricting to that range, we ensure that we can convert to and from [RFC
|
||||||
|
// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
||||||
|
//
|
||||||
|
// # Examples
|
||||||
|
//
|
||||||
|
// Example 1: Compute Timestamp from POSIX `time()`.
|
||||||
|
//
|
||||||
|
// Timestamp timestamp;
|
||||||
|
// timestamp.set_seconds(time(NULL));
|
||||||
|
// timestamp.set_nanos(0);
|
||||||
|
//
|
||||||
|
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||||
|
//
|
||||||
|
// struct timeval tv;
|
||||||
|
// gettimeofday(&tv, NULL);
|
||||||
|
//
|
||||||
|
// Timestamp timestamp;
|
||||||
|
// timestamp.set_seconds(tv.tv_sec);
|
||||||
|
// timestamp.set_nanos(tv.tv_usec * 1000);
|
||||||
|
//
|
||||||
|
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||||
|
//
|
||||||
|
// FILETIME ft;
|
||||||
|
// GetSystemTimeAsFileTime(&ft);
|
||||||
|
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||||
|
//
|
||||||
|
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||||
|
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||||
|
// Timestamp timestamp;
|
||||||
|
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||||
|
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||||
|
//
|
||||||
|
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||||
|
//
|
||||||
|
// long millis = System.currentTimeMillis();
|
||||||
|
//
|
||||||
|
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||||
|
// .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Example 5: Compute Timestamp from Java `Instant.now()`.
|
||||||
|
//
|
||||||
|
// Instant now = Instant.now();
|
||||||
|
//
|
||||||
|
// Timestamp timestamp =
|
||||||
|
// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
||||||
|
// .setNanos(now.getNano()).build();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Example 6: Compute Timestamp from current time in Python.
|
||||||
|
//
|
||||||
|
// timestamp = Timestamp()
|
||||||
|
// timestamp.GetCurrentTime()
|
||||||
|
//
|
||||||
|
// # JSON Mapping
|
||||||
|
//
|
||||||
|
// In JSON format, the Timestamp type is encoded as a string in the
|
||||||
|
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||||
|
// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||||
|
// where {year} is always expressed using four digits while {month}, {day},
|
||||||
|
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||||
|
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||||
|
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||||
|
// is required. A proto3 JSON serializer should always use UTC (as indicated by
|
||||||
|
// "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
||||||
|
// able to accept both UTC and other timezones (as indicated by an offset).
|
||||||
|
//
|
||||||
|
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||||
|
// 01:30 UTC on January 15, 2017.
|
||||||
|
//
|
||||||
|
// In JavaScript, one can convert a Date object to this format using the
|
||||||
|
// standard
|
||||||
|
// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||||
|
// method. In Python, a standard `datetime.datetime` object can be converted
|
||||||
|
// to this format using
|
||||||
|
// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||||
|
// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||||
|
// the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||||
|
// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
||||||
|
// ) to obtain a formatter capable of generating timestamps in this format.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
message Timestamp {
|
||||||
|
// Represents seconds of UTC time since Unix epoch
|
||||||
|
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||||
|
// 9999-12-31T23:59:59Z inclusive.
|
||||||
|
int64 seconds = 1;
|
||||||
|
|
||||||
|
// Non-negative fractions of a second at nanosecond resolution. Negative
|
||||||
|
// second values with fractions must still have non-negative nanos values
|
||||||
|
// that count forward in time. Must be from 0 to 999,999,999
|
||||||
|
// inclusive.
|
||||||
|
int32 nanos = 2;
|
||||||
|
}
|
@ -0,0 +1,187 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
import "google/protobuf/any.proto";
|
||||||
|
import "google/protobuf/source_context.proto";
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "TypeProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/typepb";
|
||||||
|
|
||||||
|
// A protocol buffer message type.
|
||||||
|
message Type {
|
||||||
|
// The fully qualified message name.
|
||||||
|
string name = 1;
|
||||||
|
// The list of fields.
|
||||||
|
repeated Field fields = 2;
|
||||||
|
// The list of types appearing in `oneof` definitions in this type.
|
||||||
|
repeated string oneofs = 3;
|
||||||
|
// The protocol buffer options.
|
||||||
|
repeated Option options = 4;
|
||||||
|
// The source context.
|
||||||
|
SourceContext source_context = 5;
|
||||||
|
// The source syntax.
|
||||||
|
Syntax syntax = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A single field of a message type.
|
||||||
|
message Field {
|
||||||
|
// Basic field types.
|
||||||
|
enum Kind {
|
||||||
|
// Field type unknown.
|
||||||
|
TYPE_UNKNOWN = 0;
|
||||||
|
// Field type double.
|
||||||
|
TYPE_DOUBLE = 1;
|
||||||
|
// Field type float.
|
||||||
|
TYPE_FLOAT = 2;
|
||||||
|
// Field type int64.
|
||||||
|
TYPE_INT64 = 3;
|
||||||
|
// Field type uint64.
|
||||||
|
TYPE_UINT64 = 4;
|
||||||
|
// Field type int32.
|
||||||
|
TYPE_INT32 = 5;
|
||||||
|
// Field type fixed64.
|
||||||
|
TYPE_FIXED64 = 6;
|
||||||
|
// Field type fixed32.
|
||||||
|
TYPE_FIXED32 = 7;
|
||||||
|
// Field type bool.
|
||||||
|
TYPE_BOOL = 8;
|
||||||
|
// Field type string.
|
||||||
|
TYPE_STRING = 9;
|
||||||
|
// Field type group. Proto2 syntax only, and deprecated.
|
||||||
|
TYPE_GROUP = 10;
|
||||||
|
// Field type message.
|
||||||
|
TYPE_MESSAGE = 11;
|
||||||
|
// Field type bytes.
|
||||||
|
TYPE_BYTES = 12;
|
||||||
|
// Field type uint32.
|
||||||
|
TYPE_UINT32 = 13;
|
||||||
|
// Field type enum.
|
||||||
|
TYPE_ENUM = 14;
|
||||||
|
// Field type sfixed32.
|
||||||
|
TYPE_SFIXED32 = 15;
|
||||||
|
// Field type sfixed64.
|
||||||
|
TYPE_SFIXED64 = 16;
|
||||||
|
// Field type sint32.
|
||||||
|
TYPE_SINT32 = 17;
|
||||||
|
// Field type sint64.
|
||||||
|
TYPE_SINT64 = 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Whether a field is optional, required, or repeated.
|
||||||
|
enum Cardinality {
|
||||||
|
// For fields with unknown cardinality.
|
||||||
|
CARDINALITY_UNKNOWN = 0;
|
||||||
|
// For optional fields.
|
||||||
|
CARDINALITY_OPTIONAL = 1;
|
||||||
|
// For required fields. Proto2 syntax only.
|
||||||
|
CARDINALITY_REQUIRED = 2;
|
||||||
|
// For repeated fields.
|
||||||
|
CARDINALITY_REPEATED = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The field type.
|
||||||
|
Kind kind = 1;
|
||||||
|
// The field cardinality.
|
||||||
|
Cardinality cardinality = 2;
|
||||||
|
// The field number.
|
||||||
|
int32 number = 3;
|
||||||
|
// The field name.
|
||||||
|
string name = 4;
|
||||||
|
// The field type URL, without the scheme, for message or enumeration
|
||||||
|
// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
|
||||||
|
string type_url = 6;
|
||||||
|
// The index of the field type in `Type.oneofs`, for message or enumeration
|
||||||
|
// types. The first type has index 1; zero means the type is not in the list.
|
||||||
|
int32 oneof_index = 7;
|
||||||
|
// Whether to use alternative packed wire representation.
|
||||||
|
bool packed = 8;
|
||||||
|
// The protocol buffer options.
|
||||||
|
repeated Option options = 9;
|
||||||
|
// The field JSON name.
|
||||||
|
string json_name = 10;
|
||||||
|
// The string value of the default value of this field. Proto2 syntax only.
|
||||||
|
string default_value = 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enum type definition.
|
||||||
|
message Enum {
|
||||||
|
// Enum type name.
|
||||||
|
string name = 1;
|
||||||
|
// Enum value definitions.
|
||||||
|
repeated EnumValue enumvalue = 2;
|
||||||
|
// Protocol buffer options.
|
||||||
|
repeated Option options = 3;
|
||||||
|
// The source context.
|
||||||
|
SourceContext source_context = 4;
|
||||||
|
// The source syntax.
|
||||||
|
Syntax syntax = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enum value definition.
|
||||||
|
message EnumValue {
|
||||||
|
// Enum value name.
|
||||||
|
string name = 1;
|
||||||
|
// Enum value number.
|
||||||
|
int32 number = 2;
|
||||||
|
// Protocol buffer options.
|
||||||
|
repeated Option options = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A protocol buffer option, which can be attached to a message, field,
|
||||||
|
// enumeration, etc.
|
||||||
|
message Option {
|
||||||
|
// The option's name. For protobuf built-in options (options defined in
|
||||||
|
// descriptor.proto), this is the short name. For example, `"map_entry"`.
|
||||||
|
// For custom options, it should be the fully-qualified name. For example,
|
||||||
|
// `"google.api.http"`.
|
||||||
|
string name = 1;
|
||||||
|
// The option's value packed in an Any message. If the value is a primitive,
|
||||||
|
// the corresponding wrapper type defined in google/protobuf/wrappers.proto
|
||||||
|
// should be used. If the value is an enum, it should be stored as an int32
|
||||||
|
// value using the google.protobuf.Int32Value type.
|
||||||
|
Any value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The syntax in which a protocol buffer element is defined.
|
||||||
|
enum Syntax {
|
||||||
|
// Syntax `proto2`.
|
||||||
|
SYNTAX_PROTO2 = 0;
|
||||||
|
// Syntax `proto3`.
|
||||||
|
SYNTAX_PROTO3 = 1;
|
||||||
|
}
|
@ -0,0 +1,123 @@
|
|||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
// Wrappers for primitive (non-message) types. These types are useful
|
||||||
|
// for embedding primitives in the `google.protobuf.Any` type and for places
|
||||||
|
// where we need to distinguish between the absence of a primitive
|
||||||
|
// typed field and its default value.
|
||||||
|
//
|
||||||
|
// These wrappers have no meaningful use within repeated fields as they lack
|
||||||
|
// the ability to detect presence on individual elements.
|
||||||
|
// These wrappers have no meaningful use within a map or a oneof since
|
||||||
|
// individual entries of a map or fields of a oneof can already detect presence.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||||
|
option cc_enable_arenas = true;
|
||||||
|
option go_package = "google.golang.org/protobuf/types/known/wrapperspb";
|
||||||
|
option java_package = "com.google.protobuf";
|
||||||
|
option java_outer_classname = "WrappersProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
option objc_class_prefix = "GPB";
|
||||||
|
|
||||||
|
// Wrapper message for `double`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `DoubleValue` is JSON number.
|
||||||
|
message DoubleValue {
|
||||||
|
// The double value.
|
||||||
|
double value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `float`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `FloatValue` is JSON number.
|
||||||
|
message FloatValue {
|
||||||
|
// The float value.
|
||||||
|
float value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `int64`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Int64Value` is JSON string.
|
||||||
|
message Int64Value {
|
||||||
|
// The int64 value.
|
||||||
|
int64 value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `uint64`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `UInt64Value` is JSON string.
|
||||||
|
message UInt64Value {
|
||||||
|
// The uint64 value.
|
||||||
|
uint64 value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `int32`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `Int32Value` is JSON number.
|
||||||
|
message Int32Value {
|
||||||
|
// The int32 value.
|
||||||
|
int32 value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `uint32`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `UInt32Value` is JSON number.
|
||||||
|
message UInt32Value {
|
||||||
|
// The uint32 value.
|
||||||
|
uint32 value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `bool`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `BoolValue` is JSON `true` and `false`.
|
||||||
|
message BoolValue {
|
||||||
|
// The bool value.
|
||||||
|
bool value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `string`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `StringValue` is JSON string.
|
||||||
|
message StringValue {
|
||||||
|
// The string value.
|
||||||
|
string value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper message for `bytes`.
|
||||||
|
//
|
||||||
|
// The JSON representation for `BytesValue` is JSON string.
|
||||||
|
message BytesValue {
|
||||||
|
// The bytes value.
|
||||||
|
bytes value = 1;
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
// Copyright 2022 Google LLC. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package openapi.v3;
|
||||||
|
|
||||||
|
import "openapi/v3/openapi.proto";
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
|
||||||
|
// This option lets the proto compiler generate Java code inside the package
|
||||||
|
// name (see below) instead of inside an outer class. It creates a simpler
|
||||||
|
// developer experience by reducing one-level of name nesting and be
|
||||||
|
// consistent with most programming languages that don't support outer classes.
|
||||||
|
option java_multiple_files = true;
|
||||||
|
|
||||||
|
// The Java outer classname should be the filename in UpperCamelCase. This
|
||||||
|
// class is only used to hold proto descriptor, so developers don't need to
|
||||||
|
// work with it directly.
|
||||||
|
option java_outer_classname = "AnnotationsProto";
|
||||||
|
|
||||||
|
// The Java package name must be proto package name with proper prefix.
|
||||||
|
option java_package = "org.openapi_v3";
|
||||||
|
|
||||||
|
// A reasonable prefix for the Objective-C symbols generated from the package.
|
||||||
|
// It should at a minimum be 3 characters long, all uppercase, and convention
|
||||||
|
// is to use an abbreviation of the package name. Something short, but
|
||||||
|
// hopefully unique enough to not conflict with things that may come along in
|
||||||
|
// the future. 'GPB' is reserved for the protocol buffer implementation itself.
|
||||||
|
option objc_class_prefix = "OAS";
|
||||||
|
|
||||||
|
// The Go package name.
|
||||||
|
option go_package = "github.com/google/gnostic/openapiv3;openapi_v3";
|
||||||
|
|
||||||
|
extend google.protobuf.FileOptions {
|
||||||
|
Document document = 1143;
|
||||||
|
}
|
||||||
|
|
||||||
|
extend google.protobuf.MethodOptions {
|
||||||
|
Operation operation = 1143;
|
||||||
|
}
|
||||||
|
|
||||||
|
extend google.protobuf.MessageOptions {
|
||||||
|
Schema schema = 1143;
|
||||||
|
}
|
||||||
|
|
||||||
|
extend google.protobuf.FieldOptions {
|
||||||
|
Schema property = 1143;
|
||||||
|
}
|
@ -0,0 +1,672 @@
|
|||||||
|
// Copyright 2020 Google LLC. All Rights Reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
// THIS FILE IS AUTOMATICALLY GENERATED.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package openapi.v3;
|
||||||
|
|
||||||
|
import "google/protobuf/any.proto";
|
||||||
|
|
||||||
|
// This option lets the proto compiler generate Java code inside the package
|
||||||
|
// name (see below) instead of inside an outer class. It creates a simpler
|
||||||
|
// developer experience by reducing one-level of name nesting and be
|
||||||
|
// consistent with most programming languages that don't support outer classes.
|
||||||
|
option java_multiple_files = true;
|
||||||
|
|
||||||
|
// The Java outer classname should be the filename in UpperCamelCase. This
|
||||||
|
// class is only used to hold proto descriptor, so developers don't need to
|
||||||
|
// work with it directly.
|
||||||
|
option java_outer_classname = "OpenAPIProto";
|
||||||
|
|
||||||
|
// The Java package name must be proto package name with proper prefix.
|
||||||
|
option java_package = "org.openapi_v3";
|
||||||
|
|
||||||
|
// A reasonable prefix for the Objective-C symbols generated from the package.
|
||||||
|
// It should at a minimum be 3 characters long, all uppercase, and convention
|
||||||
|
// is to use an abbreviation of the package name. Something short, but
|
||||||
|
// hopefully unique enough to not conflict with things that may come along in
|
||||||
|
// the future. 'GPB' is reserved for the protocol buffer implementation itself.
|
||||||
|
option objc_class_prefix = "OAS";
|
||||||
|
|
||||||
|
// The Go package name.
|
||||||
|
option go_package = "github.com/google/gnostic/openapiv3;openapi_v3";
|
||||||
|
|
||||||
|
message AdditionalPropertiesItem {
|
||||||
|
oneof oneof {
|
||||||
|
SchemaOrReference schema_or_reference = 1;
|
||||||
|
bool boolean = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message Any {
|
||||||
|
google.protobuf.Any value = 1;
|
||||||
|
string yaml = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AnyOrExpression {
|
||||||
|
oneof oneof {
|
||||||
|
Any any = 1;
|
||||||
|
Expression expression = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
|
||||||
|
message Callback {
|
||||||
|
repeated NamedPathItem path = 1;
|
||||||
|
repeated NamedAny specification_extension = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CallbackOrReference {
|
||||||
|
oneof oneof {
|
||||||
|
Callback callback = 1;
|
||||||
|
Reference reference = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message CallbacksOrReferences {
|
||||||
|
repeated NamedCallbackOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
|
||||||
|
message Components {
|
||||||
|
SchemasOrReferences schemas = 1;
|
||||||
|
ResponsesOrReferences responses = 2;
|
||||||
|
ParametersOrReferences parameters = 3;
|
||||||
|
ExamplesOrReferences examples = 4;
|
||||||
|
RequestBodiesOrReferences request_bodies = 5;
|
||||||
|
HeadersOrReferences headers = 6;
|
||||||
|
SecuritySchemesOrReferences security_schemes = 7;
|
||||||
|
LinksOrReferences links = 8;
|
||||||
|
CallbacksOrReferences callbacks = 9;
|
||||||
|
repeated NamedAny specification_extension = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Contact information for the exposed API.
|
||||||
|
message Contact {
|
||||||
|
string name = 1;
|
||||||
|
string url = 2;
|
||||||
|
string email = 3;
|
||||||
|
repeated NamedAny specification_extension = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DefaultType {
|
||||||
|
oneof oneof {
|
||||||
|
double number = 1;
|
||||||
|
bool boolean = 2;
|
||||||
|
string string = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered.
|
||||||
|
message Discriminator {
|
||||||
|
string property_name = 1;
|
||||||
|
Strings mapping = 2;
|
||||||
|
repeated NamedAny specification_extension = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Document {
|
||||||
|
string openapi = 1;
|
||||||
|
Info info = 2;
|
||||||
|
repeated Server servers = 3;
|
||||||
|
Paths paths = 4;
|
||||||
|
Components components = 5;
|
||||||
|
repeated SecurityRequirement security = 6;
|
||||||
|
repeated Tag tags = 7;
|
||||||
|
ExternalDocs external_docs = 8;
|
||||||
|
repeated NamedAny specification_extension = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A single encoding definition applied to a single schema property.
|
||||||
|
message Encoding {
|
||||||
|
string content_type = 1;
|
||||||
|
HeadersOrReferences headers = 2;
|
||||||
|
string style = 3;
|
||||||
|
bool explode = 4;
|
||||||
|
bool allow_reserved = 5;
|
||||||
|
repeated NamedAny specification_extension = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Encodings {
|
||||||
|
repeated NamedEncoding additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Example {
|
||||||
|
string summary = 1;
|
||||||
|
string description = 2;
|
||||||
|
Any value = 3;
|
||||||
|
string external_value = 4;
|
||||||
|
repeated NamedAny specification_extension = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExampleOrReference {
|
||||||
|
oneof oneof {
|
||||||
|
Example example = 1;
|
||||||
|
Reference reference = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExamplesOrReferences {
|
||||||
|
repeated NamedExampleOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Expression {
|
||||||
|
repeated NamedAny additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allows referencing an external resource for extended documentation.
|
||||||
|
message ExternalDocs {
|
||||||
|
string description = 1;
|
||||||
|
string url = 2;
|
||||||
|
repeated NamedAny specification_extension = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).
|
||||||
|
message Header {
|
||||||
|
string description = 1;
|
||||||
|
bool required = 2;
|
||||||
|
bool deprecated = 3;
|
||||||
|
bool allow_empty_value = 4;
|
||||||
|
string style = 5;
|
||||||
|
bool explode = 6;
|
||||||
|
bool allow_reserved = 7;
|
||||||
|
SchemaOrReference schema = 8;
|
||||||
|
Any example = 9;
|
||||||
|
ExamplesOrReferences examples = 10;
|
||||||
|
MediaTypes content = 11;
|
||||||
|
repeated NamedAny specification_extension = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
message HeaderOrReference {
|
||||||
|
oneof oneof {
|
||||||
|
Header header = 1;
|
||||||
|
Reference reference = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message HeadersOrReferences {
|
||||||
|
repeated NamedHeaderOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
|
||||||
|
message Info {
|
||||||
|
string title = 1;
|
||||||
|
string description = 2;
|
||||||
|
string terms_of_service = 3;
|
||||||
|
Contact contact = 4;
|
||||||
|
License license = 5;
|
||||||
|
string version = 6;
|
||||||
|
repeated NamedAny specification_extension = 7;
|
||||||
|
string summary = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ItemsItem {
|
||||||
|
repeated SchemaOrReference schema_or_reference = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// License information for the exposed API.
|
||||||
|
message License {
|
||||||
|
string name = 1;
|
||||||
|
string url = 2;
|
||||||
|
repeated NamedAny specification_extension = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.
|
||||||
|
message Link {
|
||||||
|
string operation_ref = 1;
|
||||||
|
string operation_id = 2;
|
||||||
|
AnyOrExpression parameters = 3;
|
||||||
|
AnyOrExpression request_body = 4;
|
||||||
|
string description = 5;
|
||||||
|
Server server = 6;
|
||||||
|
repeated NamedAny specification_extension = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LinkOrReference {
|
||||||
|
oneof oneof {
|
||||||
|
Link link = 1;
|
||||||
|
Reference reference = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message LinksOrReferences {
|
||||||
|
repeated NamedLinkOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Each Media Type Object provides schema and examples for the media type identified by its key.
|
||||||
|
message MediaType {
|
||||||
|
SchemaOrReference schema = 1;
|
||||||
|
Any example = 2;
|
||||||
|
ExamplesOrReferences examples = 3;
|
||||||
|
Encodings encoding = 4;
|
||||||
|
repeated NamedAny specification_extension = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MediaTypes {
|
||||||
|
repeated NamedMediaType additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
|
||||||
|
message NamedAny {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
Any value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs.
|
||||||
|
message NamedCallbackOrReference {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
CallbackOrReference value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs.
|
||||||
|
message NamedEncoding {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
Encoding value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs.
|
||||||
|
message NamedExampleOrReference {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
ExampleOrReference value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs.
|
||||||
|
message NamedHeaderOrReference {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
HeaderOrReference value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs.
|
||||||
|
message NamedLinkOrReference {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
LinkOrReference value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs.
|
||||||
|
message NamedMediaType {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
MediaType value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs.
|
||||||
|
message NamedParameterOrReference {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
ParameterOrReference value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
|
||||||
|
message NamedPathItem {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
PathItem value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs.
|
||||||
|
message NamedRequestBodyOrReference {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
RequestBodyOrReference value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs.
|
||||||
|
message NamedResponseOrReference {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
ResponseOrReference value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs.
|
||||||
|
message NamedSchemaOrReference {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
SchemaOrReference value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs.
|
||||||
|
message NamedSecuritySchemeOrReference {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
SecuritySchemeOrReference value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs.
|
||||||
|
message NamedServerVariable {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
ServerVariable value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
|
||||||
|
message NamedString {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
string value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
|
||||||
|
message NamedStringArray {
|
||||||
|
// Map key
|
||||||
|
string name = 1;
|
||||||
|
// Mapped value
|
||||||
|
StringArray value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configuration details for a supported OAuth Flow
|
||||||
|
message OauthFlow {
|
||||||
|
string authorization_url = 1;
|
||||||
|
string token_url = 2;
|
||||||
|
string refresh_url = 3;
|
||||||
|
Strings scopes = 4;
|
||||||
|
repeated NamedAny specification_extension = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allows configuration of the supported OAuth Flows.
|
||||||
|
message OauthFlows {
|
||||||
|
OauthFlow implicit = 1;
|
||||||
|
OauthFlow password = 2;
|
||||||
|
OauthFlow client_credentials = 3;
|
||||||
|
OauthFlow authorization_code = 4;
|
||||||
|
repeated NamedAny specification_extension = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Object {
|
||||||
|
repeated NamedAny additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a single API operation on a path.
|
||||||
|
message Operation {
|
||||||
|
repeated string tags = 1;
|
||||||
|
string summary = 2;
|
||||||
|
string description = 3;
|
||||||
|
ExternalDocs external_docs = 4;
|
||||||
|
string operation_id = 5;
|
||||||
|
repeated ParameterOrReference parameters = 6;
|
||||||
|
RequestBodyOrReference request_body = 7;
|
||||||
|
Responses responses = 8;
|
||||||
|
CallbacksOrReferences callbacks = 9;
|
||||||
|
bool deprecated = 10;
|
||||||
|
repeated SecurityRequirement security = 11;
|
||||||
|
repeated Server servers = 12;
|
||||||
|
repeated NamedAny specification_extension = 13;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.
|
||||||
|
message Parameter {
|
||||||
|
string name = 1;
|
||||||
|
string in = 2;
|
||||||
|
string description = 3;
|
||||||
|
bool required = 4;
|
||||||
|
bool deprecated = 5;
|
||||||
|
bool allow_empty_value = 6;
|
||||||
|
string style = 7;
|
||||||
|
bool explode = 8;
|
||||||
|
bool allow_reserved = 9;
|
||||||
|
SchemaOrReference schema = 10;
|
||||||
|
Any example = 11;
|
||||||
|
ExamplesOrReferences examples = 12;
|
||||||
|
MediaTypes content = 13;
|
||||||
|
repeated NamedAny specification_extension = 14;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ParameterOrReference {
|
||||||
|
oneof oneof {
|
||||||
|
Parameter parameter = 1;
|
||||||
|
Reference reference = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ParametersOrReferences {
|
||||||
|
repeated NamedParameterOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
|
||||||
|
message PathItem {
|
||||||
|
string _ref = 1;
|
||||||
|
string summary = 2;
|
||||||
|
string description = 3;
|
||||||
|
Operation get = 4;
|
||||||
|
Operation put = 5;
|
||||||
|
Operation post = 6;
|
||||||
|
Operation delete = 7;
|
||||||
|
Operation options = 8;
|
||||||
|
Operation head = 9;
|
||||||
|
Operation patch = 10;
|
||||||
|
Operation trace = 11;
|
||||||
|
repeated Server servers = 12;
|
||||||
|
repeated ParameterOrReference parameters = 13;
|
||||||
|
repeated NamedAny specification_extension = 14;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.
|
||||||
|
message Paths {
|
||||||
|
repeated NamedPathItem path = 1;
|
||||||
|
repeated NamedAny specification_extension = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Properties {
|
||||||
|
repeated NamedSchemaOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.
|
||||||
|
message Reference {
|
||||||
|
string _ref = 1;
|
||||||
|
string summary = 2;
|
||||||
|
string description = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RequestBodiesOrReferences {
|
||||||
|
repeated NamedRequestBodyOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a single request body.
|
||||||
|
message RequestBody {
|
||||||
|
string description = 1;
|
||||||
|
MediaTypes content = 2;
|
||||||
|
bool required = 3;
|
||||||
|
repeated NamedAny specification_extension = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RequestBodyOrReference {
|
||||||
|
oneof oneof {
|
||||||
|
RequestBody request_body = 1;
|
||||||
|
Reference reference = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.
|
||||||
|
message Response {
|
||||||
|
string description = 1;
|
||||||
|
HeadersOrReferences headers = 2;
|
||||||
|
MediaTypes content = 3;
|
||||||
|
LinksOrReferences links = 4;
|
||||||
|
repeated NamedAny specification_extension = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ResponseOrReference {
|
||||||
|
oneof oneof {
|
||||||
|
Response response = 1;
|
||||||
|
Reference reference = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.
|
||||||
|
message Responses {
|
||||||
|
ResponseOrReference default = 1;
|
||||||
|
repeated NamedResponseOrReference response_or_reference = 2;
|
||||||
|
repeated NamedAny specification_extension = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ResponsesOrReferences {
|
||||||
|
repeated NamedResponseOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.
|
||||||
|
message Schema {
|
||||||
|
bool nullable = 1;
|
||||||
|
Discriminator discriminator = 2;
|
||||||
|
bool read_only = 3;
|
||||||
|
bool write_only = 4;
|
||||||
|
Xml xml = 5;
|
||||||
|
ExternalDocs external_docs = 6;
|
||||||
|
Any example = 7;
|
||||||
|
bool deprecated = 8;
|
||||||
|
string title = 9;
|
||||||
|
double multiple_of = 10;
|
||||||
|
double maximum = 11;
|
||||||
|
bool exclusive_maximum = 12;
|
||||||
|
double minimum = 13;
|
||||||
|
bool exclusive_minimum = 14;
|
||||||
|
int64 max_length = 15;
|
||||||
|
int64 min_length = 16;
|
||||||
|
string pattern = 17;
|
||||||
|
int64 max_items = 18;
|
||||||
|
int64 min_items = 19;
|
||||||
|
bool unique_items = 20;
|
||||||
|
int64 max_properties = 21;
|
||||||
|
int64 min_properties = 22;
|
||||||
|
repeated string required = 23;
|
||||||
|
repeated Any enum = 24;
|
||||||
|
string type = 25;
|
||||||
|
repeated SchemaOrReference all_of = 26;
|
||||||
|
repeated SchemaOrReference one_of = 27;
|
||||||
|
repeated SchemaOrReference any_of = 28;
|
||||||
|
Schema not = 29;
|
||||||
|
ItemsItem items = 30;
|
||||||
|
Properties properties = 31;
|
||||||
|
AdditionalPropertiesItem additional_properties = 32;
|
||||||
|
DefaultType default = 33;
|
||||||
|
string description = 34;
|
||||||
|
string format = 35;
|
||||||
|
repeated NamedAny specification_extension = 36;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SchemaOrReference {
|
||||||
|
oneof oneof {
|
||||||
|
Schema schema = 1;
|
||||||
|
Reference reference = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message SchemasOrReferences {
|
||||||
|
repeated NamedSchemaOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
|
||||||
|
message SecurityRequirement {
|
||||||
|
repeated NamedStringArray additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE.
|
||||||
|
message SecurityScheme {
|
||||||
|
string type = 1;
|
||||||
|
string description = 2;
|
||||||
|
string name = 3;
|
||||||
|
string in = 4;
|
||||||
|
string scheme = 5;
|
||||||
|
string bearer_format = 6;
|
||||||
|
OauthFlows flows = 7;
|
||||||
|
string open_id_connect_url = 8;
|
||||||
|
repeated NamedAny specification_extension = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SecuritySchemeOrReference {
|
||||||
|
oneof oneof {
|
||||||
|
SecurityScheme security_scheme = 1;
|
||||||
|
Reference reference = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message SecuritySchemesOrReferences {
|
||||||
|
repeated NamedSecuritySchemeOrReference additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// An object representing a Server.
|
||||||
|
message Server {
|
||||||
|
string url = 1;
|
||||||
|
string description = 2;
|
||||||
|
ServerVariables variables = 3;
|
||||||
|
repeated NamedAny specification_extension = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// An object representing a Server Variable for server URL template substitution.
|
||||||
|
message ServerVariable {
|
||||||
|
repeated string enum = 1;
|
||||||
|
string default = 2;
|
||||||
|
string description = 3;
|
||||||
|
repeated NamedAny specification_extension = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ServerVariables {
|
||||||
|
repeated NamedServerVariable additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Any property starting with x- is valid.
|
||||||
|
message SpecificationExtension {
|
||||||
|
oneof oneof {
|
||||||
|
double number = 1;
|
||||||
|
bool boolean = 2;
|
||||||
|
string string = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message StringArray {
|
||||||
|
repeated string value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Strings {
|
||||||
|
repeated NamedString additional_properties = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
|
||||||
|
message Tag {
|
||||||
|
string name = 1;
|
||||||
|
string description = 2;
|
||||||
|
ExternalDocs external_docs = 3;
|
||||||
|
repeated NamedAny specification_extension = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.
|
||||||
|
message Xml {
|
||||||
|
string name = 1;
|
||||||
|
string namespace = 2;
|
||||||
|
string prefix = 3;
|
||||||
|
bool attribute = 4;
|
||||||
|
bool wrapped = 5;
|
||||||
|
repeated NamedAny specification_extension = 6;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
|||||||
|
# protoc-gen-validate (PGV)
|
||||||
|
|
||||||
|
* https://github.com/envoyproxy/protoc-gen-validate
|
@ -0,0 +1,863 @@
|
|||||||
|
syntax = "proto2";
|
||||||
|
package validate;
|
||||||
|
|
||||||
|
option go_package = "github.com/envoyproxy/protoc-gen-validate/validate";
|
||||||
|
option java_package = "io.envoyproxy.pgv.validate";
|
||||||
|
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
import "google/protobuf/duration.proto";
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
|
// Validation rules applied at the message level
|
||||||
|
extend google.protobuf.MessageOptions {
|
||||||
|
// Disabled nullifies any validation rules for this message, including any
|
||||||
|
// message fields associated with it that do support validation.
|
||||||
|
optional bool disabled = 1071;
|
||||||
|
// Ignore skips generation of validation methods for this message.
|
||||||
|
optional bool ignored = 1072;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validation rules applied at the oneof level
|
||||||
|
extend google.protobuf.OneofOptions {
|
||||||
|
// Required ensures that exactly one the field options in a oneof is set;
|
||||||
|
// validation fails if no fields in the oneof are set.
|
||||||
|
optional bool required = 1071;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validation rules applied at the field level
|
||||||
|
extend google.protobuf.FieldOptions {
|
||||||
|
// Rules specify the validations to be performed on this field. By default,
|
||||||
|
// no validation is performed against a field.
|
||||||
|
optional FieldRules rules = 1071;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FieldRules encapsulates the rules for each type of field. Depending on the
|
||||||
|
// field, the correct set should be used to ensure proper validations.
|
||||||
|
message FieldRules {
|
||||||
|
optional MessageRules message = 17;
|
||||||
|
oneof type {
|
||||||
|
// Scalar Field Types
|
||||||
|
FloatRules float = 1;
|
||||||
|
DoubleRules double = 2;
|
||||||
|
Int32Rules int32 = 3;
|
||||||
|
Int64Rules int64 = 4;
|
||||||
|
UInt32Rules uint32 = 5;
|
||||||
|
UInt64Rules uint64 = 6;
|
||||||
|
SInt32Rules sint32 = 7;
|
||||||
|
SInt64Rules sint64 = 8;
|
||||||
|
Fixed32Rules fixed32 = 9;
|
||||||
|
Fixed64Rules fixed64 = 10;
|
||||||
|
SFixed32Rules sfixed32 = 11;
|
||||||
|
SFixed64Rules sfixed64 = 12;
|
||||||
|
BoolRules bool = 13;
|
||||||
|
StringRules string = 14;
|
||||||
|
BytesRules bytes = 15;
|
||||||
|
|
||||||
|
// Complex Field Types
|
||||||
|
EnumRules enum = 16;
|
||||||
|
RepeatedRules repeated = 18;
|
||||||
|
MapRules map = 19;
|
||||||
|
|
||||||
|
// Well-Known Field Types
|
||||||
|
AnyRules any = 20;
|
||||||
|
DurationRules duration = 21;
|
||||||
|
TimestampRules timestamp = 22;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FloatRules describes the constraints applied to `float` values
|
||||||
|
message FloatRules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional float const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional float lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional float lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional float gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional float gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated float in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated float not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DoubleRules describes the constraints applied to `double` values
|
||||||
|
message DoubleRules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional double const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional double lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional double lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional double gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional double gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated double in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated double not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int32Rules describes the constraints applied to `int32` values
|
||||||
|
message Int32Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional int32 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional int32 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional int32 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional int32 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional int32 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated int32 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated int32 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int64Rules describes the constraints applied to `int64` values
|
||||||
|
message Int64Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional int64 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional int64 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional int64 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional int64 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional int64 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated int64 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated int64 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UInt32Rules describes the constraints applied to `uint32` values
|
||||||
|
message UInt32Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional uint32 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional uint32 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional uint32 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional uint32 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional uint32 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated uint32 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated uint32 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UInt64Rules describes the constraints applied to `uint64` values
|
||||||
|
message UInt64Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional uint64 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional uint64 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional uint64 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional uint64 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional uint64 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated uint64 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated uint64 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SInt32Rules describes the constraints applied to `sint32` values
|
||||||
|
message SInt32Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional sint32 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional sint32 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional sint32 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional sint32 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional sint32 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated sint32 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated sint32 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SInt64Rules describes the constraints applied to `sint64` values
|
||||||
|
message SInt64Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional sint64 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional sint64 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional sint64 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional sint64 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional sint64 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated sint64 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated sint64 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fixed32Rules describes the constraints applied to `fixed32` values
|
||||||
|
message Fixed32Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional fixed32 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional fixed32 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional fixed32 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional fixed32 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional fixed32 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated fixed32 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated fixed32 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fixed64Rules describes the constraints applied to `fixed64` values
|
||||||
|
message Fixed64Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional fixed64 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional fixed64 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional fixed64 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional fixed64 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional fixed64 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated fixed64 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated fixed64 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SFixed32Rules describes the constraints applied to `sfixed32` values
|
||||||
|
message SFixed32Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional sfixed32 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional sfixed32 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional sfixed32 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional sfixed32 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional sfixed32 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated sfixed32 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated sfixed32 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SFixed64Rules describes the constraints applied to `sfixed64` values
|
||||||
|
message SFixed64Rules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional sfixed64 const = 1;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional sfixed64 lt = 2;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than or equal to the
|
||||||
|
// specified value, inclusive
|
||||||
|
optional sfixed64 lte = 3;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive. If the value of Gt is larger than a specified Lt or Lte, the
|
||||||
|
// range is reversed.
|
||||||
|
optional sfixed64 gt = 4;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than or equal to the
|
||||||
|
// specified value, inclusive. If the value of Gte is larger than a
|
||||||
|
// specified Lt or Lte, the range is reversed.
|
||||||
|
optional sfixed64 gte = 5;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated sfixed64 in = 6;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated sfixed64 not_in = 7;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BoolRules describes the constraints applied to `bool` values
|
||||||
|
message BoolRules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional bool const = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// StringRules describe the constraints applied to `string` values
|
||||||
|
message StringRules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional string const = 1;
|
||||||
|
|
||||||
|
// Len specifies that this field must be the specified number of
|
||||||
|
// characters (Unicode code points). Note that the number of
|
||||||
|
// characters may differ from the number of bytes in the string.
|
||||||
|
optional uint64 len = 19;
|
||||||
|
|
||||||
|
// MinLen specifies that this field must be the specified number of
|
||||||
|
// characters (Unicode code points) at a minimum. Note that the number of
|
||||||
|
// characters may differ from the number of bytes in the string.
|
||||||
|
optional uint64 min_len = 2;
|
||||||
|
|
||||||
|
// MaxLen specifies that this field must be the specified number of
|
||||||
|
// characters (Unicode code points) at a maximum. Note that the number of
|
||||||
|
// characters may differ from the number of bytes in the string.
|
||||||
|
optional uint64 max_len = 3;
|
||||||
|
|
||||||
|
// LenBytes specifies that this field must be the specified number of bytes
|
||||||
|
// at a minimum
|
||||||
|
optional uint64 len_bytes = 20;
|
||||||
|
|
||||||
|
// MinBytes specifies that this field must be the specified number of bytes
|
||||||
|
// at a minimum
|
||||||
|
optional uint64 min_bytes = 4;
|
||||||
|
|
||||||
|
// MaxBytes specifies that this field must be the specified number of bytes
|
||||||
|
// at a maximum
|
||||||
|
optional uint64 max_bytes = 5;
|
||||||
|
|
||||||
|
// Pattern specifes that this field must match against the specified
|
||||||
|
// regular expression (RE2 syntax). The included expression should elide
|
||||||
|
// any delimiters.
|
||||||
|
optional string pattern = 6;
|
||||||
|
|
||||||
|
// Prefix specifies that this field must have the specified substring at
|
||||||
|
// the beginning of the string.
|
||||||
|
optional string prefix = 7;
|
||||||
|
|
||||||
|
// Suffix specifies that this field must have the specified substring at
|
||||||
|
// the end of the string.
|
||||||
|
optional string suffix = 8;
|
||||||
|
|
||||||
|
// Contains specifies that this field must have the specified substring
|
||||||
|
// anywhere in the string.
|
||||||
|
optional string contains = 9;
|
||||||
|
|
||||||
|
// NotContains specifies that this field cannot have the specified substring
|
||||||
|
// anywhere in the string.
|
||||||
|
optional string not_contains = 23;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated string in = 10;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated string not_in = 11;
|
||||||
|
|
||||||
|
// WellKnown rules provide advanced constraints against common string
|
||||||
|
// patterns
|
||||||
|
oneof well_known {
|
||||||
|
// Email specifies that the field must be a valid email address as
|
||||||
|
// defined by RFC 5322
|
||||||
|
bool email = 12;
|
||||||
|
|
||||||
|
// Hostname specifies that the field must be a valid hostname as
|
||||||
|
// defined by RFC 1034. This constraint does not support
|
||||||
|
// internationalized domain names (IDNs).
|
||||||
|
bool hostname = 13;
|
||||||
|
|
||||||
|
// Ip specifies that the field must be a valid IP (v4 or v6) address.
|
||||||
|
// Valid IPv6 addresses should not include surrounding square brackets.
|
||||||
|
bool ip = 14;
|
||||||
|
|
||||||
|
// Ipv4 specifies that the field must be a valid IPv4 address.
|
||||||
|
bool ipv4 = 15;
|
||||||
|
|
||||||
|
// Ipv6 specifies that the field must be a valid IPv6 address. Valid
|
||||||
|
// IPv6 addresses should not include surrounding square brackets.
|
||||||
|
bool ipv6 = 16;
|
||||||
|
|
||||||
|
// Uri specifies that the field must be a valid, absolute URI as defined
|
||||||
|
// by RFC 3986
|
||||||
|
bool uri = 17;
|
||||||
|
|
||||||
|
// UriRef specifies that the field must be a valid URI as defined by RFC
|
||||||
|
// 3986 and may be relative or absolute.
|
||||||
|
bool uri_ref = 18;
|
||||||
|
|
||||||
|
// Address specifies that the field must be either a valid hostname as
|
||||||
|
// defined by RFC 1034 (which does not support internationalized domain
|
||||||
|
// names or IDNs), or it can be a valid IP (v4 or v6).
|
||||||
|
bool address = 21;
|
||||||
|
|
||||||
|
// Uuid specifies that the field must be a valid UUID as defined by
|
||||||
|
// RFC 4122
|
||||||
|
bool uuid = 22;
|
||||||
|
|
||||||
|
// WellKnownRegex specifies a common well known pattern defined as a regex.
|
||||||
|
KnownRegex well_known_regex = 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This applies to regexes HTTP_HEADER_NAME and HTTP_HEADER_VALUE to enable
|
||||||
|
// strict header validation.
|
||||||
|
// By default, this is true, and HTTP header validations are RFC-compliant.
|
||||||
|
// Setting to false will enable a looser validations that only disallows
|
||||||
|
// \r\n\0 characters, which can be used to bypass header matching rules.
|
||||||
|
optional bool strict = 25 [default = true];
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 26;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WellKnownRegex contain some well-known patterns.
|
||||||
|
enum KnownRegex {
|
||||||
|
UNKNOWN = 0;
|
||||||
|
|
||||||
|
// HTTP header name as defined by RFC 7230.
|
||||||
|
HTTP_HEADER_NAME = 1;
|
||||||
|
|
||||||
|
// HTTP header value as defined by RFC 7230.
|
||||||
|
HTTP_HEADER_VALUE = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BytesRules describe the constraints applied to `bytes` values
|
||||||
|
message BytesRules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional bytes const = 1;
|
||||||
|
|
||||||
|
// Len specifies that this field must be the specified number of bytes
|
||||||
|
optional uint64 len = 13;
|
||||||
|
|
||||||
|
// MinLen specifies that this field must be the specified number of bytes
|
||||||
|
// at a minimum
|
||||||
|
optional uint64 min_len = 2;
|
||||||
|
|
||||||
|
// MaxLen specifies that this field must be the specified number of bytes
|
||||||
|
// at a maximum
|
||||||
|
optional uint64 max_len = 3;
|
||||||
|
|
||||||
|
// Pattern specifes that this field must match against the specified
|
||||||
|
// regular expression (RE2 syntax). The included expression should elide
|
||||||
|
// any delimiters.
|
||||||
|
optional string pattern = 4;
|
||||||
|
|
||||||
|
// Prefix specifies that this field must have the specified bytes at the
|
||||||
|
// beginning of the string.
|
||||||
|
optional bytes prefix = 5;
|
||||||
|
|
||||||
|
// Suffix specifies that this field must have the specified bytes at the
|
||||||
|
// end of the string.
|
||||||
|
optional bytes suffix = 6;
|
||||||
|
|
||||||
|
// Contains specifies that this field must have the specified bytes
|
||||||
|
// anywhere in the string.
|
||||||
|
optional bytes contains = 7;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated bytes in = 8;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated bytes not_in = 9;
|
||||||
|
|
||||||
|
// WellKnown rules provide advanced constraints against common byte
|
||||||
|
// patterns
|
||||||
|
oneof well_known {
|
||||||
|
// Ip specifies that the field must be a valid IP (v4 or v6) address in
|
||||||
|
// byte format
|
||||||
|
bool ip = 10;
|
||||||
|
|
||||||
|
// Ipv4 specifies that the field must be a valid IPv4 address in byte
|
||||||
|
// format
|
||||||
|
bool ipv4 = 11;
|
||||||
|
|
||||||
|
// Ipv6 specifies that the field must be a valid IPv6 address in byte
|
||||||
|
// format
|
||||||
|
bool ipv6 = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 14;
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnumRules describe the constraints applied to enum values
|
||||||
|
message EnumRules {
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional int32 const = 1;
|
||||||
|
|
||||||
|
// DefinedOnly specifies that this field must be only one of the defined
|
||||||
|
// values for this enum, failing on any undefined value.
|
||||||
|
optional bool defined_only = 2;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated int32 in = 3;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated int32 not_in = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// MessageRules describe the constraints applied to embedded message values.
|
||||||
|
// For message-type fields, validation is performed recursively.
|
||||||
|
message MessageRules {
|
||||||
|
// Skip specifies that the validation rules of this field should not be
|
||||||
|
// evaluated
|
||||||
|
optional bool skip = 1;
|
||||||
|
|
||||||
|
// Required specifies that this field must be set
|
||||||
|
optional bool required = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// RepeatedRules describe the constraints applied to `repeated` values
|
||||||
|
message RepeatedRules {
|
||||||
|
// MinItems specifies that this field must have the specified number of
|
||||||
|
// items at a minimum
|
||||||
|
optional uint64 min_items = 1;
|
||||||
|
|
||||||
|
// MaxItems specifies that this field must have the specified number of
|
||||||
|
// items at a maximum
|
||||||
|
optional uint64 max_items = 2;
|
||||||
|
|
||||||
|
// Unique specifies that all elements in this field must be unique. This
|
||||||
|
// contraint is only applicable to scalar and enum types (messages are not
|
||||||
|
// supported).
|
||||||
|
optional bool unique = 3;
|
||||||
|
|
||||||
|
// Items specifies the contraints to be applied to each item in the field.
|
||||||
|
// Repeated message fields will still execute validation against each item
|
||||||
|
// unless skip is specified here.
|
||||||
|
optional FieldRules items = 4;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapRules describe the constraints applied to `map` values
|
||||||
|
message MapRules {
|
||||||
|
// MinPairs specifies that this field must have the specified number of
|
||||||
|
// KVs at a minimum
|
||||||
|
optional uint64 min_pairs = 1;
|
||||||
|
|
||||||
|
// MaxPairs specifies that this field must have the specified number of
|
||||||
|
// KVs at a maximum
|
||||||
|
optional uint64 max_pairs = 2;
|
||||||
|
|
||||||
|
// NoSparse specifies values in this field cannot be unset. This only
|
||||||
|
// applies to map's with message value types.
|
||||||
|
optional bool no_sparse = 3;
|
||||||
|
|
||||||
|
// Keys specifies the constraints to be applied to each key in the field.
|
||||||
|
optional FieldRules keys = 4;
|
||||||
|
|
||||||
|
// Values specifies the constraints to be applied to the value of each key
|
||||||
|
// in the field. Message values will still have their validations evaluated
|
||||||
|
// unless skip is specified here.
|
||||||
|
optional FieldRules values = 5;
|
||||||
|
|
||||||
|
// IgnoreEmpty specifies that the validation rules of this field should be
|
||||||
|
// evaluated only if the field is not empty
|
||||||
|
optional bool ignore_empty = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnyRules describe constraints applied exclusively to the
|
||||||
|
// `google.protobuf.Any` well-known type
|
||||||
|
message AnyRules {
|
||||||
|
// Required specifies that this field must be set
|
||||||
|
optional bool required = 1;
|
||||||
|
|
||||||
|
// In specifies that this field's `type_url` must be equal to one of the
|
||||||
|
// specified values.
|
||||||
|
repeated string in = 2;
|
||||||
|
|
||||||
|
// NotIn specifies that this field's `type_url` must not be equal to any of
|
||||||
|
// the specified values.
|
||||||
|
repeated string not_in = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DurationRules describe the constraints applied exclusively to the
|
||||||
|
// `google.protobuf.Duration` well-known type
|
||||||
|
message DurationRules {
|
||||||
|
// Required specifies that this field must be set
|
||||||
|
optional bool required = 1;
|
||||||
|
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional google.protobuf.Duration const = 2;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional google.protobuf.Duration lt = 3;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// inclusive
|
||||||
|
optional google.protobuf.Duration lte = 4;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional google.protobuf.Duration gt = 5;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than the specified value,
|
||||||
|
// inclusive
|
||||||
|
optional google.protobuf.Duration gte = 6;
|
||||||
|
|
||||||
|
// In specifies that this field must be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated google.protobuf.Duration in = 7;
|
||||||
|
|
||||||
|
// NotIn specifies that this field cannot be equal to one of the specified
|
||||||
|
// values
|
||||||
|
repeated google.protobuf.Duration not_in = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimestampRules describe the constraints applied exclusively to the
|
||||||
|
// `google.protobuf.Timestamp` well-known type
|
||||||
|
message TimestampRules {
|
||||||
|
// Required specifies that this field must be set
|
||||||
|
optional bool required = 1;
|
||||||
|
|
||||||
|
// Const specifies that this field must be exactly the specified value
|
||||||
|
optional google.protobuf.Timestamp const = 2;
|
||||||
|
|
||||||
|
// Lt specifies that this field must be less than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional google.protobuf.Timestamp lt = 3;
|
||||||
|
|
||||||
|
// Lte specifies that this field must be less than the specified value,
|
||||||
|
// inclusive
|
||||||
|
optional google.protobuf.Timestamp lte = 4;
|
||||||
|
|
||||||
|
// Gt specifies that this field must be greater than the specified value,
|
||||||
|
// exclusive
|
||||||
|
optional google.protobuf.Timestamp gt = 5;
|
||||||
|
|
||||||
|
// Gte specifies that this field must be greater than the specified value,
|
||||||
|
// inclusive
|
||||||
|
optional google.protobuf.Timestamp gte = 6;
|
||||||
|
|
||||||
|
// LtNow specifies that this must be less than the current time. LtNow
|
||||||
|
// can only be used with the Within rule.
|
||||||
|
optional bool lt_now = 7;
|
||||||
|
|
||||||
|
// GtNow specifies that this must be greater than the current time. GtNow
|
||||||
|
// can only be used with the Within rule.
|
||||||
|
optional bool gt_now = 8;
|
||||||
|
|
||||||
|
// Within specifies that this field must be within this duration of the
|
||||||
|
// current time. This constraint can be used alone or with the LtNow and
|
||||||
|
// GtNow rules.
|
||||||
|
optional google.protobuf.Duration within = 9;
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue