Generate JSON and Binary Marshalers for Protobuf Types (#6564)

* Add JSON and Binary Marshaler Generators for Protobuf Types

* Generate files with the correct version of gogo/protobuf

I have pinned the version in the makefile so when you run make tools you get the right version. This pulls the version out of go.mod so it should remain up to date.

The version at the time of this commit we are using is v1.2.1

* Fixup some shell output

* Update how we determine the version of gogo
This just greps the go.mod file instead of expecting the go mod cache to already be present

* Fixup vendoring and remove no longer needed json encoder functions
This commit is contained in:
Matt Keeler 2019-09-30 15:39:20 -04:00 committed by GitHub
parent 338812f5c2
commit cfa879d63c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 2424 additions and 217 deletions

View File

@ -1,11 +1,14 @@
SHELL = bash
GOGOVERSION?=$(shell grep github.com/gogo/protobuf go.mod | awk '{print $$2}')
GOTOOLS = \
github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs \
github.com/hashicorp/go-bindata/go-bindata \
github.com/mitchellh/gox \
golang.org/x/tools/cmd/cover \
golang.org/x/tools/cmd/stringer \
github.com/gogo/protobuf/protoc-gen-gofast \
github.com/gogo/protobuf/protoc-gen-gofast@$(GOGOVERSION) \
github.com/mitchellh/protoc-gen-go-json \
github.com/hashicorp/protoc-gen-go-binary \
github.com/vektra/mockery/cmd/mockery
GOTAGS ?=
@ -31,6 +34,8 @@ GOLDFLAGS=-X $(GIT_IMPORT).GitCommit=$(GIT_COMMIT)$(GIT_DIRTY) -X $(GIT_IMPORT).
PROTOFILES?=$(shell find . -name '*.proto' | grep -v 'vendor/')
PROTOGOFILES=$(PROTOFILES:.proto=.pb.go)
PROTOGOBINFILES=$(PROTOFILES:.proto=.pb.binary.go)
PROTOGOJSONFILES=$(PROTOFILES:.proto=.pb.json.go)
ifeq ($(FORCE_REBUILD),1)
NOCACHE=--no-cache
@ -330,7 +335,7 @@ static-assets:
ui: ui-docker static-assets-docker
tools:
go get -u -v $(GOTOOLS)
go get -v $(GOTOOLS)
version:
@echo -n "Version: "
@ -368,14 +373,19 @@ test-envoy-integ: $(ENVOY_INTEG_DEPS)
proto-go-delete:
@echo "Removing $(PROTOGOFILES)"
-@rm $(PROTOGOFILES)
@echo "Removing $(PROTOGOBINFILES)"
-@rm $(PROTOGOBINFILES)
@echo "Removing $(PROTOGOJSONFILES)"
-@rm $(PROTOGOJSONFILES)
proto-rebuild: proto-go-delete proto
proto: $(PROTOGOFILES)
proto: $(PROTOGOFILES) $(PROTOGOBINFILES) $(PROTOGOJSONFILES)
@echo "Generated all protobuf Go files"
%.pb.go: %.proto
@$(SHELL) $(CURDIR)/build-support/scripts/proto-gen.sh --grpc --import-replace --generator gogo "$<"
%.pb.go %.pb.json.go %.pb.binary.go: %.proto
@$(SHELL) $(CURDIR)/build-support/scripts/proto-gen.sh --grpc --import-replace "$<"
.PHONY: all ci bin dev dist cov test test-ci test-internal test-install-deps cover format vet ui static-assets tools

View File

@ -0,0 +1,18 @@
// Code generated by protoc-gen-go-binary. DO NOT EDIT.
// source: acl.proto
package agentpb
import (
"github.com/golang/protobuf/proto"
)
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *ACLLink) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *ACLLink) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}

View File

@ -0,0 +1,26 @@
// Code generated by protoc-gen-go-json. DO NOT EDIT.
// source: acl.proto
package agentpb
import (
"bytes"
"github.com/golang/protobuf/jsonpb"
)
// MarshalJSON implements json.Marshaler
func (msg *ACLLink) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *ACLLink) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}

View File

@ -0,0 +1,58 @@
// Code generated by protoc-gen-go-binary. DO NOT EDIT.
// source: common.proto
package agentpb
import (
"github.com/golang/protobuf/proto"
)
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *RaftIndex) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *RaftIndex) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *TargetDatacenter) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *TargetDatacenter) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *WriteRequest) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *WriteRequest) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *QueryOptions) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *QueryOptions) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *QueryMeta) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *QueryMeta) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}

View File

@ -11,7 +11,6 @@ import (
proto "github.com/golang/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
time "time"
)
@ -25,7 +24,7 @@ var _ = time.Kitchen
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// RaftIndex is used to track the index used while creating
// or modifying a given struct type.
@ -48,7 +47,7 @@ func (m *RaftIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RaftIndex.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
@ -87,7 +86,7 @@ func (m *TargetDatacenter) XXX_Marshal(b []byte, deterministic bool) ([]byte, er
return xxx_messageInfo_TargetDatacenter.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
@ -126,7 +125,7 @@ func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_WriteRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
@ -219,7 +218,7 @@ func (m *QueryOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return xxx_messageInfo_QueryOptions.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
@ -346,7 +345,7 @@ func (m *QueryMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_QueryMeta.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
@ -444,7 +443,7 @@ var fileDescriptor_555bd8c177793206 = []byte{
func (m *RaftIndex) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
@ -452,32 +451,27 @@ func (m *RaftIndex) Marshal() (dAtA []byte, err error) {
}
func (m *RaftIndex) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *RaftIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
var i int
_ = i
var l int
_ = l
if m.ModifyIndex != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.ModifyIndex))
i--
dAtA[i] = 0x10
}
if m.CreateIndex != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.CreateIndex))
i--
dAtA[i] = 0x8
i++
i = encodeVarintCommon(dAtA, i, uint64(m.CreateIndex))
}
return len(dAtA) - i, nil
if m.ModifyIndex != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintCommon(dAtA, i, uint64(m.ModifyIndex))
}
return i, nil
}
func (m *TargetDatacenter) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
@ -485,29 +479,23 @@ func (m *TargetDatacenter) Marshal() (dAtA []byte, err error) {
}
func (m *TargetDatacenter) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *TargetDatacenter) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
var i int
_ = i
var l int
_ = l
if len(m.Datacenter) > 0 {
i -= len(m.Datacenter)
copy(dAtA[i:], m.Datacenter)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Datacenter)))
i--
dAtA[i] = 0xa
i++
i = encodeVarintCommon(dAtA, i, uint64(len(m.Datacenter)))
i += copy(dAtA[i:], m.Datacenter)
}
return len(dAtA) - i, nil
return i, nil
}
func (m *WriteRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
@ -515,29 +503,23 @@ func (m *WriteRequest) Marshal() (dAtA []byte, err error) {
}
func (m *WriteRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
var i int
_ = i
var l int
_ = l
if len(m.Token) > 0 {
i -= len(m.Token)
copy(dAtA[i:], m.Token)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token)))
i--
dAtA[i] = 0xa
i++
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token)))
i += copy(dAtA[i:], m.Token)
}
return len(dAtA) - i, nil
return i, nil
}
func (m *QueryOptions) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
@ -545,113 +527,106 @@ func (m *QueryOptions) Marshal() (dAtA []byte, err error) {
}
func (m *QueryOptions) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
var i int
_ = i
var l int
_ = l
if len(m.Filter) > 0 {
i -= len(m.Filter)
copy(dAtA[i:], m.Filter)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Filter)))
i--
dAtA[i] = 0x5a
}
n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.StaleIfError, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.StaleIfError):])
if err1 != nil {
return 0, err1
}
i -= n1
i = encodeVarintCommon(dAtA, i, uint64(n1))
i--
dAtA[i] = 0x52
if m.MustRevalidate {
i--
if m.MustRevalidate {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x48
}
n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAge, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAge):])
if err2 != nil {
return 0, err2
}
i -= n2
i = encodeVarintCommon(dAtA, i, uint64(n2))
i--
dAtA[i] = 0x42
n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxStaleDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxStaleDuration):])
if err3 != nil {
return 0, err3
}
i -= n3
i = encodeVarintCommon(dAtA, i, uint64(n3))
i--
dAtA[i] = 0x3a
if m.UseCache {
i--
if m.UseCache {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x30
}
if m.RequireConsistent {
i--
if m.RequireConsistent {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x28
}
if m.AllowStale {
i--
if m.AllowStale {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxQueryTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxQueryTime):])
if err4 != nil {
return 0, err4
}
i -= n4
i = encodeVarintCommon(dAtA, i, uint64(n4))
i--
dAtA[i] = 0x1a
if m.MinQueryIndex != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.MinQueryIndex))
i--
dAtA[i] = 0x10
}
if len(m.Token) > 0 {
i -= len(m.Token)
copy(dAtA[i:], m.Token)
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token)))
i--
dAtA[i] = 0xa
i++
i = encodeVarintCommon(dAtA, i, uint64(len(m.Token)))
i += copy(dAtA[i:], m.Token)
}
return len(dAtA) - i, nil
if m.MinQueryIndex != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintCommon(dAtA, i, uint64(m.MinQueryIndex))
}
dAtA[i] = 0x1a
i++
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxQueryTime)))
n1, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxQueryTime, dAtA[i:])
if err != nil {
return 0, err
}
i += n1
if m.AllowStale {
dAtA[i] = 0x20
i++
if m.AllowStale {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
if m.RequireConsistent {
dAtA[i] = 0x28
i++
if m.RequireConsistent {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
if m.UseCache {
dAtA[i] = 0x30
i++
if m.UseCache {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
dAtA[i] = 0x3a
i++
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxStaleDuration)))
n2, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxStaleDuration, dAtA[i:])
if err != nil {
return 0, err
}
i += n2
dAtA[i] = 0x42
i++
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAge)))
n3, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAge, dAtA[i:])
if err != nil {
return 0, err
}
i += n3
if m.MustRevalidate {
dAtA[i] = 0x48
i++
if m.MustRevalidate {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
dAtA[i] = 0x52
i++
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.StaleIfError)))
n4, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.StaleIfError, dAtA[i:])
if err != nil {
return 0, err
}
i += n4
if len(m.Filter) > 0 {
dAtA[i] = 0x5a
i++
i = encodeVarintCommon(dAtA, i, uint64(len(m.Filter)))
i += copy(dAtA[i:], m.Filter)
}
return i, nil
}
func (m *QueryMeta) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
@ -659,58 +634,50 @@ func (m *QueryMeta) Marshal() (dAtA []byte, err error) {
}
func (m *QueryMeta) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
var i int
_ = i
var l int
_ = l
if len(m.ConsistencyLevel) > 0 {
i -= len(m.ConsistencyLevel)
copy(dAtA[i:], m.ConsistencyLevel)
i = encodeVarintCommon(dAtA, i, uint64(len(m.ConsistencyLevel)))
i--
dAtA[i] = 0x22
if m.Index != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintCommon(dAtA, i, uint64(m.Index))
}
dAtA[i] = 0x12
i++
i = encodeVarintCommon(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdDuration(m.LastContact)))
n5, err := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LastContact, dAtA[i:])
if err != nil {
return 0, err
}
i += n5
if m.KnownLeader {
i--
dAtA[i] = 0x18
i++
if m.KnownLeader {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
i++
}
n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.LastContact, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.LastContact):])
if err5 != nil {
return 0, err5
if len(m.ConsistencyLevel) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintCommon(dAtA, i, uint64(len(m.ConsistencyLevel)))
i += copy(dAtA[i:], m.ConsistencyLevel)
}
i -= n5
i = encodeVarintCommon(dAtA, i, uint64(n5))
i--
dAtA[i] = 0x12
if m.Index != 0 {
i = encodeVarintCommon(dAtA, i, uint64(m.Index))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
return i, nil
}
func encodeVarintCommon(dAtA []byte, offset int, v uint64) int {
offset -= sovCommon(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
return offset + 1
}
func (m *RaftIndex) Size() (n int) {
if m == nil {
@ -815,7 +782,14 @@ func (m *QueryMeta) Size() (n int) {
}
func sovCommon(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozCommon(x uint64) (n int) {
return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63))))

View File

@ -0,0 +1,90 @@
// Code generated by protoc-gen-go-json. DO NOT EDIT.
// source: common.proto
package agentpb
import (
"bytes"
"github.com/golang/protobuf/jsonpb"
)
// MarshalJSON implements json.Marshaler
func (msg *RaftIndex) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *RaftIndex) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *TargetDatacenter) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *TargetDatacenter) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *WriteRequest) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *WriteRequest) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *QueryOptions) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *QueryOptions) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *QueryMeta) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *QueryMeta) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}

View File

@ -1,12 +1,8 @@
package agentpb
import (
"bytes"
"fmt"
"io"
"github.com/gogo/protobuf/jsonpb"
"github.com/gogo/protobuf/proto"
"github.com/hashicorp/consul/agent/structs"
)
@ -37,27 +33,3 @@ func Decode(buf []byte, out ProtoMarshaller) error {
// Note that this assumes the leading byte indicating the type has already been stripped off
return out.Unmarshal(buf)
}
func MarshalJSON(msg proto.Message) ([]byte, error) {
m := jsonpb.Marshaler{
EmitDefaults: false,
}
var buf bytes.Buffer
if err := m.Marshal(&buf, msg); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func UnmarshalJSON(r io.Reader, msg proto.Message) error {
u := jsonpb.Unmarshaler{
AllowUnknownFields: true,
}
return u.Unmarshal(r, msg)
}
func UnmarshalJSONBytes(b []byte, msg proto.Message) error {
return UnmarshalJSON(bytes.NewReader(b), msg)
}

View File

@ -0,0 +1,138 @@
// Code generated by protoc-gen-go-binary. DO NOT EDIT.
// source: provider.proto
package plugin
import (
"github.com/golang/protobuf/proto"
)
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *ConfigureRequest) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *ConfigureRequest) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *SetIntermediateRequest) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *SetIntermediateRequest) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *SignRequest) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *SignRequest) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *SignIntermediateRequest) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *SignIntermediateRequest) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *CrossSignCARequest) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *CrossSignCARequest) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *ActiveRootResponse) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *ActiveRootResponse) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *GenerateIntermediateCSRResponse) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *GenerateIntermediateCSRResponse) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *ActiveIntermediateResponse) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *ActiveIntermediateResponse) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *GenerateIntermediateResponse) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *GenerateIntermediateResponse) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *SignResponse) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *SignResponse) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *SignIntermediateResponse) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *SignIntermediateResponse) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *CrossSignCAResponse) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *CrossSignCAResponse) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *Empty) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *Empty) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}

View File

@ -0,0 +1,218 @@
// Code generated by protoc-gen-go-json. DO NOT EDIT.
// source: provider.proto
package plugin
import (
"bytes"
"github.com/golang/protobuf/jsonpb"
)
// MarshalJSON implements json.Marshaler
func (msg *ConfigureRequest) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *ConfigureRequest) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *SetIntermediateRequest) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *SetIntermediateRequest) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *SignRequest) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *SignRequest) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *SignIntermediateRequest) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *SignIntermediateRequest) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *CrossSignCARequest) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *CrossSignCARequest) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *ActiveRootResponse) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *ActiveRootResponse) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *GenerateIntermediateCSRResponse) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *GenerateIntermediateCSRResponse) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *ActiveIntermediateResponse) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *ActiveIntermediateResponse) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *GenerateIntermediateResponse) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *GenerateIntermediateResponse) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *SignResponse) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *SignResponse) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *SignIntermediateResponse) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *SignIntermediateResponse) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *CrossSignCAResponse) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *CrossSignCAResponse) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}
// MarshalJSON implements json.Marshaler
func (msg *Empty) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := (&jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
OrigName: false,
}).Marshal(&buf, msg)
return buf.Bytes(), err
}
// UnmarshalJSON implements json.Unmarshaler
func (msg *Empty) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), msg)
}

View File

@ -23,9 +23,6 @@ Description:
Options:
--import-replace Replace imports of google types with those from the gogo/protobuf repo.
--generator Which generator to use: gogo, gofast etc. Defaults to gofast.
--grpc Enable the gRPC plugin
-h | --help Print this help text.
@ -39,7 +36,6 @@ function err_usage {
}
function main {
local generator=gofast
local -i grpc=0
local -i imp_replace=0
local proto_path=
@ -51,16 +47,6 @@ function main {
usage
return 0
;;
generator )
if test -z "$2"
then
err_usage "ERROR: option -g/--generator requires an argument"
return 1
fi
generator="$2"
shift 2
;;
--grpc )
grpc=1
shift
@ -92,6 +78,8 @@ function main {
gogo_proto_imp_replace="${gogo_proto_imp_replace},Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types"
local proto_go_path=${proto_path%%.proto}.pb.go
local proto_go_bin_path=${proto_path%%.proto}.pb.binary.go
local proto_go_json_path=${proto_path%%.proto}.pb.json.go
local go_proto_out=""
local sep=""
@ -112,17 +100,19 @@ function main {
fi
local -i ret=0
status_stage "Generating ${proto_go_path} from ${proto_path}"
status_stage "Generating ${proto_path} into ${proto_go_path}, ${proto_go_bin_path}, and ${proto_go_json_path}"
debug_run protoc \
-I="$(dirname ${proto_path})" \
-I="${gogo_proto_path}/protobuf" \
-I="${gogo_proto_path}" \
-I="${gogo_proto_mod_path}" \
--${generator}_out="${go_proto_out}$(dirname ${proto_path})" \
--gofast_out="${go_proto_out}$(dirname ${proto_path})" \
--go-binary_out="$(dirname ${proto_path})" \
--go-json_out="$(dirname ${proto_path})" \
"${proto_path}"
if test $? -ne 0
then
err "Failed to generate ${proto_go_path} from ${proto_path}"
err "Failed to generate outputs from ${proto_path}"
return 1
fi
@ -132,6 +122,14 @@ function main {
echo -e "${BUILD_TAGS}\n" >> "${proto_go_path}.new"
cat "${proto_go_path}" >> "${proto_go_path}.new"
mv "${proto_go_path}.new" "${proto_go_path}"
echo -e "${BUILD_TAGS}\n" >> "${proto_go_bin_path}.new"
cat "${proto_go_bin_path}" >> "${proto_go_bin_path}.new"
mv "${proto_go_bin_path}.new" "${proto_go_bin_path}"
echo -e "${BUILD_TAGS}\n" >> "${proto_go_json_path}.new"
cat "${proto_go_json_path}" >> "${proto_go_json_path}.new"
mv "${proto_go_json_path}.new" "${proto_go_json_path}"
fi
return 0

1271
vendor/github.com/golang/protobuf/jsonpb/jsonpb.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,336 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/struct.proto
package structpb
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// `NullValue` is a singleton enumeration to represent the null value for the
// `Value` type union.
//
// The JSON representation for `NullValue` is JSON `null`.
type NullValue int32
const (
// Null value.
NullValue_NULL_VALUE NullValue = 0
)
var NullValue_name = map[int32]string{
0: "NULL_VALUE",
}
var NullValue_value = map[string]int32{
"NULL_VALUE": 0,
}
func (x NullValue) String() string {
return proto.EnumName(NullValue_name, int32(x))
}
func (NullValue) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_df322afd6c9fb402, []int{0}
}
func (NullValue) XXX_WellKnownType() string { return "NullValue" }
// `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.
type Struct struct {
// Unordered map of dynamically typed values.
Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Struct) Reset() { *m = Struct{} }
func (m *Struct) String() string { return proto.CompactTextString(m) }
func (*Struct) ProtoMessage() {}
func (*Struct) Descriptor() ([]byte, []int) {
return fileDescriptor_df322afd6c9fb402, []int{0}
}
func (*Struct) XXX_WellKnownType() string { return "Struct" }
func (m *Struct) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Struct.Unmarshal(m, b)
}
func (m *Struct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Struct.Marshal(b, m, deterministic)
}
func (m *Struct) XXX_Merge(src proto.Message) {
xxx_messageInfo_Struct.Merge(m, src)
}
func (m *Struct) XXX_Size() int {
return xxx_messageInfo_Struct.Size(m)
}
func (m *Struct) XXX_DiscardUnknown() {
xxx_messageInfo_Struct.DiscardUnknown(m)
}
var xxx_messageInfo_Struct proto.InternalMessageInfo
func (m *Struct) GetFields() map[string]*Value {
if m != nil {
return m.Fields
}
return nil
}
// `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 that
// variants, absence of any variant indicates an error.
//
// The JSON representation for `Value` is JSON value.
type Value struct {
// The kind of value.
//
// Types that are valid to be assigned to Kind:
// *Value_NullValue
// *Value_NumberValue
// *Value_StringValue
// *Value_BoolValue
// *Value_StructValue
// *Value_ListValue
Kind isValue_Kind `protobuf_oneof:"kind"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Value) Reset() { *m = Value{} }
func (m *Value) String() string { return proto.CompactTextString(m) }
func (*Value) ProtoMessage() {}
func (*Value) Descriptor() ([]byte, []int) {
return fileDescriptor_df322afd6c9fb402, []int{1}
}
func (*Value) XXX_WellKnownType() string { return "Value" }
func (m *Value) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Value.Unmarshal(m, b)
}
func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Value.Marshal(b, m, deterministic)
}
func (m *Value) XXX_Merge(src proto.Message) {
xxx_messageInfo_Value.Merge(m, src)
}
func (m *Value) XXX_Size() int {
return xxx_messageInfo_Value.Size(m)
}
func (m *Value) XXX_DiscardUnknown() {
xxx_messageInfo_Value.DiscardUnknown(m)
}
var xxx_messageInfo_Value proto.InternalMessageInfo
type isValue_Kind interface {
isValue_Kind()
}
type Value_NullValue struct {
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"`
}
type Value_NumberValue struct {
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"`
}
type Value_StringValue struct {
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
}
type Value_BoolValue struct {
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"`
}
type Value_StructValue struct {
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"`
}
type Value_ListValue struct {
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"`
}
func (*Value_NullValue) isValue_Kind() {}
func (*Value_NumberValue) isValue_Kind() {}
func (*Value_StringValue) isValue_Kind() {}
func (*Value_BoolValue) isValue_Kind() {}
func (*Value_StructValue) isValue_Kind() {}
func (*Value_ListValue) isValue_Kind() {}
func (m *Value) GetKind() isValue_Kind {
if m != nil {
return m.Kind
}
return nil
}
func (m *Value) GetNullValue() NullValue {
if x, ok := m.GetKind().(*Value_NullValue); ok {
return x.NullValue
}
return NullValue_NULL_VALUE
}
func (m *Value) GetNumberValue() float64 {
if x, ok := m.GetKind().(*Value_NumberValue); ok {
return x.NumberValue
}
return 0
}
func (m *Value) GetStringValue() string {
if x, ok := m.GetKind().(*Value_StringValue); ok {
return x.StringValue
}
return ""
}
func (m *Value) GetBoolValue() bool {
if x, ok := m.GetKind().(*Value_BoolValue); ok {
return x.BoolValue
}
return false
}
func (m *Value) GetStructValue() *Struct {
if x, ok := m.GetKind().(*Value_StructValue); ok {
return x.StructValue
}
return nil
}
func (m *Value) GetListValue() *ListValue {
if x, ok := m.GetKind().(*Value_ListValue); ok {
return x.ListValue
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*Value) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*Value_NullValue)(nil),
(*Value_NumberValue)(nil),
(*Value_StringValue)(nil),
(*Value_BoolValue)(nil),
(*Value_StructValue)(nil),
(*Value_ListValue)(nil),
}
}
// `ListValue` is a wrapper around a repeated field of values.
//
// The JSON representation for `ListValue` is JSON array.
type ListValue struct {
// Repeated field of dynamically typed values.
Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListValue) Reset() { *m = ListValue{} }
func (m *ListValue) String() string { return proto.CompactTextString(m) }
func (*ListValue) ProtoMessage() {}
func (*ListValue) Descriptor() ([]byte, []int) {
return fileDescriptor_df322afd6c9fb402, []int{2}
}
func (*ListValue) XXX_WellKnownType() string { return "ListValue" }
func (m *ListValue) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListValue.Unmarshal(m, b)
}
func (m *ListValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListValue.Marshal(b, m, deterministic)
}
func (m *ListValue) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListValue.Merge(m, src)
}
func (m *ListValue) XXX_Size() int {
return xxx_messageInfo_ListValue.Size(m)
}
func (m *ListValue) XXX_DiscardUnknown() {
xxx_messageInfo_ListValue.DiscardUnknown(m)
}
var xxx_messageInfo_ListValue proto.InternalMessageInfo
func (m *ListValue) GetValues() []*Value {
if m != nil {
return m.Values
}
return nil
}
func init() {
proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value)
proto.RegisterType((*Struct)(nil), "google.protobuf.Struct")
proto.RegisterMapType((map[string]*Value)(nil), "google.protobuf.Struct.FieldsEntry")
proto.RegisterType((*Value)(nil), "google.protobuf.Value")
proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue")
}
func init() { proto.RegisterFile("google/protobuf/struct.proto", fileDescriptor_df322afd6c9fb402) }
var fileDescriptor_df322afd6c9fb402 = []byte{
// 417 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8b, 0xd3, 0x40,
0x14, 0xc7, 0x3b, 0xc9, 0x36, 0x98, 0x17, 0x59, 0x97, 0x11, 0xb4, 0xac, 0xa2, 0xa1, 0x7b, 0x09,
0x22, 0x29, 0xd6, 0x8b, 0x18, 0x2f, 0x06, 0xd6, 0x5d, 0x30, 0x2c, 0x31, 0xba, 0x15, 0xbc, 0x94,
0x26, 0x4d, 0x63, 0xe8, 0x74, 0x26, 0x24, 0x33, 0x4a, 0x8f, 0x7e, 0x0b, 0xcf, 0x1e, 0x3d, 0xfa,
0xe9, 0x3c, 0xca, 0xcc, 0x24, 0xa9, 0xb4, 0xf4, 0x94, 0xbc, 0xf7, 0x7e, 0xef, 0x3f, 0xef, 0xff,
0x66, 0xe0, 0x71, 0xc1, 0x58, 0x41, 0xf2, 0x49, 0x55, 0x33, 0xce, 0x52, 0xb1, 0x9a, 0x34, 0xbc,
0x16, 0x19, 0xf7, 0x55, 0x8c, 0xef, 0xe9, 0xaa, 0xdf, 0x55, 0xc7, 0x3f, 0x11, 0x58, 0x1f, 0x15,
0x81, 0x03, 0xb0, 0x56, 0x65, 0x4e, 0x96, 0xcd, 0x08, 0xb9, 0xa6, 0xe7, 0x4c, 0x2f, 0xfc, 0x3d,
0xd8, 0xd7, 0xa0, 0xff, 0x4e, 0x51, 0x97, 0x94, 0xd7, 0xdb, 0xa4, 0x6d, 0x39, 0xff, 0x00, 0xce,
0x7f, 0x69, 0x7c, 0x06, 0xe6, 0x3a, 0xdf, 0x8e, 0x90, 0x8b, 0x3c, 0x3b, 0x91, 0xbf, 0xf8, 0x39,
0x0c, 0xbf, 0x2d, 0x88, 0xc8, 0x47, 0x86, 0x8b, 0x3c, 0x67, 0xfa, 0xe0, 0x40, 0x7c, 0x26, 0xab,
0x89, 0x86, 0x5e, 0x1b, 0xaf, 0xd0, 0xf8, 0x8f, 0x01, 0x43, 0x95, 0xc4, 0x01, 0x00, 0x15, 0x84,
0xcc, 0xb5, 0x80, 0x14, 0x3d, 0x9d, 0x9e, 0x1f, 0x08, 0xdc, 0x08, 0x42, 0x14, 0x7f, 0x3d, 0x48,
0x6c, 0xda, 0x05, 0xf8, 0x02, 0xee, 0x52, 0xb1, 0x49, 0xf3, 0x7a, 0xbe, 0x3b, 0x1f, 0x5d, 0x0f,
0x12, 0x47, 0x67, 0x7b, 0xa8, 0xe1, 0x75, 0x49, 0x8b, 0x16, 0x32, 0xe5, 0xe0, 0x12, 0xd2, 0x59,
0x0d, 0x3d, 0x05, 0x48, 0x19, 0xeb, 0xc6, 0x38, 0x71, 0x91, 0x77, 0x47, 0x1e, 0x25, 0x73, 0x1a,
0x78, 0xa3, 0x54, 0x44, 0xc6, 0x5b, 0x64, 0xa8, 0xac, 0x3e, 0x3c, 0xb2, 0xc7, 0x56, 0x5e, 0x64,
0xbc, 0x77, 0x49, 0xca, 0xa6, 0xeb, 0xb5, 0x54, 0xef, 0xa1, 0xcb, 0xa8, 0x6c, 0x78, 0xef, 0x92,
0x74, 0x41, 0x68, 0xc1, 0xc9, 0xba, 0xa4, 0xcb, 0x71, 0x00, 0x76, 0x4f, 0x60, 0x1f, 0x2c, 0x25,
0xd6, 0xdd, 0xe8, 0xb1, 0xa5, 0xb7, 0xd4, 0xb3, 0x47, 0x60, 0xf7, 0x4b, 0xc4, 0xa7, 0x00, 0x37,
0xb7, 0x51, 0x34, 0x9f, 0xbd, 0x8d, 0x6e, 0x2f, 0xcf, 0x06, 0xe1, 0x0f, 0x04, 0xf7, 0x33, 0xb6,
0xd9, 0x97, 0x08, 0x1d, 0xed, 0x26, 0x96, 0x71, 0x8c, 0xbe, 0xbc, 0x28, 0x4a, 0xfe, 0x55, 0xa4,
0x7e, 0xc6, 0x36, 0x93, 0x82, 0x91, 0x05, 0x2d, 0x76, 0x4f, 0xb1, 0xe2, 0xdb, 0x2a, 0x6f, 0xda,
0x17, 0x19, 0xe8, 0x4f, 0x95, 0xfe, 0x45, 0xe8, 0x97, 0x61, 0x5e, 0xc5, 0xe1, 0x6f, 0xe3, 0xc9,
0x95, 0x16, 0x8f, 0xbb, 0xf9, 0x3e, 0xe7, 0x84, 0xbc, 0xa7, 0xec, 0x3b, 0xfd, 0x24, 0x3b, 0x53,
0x4b, 0x49, 0xbd, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x1b, 0x59, 0xf8, 0xe5, 0x02, 0x00,
0x00,
}

View File

@ -0,0 +1,96 @@
// 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 = "github.com/golang/protobuf/ptypes/struct;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 that
// 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;
}

4
vendor/modules.txt vendored
View File

@ -121,15 +121,17 @@ github.com/gogo/googleapis/google/rpc
github.com/gogo/googleapis/google/api
# github.com/gogo/protobuf v1.2.1
github.com/gogo/protobuf/gogoproto
github.com/gogo/protobuf/types
github.com/gogo/protobuf/jsonpb
github.com/gogo/protobuf/proto
github.com/gogo/protobuf/types
github.com/gogo/protobuf/protoc-gen-gogo/descriptor
github.com/gogo/protobuf/sortkeys
# github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/glog
# github.com/golang/protobuf v1.3.1
github.com/golang/protobuf/jsonpb
github.com/golang/protobuf/proto
github.com/golang/protobuf/ptypes/struct
github.com/golang/protobuf/ptypes
github.com/golang/protobuf/protoc-gen-go/descriptor
github.com/golang/protobuf/ptypes/duration