WatchList(..) endpoint for the resource service (#16726)

This commit is contained in:
Semir Patel 2023-03-27 14:37:54 -05:00 committed by GitHub
parent 72750ec311
commit 0b441e07cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 493 additions and 386 deletions

View File

@ -12,7 +12,6 @@ import (
"github.com/hashicorp/consul/internal/resource"
"github.com/hashicorp/consul/internal/storage"
"github.com/hashicorp/consul/internal/storage/inmem"
"github.com/hashicorp/consul/proto-public/pbresource"
"github.com/hashicorp/consul/proto/private/prototest"
)
@ -122,50 +121,3 @@ func readTestCases() map[string]readTestCase {
}
}
func testServer(t *testing.T) *Server {
backend, err := inmem.NewBackend()
require.NoError(t, err)
ctx := testContext(t)
go backend.Run(ctx)
return NewServer(Config{
registry: resource.NewRegistry(),
backend: backend,
})
}
func testContext(t *testing.T) context.Context {
ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)
return ctx
}
var (
typev1 = &pbresource.Type{
Group: "mesh",
GroupVersion: "v1",
Kind: "service",
}
typev2 = &pbresource.Type{
Group: "mesh",
GroupVersion: "v2",
Kind: "service",
}
tenancy = &pbresource.Tenancy{
Partition: "default",
Namespace: "default",
PeerName: "local",
}
id1 = &pbresource.ID{
Uid: "abcd",
Name: "billing",
Type: typev1,
Tenancy: tenancy,
}
id2 = &pbresource.ID{
Uid: "abcd",
Name: "billing",
Type: typev2,
Tenancy: tenancy,
}
)

View File

@ -4,6 +4,8 @@ import (
"context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/hashicorp/consul/internal/resource"
"github.com/hashicorp/consul/internal/storage"
@ -15,8 +17,13 @@ type Server struct {
}
type Config struct {
registry resource.Registry
backend storage.Backend
registry Registry
backend Backend
}
//go:generate mockery --name Registry --inpackage
type Registry interface {
resource.Registry
}
//go:generate mockery --name Backend --inpackage
@ -54,7 +61,13 @@ func (s *Server) Delete(ctx context.Context, req *pbresource.DeleteRequest) (*pb
return &pbresource.DeleteResponse{}, nil
}
func (s *Server) Watch(req *pbresource.WatchRequest, ws pbresource.ResourceService_WatchServer) error {
// TODO
return nil
func (s *Server) resolveType(typ *pbresource.Type) (*resource.Registration, error) {
v, ok := s.registry.Resolve(typ)
if ok {
return &v, nil
}
return nil, status.Errorf(
codes.InvalidArgument,
"resource type %s not registered", resource.ToGVK(typ),
)
}

View File

@ -8,24 +8,11 @@ import (
"google.golang.org/grpc"
"github.com/hashicorp/consul/agent/grpc-external/testutils"
"github.com/hashicorp/consul/internal/resource"
"github.com/hashicorp/consul/internal/storage/inmem"
"github.com/hashicorp/consul/proto-public/pbresource"
)
func testClient(t *testing.T, server *Server) pbresource.ResourceServiceClient {
t.Helper()
addr := testutils.RunTestServer(t, server)
//nolint:staticcheck
conn, err := grpc.DialContext(context.Background(), addr.String(), grpc.WithInsecure())
require.NoError(t, err)
t.Cleanup(func() {
require.NoError(t, conn.Close())
})
return pbresource.NewResourceServiceClient(conn)
}
func TestWrite_TODO(t *testing.T) {
server := NewServer(Config{})
client := testClient(t, server)
@ -58,10 +45,73 @@ func TestDelete_TODO(t *testing.T) {
require.NotNil(t, resp)
}
func TestWatch_TODO(t *testing.T) {
server := NewServer(Config{})
client := testClient(t, server)
wc, err := client.Watch(context.Background(), &pbresource.WatchRequest{})
func testServer(t *testing.T) *Server {
t.Helper()
backend, err := inmem.NewBackend()
require.NoError(t, err)
require.NotNil(t, wc)
go backend.Run(testContext(t))
registry := resource.NewRegistry()
return NewServer(Config{registry: registry, backend: backend})
}
func testClient(t *testing.T, server *Server) pbresource.ResourceServiceClient {
t.Helper()
addr := testutils.RunTestServer(t, server)
//nolint:staticcheck
conn, err := grpc.DialContext(context.Background(), addr.String(), grpc.WithInsecure())
require.NoError(t, err)
t.Cleanup(func() {
require.NoError(t, conn.Close())
})
return pbresource.NewResourceServiceClient(conn)
}
func testContext(t *testing.T) context.Context {
ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)
return ctx
}
var (
tenancy = &pbresource.Tenancy{
Partition: "default",
Namespace: "default",
PeerName: "local",
}
typev1 = &pbresource.Type{
Group: "mesh",
GroupVersion: "v1",
Kind: "service",
}
typev2 = &pbresource.Type{
Group: "mesh",
GroupVersion: "v2",
Kind: "service",
}
id1 = &pbresource.ID{
Uid: "abcd",
Name: "billing",
Type: typev1,
Tenancy: tenancy,
}
id2 = &pbresource.ID{
Uid: "abcd",
Name: "billing",
Type: typev2,
Tenancy: tenancy,
}
resourcev1 = &pbresource.Resource{
Id: &pbresource.ID{
Uid: "someUid",
Name: "someName",
Type: typev1,
Tenancy: tenancy,
},
Version: "",
}
)

View File

@ -0,0 +1,40 @@
package resource
import (
"github.com/hashicorp/consul/internal/storage"
"github.com/hashicorp/consul/proto-public/pbresource"
)
func (s *Server) WatchList(req *pbresource.WatchListRequest, stream pbresource.ResourceService_WatchListServer) error {
// check type exists
if _, err := s.resolveType(req.Type); err != nil {
return err
}
unversionedType := storage.UnversionedTypeFrom(req.Type)
watch, err := s.backend.WatchList(
stream.Context(),
unversionedType,
req.Tenancy,
req.NamePrefix,
)
if err != nil {
return err
}
for {
event, err := watch.Next(stream.Context())
if err != nil {
return err
}
// drop versions that don't match
if event.Resource.Id.Type.GroupVersion != req.Type.GroupVersion {
continue
}
if err = stream.Send(event); err != nil {
return err
}
}
}

View File

@ -0,0 +1,177 @@
package resource
import (
"context"
"errors"
"io"
"testing"
"time"
"github.com/hashicorp/consul/internal/resource"
"github.com/hashicorp/consul/proto-public/pbresource"
"github.com/hashicorp/consul/proto/private/prototest"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
func TestWatchList_TypeNotFound(t *testing.T) {
t.Parallel()
server := testServer(t)
client := testClient(t, server)
stream, err := client.WatchList(context.Background(), &pbresource.WatchListRequest{
Type: typev1,
Tenancy: tenancy,
NamePrefix: "",
})
require.NoError(t, err)
rspCh := handleResourceStream(t, stream)
err = mustGetError(t, rspCh)
require.Equal(t, codes.InvalidArgument.String(), status.Code(err).String())
require.Contains(t, err.Error(), "resource type mesh/v1/service not registered")
}
func TestWatchList_GroupVersionMatches(t *testing.T) {
t.Parallel()
server := testServer(t)
client := testClient(t, server)
server.registry.Register(resource.Registration{Type: typev1})
ctx := context.Background()
// create a watch
stream, err := client.WatchList(ctx, &pbresource.WatchListRequest{
Type: typev1,
Tenancy: tenancy,
NamePrefix: "",
})
require.NoError(t, err)
rspCh := handleResourceStream(t, stream)
// insert and verify upsert event received
r1, err := server.backend.WriteCAS(ctx, resourcev1)
require.NoError(t, err)
rsp := mustGetResource(t, rspCh)
require.Equal(t, pbresource.WatchEvent_OPERATION_UPSERT, rsp.Operation)
prototest.AssertDeepEqual(t, r1, rsp.Resource)
// update and verify upsert event received
r2 := clone(r1)
r2, err = server.backend.WriteCAS(ctx, r2)
require.NoError(t, err)
rsp = mustGetResource(t, rspCh)
require.Equal(t, pbresource.WatchEvent_OPERATION_UPSERT, rsp.Operation)
prototest.AssertDeepEqual(t, r2, rsp.Resource)
// delete and verify delete event received
err = server.backend.DeleteCAS(ctx, r2.Id, r2.Version)
require.NoError(t, err)
rsp = mustGetResource(t, rspCh)
require.Equal(t, pbresource.WatchEvent_OPERATION_DELETE, rsp.Operation)
}
func TestWatchList_GroupVersionMismatch(t *testing.T) {
// Given a watch on typev2 that only differs from typev1 by GroupVersion
// When a resource of typev1 is created/updated/deleted
// Then no watch events should be emitted
t.Parallel()
server := testServer(t)
client := testClient(t, server)
ctx := context.Background()
server.registry.Register(resource.Registration{Type: typev1})
server.registry.Register(resource.Registration{Type: typev2})
// create a watch for typev2
stream, err := client.WatchList(ctx, &pbresource.WatchListRequest{
Type: typev2,
Tenancy: tenancy,
NamePrefix: "",
})
require.NoError(t, err)
rspCh := handleResourceStream(t, stream)
// insert
r1, err := server.backend.WriteCAS(ctx, resourcev1)
require.NoError(t, err)
// update
r2 := clone(r1)
r2, err = server.backend.WriteCAS(ctx, r2)
require.NoError(t, err)
// delete
err = server.backend.DeleteCAS(ctx, r2.Id, r2.Version)
require.NoError(t, err)
// verify no events received
mustGetNoResource(t, rspCh)
}
func mustGetNoResource(t *testing.T, ch <-chan resourceOrError) {
t.Helper()
select {
case rsp := <-ch:
require.NoError(t, rsp.err)
require.Nil(t, rsp.rsp, "expected nil response with no error")
case <-time.After(250 * time.Millisecond):
return
}
}
func mustGetResource(t *testing.T, ch <-chan resourceOrError) *pbresource.WatchEvent {
t.Helper()
select {
case rsp := <-ch:
require.NoError(t, rsp.err)
return rsp.rsp
case <-time.After(1 * time.Second):
t.Fatal("timeout waiting for WatchListResponse")
return nil
}
}
func mustGetError(t *testing.T, ch <-chan resourceOrError) error {
t.Helper()
select {
case rsp := <-ch:
require.Error(t, rsp.err)
return rsp.err
case <-time.After(2 * time.Second):
t.Fatal("timeout waiting for WatchListResponse")
return nil
}
}
func handleResourceStream(t *testing.T, stream pbresource.ResourceService_WatchListClient) <-chan resourceOrError {
t.Helper()
rspCh := make(chan resourceOrError)
go func() {
for {
rsp, err := stream.Recv()
if errors.Is(err, io.EOF) ||
errors.Is(err, context.Canceled) ||
errors.Is(err, context.DeadlineExceeded) {
return
}
rspCh <- resourceOrError{
rsp: rsp,
err: err,
}
}
}()
return rspCh
}
type resourceOrError struct {
rsp *pbresource.WatchEvent
err error
}
func clone[T proto.Message](v T) T { return proto.Clone(v).(T) }

View File

@ -25,7 +25,7 @@ var rpcRateLimitSpecs = map[string]rate.OperationSpec{
"/hashicorp.consul.resource.ResourceService/Delete": {Type: rate.OperationTypeWrite, Category: rate.OperationCategoryResource},
"/hashicorp.consul.resource.ResourceService/List": {Type: rate.OperationTypeRead, Category: rate.OperationCategoryResource},
"/hashicorp.consul.resource.ResourceService/Read": {Type: rate.OperationTypeRead, Category: rate.OperationCategoryResource},
"/hashicorp.consul.resource.ResourceService/Watch": {Type: rate.OperationTypeRead, Category: rate.OperationCategoryResource},
"/hashicorp.consul.resource.ResourceService/WatchList": {Type: rate.OperationTypeRead, Category: rate.OperationCategoryResource},
"/hashicorp.consul.resource.ResourceService/Write": {Type: rate.OperationTypeWrite, Category: rate.OperationCategoryResource},
"/hashicorp.consul.resource.ResourceService/WriteStatus": {Type: rate.OperationTypeWrite, Category: rate.OperationCategoryResource},
"/hashicorp.consul.serverdiscovery.ServerDiscoveryService/WatchServers": {Type: rate.OperationTypeRead, Category: rate.OperationCategoryServerDiscovery},

View File

@ -12,6 +12,7 @@ lint:
- PACKAGE_VERSION_SUFFIX
service_suffix: Service
allow_comment_ignores: true
breaking:
use:
- FILE

View File

@ -158,21 +158,11 @@ func (msg *DeleteResponse) UnmarshalBinary(b []byte) error {
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *WatchRequest) MarshalBinary() ([]byte, error) {
func (msg *WatchListRequest) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *WatchRequest) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}
// MarshalBinary implements encoding.BinaryMarshaler
func (msg *WatchResponse) MarshalBinary() ([]byte, error) {
return proto.Marshal(msg)
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (msg *WatchResponse) UnmarshalBinary(b []byte) error {
func (msg *WatchListRequest) UnmarshalBinary(b []byte) error {
return proto.Unmarshal(b, msg)
}

View File

@ -123,55 +123,6 @@ func (WatchEvent_Operation) EnumDescriptor() ([]byte, []int) {
return file_pbresource_resource_proto_rawDescGZIP(), []int{4, 0}
}
type WatchResponse_Operation int32
const (
WatchResponse_OPERATION_UNSPECIFIED WatchResponse_Operation = 0
WatchResponse_OPERATION_UPSERT WatchResponse_Operation = 1
WatchResponse_OPERATION_DELETE WatchResponse_Operation = 2
)
// Enum value maps for WatchResponse_Operation.
var (
WatchResponse_Operation_name = map[int32]string{
0: "OPERATION_UNSPECIFIED",
1: "OPERATION_UPSERT",
2: "OPERATION_DELETE",
}
WatchResponse_Operation_value = map[string]int32{
"OPERATION_UNSPECIFIED": 0,
"OPERATION_UPSERT": 1,
"OPERATION_DELETE": 2,
}
)
func (x WatchResponse_Operation) Enum() *WatchResponse_Operation {
p := new(WatchResponse_Operation)
*p = x
return p
}
func (x WatchResponse_Operation) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (WatchResponse_Operation) Descriptor() protoreflect.EnumDescriptor {
return file_pbresource_resource_proto_enumTypes[2].Descriptor()
}
func (WatchResponse_Operation) Type() protoreflect.EnumType {
return &file_pbresource_resource_proto_enumTypes[2]
}
func (x WatchResponse_Operation) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use WatchResponse_Operation.Descriptor instead.
func (WatchResponse_Operation) EnumDescriptor() ([]byte, []int) {
return file_pbresource_resource_proto_rawDescGZIP(), []int{16, 0}
}
type Type struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -1036,16 +987,18 @@ func (*DeleteResponse) Descriptor() ([]byte, []int) {
return file_pbresource_resource_proto_rawDescGZIP(), []int{14}
}
type WatchRequest struct {
type WatchListRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id *ID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Type *Type `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Tenancy *Tenancy `protobuf:"bytes,2,opt,name=tenancy,proto3" json:"tenancy,omitempty"`
NamePrefix string `protobuf:"bytes,3,opt,name=name_prefix,json=namePrefix,proto3" json:"name_prefix,omitempty"`
}
func (x *WatchRequest) Reset() {
*x = WatchRequest{}
func (x *WatchListRequest) Reset() {
*x = WatchListRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_pbresource_resource_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1053,13 +1006,13 @@ func (x *WatchRequest) Reset() {
}
}
func (x *WatchRequest) String() string {
func (x *WatchListRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WatchRequest) ProtoMessage() {}
func (*WatchListRequest) ProtoMessage() {}
func (x *WatchRequest) ProtoReflect() protoreflect.Message {
func (x *WatchListRequest) ProtoReflect() protoreflect.Message {
mi := &file_pbresource_resource_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1071,73 +1024,32 @@ func (x *WatchRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use WatchRequest.ProtoReflect.Descriptor instead.
func (*WatchRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use WatchListRequest.ProtoReflect.Descriptor instead.
func (*WatchListRequest) Descriptor() ([]byte, []int) {
return file_pbresource_resource_proto_rawDescGZIP(), []int{15}
}
func (x *WatchRequest) GetId() *ID {
func (x *WatchListRequest) GetType() *Type {
if x != nil {
return x.Id
return x.Type
}
return nil
}
type WatchResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Operation WatchResponse_Operation `protobuf:"varint,1,opt,name=operation,proto3,enum=hashicorp.consul.resource.WatchResponse_Operation" json:"operation,omitempty"`
Resource *Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
}
func (x *WatchResponse) Reset() {
*x = WatchResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_pbresource_resource_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *WatchResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WatchResponse) ProtoMessage() {}
func (x *WatchResponse) ProtoReflect() protoreflect.Message {
mi := &file_pbresource_resource_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use WatchResponse.ProtoReflect.Descriptor instead.
func (*WatchResponse) Descriptor() ([]byte, []int) {
return file_pbresource_resource_proto_rawDescGZIP(), []int{16}
}
func (x *WatchResponse) GetOperation() WatchResponse_Operation {
func (x *WatchListRequest) GetTenancy() *Tenancy {
if x != nil {
return x.Operation
}
return WatchResponse_OPERATION_UNSPECIFIED
}
func (x *WatchResponse) GetResource() *Resource {
if x != nil {
return x.Resource
return x.Tenancy
}
return nil
}
func (x *WatchListRequest) GetNamePrefix() string {
if x != nil {
return x.NamePrefix
}
return ""
}
var File_pbresource_resource_proto protoreflect.FileDescriptor
var file_pbresource_resource_proto_rawDesc = []byte{
@ -1269,89 +1181,81 @@ var file_pbresource_resource_proto_rawDesc = []byte{
0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x22, 0x10, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x3d, 0x0a, 0x0c, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x2d, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d,
0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75,
0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x49, 0x44, 0x52, 0x02, 0x69,
0x64, 0x22, 0xf6, 0x01, 0x0a, 0x0d, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63,
0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75,
0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x52, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e,
0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14,
0x0a, 0x10, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x50, 0x53, 0x45,
0x52, 0x54, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f,
0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x2a, 0x77, 0x0a, 0x09, 0x43, 0x6f,
0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44, 0x49,
0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f,
0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10,
0x02, 0x12, 0x20, 0x0a, 0x1c, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50,
0x45, 0x52, 0x53, 0x49, 0x53, 0x54, 0x45, 0x4e, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52,
0x45, 0x10, 0x03, 0x32, 0x86, 0x05, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x61, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12,
0x26, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x64,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63,
0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75,
0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x08, 0xe2, 0x86, 0x04, 0x04, 0x08, 0x02, 0x10, 0x0b, 0x12, 0x64, 0x0a, 0x05, 0x57, 0x72,
0x69, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e,
0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e,
0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x68,
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0xe2, 0x86, 0x04, 0x04, 0x08, 0x03, 0x10, 0x0b,
0x12, 0x76, 0x0a, 0x0b, 0x57, 0x72, 0x69, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
0x2d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x57, 0x72, 0x69, 0x74,
0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e,
0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75,
0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08,
0xe2, 0x86, 0x04, 0x04, 0x08, 0x03, 0x10, 0x0b, 0x12, 0x61, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74,
0x12, 0x26, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73,
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69,
0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x08, 0xe2, 0x86, 0x04, 0x04, 0x08, 0x02, 0x10, 0x0b, 0x12, 0x67, 0x0a, 0x06, 0x44,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x28, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72,
0x73, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x10, 0x57, 0x61, 0x74, 0x63, 0x68, 0x4c, 0x69, 0x73, 0x74,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72,
0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x29, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65,
0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0xe2, 0x86, 0x04, 0x04,
0x08, 0x03, 0x10, 0x0b, 0x12, 0x66, 0x0a, 0x05, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x27, 0x2e,
0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3c, 0x0a, 0x07,
0x74, 0x65, 0x6e, 0x61, 0x6e, 0x63, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e,
0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x63,
0x79, 0x52, 0x07, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x63, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x6e, 0x61,
0x6d, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x2a, 0x77, 0x0a, 0x09, 0x43,
0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x44,
0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,
0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e,
0x5f, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x43,
0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44,
0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
0x50, 0x45, 0x52, 0x53, 0x49, 0x53, 0x54, 0x45, 0x4e, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55,
0x52, 0x45, 0x10, 0x03, 0x32, 0x8b, 0x05, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x61, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64,
0x12, 0x26, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x61,
0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69,
0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x08, 0xe2, 0x86, 0x04, 0x04, 0x08, 0x02, 0x10, 0x0b, 0x12, 0x64, 0x0a, 0x05, 0x57,
0x72, 0x69, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e,
0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0xe2, 0x86, 0x04, 0x04, 0x08, 0x03, 0x10,
0x0b, 0x12, 0x76, 0x0a, 0x0b, 0x57, 0x72, 0x69, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x2d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x57, 0x72, 0x69,
0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x57, 0x72, 0x69, 0x74,
0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x08, 0xe2, 0x86, 0x04, 0x04, 0x08, 0x03, 0x10, 0x0b, 0x12, 0x61, 0x0a, 0x04, 0x4c, 0x69, 0x73,
0x74, 0x12, 0x26, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f,
0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x68, 0x61, 0x73, 0x68,
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x08, 0xe2, 0x86, 0x04, 0x04, 0x08, 0x02, 0x10, 0x0b, 0x12, 0x67, 0x0a, 0x06,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x28, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x08, 0xe2, 0x86, 0x04, 0x04, 0x08, 0x02, 0x10, 0x0b, 0x30, 0x01, 0x42, 0xe9, 0x01, 0x0a,
0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63,
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x0d,
0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68,
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x52, 0xaa, 0x02, 0x19, 0x48, 0x61, 0x73,
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x52, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0xca, 0x02, 0x19, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0xe2, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43,
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x48, 0x61, 0x73,
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a,
0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x29, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x08, 0xe2, 0x86, 0x04,
0x04, 0x08, 0x03, 0x10, 0x0b, 0x12, 0x6b, 0x0a, 0x09, 0x57, 0x61, 0x74, 0x63, 0x68, 0x4c, 0x69,
0x73, 0x74, 0x12, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63,
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x57,
0x61, 0x74, 0x63, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x25, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x57, 0x61, 0x74, 0x63,
0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x08, 0xe2, 0x86, 0x04, 0x04, 0x08, 0x02, 0x10, 0x0b,
0x30, 0x01, 0x42, 0xe9, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69,
0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x42, 0x0d, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73,
0x75, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f,
0x70, 0x62, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x52,
0xaa, 0x02, 0x19, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e,
0x73, 0x75, 0x6c, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0xca, 0x02, 0x19, 0x48,
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c,
0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0xe2, 0x02, 0x25, 0x48, 0x61, 0x73, 0x68, 0x69,
0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x52, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0xea, 0x02, 0x1b, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f,
0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1366,72 +1270,69 @@ func file_pbresource_resource_proto_rawDescGZIP() []byte {
return file_pbresource_resource_proto_rawDescData
}
var file_pbresource_resource_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_pbresource_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_pbresource_resource_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_pbresource_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
var file_pbresource_resource_proto_goTypes = []interface{}{
(Condition)(0), // 0: hashicorp.consul.resource.Condition
(WatchEvent_Operation)(0), // 1: hashicorp.consul.resource.WatchEvent.Operation
(WatchResponse_Operation)(0), // 2: hashicorp.consul.resource.WatchResponse.Operation
(*Type)(nil), // 3: hashicorp.consul.resource.Type
(*Tenancy)(nil), // 4: hashicorp.consul.resource.Tenancy
(*ID)(nil), // 5: hashicorp.consul.resource.ID
(*Resource)(nil), // 6: hashicorp.consul.resource.Resource
(*WatchEvent)(nil), // 7: hashicorp.consul.resource.WatchEvent
(*ReadRequest)(nil), // 8: hashicorp.consul.resource.ReadRequest
(*ReadResponse)(nil), // 9: hashicorp.consul.resource.ReadResponse
(*ListRequest)(nil), // 10: hashicorp.consul.resource.ListRequest
(*ListResponse)(nil), // 11: hashicorp.consul.resource.ListResponse
(*WriteRequest)(nil), // 12: hashicorp.consul.resource.WriteRequest
(*WriteResponse)(nil), // 13: hashicorp.consul.resource.WriteResponse
(*WriteStatusResponse)(nil), // 14: hashicorp.consul.resource.WriteStatusResponse
(*WriteStatusRequest)(nil), // 15: hashicorp.consul.resource.WriteStatusRequest
(*DeleteRequest)(nil), // 16: hashicorp.consul.resource.DeleteRequest
(*DeleteResponse)(nil), // 17: hashicorp.consul.resource.DeleteResponse
(*WatchRequest)(nil), // 18: hashicorp.consul.resource.WatchRequest
(*WatchResponse)(nil), // 19: hashicorp.consul.resource.WatchResponse
nil, // 20: hashicorp.consul.resource.Resource.MetadataEntry
(*anypb.Any)(nil), // 21: google.protobuf.Any
(*Type)(nil), // 2: hashicorp.consul.resource.Type
(*Tenancy)(nil), // 3: hashicorp.consul.resource.Tenancy
(*ID)(nil), // 4: hashicorp.consul.resource.ID
(*Resource)(nil), // 5: hashicorp.consul.resource.Resource
(*WatchEvent)(nil), // 6: hashicorp.consul.resource.WatchEvent
(*ReadRequest)(nil), // 7: hashicorp.consul.resource.ReadRequest
(*ReadResponse)(nil), // 8: hashicorp.consul.resource.ReadResponse
(*ListRequest)(nil), // 9: hashicorp.consul.resource.ListRequest
(*ListResponse)(nil), // 10: hashicorp.consul.resource.ListResponse
(*WriteRequest)(nil), // 11: hashicorp.consul.resource.WriteRequest
(*WriteResponse)(nil), // 12: hashicorp.consul.resource.WriteResponse
(*WriteStatusResponse)(nil), // 13: hashicorp.consul.resource.WriteStatusResponse
(*WriteStatusRequest)(nil), // 14: hashicorp.consul.resource.WriteStatusRequest
(*DeleteRequest)(nil), // 15: hashicorp.consul.resource.DeleteRequest
(*DeleteResponse)(nil), // 16: hashicorp.consul.resource.DeleteResponse
(*WatchListRequest)(nil), // 17: hashicorp.consul.resource.WatchListRequest
nil, // 18: hashicorp.consul.resource.Resource.MetadataEntry
(*anypb.Any)(nil), // 19: google.protobuf.Any
}
var file_pbresource_resource_proto_depIdxs = []int32{
3, // 0: hashicorp.consul.resource.ID.type:type_name -> hashicorp.consul.resource.Type
4, // 1: hashicorp.consul.resource.ID.tenancy:type_name -> hashicorp.consul.resource.Tenancy
5, // 2: hashicorp.consul.resource.Resource.id:type_name -> hashicorp.consul.resource.ID
5, // 3: hashicorp.consul.resource.Resource.owner:type_name -> hashicorp.consul.resource.ID
20, // 4: hashicorp.consul.resource.Resource.metadata:type_name -> hashicorp.consul.resource.Resource.MetadataEntry
21, // 5: hashicorp.consul.resource.Resource.data:type_name -> google.protobuf.Any
2, // 0: hashicorp.consul.resource.ID.type:type_name -> hashicorp.consul.resource.Type
3, // 1: hashicorp.consul.resource.ID.tenancy:type_name -> hashicorp.consul.resource.Tenancy
4, // 2: hashicorp.consul.resource.Resource.id:type_name -> hashicorp.consul.resource.ID
4, // 3: hashicorp.consul.resource.Resource.owner:type_name -> hashicorp.consul.resource.ID
18, // 4: hashicorp.consul.resource.Resource.metadata:type_name -> hashicorp.consul.resource.Resource.MetadataEntry
19, // 5: hashicorp.consul.resource.Resource.data:type_name -> google.protobuf.Any
1, // 6: hashicorp.consul.resource.WatchEvent.operation:type_name -> hashicorp.consul.resource.WatchEvent.Operation
6, // 7: hashicorp.consul.resource.WatchEvent.resource:type_name -> hashicorp.consul.resource.Resource
5, // 8: hashicorp.consul.resource.ReadRequest.id:type_name -> hashicorp.consul.resource.ID
6, // 9: hashicorp.consul.resource.ReadResponse.resource:type_name -> hashicorp.consul.resource.Resource
3, // 10: hashicorp.consul.resource.ListRequest.type:type_name -> hashicorp.consul.resource.Type
4, // 11: hashicorp.consul.resource.ListRequest.tenancy:type_name -> hashicorp.consul.resource.Tenancy
6, // 12: hashicorp.consul.resource.ListResponse.resources:type_name -> hashicorp.consul.resource.Resource
6, // 13: hashicorp.consul.resource.WriteRequest.resource:type_name -> hashicorp.consul.resource.Resource
6, // 14: hashicorp.consul.resource.WriteResponse.resource:type_name -> hashicorp.consul.resource.Resource
6, // 15: hashicorp.consul.resource.WriteStatusResponse.resource:type_name -> hashicorp.consul.resource.Resource
5, // 16: hashicorp.consul.resource.WriteStatusRequest.id:type_name -> hashicorp.consul.resource.ID
5, // 7: hashicorp.consul.resource.WatchEvent.resource:type_name -> hashicorp.consul.resource.Resource
4, // 8: hashicorp.consul.resource.ReadRequest.id:type_name -> hashicorp.consul.resource.ID
5, // 9: hashicorp.consul.resource.ReadResponse.resource:type_name -> hashicorp.consul.resource.Resource
2, // 10: hashicorp.consul.resource.ListRequest.type:type_name -> hashicorp.consul.resource.Type
3, // 11: hashicorp.consul.resource.ListRequest.tenancy:type_name -> hashicorp.consul.resource.Tenancy
5, // 12: hashicorp.consul.resource.ListResponse.resources:type_name -> hashicorp.consul.resource.Resource
5, // 13: hashicorp.consul.resource.WriteRequest.resource:type_name -> hashicorp.consul.resource.Resource
5, // 14: hashicorp.consul.resource.WriteResponse.resource:type_name -> hashicorp.consul.resource.Resource
5, // 15: hashicorp.consul.resource.WriteStatusResponse.resource:type_name -> hashicorp.consul.resource.Resource
4, // 16: hashicorp.consul.resource.WriteStatusRequest.id:type_name -> hashicorp.consul.resource.ID
0, // 17: hashicorp.consul.resource.WriteStatusRequest.condition:type_name -> hashicorp.consul.resource.Condition
5, // 18: hashicorp.consul.resource.DeleteRequest.id:type_name -> hashicorp.consul.resource.ID
5, // 19: hashicorp.consul.resource.WatchRequest.id:type_name -> hashicorp.consul.resource.ID
2, // 20: hashicorp.consul.resource.WatchResponse.operation:type_name -> hashicorp.consul.resource.WatchResponse.Operation
6, // 21: hashicorp.consul.resource.WatchResponse.resource:type_name -> hashicorp.consul.resource.Resource
8, // 22: hashicorp.consul.resource.ResourceService.Read:input_type -> hashicorp.consul.resource.ReadRequest
12, // 23: hashicorp.consul.resource.ResourceService.Write:input_type -> hashicorp.consul.resource.WriteRequest
15, // 24: hashicorp.consul.resource.ResourceService.WriteStatus:input_type -> hashicorp.consul.resource.WriteStatusRequest
10, // 25: hashicorp.consul.resource.ResourceService.List:input_type -> hashicorp.consul.resource.ListRequest
16, // 26: hashicorp.consul.resource.ResourceService.Delete:input_type -> hashicorp.consul.resource.DeleteRequest
18, // 27: hashicorp.consul.resource.ResourceService.Watch:input_type -> hashicorp.consul.resource.WatchRequest
9, // 28: hashicorp.consul.resource.ResourceService.Read:output_type -> hashicorp.consul.resource.ReadResponse
13, // 29: hashicorp.consul.resource.ResourceService.Write:output_type -> hashicorp.consul.resource.WriteResponse
14, // 30: hashicorp.consul.resource.ResourceService.WriteStatus:output_type -> hashicorp.consul.resource.WriteStatusResponse
11, // 31: hashicorp.consul.resource.ResourceService.List:output_type -> hashicorp.consul.resource.ListResponse
17, // 32: hashicorp.consul.resource.ResourceService.Delete:output_type -> hashicorp.consul.resource.DeleteResponse
19, // 33: hashicorp.consul.resource.ResourceService.Watch:output_type -> hashicorp.consul.resource.WatchResponse
28, // [28:34] is the sub-list for method output_type
22, // [22:28] is the sub-list for method input_type
22, // [22:22] is the sub-list for extension type_name
22, // [22:22] is the sub-list for extension extendee
0, // [0:22] is the sub-list for field type_name
4, // 18: hashicorp.consul.resource.DeleteRequest.id:type_name -> hashicorp.consul.resource.ID
2, // 19: hashicorp.consul.resource.WatchListRequest.type:type_name -> hashicorp.consul.resource.Type
3, // 20: hashicorp.consul.resource.WatchListRequest.tenancy:type_name -> hashicorp.consul.resource.Tenancy
7, // 21: hashicorp.consul.resource.ResourceService.Read:input_type -> hashicorp.consul.resource.ReadRequest
11, // 22: hashicorp.consul.resource.ResourceService.Write:input_type -> hashicorp.consul.resource.WriteRequest
14, // 23: hashicorp.consul.resource.ResourceService.WriteStatus:input_type -> hashicorp.consul.resource.WriteStatusRequest
9, // 24: hashicorp.consul.resource.ResourceService.List:input_type -> hashicorp.consul.resource.ListRequest
15, // 25: hashicorp.consul.resource.ResourceService.Delete:input_type -> hashicorp.consul.resource.DeleteRequest
17, // 26: hashicorp.consul.resource.ResourceService.WatchList:input_type -> hashicorp.consul.resource.WatchListRequest
8, // 27: hashicorp.consul.resource.ResourceService.Read:output_type -> hashicorp.consul.resource.ReadResponse
12, // 28: hashicorp.consul.resource.ResourceService.Write:output_type -> hashicorp.consul.resource.WriteResponse
13, // 29: hashicorp.consul.resource.ResourceService.WriteStatus:output_type -> hashicorp.consul.resource.WriteStatusResponse
10, // 30: hashicorp.consul.resource.ResourceService.List:output_type -> hashicorp.consul.resource.ListResponse
16, // 31: hashicorp.consul.resource.ResourceService.Delete:output_type -> hashicorp.consul.resource.DeleteResponse
6, // 32: hashicorp.consul.resource.ResourceService.WatchList:output_type -> hashicorp.consul.resource.WatchEvent
27, // [27:33] is the sub-list for method output_type
21, // [21:27] is the sub-list for method input_type
21, // [21:21] is the sub-list for extension type_name
21, // [21:21] is the sub-list for extension extendee
0, // [0:21] is the sub-list for field type_name
}
func init() { file_pbresource_resource_proto_init() }
@ -1621,19 +1522,7 @@ func file_pbresource_resource_proto_init() {
}
}
file_pbresource_resource_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WatchRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pbresource_resource_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WatchResponse); i {
switch v := v.(*WatchListRequest); i {
case 0:
return &v.state
case 1:
@ -1650,8 +1539,8 @@ func file_pbresource_resource_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pbresource_resource_proto_rawDesc,
NumEnums: 3,
NumMessages: 18,
NumEnums: 2,
NumMessages: 17,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -83,7 +83,8 @@ service ResourceService {
};
}
rpc Watch(WatchRequest) returns (stream WatchResponse) {
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
rpc WatchList(WatchListRequest) returns (stream WatchEvent) {
option (hashicorp.consul.internal.ratelimit.spec) = {
operation_type: OPERATION_TYPE_READ,
operation_category: OPERATION_CATEGORY_RESOURCE
@ -144,16 +145,8 @@ message DeleteRequest {
message DeleteResponse {}
message WatchRequest {
ID id = 1;
}
message WatchResponse {
enum Operation {
OPERATION_UNSPECIFIED = 0;
OPERATION_UPSERT = 1;
OPERATION_DELETE = 2;
}
Operation operation = 1;
Resource resource = 2;
message WatchListRequest {
Type type = 1;
Tenancy tenancy = 2;
string name_prefix = 3;
}

View File

@ -27,7 +27,8 @@ type ResourceServiceClient interface {
WriteStatus(ctx context.Context, in *WriteStatusRequest, opts ...grpc.CallOption) (*WriteStatusResponse, error)
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (ResourceService_WatchClient, error)
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
WatchList(ctx context.Context, in *WatchListRequest, opts ...grpc.CallOption) (ResourceService_WatchListClient, error)
}
type resourceServiceClient struct {
@ -83,12 +84,12 @@ func (c *resourceServiceClient) Delete(ctx context.Context, in *DeleteRequest, o
return out, nil
}
func (c *resourceServiceClient) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (ResourceService_WatchClient, error) {
stream, err := c.cc.NewStream(ctx, &ResourceService_ServiceDesc.Streams[0], "/hashicorp.consul.resource.ResourceService/Watch", opts...)
func (c *resourceServiceClient) WatchList(ctx context.Context, in *WatchListRequest, opts ...grpc.CallOption) (ResourceService_WatchListClient, error) {
stream, err := c.cc.NewStream(ctx, &ResourceService_ServiceDesc.Streams[0], "/hashicorp.consul.resource.ResourceService/WatchList", opts...)
if err != nil {
return nil, err
}
x := &resourceServiceWatchClient{stream}
x := &resourceServiceWatchListClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
@ -98,17 +99,17 @@ func (c *resourceServiceClient) Watch(ctx context.Context, in *WatchRequest, opt
return x, nil
}
type ResourceService_WatchClient interface {
Recv() (*WatchResponse, error)
type ResourceService_WatchListClient interface {
Recv() (*WatchEvent, error)
grpc.ClientStream
}
type resourceServiceWatchClient struct {
type resourceServiceWatchListClient struct {
grpc.ClientStream
}
func (x *resourceServiceWatchClient) Recv() (*WatchResponse, error) {
m := new(WatchResponse)
func (x *resourceServiceWatchListClient) Recv() (*WatchEvent, error) {
m := new(WatchEvent)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
@ -124,7 +125,8 @@ type ResourceServiceServer interface {
WriteStatus(context.Context, *WriteStatusRequest) (*WriteStatusResponse, error)
List(context.Context, *ListRequest) (*ListResponse, error)
Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
Watch(*WatchRequest, ResourceService_WatchServer) error
// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
WatchList(*WatchListRequest, ResourceService_WatchListServer) error
}
// UnimplementedResourceServiceServer should be embedded to have forward compatible implementations.
@ -146,8 +148,8 @@ func (UnimplementedResourceServiceServer) List(context.Context, *ListRequest) (*
func (UnimplementedResourceServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedResourceServiceServer) Watch(*WatchRequest, ResourceService_WatchServer) error {
return status.Errorf(codes.Unimplemented, "method Watch not implemented")
func (UnimplementedResourceServiceServer) WatchList(*WatchListRequest, ResourceService_WatchListServer) error {
return status.Errorf(codes.Unimplemented, "method WatchList not implemented")
}
// UnsafeResourceServiceServer may be embedded to opt out of forward compatibility for this service.
@ -251,24 +253,24 @@ func _ResourceService_Delete_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler)
}
func _ResourceService_Watch_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(WatchRequest)
func _ResourceService_WatchList_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(WatchListRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(ResourceServiceServer).Watch(m, &resourceServiceWatchServer{stream})
return srv.(ResourceServiceServer).WatchList(m, &resourceServiceWatchListServer{stream})
}
type ResourceService_WatchServer interface {
Send(*WatchResponse) error
type ResourceService_WatchListServer interface {
Send(*WatchEvent) error
grpc.ServerStream
}
type resourceServiceWatchServer struct {
type resourceServiceWatchListServer struct {
grpc.ServerStream
}
func (x *resourceServiceWatchServer) Send(m *WatchResponse) error {
func (x *resourceServiceWatchListServer) Send(m *WatchEvent) error {
return x.ServerStream.SendMsg(m)
}
@ -302,8 +304,8 @@ var ResourceService_ServiceDesc = grpc.ServiceDesc{
},
Streams: []grpc.StreamDesc{
{
StreamName: "Watch",
Handler: _ResourceService_Watch_Handler,
StreamName: "WatchList",
Handler: _ResourceService_WatchList_Handler,
ServerStreams: true,
},
},