From a890fd498d032209bae79358a3d75ba0fdb5f1d9 Mon Sep 17 00:00:00 2001 From: Gabriele Gerbino Date: Thu, 21 Jul 2022 16:07:42 +0200 Subject: [PATCH] feat: expand upstreams model and validation for 3.0 --- .../grpc/kong/admin/model/v1/upstream.pb.go | 293 ++++++++++-------- internal/gen/jsonschema/schemas/upstream.json | 178 ++++++++++- internal/gen/swagger/koko.swagger.json | 24 ++ .../proto/kong/admin/model/v1/upstream.proto | 4 + internal/resource/upstream.go | 210 ++++++++++++- internal/resource/upstream_test.go | 158 +++++++++- 6 files changed, 724 insertions(+), 143 deletions(-) diff --git a/internal/gen/grpc/kong/admin/model/v1/upstream.pb.go b/internal/gen/grpc/kong/admin/model/v1/upstream.pb.go index 3f6183e8f..a10939b42 100644 --- a/internal/gen/grpc/kong/admin/model/v1/upstream.pb.go +++ b/internal/gen/grpc/kong/admin/model/v1/upstream.pb.go @@ -26,22 +26,26 @@ type Upstream struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` - CreatedAt int32 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - UpdatedAt int32 `protobuf:"varint,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` - HashOn string `protobuf:"bytes,6,opt,name=hash_on,json=hashOn,proto3" json:"hash_on,omitempty"` - HashFallback string `protobuf:"bytes,7,opt,name=hash_fallback,json=hashFallback,proto3" json:"hash_fallback,omitempty"` - HashOnHeader string `protobuf:"bytes,8,opt,name=hash_on_header,json=hashOnHeader,proto3" json:"hash_on_header,omitempty"` - HashFallbackHeader string `protobuf:"bytes,9,opt,name=hash_fallback_header,json=hashFallbackHeader,proto3" json:"hash_fallback_header,omitempty"` - HashOnCookie string `protobuf:"bytes,10,opt,name=hash_on_cookie,json=hashOnCookie,proto3" json:"hash_on_cookie,omitempty"` - HashOnCookiePath string `protobuf:"bytes,11,opt,name=hash_on_cookie_path,json=hashOnCookiePath,proto3" json:"hash_on_cookie_path,omitempty"` - Slots *wrapperspb.Int32Value `protobuf:"bytes,12,opt,name=slots,proto3" json:"slots,omitempty"` - Healthchecks *Healthchecks `protobuf:"bytes,13,opt,name=healthchecks,proto3" json:"healthchecks,omitempty"` - Tags []string `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"` - HostHeader string `protobuf:"bytes,15,opt,name=host_header,json=hostHeader,proto3" json:"host_header,omitempty"` - ClientCertificate *Certificate `protobuf:"bytes,16,opt,name=client_certificate,json=clientCertificate,proto3" json:"client_certificate,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` + CreatedAt int32 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt int32 `protobuf:"varint,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + HashOn string `protobuf:"bytes,6,opt,name=hash_on,json=hashOn,proto3" json:"hash_on,omitempty"` + HashFallback string `protobuf:"bytes,7,opt,name=hash_fallback,json=hashFallback,proto3" json:"hash_fallback,omitempty"` + HashOnHeader string `protobuf:"bytes,8,opt,name=hash_on_header,json=hashOnHeader,proto3" json:"hash_on_header,omitempty"` + HashFallbackHeader string `protobuf:"bytes,9,opt,name=hash_fallback_header,json=hashFallbackHeader,proto3" json:"hash_fallback_header,omitempty"` + HashOnCookie string `protobuf:"bytes,10,opt,name=hash_on_cookie,json=hashOnCookie,proto3" json:"hash_on_cookie,omitempty"` + HashOnCookiePath string `protobuf:"bytes,11,opt,name=hash_on_cookie_path,json=hashOnCookiePath,proto3" json:"hash_on_cookie_path,omitempty"` + Slots *wrapperspb.Int32Value `protobuf:"bytes,12,opt,name=slots,proto3" json:"slots,omitempty"` + Healthchecks *Healthchecks `protobuf:"bytes,13,opt,name=healthchecks,proto3" json:"healthchecks,omitempty"` + Tags []string `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"` + HostHeader string `protobuf:"bytes,15,opt,name=host_header,json=hostHeader,proto3" json:"host_header,omitempty"` + ClientCertificate *Certificate `protobuf:"bytes,16,opt,name=client_certificate,json=clientCertificate,proto3" json:"client_certificate,omitempty"` + HashOnQueryArg string `protobuf:"bytes,17,opt,name=hash_on_query_arg,json=hashOnQueryArg,proto3" json:"hash_on_query_arg,omitempty"` + HashFallbackQueryArg string `protobuf:"bytes,18,opt,name=hash_fallback_query_arg,json=hashFallbackQueryArg,proto3" json:"hash_fallback_query_arg,omitempty"` + HashOnUriCapture string `protobuf:"bytes,19,opt,name=hash_on_uri_capture,json=hashOnUriCapture,proto3" json:"hash_on_uri_capture,omitempty"` + HashFallbackUriCapture string `protobuf:"bytes,20,opt,name=hash_fallback_uri_capture,json=hashFallbackUriCapture,proto3" json:"hash_fallback_uri_capture,omitempty"` } func (x *Upstream) Reset() { @@ -188,6 +192,34 @@ func (x *Upstream) GetClientCertificate() *Certificate { return nil } +func (x *Upstream) GetHashOnQueryArg() string { + if x != nil { + return x.HashOnQueryArg + } + return "" +} + +func (x *Upstream) GetHashFallbackQueryArg() string { + if x != nil { + return x.HashFallbackQueryArg + } + return "" +} + +func (x *Upstream) GetHashOnUriCapture() string { + if x != nil { + return x.HashOnUriCapture + } + return "" +} + +func (x *Upstream) GetHashFallbackUriCapture() string { + if x != nil { + return x.HashFallbackUriCapture + } + return "" +} + type Healthchecks struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -696,7 +728,7 @@ var file_kong_admin_model_v1_upstream_proto_rawDesc = []byte{ 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x6b, 0x6f, 0x6e, 0x67, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0xf5, 0x04, 0x0a, 0x08, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0e, 0x0a, + 0x22, 0xc1, 0x06, 0x0a, 0x08, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x03, @@ -735,119 +767,132 @@ var file_kong_admin_model_v1_upstream_proto_rawDesc = []byte{ 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x11, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, - 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x22, 0xcc, 0x01, 0x0a, 0x0c, 0x48, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0x3e, 0x0a, 0x06, 0x61, 0x63, 0x74, - 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x29, 0x0a, 0x11, 0x68, 0x61, 0x73, 0x68, + 0x5f, 0x6f, 0x6e, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x61, 0x72, 0x67, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x68, 0x61, 0x73, 0x68, 0x4f, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x41, 0x72, 0x67, 0x12, 0x35, 0x0a, 0x17, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x66, 0x61, 0x6c, 0x6c, + 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x61, 0x72, 0x67, 0x18, 0x12, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x68, 0x61, 0x73, 0x68, 0x46, 0x61, 0x6c, 0x6c, 0x62, 0x61, + 0x63, 0x6b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x72, 0x67, 0x12, 0x2d, 0x0a, 0x13, 0x68, 0x61, + 0x73, 0x68, 0x5f, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x69, 0x5f, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, + 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x68, 0x61, 0x73, 0x68, 0x4f, 0x6e, 0x55, + 0x72, 0x69, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x12, 0x39, 0x0a, 0x19, 0x68, 0x61, 0x73, + 0x68, 0x5f, 0x66, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x75, 0x72, 0x69, 0x5f, 0x63, + 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x68, 0x61, + 0x73, 0x68, 0x46, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x55, 0x72, 0x69, 0x43, 0x61, 0x70, + 0x74, 0x75, 0x72, 0x65, 0x22, 0xcc, 0x01, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0x3e, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, 0x6d, + 0x69, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x06, 0x61, + 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x70, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, + 0x6d, 0x69, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, + 0x73, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, + 0x07, 0x70, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x12, 0x39, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, + 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x6c, + 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, + 0x6f, 0x6c, 0x64, 0x22, 0xc1, 0x03, 0x0a, 0x11, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, + 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x3d, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x45, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, - 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, - 0x6b, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x70, 0x61, 0x73, - 0x73, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6b, 0x6f, 0x6e, - 0x67, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, - 0x2e, 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x52, 0x07, 0x70, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x12, 0x39, 0x0a, 0x09, - 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x74, 0x68, - 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x22, 0xc1, 0x03, 0x0a, 0x11, 0x41, 0x63, 0x74, 0x69, - 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x3d, 0x0a, - 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, - 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x45, 0x0a, 0x07, - 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, + 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, + 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x12, + 0x1b, 0x0a, 0x09, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, + 0x68, 0x74, 0x74, 0x70, 0x73, 0x5f, 0x73, 0x6e, 0x69, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x68, 0x74, 0x74, 0x70, 0x73, 0x53, 0x6e, 0x69, 0x12, 0x54, 0x0a, 0x18, 0x68, 0x74, 0x74, + 0x70, 0x73, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, + 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x16, 0x68, 0x74, 0x74, 0x70, 0x73, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x79, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x75, 0x6e, + 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x68, 0x65, 0x61, 0x6c, - 0x74, 0x68, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x68, - 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x74, 0x74, 0x70, 0x73, 0x5f, 0x73, 0x6e, 0x69, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x74, 0x74, 0x70, 0x73, 0x53, 0x6e, 0x69, 0x12, 0x54, 0x0a, - 0x18, 0x68, 0x74, 0x74, 0x70, 0x73, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x63, 0x65, - 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x16, 0x68, 0x74, 0x74, - 0x70, 0x73, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x4b, - 0x0a, 0x09, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2d, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x55, 0x6e, - 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x09, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x22, 0xbe, 0x01, 0x0a, 0x12, - 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x12, 0x46, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, - 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, - 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x07, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x4c, - 0x0a, 0x09, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2e, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x55, - 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x09, 0x75, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x22, 0xb1, 0x01, 0x0a, - 0x16, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, + 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x55, 0x6e, 0x68, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x75, 0x6e, + 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x22, 0xbe, 0x01, 0x0a, 0x12, 0x50, 0x61, 0x73, 0x73, + 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x46, + 0x0a, 0x07, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x68, + 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x4c, 0x0a, 0x09, 0x75, 0x6e, + 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, + 0x6b, 0x6f, 0x6e, 0x67, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x55, 0x6e, 0x68, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x75, + 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x22, 0xb1, 0x01, 0x0a, 0x16, 0x41, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, + 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, + 0x6c, 0x12, 0x39, 0x0a, 0x09, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x09, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x22, 0x79, 0x0a, 0x17, + 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, - 0x68, 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x08, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x39, 0x0a, 0x09, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, - 0x22, 0x79, 0x0a, 0x17, 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x68, - 0x74, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x05, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, - 0x12, 0x39, 0x0a, 0x09, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x09, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x22, 0xb3, 0x02, 0x0a, 0x18, - 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x55, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, - 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, - 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x68, 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x09, + 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x68, 0x74, - 0x74, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x74, 0x63, - 0x70, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x74, - 0x63, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x74, - 0x74, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x05, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, - 0x37, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x76, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, - 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, - 0x6c, 0x22, 0xfb, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x55, 0x6e, 0x68, - 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x40, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x73, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x22, 0xb3, 0x02, 0x0a, 0x18, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x65, 0x55, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x66, 0x61, 0x69, + 0x6c, 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, + 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x46, 0x61, + 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x74, 0x63, 0x70, 0x5f, 0x66, 0x61, + 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, + 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x74, 0x63, 0x70, 0x46, 0x61, + 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x68, + 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x74, + 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, + 0x6f, 0x75, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, - 0x73, 0x12, 0x3e, 0x0a, 0x0c, 0x74, 0x63, 0x70, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x74, 0x63, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, - 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, - 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x73, 0x42, - 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x6f, - 0x6e, 0x67, 0x2f, 0x6b, 0x6f, 0x6b, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6b, 0x6f, 0x6e, 0x67, 0x2f, 0x61, - 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x75, 0x65, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x22, 0xfb, 0x01, + 0x0a, 0x19, 0x50, 0x61, 0x73, 0x73, 0x69, 0x76, 0x65, 0x55, 0x6e, 0x68, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x79, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x0d, 0x68, + 0x74, 0x74, 0x70, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x0c, 0x68, 0x74, 0x74, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x12, 0x3e, 0x0a, + 0x0c, 0x74, 0x63, 0x70, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x0b, 0x74, 0x63, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x73, 0x12, 0x23, 0x0a, + 0x0d, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x68, 0x74, 0x74, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x65, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x73, 0x42, 0x3f, 0x5a, 0x3d, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x6f, 0x6e, 0x67, 0x2f, 0x6b, + 0x6f, 0x6b, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6b, 0x6f, 0x6e, 0x67, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, + 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/gen/jsonschema/schemas/upstream.json b/internal/gen/jsonschema/schemas/upstream.json index 54d6dd346..a27175c38 100755 --- a/internal/gen/jsonschema/schemas/upstream.json +++ b/internal/gen/jsonschema/schemas/upstream.json @@ -36,7 +36,10 @@ "consumer", "ip", "header", - "cookie" + "cookie", + "path", + "query_arg", + "uri_capture" ], "type": "string" }, @@ -44,13 +47,24 @@ "pattern": "^[A-Za-z0-9!#$%\u0026'*+-.^_|~]{1,64}$", "type": "string" }, + "hash_fallback_query_arg": { + "pattern": "^[a-zA-Z0-9-_]+$", + "type": "string" + }, + "hash_fallback_uri_capture": { + "pattern": "^[a-zA-Z0-9-_]+$", + "type": "string" + }, "hash_on": { "enum": [ "none", "consumer", "ip", "header", - "cookie" + "cookie", + "path", + "query_arg", + "uri_capture" ], "type": "string" }, @@ -81,6 +95,14 @@ "pattern": "^[A-Za-z0-9!#$%\u0026'*+-.^_|~]{1,64}$", "type": "string" }, + "hash_on_query_arg": { + "pattern": "^[a-zA-Z0-9-_]+$", + "type": "string" + }, + "hash_on_uri_capture": { + "pattern": "^[a-zA-Z0-9-_]+$", + "type": "string" + }, "healthchecks": { "properties": { "active": { @@ -430,7 +452,7 @@ } }, { - "description": "when 'hash_on' is set to 'consumer', 'hash_fallback' must be set to one of 'none', 'ip', 'header', 'cookie'", + "description": "when 'hash_on' is set to 'consumer', 'hash_fallback' must be set to one of 'none', 'ip', 'header', 'cookie', 'path', 'query_arg', 'uri_capture'", "if": { "required": [ "hash_on" @@ -463,6 +485,18 @@ { "type": "string", "const": "cookie" + }, + { + "type": "string", + "const": "path" + }, + { + "type": "string", + "const": "query_arg" + }, + { + "type": "string", + "const": "uri_capture" } ] } @@ -470,7 +504,7 @@ } }, { - "description": "when 'hash_on' is set to 'ip', 'hash_fallback' must be set to one of 'none', 'consumer', 'header', 'cookie'", + "description": "when 'hash_on' is set to 'ip', 'hash_fallback' must be set to one of 'none', 'consumer', 'header', 'cookie', 'path', 'query_arg', 'uri_capture'", "if": { "required": [ "hash_on" @@ -503,11 +537,147 @@ { "type": "string", "const": "cookie" + }, + { + "type": "string", + "const": "path" + }, + { + "type": "string", + "const": "query_arg" + }, + { + "type": "string", + "const": "uri_capture" + } + ] + } + } + } + }, + { + "description": "when 'hash_on' is set to 'path', 'hash_fallback' must be set to one of 'none', 'consumer', 'ip', 'header', 'cookie', 'query_arg', 'uri_capture'", + "if": { + "required": [ + "hash_on" + ], + "properties": { + "hash_on": { + "const": "path" + } + } + }, + "then": { + "required": [ + "hash_fallback" + ], + "properties": { + "hash_fallback": { + "anyOf": [ + { + "type": "string", + "const": "none" + }, + { + "type": "string", + "const": "consumer" + }, + { + "type": "string", + "const": "header" + }, + { + "type": "string", + "const": "cookie" + }, + { + "type": "string", + "const": "ip" + }, + { + "type": "string", + "const": "query_arg" + }, + { + "type": "string", + "const": "uri_capture" } ] } } } + }, + { + "description": "when 'hash_on' is set to 'query_arg', 'hash_on_query_arg' must be set", + "if": { + "required": [ + "hash_on" + ], + "properties": { + "hash_on": { + "const": "query_arg" + } + } + }, + "then": { + "required": [ + "hash_on_query_arg" + ] + } + }, + { + "description": "when 'hash_fallback' is set to 'query_arg', 'hash_fallback_query_arg' must be set", + "if": { + "required": [ + "hash_fallback" + ], + "properties": { + "hash_fallback": { + "const": "query_arg" + } + } + }, + "then": { + "required": [ + "hash_fallback_query_arg" + ] + } + }, + { + "description": "when 'hash_on' is set to 'uri_capture', 'hash_on_uri_capture' must be set", + "if": { + "required": [ + "hash_on" + ], + "properties": { + "hash_on": { + "const": "uri_capture" + } + } + }, + "then": { + "required": [ + "hash_on_uri_capture" + ] + } + }, + { + "description": "when 'hash_fallback' is set to 'uri_capture', 'hash_fallback_uri_capture' must be set", + "if": { + "required": [ + "hash_fallback" + ], + "properties": { + "hash_fallback": { + "const": "uri_capture" + } + } + }, + "then": { + "required": [ + "hash_fallback_uri_capture" + ] + } } ], "x-koko-config": { diff --git a/internal/gen/swagger/koko.swagger.json b/internal/gen/swagger/koko.swagger.json index 0e953a271..6c1bc676a 100644 --- a/internal/gen/swagger/koko.swagger.json +++ b/internal/gen/swagger/koko.swagger.json @@ -3280,6 +3280,18 @@ }, "client_certificate": { "$ref": "#/definitions/kong.admin.model.v1.Certificate" + }, + "hash_on_query_arg": { + "type": "string" + }, + "hash_fallback_query_arg": { + "type": "string" + }, + "hash_on_uri_capture": { + "type": "string" + }, + "hash_fallback_uri_capture": { + "type": "string" } } } @@ -4177,6 +4189,18 @@ }, "client_certificate": { "$ref": "#/definitions/kong.admin.model.v1.Certificate" + }, + "hash_on_query_arg": { + "type": "string" + }, + "hash_fallback_query_arg": { + "type": "string" + }, + "hash_on_uri_capture": { + "type": "string" + }, + "hash_fallback_uri_capture": { + "type": "string" } } }, diff --git a/internal/grpc/proto/kong/admin/model/v1/upstream.proto b/internal/grpc/proto/kong/admin/model/v1/upstream.proto index 8cd0c9478..fdb3dc0e1 100644 --- a/internal/grpc/proto/kong/admin/model/v1/upstream.proto +++ b/internal/grpc/proto/kong/admin/model/v1/upstream.proto @@ -24,6 +24,10 @@ message Upstream { repeated string tags = 14; string host_header = 15; Certificate client_certificate = 16; + string hash_on_query_arg = 17; + string hash_fallback_query_arg = 18; + string hash_on_uri_capture = 19; + string hash_fallback_uri_capture = 20; } message Healthchecks { diff --git a/internal/resource/upstream.go b/internal/resource/upstream.go index 8b2e1c533..4a2a19fd0 100644 --- a/internal/resource/upstream.go +++ b/internal/resource/upstream.go @@ -17,16 +17,16 @@ import ( const ( TypeUpstream model.Type = "upstream" - cookieNamePattern = "^[a-zA-Z0-9-_]+$" - maxSlots = 1 << 16 - minSlots = 10 - maxConcurrency = 1 << 31 - maxSeconds = 65535 - maxStatuses = 32 - minStatus = 100 - maxStatus = 999 - maxOneByteInt = 255 - maxThreshold = 100 + hashFieldPattern = "^[a-zA-Z0-9-_]+$" + maxSlots = 1 << 16 + minSlots = 10 + maxConcurrency = 1 << 31 + maxSeconds = 65535 + maxStatuses = 32 + minStatus = 100 + maxStatus = 999 + maxOneByteInt = 255 + maxThreshold = 100 defaultSlots = 10000 defaultConcurrency = 10 @@ -88,6 +88,10 @@ var ( "ip", "header", "cookie", + // 3.0+ + "path", + "query_arg", + "uri_capture", }, } typedefSeconds = &generator.Schema{ @@ -170,6 +174,36 @@ func (r Upstream) Validate(ctx context.Context) error { } } } + if r.Upstream.HashOnQueryArg != "" || r.Upstream.HashFallbackQueryArg != "" { + if r.Upstream.HashOnQueryArg == r.Upstream.HashFallbackQueryArg { + return validation.Error{ + Errs: []*v1.ErrorDetail{ + { + Type: v1.ErrorType_ERROR_TYPE_ENTITY, + Messages: []string{ + "'hash_on_query_arg' must not be" + + " equal to 'hash_fallback_query_arg'", + }, + }, + }, + } + } + } + if r.Upstream.HashOnUriCapture != "" || r.Upstream.HashFallbackUriCapture != "" { + if r.Upstream.HashOnUriCapture == r.Upstream.HashFallbackUriCapture { + return validation.Error{ + Errs: []*v1.ErrorDetail{ + { + Type: v1.ErrorType_ERROR_TYPE_ENTITY, + Messages: []string{ + "'hash_on_uri_capture' must not be" + + " equal to 'hash_fallback_uri_capture'", + }, + }, + }, + } + } + } return nil } @@ -234,9 +268,25 @@ func init() { "hash_fallback_header": typedefs.Header, "hash_on_cookie": { Type: "string", - Pattern: cookieNamePattern, + Pattern: hashFieldPattern, }, "hash_on_cookie_path": typedefs.Path, + "hash_on_query_arg": { + Type: "string", + Pattern: hashFieldPattern, + }, + "hash_fallback_query_arg": { + Type: "string", + Pattern: hashFieldPattern, + }, + "hash_on_uri_capture": { + Type: "string", + Pattern: hashFieldPattern, + }, + "hash_fallback_uri_capture": { + Type: "string", + Pattern: hashFieldPattern, + }, "slots": { Type: "integer", Minimum: intP(minSlots), @@ -422,7 +472,7 @@ func init() { { Description: "when 'hash_on' is set to 'consumer', " + "'hash_fallback' must be set to one of 'none', 'ip', " + - "'header', 'cookie'", + "'header', 'cookie', 'path', 'query_arg', 'uri_capture'", If: &generator.Schema{ Required: []string{"hash_on"}, Properties: map[string]*generator.Schema{ @@ -452,6 +502,18 @@ func init() { Type: "string", Const: "cookie", }, + { + Type: "string", + Const: "path", + }, + { + Type: "string", + Const: "query_arg", + }, + { + Type: "string", + Const: "uri_capture", + }, }, }, }, @@ -460,7 +522,7 @@ func init() { { Description: "when 'hash_on' is set to 'ip', " + "'hash_fallback' must be set to one of 'none', 'consumer', " + - "'header', 'cookie'", + "'header', 'cookie', 'path', 'query_arg', 'uri_capture'", If: &generator.Schema{ Required: []string{"hash_on"}, Properties: map[string]*generator.Schema{ @@ -490,11 +552,133 @@ func init() { Type: "string", Const: "cookie", }, + { + Type: "string", + Const: "path", + }, + { + Type: "string", + Const: "query_arg", + }, + { + Type: "string", + Const: "uri_capture", + }, + }, + }, + }, + }, + }, + { + Description: "when 'hash_on' is set to 'path', " + + "'hash_fallback' must be set to one of 'none', 'consumer', 'ip', " + + "'header', 'cookie', 'query_arg', 'uri_capture'", + If: &generator.Schema{ + Required: []string{"hash_on"}, + Properties: map[string]*generator.Schema{ + "hash_on": { + Const: "path", + }, + }, + }, + Then: &generator.Schema{ + Required: []string{"hash_fallback"}, + Properties: map[string]*generator.Schema{ + "hash_fallback": { + AnyOf: []*generator.Schema{ + { + Type: "string", + Const: "none", + }, + { + Type: "string", + Const: "consumer", + }, + { + Type: "string", + Const: "header", + }, + { + Type: "string", + Const: "cookie", + }, + { + Type: "string", + Const: "ip", + }, + { + Type: "string", + Const: "query_arg", + }, + { + Type: "string", + Const: "uri_capture", + }, }, }, }, }, }, + { + Description: "when 'hash_on' is set to 'query_arg', " + + "'hash_on_query_arg' must be set", + If: &generator.Schema{ + Required: []string{"hash_on"}, + Properties: map[string]*generator.Schema{ + "hash_on": { + Const: "query_arg", + }, + }, + }, + Then: &generator.Schema{ + Required: []string{"hash_on_query_arg"}, + }, + }, + { + Description: "when 'hash_fallback' is set to 'query_arg', " + + "'hash_fallback_query_arg' must be set", + If: &generator.Schema{ + Required: []string{"hash_fallback"}, + Properties: map[string]*generator.Schema{ + "hash_fallback": { + Const: "query_arg", + }, + }, + }, + Then: &generator.Schema{ + Required: []string{"hash_fallback_query_arg"}, + }, + }, + { + Description: "when 'hash_on' is set to 'uri_capture', " + + "'hash_on_uri_capture' must be set", + If: &generator.Schema{ + Required: []string{"hash_on"}, + Properties: map[string]*generator.Schema{ + "hash_on": { + Const: "uri_capture", + }, + }, + }, + Then: &generator.Schema{ + Required: []string{"hash_on_uri_capture"}, + }, + }, + { + Description: "when 'hash_fallback' is set to 'uri_capture', " + + "'hash_fallback_uri_capture' must be set", + If: &generator.Schema{ + Required: []string{"hash_fallback"}, + Properties: map[string]*generator.Schema{ + "hash_fallback": { + Const: "uri_capture", + }, + }, + }, + Then: &generator.Schema{ + Required: []string{"hash_fallback_uri_capture"}, + }, + }, }, XKokoConfig: &extension.Config{ ResourceAPIPath: "upstreams", diff --git a/internal/resource/upstream_test.go b/internal/resource/upstream_test.go index bd9055b3e..2fd576860 100644 --- a/internal/resource/upstream_test.go +++ b/internal/resource/upstream_test.go @@ -269,7 +269,8 @@ func TestUpstream_Validate(t *testing.T) { Messages: []string{ "when 'hash_on' is set to 'consumer', " + "'hash_fallback' must be set to one of 'none', " + - "'ip', 'header', 'cookie'", + "'ip', 'header', 'cookie', 'path', " + + "'query_arg', 'uri_capture'", }, }, }, @@ -292,7 +293,8 @@ func TestUpstream_Validate(t *testing.T) { Messages: []string{ "when 'hash_on' is set to 'ip', " + "'hash_fallback' must be set to one of 'none', " + - "'consumer', 'header', 'cookie'", + "'consumer', 'header', 'cookie', 'path', " + + "'query_arg', 'uri_capture'", }, }, }, @@ -523,6 +525,158 @@ func TestUpstream_Validate(t *testing.T) { }, }, }, + { + name: "hash_fallback must not be set to 'path' when 'hash_on" + + "' is set to 'path'", + Upstream: func() Upstream { + u := NewUpstream() + u.Upstream.Id = uuid.NewString() + u.Upstream.Name = "foo" + u.Upstream.HashOn = "path" + u.Upstream.HashFallback = "path" + return u + }, + wantErr: true, + Errs: []*model.ErrorDetail{ + { + Type: model.ErrorType_ERROR_TYPE_ENTITY, + Messages: []string{ + "when 'hash_on' is set to 'path', " + + "'hash_fallback' must be set to one of 'none', " + + "'consumer', 'ip', 'header', 'cookie', " + + "'query_arg', 'uri_capture'", + }, + }, + }, + }, + { + name: "hash_on_query_arg is required when hash_on is set" + + " to 'query_arg'", + Upstream: func() Upstream { + u := NewUpstream() + u.Upstream.Id = uuid.NewString() + u.Upstream.Name = "foo" + u.Upstream.HashOn = "query_arg" + return u + }, + wantErr: true, + Errs: []*model.ErrorDetail{ + { + Type: model.ErrorType_ERROR_TYPE_ENTITY, + Messages: []string{ + "when 'hash_on' is set to 'query_arg', " + + "'hash_on_query_arg' must be set", + }, + }, + }, + }, + { + name: "hash_fallback_query_arg is required when hash_fallback is set" + + " to 'query_arg'", + Upstream: func() Upstream { + u := NewUpstream() + u.Upstream.Id = uuid.NewString() + u.Upstream.Name = "foo" + u.Upstream.HashFallback = "query_arg" + return u + }, + wantErr: true, + Errs: []*model.ErrorDetail{ + { + Type: model.ErrorType_ERROR_TYPE_ENTITY, + Messages: []string{ + "when 'hash_fallback' is set to 'query_arg', " + + "'hash_fallback_query_arg' must be set", + }, + }, + }, + }, + { + name: "hash_on_query_arg is required when hash_on is set" + + " to 'uri_capture'", + Upstream: func() Upstream { + u := NewUpstream() + u.Upstream.Id = uuid.NewString() + u.Upstream.Name = "foo" + u.Upstream.HashOn = "uri_capture" + return u + }, + wantErr: true, + Errs: []*model.ErrorDetail{ + { + Type: model.ErrorType_ERROR_TYPE_ENTITY, + Messages: []string{ + "when 'hash_on' is set to 'uri_capture', " + + "'hash_on_uri_capture' must be set", + }, + }, + }, + }, + { + name: "hash_fallback_uri_capture is required when hash_fallback is set" + + " to 'uri_capture'", + Upstream: func() Upstream { + u := NewUpstream() + u.Upstream.Id = uuid.NewString() + u.Upstream.Name = "foo" + u.Upstream.HashFallback = "uri_capture" + return u + }, + wantErr: true, + Errs: []*model.ErrorDetail{ + { + Type: model.ErrorType_ERROR_TYPE_ENTITY, + Messages: []string{ + "when 'hash_fallback' is set to 'uri_capture', " + + "'hash_fallback_uri_capture' must be set", + }, + }, + }, + }, + { + name: "hash_on_query_arg must not be equal to hash_fallback_query_arg", + Upstream: func() Upstream { + u := NewUpstream() + u.Upstream.Id = uuid.NewString() + u.Upstream.Name = "foo" + u.Upstream.HashOn = "query_arg" + u.Upstream.HashFallbackQueryArg = "query" + u.Upstream.HashOnQueryArg = "query" + return u + }, + wantErr: true, + Errs: []*model.ErrorDetail{ + { + Type: model.ErrorType_ERROR_TYPE_ENTITY, + Messages: []string{ + "'hash_on_query_arg' must not be equal to" + + " 'hash_fallback_query_arg'", + }, + }, + }, + }, + { + name: "hash_on_uri_capture must not be equal to hash_fallback_uri_capture", + Upstream: func() Upstream { + u := NewUpstream() + u.Upstream.Id = uuid.NewString() + u.Upstream.Name = "foo" + u.Upstream.HashOn = "uri_capture" + u.Upstream.HashFallbackUriCapture = "foobar" + u.Upstream.HashOnUriCapture = "foobar" + return u + }, + wantErr: true, + Errs: []*model.ErrorDetail{ + { + Type: model.ErrorType_ERROR_TYPE_ENTITY, + Messages: []string{ + "'hash_on_uri_capture' must not be equal to" + + " 'hash_fallback_uri_capture'", + }, + }, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {