From ca580c4fcf87b178547c2e9e41a2481b0008efe9 Mon Sep 17 00:00:00 2001 From: htuch Date: Wed, 24 Jun 2020 19:37:33 -0400 Subject: [PATCH] udpa: add core proto definitions from xDS transport++ proposal. (#29) These are the new UDPA protos from https://github.com/envoyproxy/envoy/issues/11264 and https://docs.google.com/document/d/1zZav-IYxMO0mP2A7y5XHBa9v0eXyirw1CxrLLSUqWR8/edit. Signed-off-by: Harvey Tuch --- go/udpa/core/v1/authority.pb.go | 84 ++++++ go/udpa/core/v1/authority.pb.validate.go | 108 +++++++ go/udpa/core/v1/collection_entry.pb.go | 196 ++++++++++++ .../core/v1/collection_entry.pb.validate.go | 225 ++++++++++++++ go/udpa/core/v1/collection_resource.pb.go | 195 ++++++++++++ .../v1/collection_resource.pb.validate.go | 227 ++++++++++++++ go/udpa/core/v1/context_params.pb.go | 86 ++++++ go/udpa/core/v1/context_params.pb.validate.go | 104 +++++++ go/udpa/core/v1/resource.pb.go | 103 +++++++ go/udpa/core/v1/resource.pb.validate.go | 123 ++++++++ go/udpa/core/v1/resource_locator.pb.go | 281 ++++++++++++++++++ .../core/v1/resource_locator.pb.validate.go | 263 ++++++++++++++++ go/udpa/core/v1/resource_name.pb.go | 114 +++++++ go/udpa/core/v1/resource_name.pb.validate.go | 128 ++++++++ udpa/core/v1/BUILD | 5 + udpa/core/v1/authority.proto | 21 ++ udpa/core/v1/collection_entry.proto | 52 ++++ udpa/core/v1/context_params.proto | 16 + udpa/core/v1/resource.proto | 28 ++ udpa/core/v1/resource_locator.proto | 97 ++++++ udpa/core/v1/resource_name.proto | 41 +++ 21 files changed, 2497 insertions(+) create mode 100644 go/udpa/core/v1/authority.pb.go create mode 100644 go/udpa/core/v1/authority.pb.validate.go create mode 100644 go/udpa/core/v1/collection_entry.pb.go create mode 100644 go/udpa/core/v1/collection_entry.pb.validate.go create mode 100644 go/udpa/core/v1/collection_resource.pb.go create mode 100644 go/udpa/core/v1/collection_resource.pb.validate.go create mode 100644 go/udpa/core/v1/context_params.pb.go create mode 100644 go/udpa/core/v1/context_params.pb.validate.go create mode 100644 go/udpa/core/v1/resource.pb.go create mode 100644 go/udpa/core/v1/resource.pb.validate.go create mode 100644 go/udpa/core/v1/resource_locator.pb.go create mode 100644 go/udpa/core/v1/resource_locator.pb.validate.go create mode 100644 go/udpa/core/v1/resource_name.pb.go create mode 100644 go/udpa/core/v1/resource_name.pb.validate.go create mode 100644 udpa/core/v1/BUILD create mode 100644 udpa/core/v1/authority.proto create mode 100644 udpa/core/v1/collection_entry.proto create mode 100644 udpa/core/v1/context_params.proto create mode 100644 udpa/core/v1/resource.proto create mode 100644 udpa/core/v1/resource_locator.proto create mode 100644 udpa/core/v1/resource_name.proto diff --git a/go/udpa/core/v1/authority.pb.go b/go/udpa/core/v1/authority.pb.go new file mode 100644 index 0000000..a957097 --- /dev/null +++ b/go/udpa/core/v1/authority.pb.go @@ -0,0 +1,84 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: udpa/core/v1/authority.proto + +package udpa_core_v1 + +import ( + fmt "fmt" + _ "github.com/cncf/udpa/go/udpa/annotations" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + 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 + +type Authority struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Authority) Reset() { *m = Authority{} } +func (m *Authority) String() string { return proto.CompactTextString(m) } +func (*Authority) ProtoMessage() {} +func (*Authority) Descriptor() ([]byte, []int) { + return fileDescriptor_609fadab943a4134, []int{0} +} + +func (m *Authority) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Authority.Unmarshal(m, b) +} +func (m *Authority) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Authority.Marshal(b, m, deterministic) +} +func (m *Authority) XXX_Merge(src proto.Message) { + xxx_messageInfo_Authority.Merge(m, src) +} +func (m *Authority) XXX_Size() int { + return xxx_messageInfo_Authority.Size(m) +} +func (m *Authority) XXX_DiscardUnknown() { + xxx_messageInfo_Authority.DiscardUnknown(m) +} + +var xxx_messageInfo_Authority proto.InternalMessageInfo + +func (m *Authority) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func init() { + proto.RegisterType((*Authority)(nil), "udpa.core.v1.Authority") +} + +func init() { proto.RegisterFile("udpa/core/v1/authority.proto", fileDescriptor_609fadab943a4134) } + +var fileDescriptor_609fadab943a4134 = []byte{ + // 178 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x4d, 0x29, 0x48, + 0xd4, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x2c, 0x2d, 0xc9, 0xc8, 0x2f, 0xca, + 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0xc9, 0xea, 0x81, 0x64, 0xf5, + 0xca, 0x0c, 0xa5, 0x64, 0xc1, 0x6a, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, + 0x8a, 0xf5, 0x8b, 0x4b, 0x12, 0x4b, 0x4a, 0x8b, 0x21, 0x8a, 0xa5, 0xc4, 0xcb, 0x12, 0x73, 0x32, + 0x53, 0x12, 0x4b, 0x52, 0xf5, 0x61, 0x0c, 0x88, 0x84, 0x92, 0x06, 0x17, 0xa7, 0x23, 0xcc, 0x60, + 0x21, 0x69, 0x2e, 0x96, 0xbc, 0xc4, 0xdc, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0xf6, + 0x5f, 0x4e, 0x2c, 0x45, 0x4c, 0x02, 0x8c, 0x41, 0x60, 0x41, 0x27, 0x8b, 0x5d, 0x0d, 0x27, 0x2e, + 0xb2, 0x31, 0x71, 0x30, 0x72, 0xc9, 0x24, 0xe7, 0xe7, 0xea, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, + 0xe9, 0x81, 0x1d, 0x81, 0xec, 0x12, 0x27, 0x3e, 0xb8, 0x79, 0x01, 0x20, 0x1b, 0x02, 0x18, 0x93, + 0xd8, 0xc0, 0x56, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x02, 0xb5, 0x8b, 0xd0, 0x00, + 0x00, 0x00, +} diff --git a/go/udpa/core/v1/authority.pb.validate.go b/go/udpa/core/v1/authority.pb.validate.go new file mode 100644 index 0000000..f94ba77 --- /dev/null +++ b/go/udpa/core/v1/authority.pb.validate.go @@ -0,0 +1,108 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: udpa/core/v1/authority.proto + +package udpa_core_v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/golang/protobuf/ptypes" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = ptypes.DynamicAny{} +) + +// define the regex for a UUID once up-front +var _authority_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") + +// Validate checks the field values on Authority with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Authority) Validate() error { + if m == nil { + return nil + } + + if utf8.RuneCountInString(m.GetName()) < 1 { + return AuthorityValidationError{ + field: "Name", + reason: "value length must be at least 1 runes", + } + } + + return nil +} + +// AuthorityValidationError is the validation error returned by +// Authority.Validate if the designated constraints aren't met. +type AuthorityValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AuthorityValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AuthorityValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AuthorityValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AuthorityValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AuthorityValidationError) ErrorName() string { return "AuthorityValidationError" } + +// Error satisfies the builtin error interface +func (e AuthorityValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAuthority.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AuthorityValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AuthorityValidationError{} diff --git a/go/udpa/core/v1/collection_entry.pb.go b/go/udpa/core/v1/collection_entry.pb.go new file mode 100644 index 0000000..0239876 --- /dev/null +++ b/go/udpa/core/v1/collection_entry.pb.go @@ -0,0 +1,196 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: udpa/core/v1/collection_entry.proto + +package udpa_core_v1 + +import ( + fmt "fmt" + _ "github.com/cncf/udpa/go/udpa/annotations" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + proto "github.com/golang/protobuf/proto" + any "github.com/golang/protobuf/ptypes/any" + 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 + +type CollectionEntry struct { + // Types that are valid to be assigned to ResourceSpecifier: + // *CollectionEntry_Locator + // *CollectionEntry_InlineEntry_ + ResourceSpecifier isCollectionEntry_ResourceSpecifier `protobuf_oneof:"resource_specifier"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CollectionEntry) Reset() { *m = CollectionEntry{} } +func (m *CollectionEntry) String() string { return proto.CompactTextString(m) } +func (*CollectionEntry) ProtoMessage() {} +func (*CollectionEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_1fbd2663cd4713c4, []int{0} +} + +func (m *CollectionEntry) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CollectionEntry.Unmarshal(m, b) +} +func (m *CollectionEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CollectionEntry.Marshal(b, m, deterministic) +} +func (m *CollectionEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_CollectionEntry.Merge(m, src) +} +func (m *CollectionEntry) XXX_Size() int { + return xxx_messageInfo_CollectionEntry.Size(m) +} +func (m *CollectionEntry) XXX_DiscardUnknown() { + xxx_messageInfo_CollectionEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_CollectionEntry proto.InternalMessageInfo + +type isCollectionEntry_ResourceSpecifier interface { + isCollectionEntry_ResourceSpecifier() +} + +type CollectionEntry_Locator struct { + Locator *ResourceLocator `protobuf:"bytes,1,opt,name=locator,proto3,oneof"` +} + +type CollectionEntry_InlineEntry_ struct { + InlineEntry *CollectionEntry_InlineEntry `protobuf:"bytes,2,opt,name=inline_entry,json=inlineEntry,proto3,oneof"` +} + +func (*CollectionEntry_Locator) isCollectionEntry_ResourceSpecifier() {} + +func (*CollectionEntry_InlineEntry_) isCollectionEntry_ResourceSpecifier() {} + +func (m *CollectionEntry) GetResourceSpecifier() isCollectionEntry_ResourceSpecifier { + if m != nil { + return m.ResourceSpecifier + } + return nil +} + +func (m *CollectionEntry) GetLocator() *ResourceLocator { + if x, ok := m.GetResourceSpecifier().(*CollectionEntry_Locator); ok { + return x.Locator + } + return nil +} + +func (m *CollectionEntry) GetInlineEntry() *CollectionEntry_InlineEntry { + if x, ok := m.GetResourceSpecifier().(*CollectionEntry_InlineEntry_); ok { + return x.InlineEntry + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*CollectionEntry) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*CollectionEntry_Locator)(nil), + (*CollectionEntry_InlineEntry_)(nil), + } +} + +type CollectionEntry_InlineEntry struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + Resource *any.Any `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CollectionEntry_InlineEntry) Reset() { *m = CollectionEntry_InlineEntry{} } +func (m *CollectionEntry_InlineEntry) String() string { return proto.CompactTextString(m) } +func (*CollectionEntry_InlineEntry) ProtoMessage() {} +func (*CollectionEntry_InlineEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_1fbd2663cd4713c4, []int{0, 0} +} + +func (m *CollectionEntry_InlineEntry) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CollectionEntry_InlineEntry.Unmarshal(m, b) +} +func (m *CollectionEntry_InlineEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CollectionEntry_InlineEntry.Marshal(b, m, deterministic) +} +func (m *CollectionEntry_InlineEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_CollectionEntry_InlineEntry.Merge(m, src) +} +func (m *CollectionEntry_InlineEntry) XXX_Size() int { + return xxx_messageInfo_CollectionEntry_InlineEntry.Size(m) +} +func (m *CollectionEntry_InlineEntry) XXX_DiscardUnknown() { + xxx_messageInfo_CollectionEntry_InlineEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_CollectionEntry_InlineEntry proto.InternalMessageInfo + +func (m *CollectionEntry_InlineEntry) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *CollectionEntry_InlineEntry) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *CollectionEntry_InlineEntry) GetResource() *any.Any { + if m != nil { + return m.Resource + } + return nil +} + +func init() { + proto.RegisterType((*CollectionEntry)(nil), "udpa.core.v1.CollectionEntry") + proto.RegisterType((*CollectionEntry_InlineEntry)(nil), "udpa.core.v1.CollectionEntry.InlineEntry") +} + +func init() { + proto.RegisterFile("udpa/core/v1/collection_entry.proto", fileDescriptor_1fbd2663cd4713c4) +} + +var fileDescriptor_1fbd2663cd4713c4 = []byte{ + // 369 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0x4f, 0x4b, 0x3a, 0x41, + 0x1c, 0xc6, 0x5d, 0xfd, 0xe1, 0x9f, 0x51, 0xf8, 0xc1, 0x60, 0xb8, 0x8a, 0x42, 0x54, 0x87, 0x22, + 0x76, 0x56, 0xed, 0x64, 0x87, 0xc0, 0x8d, 0xc0, 0x20, 0x42, 0xf6, 0x58, 0x96, 0x8c, 0xe3, 0x68, + 0x03, 0xeb, 0x8c, 0xcc, 0xce, 0x2e, 0xd8, 0x21, 0xba, 0xf7, 0x8e, 0xba, 0x07, 0x5d, 0x7b, 0x37, + 0xd1, 0x29, 0x76, 0x76, 0xd7, 0xd4, 0xdb, 0x0c, 0xdf, 0xcf, 0x33, 0xcf, 0xf3, 0xcc, 0x17, 0x1c, + 0x06, 0xd3, 0x25, 0xb6, 0x89, 0x90, 0xd4, 0x0e, 0x3b, 0x36, 0x11, 0x9e, 0x47, 0x89, 0x62, 0x82, + 0x8f, 0x29, 0x57, 0x72, 0x85, 0x96, 0x52, 0x28, 0x01, 0x2b, 0x11, 0x84, 0x22, 0x08, 0x85, 0x9d, + 0x46, 0x7d, 0x2e, 0xc4, 0xdc, 0xa3, 0xb6, 0x9e, 0x4d, 0x82, 0x99, 0x8d, 0x79, 0x02, 0x36, 0x5a, + 0xfa, 0x35, 0xcc, 0xb9, 0x50, 0x38, 0x7a, 0xc5, 0xb7, 0x7d, 0x85, 0x55, 0xe0, 0x27, 0xe3, 0x6d, + 0x33, 0x49, 0x7d, 0x11, 0x48, 0x42, 0xc7, 0x9e, 0x20, 0x58, 0x09, 0x99, 0x40, 0xb5, 0x10, 0x7b, + 0x6c, 0x8a, 0x15, 0xb5, 0xd3, 0x43, 0x3c, 0x38, 0xf8, 0xc8, 0x82, 0xff, 0x97, 0xeb, 0x80, 0x57, + 0x51, 0x3e, 0xd8, 0x03, 0x85, 0x44, 0x6d, 0x1a, 0xfb, 0xc6, 0x71, 0xb9, 0xdb, 0x42, 0x9b, 0x59, + 0x91, 0x9b, 0x78, 0xdc, 0xc4, 0xd0, 0x20, 0xe3, 0xa6, 0x3c, 0xbc, 0x05, 0x15, 0xc6, 0x3d, 0xc6, + 0x69, 0x5c, 0xd5, 0xcc, 0x6a, 0xfd, 0xc9, 0xb6, 0x7e, 0xc7, 0x0f, 0x5d, 0x6b, 0x85, 0x3e, 0x0f, + 0x32, 0x6e, 0x99, 0xfd, 0x5d, 0x1b, 0x6f, 0x06, 0x28, 0x6f, 0x8c, 0x61, 0x1b, 0xfc, 0xe3, 0x78, + 0x41, 0x75, 0xae, 0x92, 0xd3, 0xfc, 0x71, 0xea, 0xb2, 0xd6, 0xdd, 0x7b, 0xbc, 0x6f, 0x5b, 0x3d, + 0x6c, 0x3d, 0xf7, 0xad, 0xbb, 0xf1, 0xc8, 0x1a, 0xa1, 0x97, 0xf3, 0x87, 0xd3, 0x23, 0x57, 0x93, + 0xd0, 0x04, 0x85, 0x90, 0x4a, 0x9f, 0x09, 0xae, 0xc3, 0x94, 0xdc, 0xf4, 0x0a, 0xdb, 0xa0, 0x98, + 0xfe, 0x96, 0x99, 0xd3, 0x39, 0xab, 0x28, 0xde, 0x02, 0x4a, 0xb7, 0x80, 0xfa, 0x7c, 0xe5, 0xae, + 0x29, 0xa7, 0x0e, 0xe0, 0xfa, 0x7f, 0xfd, 0x25, 0x25, 0x6c, 0xc6, 0xa8, 0x84, 0xb9, 0x6f, 0xc7, + 0x70, 0x2e, 0xde, 0x5f, 0x3f, 0xbf, 0xf2, 0xd9, 0xa2, 0x01, 0x9a, 0x44, 0x2c, 0xd0, 0x9c, 0xa9, + 0xa7, 0x60, 0x12, 0xd7, 0xde, 0xec, 0xee, 0x54, 0x77, 0xca, 0x0f, 0x23, 0xa7, 0xa1, 0x31, 0xc9, + 0x6b, 0xcb, 0xb3, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x54, 0xf1, 0xee, 0x8f, 0x3b, 0x02, 0x00, + 0x00, +} diff --git a/go/udpa/core/v1/collection_entry.pb.validate.go b/go/udpa/core/v1/collection_entry.pb.validate.go new file mode 100644 index 0000000..2ac3d60 --- /dev/null +++ b/go/udpa/core/v1/collection_entry.pb.validate.go @@ -0,0 +1,225 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: udpa/core/v1/collection_entry.proto + +package udpa_core_v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/golang/protobuf/ptypes" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = ptypes.DynamicAny{} +) + +// define the regex for a UUID once up-front +var _collection_entry_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") + +// Validate checks the field values on CollectionEntry with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *CollectionEntry) Validate() error { + if m == nil { + return nil + } + + switch m.ResourceSpecifier.(type) { + + case *CollectionEntry_Locator: + + if v, ok := interface{}(m.GetLocator()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CollectionEntryValidationError{ + field: "Locator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *CollectionEntry_InlineEntry_: + + if v, ok := interface{}(m.GetInlineEntry()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CollectionEntryValidationError{ + field: "InlineEntry", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return CollectionEntryValidationError{ + field: "ResourceSpecifier", + reason: "value is required", + } + + } + + return nil +} + +// CollectionEntryValidationError is the validation error returned by +// CollectionEntry.Validate if the designated constraints aren't met. +type CollectionEntryValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CollectionEntryValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CollectionEntryValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CollectionEntryValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CollectionEntryValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CollectionEntryValidationError) ErrorName() string { return "CollectionEntryValidationError" } + +// Error satisfies the builtin error interface +func (e CollectionEntryValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCollectionEntry.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CollectionEntryValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CollectionEntryValidationError{} + +// Validate checks the field values on CollectionEntry_InlineEntry with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CollectionEntry_InlineEntry) Validate() error { + if m == nil { + return nil + } + + if !_CollectionEntry_InlineEntry_Name_Pattern.MatchString(m.GetName()) { + return CollectionEntry_InlineEntryValidationError{ + field: "Name", + reason: "value does not match regex pattern \"^[0-9a-zA-Z_\\\\-\\\\.~:]+$\"", + } + } + + // no validation rules for Version + + if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CollectionEntry_InlineEntryValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + } + } + } + + return nil +} + +// CollectionEntry_InlineEntryValidationError is the validation error returned +// by CollectionEntry_InlineEntry.Validate if the designated constraints +// aren't met. +type CollectionEntry_InlineEntryValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CollectionEntry_InlineEntryValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CollectionEntry_InlineEntryValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CollectionEntry_InlineEntryValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CollectionEntry_InlineEntryValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CollectionEntry_InlineEntryValidationError) ErrorName() string { + return "CollectionEntry_InlineEntryValidationError" +} + +// Error satisfies the builtin error interface +func (e CollectionEntry_InlineEntryValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCollectionEntry_InlineEntry.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CollectionEntry_InlineEntryValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CollectionEntry_InlineEntryValidationError{} + +var _CollectionEntry_InlineEntry_Name_Pattern = regexp.MustCompile("^[0-9a-zA-Z_\\-\\.~:]+$") diff --git a/go/udpa/core/v1/collection_resource.pb.go b/go/udpa/core/v1/collection_resource.pb.go new file mode 100644 index 0000000..3fb5256 --- /dev/null +++ b/go/udpa/core/v1/collection_resource.pb.go @@ -0,0 +1,195 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: udpa/core/v1/collection_resource.proto + +package udpa_core_v1 + +import ( + fmt "fmt" + _ "github.com/cncf/udpa/go/udpa/annotations" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + proto "github.com/golang/protobuf/proto" + any "github.com/golang/protobuf/ptypes/any" + 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 + +type CollectionResource struct { + // Types that are valid to be assigned to ResourceSpecifier: + // *CollectionResource_Locator + // *CollectionResource_Entry + ResourceSpecifier isCollectionResource_ResourceSpecifier `protobuf_oneof:"resource_specifier"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CollectionResource) Reset() { *m = CollectionResource{} } +func (m *CollectionResource) String() string { return proto.CompactTextString(m) } +func (*CollectionResource) ProtoMessage() {} +func (*CollectionResource) Descriptor() ([]byte, []int) { + return fileDescriptor_a105f4a9571f0c96, []int{0} +} + +func (m *CollectionResource) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CollectionResource.Unmarshal(m, b) +} +func (m *CollectionResource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CollectionResource.Marshal(b, m, deterministic) +} +func (m *CollectionResource) XXX_Merge(src proto.Message) { + xxx_messageInfo_CollectionResource.Merge(m, src) +} +func (m *CollectionResource) XXX_Size() int { + return xxx_messageInfo_CollectionResource.Size(m) +} +func (m *CollectionResource) XXX_DiscardUnknown() { + xxx_messageInfo_CollectionResource.DiscardUnknown(m) +} + +var xxx_messageInfo_CollectionResource proto.InternalMessageInfo + +type isCollectionResource_ResourceSpecifier interface { + isCollectionResource_ResourceSpecifier() +} + +type CollectionResource_Locator struct { + Locator *ResourceLocator `protobuf:"bytes,1,opt,name=locator,proto3,oneof"` +} + +type CollectionResource_Entry struct { + Entry *CollectionResource_InlineEntry `protobuf:"bytes,2,opt,name=entry,proto3,oneof"` +} + +func (*CollectionResource_Locator) isCollectionResource_ResourceSpecifier() {} + +func (*CollectionResource_Entry) isCollectionResource_ResourceSpecifier() {} + +func (m *CollectionResource) GetResourceSpecifier() isCollectionResource_ResourceSpecifier { + if m != nil { + return m.ResourceSpecifier + } + return nil +} + +func (m *CollectionResource) GetLocator() *ResourceLocator { + if x, ok := m.GetResourceSpecifier().(*CollectionResource_Locator); ok { + return x.Locator + } + return nil +} + +func (m *CollectionResource) GetEntry() *CollectionResource_InlineEntry { + if x, ok := m.GetResourceSpecifier().(*CollectionResource_Entry); ok { + return x.Entry + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*CollectionResource) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*CollectionResource_Locator)(nil), + (*CollectionResource_Entry)(nil), + } +} + +type CollectionResource_InlineEntry struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + Resource *any.Any `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CollectionResource_InlineEntry) Reset() { *m = CollectionResource_InlineEntry{} } +func (m *CollectionResource_InlineEntry) String() string { return proto.CompactTextString(m) } +func (*CollectionResource_InlineEntry) ProtoMessage() {} +func (*CollectionResource_InlineEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_a105f4a9571f0c96, []int{0, 0} +} + +func (m *CollectionResource_InlineEntry) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CollectionResource_InlineEntry.Unmarshal(m, b) +} +func (m *CollectionResource_InlineEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CollectionResource_InlineEntry.Marshal(b, m, deterministic) +} +func (m *CollectionResource_InlineEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_CollectionResource_InlineEntry.Merge(m, src) +} +func (m *CollectionResource_InlineEntry) XXX_Size() int { + return xxx_messageInfo_CollectionResource_InlineEntry.Size(m) +} +func (m *CollectionResource_InlineEntry) XXX_DiscardUnknown() { + xxx_messageInfo_CollectionResource_InlineEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_CollectionResource_InlineEntry proto.InternalMessageInfo + +func (m *CollectionResource_InlineEntry) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *CollectionResource_InlineEntry) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *CollectionResource_InlineEntry) GetResource() *any.Any { + if m != nil { + return m.Resource + } + return nil +} + +func init() { + proto.RegisterType((*CollectionResource)(nil), "udpa.core.v1.CollectionResource") + proto.RegisterType((*CollectionResource_InlineEntry)(nil), "udpa.core.v1.CollectionResource.InlineEntry") +} + +func init() { + proto.RegisterFile("udpa/core/v1/collection_resource.proto", fileDescriptor_a105f4a9571f0c96) +} + +var fileDescriptor_a105f4a9571f0c96 = []byte{ + // 365 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x4f, 0x4f, 0x2a, 0x31, + 0x14, 0xc5, 0x19, 0x78, 0x8f, 0x3f, 0xe5, 0xad, 0x9a, 0x67, 0x18, 0x08, 0x24, 0x46, 0x8d, 0x31, + 0xd1, 0xe9, 0x00, 0xae, 0x70, 0xc7, 0xa8, 0x09, 0x26, 0x2e, 0xc8, 0x2c, 0x15, 0x25, 0xa5, 0x14, + 0x6c, 0x32, 0xb4, 0xa4, 0xd3, 0x99, 0x04, 0x17, 0xc6, 0xbd, 0xdf, 0xc8, 0x85, 0x6b, 0xb7, 0x7e, + 0x1b, 0xe3, 0xca, 0x4c, 0x67, 0x4a, 0x20, 0xec, 0xda, 0xdc, 0xdf, 0xb9, 0xe7, 0xdc, 0x03, 0x8e, + 0xa3, 0xe9, 0x12, 0xbb, 0x44, 0x48, 0xea, 0xc6, 0x1d, 0x97, 0x88, 0x20, 0xa0, 0x44, 0x31, 0xc1, + 0xc7, 0x92, 0x86, 0x22, 0x92, 0x84, 0xa2, 0xa5, 0x14, 0x4a, 0xc0, 0x7f, 0x09, 0x87, 0x12, 0x0e, + 0xc5, 0x9d, 0x46, 0x7d, 0x2e, 0xc4, 0x3c, 0xa0, 0xae, 0x9e, 0x4d, 0xa2, 0x99, 0x8b, 0xf9, 0x2a, + 0x05, 0x1b, 0x2d, 0xbd, 0x10, 0x73, 0x2e, 0x14, 0x4e, 0x16, 0x85, 0x6e, 0xa8, 0xb0, 0x8a, 0xc2, + 0x6c, 0x7c, 0xb8, 0xe5, 0x67, 0x4c, 0xc6, 0x81, 0x20, 0x58, 0x09, 0x99, 0x41, 0xb5, 0x18, 0x07, + 0x6c, 0x8a, 0x15, 0x75, 0xcd, 0x23, 0x1d, 0x1c, 0x7c, 0xe4, 0x01, 0xbc, 0x5c, 0x67, 0xf4, 0x33, + 0x35, 0xec, 0x81, 0x52, 0xb6, 0xc0, 0xb6, 0xf6, 0xad, 0x93, 0x6a, 0xb7, 0x85, 0x36, 0xe3, 0x22, + 0x03, 0xde, 0xa6, 0xd0, 0x20, 0xe7, 0x1b, 0x1e, 0x5e, 0x81, 0xbf, 0x94, 0x2b, 0xb9, 0xb2, 0xf3, + 0x5a, 0x78, 0xb6, 0x2d, 0xdc, 0xf5, 0x42, 0x37, 0x3c, 0x60, 0x9c, 0x5e, 0x27, 0x9a, 0x41, 0xce, + 0x4f, 0xc5, 0x8d, 0x37, 0x0b, 0x54, 0x37, 0x06, 0xb0, 0x0d, 0xfe, 0x70, 0xbc, 0xa0, 0x3a, 0x4d, + 0xc5, 0x6b, 0xfe, 0x78, 0x75, 0x59, 0xeb, 0xee, 0x3d, 0xde, 0xb7, 0x9d, 0x1e, 0x76, 0x9e, 0xfb, + 0xce, 0xdd, 0x78, 0xe4, 0x8c, 0xd0, 0xcb, 0xc5, 0xc3, 0xe9, 0x91, 0xaf, 0x49, 0x68, 0x83, 0x52, + 0x4c, 0x65, 0xc8, 0x04, 0xd7, 0x49, 0x2a, 0xbe, 0xf9, 0xc2, 0x36, 0x28, 0x9b, 0x9a, 0xec, 0x82, + 0x0e, 0xf9, 0x1f, 0xa5, 0xf5, 0x23, 0x53, 0x3f, 0xea, 0xf3, 0x95, 0xbf, 0xa6, 0xbc, 0x3a, 0x80, + 0xeb, 0x62, 0xc3, 0x25, 0x25, 0x6c, 0xc6, 0xa8, 0x84, 0x85, 0x6f, 0xcf, 0xf2, 0xfa, 0xef, 0xaf, + 0x9f, 0x5f, 0xc5, 0x7c, 0xd9, 0x02, 0x4d, 0x22, 0x16, 0x68, 0xce, 0xd4, 0x53, 0x34, 0x49, 0x6f, + 0xde, 0x3c, 0xdc, 0xab, 0xed, 0x5e, 0x3e, 0x4c, 0xcc, 0x86, 0xd6, 0xa4, 0xa8, 0x5d, 0xcf, 0x7f, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x7e, 0xab, 0x78, 0x80, 0x3a, 0x02, 0x00, 0x00, +} diff --git a/go/udpa/core/v1/collection_resource.pb.validate.go b/go/udpa/core/v1/collection_resource.pb.validate.go new file mode 100644 index 0000000..a91f4f7 --- /dev/null +++ b/go/udpa/core/v1/collection_resource.pb.validate.go @@ -0,0 +1,227 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: udpa/core/v1/collection_resource.proto + +package udpa_core_v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/golang/protobuf/ptypes" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = ptypes.DynamicAny{} +) + +// define the regex for a UUID once up-front +var _collection_resource_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") + +// Validate checks the field values on CollectionResource with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CollectionResource) Validate() error { + if m == nil { + return nil + } + + switch m.ResourceSpecifier.(type) { + + case *CollectionResource_Locator: + + if v, ok := interface{}(m.GetLocator()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CollectionResourceValidationError{ + field: "Locator", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *CollectionResource_Entry: + + if v, ok := interface{}(m.GetEntry()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CollectionResourceValidationError{ + field: "Entry", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + return CollectionResourceValidationError{ + field: "ResourceSpecifier", + reason: "value is required", + } + + } + + return nil +} + +// CollectionResourceValidationError is the validation error returned by +// CollectionResource.Validate if the designated constraints aren't met. +type CollectionResourceValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CollectionResourceValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CollectionResourceValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CollectionResourceValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CollectionResourceValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CollectionResourceValidationError) ErrorName() string { + return "CollectionResourceValidationError" +} + +// Error satisfies the builtin error interface +func (e CollectionResourceValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCollectionResource.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CollectionResourceValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CollectionResourceValidationError{} + +// Validate checks the field values on CollectionResource_InlineEntry with the +// rules defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *CollectionResource_InlineEntry) Validate() error { + if m == nil { + return nil + } + + if !_CollectionResource_InlineEntry_Name_Pattern.MatchString(m.GetName()) { + return CollectionResource_InlineEntryValidationError{ + field: "Name", + reason: "value does not match regex pattern \"^[0-9a-zA-Z_\\\\-\\\\.~:]+$\"", + } + } + + // no validation rules for Version + + if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CollectionResource_InlineEntryValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + } + } + } + + return nil +} + +// CollectionResource_InlineEntryValidationError is the validation error +// returned by CollectionResource_InlineEntry.Validate if the designated +// constraints aren't met. +type CollectionResource_InlineEntryValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CollectionResource_InlineEntryValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CollectionResource_InlineEntryValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CollectionResource_InlineEntryValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CollectionResource_InlineEntryValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CollectionResource_InlineEntryValidationError) ErrorName() string { + return "CollectionResource_InlineEntryValidationError" +} + +// Error satisfies the builtin error interface +func (e CollectionResource_InlineEntryValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCollectionResource_InlineEntry.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CollectionResource_InlineEntryValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CollectionResource_InlineEntryValidationError{} + +var _CollectionResource_InlineEntry_Name_Pattern = regexp.MustCompile("^[0-9a-zA-Z_\\-\\.~:]+$") diff --git a/go/udpa/core/v1/context_params.pb.go b/go/udpa/core/v1/context_params.pb.go new file mode 100644 index 0000000..2caae46 --- /dev/null +++ b/go/udpa/core/v1/context_params.pb.go @@ -0,0 +1,86 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: udpa/core/v1/context_params.proto + +package udpa_core_v1 + +import ( + fmt "fmt" + _ "github.com/cncf/udpa/go/udpa/annotations" + 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 + +type ContextParams struct { + Params map[string]string `protobuf:"bytes,1,rep,name=params,proto3" json:"params,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 *ContextParams) Reset() { *m = ContextParams{} } +func (m *ContextParams) String() string { return proto.CompactTextString(m) } +func (*ContextParams) ProtoMessage() {} +func (*ContextParams) Descriptor() ([]byte, []int) { + return fileDescriptor_bbf45dc46a790208, []int{0} +} + +func (m *ContextParams) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ContextParams.Unmarshal(m, b) +} +func (m *ContextParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ContextParams.Marshal(b, m, deterministic) +} +func (m *ContextParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContextParams.Merge(m, src) +} +func (m *ContextParams) XXX_Size() int { + return xxx_messageInfo_ContextParams.Size(m) +} +func (m *ContextParams) XXX_DiscardUnknown() { + xxx_messageInfo_ContextParams.DiscardUnknown(m) +} + +var xxx_messageInfo_ContextParams proto.InternalMessageInfo + +func (m *ContextParams) GetParams() map[string]string { + if m != nil { + return m.Params + } + return nil +} + +func init() { + proto.RegisterType((*ContextParams)(nil), "udpa.core.v1.ContextParams") + proto.RegisterMapType((map[string]string)(nil), "udpa.core.v1.ContextParams.ParamsEntry") +} + +func init() { proto.RegisterFile("udpa/core/v1/context_params.proto", fileDescriptor_bbf45dc46a790208) } + +var fileDescriptor_bbf45dc46a790208 = []byte{ + // 217 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0x4d, 0x29, 0x48, + 0xd4, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xad, 0x28, + 0x89, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, + 0x29, 0xd1, 0x03, 0x29, 0xd1, 0x2b, 0x33, 0x94, 0x92, 0x05, 0x6b, 0x48, 0xcc, 0xcb, 0xcb, 0x2f, + 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x2f, 0x2e, 0x49, 0x2c, 0x29, 0x85, 0x2a, 0x56, 0xea, + 0x66, 0xe4, 0xe2, 0x75, 0x86, 0x98, 0x12, 0x00, 0x36, 0x44, 0xc8, 0x9e, 0x8b, 0x0d, 0x62, 0x9c, + 0x04, 0xa3, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0xba, 0x1e, 0xb2, 0x79, 0x7a, 0x28, 0x8a, 0xf5, 0x20, + 0x94, 0x6b, 0x5e, 0x49, 0x51, 0x65, 0x10, 0x54, 0x9b, 0x94, 0x25, 0x17, 0x37, 0x92, 0xb0, 0x90, + 0x00, 0x17, 0x73, 0x76, 0x6a, 0xa5, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x88, 0x29, 0x24, + 0xc2, 0xc5, 0x5a, 0x96, 0x98, 0x53, 0x9a, 0x2a, 0xc1, 0x04, 0x16, 0x83, 0x70, 0xac, 0x98, 0x2c, + 0x18, 0x9d, 0x6c, 0x76, 0x35, 0x9c, 0xb8, 0xc8, 0xc6, 0xc4, 0xc1, 0xc8, 0x25, 0x93, 0x9c, 0x9f, + 0xab, 0x97, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0x04, 0xb1, 0x1f, 0xd9, 0x11, 0x4e, 0x42, 0x28, 0xae, + 0x08, 0x00, 0xf9, 0x24, 0x80, 0x31, 0x89, 0x0d, 0xec, 0x25, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x05, 0x1a, 0x11, 0x52, 0x24, 0x01, 0x00, 0x00, +} diff --git a/go/udpa/core/v1/context_params.pb.validate.go b/go/udpa/core/v1/context_params.pb.validate.go new file mode 100644 index 0000000..1b8f5e1 --- /dev/null +++ b/go/udpa/core/v1/context_params.pb.validate.go @@ -0,0 +1,104 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: udpa/core/v1/context_params.proto + +package udpa_core_v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/golang/protobuf/ptypes" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = ptypes.DynamicAny{} +) + +// define the regex for a UUID once up-front +var _context_params_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") + +// Validate checks the field values on ContextParams with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *ContextParams) Validate() error { + if m == nil { + return nil + } + + // no validation rules for Params + + return nil +} + +// ContextParamsValidationError is the validation error returned by +// ContextParams.Validate if the designated constraints aren't met. +type ContextParamsValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ContextParamsValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ContextParamsValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ContextParamsValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ContextParamsValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ContextParamsValidationError) ErrorName() string { return "ContextParamsValidationError" } + +// Error satisfies the builtin error interface +func (e ContextParamsValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sContextParams.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ContextParamsValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ContextParamsValidationError{} diff --git a/go/udpa/core/v1/resource.pb.go b/go/udpa/core/v1/resource.pb.go new file mode 100644 index 0000000..5239103 --- /dev/null +++ b/go/udpa/core/v1/resource.pb.go @@ -0,0 +1,103 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: udpa/core/v1/resource.proto + +package udpa_core_v1 + +import ( + fmt "fmt" + _ "github.com/cncf/udpa/go/udpa/annotations" + proto "github.com/golang/protobuf/proto" + any "github.com/golang/protobuf/ptypes/any" + 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 + +type Resource struct { + Name *ResourceName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + Resource *any.Any `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Resource) Reset() { *m = Resource{} } +func (m *Resource) String() string { return proto.CompactTextString(m) } +func (*Resource) ProtoMessage() {} +func (*Resource) Descriptor() ([]byte, []int) { + return fileDescriptor_3bc3fd9d360e95ec, []int{0} +} + +func (m *Resource) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Resource.Unmarshal(m, b) +} +func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Resource.Marshal(b, m, deterministic) +} +func (m *Resource) XXX_Merge(src proto.Message) { + xxx_messageInfo_Resource.Merge(m, src) +} +func (m *Resource) XXX_Size() int { + return xxx_messageInfo_Resource.Size(m) +} +func (m *Resource) XXX_DiscardUnknown() { + xxx_messageInfo_Resource.DiscardUnknown(m) +} + +var xxx_messageInfo_Resource proto.InternalMessageInfo + +func (m *Resource) GetName() *ResourceName { + if m != nil { + return m.Name + } + return nil +} + +func (m *Resource) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *Resource) GetResource() *any.Any { + if m != nil { + return m.Resource + } + return nil +} + +func init() { + proto.RegisterType((*Resource)(nil), "udpa.core.v1.Resource") +} + +func init() { proto.RegisterFile("udpa/core/v1/resource.proto", fileDescriptor_3bc3fd9d360e95ec) } + +var fileDescriptor_3bc3fd9d360e95ec = []byte{ + // 237 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x4d, 0x29, 0x48, + 0xd4, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0x4a, 0x2d, 0xce, 0x2f, 0x2d, 0x4a, + 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x49, 0xea, 0x81, 0x24, 0xf5, 0xca, + 0x0c, 0xa5, 0x24, 0xd3, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0xc1, 0x72, 0x49, 0xa5, 0x69, 0xfa, + 0x89, 0x79, 0x95, 0x10, 0x85, 0x52, 0xb2, 0x60, 0x53, 0x12, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, + 0x32, 0xf3, 0xf3, 0x8a, 0xf5, 0x8b, 0x4b, 0x12, 0x4b, 0x4a, 0x8b, 0xa1, 0xd2, 0x0a, 0x58, 0x2d, + 0x89, 0xcf, 0x4b, 0xcc, 0x85, 0xda, 0xa4, 0xd4, 0xc6, 0xc8, 0xc5, 0x11, 0x04, 0x15, 0x17, 0xd2, + 0xe3, 0x62, 0x01, 0x49, 0x49, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xe9, 0x21, 0xbb, 0x42, + 0x0f, 0xa6, 0xca, 0x2f, 0x31, 0x37, 0x35, 0x08, 0xac, 0x4e, 0x48, 0x82, 0x8b, 0xbd, 0x2c, 0xb5, + 0xa8, 0x38, 0x33, 0x3f, 0x4f, 0x82, 0x49, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc6, 0x15, 0x32, 0xe0, + 0xe2, 0x80, 0xd9, 0x26, 0xc1, 0x0c, 0x36, 0x4d, 0x44, 0x0f, 0xe2, 0x0b, 0x3d, 0x98, 0x2f, 0xf4, + 0x1c, 0xf3, 0x2a, 0x83, 0xe0, 0xaa, 0x9c, 0xcc, 0x77, 0x35, 0x9c, 0xb8, 0xc8, 0xc6, 0xc4, 0xc1, + 0xc8, 0x25, 0x93, 0x9c, 0x9f, 0xab, 0x97, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0x04, 0x71, 0x01, 0xb2, + 0x33, 0x9c, 0x78, 0x61, 0xee, 0x08, 0x00, 0x99, 0x13, 0xc0, 0x98, 0xc4, 0x06, 0x36, 0xd0, 0x18, + 0x10, 0x00, 0x00, 0xff, 0xff, 0x06, 0x0a, 0x1d, 0xc1, 0x51, 0x01, 0x00, 0x00, +} diff --git a/go/udpa/core/v1/resource.pb.validate.go b/go/udpa/core/v1/resource.pb.validate.go new file mode 100644 index 0000000..a87c3fb --- /dev/null +++ b/go/udpa/core/v1/resource.pb.validate.go @@ -0,0 +1,123 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: udpa/core/v1/resource.proto + +package udpa_core_v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/golang/protobuf/ptypes" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = ptypes.DynamicAny{} +) + +// define the regex for a UUID once up-front +var _resource_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") + +// Validate checks the field values on Resource with the rules defined in the +// proto definition for this message. If any rules are violated, an error is returned. +func (m *Resource) Validate() error { + if m == nil { + return nil + } + + if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for Version + + if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + } + } + } + + return nil +} + +// ResourceValidationError is the validation error returned by +// Resource.Validate if the designated constraints aren't met. +type ResourceValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceValidationError) ErrorName() string { return "ResourceValidationError" } + +// Error satisfies the builtin error interface +func (e ResourceValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResource.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceValidationError{} diff --git a/go/udpa/core/v1/resource_locator.pb.go b/go/udpa/core/v1/resource_locator.pb.go new file mode 100644 index 0000000..890f861 --- /dev/null +++ b/go/udpa/core/v1/resource_locator.pb.go @@ -0,0 +1,281 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: udpa/core/v1/resource_locator.proto + +package udpa_core_v1 + +import ( + fmt "fmt" + _ "github.com/cncf/udpa/go/udpa/annotations" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + 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 + +type ResourceLocator_Schema int32 + +const ( + ResourceLocator_UDPA ResourceLocator_Schema = 0 + ResourceLocator_HTTP ResourceLocator_Schema = 1 + ResourceLocator_FILE ResourceLocator_Schema = 2 +) + +var ResourceLocator_Schema_name = map[int32]string{ + 0: "UDPA", + 1: "HTTP", + 2: "FILE", +} + +var ResourceLocator_Schema_value = map[string]int32{ + "UDPA": 0, + "HTTP": 1, + "FILE": 2, +} + +func (x ResourceLocator_Schema) String() string { + return proto.EnumName(ResourceLocator_Schema_name, int32(x)) +} + +func (ResourceLocator_Schema) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b10c84cf310f3232, []int{0, 0} +} + +type ResourceLocator struct { + Schema ResourceLocator_Schema `protobuf:"varint,1,opt,name=schema,proto3,enum=udpa.core.v1.ResourceLocator_Schema" json:"schema,omitempty"` + Id []string `protobuf:"bytes,2,rep,name=id,proto3" json:"id,omitempty"` + Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` + ResourceType string `protobuf:"bytes,4,opt,name=resource_type,json=resourceType,proto3" json:"resource_type,omitempty"` + // Types that are valid to be assigned to ContextParamSpecifier: + // *ResourceLocator_ExactContext + ContextParamSpecifier isResourceLocator_ContextParamSpecifier `protobuf_oneof:"context_param_specifier"` + Directives []*ResourceLocator_Directive `protobuf:"bytes,6,rep,name=directives,proto3" json:"directives,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResourceLocator) Reset() { *m = ResourceLocator{} } +func (m *ResourceLocator) String() string { return proto.CompactTextString(m) } +func (*ResourceLocator) ProtoMessage() {} +func (*ResourceLocator) Descriptor() ([]byte, []int) { + return fileDescriptor_b10c84cf310f3232, []int{0} +} + +func (m *ResourceLocator) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResourceLocator.Unmarshal(m, b) +} +func (m *ResourceLocator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResourceLocator.Marshal(b, m, deterministic) +} +func (m *ResourceLocator) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceLocator.Merge(m, src) +} +func (m *ResourceLocator) XXX_Size() int { + return xxx_messageInfo_ResourceLocator.Size(m) +} +func (m *ResourceLocator) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceLocator.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceLocator proto.InternalMessageInfo + +func (m *ResourceLocator) GetSchema() ResourceLocator_Schema { + if m != nil { + return m.Schema + } + return ResourceLocator_UDPA +} + +func (m *ResourceLocator) GetId() []string { + if m != nil { + return m.Id + } + return nil +} + +func (m *ResourceLocator) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *ResourceLocator) GetResourceType() string { + if m != nil { + return m.ResourceType + } + return "" +} + +type isResourceLocator_ContextParamSpecifier interface { + isResourceLocator_ContextParamSpecifier() +} + +type ResourceLocator_ExactContext struct { + ExactContext *ContextParams `protobuf:"bytes,5,opt,name=exact_context,json=exactContext,proto3,oneof"` +} + +func (*ResourceLocator_ExactContext) isResourceLocator_ContextParamSpecifier() {} + +func (m *ResourceLocator) GetContextParamSpecifier() isResourceLocator_ContextParamSpecifier { + if m != nil { + return m.ContextParamSpecifier + } + return nil +} + +func (m *ResourceLocator) GetExactContext() *ContextParams { + if x, ok := m.GetContextParamSpecifier().(*ResourceLocator_ExactContext); ok { + return x.ExactContext + } + return nil +} + +func (m *ResourceLocator) GetDirectives() []*ResourceLocator_Directive { + if m != nil { + return m.Directives + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ResourceLocator) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ResourceLocator_ExactContext)(nil), + } +} + +type ResourceLocator_Directive struct { + // Types that are valid to be assigned to Directive: + // *ResourceLocator_Directive_Alt + // *ResourceLocator_Directive_Entry + Directive isResourceLocator_Directive_Directive `protobuf_oneof:"directive"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResourceLocator_Directive) Reset() { *m = ResourceLocator_Directive{} } +func (m *ResourceLocator_Directive) String() string { return proto.CompactTextString(m) } +func (*ResourceLocator_Directive) ProtoMessage() {} +func (*ResourceLocator_Directive) Descriptor() ([]byte, []int) { + return fileDescriptor_b10c84cf310f3232, []int{0, 0} +} + +func (m *ResourceLocator_Directive) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResourceLocator_Directive.Unmarshal(m, b) +} +func (m *ResourceLocator_Directive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResourceLocator_Directive.Marshal(b, m, deterministic) +} +func (m *ResourceLocator_Directive) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceLocator_Directive.Merge(m, src) +} +func (m *ResourceLocator_Directive) XXX_Size() int { + return xxx_messageInfo_ResourceLocator_Directive.Size(m) +} +func (m *ResourceLocator_Directive) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceLocator_Directive.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceLocator_Directive proto.InternalMessageInfo + +type isResourceLocator_Directive_Directive interface { + isResourceLocator_Directive_Directive() +} + +type ResourceLocator_Directive_Alt struct { + Alt *ResourceLocator `protobuf:"bytes,1,opt,name=alt,proto3,oneof"` +} + +type ResourceLocator_Directive_Entry struct { + Entry string `protobuf:"bytes,2,opt,name=entry,proto3,oneof"` +} + +func (*ResourceLocator_Directive_Alt) isResourceLocator_Directive_Directive() {} + +func (*ResourceLocator_Directive_Entry) isResourceLocator_Directive_Directive() {} + +func (m *ResourceLocator_Directive) GetDirective() isResourceLocator_Directive_Directive { + if m != nil { + return m.Directive + } + return nil +} + +func (m *ResourceLocator_Directive) GetAlt() *ResourceLocator { + if x, ok := m.GetDirective().(*ResourceLocator_Directive_Alt); ok { + return x.Alt + } + return nil +} + +func (m *ResourceLocator_Directive) GetEntry() string { + if x, ok := m.GetDirective().(*ResourceLocator_Directive_Entry); ok { + return x.Entry + } + return "" +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ResourceLocator_Directive) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ResourceLocator_Directive_Alt)(nil), + (*ResourceLocator_Directive_Entry)(nil), + } +} + +func init() { + proto.RegisterEnum("udpa.core.v1.ResourceLocator_Schema", ResourceLocator_Schema_name, ResourceLocator_Schema_value) + proto.RegisterType((*ResourceLocator)(nil), "udpa.core.v1.ResourceLocator") + proto.RegisterType((*ResourceLocator_Directive)(nil), "udpa.core.v1.ResourceLocator.Directive") +} + +func init() { + proto.RegisterFile("udpa/core/v1/resource_locator.proto", fileDescriptor_b10c84cf310f3232) +} + +var fileDescriptor_b10c84cf310f3232 = []byte{ + // 484 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0x73, 0x76, 0x62, 0xe2, 0x4b, 0x0a, 0xd6, 0x09, 0x51, 0x13, 0x52, 0x61, 0x4a, 0x05, + 0x96, 0x20, 0x36, 0x31, 0x03, 0x82, 0x01, 0xa9, 0x47, 0x29, 0x41, 0xea, 0x60, 0x99, 0xb0, 0x40, + 0xc1, 0xba, 0xda, 0x07, 0x39, 0x29, 0xf1, 0x59, 0xe7, 0x73, 0xd4, 0x30, 0x20, 0xc4, 0xc6, 0xca, + 0xca, 0x37, 0xe1, 0x13, 0xb0, 0xf2, 0x6d, 0x50, 0x26, 0x64, 0x3b, 0x49, 0x93, 0x0e, 0xd9, 0x9e, + 0xee, 0xff, 0x7b, 0x4f, 0xff, 0xff, 0xbb, 0x07, 0xef, 0xe6, 0x71, 0x4a, 0xdc, 0x88, 0x0b, 0xea, + 0x4e, 0xfb, 0xae, 0xa0, 0x19, 0xcf, 0x45, 0x44, 0xc3, 0x31, 0x8f, 0x88, 0xe4, 0xc2, 0x49, 0x05, + 0x97, 0x1c, 0xb5, 0x0b, 0xc8, 0x29, 0x20, 0x67, 0xda, 0xef, 0xec, 0x95, 0x2d, 0x24, 0x49, 0xb8, + 0x24, 0x92, 0xf1, 0x24, 0x73, 0x33, 0x49, 0x64, 0x9e, 0x55, 0x70, 0xe7, 0xce, 0xc6, 0xc4, 0x88, + 0x27, 0x92, 0x9e, 0xcb, 0x30, 0x25, 0x82, 0x4c, 0x96, 0xc8, 0xee, 0x94, 0x8c, 0x59, 0x4c, 0x24, + 0x75, 0x97, 0x45, 0x25, 0xec, 0xff, 0xaa, 0xc3, 0x6b, 0xc1, 0xc2, 0xc3, 0x49, 0x65, 0x01, 0x1d, + 0x43, 0x2d, 0x8b, 0x46, 0x74, 0x42, 0x4c, 0x60, 0x01, 0xfb, 0xaa, 0x77, 0xe0, 0xac, 0xbb, 0x71, + 0x2e, 0xe1, 0xce, 0x9b, 0x92, 0xc5, 0xcd, 0x39, 0x6e, 0x7c, 0x07, 0x8a, 0x01, 0x82, 0x45, 0x37, + 0x32, 0xa1, 0xc2, 0x62, 0x53, 0xb1, 0x54, 0x5b, 0x2f, 0xd5, 0x9f, 0x40, 0x69, 0x82, 0x40, 0x61, + 0x31, 0xea, 0x42, 0x9d, 0xe4, 0x72, 0xc4, 0x05, 0x93, 0x33, 0x53, 0xb5, 0x80, 0xad, 0x07, 0x17, + 0x0f, 0xe8, 0x21, 0xdc, 0x59, 0xad, 0x45, 0xce, 0x52, 0x6a, 0xd6, 0x0b, 0x02, 0x5f, 0x99, 0xe3, + 0xba, 0x28, 0xe6, 0xb7, 0x97, 0xea, 0x70, 0x96, 0x52, 0x84, 0xe1, 0x0e, 0x3d, 0x27, 0x91, 0x0c, + 0x17, 0xc1, 0xcd, 0x86, 0x05, 0xec, 0x96, 0x77, 0x6b, 0xd3, 0xf4, 0x8b, 0x4a, 0xf4, 0xcb, 0xa5, + 0x0c, 0x6a, 0x41, 0xbb, 0xec, 0x59, 0xbc, 0xa2, 0x57, 0x10, 0xc6, 0x4c, 0xd0, 0x48, 0xb2, 0x29, + 0xcd, 0x4c, 0xcd, 0x52, 0xed, 0x96, 0x77, 0x7f, 0x7b, 0xea, 0xa3, 0x25, 0x1f, 0xac, 0xb5, 0x76, + 0x7e, 0x00, 0xa8, 0xaf, 0x14, 0xd4, 0x87, 0x2a, 0x19, 0xcb, 0x72, 0x8b, 0x2d, 0x6f, 0x6f, 0xeb, + 0xbc, 0x41, 0x2d, 0x28, 0x58, 0xf4, 0x04, 0x36, 0x68, 0x22, 0xc5, 0xcc, 0x54, 0xca, 0xcc, 0xb7, + 0xe7, 0xb8, 0x2b, 0x3a, 0x06, 0xf0, 0x6e, 0x7c, 0x7c, 0xff, 0xa8, 0xf7, 0x94, 0xf4, 0xbe, 0x1c, + 0xf6, 0xde, 0x85, 0xa7, 0xbd, 0x53, 0xc7, 0xfd, 0xfa, 0xec, 0xc3, 0x83, 0x83, 0x41, 0x2d, 0xa8, + 0x78, 0x6c, 0x40, 0x7d, 0xe5, 0x03, 0xa9, 0xff, 0x30, 0xd8, 0xbf, 0x07, 0xb5, 0xea, 0x6b, 0x50, + 0x13, 0xd6, 0xdf, 0x1e, 0xf9, 0x87, 0x46, 0xad, 0xa8, 0x06, 0xc3, 0xa1, 0x6f, 0x80, 0xa2, 0x3a, + 0x7e, 0x7d, 0xf2, 0xd2, 0x50, 0xf0, 0x4d, 0xb8, 0xbb, 0x71, 0x33, 0x61, 0x96, 0xd2, 0x88, 0x7d, + 0x62, 0x54, 0xe0, 0xe7, 0xbf, 0xbf, 0xfd, 0xf9, 0xab, 0x29, 0x4d, 0x00, 0xbb, 0x11, 0x9f, 0x38, + 0x9f, 0x99, 0x1c, 0xe5, 0x67, 0x55, 0x8e, 0xf5, 0x30, 0xf8, 0xfa, 0xa5, 0x34, 0x7e, 0x71, 0x5b, + 0x3e, 0x38, 0xd3, 0xca, 0x23, 0x7b, 0xfc, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x4e, 0xe4, 0x16, + 0xf4, 0x02, 0x00, 0x00, +} diff --git a/go/udpa/core/v1/resource_locator.pb.validate.go b/go/udpa/core/v1/resource_locator.pb.validate.go new file mode 100644 index 0000000..93f9dc0 --- /dev/null +++ b/go/udpa/core/v1/resource_locator.pb.validate.go @@ -0,0 +1,263 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: udpa/core/v1/resource_locator.proto + +package udpa_core_v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/golang/protobuf/ptypes" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = ptypes.DynamicAny{} +) + +// define the regex for a UUID once up-front +var _resource_locator_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") + +// Validate checks the field values on ResourceLocator with the rules defined +// in the proto definition for this message. If any rules are violated, an +// error is returned. +func (m *ResourceLocator) Validate() error { + if m == nil { + return nil + } + + if _, ok := ResourceLocator_Schema_name[int32(m.GetSchema())]; !ok { + return ResourceLocatorValidationError{ + field: "Schema", + reason: "value must be one of the defined enum values", + } + } + + if len(m.GetId()) < 1 { + return ResourceLocatorValidationError{ + field: "Id", + reason: "value must contain at least 1 item(s)", + } + } + + // no validation rules for Authority + + if utf8.RuneCountInString(m.GetResourceType()) < 1 { + return ResourceLocatorValidationError{ + field: "ResourceType", + reason: "value length must be at least 1 runes", + } + } + + for idx, item := range m.GetDirectives() { + _, _ = idx, item + + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceLocatorValidationError{ + field: fmt.Sprintf("Directives[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + switch m.ContextParamSpecifier.(type) { + + case *ResourceLocator_ExactContext: + + if v, ok := interface{}(m.GetExactContext()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceLocatorValidationError{ + field: "ExactContext", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + return nil +} + +// ResourceLocatorValidationError is the validation error returned by +// ResourceLocator.Validate if the designated constraints aren't met. +type ResourceLocatorValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceLocatorValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceLocatorValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceLocatorValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceLocatorValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceLocatorValidationError) ErrorName() string { return "ResourceLocatorValidationError" } + +// Error satisfies the builtin error interface +func (e ResourceLocatorValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceLocator.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceLocatorValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceLocatorValidationError{} + +// Validate checks the field values on ResourceLocator_Directive with the rules +// defined in the proto definition for this message. If any rules are +// violated, an error is returned. +func (m *ResourceLocator_Directive) Validate() error { + if m == nil { + return nil + } + + switch m.Directive.(type) { + + case *ResourceLocator_Directive_Alt: + + if v, ok := interface{}(m.GetAlt()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceLocator_DirectiveValidationError{ + field: "Alt", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ResourceLocator_Directive_Entry: + + if utf8.RuneCountInString(m.GetEntry()) < 1 { + return ResourceLocator_DirectiveValidationError{ + field: "Entry", + reason: "value length must be at least 1 runes", + } + } + + if !_ResourceLocator_Directive_Entry_Pattern.MatchString(m.GetEntry()) { + return ResourceLocator_DirectiveValidationError{ + field: "Entry", + reason: "value does not match regex pattern \"^[0-9a-zA-Z_\\\\-\\\\./~:]+$\"", + } + } + + default: + return ResourceLocator_DirectiveValidationError{ + field: "Directive", + reason: "value is required", + } + + } + + return nil +} + +// ResourceLocator_DirectiveValidationError is the validation error returned by +// ResourceLocator_Directive.Validate if the designated constraints aren't met. +type ResourceLocator_DirectiveValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceLocator_DirectiveValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceLocator_DirectiveValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceLocator_DirectiveValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceLocator_DirectiveValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceLocator_DirectiveValidationError) ErrorName() string { + return "ResourceLocator_DirectiveValidationError" +} + +// Error satisfies the builtin error interface +func (e ResourceLocator_DirectiveValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceLocator_Directive.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceLocator_DirectiveValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceLocator_DirectiveValidationError{} + +var _ResourceLocator_Directive_Entry_Pattern = regexp.MustCompile("^[0-9a-zA-Z_\\-\\./~:]+$") diff --git a/go/udpa/core/v1/resource_name.pb.go b/go/udpa/core/v1/resource_name.pb.go new file mode 100644 index 0000000..96f3a47 --- /dev/null +++ b/go/udpa/core/v1/resource_name.pb.go @@ -0,0 +1,114 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: udpa/core/v1/resource_name.proto + +package udpa_core_v1 + +import ( + fmt "fmt" + _ "github.com/cncf/udpa/go/udpa/annotations" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + 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 + +type ResourceName struct { + Id []string `protobuf:"bytes,1,rep,name=id,proto3" json:"id,omitempty"` + Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` + ResourceType string `protobuf:"bytes,3,opt,name=resource_type,json=resourceType,proto3" json:"resource_type,omitempty"` + Context *ContextParams `protobuf:"bytes,4,opt,name=context,proto3" json:"context,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResourceName) Reset() { *m = ResourceName{} } +func (m *ResourceName) String() string { return proto.CompactTextString(m) } +func (*ResourceName) ProtoMessage() {} +func (*ResourceName) Descriptor() ([]byte, []int) { + return fileDescriptor_cadec11c867fca74, []int{0} +} + +func (m *ResourceName) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ResourceName.Unmarshal(m, b) +} +func (m *ResourceName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ResourceName.Marshal(b, m, deterministic) +} +func (m *ResourceName) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceName.Merge(m, src) +} +func (m *ResourceName) XXX_Size() int { + return xxx_messageInfo_ResourceName.Size(m) +} +func (m *ResourceName) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceName.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceName proto.InternalMessageInfo + +func (m *ResourceName) GetId() []string { + if m != nil { + return m.Id + } + return nil +} + +func (m *ResourceName) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *ResourceName) GetResourceType() string { + if m != nil { + return m.ResourceType + } + return "" +} + +func (m *ResourceName) GetContext() *ContextParams { + if m != nil { + return m.Context + } + return nil +} + +func init() { + proto.RegisterType((*ResourceName)(nil), "udpa.core.v1.ResourceName") +} + +func init() { proto.RegisterFile("udpa/core/v1/resource_name.proto", fileDescriptor_cadec11c867fca74) } + +var fileDescriptor_cadec11c867fca74 = []byte{ + // 280 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0x41, 0x4e, 0x83, 0x40, + 0x14, 0x86, 0x33, 0xd3, 0xda, 0xc2, 0x88, 0x89, 0xb2, 0x91, 0xd4, 0x9a, 0xa0, 0x2b, 0x16, 0x66, + 0x48, 0x35, 0xae, 0xdc, 0x8d, 0x7b, 0x43, 0x88, 0xfb, 0xe6, 0x15, 0x26, 0x76, 0x12, 0x61, 0xc8, + 0xf0, 0x20, 0xb2, 0xf3, 0x0c, 0x5e, 0xc3, 0x1b, 0x78, 0x02, 0xb7, 0x5e, 0xa7, 0x2b, 0x03, 0x14, + 0xa5, 0xbb, 0xc9, 0xfc, 0xdf, 0xff, 0xf2, 0x7f, 0xcc, 0xaf, 0xd2, 0x02, 0xc2, 0x44, 0x1b, 0x19, + 0xd6, 0xab, 0xd0, 0xc8, 0x52, 0x57, 0x26, 0x91, 0xeb, 0x1c, 0x32, 0xc9, 0x0b, 0xa3, 0x51, 0xbb, + 0x4e, 0x4b, 0xf0, 0x96, 0xe0, 0xf5, 0x6a, 0x71, 0xd9, 0xf1, 0x90, 0xe7, 0x1a, 0x01, 0x95, 0xce, + 0xcb, 0xb0, 0x44, 0xc0, 0xaa, 0xec, 0xe1, 0xc5, 0xd5, 0xc1, 0xb9, 0x44, 0xe7, 0x28, 0xdf, 0x70, + 0x5d, 0x80, 0x81, 0x6c, 0x40, 0xce, 0x6b, 0x78, 0x55, 0x29, 0xa0, 0x0c, 0x87, 0x47, 0x1f, 0x5c, + 0x7f, 0x12, 0xe6, 0xc4, 0xfb, 0x01, 0x4f, 0x90, 0x49, 0xd7, 0x63, 0x54, 0xa5, 0x1e, 0xf1, 0x27, + 0x81, 0x2d, 0xac, 0x9d, 0x38, 0xfa, 0x20, 0xd4, 0x22, 0x31, 0x55, 0xa9, 0xbb, 0x64, 0x36, 0x54, + 0xb8, 0xd5, 0x46, 0x61, 0xe3, 0x51, 0x9f, 0x04, 0x76, 0xfc, 0xff, 0xe1, 0xde, 0xb0, 0x93, 0x3f, + 0x11, 0x6c, 0x0a, 0xe9, 0x4d, 0x5a, 0x42, 0xcc, 0x77, 0x62, 0x6a, 0xe8, 0x29, 0x89, 0x9d, 0x21, + 0x7d, 0x6e, 0x0a, 0xe9, 0xde, 0xb3, 0xf9, 0x7e, 0xa7, 0x37, 0xf5, 0x49, 0x70, 0x7c, 0x7b, 0xc1, + 0xc7, 0xc6, 0xfc, 0xb1, 0x0f, 0xa3, 0xce, 0x21, 0x1e, 0x58, 0xf1, 0xf0, 0xf5, 0xfe, 0xfd, 0x33, + 0xa3, 0x16, 0x61, 0xcb, 0x44, 0x67, 0xfc, 0x45, 0xe1, 0xb6, 0xda, 0xf4, 0xcd, 0x71, 0x5d, 0x9c, + 0x8d, 0x95, 0xa2, 0x56, 0x34, 0x22, 0x9b, 0x59, 0x67, 0x7c, 0xf7, 0x1b, 0x00, 0x00, 0xff, 0xff, + 0x4e, 0xc6, 0x95, 0x08, 0x7e, 0x01, 0x00, 0x00, +} diff --git a/go/udpa/core/v1/resource_name.pb.validate.go b/go/udpa/core/v1/resource_name.pb.validate.go new file mode 100644 index 0000000..ef9df0f --- /dev/null +++ b/go/udpa/core/v1/resource_name.pb.validate.go @@ -0,0 +1,128 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: udpa/core/v1/resource_name.proto + +package udpa_core_v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "strings" + "time" + "unicode/utf8" + + "github.com/golang/protobuf/ptypes" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = ptypes.DynamicAny{} +) + +// define the regex for a UUID once up-front +var _resource_name_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") + +// Validate checks the field values on ResourceName with the rules defined in +// the proto definition for this message. If any rules are violated, an error +// is returned. +func (m *ResourceName) Validate() error { + if m == nil { + return nil + } + + if len(m.GetId()) < 1 { + return ResourceNameValidationError{ + field: "Id", + reason: "value must contain at least 1 item(s)", + } + } + + // no validation rules for Authority + + if utf8.RuneCountInString(m.GetResourceType()) < 1 { + return ResourceNameValidationError{ + field: "ResourceType", + reason: "value length must be at least 1 runes", + } + } + + if v, ok := interface{}(m.GetContext()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ResourceNameValidationError{ + field: "Context", + reason: "embedded message failed validation", + cause: err, + } + } + } + + return nil +} + +// ResourceNameValidationError is the validation error returned by +// ResourceName.Validate if the designated constraints aren't met. +type ResourceNameValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ResourceNameValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ResourceNameValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ResourceNameValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ResourceNameValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ResourceNameValidationError) ErrorName() string { return "ResourceNameValidationError" } + +// Error satisfies the builtin error interface +func (e ResourceNameValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sResourceName.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ResourceNameValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ResourceNameValidationError{} diff --git a/udpa/core/v1/BUILD b/udpa/core/v1/BUILD new file mode 100644 index 0000000..7ce8b05 --- /dev/null +++ b/udpa/core/v1/BUILD @@ -0,0 +1,5 @@ +load("//bazel:api_build_system.bzl", "udpa_proto_package") + +licenses(["notice"]) # Apache 2 + +udpa_proto_package(deps = ["//udpa/annotations:pkg"]) diff --git a/udpa/core/v1/authority.proto b/udpa/core/v1/authority.proto new file mode 100644 index 0000000..f250a6c --- /dev/null +++ b/udpa/core/v1/authority.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package udpa.core.v1; + +import "udpa/annotations/status.proto"; + +import "validate/validate.proto"; + +option java_outer_classname = "AuthorityProto"; +option java_multiple_files = true; +option java_package = "com.github.udpa.udpa.core.v1"; + +option (udpa.annotations.file_status).work_in_progress = true; + +// UDPA authority information. +message Authority { + string name = 1 [(validate.rules).string = {min_len: 1}]; + + // .. space reserved for additional authority addressing information, e.g. for + // resource signing, items such as CA trust chain, cert pinning may be added. +} diff --git a/udpa/core/v1/collection_entry.proto b/udpa/core/v1/collection_entry.proto new file mode 100644 index 0000000..8e4f0c8 --- /dev/null +++ b/udpa/core/v1/collection_entry.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package udpa.core.v1; + +import "google/protobuf/any.proto"; + +import "udpa/annotations/status.proto"; +import "udpa/core/v1/resource_locator.proto"; + +import "validate/validate.proto"; + +option java_outer_classname = "CollectionEntryProto"; +option java_multiple_files = true; +option java_package = "com.github.udpa.udpa.core.v1"; + +option (udpa.annotations.file_status).work_in_progress = true; + +// UDPA collection resource wrapper. This encapsulates a UDPA resource when +// appearing inside a list collection resource. List collection resources are +// regular Resource messages of type: +// +// message Collection { +// repeated CollectionEntry resources = 1; +// } +// +message CollectionEntry { + // Inlined resource entry. + message InlineEntry { + // Optional name to describe the inlined resource. Resource names must + // [a-zA-Z0-9_-\./]+ (TODO(htuch): turn this into a PGV constraint once + // finalized, probably should be a RFC3986 pchar). This name allows + // reference via the #entry directive in ResourceLocator. + string name = 1 [(validate.rules).string.pattern = "^[0-9a-zA-Z_\\-\\.~:]+$"]; + + // The resource's logical version. It is illegal to have the same named UDPA + // resource name at a given version with different resource payloads. + string version = 2; + + // The resource payload, including type URL. + google.protobuf.Any resource = 3; + } + + oneof resource_specifier { + option (validate.required) = true; + + // A resource locator describing how the member resource is to be located. + ResourceLocator locator = 1; + + // The resource is inlined in the list collection. + InlineEntry inline_entry = 2; + } +} diff --git a/udpa/core/v1/context_params.proto b/udpa/core/v1/context_params.proto new file mode 100644 index 0000000..ccc4638 --- /dev/null +++ b/udpa/core/v1/context_params.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package udpa.core.v1; + +import "udpa/annotations/status.proto"; + +option java_outer_classname = "ContextParamsProto"; +option java_multiple_files = true; +option java_package = "com.github.udpa.udpa.core.v1"; + +option (udpa.annotations.file_status).work_in_progress = true; + +// Additional parameters that can be used to select resource variants. +message ContextParams { + map params = 1; +} diff --git a/udpa/core/v1/resource.proto b/udpa/core/v1/resource.proto new file mode 100644 index 0000000..780a12e --- /dev/null +++ b/udpa/core/v1/resource.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +package udpa.core.v1; + +import "google/protobuf/any.proto"; + +import "udpa/annotations/status.proto"; +import "udpa/core/v1/resource_name.proto"; + +option java_outer_classname = "ResourceProto"; +option java_multiple_files = true; +option java_package = "com.github.udpa.udpa.core.v1"; + +option (udpa.annotations.file_status).work_in_progress = true; + +// UDPA resource wrapper. This encapsulates a UDPA resource when appearing in an +// xDS transport discovery response or when accessed as a filesystem object. +message Resource { + // Resource name. This may be omitted for filesystem resources. + ResourceName name = 1; + + // The resource's logical version. It is illegal to have the same named UDPA + // resource name at a given version with different resource payloads. + string version = 2; + + // The resource payload, including type URL. + google.protobuf.Any resource = 3; +} diff --git a/udpa/core/v1/resource_locator.proto b/udpa/core/v1/resource_locator.proto new file mode 100644 index 0000000..aadccee --- /dev/null +++ b/udpa/core/v1/resource_locator.proto @@ -0,0 +1,97 @@ +syntax = "proto3"; + +package udpa.core.v1; + +import "udpa/annotations/status.proto"; +import "udpa/core/v1/context_params.proto"; + +import "validate/validate.proto"; + +option java_outer_classname = "ResourceLocatorProto"; +option java_multiple_files = true; +option java_package = "com.github.udpa.udpa.core.v1"; + +option (udpa.annotations.file_status).work_in_progress = true; + +// UDPA resource locators identify a UDPA resource name and instruct the +// data-plane load balancer on how the resource may be located. +// +// Resource locators have a canonical udpa:// URI representation: +// +// udpa://{authority}/{type_url}/{id/*}?{context_params}{#directive*} +// +// where context_params take the form of URI query parameters. +// +// Resource locators have a similar canonical http:// URI representation: +// +// http://{authority}/{type_url}/{id/*}?{context_params}{#directive*} +// +// Resource locators also have a simplified file:// URI representation: +// +// file:///{id/*}{#directive*} +// +message ResourceLocator { + enum Schema { + UDPA = 0; + HTTP = 1; + FILE = 2; + } + + // URI schema. + Schema schema = 1 [(validate.rules).enum = {defined_only: true}]; + + // Opaque identifiers for the resource. These are effectively concatenated + // with ‘/’ to form the non-query param path as resource ID. This may end + // with ‘*’ for glob collection references. + repeated string id = 2 [(validate.rules).repeated = {min_items: 1}]; + + // Logical authority for resource (not necessarily transport network address). + // Authorities are opaque in the UDPA API, data-plane load balancers will map + // them to concrete network transports such as an xDS management server, e.g. + // via envoy.config.core.v3.ConfigSource. + string authority = 3; + + // Fully qualified resource type (as in type URL without types.googleapis.com/ + // prefix). + string resource_type = 4 [(validate.rules).string = {min_len: 1}]; + + oneof context_param_specifier { + // Additional parameters that can be used to select resource variants. + // Matches must be exact, i.e. all context parameters must match exactly and + // there must be no additional context parameters set on the matched + // resource. + ContextParams exact_context = 5; + + // .. space reserved for future potential matchers, e.g. CEL expressions. + } + + // Directives provide information to data-plane load balancers on how UDPA + // resource names are to be resolved. For example, they may provide + // alternative resource locators for when primary resolution fails. Directives + // are not part of resource names and do not appear in a xDS transport discovery + // request. + message Directive { + oneof directive { + option (validate.required) = true; + + // An alternative resource locator for fallback if the resource is + // unavailable. For example, take the resource locator: + // + // udpa://foo/some-type/some-route-table#alt=udpa://bar/some-type/another-route-table. + // + // If the data-plane load balancer is unable to reach `foo` to fetch the + // resource, it will fallback to `bar`. Alternative resources do not need + // to have equivalent content, but they should be functional substitutes. + ResourceLocator alt = 1; + + // List collections support inlining of resources via the entry field in + // Resource. These inlined Resource objects may have an optional name + // field specified. When specified, the entry directive allows + // UdpaResourceLocator to directly reference these inlined resources, e.g. + // udpa://.../foo#entry=bar. + string entry = 2 [(validate.rules).string = {min_len: 1, pattern: "^[0-9a-zA-Z_\\-\\./~:]+$"}]; + } + } + + repeated Directive directives = 6; +} diff --git a/udpa/core/v1/resource_name.proto b/udpa/core/v1/resource_name.proto new file mode 100644 index 0000000..d618885 --- /dev/null +++ b/udpa/core/v1/resource_name.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; + +package udpa.core.v1; + +import "udpa/annotations/status.proto"; +import "udpa/core/v1/context_params.proto"; + +import "validate/validate.proto"; + +option java_outer_classname = "ResourceNameProto"; +option java_multiple_files = true; +option java_package = "com.github.udpa.udpa.core.v1"; + +option (udpa.annotations.file_status).work_in_progress = true; + +// UDPA resource name. This has a canonical udpa:// URI representation: +// +// udpa://{authority}/{type_url}/{id/*}?{context_params} +// +// where context_params take the form of URI query parameters. +// +// A UDPA resource name fully identifies a network resource for transport +// purposes. UDPA resource names in this form appear only in discovery +// request/response messages used with the xDS transport. +message ResourceName { + // Opaque identifiers for the resource. These are effectively concatenated + // with ‘/’ to form the non-query param path as resource ID. + repeated string id = 1 [(validate.rules).repeated = {min_items: 1}]; + + // Logical authority for resource (not necessarily transport network address). + // Authorities are opaque in the UDPA API, data-plane load balancers will map + // them to concrete network transports such as an xDS management server. + string authority = 2; + + // Fully qualified resource type (as in type URL without types.googleapis.com/ + // prefix). + string resource_type = 3 [(validate.rules).string = {min_len: 1}]; + + // Additional parameters that can be used to select resource variants. + ContextParams context = 4; +}