From d595e6ade96b537cc027361a6074a6fd261769dc Mon Sep 17 00:00:00 2001 From: Dan Upton Date: Tue, 11 Apr 2023 19:23:14 +0100 Subject: [PATCH] resource: `WriteStatus` endpoint (#16886) --- .../grpc-external/services/resource/server.go | 5 - .../services/resource/server_test.go | 11 +- .../grpc-external/services/resource/write.go | 38 +- .../services/resource/write_status.go | 132 +++ .../services/resource/write_status_test.go | 237 +++++ .../services/resource/write_test.go | 86 +- internal/resource/reference.go | 13 + internal/resource/status.go | 43 + internal/resource/status_test.go | 126 +++ proto-public/pbresource/resource.pb.binary.go | 50 +- proto-public/pbresource/resource.pb.go | 959 +++++++++++------- proto-public/pbresource/resource.proto | 48 +- 12 files changed, 1356 insertions(+), 392 deletions(-) create mode 100644 agent/grpc-external/services/resource/write_status.go create mode 100644 agent/grpc-external/services/resource/write_status_test.go create mode 100644 internal/resource/reference.go create mode 100644 internal/resource/status.go create mode 100644 internal/resource/status_test.go diff --git a/agent/grpc-external/services/resource/server.go b/agent/grpc-external/services/resource/server.go index d82e7c81bc..ce5b00444c 100644 --- a/agent/grpc-external/services/resource/server.go +++ b/agent/grpc-external/services/resource/server.go @@ -58,11 +58,6 @@ func (s *Server) Register(grpcServer *grpc.Server) { pbresource.RegisterResourceServiceServer(grpcServer, s) } -func (s *Server) WriteStatus(ctx context.Context, req *pbresource.WriteStatusRequest) (*pbresource.WriteStatusResponse, error) { - // TODO - return &pbresource.WriteStatusResponse{}, nil -} - // Get token from grpc metadata or AnonymounsTokenId if not found func tokenFromContext(ctx context.Context) string { md, ok := metadata.FromIncomingContext(ctx) diff --git a/agent/grpc-external/services/resource/server_test.go b/agent/grpc-external/services/resource/server_test.go index eef225b830..a92fff38a3 100644 --- a/agent/grpc-external/services/resource/server_test.go +++ b/agent/grpc-external/services/resource/server_test.go @@ -13,6 +13,8 @@ import ( "google.golang.org/grpc" "google.golang.org/protobuf/types/known/anypb" + "github.com/hashicorp/go-uuid" + "github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/acl/resolver" "github.com/hashicorp/consul/agent/grpc-external/testutils" @@ -22,17 +24,8 @@ import ( "github.com/hashicorp/consul/proto-public/pbresource" pbdemov2 "github.com/hashicorp/consul/proto/private/pbdemo/v2" "github.com/hashicorp/consul/sdk/testutil" - "github.com/hashicorp/go-uuid" ) -func TestWriteStatus_TODO(t *testing.T) { - server := testServer(t) - client := testClient(t, server) - resp, err := client.WriteStatus(context.Background(), &pbresource.WriteStatusRequest{}) - require.NoError(t, err) - require.NotNil(t, resp) -} - func randomACLIdentity(t *testing.T) structs.ACLIdentity { id, err := uuid.GenerateUUID() require.NoError(t, err) diff --git a/agent/grpc-external/services/resource/write.go b/agent/grpc-external/services/resource/write.go index 4a1a80e153..f7c5c03787 100644 --- a/agent/grpc-external/services/resource/write.go +++ b/agent/grpc-external/services/resource/write.go @@ -10,13 +10,30 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/hashicorp/consul/internal/resource" "github.com/hashicorp/consul/internal/storage" "github.com/hashicorp/consul/lib/retry" "github.com/hashicorp/consul/proto-public/pbresource" ) +// errUseWriteStatus is returned when the user attempts to modify the resource +// status using the Write endpoint. +// +// We only allow modifications to the status using the WriteStatus endpoint +// because: +// +// - Setting statuses should only be done by controllers and requires different +// permissions. +// +// - Status-only updates shouldn't increment the resource generation. +// +// While we could accomplish both in the Write handler, there's seldom need to +// update the resource body and status at the same time, so it makes more sense +// to keep them separate. +var errUseWriteStatus = status.Error(codes.InvalidArgument, "resource.status can only be set using the WriteStatus endpoint") + func (s *Server) Write(ctx context.Context, req *pbresource.WriteRequest) (*pbresource.WriteResponse, error) { - if err := validateWriteRequiredFields(req); err != nil { + if err := validateWriteRequest(req); err != nil { return nil, err } @@ -74,7 +91,9 @@ func (s *Server) Write(ctx context.Context, req *pbresource.WriteRequest) (*pbre case errors.Is(err, storage.ErrNotFound): input.Id.Uid = ulid.Make().String() - // TODO: Prevent setting statuses in this endpoint. + if len(input.Status) != 0 { + return errUseWriteStatus + } // Update path. case err == nil: @@ -101,13 +120,15 @@ func (s *Server) Write(ctx context.Context, req *pbresource.WriteRequest) (*pbre // - Read returns stale version `v1` // - We carry `v1`'s statuses over (effectively overwriting `v2`'s statuses) // - CAS operation succeeds anyway because user-given version is current - // - // TODO(boxofrad): add a test for this once the status field has been added. if input.Version != existing.Version { return storage.ErrCASFailure } - // TODO: Carry over the statuses here. + if input.Status == nil { + input.Status = existing.Status + } else if !resource.EqualStatus(input.Status, existing.Status) { + return errUseWriteStatus + } default: return err @@ -124,7 +145,10 @@ func (s *Server) Write(ctx context.Context, req *pbresource.WriteRequest) (*pbre case errors.Is(err, storage.ErrWrongUid): return nil, status.Error(codes.FailedPrecondition, err.Error()) case err != nil: - return nil, status.Errorf(codes.Internal, "failed to write resource: %v", err.Error()) + if _, ok := status.FromError(err); !ok { + err = status.Errorf(codes.Internal, "failed to write resource: %v", err.Error()) + } + return nil, err } return &pbresource.WriteResponse{Resource: result}, nil @@ -165,7 +189,7 @@ func (s *Server) retryCAS(ctx context.Context, vsn string, cas func() error) err return err } -func validateWriteRequiredFields(req *pbresource.WriteRequest) error { +func validateWriteRequest(req *pbresource.WriteRequest) error { var field string switch { case req.Resource == nil: diff --git a/agent/grpc-external/services/resource/write_status.go b/agent/grpc-external/services/resource/write_status.go new file mode 100644 index 0000000000..eacf7dbf75 --- /dev/null +++ b/agent/grpc-external/services/resource/write_status.go @@ -0,0 +1,132 @@ +package resource + +import ( + "context" + "errors" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/oklog/ulid/v2" + + "github.com/hashicorp/consul/internal/storage" + "github.com/hashicorp/consul/proto-public/pbresource" +) + +func (s *Server) WriteStatus(ctx context.Context, req *pbresource.WriteStatusRequest) (*pbresource.WriteStatusResponse, error) { + if err := validateWriteStatusRequest(req); err != nil { + return nil, err + } + + _, err := s.resolveType(req.Id.Type) + if err != nil { + return nil, err + } + + // At the storage backend layer, all writes are CAS operations. + // + // See comment in write.go for more information. + // + // Most controllers *won't* do an explicit CAS write of the status because it + // doesn't provide much value, and conflicts are fairly likely in the flurry + // of activity after a resource is updated. + // + // Here's why that's okay: + // + // - Controllers should only update their own status (identified by its key) + // and updating separate statuses is commutative. + // + // - Controllers that make writes should be leader-elected singletons (i.e. + // there should only be one instance of the controller running) so we don't + // need to worry about multiple instances racing with each other. + // + // - Only controllers are supposed to write statuses, so you should never be + // racing with a user's write of the same status. + var result *pbresource.Resource + err = s.retryCAS(ctx, req.Version, func() error { + resource, err := s.Backend.Read(ctx, storage.EventualConsistency, req.Id) + if err != nil { + return err + } + + if req.Version != "" && req.Version != resource.Version { + return storage.ErrCASFailure + } + + resource = clone(resource) + if resource.Status == nil { + resource.Status = make(map[string]*pbresource.Status) + } + resource.Status[req.Key] = req.Status + + result, err = s.Backend.WriteCAS(ctx, resource) + return err + }) + + switch { + case errors.Is(err, storage.ErrNotFound): + return nil, status.Error(codes.NotFound, err.Error()) + case errors.Is(err, storage.ErrCASFailure): + return nil, status.Error(codes.Aborted, err.Error()) + case err != nil: + return nil, status.Errorf(codes.Internal, "failed to write resource: %v", err.Error()) + } + + return &pbresource.WriteStatusResponse{Resource: result}, nil +} + +func validateWriteStatusRequest(req *pbresource.WriteStatusRequest) error { + var field string + switch { + case req.Id == nil: + field = "id" + case req.Id.Type == nil: + field = "id.type" + case req.Id.Tenancy == nil: + field = "id.tenancy" + case req.Id.Name == "": + field = "id.name" + case req.Id.Uid == "": + // We require Uid because only controllers should write statuses and + // controllers should *always* refer to a specific incarnation of a + // resource using its Uid. + field = "id.uid" + case req.Key == "": + field = "key" + case req.Status == nil: + field = "status" + case req.Status.ObservedGeneration == "": + field = "status.observed_generation" + default: + for i, condition := range req.Status.Conditions { + if condition.Type == "" { + field = fmt.Sprintf("status.conditions[%d].type", i) + break + } + + if condition.Resource != nil { + switch { + case condition.Resource.Type == nil: + field = fmt.Sprintf("status.conditions[%d].resource.type", i) + break + case condition.Resource.Tenancy == nil: + field = fmt.Sprintf("status.conditions[%d].resource.tenancy", i) + break + case condition.Resource.Name == "": + field = fmt.Sprintf("status.conditions[%d].resource.name", i) + break + } + } + } + } + if field != "" { + return status.Errorf(codes.InvalidArgument, "%s is required", field) + } + + if _, err := ulid.ParseStrict(req.Status.ObservedGeneration); err != nil { + return status.Error(codes.InvalidArgument, "status.observed_generation is not valid") + } + + return nil +} diff --git a/agent/grpc-external/services/resource/write_status_test.go b/agent/grpc-external/services/resource/write_status_test.go new file mode 100644 index 0000000000..70e1967222 --- /dev/null +++ b/agent/grpc-external/services/resource/write_status_test.go @@ -0,0 +1,237 @@ +package resource + +import ( + "fmt" + "testing" + + "github.com/oklog/ulid/v2" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/hashicorp/consul/internal/resource" + "github.com/hashicorp/consul/internal/resource/demo" + "github.com/hashicorp/consul/proto-public/pbresource" +) + +func TestWriteStatus_InputValidation(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + + demo.Register(server.Registry) + + testCases := map[string]func(*pbresource.WriteStatusRequest){ + "no id": func(req *pbresource.WriteStatusRequest) { req.Id = nil }, + "no type": func(req *pbresource.WriteStatusRequest) { req.Id.Type = nil }, + "no tenancy": func(req *pbresource.WriteStatusRequest) { req.Id.Tenancy = nil }, + "no name": func(req *pbresource.WriteStatusRequest) { req.Id.Name = "" }, + "no uid": func(req *pbresource.WriteStatusRequest) { req.Id.Uid = "" }, + "no key": func(req *pbresource.WriteStatusRequest) { req.Key = "" }, + "no status": func(req *pbresource.WriteStatusRequest) { req.Status = nil }, + "no observed generation": func(req *pbresource.WriteStatusRequest) { req.Status.ObservedGeneration = "" }, + "bad observed generation": func(req *pbresource.WriteStatusRequest) { req.Status.ObservedGeneration = "bogus" }, + "no condition type": func(req *pbresource.WriteStatusRequest) { req.Status.Conditions[0].Type = "" }, + "no reference type": func(req *pbresource.WriteStatusRequest) { req.Status.Conditions[0].Resource.Type = nil }, + "no reference tenancy": func(req *pbresource.WriteStatusRequest) { req.Status.Conditions[0].Resource.Tenancy = nil }, + "no reference name": func(req *pbresource.WriteStatusRequest) { req.Status.Conditions[0].Resource.Name = "" }, + } + for desc, modFn := range testCases { + t.Run(desc, func(t *testing.T) { + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + + res.Id.Uid = ulid.Make().String() + res.Generation = ulid.Make().String() + + req := validWriteStatusRequest(t, res) + modFn(req) + + _, err = client.WriteStatus(testContext(t), req) + require.Error(t, err) + require.Equal(t, codes.InvalidArgument.String(), status.Code(err).String()) + }) + } +} + +func TestWriteStatus_Success(t *testing.T) { + for desc, fn := range map[string]func(*pbresource.WriteStatusRequest){ + "CAS": func(*pbresource.WriteStatusRequest) {}, + "Non CAS": func(req *pbresource.WriteStatusRequest) { req.Version = "" }, + } { + t.Run(desc, func(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + + demo.Register(server.Registry) + + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + + writeRsp, err := client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.NoError(t, err) + res = writeRsp.Resource + + req := validWriteStatusRequest(t, res) + fn(req) + + rsp, err := client.WriteStatus(testContext(t), req) + require.NoError(t, err) + res = rsp.Resource + + req = validWriteStatusRequest(t, res) + req.Key = "consul.io/other-controller" + fn(req) + + rsp, err = client.WriteStatus(testContext(t), req) + require.NoError(t, err) + + require.Equal(t, rsp.Resource.Generation, res.Generation, "generation should not have changed") + require.NotEqual(t, rsp.Resource.Version, res.Version, "version should have changed") + require.Contains(t, rsp.Resource.Status, "consul.io/other-controller") + require.Contains(t, rsp.Resource.Status, "consul.io/artist-controller") + }) + } +} + +func TestWriteStatus_CASFailure(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + + demo.Register(server.Registry) + + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + + rsp, err := client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.NoError(t, err) + res = rsp.Resource + + req := validWriteStatusRequest(t, res) + req.Version = "nope" + + _, err = client.WriteStatus(testContext(t), req) + require.Error(t, err) + require.Equal(t, codes.Aborted.String(), status.Code(err).String()) +} + +func TestWriteStatus_TypeNotFound(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + res.Id.Uid = ulid.Make().String() + res.Generation = ulid.Make().String() + + _, err = client.WriteStatus(testContext(t), validWriteStatusRequest(t, res)) + require.Error(t, err) + require.Equal(t, codes.InvalidArgument.String(), status.Code(err).String()) + require.Contains(t, err.Error(), "resource type demo.v2.artist not registered") +} + +func TestWriteStatus_ResourceNotFound(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + demo.Register(server.Registry) + + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + res.Id.Uid = ulid.Make().String() + res.Generation = ulid.Make().String() + + _, err = client.WriteStatus(testContext(t), validWriteStatusRequest(t, res)) + require.Error(t, err) + require.Equal(t, codes.NotFound.String(), status.Code(err).String()) +} + +func TestWriteStatus_WrongUid(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + demo.Register(server.Registry) + + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + + rsp, err := client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.NoError(t, err) + res = rsp.Resource + + req := validWriteStatusRequest(t, res) + req.Id.Uid = ulid.Make().String() + + _, err = client.WriteStatus(testContext(t), req) + require.Error(t, err) + require.Equal(t, codes.NotFound.String(), status.Code(err).String()) +} + +func TestWriteStatus_NonCASUpdate_Retry(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + + demo.Register(server.Registry) + + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + + rsp, err := client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.NoError(t, err) + res = rsp.Resource + + // Simulate conflicting writes by blocking the RPC after it has read the + // current version of the resource, but before it tries to make a write. + backend := &blockOnceBackend{ + Backend: server.Backend, + + readCh: make(chan struct{}), + blockCh: make(chan struct{}), + } + server.Backend = backend + + errCh := make(chan error) + go func() { + req := validWriteStatusRequest(t, res) + req.Version = "" + + _, err := client.WriteStatus(testContext(t), req) + errCh <- err + }() + + // Wait for the read, to ensure the Write in the goroutine above has read the + // current version of the resource. + <-backend.readCh + + // Update the resource. + _, err = client.Write(testContext(t), &pbresource.WriteRequest{Resource: modifyArtist(t, res)}) + require.NoError(t, err) + + // Unblock the read. + close(backend.blockCh) + + // Check that the write succeeded anyway because of a retry. + require.NoError(t, <-errCh) +} + +func validWriteStatusRequest(t *testing.T, res *pbresource.Resource) *pbresource.WriteStatusRequest { + t.Helper() + + album, err := demo.GenerateV2Album(res.Id) + require.NoError(t, err) + + return &pbresource.WriteStatusRequest{ + Id: res.Id, + Version: res.Version, + Key: "consul.io/artist-controller", + Status: &pbresource.Status{ + ObservedGeneration: res.Generation, + Conditions: []*pbresource.Condition{ + { + Type: "AlbumCreated", + State: pbresource.Condition_STATE_TRUE, + Reason: "AlbumCreated", + Message: fmt.Sprintf("Album '%s' created", album.Id.Name), + Resource: resource.Reference(album.Id, ""), + }, + }, + }, + } +} diff --git a/agent/grpc-external/services/resource/write_test.go b/agent/grpc-external/services/resource/write_test.go index 2fbbaee80f..75c65f1a91 100644 --- a/agent/grpc-external/services/resource/write_test.go +++ b/agent/grpc-external/services/resource/write_test.go @@ -2,9 +2,10 @@ package resource import ( "context" - "sync" + "sync/atomic" "testing" + "github.com/oklog/ulid/v2" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -69,7 +70,7 @@ func TestWrite_TypeNotFound(t *testing.T) { require.Contains(t, err.Error(), "resource type demo.v2.artist not registered") } -func TestWrite_ResourceCreation(t *testing.T) { +func TestWrite_ResourceCreation_Success(t *testing.T) { server := testServer(t) client := testClient(t, server) @@ -107,6 +108,25 @@ func TestWrite_CASUpdate_Success(t *testing.T) { require.NotEqual(t, rsp1.Resource.Generation, rsp2.Resource.Generation) } +func TestWrite_ResourceCreation_StatusProvided(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + + demo.Register(server.Registry) + + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + + res.Status = map[string]*pbresource.Status{ + "consul.io/some-controller": {ObservedGeneration: ulid.Make().String()}, + } + + _, err = client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.Error(t, err) + require.Equal(t, codes.InvalidArgument.String(), status.Code(err).String()) + require.Contains(t, err.Error(), "WriteStatus endpoint") +} + func TestWrite_CASUpdate_Failure(t *testing.T) { server := testServer(t) client := testClient(t, server) @@ -149,6 +169,60 @@ func TestWrite_Update_WrongUid(t *testing.T) { require.Contains(t, err.Error(), "uid doesn't match") } +func TestWrite_Update_StatusModified(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + + demo.Register(server.Registry) + + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + + rsp1, err := client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.NoError(t, err) + + statusRsp, err := client.WriteStatus(testContext(t), validWriteStatusRequest(t, rsp1.Resource)) + require.NoError(t, err) + res = statusRsp.Resource + + // Passing the staus unmodified should be fine. + rsp2, err := client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.NoError(t, err) + + // Attempting to modify the status should return an error. + res = rsp2.Resource + res.Status["consul.io/other-controller"] = &pbresource.Status{ObservedGeneration: res.Generation} + + _, err = client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.Error(t, err) + require.Equal(t, codes.InvalidArgument.String(), status.Code(err).String()) + require.Contains(t, err.Error(), "WriteStatus endpoint") +} + +func TestWrite_Update_NilStatus(t *testing.T) { + server := testServer(t) + client := testClient(t, server) + + demo.Register(server.Registry) + + res, err := demo.GenerateV2Artist() + require.NoError(t, err) + + rsp1, err := client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.NoError(t, err) + + statusRsp, err := client.WriteStatus(testContext(t), validWriteStatusRequest(t, rsp1.Resource)) + require.NoError(t, err) + + // Passing a nil status should be fine (and carry over the old status). + res = statusRsp.Resource + res.Status = nil + + rsp2, err := client.Write(testContext(t), &pbresource.WriteRequest{Resource: res}) + require.NoError(t, err) + require.NotEmpty(t, rsp2.Resource.Status) +} + func TestWrite_Update_NoUid(t *testing.T) { server := testServer(t) client := testClient(t, server) @@ -239,7 +313,7 @@ func TestWrite_NonCASUpdate_Retry(t *testing.T) { type blockOnceBackend struct { storage.Backend - once sync.Once + done uint32 readCh chan struct{} blockCh chan struct{} } @@ -247,10 +321,12 @@ type blockOnceBackend struct { func (b *blockOnceBackend) Read(ctx context.Context, consistency storage.ReadConsistency, id *pbresource.ID) (*pbresource.Resource, error) { res, err := b.Backend.Read(ctx, consistency, id) - b.once.Do(func() { + // Block for exactly one call to Read. All subsequent calls (including those + // concurrent to the blocked call) will return immediately. + if atomic.CompareAndSwapUint32(&b.done, 0, 1) { close(b.readCh) <-b.blockCh - }) + } return res, err } diff --git a/internal/resource/reference.go b/internal/resource/reference.go new file mode 100644 index 0000000000..2e48ce03f7 --- /dev/null +++ b/internal/resource/reference.go @@ -0,0 +1,13 @@ +package resource + +import "github.com/hashicorp/consul/proto-public/pbresource" + +// Reference returns a reference to the resource with the given ID. +func Reference(id *pbresource.ID, section string) *pbresource.Reference { + return &pbresource.Reference{ + Type: id.Type, + Tenancy: id.Tenancy, + Name: id.Name, + Section: section, + } +} diff --git a/internal/resource/status.go b/internal/resource/status.go new file mode 100644 index 0000000000..7c67fb3fff --- /dev/null +++ b/internal/resource/status.go @@ -0,0 +1,43 @@ +package resource + +import ( + "google.golang.org/protobuf/proto" + + "github.com/hashicorp/consul/proto-public/pbresource" +) + +// EqualStatus compares two status maps for equality. +func EqualStatus(a, b map[string]*pbresource.Status) bool { + if len(a) != len(b) { + return false + } + + compared := make(map[string]struct{}) + for k, av := range a { + bv, ok := b[k] + if !ok { + return false + } + if !proto.Equal(av, bv) { + return false + } + compared[k] = struct{}{} + } + + for k, bv := range b { + if _, skip := compared[k]; skip { + continue + } + + av, ok := a[k] + if !ok { + return false + } + + if !proto.Equal(av, bv) { + return false + } + } + + return true +} diff --git a/internal/resource/status_test.go b/internal/resource/status_test.go new file mode 100644 index 0000000000..d62d431ee2 --- /dev/null +++ b/internal/resource/status_test.go @@ -0,0 +1,126 @@ +package resource + +import ( + "fmt" + "testing" + + "github.com/oklog/ulid/v2" + "github.com/stretchr/testify/require" + + "github.com/hashicorp/consul/proto-public/pbresource" +) + +func TestEqualStatus(t *testing.T) { + generation := ulid.Make().String() + + for idx, tc := range []struct { + a, b map[string]*pbresource.Status + equal bool + }{ + {nil, nil, true}, + {nil, map[string]*pbresource.Status{}, true}, + { + map[string]*pbresource.Status{ + "consul.io/some-controller": { + ObservedGeneration: generation, + Conditions: []*pbresource.Condition{ + { + Type: "Foo", + State: pbresource.Condition_STATE_TRUE, + Reason: "Bar", + Message: "Foo is true because of Bar", + }, + }, + }, + }, + map[string]*pbresource.Status{ + "consul.io/some-controller": { + ObservedGeneration: generation, + Conditions: []*pbresource.Condition{ + { + Type: "Foo", + State: pbresource.Condition_STATE_TRUE, + Reason: "Bar", + Message: "Foo is true because of Bar", + }, + }, + }, + }, + true, + }, + { + map[string]*pbresource.Status{ + "consul.io/some-controller": { + ObservedGeneration: generation, + Conditions: []*pbresource.Condition{ + { + Type: "Foo", + State: pbresource.Condition_STATE_TRUE, + Reason: "Bar", + Message: "Foo is true because of Bar", + }, + }, + }, + }, + map[string]*pbresource.Status{ + "consul.io/some-controller": { + ObservedGeneration: generation, + Conditions: []*pbresource.Condition{ + { + Type: "Foo", + State: pbresource.Condition_STATE_FALSE, + Reason: "Bar", + Message: "Foo is false because of Bar", + }, + }, + }, + }, + false, + }, + { + map[string]*pbresource.Status{ + "consul.io/some-controller": { + ObservedGeneration: generation, + Conditions: []*pbresource.Condition{ + { + Type: "Foo", + State: pbresource.Condition_STATE_TRUE, + Reason: "Bar", + Message: "Foo is true because of Bar", + }, + }, + }, + }, + map[string]*pbresource.Status{ + "consul.io/some-controller": { + ObservedGeneration: generation, + Conditions: []*pbresource.Condition{ + { + Type: "Foo", + State: pbresource.Condition_STATE_TRUE, + Reason: "Bar", + Message: "Foo is true because of Bar", + }, + }, + }, + "consul.io/other-controller": { + ObservedGeneration: generation, + Conditions: []*pbresource.Condition{ + { + Type: "Foo", + State: pbresource.Condition_STATE_TRUE, + Reason: "Bar", + Message: "Foo is true because of Bar", + }, + }, + }, + }, + false, + }, + } { + t.Run(fmt.Sprintf("%d", idx), func(t *testing.T) { + require.Equal(t, tc.equal, EqualStatus(tc.a, tc.b)) + require.Equal(t, tc.equal, EqualStatus(tc.b, tc.a)) + }) + } +} diff --git a/proto-public/pbresource/resource.pb.binary.go b/proto-public/pbresource/resource.pb.binary.go index cdb3f0ca59..00bf89d498 100644 --- a/proto-public/pbresource/resource.pb.binary.go +++ b/proto-public/pbresource/resource.pb.binary.go @@ -47,6 +47,36 @@ func (msg *Resource) UnmarshalBinary(b []byte) error { return proto.Unmarshal(b, msg) } +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *Status) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *Status) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} + +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *Condition) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *Condition) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} + +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *Reference) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *Reference) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} + // MarshalBinary implements encoding.BinaryMarshaler func (msg *WatchEvent) MarshalBinary() ([]byte, error) { return proto.Marshal(msg) @@ -117,16 +147,6 @@ func (msg *WriteResponse) UnmarshalBinary(b []byte) error { return proto.Unmarshal(b, msg) } -// MarshalBinary implements encoding.BinaryMarshaler -func (msg *WriteStatusResponse) MarshalBinary() ([]byte, error) { - return proto.Marshal(msg) -} - -// UnmarshalBinary implements encoding.BinaryUnmarshaler -func (msg *WriteStatusResponse) UnmarshalBinary(b []byte) error { - return proto.Unmarshal(b, msg) -} - // MarshalBinary implements encoding.BinaryMarshaler func (msg *WriteStatusRequest) MarshalBinary() ([]byte, error) { return proto.Marshal(msg) @@ -137,6 +157,16 @@ func (msg *WriteStatusRequest) UnmarshalBinary(b []byte) error { return proto.Unmarshal(b, msg) } +// MarshalBinary implements encoding.BinaryMarshaler +func (msg *WriteStatusResponse) MarshalBinary() ([]byte, error) { + return proto.Marshal(msg) +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler +func (msg *WriteStatusResponse) UnmarshalBinary(b []byte) error { + return proto.Unmarshal(b, msg) +} + // MarshalBinary implements encoding.BinaryMarshaler func (msg *DeleteRequest) MarshalBinary() ([]byte, error) { return proto.Marshal(msg) diff --git a/proto-public/pbresource/resource.pb.go b/proto-public/pbresource/resource.pb.go index 6e4e119479..5cccb46c5d 100644 --- a/proto-public/pbresource/resource.pb.go +++ b/proto-public/pbresource/resource.pb.go @@ -25,56 +25,54 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type Condition int32 +type Condition_State int32 const ( - Condition_CONDITION_UNSPECIFIED Condition = 0 - Condition_CONDITION_ACCEPTED Condition = 1 - Condition_CONDITION_INVALID Condition = 2 - Condition_CONDITION_PERSISTENT_FAILURE Condition = 3 + // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + Condition_STATE_UNKNOWN Condition_State = 0 + Condition_STATE_TRUE Condition_State = 1 + Condition_STATE_FALSE Condition_State = 2 ) -// Enum value maps for Condition. +// Enum value maps for Condition_State. var ( - Condition_name = map[int32]string{ - 0: "CONDITION_UNSPECIFIED", - 1: "CONDITION_ACCEPTED", - 2: "CONDITION_INVALID", - 3: "CONDITION_PERSISTENT_FAILURE", + Condition_State_name = map[int32]string{ + 0: "STATE_UNKNOWN", + 1: "STATE_TRUE", + 2: "STATE_FALSE", } - Condition_value = map[string]int32{ - "CONDITION_UNSPECIFIED": 0, - "CONDITION_ACCEPTED": 1, - "CONDITION_INVALID": 2, - "CONDITION_PERSISTENT_FAILURE": 3, + Condition_State_value = map[string]int32{ + "STATE_UNKNOWN": 0, + "STATE_TRUE": 1, + "STATE_FALSE": 2, } ) -func (x Condition) Enum() *Condition { - p := new(Condition) +func (x Condition_State) Enum() *Condition_State { + p := new(Condition_State) *p = x return p } -func (x Condition) String() string { +func (x Condition_State) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (Condition) Descriptor() protoreflect.EnumDescriptor { +func (Condition_State) Descriptor() protoreflect.EnumDescriptor { return file_pbresource_resource_proto_enumTypes[0].Descriptor() } -func (Condition) Type() protoreflect.EnumType { +func (Condition_State) Type() protoreflect.EnumType { return &file_pbresource_resource_proto_enumTypes[0] } -func (x Condition) Number() protoreflect.EnumNumber { +func (x Condition_State) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use Condition.Descriptor instead. -func (Condition) EnumDescriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{0} +// Deprecated: Use Condition_State.Descriptor instead. +func (Condition_State) EnumDescriptor() ([]byte, []int) { + return file_pbresource_resource_proto_rawDescGZIP(), []int{5, 0} } type WatchEvent_Operation int32 @@ -123,7 +121,7 @@ func (x WatchEvent_Operation) Number() protoreflect.EnumNumber { // Deprecated: Use WatchEvent_Operation.Descriptor instead. func (WatchEvent_Operation) EnumDescriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{4, 0} + return file_pbresource_resource_proto_rawDescGZIP(), []int{7, 0} } type Type struct { @@ -328,12 +326,13 @@ type Resource struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *ID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Owner *ID `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - Generation string `protobuf:"bytes,4,opt,name=generation,proto3" json:"generation,omitempty"` - Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Data *anypb.Any `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"` + Id *ID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Owner *ID `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Generation string `protobuf:"bytes,4,opt,name=generation,proto3" json:"generation,omitempty"` + Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Status map[string]*Status `protobuf:"bytes,6,rep,name=status,proto3" json:"status,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Data *anypb.Any `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"` } func (x *Resource) Reset() { @@ -403,6 +402,13 @@ func (x *Resource) GetMetadata() map[string]string { return nil } +func (x *Resource) GetStatus() map[string]*Status { + if x != nil { + return x.Status + } + return nil +} + func (x *Resource) GetData() *anypb.Any { if x != nil { return x.Data @@ -410,6 +416,211 @@ func (x *Resource) GetData() *anypb.Any { return nil } +type Status struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ObservedGeneration string `protobuf:"bytes,1,opt,name=observed_generation,json=observedGeneration,proto3" json:"observed_generation,omitempty"` + Conditions []*Condition `protobuf:"bytes,2,rep,name=conditions,proto3" json:"conditions,omitempty"` +} + +func (x *Status) Reset() { + *x = Status{} + if protoimpl.UnsafeEnabled { + mi := &file_pbresource_resource_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Status) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status) ProtoMessage() {} + +func (x *Status) ProtoReflect() protoreflect.Message { + mi := &file_pbresource_resource_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Status.ProtoReflect.Descriptor instead. +func (*Status) Descriptor() ([]byte, []int) { + return file_pbresource_resource_proto_rawDescGZIP(), []int{4} +} + +func (x *Status) GetObservedGeneration() string { + if x != nil { + return x.ObservedGeneration + } + return "" +} + +func (x *Status) GetConditions() []*Condition { + if x != nil { + return x.Conditions + } + return nil +} + +type Condition struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + State Condition_State `protobuf:"varint,2,opt,name=state,proto3,enum=hashicorp.consul.resource.Condition_State" json:"state,omitempty"` + Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"` + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` + Resource *Reference `protobuf:"bytes,5,opt,name=resource,proto3" json:"resource,omitempty"` +} + +func (x *Condition) Reset() { + *x = Condition{} + if protoimpl.UnsafeEnabled { + mi := &file_pbresource_resource_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Condition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Condition) ProtoMessage() {} + +func (x *Condition) ProtoReflect() protoreflect.Message { + mi := &file_pbresource_resource_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Condition.ProtoReflect.Descriptor instead. +func (*Condition) Descriptor() ([]byte, []int) { + return file_pbresource_resource_proto_rawDescGZIP(), []int{5} +} + +func (x *Condition) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Condition) GetState() Condition_State { + if x != nil { + return x.State + } + return Condition_STATE_UNKNOWN +} + +func (x *Condition) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +func (x *Condition) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *Condition) GetResource() *Reference { + if x != nil { + return x.Resource + } + return nil +} + +type Reference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type *Type `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Tenancy *Tenancy `protobuf:"bytes,2,opt,name=tenancy,proto3" json:"tenancy,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Section string `protobuf:"bytes,4,opt,name=section,proto3" json:"section,omitempty"` +} + +func (x *Reference) Reset() { + *x = Reference{} + if protoimpl.UnsafeEnabled { + mi := &file_pbresource_resource_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Reference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Reference) ProtoMessage() {} + +func (x *Reference) ProtoReflect() protoreflect.Message { + mi := &file_pbresource_resource_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Reference.ProtoReflect.Descriptor instead. +func (*Reference) Descriptor() ([]byte, []int) { + return file_pbresource_resource_proto_rawDescGZIP(), []int{6} +} + +func (x *Reference) GetType() *Type { + if x != nil { + return x.Type + } + return nil +} + +func (x *Reference) GetTenancy() *Tenancy { + if x != nil { + return x.Tenancy + } + return nil +} + +func (x *Reference) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Reference) GetSection() string { + if x != nil { + return x.Section + } + return "" +} + type WatchEvent struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -422,7 +633,7 @@ type WatchEvent struct { func (x *WatchEvent) Reset() { *x = WatchEvent{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[4] + mi := &file_pbresource_resource_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -435,7 +646,7 @@ func (x *WatchEvent) String() string { func (*WatchEvent) ProtoMessage() {} func (x *WatchEvent) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[4] + mi := &file_pbresource_resource_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -448,7 +659,7 @@ func (x *WatchEvent) ProtoReflect() protoreflect.Message { // Deprecated: Use WatchEvent.ProtoReflect.Descriptor instead. func (*WatchEvent) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{4} + return file_pbresource_resource_proto_rawDescGZIP(), []int{7} } func (x *WatchEvent) GetOperation() WatchEvent_Operation { @@ -476,7 +687,7 @@ type ReadRequest struct { func (x *ReadRequest) Reset() { *x = ReadRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[5] + mi := &file_pbresource_resource_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -489,7 +700,7 @@ func (x *ReadRequest) String() string { func (*ReadRequest) ProtoMessage() {} func (x *ReadRequest) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[5] + mi := &file_pbresource_resource_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -502,7 +713,7 @@ func (x *ReadRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead. func (*ReadRequest) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{5} + return file_pbresource_resource_proto_rawDescGZIP(), []int{8} } func (x *ReadRequest) GetId() *ID { @@ -523,7 +734,7 @@ type ReadResponse struct { func (x *ReadResponse) Reset() { *x = ReadResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[6] + mi := &file_pbresource_resource_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -536,7 +747,7 @@ func (x *ReadResponse) String() string { func (*ReadResponse) ProtoMessage() {} func (x *ReadResponse) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[6] + mi := &file_pbresource_resource_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -549,7 +760,7 @@ func (x *ReadResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead. func (*ReadResponse) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{6} + return file_pbresource_resource_proto_rawDescGZIP(), []int{9} } func (x *ReadResponse) GetResource() *Resource { @@ -572,7 +783,7 @@ type ListRequest struct { func (x *ListRequest) Reset() { *x = ListRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[7] + mi := &file_pbresource_resource_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -585,7 +796,7 @@ func (x *ListRequest) String() string { func (*ListRequest) ProtoMessage() {} func (x *ListRequest) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[7] + mi := &file_pbresource_resource_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -598,7 +809,7 @@ func (x *ListRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListRequest.ProtoReflect.Descriptor instead. func (*ListRequest) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{7} + return file_pbresource_resource_proto_rawDescGZIP(), []int{10} } func (x *ListRequest) GetType() *Type { @@ -633,7 +844,7 @@ type ListResponse struct { func (x *ListResponse) Reset() { *x = ListResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[8] + mi := &file_pbresource_resource_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -646,7 +857,7 @@ func (x *ListResponse) String() string { func (*ListResponse) ProtoMessage() {} func (x *ListResponse) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[8] + mi := &file_pbresource_resource_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -659,7 +870,7 @@ func (x *ListResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListResponse.ProtoReflect.Descriptor instead. func (*ListResponse) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{8} + return file_pbresource_resource_proto_rawDescGZIP(), []int{11} } func (x *ListResponse) GetResources() []*Resource { @@ -680,7 +891,7 @@ type WriteRequest struct { func (x *WriteRequest) Reset() { *x = WriteRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[9] + mi := &file_pbresource_resource_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -693,7 +904,7 @@ func (x *WriteRequest) String() string { func (*WriteRequest) ProtoMessage() {} func (x *WriteRequest) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[9] + mi := &file_pbresource_resource_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -706,7 +917,7 @@ func (x *WriteRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WriteRequest.ProtoReflect.Descriptor instead. func (*WriteRequest) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{9} + return file_pbresource_resource_proto_rawDescGZIP(), []int{12} } func (x *WriteRequest) GetResource() *Resource { @@ -727,7 +938,7 @@ type WriteResponse struct { func (x *WriteResponse) Reset() { *x = WriteResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[10] + mi := &file_pbresource_resource_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -740,7 +951,7 @@ func (x *WriteResponse) String() string { func (*WriteResponse) ProtoMessage() {} func (x *WriteResponse) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[10] + mi := &file_pbresource_resource_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -753,7 +964,7 @@ func (x *WriteResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use WriteResponse.ProtoReflect.Descriptor instead. func (*WriteResponse) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{10} + return file_pbresource_resource_proto_rawDescGZIP(), []int{13} } func (x *WriteResponse) GetResource() *Resource { @@ -763,70 +974,21 @@ func (x *WriteResponse) GetResource() *Resource { return nil } -type WriteStatusResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` -} - -func (x *WriteStatusResponse) Reset() { - *x = WriteStatusResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WriteStatusResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteStatusResponse) ProtoMessage() {} - -func (x *WriteStatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[11] - 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 WriteStatusResponse.ProtoReflect.Descriptor instead. -func (*WriteStatusResponse) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{11} -} - -func (x *WriteStatusResponse) GetResource() *Resource { - if x != nil { - return x.Resource - } - return nil -} - type WriteStatusRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *ID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` - Condition Condition `protobuf:"varint,4,opt,name=condition,proto3,enum=hashicorp.consul.resource.Condition" json:"condition,omitempty"` - State string `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` - Messages []string `protobuf:"bytes,6,rep,name=messages,proto3" json:"messages,omitempty"` + Id *ID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + Status *Status `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` } func (x *WriteStatusRequest) Reset() { *x = WriteStatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[12] + mi := &file_pbresource_resource_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -839,7 +1001,7 @@ func (x *WriteStatusRequest) String() string { func (*WriteStatusRequest) ProtoMessage() {} func (x *WriteStatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[12] + mi := &file_pbresource_resource_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -852,7 +1014,7 @@ func (x *WriteStatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WriteStatusRequest.ProtoReflect.Descriptor instead. func (*WriteStatusRequest) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{12} + return file_pbresource_resource_proto_rawDescGZIP(), []int{14} } func (x *WriteStatusRequest) GetId() *ID { @@ -876,23 +1038,56 @@ func (x *WriteStatusRequest) GetKey() string { return "" } -func (x *WriteStatusRequest) GetCondition() Condition { +func (x *WriteStatusRequest) GetStatus() *Status { if x != nil { - return x.Condition + return x.Status } - return Condition_CONDITION_UNSPECIFIED + return nil } -func (x *WriteStatusRequest) GetState() string { - if x != nil { - return x.State - } - return "" +type WriteStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` } -func (x *WriteStatusRequest) GetMessages() []string { +func (x *WriteStatusResponse) Reset() { + *x = WriteStatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pbresource_resource_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WriteStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteStatusResponse) ProtoMessage() {} + +func (x *WriteStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_pbresource_resource_proto_msgTypes[15] + 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 WriteStatusResponse.ProtoReflect.Descriptor instead. +func (*WriteStatusResponse) Descriptor() ([]byte, []int) { + return file_pbresource_resource_proto_rawDescGZIP(), []int{15} +} + +func (x *WriteStatusResponse) GetResource() *Resource { if x != nil { - return x.Messages + return x.Resource } return nil } @@ -909,7 +1104,7 @@ type DeleteRequest struct { func (x *DeleteRequest) Reset() { *x = DeleteRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[13] + mi := &file_pbresource_resource_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -922,7 +1117,7 @@ func (x *DeleteRequest) String() string { func (*DeleteRequest) ProtoMessage() {} func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[13] + mi := &file_pbresource_resource_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -935,7 +1130,7 @@ func (x *DeleteRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{13} + return file_pbresource_resource_proto_rawDescGZIP(), []int{16} } func (x *DeleteRequest) GetId() *ID { @@ -961,7 +1156,7 @@ type DeleteResponse struct { func (x *DeleteResponse) Reset() { *x = DeleteResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[14] + mi := &file_pbresource_resource_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -974,7 +1169,7 @@ func (x *DeleteResponse) String() string { func (*DeleteResponse) ProtoMessage() {} func (x *DeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[14] + mi := &file_pbresource_resource_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -987,7 +1182,7 @@ func (x *DeleteResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. func (*DeleteResponse) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{14} + return file_pbresource_resource_proto_rawDescGZIP(), []int{17} } type WatchListRequest struct { @@ -1003,7 +1198,7 @@ type WatchListRequest struct { func (x *WatchListRequest) Reset() { *x = WatchListRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pbresource_resource_proto_msgTypes[15] + mi := &file_pbresource_resource_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1016,7 +1211,7 @@ func (x *WatchListRequest) String() string { func (*WatchListRequest) ProtoMessage() {} func (x *WatchListRequest) ProtoReflect() protoreflect.Message { - mi := &file_pbresource_resource_proto_msgTypes[15] + mi := &file_pbresource_resource_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1029,7 +1224,7 @@ func (x *WatchListRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WatchListRequest.ProtoReflect.Descriptor instead. func (*WatchListRequest) Descriptor() ([]byte, []int) { - return file_pbresource_resource_proto_rawDescGZIP(), []int{15} + return file_pbresource_resource_proto_rawDescGZIP(), []int{18} } func (x *WatchListRequest) GetType() *Type { @@ -1085,7 +1280,7 @@ var file_pbresource_resource_proto_rawDesc = []byte{ 0x18, 0x04, 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, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x63, 0x79, 0x52, 0x07, 0x74, 0x65, 0x6e, 0x61, - 0x6e, 0x63, 0x79, 0x22, 0xe4, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x6e, 0x63, 0x79, 0x22, 0x85, 0x04, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 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, 0x12, @@ -1100,165 +1295,200 @@ var file_pbresource_resource_proto_rawDesc = []byte{ 0x32, 0x31, 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, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x4a, 0x04, 0x08, 0x06, 0x10, 0x07, 0x22, 0xf0, 0x01, 0x0a, 0x0a, 0x57, - 0x61, 0x74, 0x63, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x09, 0x6f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 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, 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, + 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x47, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 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, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5c, 0x0a, + 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x37, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 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, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x7f, 0x0a, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x64, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x12, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 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, 0x22, 0x3c, 0x0a, - 0x0b, 0x52, 0x65, 0x61, 0x64, 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, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x92, 0x02, 0x0a, + 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x40, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 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, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 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, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x22, 0x3b, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x11, 0x0a, + 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, + 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x52, 0x55, 0x45, 0x10, 0x01, + 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x46, 0x41, 0x4c, 0x53, 0x45, 0x10, + 0x02, 0x22, 0xac, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 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, 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, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x63, 0x79, 0x52, 0x07, 0x74, 0x65, 0x6e, 0x61, 0x6e, + 0x63, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0xf0, 0x01, 0x0a, 0x0a, 0x57, 0x61, 0x74, 0x63, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, + 0x4d, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2f, 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, 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, 0x22, 0x3c, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 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, 0x4f, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 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, 0xa1, 0x01, 0x0a, 0x0b, 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, 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, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x0c, 0x52, - 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x72, + 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, 0x22, 0x51, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 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, 0x09, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x4f, 0x0a, 0x0c, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 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, 0x50, 0x0a, 0x0d, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 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, 0xa1, 0x01, 0x0a, - 0x0b, 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, + 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0xaa, 0x01, 0x0a, + 0x12, 0x57, 0x72, 0x69, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 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, 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, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x39, + 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, + 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, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x56, 0x0a, 0x13, 0x57, 0x72, 0x69, + 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 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, 0x58, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 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, 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, 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, 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, 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, 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, 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, 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, - 0x22, 0x51, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x41, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 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, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x22, 0x4f, 0x0a, 0x0c, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, - 0x01, 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, 0x50, 0x0a, 0x0d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x18, 0x01, 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, 0x56, 0x0a, 0x13, 0x57, 0x72, 0x69, 0x74, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, - 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 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, 0xe5, - 0x01, 0x0a, 0x12, 0x57, 0x72, 0x69, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 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, 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, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x42, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x24, 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, - 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x58, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 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, 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, 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, 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, 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, + 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, 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, + 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, - 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, + 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, 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, + 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, 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 ( @@ -1274,68 +1504,79 @@ func file_pbresource_resource_proto_rawDescGZIP() []byte { } 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_msgTypes = make([]protoimpl.MessageInfo, 21) var file_pbresource_resource_proto_goTypes = []interface{}{ - (Condition)(0), // 0: hashicorp.consul.resource.Condition + (Condition_State)(0), // 0: hashicorp.consul.resource.Condition.State (WatchEvent_Operation)(0), // 1: hashicorp.consul.resource.WatchEvent.Operation (*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 + (*Status)(nil), // 6: hashicorp.consul.resource.Status + (*Condition)(nil), // 7: hashicorp.consul.resource.Condition + (*Reference)(nil), // 8: hashicorp.consul.resource.Reference + (*WatchEvent)(nil), // 9: hashicorp.consul.resource.WatchEvent + (*ReadRequest)(nil), // 10: hashicorp.consul.resource.ReadRequest + (*ReadResponse)(nil), // 11: hashicorp.consul.resource.ReadResponse + (*ListRequest)(nil), // 12: hashicorp.consul.resource.ListRequest + (*ListResponse)(nil), // 13: hashicorp.consul.resource.ListResponse + (*WriteRequest)(nil), // 14: hashicorp.consul.resource.WriteRequest + (*WriteResponse)(nil), // 15: hashicorp.consul.resource.WriteResponse + (*WriteStatusRequest)(nil), // 16: hashicorp.consul.resource.WriteStatusRequest + (*WriteStatusResponse)(nil), // 17: hashicorp.consul.resource.WriteStatusResponse + (*DeleteRequest)(nil), // 18: hashicorp.consul.resource.DeleteRequest + (*DeleteResponse)(nil), // 19: hashicorp.consul.resource.DeleteResponse + (*WatchListRequest)(nil), // 20: hashicorp.consul.resource.WatchListRequest + nil, // 21: hashicorp.consul.resource.Resource.MetadataEntry + nil, // 22: hashicorp.consul.resource.Resource.StatusEntry + (*anypb.Any)(nil), // 23: google.protobuf.Any } var file_pbresource_resource_proto_depIdxs = []int32{ 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 - 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 - 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 + 21, // 4: hashicorp.consul.resource.Resource.metadata:type_name -> hashicorp.consul.resource.Resource.MetadataEntry + 22, // 5: hashicorp.consul.resource.Resource.status:type_name -> hashicorp.consul.resource.Resource.StatusEntry + 23, // 6: hashicorp.consul.resource.Resource.data:type_name -> google.protobuf.Any + 7, // 7: hashicorp.consul.resource.Status.conditions:type_name -> hashicorp.consul.resource.Condition + 0, // 8: hashicorp.consul.resource.Condition.state:type_name -> hashicorp.consul.resource.Condition.State + 8, // 9: hashicorp.consul.resource.Condition.resource:type_name -> hashicorp.consul.resource.Reference + 2, // 10: hashicorp.consul.resource.Reference.type:type_name -> hashicorp.consul.resource.Type + 3, // 11: hashicorp.consul.resource.Reference.tenancy:type_name -> hashicorp.consul.resource.Tenancy + 1, // 12: hashicorp.consul.resource.WatchEvent.operation:type_name -> hashicorp.consul.resource.WatchEvent.Operation + 5, // 13: hashicorp.consul.resource.WatchEvent.resource:type_name -> hashicorp.consul.resource.Resource + 4, // 14: hashicorp.consul.resource.ReadRequest.id:type_name -> hashicorp.consul.resource.ID + 5, // 15: hashicorp.consul.resource.ReadResponse.resource:type_name -> hashicorp.consul.resource.Resource + 2, // 16: hashicorp.consul.resource.ListRequest.type:type_name -> hashicorp.consul.resource.Type + 3, // 17: hashicorp.consul.resource.ListRequest.tenancy:type_name -> hashicorp.consul.resource.Tenancy + 5, // 18: hashicorp.consul.resource.ListResponse.resources:type_name -> hashicorp.consul.resource.Resource + 5, // 19: hashicorp.consul.resource.WriteRequest.resource:type_name -> hashicorp.consul.resource.Resource + 5, // 20: hashicorp.consul.resource.WriteResponse.resource:type_name -> hashicorp.consul.resource.Resource + 4, // 21: hashicorp.consul.resource.WriteStatusRequest.id:type_name -> hashicorp.consul.resource.ID + 6, // 22: hashicorp.consul.resource.WriteStatusRequest.status:type_name -> hashicorp.consul.resource.Status + 5, // 23: hashicorp.consul.resource.WriteStatusResponse.resource:type_name -> hashicorp.consul.resource.Resource + 4, // 24: hashicorp.consul.resource.DeleteRequest.id:type_name -> hashicorp.consul.resource.ID + 2, // 25: hashicorp.consul.resource.WatchListRequest.type:type_name -> hashicorp.consul.resource.Type + 3, // 26: hashicorp.consul.resource.WatchListRequest.tenancy:type_name -> hashicorp.consul.resource.Tenancy + 6, // 27: hashicorp.consul.resource.Resource.StatusEntry.value:type_name -> hashicorp.consul.resource.Status + 10, // 28: hashicorp.consul.resource.ResourceService.Read:input_type -> hashicorp.consul.resource.ReadRequest + 14, // 29: hashicorp.consul.resource.ResourceService.Write:input_type -> hashicorp.consul.resource.WriteRequest + 16, // 30: hashicorp.consul.resource.ResourceService.WriteStatus:input_type -> hashicorp.consul.resource.WriteStatusRequest + 12, // 31: hashicorp.consul.resource.ResourceService.List:input_type -> hashicorp.consul.resource.ListRequest + 18, // 32: hashicorp.consul.resource.ResourceService.Delete:input_type -> hashicorp.consul.resource.DeleteRequest + 20, // 33: hashicorp.consul.resource.ResourceService.WatchList:input_type -> hashicorp.consul.resource.WatchListRequest + 11, // 34: hashicorp.consul.resource.ResourceService.Read:output_type -> hashicorp.consul.resource.ReadResponse + 15, // 35: hashicorp.consul.resource.ResourceService.Write:output_type -> hashicorp.consul.resource.WriteResponse + 17, // 36: hashicorp.consul.resource.ResourceService.WriteStatus:output_type -> hashicorp.consul.resource.WriteStatusResponse + 13, // 37: hashicorp.consul.resource.ResourceService.List:output_type -> hashicorp.consul.resource.ListResponse + 19, // 38: hashicorp.consul.resource.ResourceService.Delete:output_type -> hashicorp.consul.resource.DeleteResponse + 9, // 39: hashicorp.consul.resource.ResourceService.WatchList:output_type -> hashicorp.consul.resource.WatchEvent + 34, // [34:40] is the sub-list for method output_type + 28, // [28:34] is the sub-list for method input_type + 28, // [28:28] is the sub-list for extension type_name + 28, // [28:28] is the sub-list for extension extendee + 0, // [0:28] is the sub-list for field type_name } func init() { file_pbresource_resource_proto_init() } @@ -1393,7 +1634,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WatchEvent); i { + switch v := v.(*Status); i { case 0: return &v.state case 1: @@ -1405,7 +1646,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadRequest); i { + switch v := v.(*Condition); i { case 0: return &v.state case 1: @@ -1417,7 +1658,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResponse); i { + switch v := v.(*Reference); i { case 0: return &v.state case 1: @@ -1429,7 +1670,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListRequest); i { + switch v := v.(*WatchEvent); i { case 0: return &v.state case 1: @@ -1441,7 +1682,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListResponse); i { + switch v := v.(*ReadRequest); i { case 0: return &v.state case 1: @@ -1453,7 +1694,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WriteRequest); i { + switch v := v.(*ReadResponse); i { case 0: return &v.state case 1: @@ -1465,7 +1706,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WriteResponse); i { + switch v := v.(*ListRequest); i { case 0: return &v.state case 1: @@ -1477,7 +1718,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WriteStatusResponse); i { + switch v := v.(*ListResponse); i { case 0: return &v.state case 1: @@ -1489,7 +1730,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WriteStatusRequest); i { + switch v := v.(*WriteRequest); i { case 0: return &v.state case 1: @@ -1501,7 +1742,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest); i { + switch v := v.(*WriteResponse); i { case 0: return &v.state case 1: @@ -1513,7 +1754,7 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteResponse); i { + switch v := v.(*WriteStatusRequest); i { case 0: return &v.state case 1: @@ -1525,6 +1766,42 @@ func file_pbresource_resource_proto_init() { } } file_pbresource_resource_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteStatusResponse); 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.(*DeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pbresource_resource_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pbresource_resource_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WatchListRequest); i { case 0: return &v.state @@ -1543,7 +1820,7 @@ func file_pbresource_resource_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pbresource_resource_proto_rawDesc, NumEnums: 2, - NumMessages: 17, + NumMessages: 21, NumExtensions: 0, NumServices: 1, }, diff --git a/proto-public/pbresource/resource.proto b/proto-public/pbresource/resource.proto index 2e85932a03..affb2df7fb 100644 --- a/proto-public/pbresource/resource.proto +++ b/proto-public/pbresource/resource.proto @@ -34,11 +34,38 @@ message Resource { string generation = 4; map metadata = 5; - reserved 6; // status + map status = 6; google.protobuf.Any data = 7; } +message Status { + string observed_generation = 1; + repeated Condition conditions = 2; +} + +message Condition { + enum State { + // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX + STATE_UNKNOWN = 0; + STATE_TRUE = 1; + STATE_FALSE = 2; + } + + string type = 1; + State state = 2; + string reason = 3; + string message = 4; + Reference resource = 5; +} + +message Reference { + Type type = 1; + Tenancy tenancy = 2; + string name = 3; + string section = 4; +} + message WatchEvent { enum Operation { OPERATION_UNSPECIFIED = 0; @@ -95,13 +122,6 @@ service ResourceService { } } -enum Condition { - CONDITION_UNSPECIFIED = 0; - CONDITION_ACCEPTED = 1; - CONDITION_INVALID = 2; - CONDITION_PERSISTENT_FAILURE = 3; -} - message ReadRequest { ID id = 1; } @@ -128,17 +148,15 @@ message WriteResponse { Resource resource = 1; } -message WriteStatusResponse { - Resource resource = 1; -} - message WriteStatusRequest { ID id = 1; string version = 2; string key = 3; - Condition condition = 4; - string state = 5; - repeated string messages = 6; + Status status = 4; +} + +message WriteStatusResponse { + Resource resource = 1; } message DeleteRequest {