From f36ff88d2a08aaef5b2d3cc1786db9df5fea1331 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 09:55:11 +1100 Subject: [PATCH 01/13] KV Proposal. --- .github/workflows/test.yaml | 25 - Makefile | 4 - cloud/aws/cmd/runtime/main.go | 4 +- cloud/aws/deploy/keyvalue/dynamodb.go | 68 + cloud/aws/deploy/policy.go | 12 +- cloud/aws/runtime/cmd/membrane.go | 4 +- cloud/aws/runtime/documents/dynamodb.go | 876 ----------- cloud/aws/runtime/keyvalue/dynamodb.go | 342 +++++ cloud/azure/cmd/runtime/main.go | 2 +- cloud/azure/deploy/policy.go | 2 +- cloud/azure/runtime/document/mongodb.go | 349 +---- cloud/gcp/cmd/runtime/membrane.go | 2 +- cloud/gcp/deploy/policy.go | 25 +- cloud/gcp/runtime/cmd/membrane.go | 2 +- cloud/gcp/runtime/document/firestore.go | 285 +--- core/pkg/decorators/documents/documents.go | 244 --- .../pkg/decorators/documents/validate_test.go | 191 --- core/pkg/decorators/keyvalue/keyvalue.go | 234 +++ .../keyvalue_suite_test.go} | 2 +- core/pkg/decorators/keyvalue/validate_test.go | 50 + core/pkg/membrane/membrane.go | 6 +- .../proto/deployments/v1/deployments.pb.go | 357 ++--- core/pkg/proto/documents/v1/documents.pb.go | 1361 ----------------- .../proto/documents/v1/documents_grpc.pb.go | 285 ---- core/pkg/proto/keyvalue/v1/keyvalue.pb.go | 724 +++++++++ .../pkg/proto/keyvalue/v1/keyvalue_grpc.pb.go | 181 +++ core/pkg/proto/resources/v1/resources.pb.go | 305 ++-- e2e/Makefile | 5 - e2e/docker.go | 69 - e2e/document/delete.go | 97 -- e2e/document/dynamodb/dynamodb_suite_test.go | 27 - e2e/document/dynamodb/dynamodb_test.go | 196 --- .../firestore/firestore_suite_test.go | 27 - e2e/document/firestore/firestore_test.go | 80 - e2e/document/get.go | 88 -- e2e/document/mongodb/mongodb_suite_test.go | 27 - e2e/document/mongodb/mongodb_test.go | 92 -- e2e/document/query.go | 572 ------- e2e/document/set.go | 102 -- e2e/document/stream.go | 446 ------ e2e/document/suite.go | 337 ---- e2e/go.mod | 133 -- e2e/go.sum | 549 ------- go.work | 1 - go.work.sum | 1 + nitric/proto/deployments/v1/deployments.proto | 4 +- nitric/proto/documents/v1/documents.proto | 143 -- nitric/proto/keyvalue/v1/keyvalue.proto | 77 + nitric/proto/resources/v1/resources.proto | 14 +- 49 files changed, 2073 insertions(+), 6956 deletions(-) create mode 100644 cloud/aws/deploy/keyvalue/dynamodb.go delete mode 100644 cloud/aws/runtime/documents/dynamodb.go create mode 100644 cloud/aws/runtime/keyvalue/dynamodb.go delete mode 100644 core/pkg/decorators/documents/documents.go delete mode 100644 core/pkg/decorators/documents/validate_test.go create mode 100644 core/pkg/decorators/keyvalue/keyvalue.go rename core/pkg/decorators/{documents/document_suite_test.go => keyvalue/keyvalue_suite_test.go} (97%) create mode 100644 core/pkg/decorators/keyvalue/validate_test.go delete mode 100644 core/pkg/proto/documents/v1/documents.pb.go delete mode 100644 core/pkg/proto/documents/v1/documents_grpc.pb.go create mode 100644 core/pkg/proto/keyvalue/v1/keyvalue.pb.go create mode 100644 core/pkg/proto/keyvalue/v1/keyvalue_grpc.pb.go delete mode 100644 e2e/Makefile delete mode 100644 e2e/docker.go delete mode 100644 e2e/document/delete.go delete mode 100644 e2e/document/dynamodb/dynamodb_suite_test.go delete mode 100644 e2e/document/dynamodb/dynamodb_test.go delete mode 100644 e2e/document/firestore/firestore_suite_test.go delete mode 100644 e2e/document/firestore/firestore_test.go delete mode 100644 e2e/document/get.go delete mode 100644 e2e/document/mongodb/mongodb_suite_test.go delete mode 100644 e2e/document/mongodb/mongodb_test.go delete mode 100644 e2e/document/query.go delete mode 100644 e2e/document/set.go delete mode 100644 e2e/document/stream.go delete mode 100644 e2e/document/suite.go delete mode 100644 e2e/go.mod delete mode 100644 e2e/go.sum delete mode 100644 nitric/proto/documents/v1/documents.proto create mode 100644 nitric/proto/keyvalue/v1/keyvalue.proto diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9aea4c288..cc2a2db62 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -90,28 +90,3 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos files: ./cloud/azure/all.coverprofile flags: azure # optional - - - # Run integration tests - test-integration: - runs-on: ubuntu-latest - env: - GOPATH: /home/runner/go - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Go - uses: actions/setup-go@v2 - with: - go-version: 1.21.6 - - name: Setup Golang caches - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-golang- - - name: Run Integration Tests - run: make test-integration diff --git a/Makefile b/Makefile index 10d4d6342..ca25e5b28 100644 --- a/Makefile +++ b/Makefile @@ -26,10 +26,6 @@ lint: $(all) $(MAKE) lint -C $$dir || exit 1; \ done -test-integration: - @echo Running integration tests - @cd ./e2e && make - test: $(all) for dir in $(all); do \ $(MAKE) test -C $$dir || exit 1; \ diff --git a/cloud/aws/cmd/runtime/main.go b/cloud/aws/cmd/runtime/main.go index 893cacaaf..15a40753d 100644 --- a/cloud/aws/cmd/runtime/main.go +++ b/cloud/aws/cmd/runtime/main.go @@ -21,9 +21,9 @@ import ( "syscall" "github.com/nitrictech/nitric/cloud/aws/runtime/api" - dynamodb_service "github.com/nitrictech/nitric/cloud/aws/runtime/documents" "github.com/nitrictech/nitric/cloud/aws/runtime/env" lambda_service "github.com/nitrictech/nitric/cloud/aws/runtime/gateway" + dynamodb_service "github.com/nitrictech/nitric/cloud/aws/runtime/keyvalue" "github.com/nitrictech/nitric/cloud/aws/runtime/resource" secrets_manager_secret_service "github.com/nitrictech/nitric/cloud/aws/runtime/secret" s3_service "github.com/nitrictech/nitric/cloud/aws/runtime/storage" @@ -58,7 +58,7 @@ func main() { membraneOpts.ApiPlugin = api.NewAwsApiGatewayProvider(provider) membraneOpts.SecretManagerPlugin, _ = secrets_manager_secret_service.New(provider) - membraneOpts.DocumentPlugin, _ = dynamodb_service.New(provider) + membraneOpts.KeyValuePlugin, _ = dynamodb_service.New(provider) membraneOpts.TopicsPlugin, _ = sns_service.New(provider) membraneOpts.StoragePlugin, _ = s3_service.New(provider) membraneOpts.ResourcesPlugin = provider diff --git a/cloud/aws/deploy/keyvalue/dynamodb.go b/cloud/aws/deploy/keyvalue/dynamodb.go new file mode 100644 index 000000000..235250ed0 --- /dev/null +++ b/cloud/aws/deploy/keyvalue/dynamodb.go @@ -0,0 +1,68 @@ +// Copyright Nitric Pty Ltd. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package keyvalue + +import ( + "github.com/nitrictech/nitric/cloud/common/deploy/resources" + "github.com/nitrictech/nitric/cloud/common/deploy/tags" + v1 "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1" + "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/dynamodb" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +) + +type DynamodbKeyValueStore struct { + pulumi.ResourceState + + Table *dynamodb.Table + Name string +} + +type DynamodbKeyValueStoreArgs struct { + StackID string + KeyValueStore *v1.KeyValueStore +} + +func NewDynamodbKeyValueStore(ctx *pulumi.Context, name string, args *DynamodbKeyValueStoreArgs, opts ...pulumi.ResourceOption) (*DynamodbKeyValueStore, error) { + res := &DynamodbKeyValueStore{Name: name} + + err := ctx.RegisterComponentResource("nitric:keyvalue:Dynamodb", name, res, opts...) + if err != nil { + return nil, err + } + + res.Table, err = dynamodb.NewTable(ctx, name, &dynamodb.TableArgs{ + Attributes: dynamodb.TableAttributeArray{ + &dynamodb.TableAttributeArgs{ + Name: pulumi.String("_pk"), + Type: pulumi.String("S"), + }, + &dynamodb.TableAttributeArgs{ + Name: pulumi.String("_sk"), + Type: pulumi.String("S"), + }, + }, + HashKey: pulumi.String("_pk"), + RangeKey: pulumi.String("_sk"), + BillingMode: pulumi.String("PAY_PER_REQUEST"), + Tags: pulumi.ToStringMap(tags.Tags(args.StackID, name, resources.Collection)), + }) + if err != nil { + return nil, err + } + + return res, nil +} diff --git a/cloud/aws/deploy/policy.go b/cloud/aws/deploy/policy.go index d5b30b368..4da63d11c 100644 --- a/cloud/aws/deploy/policy.go +++ b/cloud/aws/deploy/policy.go @@ -62,21 +62,17 @@ var awsActionsMap map[resourcespb.Action][]string = map[resourcespb.Action][]str "states:StartExecution", "states:StateSyncExecution", }, - resourcespb.Action_CollectionDocumentRead: { + resourcespb.Action_KeyValueStoreRead: { "dynamodb:GetItem", "dynamodb:BatchGetItem", }, - resourcespb.Action_CollectionDocumentWrite: { + resourcespb.Action_KeyValueStoreWrite: { "dynamodb:UpdateItem", "dynamodb:PutItem", }, - resourcespb.Action_CollectionDocumentDelete: { + resourcespb.Action_KeyValueStoreDelete: { "dynamodb:DeleteItem", }, - resourcespb.Action_CollectionQuery: { - "dynamodb:Query", - "dynamodb:Scan", - }, // XXX: Cannot be applied to single resources // v1.Action_CollectionList: { // "dynamodb:ListTables", @@ -113,7 +109,7 @@ func (a *NitricAwsPulumiProvider) arnForResource(resource *deploymentspb.Resourc if t, ok := a.topics[resource.Id.Name]; ok { return []interface{}{t.sns.Arn, t.sfn.Arn}, nil } - case resourcespb.ResourceType_Collection: + case resourcespb.ResourceType_KeyValueStore: if c, ok := a.collections[resource.Id.Name]; ok { return []interface{}{c.Arn}, nil } diff --git a/cloud/aws/runtime/cmd/membrane.go b/cloud/aws/runtime/cmd/membrane.go index bf9310e6d..952fef456 100644 --- a/cloud/aws/runtime/cmd/membrane.go +++ b/cloud/aws/runtime/cmd/membrane.go @@ -20,9 +20,9 @@ import ( "os/signal" "syscall" - dynamodb_service "github.com/nitrictech/nitric/cloud/aws/runtime/documents" "github.com/nitrictech/nitric/cloud/aws/runtime/env" lambda_service "github.com/nitrictech/nitric/cloud/aws/runtime/gateway" + dynamodb_service "github.com/nitrictech/nitric/cloud/aws/runtime/keyvalue" "github.com/nitrictech/nitric/cloud/aws/runtime/resource" secrets_manager_secret_service "github.com/nitrictech/nitric/cloud/aws/runtime/secret" s3_service "github.com/nitrictech/nitric/cloud/aws/runtime/storage" @@ -56,7 +56,7 @@ func main() { } membraneOpts.SecretManagerPlugin, _ = secrets_manager_secret_service.New(provider) - membraneOpts.DocumentPlugin, _ = dynamodb_service.New(provider) + membraneOpts.KeyValuePlugin, _ = dynamodb_service.New(provider) membraneOpts.TopicsPlugin, _ = sns_service.New(provider) membraneOpts.StoragePlugin, _ = s3_service.New(provider) membraneOpts.ResourcesPlugin = provider diff --git a/cloud/aws/runtime/documents/dynamodb.go b/cloud/aws/runtime/documents/dynamodb.go deleted file mode 100644 index 5fb130e02..000000000 --- a/cloud/aws/runtime/documents/dynamodb.go +++ /dev/null @@ -1,876 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package documents - -import ( - "context" - "errors" - "fmt" - "sort" - "strings" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/config" - "github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue" - "github.com/aws/aws-sdk-go-v2/service/dynamodb" - "github.com/aws/aws-sdk-go-v2/service/dynamodb/types" - "github.com/aws/smithy-go" - "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws" - "google.golang.org/grpc/codes" - "google.golang.org/protobuf/types/known/structpb" - - "github.com/nitrictech/nitric/cloud/aws/ifaces/dynamodbiface" - "github.com/nitrictech/nitric/cloud/aws/runtime/env" - "github.com/nitrictech/nitric/cloud/aws/runtime/resource" - document "github.com/nitrictech/nitric/core/pkg/decorators/documents" - grpc_errors "github.com/nitrictech/nitric/core/pkg/grpc/errors" - documentpb "github.com/nitrictech/nitric/core/pkg/proto/documents/v1" -) - -const ( - AttribPk = "_pk" - AttribSk = "_sk" - deleteQueryLimit = int32(1000) - maxBatchWrite = 25 -) - -// DynamoDocService - an AWS DynamoDB implementation of the Nitric Document Service -type DynamoDocService struct { - client dynamodbiface.DynamoDBAPI - provider resource.AwsResourceProvider -} - -var _ documentpb.DocumentsServer = &DynamoDocService{} - -func isDynamoAccessDeniedErr(err error) bool { - var opErr *smithy.OperationError - if errors.As(err, &opErr) { - return opErr.Service() == "DynamoDB" && strings.Contains(opErr.Unwrap().Error(), "AccessDenied") - } - return false -} - -// Get a document from the DynamoDB table -func (s *DynamoDocService) Get(ctx context.Context, req *documentpb.DocumentGetRequest) (*documentpb.DocumentGetResponse, error) { - newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Get") - - err := document.ValidateKey(req.Key) - if err != nil { - return nil, newErr( - codes.InvalidArgument, - "Invalid key", - err, - ) - } - - keyMap := createKeyMap(req.Key) - attributeMap, err := attributevalue.MarshalMap(keyMap) - if err != nil { - return nil, newErr( - codes.InvalidArgument, - "failed to marshal key", - err, - ) - } - - tableName, err := s.getTableName(ctx, req.Key.Collection) - if err != nil { - return nil, err - } - - input := &dynamodb.GetItemInput{ - Key: attributeMap, - TableName: tableName, - } - - result, err := s.client.GetItem(ctx, input) - if err != nil { - if isDynamoAccessDeniedErr(err) { - return nil, newErr( - codes.PermissionDenied, - "unable to get document value, this may be due to a missing permissions request in your code.", - err, - ) - } - - return nil, newErr( - codes.Internal, - fmt.Sprintf("error retrieving key %v", req.Key), - err, - ) - } - - if result.Item == nil { - return nil, newErr( - codes.NotFound, - fmt.Sprintf("%v not found", req.Key), - err, - ) - } - - var itemMap map[string]interface{} - err = attributevalue.UnmarshalMap(result.Item, &itemMap) - if err != nil { - return nil, newErr( - codes.Internal, - "error unmarshalling item", - err, - ) - } - - delete(itemMap, AttribPk) - delete(itemMap, AttribSk) - - documentContent, err := structpb.NewStruct(itemMap) - if err != nil { - return nil, newErr( - codes.Internal, - "error converting returned document to struct", - err, - ) - } - - return &documentpb.DocumentGetResponse{ - Document: &documentpb.Document{ - Key: req.Key, - Content: documentContent, - }, - }, nil -} - -// Set a document in the DynamoDB table -func (s *DynamoDocService) Set(ctx context.Context, req *documentpb.DocumentSetRequest) (*documentpb.DocumentSetResponse, error) { - newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Set") - - if err := document.ValidateKey(req.Key); err != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid key", - err, - ) - } - - if req.Content == nil { - return nil, newErr( - codes.InvalidArgument, - "document content must not be nil", - nil, - ) - } - - // Construct DynamoDB attribute value object - itemMap := createItemMap(req.Content.AsMap(), req.Key) - itemAttributeMap, err := attributevalue.MarshalMap(itemMap) - if err != nil { - return nil, newErr( - codes.NotFound, - "failed to marshal content", - err, - ) - } - - tableName, err := s.getTableName(ctx, req.Key.Collection) - if err != nil { - return nil, newErr( - codes.NotFound, - "unable to find table", - err, - ) - } - - input := &dynamodb.PutItemInput{ - Item: itemAttributeMap, - TableName: tableName, - } - - _, err = s.client.PutItem(ctx, input) - if err != nil { - if isDynamoAccessDeniedErr(err) { - return nil, newErr( - codes.PermissionDenied, - "unable to set document value, this may be due to a missing permissions request in your code.", - err, - ) - } - - return nil, newErr( - codes.Unknown, - "unable to set document value", - err, - ) - } - - return &documentpb.DocumentSetResponse{}, nil -} - -// Delete a document from the DynamoDB table -func (s *DynamoDocService) Delete(ctx context.Context, req *documentpb.DocumentDeleteRequest) (*documentpb.DocumentDeleteResponse, error) { - newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Delete") - - if err := document.ValidateKey(req.Key); err != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid key", - err, - ) - } - - keyMap := createKeyMap(req.Key) - attributeMap, err := attributevalue.MarshalMap(keyMap) - if err != nil { - return nil, newErr( - codes.InvalidArgument, - fmt.Sprintf("failed to marshal keys: %v", req.Key), - err, - ) - } - - tableName, err := s.getTableName(ctx, req.Key.Collection) - if err != nil { - return nil, newErr( - codes.NotFound, - "unable to find table", - err, - ) - } - - deleteInput := &dynamodb.DeleteItemInput{ - Key: attributeMap, - TableName: tableName, - } - - _, err = s.client.DeleteItem(ctx, deleteInput) - if err != nil { - if isDynamoAccessDeniedErr(err) { - return nil, newErr( - codes.PermissionDenied, - "unable to delete document, this may be due to a missing permissions request in your code.", - err, - ) - } - - return nil, newErr( - codes.Internal, - fmt.Sprintf("error deleting %v item %v : %v", req.Key.Collection, req.Key.Id, err), - err, - ) - } - - // Delete sub collection items - if req.Key.Collection.Parent == nil { - var lastEvaluatedKey map[string]types.AttributeValue - for { - queryInput := createDeleteQuery(tableName, req.Key, lastEvaluatedKey) - resp, err := s.client.Query(ctx, queryInput) - if err != nil { - return nil, newErr( - codes.Internal, - "error performing delete in table", - err, - ) - } - - lastEvaluatedKey = resp.LastEvaluatedKey - - err = s.processDeleteQuery(ctx, *tableName, resp) - if err != nil { - return nil, newErr( - codes.Internal, - "error performing delete", - err, - ) - } - - if len(lastEvaluatedKey) == 0 { - break - } - } - } - - return &documentpb.DocumentDeleteResponse{}, nil -} - -func (s *DynamoDocService) query(ctx context.Context, collection *documentpb.Collection, expressions []*documentpb.Expression, limit int32, pagingToken map[string]string) (*documentpb.DocumentQueryResponse, error) { - queryResult := &documentpb.DocumentQueryResponse{ - Documents: make([]*documentpb.Document, 0), - } - - var resFunc resultRetriever = s.performQuery - if collection.Parent == nil || collection.Parent.Id == "" { - resFunc = s.performScan - } - - if res, err := resFunc(ctx, collection, expressions, limit, pagingToken); err != nil { - return nil, err - } else { - queryResult.Documents = append(queryResult.Documents, res.Documents...) - queryResult.PagingToken = res.PagingToken - } - - return queryResult, nil -} - -// Query documents from the DynamoDB table with pagination -func (s *DynamoDocService) Query(ctx context.Context, req *documentpb.DocumentQueryRequest) (*documentpb.DocumentQueryResponse, error) { - newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Query") - - if err := document.ValidateQueryCollection(req.Collection); err != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid collection", - err, - ) - } - - if err := document.ValidateExpressions(req.Expressions); err != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid expressions", - err, - ) - } - - queryResult, err := s.query(ctx, req.Collection, req.Expressions, req.Limit, req.PagingToken) - if err != nil { - if isDynamoAccessDeniedErr(err) { - return nil, newErr( - codes.PermissionDenied, - "unable to query document values, this may be due to a missing permissions request in your code.", - err, - ) - } - - return nil, newErr( - codes.Internal, - "query error", - err, - ) - } - - remainingLimit := req.Limit - int32(len(queryResult.Documents)) - - // If more results available, perform additional queries - for remainingLimit > 0 && - (queryResult.PagingToken != nil && len(queryResult.PagingToken) > 0) { - if res, err := s.query(ctx, req.Collection, req.Expressions, remainingLimit, queryResult.PagingToken); err != nil { - return nil, newErr( - codes.Internal, - "query error", - err, - ) - } else { - queryResult.Documents = append(queryResult.Documents, res.Documents...) - queryResult.PagingToken = res.PagingToken - } - - remainingLimit = req.Limit - int32(len(queryResult.Documents)) - } - - return queryResult, nil -} - -// QuerySteam queries documents from the DynamoDB table as a stream -func (s *DynamoDocService) QueryStream(req *documentpb.DocumentQueryStreamRequest, srv documentpb.Documents_QueryStreamServer) error { - newErr := grpc_errors.ErrorsWithScope("DynamoDocService.QueryStream") - - colErr := document.ValidateQueryCollection(req.Collection) - if colErr != nil { - return newErr( - codes.InvalidArgument, - "invalid arguments", - fmt.Errorf("collection error: %w", colErr), - ) - } - - expErr := document.ValidateExpressions(req.Expressions) - if expErr != nil { - return newErr( - codes.InvalidArgument, - "invalid arguments", - fmt.Errorf("expression error: %w", expErr), - ) - } - - var pagingToken map[string]string - numReturned := int32(0) - - for numReturned < req.Limit { - res, fetchErr := s.query(srv.Context(), req.Collection, req.Expressions, req.Limit-numReturned, pagingToken) - pagingToken = res.PagingToken - - if fetchErr != nil { - return newErr( - codes.Internal, - "query error", - fetchErr, - ) - } - - // no more results to return - if len(res.Documents) == 0 { - return nil - } - - for _, doc := range res.Documents { - if err := srv.Send(&documentpb.DocumentQueryStreamResponse{ - Document: doc, - }); err != nil { - return newErr( - codes.Internal, - "error returning document", - err, - ) - } - - numReturned++ - if numReturned >= req.Limit { - break - } - } - } - - return nil -} - -// New creates a new AWS DynamoDB implementation of a DocumentServiceServer -func New(provider resource.AwsResourceProvider) (*DynamoDocService, error) { - awsRegion := env.AWS_REGION.String() - - // Create a new AWS session - cfg, sessionError := config.LoadDefaultConfig(context.TODO(), config.WithRegion(awsRegion)) - if sessionError != nil { - return nil, fmt.Errorf("error creating new AWS session %w", sessionError) - } - - otelaws.AppendMiddlewares(&cfg.APIOptions) - - dynamoClient := dynamodb.NewFromConfig(cfg) - - return &DynamoDocService{ - client: dynamoClient, - provider: provider, - }, nil -} - -// NewWithClient creates a DocumentServiceServer with an given DynamoDB client instance. -// -// Primarily used for testing -func NewWithClient(provider resource.AwsResourceProvider, client *dynamodb.Client) (*DynamoDocService, error) { - return &DynamoDocService{ - provider: provider, - client: client, - }, nil -} - -func createKeyMap(key *documentpb.Key) map[string]string { - keyMap := make(map[string]string) - - parentKey := key.Collection.Parent - - if parentKey == nil { - keyMap[AttribPk] = key.Id - keyMap[AttribSk] = key.Collection.Name + "#" - } else { - keyMap[AttribPk] = parentKey.Id - keyMap[AttribSk] = key.Collection.Name + "#" + key.Id - } - - return keyMap -} - -func createItemMap(source map[string]interface{}, key *documentpb.Key) map[string]interface{} { - // Copy map - newMap := make(map[string]interface{}) - for key, value := range source { - newMap[key] = value - } - - keyMap := createKeyMap(key) - - // Add key attributes - newMap[AttribPk] = keyMap[AttribPk] - newMap[AttribSk] = keyMap[AttribSk] - - return newMap -} - -type resultRetriever = func( - ctx context.Context, - collection *documentpb.Collection, - expressions []*documentpb.Expression, - limit int32, - pagingToken map[string]string, -) (*documentpb.DocumentQueryResponse, error) - -func (s *DynamoDocService) performQuery( - ctx context.Context, - collection *documentpb.Collection, - expressions []*documentpb.Expression, - limit int32, - pagingToken map[string]string, -) (*documentpb.DocumentQueryResponse, error) { - if collection.Parent == nil { - // Should never occur - return nil, fmt.Errorf("cannot perform query without partition key defined") - } - - // Sort expressions to help map where "A >= %1 AND A <= %2" to DynamoDB expression "A BETWEEN %1 AND %2" - sort.Sort(document.ExpsSort(expressions)) - - tableName, err := s.getTableName(ctx, collection) - if err != nil { - return nil, err - } - - input := &dynamodb.QueryInput{ - TableName: tableName, - } - - // Configure KeyConditionExpression - keyExp := "#pk = :pk AND begins_with(#sk, :sk)" - input.KeyConditionExpression = aws.String(keyExp) - - // Configure FilterExpression - filterExp := createFilterExpression(expressions) - if filterExp != "" { - input.FilterExpression = aws.String(filterExp) - } - - // Configure ExpressionAttributeNames - input.ExpressionAttributeNames = make(map[string]string) - input.ExpressionAttributeNames["#pk"] = "_pk" - input.ExpressionAttributeNames["#sk"] = "_sk" - for _, exp := range expressions { - input.ExpressionAttributeNames["#"+exp.Operand] = exp.Operand - } - - // Configure ExpressionAttributeValues - input.ExpressionAttributeValues = make(map[string]types.AttributeValue) - input.ExpressionAttributeValues[":pk"] = &types.AttributeValueMemberS{ - Value: collection.Parent.Id, - } - input.ExpressionAttributeValues[":sk"] = &types.AttributeValueMemberS{ - Value: collection.Name + "#", - } - for i, exp := range expressions { - expKey := fmt.Sprintf(":%v%v", exp.Operand, i) - valAttrib, err := attributevalue.Marshal(exp.Value) - if err != nil { - return nil, fmt.Errorf("error marshalling %v: %v", exp.Operand, exp.Value) - } - input.ExpressionAttributeValues[expKey] = valAttrib - } - - // Configure fetch Limit - if limit > 0 { - limit64 := limit - input.Limit = &(limit64) - - if len(pagingToken) > 0 { - startKey, err := attributevalue.MarshalMap(pagingToken) - if err != nil { - return nil, fmt.Errorf("error performing query %v: %w", input, err) - } - input.ExclusiveStartKey = startKey - } - } - - // Perform query - resp, err := s.client.Query(ctx, input) - if err != nil { - return nil, fmt.Errorf("error performing query %v: %w", input, err) - } - - return marshalQueryResult(collection, resp.Items, resp.LastEvaluatedKey) -} - -func (s *DynamoDocService) performScan( - ctx context.Context, - collection *documentpb.Collection, - expressions []*documentpb.Expression, - limit int32, - pagingToken map[string]string, -) (*documentpb.DocumentQueryResponse, error) { - // Sort expressions to help map where "A >= %1 AND A <= %2" to DynamoDB expression "A BETWEEN %1 AND %2" - sort.Sort(document.ExpsSort(expressions)) - - tableName, err := s.getTableName(ctx, collection) - if err != nil { - return nil, err - } - - input := &dynamodb.ScanInput{ - TableName: tableName, - } - - // Filter on SK collection name or sub-collection name - filterExp := "#sk = :sk" - if collection.Parent != nil { - filterExp = "begins_with(#sk, :sk)" - } - - expFilters := createFilterExpression(expressions) - if expFilters != "" { - filterExp += " AND " + expFilters - } - - // Configure FilterExpression - input.FilterExpression = aws.String(filterExp) - - // Configure ExpressionAttributeNames - input.ExpressionAttributeNames = make(map[string]string) - input.ExpressionAttributeNames["#sk"] = "_sk" - - for _, exp := range expressions { - input.ExpressionAttributeNames["#"+exp.Operand] = exp.Operand - } - - // Configure ExpressionAttributeValues - input.ExpressionAttributeValues = make(map[string]types.AttributeValue) - keyAttrib := &types.AttributeValueMemberS{Value: collection.Name + "#"} - - input.ExpressionAttributeValues[":sk"] = keyAttrib - for i, exp := range expressions { - expKey := fmt.Sprintf(":%v%v", exp.Operand, i) - valAttrib, err := attributevalue.Marshal(exp.Value) - if err != nil { - return nil, fmt.Errorf("error marshalling %v: %v", exp.Operand, exp.Value) - } - input.ExpressionAttributeValues[expKey] = valAttrib - } - - // Configure fetch Limit - if limit > 0 { - // Account for parent record in fetch limit - limit32 := limit - input.Limit = &(limit32) - - if len(pagingToken) > 0 { - startKey, err := attributevalue.MarshalMap(pagingToken) - if err != nil { - return nil, fmt.Errorf("error performing scan %v: %w", input, err) - } - input.ExclusiveStartKey = startKey - } - } - - resp, err := s.client.Scan(ctx, input) - if err != nil { - return nil, fmt.Errorf("error performing scan %v: %w", input, err) - } - - return marshalQueryResult(collection, resp.Items, resp.LastEvaluatedKey) -} - -func marshalQueryResult(collection *documentpb.Collection, items []map[string]types.AttributeValue, lastEvaluatedKey map[string]types.AttributeValue) (*documentpb.DocumentQueryResponse, error) { - // Unmarshal Dynamo response items - var pTkn map[string]string = nil - var valueMaps []map[string]interface{} - if err := attributevalue.UnmarshalListOfMaps(items, &valueMaps); err != nil { - return nil, fmt.Errorf("error unmarshalling query response: %w", err) - } - - docs := make([]*documentpb.Document, 0, len(valueMaps)) - - // Strip keys & append results - for _, m := range valueMaps { - // Retrieve the original ID on the result - var id string - var c *documentpb.Collection - if collection.Parent == nil { - // We know this is a root document so its key will be located in PK - pk, _ := m[AttribPk].(string) - id = pk - c = collection - } else { - // We know this is a child document so its key will be located in the SK - pk, _ := m[AttribPk].(string) - sk, _ := m[AttribSk].(string) - idStr := strings.Split(sk, "#") - id = idStr[len(idStr)-1] - c = &documentpb.Collection{ - Name: collection.Name, - Parent: &documentpb.Key{ - Collection: &documentpb.Collection{ - Name: collection.Parent.Collection.Name, - }, - Id: pk, - }, - } - } - - // Split out sort key value - delete(m, AttribPk) - delete(m, AttribSk) - - structContent, err := structpb.NewStruct(m) - if err != nil { - return nil, err - } - - sdkDoc := &documentpb.Document{ - Key: &documentpb.Key{ - Collection: c, - Id: id, - }, - Content: structContent, - } - docs = append(docs, sdkDoc) - } - - // Unmarshal lastEvalutedKey - var resultPagingToken map[string]string - if len(lastEvaluatedKey) > 0 { - if err := attributevalue.UnmarshalMap(lastEvaluatedKey, &resultPagingToken); err != nil { - return nil, fmt.Errorf("error unmarshalling query lastEvaluatedKey: %w", err) - } - pTkn = resultPagingToken - } - - return &documentpb.DocumentQueryResponse{ - Documents: docs, - PagingToken: pTkn, - }, nil -} - -func createFilterExpression(expressions []*documentpb.Expression) string { - keyExp := "" - for i, exp := range expressions { - if keyExp != "" { - keyExp += " AND " - } - - if isBetweenStart(i, expressions) { - // #{exp.operand} BETWEEN :{exp.operand}{exp.index}) - keyExp += fmt.Sprintf("#%v BETWEEN :%s%d", exp.Operand, exp.Operand, i) - } else if isBetweenEnd(i, expressions) { - // AND :{exp.operand}{exp.index}) - keyExp += fmt.Sprintf(":%s%d", exp.Operand, i) - } else if exp.Operator == "startsWith" { - // begins_with(#{exp.operand}, :{exp.operand}{exp.index}) - keyExp += fmt.Sprintf("begins_with(#%s, :%s%d)", exp.Operand, exp.Operand, i) - } else if exp.Operator == "==" { - // #{exp.operand} = :{exp.operand}{exp.index} - keyExp += fmt.Sprintf("#%s = :%s%d", exp.Operand, exp.Operand, i) - } else { - // #{exp.operand} {exp.operator} :{exp.operand}{exp.index} - keyExp += fmt.Sprintf("#%s %s :%s%d", exp.Operand, exp.Operator, exp.Operand, i) - } - } - - return keyExp -} - -func isBetweenStart(index int, exps []*documentpb.Expression) bool { - if index < (len(exps) - 1) { - if exps[index].Operand == exps[index+1].Operand && - exps[index].Operator == ">=" && - exps[index+1].Operator == "<=" { - return true - } - } - return false -} - -func isBetweenEnd(index int, exps []*documentpb.Expression) bool { - if index > 0 && index < len(exps) { - if exps[index-1].Operand == exps[index].Operand && - exps[index-1].Operator == ">=" && - exps[index].Operator == "<=" { - return true - } - } - return false -} - -func (s *DynamoDocService) getTableName(ctx context.Context, collection *documentpb.Collection) (*string, error) { - tables, err := s.provider.GetResources(ctx, resource.AwsResource_Collection) - if err != nil { - return nil, fmt.Errorf("encountered an error retrieving the table list: %w", err) - } - - coll := collection - for coll.Parent != nil { - coll = coll.Parent.Collection - } - - if table, ok := tables[coll.Name]; ok { - tableName := strings.Split(table.ARN, "/")[1] - - // split the table arn to get the name - return aws.String(tableName), nil - } - - return nil, fmt.Errorf("collection %s does not exist", coll.Name) -} - -func createDeleteQuery(table *string, key *documentpb.Key, startKey map[string]types.AttributeValue) *dynamodb.QueryInput { - limit := deleteQueryLimit - - return &dynamodb.QueryInput{ - TableName: table, - Limit: &(limit), - Select: types.SelectSpecificAttributes, - ProjectionExpression: aws.String("#pk, #sk"), - KeyConditionExpression: aws.String("#pk = :pk"), - ExpressionAttributeNames: map[string]string{ - "#pk": "_pk", - "#sk": "_sk", - }, - ExpressionAttributeValues: map[string]types.AttributeValue{ - ":pk": &types.AttributeValueMemberS{ - Value: key.Id, - }, - }, - ExclusiveStartKey: startKey, - } -} - -func (s *DynamoDocService) processDeleteQuery(ctx context.Context, table string, resp *dynamodb.QueryOutput) error { - itemIndex := 0 - for itemIndex < len(resp.Items) { - batchInput := &dynamodb.BatchWriteItemInput{} - batchInput.RequestItems = make(map[string][]types.WriteRequest) - writeRequests := make([]types.WriteRequest, 0, maxBatchWrite) - - batchCount := 0 - for batchCount < maxBatchWrite && itemIndex < len(resp.Items) { - item := resp.Items[itemIndex] - itemIndex += 1 - - writeRequest := types.WriteRequest{} - - writeRequest.DeleteRequest = &types.DeleteRequest{ - Key: map[string]types.AttributeValue{ - AttribPk: item[AttribPk], - AttribSk: item[AttribSk], - }, - } - writeRequests = append(writeRequests, writeRequest) - - batchCount += 1 - } - - batchInput.RequestItems = make(map[string][]types.WriteRequest) - batchInput.RequestItems[table] = writeRequests - - _, err := s.client.BatchWriteItem(ctx, batchInput) - if err != nil { - return err - } - } - - return nil -} diff --git a/cloud/aws/runtime/keyvalue/dynamodb.go b/cloud/aws/runtime/keyvalue/dynamodb.go new file mode 100644 index 000000000..cc7d80b1f --- /dev/null +++ b/cloud/aws/runtime/keyvalue/dynamodb.go @@ -0,0 +1,342 @@ +// Copyright 2021 Nitric Pty Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package keyvalue + +import ( + "context" + "errors" + "fmt" + "strings" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue" + "github.com/aws/aws-sdk-go-v2/service/dynamodb" + "github.com/aws/smithy-go" + "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws" + "google.golang.org/grpc/codes" + "google.golang.org/protobuf/types/known/structpb" + + "github.com/nitrictech/nitric/cloud/aws/ifaces/dynamodbiface" + "github.com/nitrictech/nitric/cloud/aws/runtime/env" + "github.com/nitrictech/nitric/cloud/aws/runtime/resource" + document "github.com/nitrictech/nitric/core/pkg/decorators/keyvalue" + grpc_errors "github.com/nitrictech/nitric/core/pkg/grpc/errors" + keyvaluepb "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1" +) + +const ( + AttribPk = "_pk" + AttribSk = "_sk" + deleteQueryLimit = int32(1000) + maxBatchWrite = 25 +) + +// DynamoKeyValueService - an AWS DynamoDB implementation of the Nitric Document Service +type DynamoKeyValueService struct { + client dynamodbiface.DynamoDBAPI + provider resource.AwsResourceProvider +} + +var _ keyvaluepb.KeyValueServer = &DynamoKeyValueService{} + +func isDynamoAccessDeniedErr(err error) bool { + var opErr *smithy.OperationError + if errors.As(err, &opErr) { + return opErr.Service() == "DynamoDB" && strings.Contains(opErr.Unwrap().Error(), "AccessDenied") + } + return false +} + +// Get a document from the DynamoDB table +func (s *DynamoKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValueGetRequest) (*keyvaluepb.KeyValueGetResponse, error) { + newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Get") + + err := document.ValidateKey(req.Key) + if err != nil { + return nil, newErr( + codes.InvalidArgument, + "Invalid key", + err, + ) + } + + keyMap := createKeyMap(req.Key) + attributeMap, err := attributevalue.MarshalMap(keyMap) + if err != nil { + return nil, newErr( + codes.InvalidArgument, + "failed to marshal key", + err, + ) + } + + tableName, err := s.getTableName(ctx, req.Key.Store) + if err != nil { + return nil, err + } + + input := &dynamodb.GetItemInput{ + Key: attributeMap, + TableName: tableName, + } + + result, err := s.client.GetItem(ctx, input) + if err != nil { + if isDynamoAccessDeniedErr(err) { + return nil, newErr( + codes.PermissionDenied, + "unable to get document value, this may be due to a missing permissions request in your code.", + err, + ) + } + + return nil, newErr( + codes.Internal, + fmt.Sprintf("error retrieving key %v", req.Key), + err, + ) + } + + if result.Item == nil { + return nil, newErr( + codes.NotFound, + fmt.Sprintf("%v not found", req.Key), + err, + ) + } + + var itemMap map[string]interface{} + err = attributevalue.UnmarshalMap(result.Item, &itemMap) + if err != nil { + return nil, newErr( + codes.Internal, + "error unmarshalling item", + err, + ) + } + + delete(itemMap, AttribPk) + delete(itemMap, AttribSk) + + documentContent, err := structpb.NewStruct(itemMap) + if err != nil { + return nil, newErr( + codes.Internal, + "error converting returned document to struct", + err, + ) + } + + return &keyvaluepb.KeyValueGetResponse{ + Value: &keyvaluepb.Value{ + Key: req.Key, + Content: documentContent, + }, + }, nil + +} + +// Set a document in the DynamoDB table +func (s *DynamoKeyValueService) Set(ctx context.Context, req *keyvaluepb.KeyValueSetRequest) (*keyvaluepb.KeyValueSetResponse, error) { + newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Set") + + if err := document.ValidateKey(req.Key); err != nil { + return nil, newErr( + codes.InvalidArgument, + "invalid key", + err, + ) + } + + if req.Content == nil { + return nil, newErr( + codes.InvalidArgument, + "document content must not be nil", + nil, + ) + } + + // Construct DynamoDB attribute value object + itemMap := createItemMap(req.Content.AsMap(), req.Key) + itemAttributeMap, err := attributevalue.MarshalMap(itemMap) + if err != nil { + return nil, newErr( + codes.NotFound, + "failed to marshal content", + err, + ) + } + + tableName, err := s.getTableName(ctx, req.Key.Store) + if err != nil { + return nil, newErr( + codes.NotFound, + "unable to find table", + err, + ) + } + + input := &dynamodb.PutItemInput{ + Item: itemAttributeMap, + TableName: tableName, + } + + _, err = s.client.PutItem(ctx, input) + if err != nil { + if isDynamoAccessDeniedErr(err) { + return nil, newErr( + codes.PermissionDenied, + "unable to set document value, this may be due to a missing permissions request in your code.", + err, + ) + } + + return nil, newErr( + codes.Unknown, + "unable to set document value", + err, + ) + } + + return &keyvaluepb.KeyValueSetResponse{}, nil +} + +// Delete a document from the DynamoDB table +func (s *DynamoKeyValueService) Delete(ctx context.Context, req *keyvaluepb.KeyValueDeleteRequest) (*keyvaluepb.KeyValueDeleteResponse, error) { + newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Delete") + + if err := document.ValidateKey(req.Key); err != nil { + return nil, newErr( + codes.InvalidArgument, + "invalid key", + err, + ) + } + + keyMap := createKeyMap(req.Key) + attributeMap, err := attributevalue.MarshalMap(keyMap) + if err != nil { + return nil, newErr( + codes.InvalidArgument, + fmt.Sprintf("failed to marshal keys: %v", req.Key), + err, + ) + } + + tableName, err := s.getTableName(ctx, req.Key.Store) + if err != nil { + return nil, newErr( + codes.NotFound, + "unable to find table", + err, + ) + } + + deleteInput := &dynamodb.DeleteItemInput{ + Key: attributeMap, + TableName: tableName, + } + + _, err = s.client.DeleteItem(ctx, deleteInput) + if err != nil { + if isDynamoAccessDeniedErr(err) { + return nil, newErr( + codes.PermissionDenied, + "unable to delete document, this may be due to a missing permissions request in your code.", + err, + ) + } + + return nil, newErr( + codes.Internal, + fmt.Sprintf("error deleting %v item %v : %v", req.Key.Store, req.Key.Key, err), + err, + ) + } + + return &keyvaluepb.KeyValueDeleteResponse{}, nil +} + +// New creates a new AWS DynamoDB implementation of a DocumentServiceServer +func New(provider resource.AwsResourceProvider) (*DynamoKeyValueService, error) { + awsRegion := env.AWS_REGION.String() + + // Create a new AWS session + cfg, sessionError := config.LoadDefaultConfig(context.TODO(), config.WithRegion(awsRegion)) + if sessionError != nil { + return nil, fmt.Errorf("error creating new AWS session %w", sessionError) + } + + otelaws.AppendMiddlewares(&cfg.APIOptions) + + dynamoClient := dynamodb.NewFromConfig(cfg) + + return &DynamoKeyValueService{ + client: dynamoClient, + provider: provider, + }, nil +} + +// NewWithClient creates a DocumentServiceServer with an given DynamoDB client instance. +// +// Primarily used for testing +func NewWithClient(provider resource.AwsResourceProvider, client *dynamodb.Client) (*DynamoKeyValueService, error) { + return &DynamoKeyValueService{ + provider: provider, + client: client, + }, nil +} + +func createKeyMap(key *keyvaluepb.Key) map[string]string { + keyMap := make(map[string]string) + + keyMap[AttribPk] = key.Key + keyMap[AttribSk] = key.Store + "#" + + return keyMap +} + +func createItemMap(source map[string]interface{}, key *keyvaluepb.Key) map[string]interface{} { + // Copy map + newMap := make(map[string]interface{}) + for key, value := range source { + newMap[key] = value + } + + keyMap := createKeyMap(key) + + // Add key attributes + newMap[AttribPk] = keyMap[AttribPk] + newMap[AttribSk] = keyMap[AttribSk] + + return newMap +} + +func (s *DynamoKeyValueService) getTableName(ctx context.Context, store string) (*string, error) { + tables, err := s.provider.GetResources(ctx, resource.AwsResource_Collection) + if err != nil { + return nil, fmt.Errorf("encountered an error retrieving the table list: %w", err) + } + + if table, ok := tables[store]; ok { + tableName := strings.Split(table.ARN, "/")[1] + + // split the table arn to get the name + return aws.String(tableName), nil + } + + return nil, fmt.Errorf("store %s does not exist", store) +} diff --git a/cloud/azure/cmd/runtime/main.go b/cloud/azure/cmd/runtime/main.go index 231e9ca28..b9ad066b7 100644 --- a/cloud/azure/cmd/runtime/main.go +++ b/cloud/azure/cmd/runtime/main.go @@ -47,7 +47,7 @@ func main() { membraneOpts.ApiPlugin = api.NewAzureApiGatewayProvider(provider) - membraneOpts.DocumentPlugin, err = mongodb_service.New() + membraneOpts.KeyValuePlugin, err = mongodb_service.New() if err != nil { log.Default().Println("Failed to load document plugin:", err.Error()) } diff --git a/cloud/azure/deploy/policy.go b/cloud/azure/deploy/policy.go index 7bc494b78..d5aaa3f7e 100644 --- a/cloud/azure/deploy/policy.go +++ b/cloud/azure/deploy/policy.go @@ -118,7 +118,7 @@ func (p *NitricAzurePulumiProvider) Policy(ctx *pulumi.Context, parent pulumi.Re opts := []pulumi.ResourceOption{pulumi.Parent(parent)} for _, resource := range policy.Resources { - if resource.Id.Type == resourcespb.ResourceType_Collection { + if resource.Id.Type == resourcespb.ResourceType_KeyValueStore { continue } diff --git a/cloud/azure/runtime/document/mongodb.go b/cloud/azure/runtime/document/mongodb.go index cbb99b9ad..3f1c1d4ff 100644 --- a/cloud/azure/runtime/document/mongodb.go +++ b/cloud/azure/runtime/document/mongodb.go @@ -18,20 +18,18 @@ import ( "context" "errors" "fmt" - "strings" "time" "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" "google.golang.org/grpc/codes" "google.golang.org/protobuf/types/known/structpb" "github.com/nitrictech/nitric/cloud/azure/runtime/env" - document "github.com/nitrictech/nitric/core/pkg/decorators/documents" + "github.com/nitrictech/nitric/core/pkg/decorators/keyvalue" grpc_errors "github.com/nitrictech/nitric/core/pkg/grpc/errors" - documentpb "github.com/nitrictech/nitric/core/pkg/proto/documents/v1" + keyvaluepb "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1" ) const ( @@ -45,28 +43,18 @@ const ( childrenAttr = "_child_colls" ) -// Mapping to mongo operators, startsWith will be handled within the function -var mongoOperatorMap = map[string]string{ - "<": "$lt", - "<=": "$lte", - "==": "$eq", - "!=": "$ne", - ">=": "$gte", - ">": "$gt", -} - type MongoDocService struct { client *mongo.Client db *mongo.Database } -var _ documentpb.DocumentsServer = &MongoDocService{} +var _ keyvaluepb.KeyValueServer = &MongoDocService{} // Get a document from the mongo collection -func (s *MongoDocService) Get(ctx context.Context, req *documentpb.DocumentGetRequest) (*documentpb.DocumentGetResponse, error) { +func (s *MongoDocService) Get(ctx context.Context, req *keyvaluepb.KeyValueGetRequest) (*keyvaluepb.KeyValueGetResponse, error) { newErr := grpc_errors.ErrorsWithScope("MongoDocService.Get") - if err := document.ValidateKey(req.Key); err != nil { + if err := keyvalue.ValidateKey(req.Key); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -75,7 +63,7 @@ func (s *MongoDocService) Get(ctx context.Context, req *documentpb.DocumentGetRe } col := s.getCollection(req.Key) - docRef := bson.M{primaryKeyAttr: req.Key.Id} + docRef := bson.M{primaryKeyAttr: req.Key.Key} var value map[string]interface{} @@ -110,8 +98,8 @@ func (s *MongoDocService) Get(ctx context.Context, req *documentpb.DocumentGetRe ) } - return &documentpb.DocumentGetResponse{ - Document: &documentpb.Document{ + return &keyvaluepb.KeyValueGetResponse{ + Value: &keyvaluepb.Value{ Key: req.Key, Content: content, }, @@ -119,10 +107,10 @@ func (s *MongoDocService) Get(ctx context.Context, req *documentpb.DocumentGetRe } // Set a document in the mongo collection -func (s *MongoDocService) Set(ctx context.Context, req *documentpb.DocumentSetRequest) (*documentpb.DocumentSetResponse, error) { +func (s *MongoDocService) Set(ctx context.Context, req *keyvaluepb.KeyValueSetRequest) (*keyvaluepb.KeyValueSetResponse, error) { newErr := grpc_errors.ErrorsWithScope("MongoDocService.Set") - if err := document.ValidateKey(req.Key); err != nil { + if err := keyvalue.ValidateKey(req.Key); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -146,7 +134,7 @@ func (s *MongoDocService) Set(ctx context.Context, req *documentpb.DocumentSetRe opts := options.Update().SetUpsert(true) - filter := bson.M{primaryKeyAttr: req.Key.Id} + filter := bson.M{primaryKeyAttr: req.Key.Key} update := bson.D{{Key: "$set", Value: value}} @@ -159,26 +147,14 @@ func (s *MongoDocService) Set(ctx context.Context, req *documentpb.DocumentSetRe ) } - // add references - if req.Key.Collection.Parent != nil { - err := s.updateChildReferences(ctx, req.Key, coll.Name(), "$addToSet") - if err != nil { - return nil, newErr( - codes.Internal, - "error updating child references", - err, - ) - } - } - - return &documentpb.DocumentSetResponse{}, nil + return &keyvaluepb.KeyValueSetResponse{}, nil } // Delete a document from the mongo collection -func (s *MongoDocService) Delete(ctx context.Context, req *documentpb.DocumentDeleteRequest) (*documentpb.DocumentDeleteResponse, error) { +func (s *MongoDocService) Delete(ctx context.Context, req *keyvaluepb.KeyValueDeleteRequest) (*keyvaluepb.KeyValueDeleteResponse, error) { newErr := grpc_errors.ErrorsWithScope("MongoDocService.Delete") - if err := document.ValidateKey(req.Key); err != nil { + if err := keyvalue.ValidateKey(req.Key); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -188,14 +164,14 @@ func (s *MongoDocService) Delete(ctx context.Context, req *documentpb.DocumentDe coll := s.getCollection(req.Key) - filter := bson.M{primaryKeyAttr: req.Key.Id} + filter := bson.M{primaryKeyAttr: req.Key.Key} opts := options.FindOneAndDelete().SetProjection(bson.M{childrenAttr: 1, primaryKeyAttr: 0}) - var deletedDocument map[string]interface{} + var deletedKeyValue map[string]interface{} // Delete document - if err := coll.FindOneAndDelete(ctx, filter, opts).Decode(&deletedDocument); err != nil { + if err := coll.FindOneAndDelete(ctx, filter, opts).Decode(&deletedKeyValue); err != nil { return nil, newErr( codes.Internal, "error deleting document", @@ -203,253 +179,7 @@ func (s *MongoDocService) Delete(ctx context.Context, req *documentpb.DocumentDe ) } - // Delete all the child collection documents - if deletedDocument[childrenAttr] != nil { - children := deletedDocument[childrenAttr].(primitive.A) - - for _, v := range children { - colName := v.(string) - childCol := s.db.Collection(colName) - _, err := childCol.DeleteMany(ctx, bson.D{{Key: parentKeyAttr, Value: req.Key.Id}}) - if err != nil { - return nil, newErr( - codes.Internal, - "error deleting child collection document(s)", - err, - ) - } - } - } - - // clean references if none left - if req.Key.Collection.Parent != nil { - err := s.updateChildReferences(ctx, req.Key, coll.Name(), "$pull") - if err != nil { - return nil, newErr( - codes.Internal, - "error removing child references", - err, - ) - } - } - - return &documentpb.DocumentDeleteResponse{}, nil -} - -func (s *MongoDocService) getCursor(ctx context.Context, collection *documentpb.Collection, expressions []*documentpb.Expression, limit int32, pagingToken map[string]string) (cursor *mongo.Cursor, orderBy string, err error) { - coll := s.getCollection(&documentpb.Key{Collection: collection}) - - query := bson.M{} - - opts := options.Find() - - opts.SetProjection(bson.M{childrenAttr: 0}) - - if limit > 0 { - opts.SetLimit(int64(limit)) - - if len(pagingToken) > 0 { - opts.SetSort(bson.D{{Key: primaryKeyAttr, Value: 1}}) - - if tokens, ok := pagingToken["pagingTokens"]; ok { - var vals []interface{} - for _, v := range strings.Split(tokens, "|") { - vals = append(vals, v) - } - - query[primaryKeyAttr] = bson.D{{Key: "$gt", Value: vals[len(vals)-1]}} - } - } - } - - if collection.Parent != nil && collection.Parent.Id != "" { - query[parentKeyAttr] = collection.Parent.Id - } - - for _, exp := range expressions { - expOperand := exp.Operand - if exp.Operator == "startsWith" { - expVal := fmt.Sprintf("%v", exp.Value) - endRangeValue := document.GetEndRangeValue(expVal) - - startsWith := bson.D{ - {Key: s.getOperator(">="), Value: expVal}, - {Key: s.getOperator("<"), Value: endRangeValue}, - } - - query[expOperand] = startsWith - } else { - query[expOperand] = bson.D{ - {Key: s.getOperator(exp.Operator), Value: exp.Value}, - } - } - - if exp.Operator != "==" && limit > 0 && orderBy == "" { - opts.SetSort(bson.D{{Key: expOperand, Value: 1}}) - orderBy = expOperand - } - } - - cursor, err = coll.Find(ctx, query, opts) - - return -} - -// Query documents from the mongo collection with pagination -func (s *MongoDocService) Query(ctx context.Context, req *documentpb.DocumentQueryRequest) (*documentpb.DocumentQueryResponse, error) { - newErr := grpc_errors.ErrorsWithScope("MongoDocService.Query") - - if colErr, expErr := document.ValidateQueryCollection(req.Collection), document.ValidateExpressions(req.Expressions); colErr != nil || expErr != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid arguments", - fmt.Errorf("collection: %w, expressions %w", colErr, expErr), - ) - } - - queryResult := &documentpb.DocumentQueryResponse{ - Documents: make([]*documentpb.Document, 0), - } - - cursor, orderBy, err := s.getCursor(ctx, req.Collection, req.Expressions, req.Limit, req.PagingToken) - if err != nil { - return nil, newErr( - codes.InvalidArgument, - "error creating mongo find", - err, - ) - } - - defer cursor.Close(ctx) - for cursor.Next(ctx) { - sdkDoc, err := mongoDocToDocument(req.Collection, cursor) - if err != nil { - return nil, newErr( - codes.Internal, - "error decoding mongo document", - err, - ) - } - - queryResult.Documents = append(queryResult.Documents, sdkDoc) - - // If query limit configured determine continue tokens - if req.Limit > 0 && len(queryResult.Documents) == int(req.Limit) { - tokens := "" - if orderBy != "" { - tokens = fmt.Sprintf("%v", sdkDoc.Content.AsMap()[orderBy]) + "|" - } - tokens += sdkDoc.Key.Id - - queryResult.PagingToken = map[string]string{ - "pagingTokens": tokens, - } - } - } - - return queryResult, nil -} - -// QueryStream queries documents from the mongo collection as a stream -func (s *MongoDocService) QueryStream(req *documentpb.DocumentQueryStreamRequest, stream documentpb.Documents_QueryStreamServer) error { - newErr := grpc_errors.ErrorsWithScope("MongoDocService.QueryStream") - - colErr := document.ValidateQueryCollection(req.Collection) - expErr := document.ValidateExpressions(req.Expressions) - - if colErr != nil || expErr != nil { - return newErr( - codes.InvalidArgument, - "invalid arguments", - fmt.Errorf("collection error: %w, expression error: %w", colErr, expErr), - ) - } - - cursor, _, cursorErr := s.getCursor(stream.Context(), req.Collection, req.Expressions, req.Limit, nil) - - if cursorErr != nil { - return cursorErr - } - - for cursor.Next(stream.Context()) { - // return the next document - doc, err := mongoDocToDocument(req.Collection, cursor) - if err != nil { - return newErr( - codes.Internal, - "error decoding mongo document", - err, - ) - } - - err = stream.Send(&documentpb.DocumentQueryStreamResponse{ - Document: doc, - }) - - if err != nil { - return err - } - } - - if err := cursor.Close(stream.Context()); err != nil { - return newErr( - codes.Internal, - "mongo cursor close error", - cursor.Err(), - ) - } - - if cursor.Err() != nil { - return newErr( - codes.Internal, - "mongo cursor error", - cursor.Err(), - ) - } else { - return nil - } -} - -func mongoDocToDocument(coll *documentpb.Collection, cursor *mongo.Cursor) (*documentpb.Document, error) { - var docSnap map[string]interface{} - - if err := cursor.Decode(&docSnap); err != nil { - return nil, err - } - - id := docSnap[primaryKeyAttr].(string) - - // remove id from content - delete(docSnap, primaryKeyAttr) - - contentStruct, err := structpb.NewStruct(docSnap) - if err != nil { - return nil, err - } - - sdkDoc := &documentpb.Document{ - Content: contentStruct, - Key: &documentpb.Key{ - Collection: coll, - Id: id, - }, - } - - if docSnap[parentKeyAttr] != nil { - parentId := docSnap[parentKeyAttr].(string) - - sdkDoc.Key.Collection = &documentpb.Collection{ - Name: coll.Name, - Parent: &documentpb.Key{ - Collection: coll.Parent.Collection, - Id: parentId, - }, - } - - delete(docSnap, parentKeyAttr) - } - - return sdkDoc, nil + return &keyvaluepb.KeyValueDeleteResponse{}, nil } func New() (*MongoDocService, error) { @@ -502,7 +232,7 @@ func NewWithClient(client *mongo.Client, database string) *MongoDocService { } } -func mapKeys(key *documentpb.Key, source map[string]interface{}) map[string]interface{} { +func mapKeys(key *keyvaluepb.Key, source map[string]interface{}) map[string]interface{} { // Copy map newMap := make(map[string]interface{}) @@ -510,46 +240,11 @@ func mapKeys(key *documentpb.Key, source map[string]interface{}) map[string]inte newMap[key] = value } - parentKey := key.Collection.Parent - - newMap[primaryKeyAttr] = key.Id - - if parentKey != nil { - newMap[parentKeyAttr] = parentKey.Id - } + newMap[primaryKeyAttr] = key.Key return newMap } -func (s *MongoDocService) updateChildReferences(ctx context.Context, key *documentpb.Key, subCollectionName string, action string) error { - parentColl := s.getCollection(key.Collection.Parent) - filter := bson.M{primaryKeyAttr: key.Collection.Parent.Id} - referenceMeta := bson.M{childrenAttr: subCollectionName} - update := bson.D{{Key: action, Value: referenceMeta}} - - opts := options.Update().SetUpsert(true) - _, err := parentColl.UpdateOne(ctx, filter, update, opts) - if err != nil { - return err - } - - return nil -} - -func (s *MongoDocService) getCollection(key *documentpb.Key) *mongo.Collection { - collectionNames := []string{} - parentKey := key.Collection.Parent - - for parentKey != nil { - collectionNames = append(collectionNames, parentKey.Collection.Name) - parentKey = parentKey.Collection.Parent - } - - collectionNames = append(collectionNames, key.Collection.Name) - - return s.db.Collection(strings.Join(collectionNames, ".")) -} - -func (s *MongoDocService) getOperator(operator string) string { - return mongoOperatorMap[operator] +func (s *MongoDocService) getCollection(key *keyvaluepb.Key) *mongo.Collection { + return s.db.Collection(key.Store) } diff --git a/cloud/gcp/cmd/runtime/membrane.go b/cloud/gcp/cmd/runtime/membrane.go index 81999cd56..73c05bdc5 100644 --- a/cloud/gcp/cmd/runtime/membrane.go +++ b/cloud/gcp/cmd/runtime/membrane.go @@ -50,7 +50,7 @@ func main() { log.Default().Println("Failed to load secret plugin:", err.Error()) } - membraneOpts.DocumentPlugin, err = firestore_service.New() + membraneOpts.KeyValuePlugin, err = firestore_service.New() if err != nil { log.Default().Println("Failed to load document plugin:", err.Error()) } diff --git a/cloud/gcp/deploy/policy.go b/cloud/gcp/deploy/policy.go index 4283a07a8..1f498ce73 100644 --- a/cloud/gcp/deploy/policy.go +++ b/cloud/gcp/deploy/policy.go @@ -62,14 +62,14 @@ var gcpActionsMap map[v1.Action][]string = map[v1.Action][]string{ "pubsub.topics.publish", }, v1.Action_TopicList: {}, // see above in gcpListActions - v1.Action_CollectionDocumentDelete: { + v1.Action_KeyValueStoreDelete: { "appengine.applications.get", "datastore.databases.get", "datastore.indexes.get", "datastore.namespaces.get", "datastore.entities.delete", }, - v1.Action_CollectionDocumentRead: { + v1.Action_KeyValueStoreRead: { "appengine.applications.get", "datastore.databases.get", "datastore.entities.get", @@ -77,24 +77,13 @@ var gcpActionsMap map[v1.Action][]string = map[v1.Action][]string{ "datastore.namespaces.get", "datastore.entities.list", }, - v1.Action_CollectionDocumentWrite: { + v1.Action_KeyValueStoreWrite: { "appengine.applications.get", "datastore.indexes.list", "datastore.namespaces.list", "datastore.entities.create", "datastore.entities.update", }, - v1.Action_CollectionQuery: { - "appengine.applications.get", - "datastore.databases.get", - "datastore.entities.get", - "datastore.entities.list", - "datastore.indexes.get", - "datastore.namespaces.get", - }, - v1.Action_CollectionList: { - "appengine.applications.get", - }, v1.Action_SecretAccess: { "resourcemanager.projects.get", "secretmanager.locations.get", @@ -122,9 +111,9 @@ var collectionActions []string = nil func getCollectionActions() []string { if collectionActions == nil { collectionActions = make([]string, 0) - collectionActions = append(collectionActions, gcpActionsMap[v1.Action_CollectionDocumentRead]...) - collectionActions = append(collectionActions, gcpActionsMap[v1.Action_CollectionDocumentWrite]...) - collectionActions = append(collectionActions, gcpActionsMap[v1.Action_CollectionDocumentDelete]...) + collectionActions = append(collectionActions, gcpActionsMap[v1.Action_KeyValueStoreRead]...) + collectionActions = append(collectionActions, gcpActionsMap[v1.Action_KeyValueStoreWrite]...) + collectionActions = append(collectionActions, gcpActionsMap[v1.Action_KeyValueStoreDelete]...) } return collectionActions @@ -200,7 +189,7 @@ func (p *NitricGcpPulumiProvider) Policy(ctx *pulumi.Context, parent pulumi.Reso return err } - case v1.ResourceType_Collection: + case v1.ResourceType_KeyValueStore: collActions := filterCollectionActions(actions) collRole, err := NewCustomRole(ctx, memberName+"-role", collActions, opts...) diff --git a/cloud/gcp/runtime/cmd/membrane.go b/cloud/gcp/runtime/cmd/membrane.go index 56893cb4e..2b038acf0 100644 --- a/cloud/gcp/runtime/cmd/membrane.go +++ b/cloud/gcp/runtime/cmd/membrane.go @@ -47,7 +47,7 @@ func main() { log.Default().Println("Failed to load secret plugin:", err.Error()) } - membraneOpts.DocumentPlugin, err = firestore_service.New() + membraneOpts.KeyValuePlugin, err = firestore_service.New() if err != nil { log.Default().Println("Failed to load document plugin:", err.Error()) } diff --git a/cloud/gcp/runtime/document/firestore.go b/cloud/gcp/runtime/document/firestore.go index 50e0f64da..85b9ebe25 100644 --- a/cloud/gcp/runtime/document/firestore.go +++ b/cloud/gcp/runtime/document/firestore.go @@ -18,11 +18,10 @@ import ( "context" "errors" "fmt" - "strings" - document "github.com/nitrictech/nitric/core/pkg/decorators/documents" + "github.com/nitrictech/nitric/core/pkg/decorators/keyvalue" grpc_errors "github.com/nitrictech/nitric/core/pkg/grpc/errors" - v1 "github.com/nitrictech/nitric/core/pkg/proto/documents/v1" + v1 "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1" "google.golang.org/grpc/codes" grpcCodes "google.golang.org/grpc/codes" @@ -31,22 +30,19 @@ import ( "cloud.google.com/go/firestore" "cloud.google.com/go/pubsub" "golang.org/x/oauth2/google" - "google.golang.org/api/iterator" "google.golang.org/grpc/status" ) -const pagingTokens = "pagingTokens" - type FirestoreDocService struct { client *firestore.Client } -var _ v1.DocumentsServer = &FirestoreDocService{} +var _ v1.KeyValueServer = &FirestoreDocService{} -func (s *FirestoreDocService) Get(ctx context.Context, req *v1.DocumentGetRequest) (*v1.DocumentGetResponse, error) { +func (s *FirestoreDocService) Get(ctx context.Context, req *v1.KeyValueGetRequest) (*v1.KeyValueGetResponse, error) { newErr := grpc_errors.ErrorsWithScope("FirestoreDocService.Get") - if err := document.ValidateKey(req.Key); err != nil { + if err := keyvalue.ValidateKey(req.Key); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -82,18 +78,18 @@ func (s *FirestoreDocService) Get(ctx context.Context, req *v1.DocumentGetReques ) } - return &v1.DocumentGetResponse{ - Document: &v1.Document{ + return &v1.KeyValueGetResponse{ + Value: &v1.Value{ Key: req.Key, Content: documentContent, }, }, nil } -func (s *FirestoreDocService) Set(ctx context.Context, req *v1.DocumentSetRequest) (*v1.DocumentSetResponse, error) { +func (s *FirestoreDocService) Set(ctx context.Context, req *v1.KeyValueSetRequest) (*v1.KeyValueSetResponse, error) { newErr := grpc_errors.ErrorsWithScope("FirestoreDocService.Set") - if err := document.ValidateKey(req.Key); err != nil { + if err := keyvalue.ValidateKey(req.Key); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -127,13 +123,13 @@ func (s *FirestoreDocService) Set(ctx context.Context, req *v1.DocumentSetReques ) } - return &v1.DocumentSetResponse{}, nil + return &v1.KeyValueSetResponse{}, nil } -func (s *FirestoreDocService) Delete(ctx context.Context, req *v1.DocumentDeleteRequest) (*v1.DocumentDeleteResponse, error) { +func (s *FirestoreDocService) Delete(ctx context.Context, req *v1.KeyValueDeleteRequest) (*v1.KeyValueDeleteResponse, error) { newErr := grpc_errors.ErrorsWithScope("FirestoreDocService.Delete") - if err := document.ValidateKey(req.Key); err != nil { + if err := keyvalue.ValidateKey(req.Key); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -143,46 +139,6 @@ func (s *FirestoreDocService) Delete(ctx context.Context, req *v1.DocumentDelete doc := s.getDocRef(req.Key) - // Delete any sub collection documents - collsIter := doc.Collections(ctx) - for subCol, err := collsIter.Next(); !errors.Is(err, iterator.Done); subCol, err = collsIter.Next() { - if err != nil { - return nil, newErr( - codes.Internal, - "error deleting value", - err, - ) - } - - // Loop over sub collection documents, performing batch deletes - // up to Firestore's maximum batch size - const maxBatchSize = 20 - for { - docsIter := subCol.Limit(maxBatchSize).Documents(ctx) - numDeleted := 0 - - batch := s.client.Batch() - for subDoc, err := docsIter.Next(); !errors.Is(err, iterator.Done); subDoc, err = docsIter.Next() { - if err != nil { - return nil, newErr(codes.Internal, "error deleting records", err) - } - - batch.Delete(subDoc.Ref) - numDeleted++ - } - - // If no more to delete, completed - if numDeleted == 0 { - break - } - - _, err := batch.Commit(ctx) - if err != nil { - return nil, newErr(codes.Internal, "error deleting records", err) - } - } - } - // Delete document if _, err := doc.Delete(ctx); err != nil { if status.Code(err) == grpcCodes.PermissionDenied { @@ -200,191 +156,10 @@ func (s *FirestoreDocService) Delete(ctx context.Context, req *v1.DocumentDelete ) } - return &v1.DocumentDeleteResponse{}, nil -} - -func (s *FirestoreDocService) buildQuery(collection *v1.Collection, expressions []*v1.Expression, limit int32) (query firestore.Query, orderBy string) { - // Select correct root collection to perform query on - query = s.getQueryRoot(collection) - - for _, exp := range expressions { - expOperand := exp.Operand - if exp.Operator == "startsWith" { - expVal := fmt.Sprintf("%v", exp.Value) - endRangeValue := document.GetEndRangeValue(expVal) - query = query.Where(expOperand, ">=", exp.Value).Where(expOperand, "<", endRangeValue) - } else { - query = query.Where(expOperand, exp.Operator, exp.Value) - } - - if exp.Operator != "==" && limit > 0 && orderBy == "" { - query = query.OrderBy(expOperand, firestore.Asc) - orderBy = expOperand - } - } - - if limit > 0 { - query = query.Limit(int(limit)) - } - - return -} - -func (s *FirestoreDocService) Query(ctx context.Context, req *v1.DocumentQueryRequest) (*v1.DocumentQueryResponse, error) { - newErr := grpc_errors.ErrorsWithScope("FirestoreDocService.Query") - - if err := document.ValidateQueryCollection(req.Collection); err != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid key", - err, - ) - } - - if err := document.ValidateExpressions(req.Expressions); err != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid expressions", - err, - ) - } - - queryResult := &v1.DocumentQueryResponse{ - Documents: make([]*v1.Document, 0), - } - - // Select correct root collection to perform query on - query, orderBy := s.buildQuery(req.Collection, req.Expressions, req.Limit) - - if len(req.PagingToken) > 0 { - query = query.OrderBy(firestore.DocumentID, firestore.Asc) - - if tokens, ok := req.PagingToken[pagingTokens]; ok { - var vals []interface{} - for _, v := range strings.Split(tokens, "|") { - vals = append(vals, v) - } - query = query.StartAfter(vals...) - } - } - - itr := query.Documents(ctx) - for docSnp, err := itr.Next(); !errors.Is(err, iterator.Done); docSnp, err = itr.Next() { - if err != nil { - return nil, newErr( - codes.Internal, - "error querying value", - err, - ) - } - - sdkDoc, err := firestoreSnapshotToDocument(req.Collection, docSnp) - if err != nil { - return nil, err - } - - queryResult.Documents = append(queryResult.Documents, sdkDoc) - - // If query limit configured determine continue tokens - if req.Limit > 0 && int32(len(queryResult.Documents)) == req.Limit { - tokens := "" - if orderBy != "" { - tokens = fmt.Sprintf("%v", docSnp.Data()[orderBy]) + "|" - } - tokens += docSnp.Ref.ID - - queryResult.PagingToken = map[string]string{ - pagingTokens: tokens, - } - } - } - - return queryResult, nil -} - -func (s *FirestoreDocService) QueryStream(req *v1.DocumentQueryStreamRequest, srv v1.Documents_QueryStreamServer) error { - newErr := grpc_errors.ErrorsWithScope("FirestoreDocService.QueryStream") - - colErr := document.ValidateQueryCollection(req.Collection) - if colErr != nil { - return newErr( - codes.InvalidArgument, - "invalid arguments", - fmt.Errorf("collection error: %w", colErr), - ) - } - - expErr := document.ValidateExpressions(req.Expressions) - if expErr != nil { - return newErr( - codes.InvalidArgument, - "invalid arguments", - fmt.Errorf("expression error: %w", expErr), - ) - } - - query, _ := s.buildQuery(req.Collection, req.Expressions, req.Limit) - iter := query.Documents(srv.Context()) - - for { - docSnp, err := iter.Next() - if err != nil { - if errors.Is(err, iterator.Done) { - return nil - } - - return newErr( - codes.Internal, - "error querying value", - err, - ) - } - - sdkDoc, err := firestoreSnapshotToDocument(req.Collection, docSnp) - if err != nil { - return newErr(codes.Internal, "error serializing firestore document", err) - } - - if err := srv.Send(&v1.DocumentQueryStreamResponse{ - Document: sdkDoc, - }); err != nil { - return newErr( - codes.Internal, - "error sending document", - err, - ) - } - } -} - -func firestoreSnapshotToDocument(col *v1.Collection, snapshot *firestore.DocumentSnapshot) (*v1.Document, error) { - documentContent, err := structpb.NewStruct(snapshot.Data()) - if err != nil { - return nil, err - } - - doc := &v1.Document{ - Content: documentContent, - Key: &v1.Key{ - Collection: col, - Id: snapshot.Ref.ID, - }, - } - - if p := snapshot.Ref.Parent.Parent; p != nil { - doc.Key.Collection = &v1.Collection{ - Name: col.Name, - Parent: &v1.Key{ - Collection: col.Parent.Collection, - Id: p.ID, - }, - } - } - - return doc, nil + return &v1.KeyValueDeleteResponse{}, nil } -func New() (v1.DocumentsServer, error) { +func New() (v1.KeyValueServer, error) { ctx := context.Background() credentials, credentialsError := google.FindDefaultCredentials(ctx, pubsub.ScopeCloudPlatform) @@ -402,40 +177,12 @@ func New() (v1.DocumentsServer, error) { }, nil } -func NewWithClient(client *firestore.Client) (v1.DocumentsServer, error) { +func NewWithClient(client *firestore.Client) (v1.KeyValueServer, error) { return &FirestoreDocService{ client: client, }, nil } func (s *FirestoreDocService) getDocRef(key *v1.Key) *firestore.DocumentRef { - parentKey := key.Collection.Parent - - if parentKey == nil { - return s.client.Collection(key.Collection.Name).Doc(key.Id) - } else { - return s.client.Collection(parentKey.Collection.Name). - Doc(parentKey.Id). - Collection(key.Collection.Name). - Doc(key.Id) - } -} - -func (s *FirestoreDocService) getQueryRoot(collection *v1.Collection) firestore.Query { - parentKey := collection.Parent - - if parentKey == nil { - return s.client.Collection(collection.Name).Offset(0) - } else { - if parentKey.Id != "" { - return s.client.Collection(parentKey.Collection.Name). - Doc(parentKey.Id). - Collection(collection.Name). - Offset(0) - } else { - // Note there is a risk of subcollection name collison - // TODO: future YAML validation could help mitigate this - return s.client.CollectionGroup(collection.Name).Offset(0) - } - } + return s.client.Collection(key.Store).Doc(key.Key) } diff --git a/core/pkg/decorators/documents/documents.go b/core/pkg/decorators/documents/documents.go deleted file mode 100644 index 64c9e639e..000000000 --- a/core/pkg/decorators/documents/documents.go +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document - -import ( - "fmt" - "sort" - "strings" - - v1 "github.com/nitrictech/nitric/core/pkg/proto/documents/v1" -) - -const SubcollectionDelimiter = "+" - -// Map of valid expression operators -var validOperators = map[string]bool{ - "==": true, - ">": true, - "<": true, - ">=": true, - "<=": true, - "startsWith": true, -} - -// ValidateKey - validates a document key, used for operations on a single document e.g. Get, Set, Delete -func ValidateKey(key *v1.Key) error { - if key == nil { - return fmt.Errorf("provide non-nil key") - } - if key.Id == "" { - return fmt.Errorf("provide non-blank key.Id") - } - if strings.Contains(key.Id, SubcollectionDelimiter) { - return fmt.Errorf("key.Id cannot contain %s", SubcollectionDelimiter) - } - if key.Collection == nil { - return fmt.Errorf("provide non-nil key.Collection") - } else { - if err := ValidateCollection(key.Collection); err != nil { - return fmt.Errorf("invalid collection for document key %s, %w", key.Id, err) - } - } - return nil -} - -// ValidateCollection - validates a collection key, used for operations on a single document/collection e.g. Get, Set, Delete -func ValidateCollection(collection *v1.Collection) error { - if collection == nil { - return fmt.Errorf("provide non-nil collection") - } - if collection.Name == "" { - return fmt.Errorf("provide non-blank collection.Name") - } - if collection.Parent != nil { - if err := ValidateKey(collection.Parent); err != nil { - return fmt.Errorf("invalid parent for collection %s, %w", collection.Name, err) - } - } - - return validateSubCollectionDepth(collection) -} - -// ValidateQueryKey - Validates a key used for query operations. -// unique from ValidateKey in that it permits blank key.Id values for wildcard query scenarios. -// e.g. querying values in a sub-collection for all documents in the parent collection. -func ValidateQueryKey(key *v1.Key) error { - if key == nil { - return fmt.Errorf("provide non-nil key") - } - if key.Collection == nil { - return fmt.Errorf("provide non-nil key.Collection") - } else { - if err := ValidateQueryCollection(key.Collection); err != nil { - return fmt.Errorf("invalid collection for document key %s, %w", key.Id, err) - } - } - return nil -} - -// ValidateQueryCollection - Validates a collection used for query operations. -// unique from ValidateCollection in that it calls ValidateQueryKey for the collection.Key -func ValidateQueryCollection(collection *v1.Collection) error { - if collection == nil { - return fmt.Errorf("provide non-nil collection") - } - if collection.Name == "" { - return fmt.Errorf("provide non-blank collection.Name") - } - if collection.Parent != nil { - if err := ValidateQueryKey(collection.Parent); err != nil { - return fmt.Errorf("invalid parent for collection %s, %w", collection.Name, err) - } - } - return validateSubCollectionDepth(collection) -} - -// GetEndRangeValue - Get end range value to implement "startsWith" expression operator using where clause. -// For example with sdk.Expression("pk", "startsWith", "Customer#") this translates to: -// WHERE pk >= {startRangeValue} AND pk < {endRangeValue} -// WHERE pk >= "Customer#" AND pk < "Customer!" -func GetEndRangeValue(value string) string { - strFrontCode := value[:len(value)-1] - - strEndCode := value[len(value)-1:] - - return strFrontCode + string(strEndCode[0]+1) -} - -// ValidateExpressions - Validate the provided query expressions -func ValidateExpressions(expressions []*v1.Expression) error { - if expressions == nil { - return fmt.Errorf("provide non-nil query expressions") - } - - inequalityProperties := make(map[string]string) - - for _, exp := range expressions { - if exp.Operand == "" { - return fmt.Errorf("provide non-blank query expression operand: %v", exp) - } - - if _, found := validOperators[exp.Operator]; !found { - return fmt.Errorf("provide valid query expression operator [==, <, >, <=, >=, startsWith]: %v", exp.Operator) - } - if exp.Value.String() == "" { - return fmt.Errorf("provide non-blank query expression value: %v", exp) - } - - if exp.Operator != "==" { - inequalityProperties[exp.Operand] = exp.Operator - } - } - - // Firestore inequality compatibility check - if len(inequalityProperties) > 1 { - msg := "" - for prop, exp := range inequalityProperties { - if msg != "" { - msg += ", " - } - msg += prop + " " + exp - } - // Firestore does not support inequality expressions on multiple properties. - // Firestore requires composite key to be created at deployment time. - return fmt.Errorf("inequality expressions on multiple properties are not supported: [ %v ]", msg) - } - - // DynamoDB range expression compatibility check - if err := hasRangeError(expressions); err != nil { - return err - } - - return nil -} - -// QueryExpression sorting support with sort.Interface - -type ExpsSort []*v1.Expression - -func (exps ExpsSort) Len() int { - return len(exps) -} - -// Less - Sort by Operand then Operator then Value -func (exps ExpsSort) Less(i, j int) bool { - operandCompare := strings.Compare(exps[i].Operand, exps[j].Operand) - if operandCompare == 0 { - // Reverse operator comparison for to support range expressions - operatorCompare := strings.Compare(exps[j].Operator, exps[i].Operator) - if operatorCompare == 0 { - iVal := fmt.Sprintf("%v", exps[i].Value) - jVal := fmt.Sprintf("%v", exps[j].Value) - - return strings.Compare(iVal, jVal) < 0 - } else { - return operatorCompare < 0 - } - } else { - return operandCompare < 0 - } -} - -func (exps ExpsSort) Swap(i, j int) { - exps[i], exps[j] = exps[j], exps[i] -} - -const MaxSubCollectionDepth = 1 - -// validateSubCollectionDepth - returns an error if the provided collection exceeds the maximum supported -// depth for a sub-collection. -func validateSubCollectionDepth(collection *v1.Collection) error { - coll := collection - depth := 0 - for coll.Parent != nil { - depth += 1 - coll = coll.Parent.Collection - } - if depth > MaxSubCollectionDepth { - return fmt.Errorf( - "sub-collections only supported to a depth of %d, found depth of %d for collection %s", - MaxSubCollectionDepth, - depth, - collection.Name, - ) - } - return nil -} - -// DynamoDB only supports query range operands: >= AND <= -// For example: WHERE price >= 20.00 AND price <= 50.0 -func hasRangeError(exps []*v1.Expression) error { - sortedExps := make([]*v1.Expression, len(exps)) - copy(sortedExps, exps) - - sort.Sort(ExpsSort(sortedExps)) - - for index, exp := range sortedExps { - if index < (len(sortedExps) - 1) { - nextExp := sortedExps[index+1] - - if exp.Operand == nextExp.Operand && - ((exp.Operator == ">" && nextExp.Operator == "<") || - (exp.Operator == ">" && nextExp.Operator == "<=") || - (exp.Operator == ">=" && nextExp.Operator == "<")) { - // Range expression combination not supported with DynamoDB, must use >= and <= which maps to DynamoDB BETWEEN - return fmt.Errorf("range expression combination not supported (use operators >= and <=) : %v", exp) - } - } - } - - return nil -} diff --git a/core/pkg/decorators/documents/validate_test.go b/core/pkg/decorators/documents/validate_test.go deleted file mode 100644 index 3bf869d1e..000000000 --- a/core/pkg/decorators/documents/validate_test.go +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -package document_test - -import ( - "sort" - - document "github.com/nitrictech/nitric/core/pkg/decorators/documents" - documentpb "github.com/nitrictech/nitric/core/pkg/proto/documents/v1" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -// Function Test Cases - -var _ = Describe("Document Plugin", func() { - When("ValidateKey", func() { - When("Nil key", func() { - It("should return error", func() { - err := document.ValidateKey(nil) - Expect(err.Error()).To(ContainSubstring("provide non-nil key")) - }) - }) - When("Blank key.Collection", func() { - It("should return error", func() { - err := document.ValidateKey(&documentpb.Key{}) - Expect(err.Error()).To(ContainSubstring("provide non-blank key.Id")) - }) - }) - When("Blank key.Id", func() { - It("should return error", func() { - key := &documentpb.Key{ - Collection: &documentpb.Collection{Name: "users"}, - } - err := document.ValidateKey(key) - Expect(err.Error()).To(ContainSubstring("provide non-blank key.Id")) - }) - }) - When("Blank key.Collection.Parent.Collection.Name", func() { - It("should return error", func() { - key := &documentpb.Key{ - Collection: &documentpb.Collection{Name: "users", Parent: &documentpb.Key{}}, - Id: "123", - } - err := document.ValidateKey(key) - Expect(err.Error()).To(ContainSubstring("invalid parent for collection users, provide non-blank key.Id")) - }) - }) - When("Blank key.Collection.Parent.Id", func() { - It("should return error", func() { - key := &documentpb.Key{ - Collection: &documentpb.Collection{ - Name: "orders", - Parent: &documentpb.Key{Collection: &documentpb.Collection{Name: "customers"}}, - }, - Id: "123", - } - err := document.ValidateKey(key) - Expect(err.Error()).To(ContainSubstring("invalid parent for collection orders, provide non-blank key.Id")) - }) - }) - }) - - When("ValidateQueryCollection", func() { - When("Nil key", func() { - It("should return error", func() { - err := document.ValidateQueryCollection(nil) - Expect(err.Error()).To(ContainSubstring("provide non-nil collection")) - }) - }) - When("Blank key.Collection", func() { - It("should return error", func() { - err := document.ValidateQueryCollection(&documentpb.Collection{}) - Expect(err.Error()).To(ContainSubstring("provide non-blank collection.Name")) - }) - }) - When("Blank key.Id", func() { - It("should return nil", func() { - coll := &documentpb.Collection{Name: "users"} - err := document.ValidateQueryCollection(coll) - Expect(err).To(BeNil()) - }) - }) - When("Blank key.Collection.Parent.Collection.Name", func() { - It("should return error", func() { - coll := &documentpb.Collection{ - Name: "users", - Parent: &documentpb.Key{ - Id: "test-key", - Collection: &documentpb.Collection{}, - }, - } - err := document.ValidateQueryCollection(coll) - Expect(err.Error()).To(ContainSubstring("provide non-blank collection.Name")) - }) - }) - When("Blank collection.Parent.Id", func() { - It("should return nil", func() { - coll := &documentpb.Collection{ - Name: "orders", - Parent: &documentpb.Key{ - Id: "test-key", - Collection: &documentpb.Collection{Name: "customers"}, - }, - } - err := document.ValidateQueryCollection(coll) - Expect(err).To(BeNil()) - }) - }) - }) - - When("GetValueEndCode", func() { - It("should get next value", func() { - endCode := document.GetEndRangeValue("Customer#") - Expect(endCode).NotTo(BeNil()) - Expect(endCode).To(BeEquivalentTo("Customer$")) - }) - }) - - When("ExpsSort", func() { - When("order is sorted", func() { - It("Should not change order", func() { - exps := []*documentpb.Expression{ - {Operand: "A", Operator: "==", Value: &documentpb.ExpressionValue{ - Kind: &documentpb.ExpressionValue_IntValue{IntValue: 1}, - }}, - {Operand: "B", Operator: "==", Value: &documentpb.ExpressionValue{ - Kind: &documentpb.ExpressionValue_IntValue{IntValue: 2}, - }}, - {Operand: "C", Operator: "==", Value: &documentpb.ExpressionValue{ - Kind: &documentpb.ExpressionValue_IntValue{IntValue: 3}, - }}, - } - sort.Sort(document.ExpsSort(exps)) - Expect(exps[0].Operand).To(BeEquivalentTo("A")) - Expect(exps[1].Operand).To(BeEquivalentTo("B")) - Expect(exps[2].Operand).To(BeEquivalentTo("C")) - }) - }) - When("not order not sorted", func() { - It("Should not change order", func() { - exps := []*documentpb.Expression{ - {Operand: "A", Operator: "==", Value: &documentpb.ExpressionValue{ - Kind: &documentpb.ExpressionValue_IntValue{IntValue: 1}, - }}, - {Operand: "B", Operator: "==", Value: &documentpb.ExpressionValue{ - Kind: &documentpb.ExpressionValue_IntValue{IntValue: 2}, - }}, - {Operand: "C", Operator: "==", Value: &documentpb.ExpressionValue{ - Kind: &documentpb.ExpressionValue_IntValue{IntValue: 3}, - }}, - } - sort.Sort(document.ExpsSort(exps)) - Expect(exps[0].Operand).To(BeEquivalentTo("A")) - Expect(exps[1].Operand).To(BeEquivalentTo("B")) - Expect(exps[2].Operand).To(BeEquivalentTo("C")) - }) - }) - When("not order not sorted", func() { - It("Should not change order", func() { - exps := []*documentpb.Expression{ - {Operand: "number", Operator: "==", Value: &documentpb.ExpressionValue{ - Kind: &documentpb.ExpressionValue_IntValue{IntValue: 1}, - }}, - {Operand: "number", Operator: ">=", Value: &documentpb.ExpressionValue{ - Kind: &documentpb.ExpressionValue_IntValue{IntValue: 1}, - }}, - {Operand: "number", Operator: "<=", Value: &documentpb.ExpressionValue{ - Kind: &documentpb.ExpressionValue_IntValue{IntValue: 2}, - }}, - } - sort.Sort(document.ExpsSort(exps)) - Expect(exps[0].Operator).To(BeEquivalentTo(">=")) - Expect(exps[1].Operator).To(BeEquivalentTo("==")) - Expect(exps[2].Operator).To(BeEquivalentTo("<=")) - }) - }) - }) -}) diff --git a/core/pkg/decorators/keyvalue/keyvalue.go b/core/pkg/decorators/keyvalue/keyvalue.go new file mode 100644 index 000000000..fc1ffb862 --- /dev/null +++ b/core/pkg/decorators/keyvalue/keyvalue.go @@ -0,0 +1,234 @@ +// Copyright 2021 Nitric Pty Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package keyvalue + +import ( + "fmt" + + v1 "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1" +) + +// Map of valid expression operators +// var validOperators = map[string]bool{ +// "==": true, +// ">": true, +// "<": true, +// ">=": true, +// "<=": true, +// "startsWith": true, +// } + +// ValidateKey - validates a document key, used for operations on a single document e.g. Get, Set, Delete +func ValidateKey(key *v1.Key) error { + if key == nil { + return fmt.Errorf("provide non-nil key") + } + if key.Key == "" { + return fmt.Errorf("provide non-blank key.Id") + } + + if key.Store == "" { + return fmt.Errorf("provide non-blank key.Store") + } + return nil +} + +// ValidateCollection - validates a collection key, used for operations on a single document/collection e.g. Get, Set, Delete +// func ValidateCollection(collection *v1.Collection) error { +// if collection == nil { +// return fmt.Errorf("provide non-nil collection") +// } +// if collection.Name == "" { +// return fmt.Errorf("provide non-blank collection.Name") +// } +// if collection.Parent != nil { +// if err := ValidateKey(collection.Parent); err != nil { +// return fmt.Errorf("invalid parent for collection %s, %w", collection.Name, err) +// } +// } + +// return validateSubCollectionDepth(collection) +// } + +// ValidateQueryKey - Validates a key used for query operations. +// unique from ValidateKey in that it permits blank key.Id values for wildcard query scenarios. +// e.g. querying values in a sub-collection for all documents in the parent collection. +// func ValidateQueryKey(key *v1.Key) error { +// if key == nil { +// return fmt.Errorf("provide non-nil key") +// } +// if key.Collection == nil { +// return fmt.Errorf("provide non-nil key.Collection") +// } else { +// if err := ValidateQueryCollection(key.Collection); err != nil { +// return fmt.Errorf("invalid collection for document key %s, %w", key.Id, err) +// } +// } +// return nil +// } + +// ValidateQueryCollection - Validates a collection used for query operations. +// unique from ValidateCollection in that it calls ValidateQueryKey for the collection.Key +// func ValidateQueryCollection(collection *v1.Collection) error { +// if collection == nil { +// return fmt.Errorf("provide non-nil collection") +// } +// if collection.Name == "" { +// return fmt.Errorf("provide non-blank collection.Name") +// } +// if collection.Parent != nil { +// if err := ValidateQueryKey(collection.Parent); err != nil { +// return fmt.Errorf("invalid parent for collection %s, %w", collection.Name, err) +// } +// } +// return validateSubCollectionDepth(collection) +// } + +// GetEndRangeValue - Get end range value to implement "startsWith" expression operator using where clause. +// For example with sdk.Expression("pk", "startsWith", "Customer#") this translates to: +// WHERE pk >= {startRangeValue} AND pk < {endRangeValue} +// WHERE pk >= "Customer#" AND pk < "Customer!" +func GetEndRangeValue(value string) string { + strFrontCode := value[:len(value)-1] + + strEndCode := value[len(value)-1:] + + return strFrontCode + string(strEndCode[0]+1) +} + +// ValidateExpressions - Validate the provided query expressions +// func ValidateExpressions(expressions []*v1.Expression) error { +// if expressions == nil { +// return fmt.Errorf("provide non-nil query expressions") +// } + +// inequalityProperties := make(map[string]string) + +// for _, exp := range expressions { +// if exp.Operand == "" { +// return fmt.Errorf("provide non-blank query expression operand: %v", exp) +// } + +// if _, found := validOperators[exp.Operator]; !found { +// return fmt.Errorf("provide valid query expression operator [==, <, >, <=, >=, startsWith]: %v", exp.Operator) +// } +// if exp.Value.String() == "" { +// return fmt.Errorf("provide non-blank query expression value: %v", exp) +// } + +// if exp.Operator != "==" { +// inequalityProperties[exp.Operand] = exp.Operator +// } +// } + +// // Firestore inequality compatibility check +// if len(inequalityProperties) > 1 { +// msg := "" +// for prop, exp := range inequalityProperties { +// if msg != "" { +// msg += ", " +// } +// msg += prop + " " + exp +// } +// // Firestore does not support inequality expressions on multiple properties. +// // Firestore requires composite key to be created at deployment time. +// return fmt.Errorf("inequality expressions on multiple properties are not supported: [ %v ]", msg) +// } + +// // DynamoDB range expression compatibility check +// if err := hasRangeError(expressions); err != nil { +// return err +// } + +// return nil +// } + +// QueryExpression sorting support with sort.Interface + +// type ExpsSort []*v1.Expression + +// func (exps ExpsSort) Len() int { +// return len(exps) +// } + +// // Less - Sort by Operand then Operator then Value +// func (exps ExpsSort) Less(i, j int) bool { +// operandCompare := strings.Compare(exps[i].Operand, exps[j].Operand) +// if operandCompare == 0 { +// // Reverse operator comparison for to support range expressions +// operatorCompare := strings.Compare(exps[j].Operator, exps[i].Operator) +// if operatorCompare == 0 { +// iVal := fmt.Sprintf("%v", exps[i].Value) +// jVal := fmt.Sprintf("%v", exps[j].Value) + +// return strings.Compare(iVal, jVal) < 0 +// } else { +// return operatorCompare < 0 +// } +// } else { +// return operandCompare < 0 +// } +// } + +// func (exps ExpsSort) Swap(i, j int) { +// exps[i], exps[j] = exps[j], exps[i] +// } + +// const MaxSubCollectionDepth = 1 + +// validateSubCollectionDepth - returns an error if the provided collection exceeds the maximum supported +// depth for a sub-collection. +// func validateSubCollectionDepth(collection *v1.Collection) error { +// coll := collection +// depth := 0 +// for coll.Parent != nil { +// depth += 1 +// coll = coll.Parent.Collection +// } +// if depth > MaxSubCollectionDepth { +// return fmt.Errorf( +// "sub-collections only supported to a depth of %d, found depth of %d for collection %s", +// MaxSubCollectionDepth, +// depth, +// collection.Name, +// ) +// } +// return nil +// } + +// // DynamoDB only supports query range operands: >= AND <= +// // For example: WHERE price >= 20.00 AND price <= 50.0 +// func hasRangeError(exps []*v1.Expression) error { +// sortedExps := make([]*v1.Expression, len(exps)) +// copy(sortedExps, exps) + +// sort.Sort(ExpsSort(sortedExps)) + +// for index, exp := range sortedExps { +// if index < (len(sortedExps) - 1) { +// nextExp := sortedExps[index+1] + +// if exp.Operand == nextExp.Operand && +// ((exp.Operator == ">" && nextExp.Operator == "<") || +// (exp.Operator == ">" && nextExp.Operator == "<=") || +// (exp.Operator == ">=" && nextExp.Operator == "<")) { +// // Range expression combination not supported with DynamoDB, must use >= and <= which maps to DynamoDB BETWEEN +// return fmt.Errorf("range expression combination not supported (use operators >= and <=) : %v", exp) +// } +// } +// } + +// return nil +// } diff --git a/core/pkg/decorators/documents/document_suite_test.go b/core/pkg/decorators/keyvalue/keyvalue_suite_test.go similarity index 97% rename from core/pkg/decorators/documents/document_suite_test.go rename to core/pkg/decorators/keyvalue/keyvalue_suite_test.go index 17a785b1a..3ca344d2d 100644 --- a/core/pkg/decorators/documents/document_suite_test.go +++ b/core/pkg/decorators/keyvalue/keyvalue_suite_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package document_test +package keyvalue_test import ( "testing" diff --git a/core/pkg/decorators/keyvalue/validate_test.go b/core/pkg/decorators/keyvalue/validate_test.go new file mode 100644 index 000000000..b4587194b --- /dev/null +++ b/core/pkg/decorators/keyvalue/validate_test.go @@ -0,0 +1,50 @@ +// Copyright 2021 Nitric Pty Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package keyvalue_test + +import ( + document "github.com/nitrictech/nitric/core/pkg/decorators/keyvalue" + keyvaluepb "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +// Function Test Cases + +var _ = Describe("Document Plugin", func() { + When("ValidateKey", func() { + When("Nil key", func() { + It("should return error", func() { + err := document.ValidateKey(nil) + Expect(err.Error()).To(ContainSubstring("provide non-nil key")) + }) + }) + When("Blank key.Collection", func() { + It("should return error", func() { + err := document.ValidateKey(&keyvaluepb.Key{}) + Expect(err.Error()).To(ContainSubstring("provide non-blank key.Id")) + }) + }) + When("Blank key.Id", func() { + It("should return error", func() { + key := &keyvaluepb.Key{ + Store: "users", + } + err := document.ValidateKey(key) + Expect(err.Error()).To(ContainSubstring("provide non-blank key.Id")) + }) + }) + }) +}) diff --git a/core/pkg/membrane/membrane.go b/core/pkg/membrane/membrane.go index 7c4b2784e..17ee8480d 100644 --- a/core/pkg/membrane/membrane.go +++ b/core/pkg/membrane/membrane.go @@ -33,8 +33,8 @@ import ( "github.com/nitrictech/nitric/core/pkg/gateway" pm "github.com/nitrictech/nitric/core/pkg/process" apispb "github.com/nitrictech/nitric/core/pkg/proto/apis/v1" - documentspb "github.com/nitrictech/nitric/core/pkg/proto/documents/v1" httppb "github.com/nitrictech/nitric/core/pkg/proto/http/v1" + keyvaluepb "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1" resourcespb "github.com/nitrictech/nitric/core/pkg/proto/resources/v1" schedulespb "github.com/nitrictech/nitric/core/pkg/proto/schedules/v1" secretspb "github.com/nitrictech/nitric/core/pkg/proto/secrets/v1" @@ -66,7 +66,7 @@ type MembraneOptions struct { MinWorkers *int // Resource access plugins - DocumentPlugin documentspb.DocumentsServer + KeyValuePlugin keyvaluepb.KeyValueServer TopicsPlugin topicspb.TopicsServer StoragePlugin storagepb.StorageServer SecretManagerPlugin secretspb.SecretManagerServer @@ -236,7 +236,7 @@ func (s *Membrane) Start(startOpts ...MembraneStartOptions) error { // Load & Register the service plugins secretsServerWithValidation := decorators.SecretsServerWithValidation(s.options.SecretManagerPlugin) - documentspb.RegisterDocumentsServer(s.grpcServer, s.options.DocumentPlugin) + keyvaluepb.RegisterKeyValueServer(s.grpcServer, s.options.KeyValuePlugin) topicspb.RegisterTopicsServer(s.grpcServer, s.options.TopicsPlugin) storagepb.RegisterStorageServer(s.grpcServer, s.options.StoragePlugin) secretspb.RegisterSecretManagerServer(s.grpcServer, secretsServerWithValidation) diff --git a/core/pkg/proto/deployments/v1/deployments.pb.go b/core/pkg/proto/deployments/v1/deployments.pb.go index 12faf6197..f4fa24381 100644 --- a/core/pkg/proto/deployments/v1/deployments.pb.go +++ b/core/pkg/proto/deployments/v1/deployments.pb.go @@ -985,14 +985,14 @@ func (x *Topic) GetSubscriptions() []*SubscriptionTarget { return nil } -type Collection struct { +type KeyValueStore struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *Collection) Reset() { - *x = Collection{} +func (x *KeyValueStore) Reset() { + *x = KeyValueStore{} if protoimpl.UnsafeEnabled { mi := &file_nitric_proto_deployments_v1_deployments_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1000,13 +1000,13 @@ func (x *Collection) Reset() { } } -func (x *Collection) String() string { +func (x *KeyValueStore) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Collection) ProtoMessage() {} +func (*KeyValueStore) ProtoMessage() {} -func (x *Collection) ProtoReflect() protoreflect.Message { +func (x *KeyValueStore) ProtoReflect() protoreflect.Message { mi := &file_nitric_proto_deployments_v1_deployments_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1018,8 +1018,8 @@ func (x *Collection) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Collection.ProtoReflect.Descriptor instead. -func (*Collection) Descriptor() ([]byte, []int) { +// Deprecated: Use KeyValueStore.ProtoReflect.Descriptor instead. +func (*KeyValueStore) Descriptor() ([]byte, []int) { return file_nitric_proto_deployments_v1_deployments_proto_rawDescGZIP(), []int{12} } @@ -1763,7 +1763,7 @@ type Resource struct { // *Resource_Api // *Resource_Policy // *Resource_Schedule - // *Resource_Collection + // *Resource_KeyValueStore // *Resource_Secret // *Resource_Websocket // *Resource_Http @@ -1858,9 +1858,9 @@ func (x *Resource) GetSchedule() *Schedule { return nil } -func (x *Resource) GetCollection() *Collection { - if x, ok := x.GetConfig().(*Resource_Collection); ok { - return x.Collection +func (x *Resource) GetKeyValueStore() *KeyValueStore { + if x, ok := x.GetConfig().(*Resource_KeyValueStore); ok { + return x.KeyValueStore } return nil } @@ -1914,8 +1914,8 @@ type Resource_Schedule struct { Schedule *Schedule `protobuf:"bytes,15,opt,name=schedule,proto3,oneof"` } -type Resource_Collection struct { - Collection *Collection `protobuf:"bytes,16,opt,name=collection,proto3,oneof"` +type Resource_KeyValueStore struct { + KeyValueStore *KeyValueStore `protobuf:"bytes,16,opt,name=key_value_store,json=keyValueStore,proto3,oneof"` } type Resource_Secret struct { @@ -1942,7 +1942,7 @@ func (*Resource_Policy) isResource_Config() {} func (*Resource_Schedule) isResource_Config() {} -func (*Resource_Collection) isResource_Config() {} +func (*Resource_KeyValueStore) isResource_Config() {} func (*Resource_Secret) isResource_Config() {} @@ -2189,173 +2189,174 @@ var file_nitric_proto_deployments_v1_deployments_proto_rawDesc = []byte{ 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x22, 0x0c, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x08, - 0x0a, 0x06, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, 0x3a, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1a, - 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x22, 0x5c, 0x0a, 0x11, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x06, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x69, 0x74, 0x72, - 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x22, 0x32, 0x0a, 0x0a, 0x48, 0x74, 0x74, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x12, 0x1a, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x47, 0x0a, 0x04, 0x48, 0x74, 0x74, 0x70, 0x12, 0x3f, - 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, - 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x74, 0x74, - 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, - 0x2d, 0x0a, 0x03, 0x41, 0x70, 0x69, 0x12, 0x1a, 0x0a, 0x07, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, - 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x70, 0x65, 0x6e, 0x61, - 0x70, 0x69, 0x42, 0x0a, 0x0a, 0x08, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x90, - 0x02, 0x0a, 0x09, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x53, 0x0a, 0x0e, - 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x12, 0x59, 0x0a, 0x11, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, + 0x22, 0x0f, 0x0a, 0x0d, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0x22, 0x08, 0x0a, 0x06, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, 0x3a, 0x0a, 0x12, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x12, 0x1a, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x5c, 0x0a, 0x11, 0x54, 0x6f, 0x70, 0x69, 0x63, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x06, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, - 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x73, 0x6f, - 0x63, 0x6b, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x10, 0x64, 0x69, 0x73, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x53, 0x0a, 0x0e, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x52, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x22, 0x37, 0x0a, 0x0f, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x36, 0x0a, 0x0e, 0x53, 0x63, - 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x07, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x22, 0xdf, 0x01, 0x0a, 0x08, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, - 0x43, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2b, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, - 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, - 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x12, 0x42, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x72, 0x79, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x72, 0x79, 0x48, - 0x00, 0x52, 0x05, 0x65, 0x76, 0x65, 0x72, 0x79, 0x12, 0x3f, 0x0a, 0x04, 0x63, 0x72, 0x6f, 0x6e, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x43, 0x72, 0x6f, - 0x6e, 0x48, 0x00, 0x52, 0x04, 0x63, 0x72, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x61, 0x64, - 0x65, 0x6e, 0x63, 0x65, 0x22, 0x23, 0x0a, 0x0d, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, - 0x45, 0x76, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x61, 0x74, 0x65, 0x22, 0x2e, 0x0a, 0x0c, 0x53, 0x63, 0x68, - 0x65, 0x64, 0x75, 0x6c, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, - 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, - 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xd5, 0x05, 0x0a, 0x08, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x52, 0x02, 0x69, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x00, 0x52, 0x07, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, - 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, + 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x32, 0x0a, 0x0a, 0x48, 0x74, 0x74, 0x70, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x47, 0x0a, 0x04, 0x48, 0x74, 0x74, + 0x70, 0x12, 0x3f, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x48, 0x74, 0x74, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x22, 0x2d, 0x0a, 0x03, 0x41, 0x70, 0x69, 0x12, 0x1a, 0x0a, 0x07, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x42, 0x0a, 0x0a, 0x08, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, + 0x74, 0x22, 0x90, 0x02, 0x0a, 0x09, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, + 0x53, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x00, 0x52, 0x06, - 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x3a, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x70, - 0x69, 0x63, 0x12, 0x34, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x20, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, - 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, - 0x69, 0x48, 0x00, 0x52, 0x03, 0x61, 0x70, 0x69, 0x12, 0x3d, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, - 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x00, 0x52, - 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x43, 0x0a, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, - 0x75, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x69, 0x74, 0x72, + 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x12, 0x59, 0x0a, 0x11, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, + 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, + 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x10, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, + 0x53, 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x22, 0x37, 0x0a, 0x0f, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, + 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x36, 0x0a, + 0x0e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, + 0x1a, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x74, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0xdf, 0x01, 0x0a, 0x08, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, + 0x6c, 0x65, 0x12, 0x43, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, + 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x42, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x72, 0x79, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x45, 0x76, 0x65, + 0x72, 0x79, 0x48, 0x00, 0x52, 0x05, 0x65, 0x76, 0x65, 0x72, 0x79, 0x12, 0x3f, 0x0a, 0x04, 0x63, + 0x72, 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, - 0x48, 0x00, 0x52, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x49, 0x0a, 0x0a, - 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, - 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x63, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, - 0x74, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x48, 0x00, 0x52, 0x06, - 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, - 0x6b, 0x65, 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x69, 0x74, 0x72, + 0x43, 0x72, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x63, 0x72, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, + 0x63, 0x61, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x23, 0x0a, 0x0d, 0x53, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x74, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x61, 0x74, 0x65, 0x22, 0x2e, 0x0a, 0x0c, + 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, + 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe0, 0x05, 0x0a, + 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, - 0x74, 0x48, 0x00, 0x52, 0x09, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x37, - 0x0a, 0x04, 0x68, 0x74, 0x74, 0x70, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, + 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, + 0x00, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x06, 0x62, 0x75, + 0x63, 0x6b, 0x65, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x69, 0x74, + 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x48, + 0x00, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x3a, 0x0a, 0x05, 0x74, 0x6f, 0x70, + 0x69, 0x63, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, + 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x48, 0x00, 0x52, 0x05, + 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x34, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x41, 0x70, 0x69, 0x48, 0x00, 0x52, 0x03, 0x61, 0x70, 0x69, 0x12, 0x3d, 0x0a, 0x06, 0x70, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x69, + 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x48, 0x00, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x43, 0x0a, 0x08, 0x73, 0x63, + 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, - 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, - 0x00, 0x52, 0x04, 0x68, 0x74, 0x74, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x22, 0xd1, 0x01, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x45, 0x0a, 0x0a, - 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, - 0x61, 0x6c, 0x73, 0x12, 0x3b, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x43, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x4b, 0x0a, 0x04, 0x53, 0x70, 0x65, 0x63, 0x12, 0x43, 0x0a, - 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x2a, 0x55, 0x0a, 0x18, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x65, - 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, - 0x0a, 0x06, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, - 0x44, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, - 0x45, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a, - 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x2a, 0x51, 0x0a, 0x18, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, - 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x47, 0x52, 0x45, 0x53, - 0x53, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x02, - 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x32, 0xe6, 0x01, 0x0a, - 0x0a, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x68, 0x0a, 0x02, 0x55, - 0x70, 0x12, 0x30, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, + 0x54, 0x0a, 0x0f, 0x6b, 0x65, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, + 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, + 0x74, 0x6f, 0x72, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x3d, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, + 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x48, 0x00, 0x52, 0x06, 0x73, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, + 0x74, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x48, + 0x00, 0x52, 0x09, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x37, 0x0a, 0x04, + 0x68, 0x74, 0x74, 0x70, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x69, 0x74, + 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, 0x00, 0x52, + 0x04, 0x68, 0x74, 0x74, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, + 0xd1, 0x01, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x45, 0x0a, 0x0a, 0x70, 0x72, + 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, + 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, + 0x73, 0x12, 0x3b, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x43, + 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x30, 0x01, 0x12, 0x6e, 0x0a, 0x04, 0x44, 0x6f, 0x77, 0x6e, 0x12, 0x32, 0x2e, - 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, - 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, - 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x30, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x22, 0x4b, 0x0a, 0x04, 0x53, 0x70, 0x65, 0x63, 0x12, 0x43, 0x0a, 0x09, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, + 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x2a, 0x55, 0x0a, 0x18, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x65, 0x70, 0x6c, + 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x0a, 0x06, + 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x44, 0x41, + 0x54, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x10, + 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x41, 0x4d, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, + 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x2a, 0x51, 0x0a, 0x18, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x00, + 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x47, 0x52, 0x45, 0x53, 0x53, 0x10, + 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x02, 0x12, 0x0a, + 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x03, 0x32, 0xe6, 0x01, 0x0a, 0x0a, 0x44, + 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x68, 0x0a, 0x02, 0x55, 0x70, 0x12, + 0x30, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, + 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, + 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x6f, 0x77, 0x6e, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x30, 0x01, 0x42, 0xb5, 0x01, 0x0a, 0x1e, 0x69, 0x6f, 0x2e, 0x6e, 0x69, 0x74, - 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x01, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x6e, - 0x69, 0x74, 0x72, 0x69, 0x63, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x2f, 0x76, 0x31, 0x3b, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x70, - 0x62, 0xaa, 0x02, 0x1b, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0xca, - 0x02, 0x1b, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5c, 0x44, - 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x30, 0x01, 0x12, 0x6e, 0x0a, 0x04, 0x44, 0x6f, 0x77, 0x6e, 0x12, 0x32, 0x2e, 0x6e, 0x69, + 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x30, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, + 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, + 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x6f, 0x77, 0x6e, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x30, 0x01, 0x42, 0xb5, 0x01, 0x0a, 0x1e, 0x69, 0x6f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, + 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x50, 0x01, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x6e, 0x69, 0x74, + 0x72, 0x69, 0x63, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, + 0x31, 0x3b, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x70, 0x62, 0xaa, + 0x02, 0x1b, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, + 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0xca, 0x02, 0x1b, + 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5c, 0x44, 0x65, 0x70, + 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -2387,7 +2388,7 @@ var file_nitric_proto_deployments_v1_deployments_proto_goTypes = []interface{}{ (*Bucket)(nil), // 11: nitric.proto.deployments.v1.Bucket (*BucketListener)(nil), // 12: nitric.proto.deployments.v1.BucketListener (*Topic)(nil), // 13: nitric.proto.deployments.v1.Topic - (*Collection)(nil), // 14: nitric.proto.deployments.v1.Collection + (*KeyValueStore)(nil), // 14: nitric.proto.deployments.v1.KeyValueStore (*Secret)(nil), // 15: nitric.proto.deployments.v1.Secret (*SubscriptionTarget)(nil), // 16: nitric.proto.deployments.v1.SubscriptionTarget (*TopicSubscription)(nil), // 17: nitric.proto.deployments.v1.TopicSubscription @@ -2440,7 +2441,7 @@ var file_nitric_proto_deployments_v1_deployments_proto_depIdxs = []int32{ 20, // 27: nitric.proto.deployments.v1.Resource.api:type_name -> nitric.proto.deployments.v1.Api 28, // 28: nitric.proto.deployments.v1.Resource.policy:type_name -> nitric.proto.deployments.v1.Policy 24, // 29: nitric.proto.deployments.v1.Resource.schedule:type_name -> nitric.proto.deployments.v1.Schedule - 14, // 30: nitric.proto.deployments.v1.Resource.collection:type_name -> nitric.proto.deployments.v1.Collection + 14, // 30: nitric.proto.deployments.v1.Resource.key_value_store:type_name -> nitric.proto.deployments.v1.KeyValueStore 15, // 31: nitric.proto.deployments.v1.Resource.secret:type_name -> nitric.proto.deployments.v1.Secret 21, // 32: nitric.proto.deployments.v1.Resource.websocket:type_name -> nitric.proto.deployments.v1.Websocket 19, // 33: nitric.proto.deployments.v1.Resource.http:type_name -> nitric.proto.deployments.v1.Http @@ -2610,7 +2611,7 @@ func file_nitric_proto_deployments_v1_deployments_proto_init() { } } file_nitric_proto_deployments_v1_deployments_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Collection); i { + switch v := v.(*KeyValueStore); i { case 0: return &v.state case 1: @@ -2844,7 +2845,7 @@ func file_nitric_proto_deployments_v1_deployments_proto_init() { (*Resource_Api)(nil), (*Resource_Policy)(nil), (*Resource_Schedule)(nil), - (*Resource_Collection)(nil), + (*Resource_KeyValueStore)(nil), (*Resource_Secret)(nil), (*Resource_Websocket)(nil), (*Resource_Http)(nil), diff --git a/core/pkg/proto/documents/v1/documents.pb.go b/core/pkg/proto/documents/v1/documents.pb.go deleted file mode 100644 index 176fd9434..000000000 --- a/core/pkg/proto/documents/v1/documents.pb.go +++ /dev/null @@ -1,1361 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.4 -// source: nitric/proto/documents/v1/documents.proto - -package documentspb - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Provides a Collection type for storing documents -type Collection struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The collection name - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional parent key, required when the collection is a sub-collection of another document - Parent *Key `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` -} - -func (x *Collection) Reset() { - *x = Collection{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Collection) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Collection) ProtoMessage() {} - -func (x *Collection) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[0] - 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 Collection.ProtoReflect.Descriptor instead. -func (*Collection) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{0} -} - -func (x *Collection) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Collection) GetParent() *Key { - if x != nil { - return x.Parent - } - return nil -} - -// Provides a document identifying key type -type Key struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The item collection - Collection *Collection `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` - // The items unique id - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *Key) Reset() { - *x = Key{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Key) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Key) ProtoMessage() {} - -func (x *Key) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[1] - 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 Key.ProtoReflect.Descriptor instead. -func (*Key) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{1} -} - -func (x *Key) GetCollection() *Collection { - if x != nil { - return x.Collection - } - return nil -} - -func (x *Key) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -// Provides a return document type -type Document struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The document content (JSON object) - Content *structpb.Struct `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` - // The document's unique key, including collection/sub-collections - Key *Key `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *Document) Reset() { - *x = Document{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Document) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Document) ProtoMessage() {} - -func (x *Document) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[2] - 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 Document.ProtoReflect.Descriptor instead. -func (*Document) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{2} -} - -func (x *Document) GetContent() *structpb.Struct { - if x != nil { - return x.Content - } - return nil -} - -func (x *Document) GetKey() *Key { - if x != nil { - return x.Key - } - return nil -} - -type ExpressionValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The kind of value. - // - // Types that are assignable to Kind: - // - // *ExpressionValue_IntValue - // *ExpressionValue_DoubleValue - // *ExpressionValue_StringValue - // *ExpressionValue_BoolValue - Kind isExpressionValue_Kind `protobuf_oneof:"kind"` -} - -func (x *ExpressionValue) Reset() { - *x = ExpressionValue{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExpressionValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExpressionValue) ProtoMessage() {} - -func (x *ExpressionValue) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[3] - 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 ExpressionValue.ProtoReflect.Descriptor instead. -func (*ExpressionValue) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{3} -} - -func (m *ExpressionValue) GetKind() isExpressionValue_Kind { - if m != nil { - return m.Kind - } - return nil -} - -func (x *ExpressionValue) GetIntValue() int64 { - if x, ok := x.GetKind().(*ExpressionValue_IntValue); ok { - return x.IntValue - } - return 0 -} - -func (x *ExpressionValue) GetDoubleValue() float64 { - if x, ok := x.GetKind().(*ExpressionValue_DoubleValue); ok { - return x.DoubleValue - } - return 0 -} - -func (x *ExpressionValue) GetStringValue() string { - if x, ok := x.GetKind().(*ExpressionValue_StringValue); ok { - return x.StringValue - } - return "" -} - -func (x *ExpressionValue) GetBoolValue() bool { - if x, ok := x.GetKind().(*ExpressionValue_BoolValue); ok { - return x.BoolValue - } - return false -} - -type isExpressionValue_Kind interface { - isExpressionValue_Kind() -} - -type ExpressionValue_IntValue struct { - // Represents an integer value. - IntValue int64 `protobuf:"varint,1,opt,name=int_value,json=intValue,proto3,oneof"` -} - -type ExpressionValue_DoubleValue struct { - // Represents a double value. - DoubleValue float64 `protobuf:"fixed64,2,opt,name=double_value,json=doubleValue,proto3,oneof"` -} - -type ExpressionValue_StringValue struct { - // Represents a string value. - StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` -} - -type ExpressionValue_BoolValue struct { - // Represents a boolean value. - BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` -} - -func (*ExpressionValue_IntValue) isExpressionValue_Kind() {} - -func (*ExpressionValue_DoubleValue) isExpressionValue_Kind() {} - -func (*ExpressionValue_StringValue) isExpressionValue_Kind() {} - -func (*ExpressionValue_BoolValue) isExpressionValue_Kind() {} - -// Provides a query expression type -type Expression struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The query operand or attribute - Operand string `protobuf:"bytes,1,opt,name=operand,proto3" json:"operand,omitempty"` - // The query operator [ == | < | <= | > | >= | startsWith ] - Operator string `protobuf:"bytes,2,opt,name=operator,proto3" json:"operator,omitempty"` - // The query expression value - Value *ExpressionValue `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *Expression) Reset() { - *x = Expression{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Expression) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Expression) ProtoMessage() {} - -func (x *Expression) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_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 Expression.ProtoReflect.Descriptor instead. -func (*Expression) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{4} -} - -func (x *Expression) GetOperand() string { - if x != nil { - return x.Operand - } - return "" -} - -func (x *Expression) GetOperator() string { - if x != nil { - return x.Operator - } - return "" -} - -func (x *Expression) GetValue() *ExpressionValue { - if x != nil { - return x.Value - } - return nil -} - -type DocumentGetRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Key of the document to retrieve - Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *DocumentGetRequest) Reset() { - *x = DocumentGetRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentGetRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentGetRequest) ProtoMessage() {} - -func (x *DocumentGetRequest) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_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 DocumentGetRequest.ProtoReflect.Descriptor instead. -func (*DocumentGetRequest) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{5} -} - -func (x *DocumentGetRequest) GetKey() *Key { - if x != nil { - return x.Key - } - return nil -} - -type DocumentGetResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The retrieved value - Document *Document `protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"` -} - -func (x *DocumentGetResponse) Reset() { - *x = DocumentGetResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentGetResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentGetResponse) ProtoMessage() {} - -func (x *DocumentGetResponse) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_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 DocumentGetResponse.ProtoReflect.Descriptor instead. -func (*DocumentGetResponse) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{6} -} - -func (x *DocumentGetResponse) GetDocument() *Document { - if x != nil { - return x.Document - } - return nil -} - -type DocumentSetRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Key of the document to set - Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // The document content to store (JSON object) - Content *structpb.Struct `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` -} - -func (x *DocumentSetRequest) Reset() { - *x = DocumentSetRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentSetRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentSetRequest) ProtoMessage() {} - -func (x *DocumentSetRequest) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[7] - 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 DocumentSetRequest.ProtoReflect.Descriptor instead. -func (*DocumentSetRequest) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{7} -} - -func (x *DocumentSetRequest) GetKey() *Key { - if x != nil { - return x.Key - } - return nil -} - -func (x *DocumentSetRequest) GetContent() *structpb.Struct { - if x != nil { - return x.Content - } - return nil -} - -type DocumentSetResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *DocumentSetResponse) Reset() { - *x = DocumentSetResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentSetResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentSetResponse) ProtoMessage() {} - -func (x *DocumentSetResponse) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[8] - 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 DocumentSetResponse.ProtoReflect.Descriptor instead. -func (*DocumentSetResponse) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{8} -} - -type DocumentDeleteRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Key of the document to delete - Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (x *DocumentDeleteRequest) Reset() { - *x = DocumentDeleteRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentDeleteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentDeleteRequest) ProtoMessage() {} - -func (x *DocumentDeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[9] - 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 DocumentDeleteRequest.ProtoReflect.Descriptor instead. -func (*DocumentDeleteRequest) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{9} -} - -func (x *DocumentDeleteRequest) GetKey() *Key { - if x != nil { - return x.Key - } - return nil -} - -type DocumentDeleteResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *DocumentDeleteResponse) Reset() { - *x = DocumentDeleteResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentDeleteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentDeleteResponse) ProtoMessage() {} - -func (x *DocumentDeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[10] - 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 DocumentDeleteResponse.ProtoReflect.Descriptor instead. -func (*DocumentDeleteResponse) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{10} -} - -type DocumentQueryRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The collection to query - Collection *Collection `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` - // Optional query expressions - Expressions []*Expression `protobuf:"bytes,3,rep,name=expressions,proto3" json:"expressions,omitempty"` - // Optional query fetch limit - Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` - // Optional query paging continuation token - PagingToken map[string]string `protobuf:"bytes,5,rep,name=paging_token,json=pagingToken,proto3" json:"paging_token,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *DocumentQueryRequest) Reset() { - *x = DocumentQueryRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentQueryRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentQueryRequest) ProtoMessage() {} - -func (x *DocumentQueryRequest) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_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 DocumentQueryRequest.ProtoReflect.Descriptor instead. -func (*DocumentQueryRequest) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{11} -} - -func (x *DocumentQueryRequest) GetCollection() *Collection { - if x != nil { - return x.Collection - } - return nil -} - -func (x *DocumentQueryRequest) GetExpressions() []*Expression { - if x != nil { - return x.Expressions - } - return nil -} - -func (x *DocumentQueryRequest) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *DocumentQueryRequest) GetPagingToken() map[string]string { - if x != nil { - return x.PagingToken - } - return nil -} - -type DocumentQueryResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The retrieved values - Documents []*Document `protobuf:"bytes,1,rep,name=documents,proto3" json:"documents,omitempty"` - // The query paging continuation token, when empty no further results are available - PagingToken map[string]string `protobuf:"bytes,2,rep,name=paging_token,json=pagingToken,proto3" json:"paging_token,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *DocumentQueryResponse) Reset() { - *x = DocumentQueryResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentQueryResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentQueryResponse) ProtoMessage() {} - -func (x *DocumentQueryResponse) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[12] - 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 DocumentQueryResponse.ProtoReflect.Descriptor instead. -func (*DocumentQueryResponse) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{12} -} - -func (x *DocumentQueryResponse) GetDocuments() []*Document { - if x != nil { - return x.Documents - } - return nil -} - -func (x *DocumentQueryResponse) GetPagingToken() map[string]string { - if x != nil { - return x.PagingToken - } - return nil -} - -type DocumentQueryStreamRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The collection to query - Collection *Collection `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` - // Optional query expressions - Expressions []*Expression `protobuf:"bytes,3,rep,name=expressions,proto3" json:"expressions,omitempty"` - // Optional query fetch limit - Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` -} - -func (x *DocumentQueryStreamRequest) Reset() { - *x = DocumentQueryStreamRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentQueryStreamRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentQueryStreamRequest) ProtoMessage() {} - -func (x *DocumentQueryStreamRequest) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[13] - 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 DocumentQueryStreamRequest.ProtoReflect.Descriptor instead. -func (*DocumentQueryStreamRequest) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{13} -} - -func (x *DocumentQueryStreamRequest) GetCollection() *Collection { - if x != nil { - return x.Collection - } - return nil -} - -func (x *DocumentQueryStreamRequest) GetExpressions() []*Expression { - if x != nil { - return x.Expressions - } - return nil -} - -func (x *DocumentQueryStreamRequest) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -type DocumentQueryStreamResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The stream document - Document *Document `protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"` -} - -func (x *DocumentQueryStreamResponse) Reset() { - *x = DocumentQueryStreamResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentQueryStreamResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentQueryStreamResponse) ProtoMessage() {} - -func (x *DocumentQueryStreamResponse) ProtoReflect() protoreflect.Message { - mi := &file_nitric_proto_documents_v1_documents_proto_msgTypes[14] - 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 DocumentQueryStreamResponse.ProtoReflect.Descriptor instead. -func (*DocumentQueryStreamResponse) Descriptor() ([]byte, []int) { - return file_nitric_proto_documents_v1_documents_proto_rawDescGZIP(), []int{14} -} - -func (x *DocumentQueryStreamResponse) GetDocument() *Document { - if x != nil { - return x.Document - } - return nil -} - -var File_nitric_proto_documents_v1_documents_proto protoreflect.FileDescriptor - -var file_nitric_proto_documents_v1_documents_proto_rawDesc = []byte{ - 0x0a, 0x29, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x6f, 0x63, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x6e, 0x69, 0x74, - 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x58, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x5c, - 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x45, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x69, 0x74, 0x72, - 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x6f, 0x0a, 0x08, - 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, - 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0xa3, 0x01, - 0x0a, 0x0f, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, - 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, - 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, - 0x69, 0x6e, 0x64, 0x22, 0x84, 0x01, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x6e, 0x64, 0x12, 0x1a, 0x0a, 0x08, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x40, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x46, 0x0a, 0x12, 0x44, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x30, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, - 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x22, 0x56, 0x0a, 0x13, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x47, 0x65, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x64, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x69, - 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x08, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x79, 0x0a, 0x12, 0x44, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x30, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, - 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x49, 0x0a, 0x15, - 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4b, - 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0xe1, 0x02, 0x0a, 0x14, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x0a, 0x63, 0x6f, - 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, - 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x47, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x65, - 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, - 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x12, 0x63, 0x0a, 0x0c, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x3e, 0x0a, 0x10, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 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, 0x22, 0x80, 0x02, 0x0a, 0x15, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, - 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x41, 0x0a, 0x09, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x09, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x12, 0x64, 0x0a, 0x0c, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, - 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x50, 0x61, 0x67, 0x69, 0x6e, - 0x67, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x61, 0x67, - 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x3e, 0x0a, 0x10, 0x50, 0x61, 0x67, 0x69, - 0x6e, 0x67, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 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, 0x22, 0xc2, 0x01, 0x0a, 0x1a, 0x44, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x69, - 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, - 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x72, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x5e, 0x0a, - 0x1b, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x08, - 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, - 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x08, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x32, 0xb2, 0x04, - 0x0a, 0x09, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x64, 0x0a, 0x03, 0x47, - 0x65, 0x74, 0x12, 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x64, 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, - 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x12, 0x30, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, - 0x2f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x30, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x7e, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x12, 0x35, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, - 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x30, 0x01, 0x42, 0xa9, 0x01, 0x0a, 0x1c, 0x69, 0x6f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x2e, 0x76, 0x31, 0x42, 0x09, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x01, - 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x69, 0x74, - 0x72, 0x69, 0x63, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x64, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x70, 0x62, 0xaa, 0x02, 0x19, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0xca, 0x02, 0x19, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x5c, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x5c, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_nitric_proto_documents_v1_documents_proto_rawDescOnce sync.Once - file_nitric_proto_documents_v1_documents_proto_rawDescData = file_nitric_proto_documents_v1_documents_proto_rawDesc -) - -func file_nitric_proto_documents_v1_documents_proto_rawDescGZIP() []byte { - file_nitric_proto_documents_v1_documents_proto_rawDescOnce.Do(func() { - file_nitric_proto_documents_v1_documents_proto_rawDescData = protoimpl.X.CompressGZIP(file_nitric_proto_documents_v1_documents_proto_rawDescData) - }) - return file_nitric_proto_documents_v1_documents_proto_rawDescData -} - -var file_nitric_proto_documents_v1_documents_proto_msgTypes = make([]protoimpl.MessageInfo, 17) -var file_nitric_proto_documents_v1_documents_proto_goTypes = []interface{}{ - (*Collection)(nil), // 0: nitric.proto.documents.v1.Collection - (*Key)(nil), // 1: nitric.proto.documents.v1.Key - (*Document)(nil), // 2: nitric.proto.documents.v1.Document - (*ExpressionValue)(nil), // 3: nitric.proto.documents.v1.ExpressionValue - (*Expression)(nil), // 4: nitric.proto.documents.v1.Expression - (*DocumentGetRequest)(nil), // 5: nitric.proto.documents.v1.DocumentGetRequest - (*DocumentGetResponse)(nil), // 6: nitric.proto.documents.v1.DocumentGetResponse - (*DocumentSetRequest)(nil), // 7: nitric.proto.documents.v1.DocumentSetRequest - (*DocumentSetResponse)(nil), // 8: nitric.proto.documents.v1.DocumentSetResponse - (*DocumentDeleteRequest)(nil), // 9: nitric.proto.documents.v1.DocumentDeleteRequest - (*DocumentDeleteResponse)(nil), // 10: nitric.proto.documents.v1.DocumentDeleteResponse - (*DocumentQueryRequest)(nil), // 11: nitric.proto.documents.v1.DocumentQueryRequest - (*DocumentQueryResponse)(nil), // 12: nitric.proto.documents.v1.DocumentQueryResponse - (*DocumentQueryStreamRequest)(nil), // 13: nitric.proto.documents.v1.DocumentQueryStreamRequest - (*DocumentQueryStreamResponse)(nil), // 14: nitric.proto.documents.v1.DocumentQueryStreamResponse - nil, // 15: nitric.proto.documents.v1.DocumentQueryRequest.PagingTokenEntry - nil, // 16: nitric.proto.documents.v1.DocumentQueryResponse.PagingTokenEntry - (*structpb.Struct)(nil), // 17: google.protobuf.Struct -} -var file_nitric_proto_documents_v1_documents_proto_depIdxs = []int32{ - 1, // 0: nitric.proto.documents.v1.Collection.parent:type_name -> nitric.proto.documents.v1.Key - 0, // 1: nitric.proto.documents.v1.Key.collection:type_name -> nitric.proto.documents.v1.Collection - 17, // 2: nitric.proto.documents.v1.Document.content:type_name -> google.protobuf.Struct - 1, // 3: nitric.proto.documents.v1.Document.key:type_name -> nitric.proto.documents.v1.Key - 3, // 4: nitric.proto.documents.v1.Expression.value:type_name -> nitric.proto.documents.v1.ExpressionValue - 1, // 5: nitric.proto.documents.v1.DocumentGetRequest.key:type_name -> nitric.proto.documents.v1.Key - 2, // 6: nitric.proto.documents.v1.DocumentGetResponse.document:type_name -> nitric.proto.documents.v1.Document - 1, // 7: nitric.proto.documents.v1.DocumentSetRequest.key:type_name -> nitric.proto.documents.v1.Key - 17, // 8: nitric.proto.documents.v1.DocumentSetRequest.content:type_name -> google.protobuf.Struct - 1, // 9: nitric.proto.documents.v1.DocumentDeleteRequest.key:type_name -> nitric.proto.documents.v1.Key - 0, // 10: nitric.proto.documents.v1.DocumentQueryRequest.collection:type_name -> nitric.proto.documents.v1.Collection - 4, // 11: nitric.proto.documents.v1.DocumentQueryRequest.expressions:type_name -> nitric.proto.documents.v1.Expression - 15, // 12: nitric.proto.documents.v1.DocumentQueryRequest.paging_token:type_name -> nitric.proto.documents.v1.DocumentQueryRequest.PagingTokenEntry - 2, // 13: nitric.proto.documents.v1.DocumentQueryResponse.documents:type_name -> nitric.proto.documents.v1.Document - 16, // 14: nitric.proto.documents.v1.DocumentQueryResponse.paging_token:type_name -> nitric.proto.documents.v1.DocumentQueryResponse.PagingTokenEntry - 0, // 15: nitric.proto.documents.v1.DocumentQueryStreamRequest.collection:type_name -> nitric.proto.documents.v1.Collection - 4, // 16: nitric.proto.documents.v1.DocumentQueryStreamRequest.expressions:type_name -> nitric.proto.documents.v1.Expression - 2, // 17: nitric.proto.documents.v1.DocumentQueryStreamResponse.document:type_name -> nitric.proto.documents.v1.Document - 5, // 18: nitric.proto.documents.v1.Documents.Get:input_type -> nitric.proto.documents.v1.DocumentGetRequest - 7, // 19: nitric.proto.documents.v1.Documents.Set:input_type -> nitric.proto.documents.v1.DocumentSetRequest - 9, // 20: nitric.proto.documents.v1.Documents.Delete:input_type -> nitric.proto.documents.v1.DocumentDeleteRequest - 11, // 21: nitric.proto.documents.v1.Documents.Query:input_type -> nitric.proto.documents.v1.DocumentQueryRequest - 13, // 22: nitric.proto.documents.v1.Documents.QueryStream:input_type -> nitric.proto.documents.v1.DocumentQueryStreamRequest - 6, // 23: nitric.proto.documents.v1.Documents.Get:output_type -> nitric.proto.documents.v1.DocumentGetResponse - 8, // 24: nitric.proto.documents.v1.Documents.Set:output_type -> nitric.proto.documents.v1.DocumentSetResponse - 10, // 25: nitric.proto.documents.v1.Documents.Delete:output_type -> nitric.proto.documents.v1.DocumentDeleteResponse - 12, // 26: nitric.proto.documents.v1.Documents.Query:output_type -> nitric.proto.documents.v1.DocumentQueryResponse - 14, // 27: nitric.proto.documents.v1.Documents.QueryStream:output_type -> nitric.proto.documents.v1.DocumentQueryStreamResponse - 23, // [23:28] is the sub-list for method output_type - 18, // [18:23] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name -} - -func init() { file_nitric_proto_documents_v1_documents_proto_init() } -func file_nitric_proto_documents_v1_documents_proto_init() { - if File_nitric_proto_documents_v1_documents_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_nitric_proto_documents_v1_documents_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Collection); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Key); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Document); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExpressionValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expression); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentGetRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentGetResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentSetRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentSetResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentDeleteRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentDeleteResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentQueryRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentQueryResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentQueryStreamRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentQueryStreamResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_nitric_proto_documents_v1_documents_proto_msgTypes[3].OneofWrappers = []interface{}{ - (*ExpressionValue_IntValue)(nil), - (*ExpressionValue_DoubleValue)(nil), - (*ExpressionValue_StringValue)(nil), - (*ExpressionValue_BoolValue)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_nitric_proto_documents_v1_documents_proto_rawDesc, - NumEnums: 0, - NumMessages: 17, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_nitric_proto_documents_v1_documents_proto_goTypes, - DependencyIndexes: file_nitric_proto_documents_v1_documents_proto_depIdxs, - MessageInfos: file_nitric_proto_documents_v1_documents_proto_msgTypes, - }.Build() - File_nitric_proto_documents_v1_documents_proto = out.File - file_nitric_proto_documents_v1_documents_proto_rawDesc = nil - file_nitric_proto_documents_v1_documents_proto_goTypes = nil - file_nitric_proto_documents_v1_documents_proto_depIdxs = nil -} diff --git a/core/pkg/proto/documents/v1/documents_grpc.pb.go b/core/pkg/proto/documents/v1/documents_grpc.pb.go deleted file mode 100644 index 58cf3c365..000000000 --- a/core/pkg/proto/documents/v1/documents_grpc.pb.go +++ /dev/null @@ -1,285 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.4 -// source: nitric/proto/documents/v1/documents.proto - -package documentspb - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// DocumentsClient is the client API for Documents service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type DocumentsClient interface { - // Get an existing document - Get(ctx context.Context, in *DocumentGetRequest, opts ...grpc.CallOption) (*DocumentGetResponse, error) - // Create a new or overwrite an existing document - Set(ctx context.Context, in *DocumentSetRequest, opts ...grpc.CallOption) (*DocumentSetResponse, error) - // Delete an existing document - Delete(ctx context.Context, in *DocumentDeleteRequest, opts ...grpc.CallOption) (*DocumentDeleteResponse, error) - // Query the document collection (supports pagination) - Query(ctx context.Context, in *DocumentQueryRequest, opts ...grpc.CallOption) (*DocumentQueryResponse, error) - // Query the document collection (supports streaming) - QueryStream(ctx context.Context, in *DocumentQueryStreamRequest, opts ...grpc.CallOption) (Documents_QueryStreamClient, error) -} - -type documentsClient struct { - cc grpc.ClientConnInterface -} - -func NewDocumentsClient(cc grpc.ClientConnInterface) DocumentsClient { - return &documentsClient{cc} -} - -func (c *documentsClient) Get(ctx context.Context, in *DocumentGetRequest, opts ...grpc.CallOption) (*DocumentGetResponse, error) { - out := new(DocumentGetResponse) - err := c.cc.Invoke(ctx, "/nitric.proto.documents.v1.Documents/Get", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *documentsClient) Set(ctx context.Context, in *DocumentSetRequest, opts ...grpc.CallOption) (*DocumentSetResponse, error) { - out := new(DocumentSetResponse) - err := c.cc.Invoke(ctx, "/nitric.proto.documents.v1.Documents/Set", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *documentsClient) Delete(ctx context.Context, in *DocumentDeleteRequest, opts ...grpc.CallOption) (*DocumentDeleteResponse, error) { - out := new(DocumentDeleteResponse) - err := c.cc.Invoke(ctx, "/nitric.proto.documents.v1.Documents/Delete", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *documentsClient) Query(ctx context.Context, in *DocumentQueryRequest, opts ...grpc.CallOption) (*DocumentQueryResponse, error) { - out := new(DocumentQueryResponse) - err := c.cc.Invoke(ctx, "/nitric.proto.documents.v1.Documents/Query", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *documentsClient) QueryStream(ctx context.Context, in *DocumentQueryStreamRequest, opts ...grpc.CallOption) (Documents_QueryStreamClient, error) { - stream, err := c.cc.NewStream(ctx, &Documents_ServiceDesc.Streams[0], "/nitric.proto.documents.v1.Documents/QueryStream", opts...) - if err != nil { - return nil, err - } - x := &documentsQueryStreamClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Documents_QueryStreamClient interface { - Recv() (*DocumentQueryStreamResponse, error) - grpc.ClientStream -} - -type documentsQueryStreamClient struct { - grpc.ClientStream -} - -func (x *documentsQueryStreamClient) Recv() (*DocumentQueryStreamResponse, error) { - m := new(DocumentQueryStreamResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// DocumentsServer is the server API for Documents service. -// All implementations should embed UnimplementedDocumentsServer -// for forward compatibility -type DocumentsServer interface { - // Get an existing document - Get(context.Context, *DocumentGetRequest) (*DocumentGetResponse, error) - // Create a new or overwrite an existing document - Set(context.Context, *DocumentSetRequest) (*DocumentSetResponse, error) - // Delete an existing document - Delete(context.Context, *DocumentDeleteRequest) (*DocumentDeleteResponse, error) - // Query the document collection (supports pagination) - Query(context.Context, *DocumentQueryRequest) (*DocumentQueryResponse, error) - // Query the document collection (supports streaming) - QueryStream(*DocumentQueryStreamRequest, Documents_QueryStreamServer) error -} - -// UnimplementedDocumentsServer should be embedded to have forward compatible implementations. -type UnimplementedDocumentsServer struct { -} - -func (UnimplementedDocumentsServer) Get(context.Context, *DocumentGetRequest) (*DocumentGetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (UnimplementedDocumentsServer) Set(context.Context, *DocumentSetRequest) (*DocumentSetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Set not implemented") -} -func (UnimplementedDocumentsServer) Delete(context.Context, *DocumentDeleteRequest) (*DocumentDeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} -func (UnimplementedDocumentsServer) Query(context.Context, *DocumentQueryRequest) (*DocumentQueryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") -} -func (UnimplementedDocumentsServer) QueryStream(*DocumentQueryStreamRequest, Documents_QueryStreamServer) error { - return status.Errorf(codes.Unimplemented, "method QueryStream not implemented") -} - -// UnsafeDocumentsServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to DocumentsServer will -// result in compilation errors. -type UnsafeDocumentsServer interface { - mustEmbedUnimplementedDocumentsServer() -} - -func RegisterDocumentsServer(s grpc.ServiceRegistrar, srv DocumentsServer) { - s.RegisterService(&Documents_ServiceDesc, srv) -} - -func _Documents_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DocumentGetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DocumentsServer).Get(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nitric.proto.documents.v1.Documents/Get", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DocumentsServer).Get(ctx, req.(*DocumentGetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Documents_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DocumentSetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DocumentsServer).Set(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nitric.proto.documents.v1.Documents/Set", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DocumentsServer).Set(ctx, req.(*DocumentSetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Documents_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DocumentDeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DocumentsServer).Delete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nitric.proto.documents.v1.Documents/Delete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DocumentsServer).Delete(ctx, req.(*DocumentDeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Documents_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DocumentQueryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DocumentsServer).Query(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/nitric.proto.documents.v1.Documents/Query", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DocumentsServer).Query(ctx, req.(*DocumentQueryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Documents_QueryStream_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(DocumentQueryStreamRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(DocumentsServer).QueryStream(m, &documentsQueryStreamServer{stream}) -} - -type Documents_QueryStreamServer interface { - Send(*DocumentQueryStreamResponse) error - grpc.ServerStream -} - -type documentsQueryStreamServer struct { - grpc.ServerStream -} - -func (x *documentsQueryStreamServer) Send(m *DocumentQueryStreamResponse) error { - return x.ServerStream.SendMsg(m) -} - -// Documents_ServiceDesc is the grpc.ServiceDesc for Documents service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Documents_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "nitric.proto.documents.v1.Documents", - HandlerType: (*DocumentsServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Get", - Handler: _Documents_Get_Handler, - }, - { - MethodName: "Set", - Handler: _Documents_Set_Handler, - }, - { - MethodName: "Delete", - Handler: _Documents_Delete_Handler, - }, - { - MethodName: "Query", - Handler: _Documents_Query_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "QueryStream", - Handler: _Documents_QueryStream_Handler, - ServerStreams: true, - }, - }, - Metadata: "nitric/proto/documents/v1/documents.proto", -} diff --git a/core/pkg/proto/keyvalue/v1/keyvalue.pb.go b/core/pkg/proto/keyvalue/v1/keyvalue.pb.go new file mode 100644 index 000000000..82398742e --- /dev/null +++ b/core/pkg/proto/keyvalue/v1/keyvalue.pb.go @@ -0,0 +1,724 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.4 +// source: nitric/proto/keyvalue/v1/keyvalue.proto + +package KeyValuepb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Provides a Collection type for storing documents +type Store struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The store name + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Store) Reset() { + *x = Store{} + if protoimpl.UnsafeEnabled { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Store) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Store) ProtoMessage() {} + +func (x *Store) ProtoReflect() protoreflect.Message { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[0] + 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 Store.ProtoReflect.Descriptor instead. +func (*Store) Descriptor() ([]byte, []int) { + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{0} +} + +func (x *Store) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Provides a document identifying key type +type Key struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The item collection + Store string `protobuf:"bytes,1,opt,name=store,proto3" json:"store,omitempty"` + // The items unique key + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *Key) Reset() { + *x = Key{} + if protoimpl.UnsafeEnabled { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Key) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Key) ProtoMessage() {} + +func (x *Key) ProtoReflect() protoreflect.Message { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[1] + 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 Key.ProtoReflect.Descriptor instead. +func (*Key) Descriptor() ([]byte, []int) { + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{1} +} + +func (x *Key) GetStore() string { + if x != nil { + return x.Store + } + return "" +} + +func (x *Key) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +// Provides a return document type +type Value struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The document's unique key, including collection/sub-collections + Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The document content (JSON object) + Content *structpb.Struct `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *Value) Reset() { + *x = Value{} + if protoimpl.UnsafeEnabled { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Value) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Value) ProtoMessage() {} + +func (x *Value) ProtoReflect() protoreflect.Message { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[2] + 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 Value.ProtoReflect.Descriptor instead. +func (*Value) Descriptor() ([]byte, []int) { + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{2} +} + +func (x *Value) GetKey() *Key { + if x != nil { + return x.Key + } + return nil +} + +func (x *Value) GetContent() *structpb.Struct { + if x != nil { + return x.Content + } + return nil +} + +type KeyValueGetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Key of the document to retrieve + Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *KeyValueGetRequest) Reset() { + *x = KeyValueGetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyValueGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueGetRequest) ProtoMessage() {} + +func (x *KeyValueGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[3] + 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 KeyValueGetRequest.ProtoReflect.Descriptor instead. +func (*KeyValueGetRequest) Descriptor() ([]byte, []int) { + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{3} +} + +func (x *KeyValueGetRequest) GetKey() *Key { + if x != nil { + return x.Key + } + return nil +} + +type KeyValueGetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The retrieved value + Value *Value `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *KeyValueGetResponse) Reset() { + *x = KeyValueGetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyValueGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueGetResponse) ProtoMessage() {} + +func (x *KeyValueGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_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 KeyValueGetResponse.ProtoReflect.Descriptor instead. +func (*KeyValueGetResponse) Descriptor() ([]byte, []int) { + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{4} +} + +func (x *KeyValueGetResponse) GetValue() *Value { + if x != nil { + return x.Value + } + return nil +} + +type KeyValueSetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Key of the document to set + Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The document content to store (JSON object) + Content *structpb.Struct `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *KeyValueSetRequest) Reset() { + *x = KeyValueSetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyValueSetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueSetRequest) ProtoMessage() {} + +func (x *KeyValueSetRequest) ProtoReflect() protoreflect.Message { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_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 KeyValueSetRequest.ProtoReflect.Descriptor instead. +func (*KeyValueSetRequest) Descriptor() ([]byte, []int) { + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{5} +} + +func (x *KeyValueSetRequest) GetKey() *Key { + if x != nil { + return x.Key + } + return nil +} + +func (x *KeyValueSetRequest) GetContent() *structpb.Struct { + if x != nil { + return x.Content + } + return nil +} + +type KeyValueSetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *KeyValueSetResponse) Reset() { + *x = KeyValueSetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyValueSetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueSetResponse) ProtoMessage() {} + +func (x *KeyValueSetResponse) ProtoReflect() protoreflect.Message { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_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 KeyValueSetResponse.ProtoReflect.Descriptor instead. +func (*KeyValueSetResponse) Descriptor() ([]byte, []int) { + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{6} +} + +type KeyValueDeleteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Key of the document to delete + Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *KeyValueDeleteRequest) Reset() { + *x = KeyValueDeleteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyValueDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueDeleteRequest) ProtoMessage() {} + +func (x *KeyValueDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[7] + 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 KeyValueDeleteRequest.ProtoReflect.Descriptor instead. +func (*KeyValueDeleteRequest) Descriptor() ([]byte, []int) { + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{7} +} + +func (x *KeyValueDeleteRequest) GetKey() *Key { + if x != nil { + return x.Key + } + return nil +} + +type KeyValueDeleteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *KeyValueDeleteResponse) Reset() { + *x = KeyValueDeleteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyValueDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValueDeleteResponse) ProtoMessage() {} + +func (x *KeyValueDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[8] + 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 KeyValueDeleteResponse.ProtoReflect.Descriptor instead. +func (*KeyValueDeleteResponse) Descriptor() ([]byte, []int) { + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{8} +} + +var File_nitric_proto_keyvalue_v1_keyvalue_proto protoreflect.FileDescriptor + +var file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, + 0x65, 0x79, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x65, 0x79, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x6e, 0x69, 0x74, 0x72, 0x69, + 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x1b, 0x0a, 0x05, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2d, + 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x6b, 0x0a, + 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2f, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, + 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x45, 0x0a, 0x12, 0x4b, 0x65, + 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x2f, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, + 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x22, 0x4c, 0x0a, 0x13, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x78, 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, + 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x4b, 0x65, 0x79, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x48, 0x0a, 0x15, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x18, 0x0a, 0x16, 0x4b, 0x65, + 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xbf, 0x02, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x62, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x2c, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, + 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x2c, 0x2e, 0x6e, + 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6e, 0x69, 0x74, + 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x06, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x12, 0x2f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, + 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa3, 0x01, 0x0a, 0x1b, 0x69, 0x6f, 0x2e, 0x6e, 0x69, + 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6b, 0x65, 0x79, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, + 0x69, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, + 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x6b, 0x65, 0x79, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x4b, 0x65, 0x79, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x70, 0x62, 0xaa, 0x02, 0x18, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, + 0x31, 0xca, 0x02, 0x18, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x5c, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescOnce sync.Once + file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescData = file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDesc +) + +func file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP() []byte { + file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescOnce.Do(func() { + file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescData = protoimpl.X.CompressGZIP(file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescData) + }) + return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescData +} + +var file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_nitric_proto_keyvalue_v1_keyvalue_proto_goTypes = []interface{}{ + (*Store)(nil), // 0: nitric.proto.KeyValue.v1.Store + (*Key)(nil), // 1: nitric.proto.KeyValue.v1.Key + (*Value)(nil), // 2: nitric.proto.KeyValue.v1.Value + (*KeyValueGetRequest)(nil), // 3: nitric.proto.KeyValue.v1.KeyValueGetRequest + (*KeyValueGetResponse)(nil), // 4: nitric.proto.KeyValue.v1.KeyValueGetResponse + (*KeyValueSetRequest)(nil), // 5: nitric.proto.KeyValue.v1.KeyValueSetRequest + (*KeyValueSetResponse)(nil), // 6: nitric.proto.KeyValue.v1.KeyValueSetResponse + (*KeyValueDeleteRequest)(nil), // 7: nitric.proto.KeyValue.v1.KeyValueDeleteRequest + (*KeyValueDeleteResponse)(nil), // 8: nitric.proto.KeyValue.v1.KeyValueDeleteResponse + (*structpb.Struct)(nil), // 9: google.protobuf.Struct +} +var file_nitric_proto_keyvalue_v1_keyvalue_proto_depIdxs = []int32{ + 1, // 0: nitric.proto.KeyValue.v1.Value.key:type_name -> nitric.proto.KeyValue.v1.Key + 9, // 1: nitric.proto.KeyValue.v1.Value.content:type_name -> google.protobuf.Struct + 1, // 2: nitric.proto.KeyValue.v1.KeyValueGetRequest.key:type_name -> nitric.proto.KeyValue.v1.Key + 2, // 3: nitric.proto.KeyValue.v1.KeyValueGetResponse.value:type_name -> nitric.proto.KeyValue.v1.Value + 1, // 4: nitric.proto.KeyValue.v1.KeyValueSetRequest.key:type_name -> nitric.proto.KeyValue.v1.Key + 9, // 5: nitric.proto.KeyValue.v1.KeyValueSetRequest.content:type_name -> google.protobuf.Struct + 1, // 6: nitric.proto.KeyValue.v1.KeyValueDeleteRequest.key:type_name -> nitric.proto.KeyValue.v1.Key + 3, // 7: nitric.proto.KeyValue.v1.KeyValue.Get:input_type -> nitric.proto.KeyValue.v1.KeyValueGetRequest + 5, // 8: nitric.proto.KeyValue.v1.KeyValue.Set:input_type -> nitric.proto.KeyValue.v1.KeyValueSetRequest + 7, // 9: nitric.proto.KeyValue.v1.KeyValue.Delete:input_type -> nitric.proto.KeyValue.v1.KeyValueDeleteRequest + 4, // 10: nitric.proto.KeyValue.v1.KeyValue.Get:output_type -> nitric.proto.KeyValue.v1.KeyValueGetResponse + 6, // 11: nitric.proto.KeyValue.v1.KeyValue.Set:output_type -> nitric.proto.KeyValue.v1.KeyValueSetResponse + 8, // 12: nitric.proto.KeyValue.v1.KeyValue.Delete:output_type -> nitric.proto.KeyValue.v1.KeyValueDeleteResponse + 10, // [10:13] is the sub-list for method output_type + 7, // [7:10] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_nitric_proto_keyvalue_v1_keyvalue_proto_init() } +func file_nitric_proto_keyvalue_v1_keyvalue_proto_init() { + if File_nitric_proto_keyvalue_v1_keyvalue_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Store); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Key); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Value); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyValueGetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyValueGetResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyValueSetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyValueSetResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyValueDeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyValueDeleteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_nitric_proto_keyvalue_v1_keyvalue_proto_goTypes, + DependencyIndexes: file_nitric_proto_keyvalue_v1_keyvalue_proto_depIdxs, + MessageInfos: file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes, + }.Build() + File_nitric_proto_keyvalue_v1_keyvalue_proto = out.File + file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDesc = nil + file_nitric_proto_keyvalue_v1_keyvalue_proto_goTypes = nil + file_nitric_proto_keyvalue_v1_keyvalue_proto_depIdxs = nil +} diff --git a/core/pkg/proto/keyvalue/v1/keyvalue_grpc.pb.go b/core/pkg/proto/keyvalue/v1/keyvalue_grpc.pb.go new file mode 100644 index 000000000..c06006efb --- /dev/null +++ b/core/pkg/proto/keyvalue/v1/keyvalue_grpc.pb.go @@ -0,0 +1,181 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.4 +// source: nitric/proto/keyvalue/v1/keyvalue.proto + +package KeyValuepb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// KeyValueClient is the client API for KeyValue service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type KeyValueClient interface { + // Get an existing document + Get(ctx context.Context, in *KeyValueGetRequest, opts ...grpc.CallOption) (*KeyValueGetResponse, error) + // Create a new or overwrite an existing document + Set(ctx context.Context, in *KeyValueSetRequest, opts ...grpc.CallOption) (*KeyValueSetResponse, error) + // Delete an existing document + Delete(ctx context.Context, in *KeyValueDeleteRequest, opts ...grpc.CallOption) (*KeyValueDeleteResponse, error) +} + +type keyValueClient struct { + cc grpc.ClientConnInterface +} + +func NewKeyValueClient(cc grpc.ClientConnInterface) KeyValueClient { + return &keyValueClient{cc} +} + +func (c *keyValueClient) Get(ctx context.Context, in *KeyValueGetRequest, opts ...grpc.CallOption) (*KeyValueGetResponse, error) { + out := new(KeyValueGetResponse) + err := c.cc.Invoke(ctx, "/nitric.proto.KeyValue.v1.KeyValue/Get", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keyValueClient) Set(ctx context.Context, in *KeyValueSetRequest, opts ...grpc.CallOption) (*KeyValueSetResponse, error) { + out := new(KeyValueSetResponse) + err := c.cc.Invoke(ctx, "/nitric.proto.KeyValue.v1.KeyValue/Set", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keyValueClient) Delete(ctx context.Context, in *KeyValueDeleteRequest, opts ...grpc.CallOption) (*KeyValueDeleteResponse, error) { + out := new(KeyValueDeleteResponse) + err := c.cc.Invoke(ctx, "/nitric.proto.KeyValue.v1.KeyValue/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// KeyValueServer is the server API for KeyValue service. +// All implementations should embed UnimplementedKeyValueServer +// for forward compatibility +type KeyValueServer interface { + // Get an existing document + Get(context.Context, *KeyValueGetRequest) (*KeyValueGetResponse, error) + // Create a new or overwrite an existing document + Set(context.Context, *KeyValueSetRequest) (*KeyValueSetResponse, error) + // Delete an existing document + Delete(context.Context, *KeyValueDeleteRequest) (*KeyValueDeleteResponse, error) +} + +// UnimplementedKeyValueServer should be embedded to have forward compatible implementations. +type UnimplementedKeyValueServer struct { +} + +func (UnimplementedKeyValueServer) Get(context.Context, *KeyValueGetRequest) (*KeyValueGetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedKeyValueServer) Set(context.Context, *KeyValueSetRequest) (*KeyValueSetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Set not implemented") +} +func (UnimplementedKeyValueServer) Delete(context.Context, *KeyValueDeleteRequest) (*KeyValueDeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} + +// UnsafeKeyValueServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to KeyValueServer will +// result in compilation errors. +type UnsafeKeyValueServer interface { + mustEmbedUnimplementedKeyValueServer() +} + +func RegisterKeyValueServer(s grpc.ServiceRegistrar, srv KeyValueServer) { + s.RegisterService(&KeyValue_ServiceDesc, srv) +} + +func _KeyValue_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KeyValueGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyValueServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nitric.proto.KeyValue.v1.KeyValue/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyValueServer).Get(ctx, req.(*KeyValueGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KeyValue_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KeyValueSetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyValueServer).Set(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nitric.proto.KeyValue.v1.KeyValue/Set", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyValueServer).Set(ctx, req.(*KeyValueSetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KeyValue_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KeyValueDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyValueServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nitric.proto.KeyValue.v1.KeyValue/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyValueServer).Delete(ctx, req.(*KeyValueDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// KeyValue_ServiceDesc is the grpc.ServiceDesc for KeyValue service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var KeyValue_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "nitric.proto.KeyValue.v1.KeyValue", + HandlerType: (*KeyValueServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Get", + Handler: _KeyValue_Get_Handler, + }, + { + MethodName: "Set", + Handler: _KeyValue_Set_Handler, + }, + { + MethodName: "Delete", + Handler: _KeyValue_Delete_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nitric/proto/keyvalue/v1/keyvalue.proto", +} diff --git a/core/pkg/proto/resources/v1/resources.pb.go b/core/pkg/proto/resources/v1/resources.pb.go index 94809352e..685dc57a8 100644 --- a/core/pkg/proto/resources/v1/resources.pb.go +++ b/core/pkg/proto/resources/v1/resources.pb.go @@ -29,7 +29,7 @@ const ( ResourceType_Topic ResourceType = 3 ResourceType_Schedule ResourceType = 4 ResourceType_Subscription ResourceType = 5 - ResourceType_Collection ResourceType = 6 + ResourceType_KeyValueStore ResourceType = 6 ResourceType_Policy ResourceType = 7 ResourceType_Secret ResourceType = 8 ResourceType_BucketListener ResourceType = 9 @@ -47,7 +47,7 @@ var ( 3: "Topic", 4: "Schedule", 5: "Subscription", - 6: "Collection", + 6: "KeyValueStore", 7: "Policy", 8: "Secret", 9: "BucketListener", @@ -62,7 +62,7 @@ var ( "Topic": 3, "Schedule": 4, "Subscription": 5, - "Collection": 6, + "KeyValueStore": 6, "Policy": 7, "Secret": 8, "BucketListener": 9, @@ -112,11 +112,9 @@ const ( Action_TopicDetail Action = 201 Action_TopicEventPublish Action = 202 // Collection Permissions: 3XX - Action_CollectionDocumentRead Action = 300 - Action_CollectionDocumentWrite Action = 301 - Action_CollectionDocumentDelete Action = 302 - Action_CollectionQuery Action = 303 - Action_CollectionList Action = 304 + Action_KeyValueStoreRead Action = 300 + Action_KeyValueStoreWrite Action = 301 + Action_KeyValueStoreDelete Action = 302 // Secret Permissions: 5XX Action_SecretPut Action = 400 Action_SecretAccess Action = 401 @@ -134,31 +132,27 @@ var ( 200: "TopicList", 201: "TopicDetail", 202: "TopicEventPublish", - 300: "CollectionDocumentRead", - 301: "CollectionDocumentWrite", - 302: "CollectionDocumentDelete", - 303: "CollectionQuery", - 304: "CollectionList", + 300: "KeyValueStoreRead", + 301: "KeyValueStoreWrite", + 302: "KeyValueStoreDelete", 400: "SecretPut", 401: "SecretAccess", 500: "WebsocketManage", } Action_value = map[string]int32{ - "BucketFileList": 0, - "BucketFileGet": 1, - "BucketFilePut": 2, - "BucketFileDelete": 3, - "TopicList": 200, - "TopicDetail": 201, - "TopicEventPublish": 202, - "CollectionDocumentRead": 300, - "CollectionDocumentWrite": 301, - "CollectionDocumentDelete": 302, - "CollectionQuery": 303, - "CollectionList": 304, - "SecretPut": 400, - "SecretAccess": 401, - "WebsocketManage": 500, + "BucketFileList": 0, + "BucketFileGet": 1, + "BucketFilePut": 2, + "BucketFileDelete": 3, + "TopicList": 200, + "TopicDetail": 201, + "TopicEventPublish": 202, + "KeyValueStoreRead": 300, + "KeyValueStoreWrite": 301, + "KeyValueStoreDelete": 302, + "SecretPut": 400, + "SecretAccess": 401, + "WebsocketManage": 500, } ) @@ -319,7 +313,7 @@ type ResourceDeclareRequest struct { // *ResourceDeclareRequest_Policy // *ResourceDeclareRequest_Bucket // *ResourceDeclareRequest_Topic - // *ResourceDeclareRequest_Collection + // *ResourceDeclareRequest_KeyValueStore // *ResourceDeclareRequest_Secret // *ResourceDeclareRequest_Api // *ResourceDeclareRequest_ApiSecurityDefinition @@ -393,9 +387,9 @@ func (x *ResourceDeclareRequest) GetTopic() *TopicResource { return nil } -func (x *ResourceDeclareRequest) GetCollection() *CollectionResource { - if x, ok := x.GetConfig().(*ResourceDeclareRequest_Collection); ok { - return x.Collection +func (x *ResourceDeclareRequest) GetKeyValueStore() *KeyValueStoreResource { + if x, ok := x.GetConfig().(*ResourceDeclareRequest_KeyValueStore); ok { + return x.KeyValueStore } return nil } @@ -437,8 +431,8 @@ type ResourceDeclareRequest_Topic struct { Topic *TopicResource `protobuf:"bytes,12,opt,name=topic,proto3,oneof"` } -type ResourceDeclareRequest_Collection struct { - Collection *CollectionResource `protobuf:"bytes,13,opt,name=collection,proto3,oneof"` +type ResourceDeclareRequest_KeyValueStore struct { + KeyValueStore *KeyValueStoreResource `protobuf:"bytes,13,opt,name=key_value_store,json=keyValueStore,proto3,oneof"` } type ResourceDeclareRequest_Secret struct { @@ -459,7 +453,7 @@ func (*ResourceDeclareRequest_Bucket) isResourceDeclareRequest_Config() {} func (*ResourceDeclareRequest_Topic) isResourceDeclareRequest_Config() {} -func (*ResourceDeclareRequest_Collection) isResourceDeclareRequest_Config() {} +func (*ResourceDeclareRequest_KeyValueStore) isResourceDeclareRequest_Config() {} func (*ResourceDeclareRequest_Secret) isResourceDeclareRequest_Config() {} @@ -543,14 +537,14 @@ func (*TopicResource) Descriptor() ([]byte, []int) { return file_nitric_proto_resources_v1_resources_proto_rawDescGZIP(), []int{4} } -type CollectionResource struct { +type KeyValueStoreResource struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *CollectionResource) Reset() { - *x = CollectionResource{} +func (x *KeyValueStoreResource) Reset() { + *x = KeyValueStoreResource{} if protoimpl.UnsafeEnabled { mi := &file_nitric_proto_resources_v1_resources_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -558,13 +552,13 @@ func (x *CollectionResource) Reset() { } } -func (x *CollectionResource) String() string { +func (x *KeyValueStoreResource) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CollectionResource) ProtoMessage() {} +func (*KeyValueStoreResource) ProtoMessage() {} -func (x *CollectionResource) ProtoReflect() protoreflect.Message { +func (x *KeyValueStoreResource) ProtoReflect() protoreflect.Message { mi := &file_nitric_proto_resources_v1_resources_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -576,8 +570,8 @@ func (x *CollectionResource) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CollectionResource.ProtoReflect.Descriptor instead. -func (*CollectionResource) Descriptor() ([]byte, []int) { +// Deprecated: Use KeyValueStoreResource.ProtoReflect.Descriptor instead. +func (*KeyValueStoreResource) Descriptor() ([]byte, []int) { return file_nitric_proto_resources_v1_resources_proto_rawDescGZIP(), []int{5} } @@ -911,7 +905,7 @@ var file_nitric_proto_resources_v1_resources_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xf3, 0x04, 0x0a, 0x16, 0x52, 0x65, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xfe, 0x04, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, @@ -930,117 +924,114 @@ var file_nitric_proto_resources_v1_resources_proto_rawDesc = []byte{ 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, - 0x4f, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0d, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x43, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x63, - 0x72, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x06, 0x73, - 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x3a, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, - 0x70, 0x69, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x03, 0x61, 0x70, - 0x69, 0x12, 0x72, 0x0a, 0x17, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, - 0x79, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, - 0x70, 0x69, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x15, - 0x61, 0x70, 0x69, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, - 0x10, 0x0a, 0x0e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x65, 0x63, 0x72, - 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x55, 0x0a, 0x1d, 0x41, 0x70, - 0x69, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x69, - 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, - 0x75, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, - 0x73, 0x22, 0x98, 0x01, 0x0a, 0x1d, 0x41, 0x70, 0x69, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, - 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x70, 0x69, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x69, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x4e, - 0x0a, 0x04, 0x6f, 0x69, 0x64, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6e, - 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, 0x69, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x64, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x69, - 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x6f, 0x69, 0x64, 0x63, 0x42, 0x0c, - 0x0a, 0x0a, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x23, 0x0a, 0x09, - 0x41, 0x70, 0x69, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, - 0x73, 0x22, 0xc2, 0x01, 0x0a, 0x0b, 0x41, 0x70, 0x69, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x12, 0x50, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x41, 0x70, 0x69, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x63, 0x75, - 0x72, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x1a, 0x61, 0x0a, 0x0d, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x41, 0x70, 0x69, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x19, 0x0a, 0x17, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2a, 0xcb, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x70, 0x69, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x42, 0x75, 0x63, 0x6b, - 0x65, 0x74, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x10, 0x03, 0x12, - 0x0c, 0x0a, 0x08, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x10, 0x04, 0x12, 0x10, 0x0a, - 0x0c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x05, 0x12, - 0x0e, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x06, 0x12, - 0x0a, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x10, 0x07, 0x12, 0x0a, 0x0a, 0x06, 0x53, - 0x65, 0x63, 0x72, 0x65, 0x74, 0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x75, 0x63, 0x6b, 0x65, - 0x74, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x10, 0x09, 0x12, 0x0d, 0x0a, 0x09, 0x57, - 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x10, 0x0a, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x74, - 0x74, 0x70, 0x10, 0x0b, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x70, 0x69, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x0c, 0x2a, - 0xd0, 0x02, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x75, - 0x63, 0x6b, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x00, 0x12, 0x11, - 0x0a, 0x0d, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x74, 0x10, - 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x50, - 0x75, 0x74, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x46, 0x69, - 0x6c, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x09, 0x54, 0x6f, - 0x70, 0x69, 0x63, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xc8, 0x01, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x6f, - 0x70, 0x69, 0x63, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x10, 0xc9, 0x01, 0x12, 0x16, 0x0a, 0x11, - 0x54, 0x6f, 0x70, 0x69, 0x63, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, - 0x68, 0x10, 0xca, 0x01, 0x12, 0x1b, 0x0a, 0x16, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, 0x64, 0x10, 0xac, - 0x02, 0x12, 0x1c, 0x0a, 0x17, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x57, 0x72, 0x69, 0x74, 0x65, 0x10, 0xad, 0x02, 0x12, - 0x1d, 0x0a, 0x18, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0xae, 0x02, 0x12, 0x14, - 0x0a, 0x0f, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x10, 0xaf, 0x02, 0x12, 0x13, 0x0a, 0x0e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xb0, 0x02, 0x12, 0x0e, 0x0a, 0x09, 0x53, 0x65, 0x63, - 0x72, 0x65, 0x74, 0x50, 0x75, 0x74, 0x10, 0x90, 0x03, 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x65, 0x63, - 0x72, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x91, 0x03, 0x12, 0x14, 0x0a, 0x0f, - 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x10, - 0xf4, 0x03, 0x32, 0x7d, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, - 0x70, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x12, 0x31, 0x2e, 0x6e, 0x69, 0x74, + 0x5a, 0x0a, 0x0f, 0x6b, 0x65, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, + 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x74, 0x6f, + 0x72, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6b, 0x65, + 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x43, 0x0a, 0x06, 0x73, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x69, + 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, + 0x12, 0x3a, 0x0a, 0x03, 0x61, 0x70, 0x69, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, 0x69, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x03, 0x61, 0x70, 0x69, 0x12, 0x72, 0x0a, 0x17, + 0x61, 0x70, 0x69, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x66, + 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, + 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, 0x69, 0x53, 0x65, 0x63, + 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x15, 0x61, 0x70, 0x69, 0x53, 0x65, + 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x42, 0x08, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x10, 0x0a, 0x0e, 0x42, 0x75, + 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x0f, 0x0a, 0x0d, + 0x54, 0x6f, 0x70, 0x69, 0x63, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x17, 0x0a, + 0x15, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x55, 0x0a, 0x1d, 0x41, 0x70, 0x69, 0x4f, + 0x70, 0x65, 0x6e, 0x49, 0x64, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, + 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, + 0x75, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, + 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x22, + 0x98, 0x01, 0x0a, 0x1d, 0x41, 0x70, 0x69, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, + 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x70, 0x69, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x69, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x4e, 0x0a, 0x04, + 0x6f, 0x69, 0x64, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, - 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, 0x69, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x6f, 0x69, 0x64, 0x63, 0x42, 0x0c, 0x0a, 0x0a, + 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x23, 0x0a, 0x09, 0x41, 0x70, + 0x69, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x22, + 0xc2, 0x01, 0x0a, 0x0b, 0x41, 0x70, 0x69, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, + 0x50, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x34, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x70, + 0x69, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, + 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, + 0x79, 0x1a, 0x61, 0x0a, 0x0d, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x41, 0x70, 0x69, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0x19, 0x0a, 0x17, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, + 0xce, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x07, 0x0a, 0x03, 0x41, 0x70, 0x69, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, + 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x10, 0x03, 0x12, 0x0c, 0x0a, + 0x08, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x05, 0x12, 0x11, 0x0a, + 0x0d, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x10, 0x06, + 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x10, 0x07, 0x12, 0x0a, 0x0a, 0x06, + 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x75, 0x63, 0x6b, + 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x10, 0x09, 0x12, 0x0d, 0x0a, 0x09, + 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x10, 0x0a, 0x12, 0x08, 0x0a, 0x04, 0x48, + 0x74, 0x74, 0x70, 0x10, 0x0b, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x70, 0x69, 0x53, 0x65, 0x63, 0x75, + 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x0c, + 0x2a, 0x96, 0x02, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x0e, 0x42, + 0x75, 0x63, 0x6b, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x00, 0x12, + 0x11, 0x0a, 0x0d, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x74, + 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, + 0x50, 0x75, 0x74, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x46, + 0x69, 0x6c, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x09, 0x54, + 0x6f, 0x70, 0x69, 0x63, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xc8, 0x01, 0x12, 0x10, 0x0a, 0x0b, 0x54, + 0x6f, 0x70, 0x69, 0x63, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x10, 0xc9, 0x01, 0x12, 0x16, 0x0a, + 0x11, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, + 0x73, 0x68, 0x10, 0xca, 0x01, 0x12, 0x16, 0x0a, 0x11, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x61, 0x64, 0x10, 0xac, 0x02, 0x12, 0x17, 0x0a, + 0x12, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x10, 0xad, 0x02, 0x12, 0x18, 0x0a, 0x13, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0xae, 0x02, + 0x12, 0x0e, 0x0a, 0x09, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x50, 0x75, 0x74, 0x10, 0x90, 0x03, + 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x10, 0x91, 0x03, 0x12, 0x14, 0x0a, 0x0f, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, + 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x10, 0xf4, 0x03, 0x32, 0x7d, 0x0a, 0x09, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x70, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, + 0x65, 0x12, 0x31, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa9, 0x01, 0x0a, 0x1c, 0x69, 0x6f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0xa9, 0x01, 0x0a, 0x1c, 0x69, 0x6f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x42, 0x09, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x50, 0x01, 0x5a, - 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x69, 0x74, 0x72, - 0x69, 0x63, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2f, 0x63, 0x6f, - 0x72, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x70, 0x62, 0xaa, 0x02, 0x19, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, - 0x31, 0xca, 0x02, 0x19, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x5c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x50, 0x01, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x6e, 0x69, + 0x74, 0x72, 0x69, 0x63, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x76, 0x31, + 0x3b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x70, 0x62, 0xaa, 0x02, 0x19, 0x4e, + 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0xca, 0x02, 0x19, 0x4e, 0x69, 0x74, 0x72, 0x69, + 0x63, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x5c, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1065,7 +1056,7 @@ var file_nitric_proto_resources_v1_resources_proto_goTypes = []interface{}{ (*ResourceDeclareRequest)(nil), // 4: nitric.proto.resources.v1.ResourceDeclareRequest (*BucketResource)(nil), // 5: nitric.proto.resources.v1.BucketResource (*TopicResource)(nil), // 6: nitric.proto.resources.v1.TopicResource - (*CollectionResource)(nil), // 7: nitric.proto.resources.v1.CollectionResource + (*KeyValueStoreResource)(nil), // 7: nitric.proto.resources.v1.KeyValueStoreResource (*SecretResource)(nil), // 8: nitric.proto.resources.v1.SecretResource (*ApiOpenIdConnectionDefinition)(nil), // 9: nitric.proto.resources.v1.ApiOpenIdConnectionDefinition (*ApiSecurityDefinitionResource)(nil), // 10: nitric.proto.resources.v1.ApiSecurityDefinitionResource @@ -1083,7 +1074,7 @@ var file_nitric_proto_resources_v1_resources_proto_depIdxs = []int32{ 2, // 5: nitric.proto.resources.v1.ResourceDeclareRequest.policy:type_name -> nitric.proto.resources.v1.PolicyResource 5, // 6: nitric.proto.resources.v1.ResourceDeclareRequest.bucket:type_name -> nitric.proto.resources.v1.BucketResource 6, // 7: nitric.proto.resources.v1.ResourceDeclareRequest.topic:type_name -> nitric.proto.resources.v1.TopicResource - 7, // 8: nitric.proto.resources.v1.ResourceDeclareRequest.collection:type_name -> nitric.proto.resources.v1.CollectionResource + 7, // 8: nitric.proto.resources.v1.ResourceDeclareRequest.key_value_store:type_name -> nitric.proto.resources.v1.KeyValueStoreResource 8, // 9: nitric.proto.resources.v1.ResourceDeclareRequest.secret:type_name -> nitric.proto.resources.v1.SecretResource 12, // 10: nitric.proto.resources.v1.ResourceDeclareRequest.api:type_name -> nitric.proto.resources.v1.ApiResource 10, // 11: nitric.proto.resources.v1.ResourceDeclareRequest.api_security_definition:type_name -> nitric.proto.resources.v1.ApiSecurityDefinitionResource @@ -1166,7 +1157,7 @@ func file_nitric_proto_resources_v1_resources_proto_init() { } } file_nitric_proto_resources_v1_resources_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CollectionResource); i { + switch v := v.(*KeyValueStoreResource); i { case 0: return &v.state case 1: @@ -1254,7 +1245,7 @@ func file_nitric_proto_resources_v1_resources_proto_init() { (*ResourceDeclareRequest_Policy)(nil), (*ResourceDeclareRequest_Bucket)(nil), (*ResourceDeclareRequest_Topic)(nil), - (*ResourceDeclareRequest_Collection)(nil), + (*ResourceDeclareRequest_KeyValueStore)(nil), (*ResourceDeclareRequest_Secret)(nil), (*ResourceDeclareRequest_Api)(nil), (*ResourceDeclareRequest_ApiSecurityDefinition)(nil), diff --git a/e2e/Makefile b/e2e/Makefile deleted file mode 100644 index 1844f8080..000000000 --- a/e2e/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -test-integration: test-integration-document - -test-integration-document: - @echo Running document integration tests - @go run github.com/onsi/ginkgo/ginkgo ./document/... \ No newline at end of file diff --git a/e2e/docker.go b/e2e/docker.go deleted file mode 100644 index c9c405417..000000000 --- a/e2e/docker.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "fmt" - "os" - "os/exec" - "strings" - "syscall" -) - -const shell = "/bin/sh" - -func StartContainer(containerName string, args []string) { - cmd := exec.Command(shell, "-c", strings.Join(args[:], " ")) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - fmt.Printf("Error running %s Image %v : %v \n", containerName, cmd, err) - panic(fmt.Sprintf("Error running %s Image %v : %v", containerName, cmd, err)) - } - - // Makes process killable - cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} -} - -func StopContainer(containerName string) { - // clean up - stopArgs := []string{ - "docker", - "container", - "stop", - containerName, - } - - stopCmd := exec.Command(shell, "-c", strings.Join(stopArgs[:], " ")) - - if err := stopCmd.Run(); err != nil { - fmt.Printf("Error stopping %s container %v : %v \n", containerName, stopCmd, err) - panic(fmt.Sprintf("Error stopping Firestore container %v : %v", stopCmd, err)) - } - - removeArgs := []string{ - "docker", - "container", - "rm", - containerName, - } - - removeCmd := exec.Command(shell, "-c", strings.Join(removeArgs[:], " ")) - - if err := removeCmd.Run(); err != nil { - fmt.Printf("Error removing %s container %v : %v \n", containerName, removeCmd, err) - panic(fmt.Sprintf("Error removing Firestore container %v : %v", removeCmd, err)) - } -} diff --git a/e2e/document/delete.go b/e2e/document/delete.go deleted file mode 100644 index facb9d5be..000000000 --- a/e2e/document/delete.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document_suite - -import ( - "context" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/nitrictech/nitric/core/pkg/plugins/document" -) - -func DeleteTests(docPlugin document.DocumentService) { - Context("Delete", func() { - When("Blank key.Collection.Name", func() { - It("Should return error", func() { - key := document.Key{Id: "1"} - err := docPlugin.Delete(context.TODO(), &key) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Blank key.Id", func() { - It("Should return error", func() { - key := document.Key{Collection: &document.Collection{Name: "users"}} - err := docPlugin.Delete(context.TODO(), &key) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Valid Delete", func() { - It("Should delete item successfully", func() { - err := docPlugin.Set(context.TODO(), &UserKey1, UserItem1) - Expect(err).ShouldNot(HaveOccurred()) - - err = docPlugin.Delete(context.TODO(), &UserKey1) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err := docPlugin.Get(context.TODO(), &UserKey1) - Expect(doc).To(BeNil()) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Valid Sub Collection Delete", func() { - It("Should delete item successfully", func() { - err := docPlugin.Set(context.TODO(), &Customer1.Orders[0].Key, Customer1.Orders[0].Content) - Expect(err).ShouldNot(HaveOccurred()) - - err = docPlugin.Delete(context.TODO(), &Customer1.Orders[0].Key) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err := docPlugin.Get(context.TODO(), &Customer1.Orders[0].Key) - Expect(doc).To(BeNil()) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Valid Parent and Sub Collection Delete", func() { - It("Should delete all children", func() { - LoadCustomersData(docPlugin) - - col := document.Collection{ - Name: "orders", - Parent: &document.Key{ - Collection: &document.Collection{ - Name: "customers", - }, - }, - } - - result, err := docPlugin.Query(context.TODO(), &col, []document.QueryExpression{}, 0, nil) - Expect(err).To(BeNil()) - Expect(result.Documents).To(HaveLen(5)) - - err = docPlugin.Delete(context.TODO(), &Customer1.Key) - Expect(err).ShouldNot(HaveOccurred()) - - err = docPlugin.Delete(context.TODO(), &Customer2.Key) - Expect(err).ShouldNot(HaveOccurred()) - - result, err = docPlugin.Query(context.TODO(), &col, []document.QueryExpression{}, 0, nil) - Expect(err).To(BeNil()) - Expect(result.Documents).To(HaveLen(0)) - }) - }) - }) -} diff --git a/e2e/document/dynamodb/dynamodb_suite_test.go b/e2e/document/dynamodb/dynamodb_suite_test.go deleted file mode 100644 index 8961b2735..000000000 --- a/e2e/document/dynamodb/dynamodb_suite_test.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package dynamodb_service_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestDynamoDb(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "DynamoDB Document Suite") -} diff --git a/e2e/document/dynamodb/dynamodb_test.go b/e2e/document/dynamodb/dynamodb_test.go deleted file mode 100644 index c53d2a847..000000000 --- a/e2e/document/dynamodb/dynamodb_test.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package dynamodb_service_test - -import ( - "context" - "fmt" - "os" - "time" - - "github.com/golang/mock/gomock" - . "github.com/onsi/ginkgo" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/config" - "github.com/aws/aws-sdk-go-v2/service/dynamodb" - "github.com/aws/aws-sdk-go-v2/service/dynamodb/types" - - mock_provider "github.com/nitrictech/nitric/cloud/aws/mocks/provider" - "github.com/nitrictech/nitric/cloud/aws/runtime/core" - dynamodb_service "github.com/nitrictech/nitric/cloud/aws/runtime/documents" - "github.com/nitrictech/nitric/e2e" - test "github.com/nitrictech/nitric/e2e/document" -) - -const ( - containerName = "dynamodb-nitric" - port = "8000" -) - -var _ = Describe("DynamoDb", func() { - defer GinkgoRecover() - - os.Setenv("NITRIC_STACK_ID", "test-stack") - os.Setenv("AWS_ACCESS_KEY_ID", "fakeMyKeyId") - os.Setenv("AWS_SECRET_ACCESS_KEY", "fakeSecretAccessKey") - os.Setenv("AWS_REGION", "X") - - // Start Local DynamoDB - // Run dynamodb container - args := []string{ - "docker", - "run", - "-d", - "-p " + port + ":" + port, - "--name " + containerName, - "amazon/dynamodb-local:latest", - } - e2e.StartContainer(containerName, args) - - // // Create DynamoDB client - db := createDynamoClient() - - testConnection(db) - - BeforeEach(func() { - // Table names suffixed with 7 alphanumeric chars to match pulumi deployment. - createTable(db, "customers-1111111", "test-stack") - createTable(db, "users-1111111", "test-stack") - createTable(db, "items-1111111", "test-stack") - createTable(db, "parentItems-1111111", "test-stack") - }) - - AfterEach(func() { - deleteTable(db, "customers-1111111") - deleteTable(db, "users-1111111") - deleteTable(db, "items-1111111") - deleteTable(db, "parentItems-1111111") - }) - - AfterSuite(func() { - e2e.StopContainer(containerName) - }) - - ctrl := gomock.NewController(GinkgoT()) - provider := mock_provider.NewMockAwsProvider(ctrl) - - provider.EXPECT().GetResources(gomock.Any(), core.AwsResource_Collection).AnyTimes().Return(map[string]string{ - "customers": "arn:${Partition}:dynamodb:${Region}:${Account}:table/customers-1111111", - "users": "arn:${Partition}:dynamodb:${Region}:${Account}:table/users-1111111", - "items": "arn:${Partition}:dynamodb:${Region}:${Account}:table/items-1111111", - "parentItems": "arn:${Partition}:dynamodb:${Region}:${Account}:table/parentItems-1111111", - }, nil) - - docPlugin, err := dynamodb_service.NewWithClient(provider, db) - if err != nil { - panic(err) - } - - test.GetTests(docPlugin) - test.SetTests(docPlugin) - test.DeleteTests(docPlugin) - test.QueryTests(docPlugin) - test.QueryStreamTests(docPlugin) -}) - -func createDynamoClient() *dynamodb.Client { - cfg, sessionError := config.LoadDefaultConfig(context.TODO(), - config.WithRegion("x"), - config.WithEndpointResolverWithOptions(aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) { - return aws.Endpoint{URL: "http://localhost:8000"}, nil - })), - ) - if sessionError != nil { - return nil - } - - return dynamodb.NewFromConfig(cfg) -} - -func testConnection(db *dynamodb.Client) { - input := &dynamodb.ListTablesInput{} - - if _, err := db.ListTables(context.TODO(), input); err != nil { - // Wait for Java DynamoDB process to get started - time.Sleep(2 * time.Second) - - if _, err := db.ListTables(context.TODO(), input); err != nil { - time.Sleep(4 * time.Second) - - if _, err := db.ListTables(context.TODO(), input); err != nil { - fmt.Printf("DynamoDB connection error: %v \n", err) - panic(err) - } - } else { - return - } - } -} - -func createTable(db *dynamodb.Client, tableName string, stackID string) { - input := &dynamodb.CreateTableInput{ - AttributeDefinitions: []types.AttributeDefinition{ - { - AttributeName: aws.String("_pk"), - AttributeType: "S", - }, - { - AttributeName: aws.String("_sk"), - AttributeType: "S", - }, - }, - KeySchema: []types.KeySchemaElement{ - { - AttributeName: aws.String("_pk"), - KeyType: types.KeyTypeHash, - }, - { - AttributeName: aws.String("_sk"), - KeyType: types.KeyTypeRange, - }, - }, - ProvisionedThroughput: &types.ProvisionedThroughput{ - ReadCapacityUnits: aws.Int64(10), - WriteCapacityUnits: aws.Int64(10), - }, - TableName: aws.String(tableName), - Tags: []types.Tag{ - { - Key: aws.String(fmt.Sprintf("x-nitric-%s-name", stackID)), - Value: aws.String(tableName), - }, - { - Key: aws.String(fmt.Sprintf("x-nitric-%s-type", "collection")), - Value: aws.String(tableName), - }, - }, - } - _, err := db.CreateTable(context.TODO(), input) - if err != nil { - panic(fmt.Sprintf("Error calling CreateTable: %s", err)) - } -} - -func deleteTable(db *dynamodb.Client, tableName string) { - deleteInput := &dynamodb.DeleteTableInput{ - TableName: aws.String(tableName), - } - - _, err := db.DeleteTable(context.TODO(), deleteInput) - if err != nil { - panic(fmt.Sprintf("Error calling DeleteTable: %s", err)) - } -} diff --git a/e2e/document/firestore/firestore_suite_test.go b/e2e/document/firestore/firestore_suite_test.go deleted file mode 100644 index 7b72f62a5..000000000 --- a/e2e/document/firestore/firestore_suite_test.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package firestore_service_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestFirestore(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Firestore Document Suite") -} diff --git a/e2e/document/firestore/firestore_test.go b/e2e/document/firestore/firestore_test.go deleted file mode 100644 index 2a6b321b4..000000000 --- a/e2e/document/firestore/firestore_test.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package firestore_service_test - -import ( - "context" - "fmt" - "os" - - firestore_service "github.com/nitrictech/nitric/cloud/gcp/runtime/document" - - "cloud.google.com/go/firestore" - . "github.com/onsi/ginkgo" - - "github.com/nitrictech/nitric/e2e" - test "github.com/nitrictech/nitric/e2e/document" -) - -const ( - containerName = "firestore-nitric" - port = "8080" -) - -func createFirestoreClient(ctx context.Context) *firestore.Client { - client, err := firestore.NewClient(ctx, "test") - if err != nil { - fmt.Printf("NewClient error: %v \n", err) - panic(err) - } - - return client -} - -var _ = Describe("Firestore", func() { - defer GinkgoRecover() - - // Start Local DynamoDB - os.Setenv("FIRESTORE_EMULATOR_HOST", "localhost:"+port) - - // Start Firestore Emulator - args := []string{ - "docker", - "run", - "-d", - "-p " + port + ":" + port, - "--env \"FIRESTORE_PROJECT_ID=dummy-project-id\"", - "--name " + containerName, - "mtlynch/firestore-emulator-docker", - } - e2e.StartContainer(containerName, args) - - db := createFirestoreClient(context.TODO()) - - AfterSuite(func() { - e2e.StopContainer(containerName) - }) - - docPlugin, err := firestore_service.NewWithClient(db) - if err != nil { - panic(err) - } - - test.GetTests(docPlugin) - test.SetTests(docPlugin) - test.DeleteTests(docPlugin) - test.QueryTests(docPlugin) - test.QueryStreamTests(docPlugin) -}) diff --git a/e2e/document/get.go b/e2e/document/get.go deleted file mode 100644 index 9838a81db..000000000 --- a/e2e/document/get.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document_suite - -import ( - "context" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/nitrictech/nitric/core/pkg/plugins/document" -) - -func GetTests(docPlugin document.DocumentService) { - Context("Get", func() { - When("Blank key.Collection.Name", func() { - It("Should return error", func() { - key := document.Key{Id: "1"} - _, err := docPlugin.Get(context.TODO(), &key) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Blank key.Id", func() { - It("Should return error", func() { - key := document.Key{Collection: &document.Collection{Name: "users"}} - _, err := docPlugin.Get(context.TODO(), &key) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Valid Get", func() { - It("Should get item successfully", func() { - err := docPlugin.Set(context.TODO(), &UserKey1, UserItem1) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err := docPlugin.Get(context.TODO(), &UserKey1) - Expect(err).ShouldNot(HaveOccurred()) - Expect(doc).ToNot(BeNil()) - Expect(doc.Key).To(Equal(&UserKey1)) - Expect(doc.Content["email"]).To(BeEquivalentTo(UserItem1["email"])) - }) - }) - When("Valid Sub Collection Get", func() { - It("Should store item successfully", func() { - err := docPlugin.Set(context.TODO(), &Customer1.Orders[0].Key, Customer1.Orders[0].Content) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err := docPlugin.Get(context.TODO(), &Customer1.Orders[0].Key) - Expect(err).ShouldNot(HaveOccurred()) - Expect(doc).ToNot(BeNil()) - Expect(doc.Key).To(Equal(&Customer1.Orders[0].Key)) - Expect(doc.Content).To(BeEquivalentTo(Customer1.Orders[0].Content)) - }) - }) - When("Document Doesn't Exist", func() { - It("Should return NotFound error", func() { - key := document.Key{Collection: &document.Collection{Name: "items"}, Id: "not-exist"} - doc, err := docPlugin.Get(context.TODO(), &key) - Expect(doc).To(BeNil()) - Expect(err).Should(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("not found")) - }) - }) - When("Valid Collection Get when there is a Sub Collection", func() { - It("Should store item successfully", func() { - err := docPlugin.Set(context.TODO(), &Customer1.Key, Customer1.Content) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err := docPlugin.Get(context.TODO(), &Customer1.Key) - Expect(err).ShouldNot(HaveOccurred()) - Expect(doc).ToNot(BeNil()) - Expect(doc.Key).To(Equal(&Customer1.Key)) - Expect(doc.Content).To(BeEquivalentTo(Customer1.Content)) - }) - }) - }) -} diff --git a/e2e/document/mongodb/mongodb_suite_test.go b/e2e/document/mongodb/mongodb_suite_test.go deleted file mode 100644 index 6246a7673..000000000 --- a/e2e/document/mongodb/mongodb_suite_test.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package mongodb_service_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestMongoDB(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "MongoDB Document Suite") -} diff --git a/e2e/document/mongodb/mongodb_test.go b/e2e/document/mongodb/mongodb_test.go deleted file mode 100644 index 8109e1fe8..000000000 --- a/e2e/document/mongodb/mongodb_test.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package mongodb_service_test - -import ( - "context" - "fmt" - - . "github.com/onsi/ginkgo" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" - - mongodb_service "github.com/nitrictech/nitric/cloud/azure/runtime/document" - "github.com/nitrictech/nitric/e2e" - test "github.com/nitrictech/nitric/e2e/document" -) - -const containerName = "mongodb-nitric" - -func createMongoClient(ctx context.Context) (*mongo.Client, error) { - clientOptions := options.Client().ApplyURI("mongodb://localhost:27017").SetDirect(true) - client, clientError := mongo.NewClient(clientOptions) - - if clientError != nil { - return nil, fmt.Errorf("mongodb error creating client: %w", clientError) - } - - connectError := client.Connect(ctx) - - if connectError != nil { - return nil, fmt.Errorf("mongodb unable to initialize connection: %w", connectError) - } - - pingError := client.Ping(ctx, nil) - - if pingError != nil { - return nil, fmt.Errorf("mongodb unable to connect: %w", pingError) - } - - return client, nil -} - -var _ = Describe("MongoDB", func() { - defer GinkgoRecover() - - // Start Mongo - args := []string{ - "docker", - "run", - "-d", - "-p 27017-27019:27017-27019", - "--name " + containerName, - "mongo:4.0", - } - e2e.StartContainer(containerName, args) - - AfterSuite(func() { - e2e.StopContainer(containerName) - }) - - ctx := context.Background() - - client, err := createMongoClient(ctx) - if err != nil { - panic(err) - } - - docPlugin := mongodb_service.NewWithClient(client, "testing") - - if err != nil { - fmt.Printf("NewClient error: %v \n", err) - panic(err) - } - - test.GetTests(docPlugin) - test.SetTests(docPlugin) - test.DeleteTests(docPlugin) - test.QueryTests(docPlugin) - test.QueryStreamTests(docPlugin) -}) diff --git a/e2e/document/query.go b/e2e/document/query.go deleted file mode 100644 index 837d29c85..000000000 --- a/e2e/document/query.go +++ /dev/null @@ -1,572 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document_suite - -import ( - "context" - "fmt" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/nitrictech/nitric/core/pkg/plugins/document" -) - -func QueryTests(docPlugin document.DocumentService) { - Context("Query", func() { - When("Invalid - blank key.Collection.Name", func() { - It("Should return an error", func() { - result, err := docPlugin.Query(context.TODO(), &document.Collection{}, []document.QueryExpression{}, 0, nil) - Expect(result).To(BeNil()) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Invalid - nil expressions argument", func() { - It("Should return an error", func() { - result, err := docPlugin.Query(context.TODO(), &document.Collection{Name: "users"}, nil, 0, nil) - Expect(result).To(BeNil()) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Empty database", func() { - It("Should return empty list", func() { - result, err := docPlugin.Query(context.TODO(), &document.Collection{Name: "users"}, []document.QueryExpression{}, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(0)) - Expect(result.PagingToken).To(BeNil()) - }) - }) - When("key: {users}, subcol: '', exp: []", func() { - It("Should return all users", func() { - LoadUsersData(docPlugin) - LoadCustomersData(docPlugin) - - result, err := docPlugin.Query(context.TODO(), &document.Collection{Name: "users"}, []document.QueryExpression{}, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(3)) - - for _, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - Expect(d.Key.Collection.Name).To(Equal("users")) - Expect(d.Key.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Parent).To(BeNil()) - } - }) - }) - When("key: {customers, nil}, subcol: '', exp: []", func() { - It("Should return 2 items", func() { - LoadCustomersData(docPlugin) - - result, err := docPlugin.Query(context.TODO(), &CustomersColl, []document.QueryExpression{}, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(2)) - Expect(result.Documents[0].Content["email"]).To(BeEquivalentTo(Customer1.Content["email"])) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer1.Key)) - Expect(result.Documents[1].Content["email"]).To(BeEquivalentTo(Customer2.Content["email"])) - Expect(*result.Documents[1].Key).To(BeEquivalentTo(Customer2.Key)) - Expect(result.PagingToken).To(BeNil()) - }) - }) - When("key: {customers, nil}, subcol: '', exp: [country == US]", func() { - It("Should return 1 item", func() { - LoadCustomersData(docPlugin) - - exps := []document.QueryExpression{ - {Operand: "country", Operator: "==", Value: "US"}, - } - result, err := docPlugin.Query(context.TODO(), &CustomersColl, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(1)) - Expect(result.Documents[0].Content["email"]).To(BeEquivalentTo(Customer2.Content["email"])) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer2.Key)) - Expect(result.PagingToken).To(BeNil()) - }) - }) - When("key: {customers, nil}, subcol: '', exp: [country == US, age > 40]", func() { - It("Should return 0 item", func() { - LoadCustomersData(docPlugin) - - exps := []document.QueryExpression{ - {Operand: "country", Operator: "==", Value: "US"}, - {Operand: "age", Operator: ">", Value: "40"}, - } - result, err := docPlugin.Query(context.TODO(), &CustomersColl, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(0)) - }) - }) - When("key: {customers, key1}, subcol: orders", func() { - It("Should return 3 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - result, err := docPlugin.Query(context.TODO(), &coll, []document.QueryExpression{}, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(3)) - Expect(result.Documents[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*result.Documents[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(result.Documents[1].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[1].Content["testName"])) - Expect(*result.Documents[1].Key).To(BeEquivalentTo(Customer1.Orders[1].Key)) - Expect(*result.Documents[1].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(result.Documents[2].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[2].Content["testName"])) - Expect(*result.Documents[2].Key).To(BeEquivalentTo(Customer1.Orders[2].Key)) - Expect(*result.Documents[2].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number == 1]", func() { - It("Should return 2 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "==", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(2)) - Expect(result.Documents[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*result.Documents[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(result.Documents[1].Content["testName"]).To(BeEquivalentTo(Customer2.Orders[0].Content["testName"])) - Expect(*result.Documents[1].Key).To(BeEquivalentTo(Customer2.Orders[0].Key)) - Expect(*result.Documents[1].Key.Collection.Parent).To(BeEquivalentTo(Customer2.Key)) - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number == 1]", func() { - It("Should return 1 order", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "==", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(1)) - Expect(result.Documents[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*result.Documents[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number > 1]", func() { - It("Should return 3 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: ">", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(3)) - - for _, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - Expect(d.Key.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Name).To(Equal("orders")) - Expect(d.Key.Collection.Parent).ToNot(BeNil()) - Expect(d.Key.Collection.Parent.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers")) - } - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number > 1]", func() { - It("Should return 2 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: ">", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(2)) - Expect(result.Documents[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[1].Content["testName"])) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer1.Orders[1].Key)) - Expect(*result.Documents[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(result.Documents[1].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[2].Content["testName"])) - Expect(*result.Documents[1].Key).To(BeEquivalentTo(Customer1.Orders[2].Key)) - Expect(*result.Documents[1].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number < 1]", func() { - It("Should return 2 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "<", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(0)) - - for _, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - Expect(d.Key.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Name).To(Equal("orders")) - Expect(d.Key.Collection.Parent).ToNot(BeNil()) - Expect(d.Key.Collection.Parent.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers")) - } - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number < 1]", func() { - It("Should return 0 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "<", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(0)) - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number >= 1]", func() { - It("Should return 5 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: ">=", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(5)) - - for _, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - Expect(d.Key.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Name).To(Equal("orders")) - Expect(d.Key.Collection.Parent).ToNot(BeNil()) - Expect(d.Key.Collection.Parent.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers")) - } - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number >= 1]", func() { - It("Should return 3 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: ">=", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(3)) - - for _, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - Expect(d.Key.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Name).To(Equal("orders")) - Expect(d.Key.Collection.Parent).ToNot(BeNil()) - Expect(d.Key.Collection.Parent.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers")) - } - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number <= 1]", func() { - It("Should return 2 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "<=", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(2)) - Expect(result.Documents[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*result.Documents[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(result.Documents[1].Content["testName"]).To(BeEquivalentTo(Customer2.Orders[0].Content["testName"])) - Expect(*result.Documents[1].Key).To(BeEquivalentTo(Customer2.Orders[0].Key)) - Expect(*result.Documents[1].Key.Collection.Parent).To(BeEquivalentTo(Customer2.Key)) - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number <= 1]", func() { - It("Should return 1 order", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "<=", Value: "1"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(1)) - Expect(result.Documents[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*result.Documents[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key {customers, nil}, subcol: orders, exps: [type startsWith scooter]", func() { - It("Should return 2 order", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "type", Operator: "startsWith", Value: "scooter"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(2)) - Expect(result.Documents[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[2].Content["testName"])) - Expect(result.Documents[1].Content["testName"]).To(BeEquivalentTo(Customer2.Orders[1].Content["testName"])) - Expect(*result.Documents[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer1.Orders[2].Key)) - Expect(*result.Documents[1].Key.Collection.Parent).To(BeEquivalentTo(Customer2.Key)) - Expect(*result.Documents[1].Key).To(BeEquivalentTo(Customer2.Orders[1].Key)) - }) - }) - When("key {customers, key1}, subcol: orders, exps: [type startsWith bike/road]", func() { - It("Should return 1 order", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "type", Operator: "startsWith", Value: "scooter"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 0, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(1)) - Expect(result.Documents[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[2].Content["testName"])) - Expect(*result.Documents[0].Key).To(BeEquivalentTo(Customer1.Orders[2].Key)) - Expect(*result.Documents[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key: {items, nil}, subcol: '', exp: [], limit: 10", func() { - It("Should return have multiple pages", func() { - LoadItemsData(docPlugin) - - coll := document.Collection{ - Name: "items", - } - result, err := docPlugin.Query(context.TODO(), &coll, []document.QueryExpression{}, 10, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(10)) - Expect(result.PagingToken).ToNot(BeEmpty()) - - // Ensure values are unique - dataMap := make(map[string]string) - for i, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - val := fmt.Sprintf("%v", result.Documents[i].Content["letter"]) - dataMap[val] = val - } - - result, err = docPlugin.Query(context.TODO(), &coll, []document.QueryExpression{}, 10, result.PagingToken) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(2)) - Expect(result.PagingToken).To(BeNil()) - - // Ensure values are unique - for i, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - val := fmt.Sprintf("%v", result.Documents[i].Content["letter"]) - if _, found := dataMap[val]; found { - Expect("matching value").ShouldNot(HaveOccurred()) - } - } - }) - }) - When("key: {items, nil}, subcol: '', exps: [letter > D], limit: 4", func() { - It("Should return have multiple pages", func() { - LoadItemsData(docPlugin) - - coll := document.Collection{ - Name: "items", - } - exps := []document.QueryExpression{ - {Operand: "letter", Operator: ">", Value: "D"}, - } - result, err := docPlugin.Query(context.TODO(), &coll, exps, 4, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(4)) - Expect(result.PagingToken).ToNot(BeEmpty()) - - // Ensure values are unique - dataMap := make(map[string]string) - for i, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - val := fmt.Sprintf("%v", result.Documents[i].Content["letter"]) - dataMap[val] = val - } - - result, err = docPlugin.Query(context.TODO(), &coll, exps, 4, result.PagingToken) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(4)) - Expect(result.PagingToken).ToNot(BeEmpty()) - - // Ensure values are unique - for i, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - val := fmt.Sprintf("%v", result.Documents[i].Content["letter"]) - if _, found := dataMap[val]; found { - Expect("matching value").ShouldNot(HaveOccurred()) - } - } - - result, err = docPlugin.Query(context.TODO(), &coll, exps, 4, result.PagingToken) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(0)) - Expect(result.PagingToken).To(BeEmpty()) - }) - }) - When("key: {parentItems, 1}, subcol: items, exp: [], limit: 10", func() { - It("Should return have multiple pages", func() { - LoadItemsData(docPlugin) - - result, err := docPlugin.Query(context.TODO(), &ChildItemsCollection, []document.QueryExpression{}, 10, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(10)) - Expect(result.PagingToken).ToNot(BeEmpty()) - - // Ensure values are unique - dataMap := make(map[string]string) - for i, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - val := fmt.Sprintf("%v", result.Documents[i].Content["letter"]) - dataMap[val] = val - } - - result, err = docPlugin.Query(context.TODO(), &ChildItemsCollection, []document.QueryExpression{}, 10, result.PagingToken) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(2)) - Expect(result.PagingToken).To(BeNil()) - - // Ensure values are unique - for i, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - val := fmt.Sprintf("%v", result.Documents[i].Content["letter"]) - if _, found := dataMap[val]; found { - Expect("matching value").ShouldNot(HaveOccurred()) - } - } - }) - }) - When("key: {parentItems, 1}, subcol: items, exps: [letter > D], limit: 4", func() { - It("Should return have multiple pages", func() { - LoadItemsData(docPlugin) - - exps := []document.QueryExpression{ - {Operand: "letter", Operator: ">", Value: "D"}, - } - result, err := docPlugin.Query(context.TODO(), &ChildItemsCollection, exps, 4, nil) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(4)) - Expect(result.PagingToken).ToNot(BeEmpty()) - - // Ensure values are unique - dataMap := make(map[string]string) - for i, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - val := fmt.Sprintf("%v", result.Documents[i].Content["letter"]) - dataMap[val] = val - } - - result, err = docPlugin.Query(context.TODO(), &ChildItemsCollection, exps, 4, result.PagingToken) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(4)) - Expect(result.PagingToken).ToNot(BeEmpty()) - - // Ensure values are unique - for i, d := range result.Documents { - Expect(d.Key).ToNot(BeNil()) - val := fmt.Sprintf("%v", result.Documents[i].Content["letter"]) - if _, found := dataMap[val]; found { - Expect("matching value").ShouldNot(HaveOccurred()) - } - } - - result, err = docPlugin.Query(context.TODO(), &ChildItemsCollection, exps, 4, result.PagingToken) - Expect(result).ToNot(BeNil()) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result.Documents).To(HaveLen(0)) - Expect(result.PagingToken).To(BeEmpty()) - }) - }) - }) -} diff --git a/e2e/document/set.go b/e2e/document/set.go deleted file mode 100644 index b637ee392..000000000 --- a/e2e/document/set.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document_suite - -import ( - "context" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/nitrictech/nitric/core/pkg/plugins/document" -) - -func SetTests(docPlugin document.DocumentService) { - Context("Set", func() { - When("Blank key.Collection.Name", func() { - It("Should return error", func() { - key := document.Key{Id: "1"} - err := docPlugin.Set(context.TODO(), &key, UserItem1) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Blank key.Id", func() { - It("Should return error", func() { - key := document.Key{Collection: &document.Collection{Name: "users"}} - err := docPlugin.Set(context.TODO(), &key, UserItem1) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Nil item map", func() { - It("Should return error", func() { - key := document.Key{Collection: &document.Collection{Name: "users"}, Id: "1"} - err := docPlugin.Set(context.TODO(), &key, nil) - Expect(err).Should(HaveOccurred()) - }) - }) - When("Valid New Set", func() { - It("Should store new item successfully", func() { - err := docPlugin.Set(context.TODO(), &UserKey1, UserItem1) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err := docPlugin.Get(context.TODO(), &UserKey1) - Expect(err).ShouldNot(HaveOccurred()) - Expect(doc).ToNot(BeNil()) - Expect(doc.Content["email"]).To(BeEquivalentTo(UserItem1["email"])) - }) - }) - When("Valid Update Set", func() { - It("Should update existing item successfully", func() { - err := docPlugin.Set(context.TODO(), &UserKey1, UserItem1) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err := docPlugin.Get(context.TODO(), &UserKey1) - Expect(err).ShouldNot(HaveOccurred()) - Expect(doc).ToNot(BeNil()) - Expect(doc.Content["email"]).To(BeEquivalentTo(UserItem1["email"])) - - err = docPlugin.Set(context.TODO(), &UserKey1, UserItem2) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err = docPlugin.Get(context.TODO(), &UserKey1) - Expect(err).ShouldNot(HaveOccurred()) - Expect(doc).ToNot(BeNil()) - Expect(doc.Content["email"]).To(BeEquivalentTo(UserItem2["email"])) - }) - }) - When("Valid Sub Collection Set", func() { - It("Should store item successfully", func() { - err := docPlugin.Set(context.TODO(), &Customer1.Orders[0].Key, Customer1.Orders[0].Content) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err := docPlugin.Get(context.TODO(), &Customer1.Orders[0].Key) - Expect(err).ShouldNot(HaveOccurred()) - Expect(doc).ToNot(BeNil()) - Expect(doc.Content).To(BeEquivalentTo(Customer1.Orders[0].Content)) - }) - }) - When("Valid Multiple Sub Collection Set", func() { - It("Should store item successfully", func() { - err := docPlugin.Set(context.TODO(), &Customer1.Reviews[0].Key, Customer1.Reviews[0].Content) - Expect(err).ShouldNot(HaveOccurred()) - - doc, err := docPlugin.Get(context.TODO(), &Customer1.Reviews[0].Key) - Expect(err).ShouldNot(HaveOccurred()) - Expect(doc).ToNot(BeNil()) - Expect(doc.Content).To(BeEquivalentTo(Customer1.Reviews[0].Content)) - }) - }) - }) -} diff --git a/e2e/document/stream.go b/e2e/document/stream.go deleted file mode 100644 index 59c9d937b..000000000 --- a/e2e/document/stream.go +++ /dev/null @@ -1,446 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document_suite - -import ( - "context" - "io" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/nitrictech/nitric/core/pkg/plugins/document" -) - -func unwrapIter(iter document.DocumentIterator) []*document.Document { - docs := make([]*document.Document, 0) - for { - d, err := iter() - if err != nil { - Expect(err).To(Equal(io.EOF)) - break - } - - docs = append(docs, d) - } - - return docs -} - -func QueryStreamTests(docPlugin document.DocumentService) { - Context("QueryStream", func() { - // Validation Tests - When("Invalid - blank key.Collection.Name", func() { - It("Should return an iterator that errors", func() { - iter := docPlugin.QueryStream(context.TODO(), &document.Collection{}, []document.QueryExpression{}, 0) - Expect(iter).ToNot(BeNil()) - - _, err := iter() - Expect(err).Should(HaveOccurred()) - Expect(err).ToNot(Equal(io.EOF)) - }) - }) - When("Invalid - nil expressions argument", func() { - It("Should return an iterator that errors", func() { - iter := docPlugin.QueryStream(context.TODO(), &document.Collection{Name: "users"}, nil, 0) - Expect(iter).ToNot(BeNil()) - - _, err := iter() - Expect(err).Should(HaveOccurred()) - Expect(err).ToNot(Equal(io.EOF)) - }) - }) - - // Query Tests - When("key: {users}, subcol: '', exp: []", func() { - It("Should return all users", func() { - LoadUsersData(docPlugin) - LoadCustomersData(docPlugin) - - iter := docPlugin.QueryStream(context.TODO(), &document.Collection{Name: "users"}, []document.QueryExpression{}, 0) - - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(3)) - - for _, d := range docs { - Expect(d.Key).ToNot(BeNil()) - Expect(d.Key.Collection.Name).To(Equal("users")) - Expect(d.Key.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Parent).To(BeNil()) - } - }) - }) - When("key: {customers, nil}, subcol: '', exp: []", func() { - It("Should return 2 items", func() { - LoadCustomersData(docPlugin) - - iter := docPlugin.QueryStream(context.TODO(), &CustomersColl, []document.QueryExpression{}, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(2)) - Expect(docs[0].Content["email"]).To(BeEquivalentTo(Customer1.Content["email"])) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer1.Key)) - Expect(docs[1].Content["email"]).To(BeEquivalentTo(Customer2.Content["email"])) - Expect(*docs[1].Key).To(BeEquivalentTo(Customer2.Key)) - }) - }) - When("key: {customers, nil}, subcol: '', exp: [country == US]", func() { - It("Should return 1 item", func() { - LoadCustomersData(docPlugin) - - exps := []document.QueryExpression{ - {Operand: "country", Operator: "==", Value: "US"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &CustomersColl, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(1)) - Expect(docs[0].Content["email"]).To(BeEquivalentTo(Customer2.Content["email"])) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer2.Key)) - }) - }) - When("key: {customers, nil}, subcol: '', exp: [country == US, age > 40]", func() { - It("Should return 0 item", func() { - LoadCustomersData(docPlugin) - - exps := []document.QueryExpression{ - {Operand: "country", Operator: "==", Value: "US"}, - {Operand: "age", Operator: ">", Value: "40"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &CustomersColl, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(0)) - }) - }) - When("key: {customers, key1}, subcol: orders", func() { - It("Should return 3 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, []document.QueryExpression{}, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(3)) - Expect(docs[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*docs[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(docs[1].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[1].Content["testName"])) - Expect(*docs[1].Key).To(BeEquivalentTo(Customer1.Orders[1].Key)) - Expect(*docs[1].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(docs[2].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[2].Content["testName"])) - Expect(*docs[2].Key).To(BeEquivalentTo(Customer1.Orders[2].Key)) - Expect(*docs[2].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number == 1]", func() { - It("Should return 2 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "==", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(2)) - Expect(docs[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*docs[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(docs[1].Content["testName"]).To(BeEquivalentTo(Customer2.Orders[0].Content["testName"])) - Expect(*docs[1].Key).To(BeEquivalentTo(Customer2.Orders[0].Key)) - Expect(*docs[1].Key.Collection.Parent).To(BeEquivalentTo(Customer2.Key)) - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number == 1]", func() { - It("Should return 1 order", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "==", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(1)) - Expect(docs[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*docs[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number > 1]", func() { - It("Should return 3 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: ">", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(3)) - - for _, d := range docs { - Expect(d.Key).ToNot(BeNil()) - Expect(d.Key.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Name).To(Equal("orders")) - Expect(d.Key.Collection.Parent).ToNot(BeNil()) - Expect(d.Key.Collection.Parent.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers")) - } - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number > 1]", func() { - It("Should return 2 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: ">", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(2)) - Expect(docs[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[1].Content["testName"])) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer1.Orders[1].Key)) - Expect(*docs[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(docs[1].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[2].Content["testName"])) - Expect(*docs[1].Key).To(BeEquivalentTo(Customer1.Orders[2].Key)) - Expect(*docs[1].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number < 1]", func() { - It("Should return 0 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "<", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(0)) - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number < 1]", func() { - It("Should return 0 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "<", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(0)) - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number >= 1]", func() { - It("Should return 5 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: ">=", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(5)) - - for _, d := range docs { - Expect(d.Key).ToNot(BeNil()) - Expect(d.Key.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Name).To(Equal("orders")) - Expect(d.Key.Collection.Parent).ToNot(BeNil()) - Expect(d.Key.Collection.Parent.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers")) - } - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number >= 1]", func() { - It("Should return 3 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: ">=", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(3)) - - for _, d := range docs { - Expect(d.Key).ToNot(BeNil()) - Expect(d.Key.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Name).To(Equal("orders")) - Expect(d.Key.Collection.Parent).ToNot(BeNil()) - Expect(d.Key.Collection.Parent.Id).ToNot(Equal("")) - Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers")) - } - }) - }) - When("key: {customers, nil}, subcol: orders, exps: [number <= 1]", func() { - It("Should return 2 orders", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "<=", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(2)) - Expect(docs[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*docs[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(docs[1].Content["testName"]).To(BeEquivalentTo(Customer2.Orders[0].Content["testName"])) - Expect(*docs[1].Key).To(BeEquivalentTo(Customer2.Orders[0].Key)) - Expect(*docs[1].Key.Collection.Parent).To(BeEquivalentTo(Customer2.Key)) - }) - }) - When("key: {customers, key1}, subcol: orders, exps: [number <= 1]", func() { - It("Should return 1 order", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "number", Operator: "<=", Value: "1"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(1)) - Expect(docs[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[0].Content["testName"])) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer1.Orders[0].Key)) - Expect(*docs[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key {customers, nil}, subcol: orders, exps: [type startsWith scooter]", func() { - It("Should return 2 order", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &CustomersKey, - } - exps := []document.QueryExpression{ - {Operand: "type", Operator: "startsWith", Value: "scooter"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(2)) - Expect(docs[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[2].Content["testName"])) - Expect(docs[1].Content["testName"]).To(BeEquivalentTo(Customer2.Orders[1].Content["testName"])) - Expect(*docs[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer1.Orders[2].Key)) - Expect(*docs[1].Key.Collection.Parent).To(BeEquivalentTo(Customer2.Key)) - Expect(*docs[1].Key).To(BeEquivalentTo(Customer2.Orders[1].Key)) - }) - }) - When("key {customers, key1}, subcol: orders, exps: [type startsWith bike/road]", func() { - It("Should return 1 order", func() { - LoadCustomersData(docPlugin) - - coll := document.Collection{ - Name: "orders", - Parent: &Customer1.Key, - } - exps := []document.QueryExpression{ - {Operand: "type", Operator: "startsWith", Value: "scooter"}, - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, exps, 0) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(1)) - Expect(docs[0].Content["testName"]).To(BeEquivalentTo(Customer1.Orders[2].Content["testName"])) - Expect(*docs[0].Key).To(BeEquivalentTo(Customer1.Orders[2].Key)) - Expect(*docs[0].Key.Collection.Parent).To(BeEquivalentTo(Customer1.Key)) - }) - }) - When("key: {items, nil}, subcol: '', exp: [], limit: 10", func() { - It("Should return limited results", func() { - LoadItemsData(docPlugin) - - coll := document.Collection{ - Name: "items", - } - - iter := docPlugin.QueryStream(context.TODO(), &coll, []document.QueryExpression{}, 10) - docs := unwrapIter(iter) - - Expect(docs).To(HaveLen(10)) - }) - }) - }) -} diff --git a/e2e/document/suite.go b/e2e/document/suite.go deleted file mode 100644 index 564c9d662..000000000 --- a/e2e/document/suite.go +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document_suite - -import ( - "context" - - "github.com/nitrictech/nitric/core/pkg/plugins/document" -) - -// Simple 'users' collection test data - -var UserKey1 = document.Key{ - Collection: &document.Collection{Name: "users"}, - Id: "jsmith@server.com", -} - -var UserItem1 = map[string]interface{}{ - "firstName": "John", - "lastName": "Smith", - "email": "jsmith@server.com", - "country": "US", - "age": "30", -} - -var UserKey2 = document.Key{ - Collection: &document.Collection{Name: "users"}, - Id: "j.smithers@yahoo.com", -} - -var UserItem2 = map[string]interface{}{ - "firstName": "Johnson", - "lastName": "Smithers", - "email": "j.smithers@yahoo.com", - "country": "AU", - "age": "40", -} - -var UserKey3 = document.Key{ - Collection: &document.Collection{Name: "users"}, - Id: "pdavis@server.com", -} - -var UserItem3 = map[string]interface{}{ - "firstName": "Paul", - "lastName": "Davis", - "email": "pdavis@server.com", - "country": "US", - "age": "50", -} - -// Single Table Design 'customers' collection test data - -var CustomersKey = document.Key{ - Collection: &document.Collection{Name: "customers"}, -} - -var CustomersColl = document.Collection{Name: "customers"} - -type Customer struct { - Key document.Key - Content map[string]interface{} - Orders []Order - Reviews []Review -} - -type Order struct { - Key document.Key - Content map[string]interface{} -} - -type Review struct { - Key document.Key - Content map[string]interface{} -} - -var Customer1 = Customer{ - Key: document.Key{ - Collection: &document.Collection{Name: "customers"}, - Id: "1000", - }, - Content: map[string]interface{}{ - "testName": "CustomerItem1", - "firstName": "John", - "lastName": "Smith", - "email": "jsmith@server.com", - "country": "AU", - "age": "40", - }, - Orders: []Order{ - { - Key: document.Key{ - Collection: &document.Collection{ - Name: "orders", - Parent: &document.Key{ - Collection: &document.Collection{Name: "customers"}, - Id: "1000", - }, - }, - Id: "501", - }, - Content: map[string]interface{}{ - "testName": "OrderItem1", - "sku": "ABC-501", - "type": "bike/mountain", - "number": "1", - "price": "14.95", - }, - }, - { - Key: document.Key{ - Collection: &document.Collection{ - Name: "orders", - Parent: &document.Key{ - Collection: &document.Collection{Name: "customers"}, - Id: "1000", - }, - }, - Id: "502", - }, - Content: map[string]interface{}{ - "testName": "OrderItem2", - "sku": "ABC-502", - "type": "bike/road", - "number": "2", - "price": "19.95", - }, - }, - { - Key: document.Key{ - Collection: &document.Collection{ - Name: "orders", - Parent: &document.Key{ - Collection: &document.Collection{Name: "customers"}, - Id: "1000", - }, - }, - Id: "503", - }, - Content: map[string]interface{}{ - "testName": "OrderItem3", - "sku": "ABC-503", - "type": "scooter/electric", - "number": "3", - "price": "124.95", - }, - }, - }, - Reviews: []Review{ - { - Key: document.Key{ - Collection: &document.Collection{ - Name: "reviews", - Parent: &document.Key{ - Collection: &document.Collection{Name: "customers"}, - Id: "1000", - }, - }, - Id: "300", - }, - Content: map[string]interface{}{ - "title": "Good review", - "stars": "5", - }, - }, - }, -} - -var Customer2 = Customer{ - Key: document.Key{ - Collection: &document.Collection{Name: "customers"}, - Id: "2000", - }, - Content: map[string]interface{}{ - "testName": "CustomerItem2", - "firstName": "David", - "lastName": "Adams", - "email": "dadams@server.com", - "country": "US", - "age": "20", - }, - Orders: []Order{ - { - Key: document.Key{ - Collection: &document.Collection{ - Name: "orders", - Parent: &document.Key{ - Collection: &document.Collection{Name: "customers"}, - Id: "2000", - }, - }, - Id: "504", - }, - Content: map[string]interface{}{ - "testName": "OrderItem4", - "sku": "ABC-504", - "type": "bike/hybrid", - "number": "1", - "price": "229.95", - }, - }, - { - Key: document.Key{ - Collection: &document.Collection{ - Name: "orders", - Parent: &document.Key{ - Collection: &document.Collection{Name: "customers"}, - Id: "2000", - }, - }, - Id: "505", - }, - Content: map[string]interface{}{ - "testName": "OrderItem5", - "sku": "ABC-505", - "type": "scooter/manual", - "number": "2", - "price": "9.95", - }, - }, - }, -} - -type Item struct { - Key document.Key - Content map[string]interface{} -} - -var Items = []Item{ - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "01"}, - Content: map[string]interface{}{"letter": "A"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "02"}, - Content: map[string]interface{}{"letter": "B"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "03"}, - Content: map[string]interface{}{"letter": "C"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "04"}, - Content: map[string]interface{}{"letter": "D"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "05"}, - Content: map[string]interface{}{"letter": "E"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "06"}, - Content: map[string]interface{}{"letter": "F"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "07"}, - Content: map[string]interface{}{"letter": "G"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "08"}, - Content: map[string]interface{}{"letter": "H"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "09"}, - Content: map[string]interface{}{"letter": "I"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "10"}, - Content: map[string]interface{}{"letter": "J"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "11"}, - Content: map[string]interface{}{"letter": "K"}, - }, - { - Key: document.Key{Collection: &document.Collection{Name: "items"}, Id: "12"}, - Content: map[string]interface{}{"letter": "L"}, - }, -} - -var ChildItemsCollection = document.Collection{ - Name: "items", - Parent: &document.Key{ - Collection: &document.Collection{Name: "parentItems"}, - Id: "1", - }, -} - -func MustHaveOccurred(err error) { - if err != nil { - panic(err) - } -} - -// Test Data Loading Functions ------------------------------------------------ - -func LoadUsersData(docPlugin document.DocumentService) { - MustHaveOccurred(docPlugin.Set(context.TODO(), &UserKey1, UserItem1)) - MustHaveOccurred(docPlugin.Set(context.TODO(), &UserKey2, UserItem2)) - MustHaveOccurred(docPlugin.Set(context.TODO(), &UserKey3, UserItem3)) -} - -func LoadCustomersData(docPlugin document.DocumentService) { - MustHaveOccurred(docPlugin.Set(context.TODO(), &Customer1.Key, Customer1.Content)) - MustHaveOccurred(docPlugin.Set(context.TODO(), &Customer1.Orders[0].Key, Customer1.Orders[0].Content)) - MustHaveOccurred(docPlugin.Set(context.TODO(), &Customer1.Orders[1].Key, Customer1.Orders[1].Content)) - MustHaveOccurred(docPlugin.Set(context.TODO(), &Customer1.Orders[2].Key, Customer1.Orders[2].Content)) - - MustHaveOccurred(docPlugin.Set(context.TODO(), &Customer2.Key, Customer2.Content)) - MustHaveOccurred(docPlugin.Set(context.TODO(), &Customer2.Orders[0].Key, Customer2.Orders[0].Content)) - MustHaveOccurred(docPlugin.Set(context.TODO(), &Customer2.Orders[1].Key, Customer2.Orders[1].Content)) -} - -func LoadItemsData(docPlugin document.DocumentService) { - for _, item := range Items { - MustHaveOccurred(docPlugin.Set(context.TODO(), &item.Key, item.Content)) - - key := document.Key{ - Collection: &ChildItemsCollection, - Id: item.Key.Id, - } - MustHaveOccurred(docPlugin.Set(context.TODO(), &key, item.Content)) - } -} - -// Unit Test Functions -------------------------------------------------------- diff --git a/e2e/go.mod b/e2e/go.mod deleted file mode 100644 index d4fc1c4f5..000000000 --- a/e2e/go.mod +++ /dev/null @@ -1,133 +0,0 @@ -module github.com/nitrictech/nitric/e2e - -go 1.21 - -require ( - cloud.google.com/go/firestore v1.9.0 - github.com/aws/aws-sdk-go-v2 v1.18.0 - github.com/aws/aws-sdk-go-v2/config v1.18.4 - github.com/aws/aws-sdk-go-v2/service/dynamodb v1.17.8 - github.com/golang/mock v1.6.0 - github.com/nitrictech/nitric/cloud/aws v0.0.0-20231107054537-4c0047677b3e - github.com/nitrictech/nitric/cloud/azure v0.0.0-20231107054537-4c0047677b3e - github.com/nitrictech/nitric/cloud/gcp v0.0.0-20231107054537-4c0047677b3e - github.com/nitrictech/nitric/core v0.0.0-20231107054537-4c0047677b3e - github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.26.0 - go.mongodb.org/mongo-driver v1.11.1 -) - -require ( - cloud.google.com/go v0.110.0 // indirect - cloud.google.com/go/compute v1.19.0 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v0.13.0 // indirect - cloud.google.com/go/longrunning v0.4.1 // indirect - cloud.google.com/go/pubsub v1.30.0 // indirect - github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230426101702-58e86b294756 // indirect - github.com/acomagu/bufpipe v1.0.4 // indirect - github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.13.4 // indirect - github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.10.6 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 // indirect - github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.12.20 // indirect - github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.13.26 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.20 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 // indirect - github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.13.21 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.17.6 // indirect - github.com/aws/smithy-go v1.13.5 // indirect - github.com/blang/semver v3.5.1+incompatible // indirect - github.com/cheggaaa/pb v1.0.29 // indirect - github.com/cloudflare/circl v1.3.3 // indirect - github.com/djherbis/times v1.5.0 // indirect - github.com/emirpasic/gods v1.18.1 // indirect - github.com/envoyproxy/protoc-gen-validate v0.9.1 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-git/gcfg v1.5.0 // indirect - github.com/go-git/go-billy/v5 v5.4.1 // indirect - github.com/go-git/go-git/v5 v5.6.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/gofrs/uuid v4.4.0+incompatible // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.1 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/google/go-cmp v0.5.9 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.7.1 // indirect - github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/imdario/mergo v0.3.15 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/kevinburke/ssh_config v1.2.0 // indirect - github.com/klauspost/compress v1.16.3 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/mitchellh/go-ps v1.0.0 // indirect - github.com/montanaflynn/stats v0.6.6 // indirect - github.com/nitrictech/nitric/cloud/common v0.0.0-20230616021604-4036d005db63 // indirect - github.com/nxadm/tail v1.4.8 // indirect - github.com/onsi/ginkgo/v2 v2.8.0 // indirect - github.com/opentracing/basictracer-go v1.1.0 // indirect - github.com/opentracing/opentracing-go v1.2.0 // indirect - github.com/pjbgf/sha1cd v0.3.0 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/pkg/term v1.1.0 // indirect - github.com/pulumi/pulumi/sdk/v3 v3.65.1 // indirect - github.com/rivo/uniseg v0.4.4 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect - github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect - github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 // indirect - github.com/sergi/go-diff v1.3.1 // indirect - github.com/skeema/knownhosts v1.1.0 // indirect - github.com/spf13/cobra v1.7.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.4 // indirect - github.com/texttheater/golang-levenshtein v1.0.1 // indirect - github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7 // indirect - github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect - github.com/uber/jaeger-lib v2.4.1+incompatible // indirect - github.com/xanzy/ssh-agent v0.3.3 // indirect - github.com/xdg-go/pbkdf2 v1.0.0 // indirect - github.com/xdg-go/scram v1.1.1 // indirect - github.com/xdg-go/stringprep v1.0.3 // indirect - github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect - go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.36.4 // indirect - go.opentelemetry.io/otel v1.11.2 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect - go.uber.org/atomic v1.10.0 // indirect - golang.org/x/crypto v0.8.0 // indirect - golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.9.0 // indirect - golang.org/x/oauth2 v0.6.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.7.0 // indirect - golang.org/x/term v0.7.0 // indirect - golang.org/x/text v0.9.0 // indirect - golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.8.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.114.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/grpc v1.54.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect - gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect - gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - lukechampine.com/frand v1.4.2 // indirect - sourcegraph.com/sourcegraph/appdash v0.0.0-20211028080628-e2786a622600 // indirect -) diff --git a/e2e/go.sum b/e2e/go.sum deleted file mode 100644 index 73db4a053..000000000 --- a/e2e/go.sum +++ /dev/null @@ -1,549 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= -cloud.google.com/go/compute v1.19.0 h1:+9zda3WGgW1ZSTlVppLCYFIr48Pa35q1uG2N1itbCEQ= -cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/firestore v1.9.0 h1:IBlRyxgGySXu5VuW0RgGFlTtLukSnNkpDiEOMkQkmpA= -cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= -cloud.google.com/go/iam v0.13.0 h1:+CmB+K0J/33d0zSQ9SlFWUeCCEn5XJA0ZMZ3pHE9u8k= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/kms v1.10.1 h1:7hm1bRqGCA1GBRQUrp831TwJ9TWhP+tvLuP497CQS2g= -cloud.google.com/go/kms v1.10.1/go.mod h1:rIWk/TryCkR59GMC3YtHtXeLzd634lBbKenvyySAyYI= -cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM= -cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= -cloud.google.com/go/pubsub v1.30.0 h1:vCge8m7aUKBJYOgrZp7EsNDf6QMd2CAlXZqWTn3yq6s= -cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= -github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= -github.com/ProtonMail/go-crypto v0.0.0-20230426101702-58e86b294756 h1:L6S7kR7SlhQKplIBpkra3s6yhcZV51lhRnXmYc4HohI= -github.com/ProtonMail/go-crypto v0.0.0-20230426101702-58e86b294756/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE= -github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= -github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= -github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY= -github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da/go.mod h1:eHEWzANqSiWQsof+nXEI9bUVUyV6F53Fp89EuCh2EAA= -github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= -github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/aws/aws-sdk-go-v2 v1.17.1/go.mod h1:JLnGeGONAyi2lWXI1p0PCIOIy333JMVK1U7Hf0aRFLw= -github.com/aws/aws-sdk-go-v2 v1.17.2/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= -github.com/aws/aws-sdk-go-v2 v1.18.0 h1:882kkTpSFhdgYRKVZ/VCgf7sd0ru57p2JCxz4/oN5RY= -github.com/aws/aws-sdk-go-v2 v1.18.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= -github.com/aws/aws-sdk-go-v2/config v1.18.4 h1:VZKhr3uAADXHStS/Gf9xSYVmmaluTUfkc0dcbPiDsKE= -github.com/aws/aws-sdk-go-v2/config v1.18.4/go.mod h1:EZxMPLSdGAZ3eAmkqXfYbRppZJTzFTkv8VyEzJhKko4= -github.com/aws/aws-sdk-go-v2/credentials v1.13.4 h1:nEbHIyJy7mCvQ/kzGG7VWHSBpRB4H6sJy3bWierWUtg= -github.com/aws/aws-sdk-go-v2/credentials v1.13.4/go.mod h1:/Cj5w9LRsNTLSwexsohwDME32OzJ6U81Zs33zr2ZWOM= -github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.10.6 h1:TAs693KgM5digUjCmCmNC9RhpPLxwczfjrCq7mjR7KY= -github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.10.6/go.mod h1:4jroHJSgwid88qqpZyJFpxTyNe6qlItCUND1cXfN50g= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 h1:tpNOglTZ8kg9T38NpcGBxudqfUAwUzyUnLQ4XSd0CHE= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20/go.mod h1:d9xFpWd3qYwdIXM0fvu7deD08vvdRXyc/ueV+0SqaWE= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25/go.mod h1:Zb29PYkf42vVYQY6pvSyJCJcFHlPIiY+YKdPtwnvMkY= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26/go.mod h1:2E0LdbJW6lbeU4uxjum99GZzI0ZjDpAb0CoSCM0oeEY= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 h1:kG5eQilShqmJbv11XL1VpyDbaEJzWxd4zRiCG30GSn4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33/go.mod h1:7i0PF1ME/2eUPFcjkVIwq+DOygHEoK92t5cDqNgYbIw= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19/go.mod h1:6Q0546uHDp421okhmmGfbxzq2hBqbXFNpi4k+Q1JnQA= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20/go.mod h1:/+6lSiby8TBFpTVXZgKiN/rCfkYXEGvhlM4zCgPpt7w= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 h1:vFQlirhuM8lLlpI7imKOMsjdQLuN9CPi+k44F/OFVsk= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27/go.mod h1:UrHnn3QV/d0pBZ6QBAEQcqFLf8FAzLmoUfPVIueOvoM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 h1:N2eKFw2S+JWRCtTt0IhIX7uoGGQciD4p6ba+SJv4WEU= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27/go.mod h1:RdwFVc7PBYWY33fa2+8T1mSqQ7ZEK4ILpM0wfioDC3w= -github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.12.20 h1:7N4o3yLag3c3c22POkmCAfrr/OQG5807a9NRh9lUUKw= -github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.12.20/go.mod h1:BEIWaGqO27qq9JeFeY746S4+SFmBajpV+yhGne2qbMo= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.17.7/go.mod h1:BiglbKCG56L8tmMnUEyEQo422BO9xnNR8vVHnOsByf8= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.17.8 h1:VgdGaSIoH4JhUZIspT8UgK0aBF85TiLve7VHEx3NfqE= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.17.8/go.mod h1:jvXzk+hVrlkiQOvnq6jH+F6qBK0CEceXkEWugT+4Kdc= -github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.13.26 h1:ToM7rTr08bzBTGWIL5cEpo74ZlzuRF9TpnWuXYDPc5E= -github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.13.26/go.mod h1:5lIdkQbMmEblCTEAyFAsLduBtMPD9Bqt9fwPjBK1KWU= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.10/go.mod h1:9cBNUHI2aW4ho0A5T87O294iPDuuUOSIEDjnd1Lq/z0= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 h1:y2+VQzC6Zh2ojtV2LoC0MNwHWc6qXv/j2vrQtlftkdA= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11/go.mod h1:iV4q2hsqtNECrfmlXyord9u4zyuFEJX9eLgLpSPzWA8= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.19/go.mod h1:2WpVWFC5n4DYhjNXzObtge8xfgId9UP6GWca46KJFLo= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.20 h1:kSZR22oLBDMtP8ZPGXhz649NU77xsJDG7g3xfT6nHVk= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.20/go.mod h1:lxM5qubwGNX29Qy+xTFG8G0r2Mj/TmyC+h3hS/7E4V8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 h1:jlgyHbkZQAgAc7VIxJDmtouH8eNjOk2REVAQfVhdaiQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20/go.mod h1:Xs52xaLBqDEKRcAfX/hgjmD3YQ7c/W+BEyfamlO/W2E= -github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.13.21 h1:m7rx+wKkJZJWhoxINdYeKvwVfhhk7gGN2smj2aVUuDU= -github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.13.21/go.mod h1:/WfhDm5Hmfy/3TSM/1m9ojM0IQsBuVGvd3vITQc86i0= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 h1:ActQgdTNQej/RuUJjB9uxYVLDOvRGtUreXF8L3c8wyg= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.26/go.mod h1:uB9tV79ULEZUXc6Ob18A46KSQ0JDlrplPni9XW6Ot60= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 h1:wihKuqYUlA2T/Rx+yu2s6NDAns8B9DgnRooB1PVhY+Q= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9/go.mod h1:2E/3D/mB8/r2J7nK42daoKP/ooCwbf0q1PznNc+DZTU= -github.com/aws/aws-sdk-go-v2/service/sts v1.17.6 h1:VQFOLQVL3BrKM/NLO/7FiS4vcp5bqK0mGMyk09xLoAY= -github.com/aws/aws-sdk-go-v2/service/sts v1.17.6/go.mod h1:Az3OXXYGyfNwQNsK/31L4R75qFYnO641RZGAoV3uH1c= -github.com/aws/smithy-go v1.13.4/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= -github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= -github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cheggaaa/pb v1.0.29 h1:FckUN5ngEk2LpvuG0fw1GEFx6LtyY2pWI/Z2QgCnEYo= -github.com/cheggaaa/pb v1.0.29/go.mod h1:W40334L7FMC5JKWldsTWbdGjLo0RxUKK73K+TuPxX30= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= -github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= -github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/djherbis/times v1.5.0 h1:79myA211VwPhFTqUk8xehWrsEO+zcIZj0zT8mXPVARU= -github.com/djherbis/times v1.5.0/go.mod h1:5q7FDLvbNg1L/KaBmPcWlVR9NmoKo3+ucqUA3ijQhA0= -github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= -github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.9.1 h1:PS7VIOgmSVhWUEeZwTe7z7zouA22Cr590PzXKbZHOVY= -github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= -github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= -github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= -github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= -github.com/go-git/go-git-fixtures/v4 v4.3.1 h1:y5z6dd3qi8Hl+stezc8p3JxDkoTRqMAlKnXHuzrfjTQ= -github.com/go-git/go-git-fixtures/v4 v4.3.1/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo= -github.com/go-git/go-git/v5 v5.6.1 h1:q4ZRqQl4pR/ZJHc1L5CFjGA1a10u76aV1iC+nh+bHsk= -github.com/go-git/go-git/v5 v5.6.1/go.mod h1:mvyoL6Unz0PiTQrGQfSfiLFhBH1c1e84ylC2MDs4ee8= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= -github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.1 h1:jxpi2eWoU84wbX9iIEyAeeoac3FLuifZpY9tcNUD9kw= -github.com/golang/glog v1.1.1/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/gax-go/v2 v2.7.1 h1:gF4c0zjUP2H/s/hEGyLA3I0fA2ZWjzYiONAD6cvPr8A= -github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU= -github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= -github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= -github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= -github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= -github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= -github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= -github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= -github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc= -github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= -github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/montanaflynn/stats v0.6.6 h1:Duep6KMIDpY4Yo11iFsvyqJDyfzLF9+sndUKT+v64GQ= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nitrictech/nitric/cloud/aws v0.0.0-20231107054537-4c0047677b3e h1:0sKZs6EVnnexpuEBsv9nFbZzafE1XhW1PMtMO+3CyGE= -github.com/nitrictech/nitric/cloud/aws v0.0.0-20231107054537-4c0047677b3e/go.mod h1:lvgb3se62+wSOusR5PPN+U00RPbWfYxnEIgal4wIgxc= -github.com/nitrictech/nitric/cloud/azure v0.0.0-20231107054537-4c0047677b3e h1:G5FNN3Tu5qjv/Lhi4dJ+xxRuLlnb9brKFd3rTrxXH5U= -github.com/nitrictech/nitric/cloud/azure v0.0.0-20231107054537-4c0047677b3e/go.mod h1:o11a+auc7Xhne+gIk8TBNfiB6PVrRtlQc6An5oTqsNU= -github.com/nitrictech/nitric/cloud/common v0.0.0-20230616021604-4036d005db63 h1:IFsLa+GXv2Z7eQrbZp+PaUmgGHGasFHtiBou9F+Y42g= -github.com/nitrictech/nitric/cloud/common v0.0.0-20230616021604-4036d005db63/go.mod h1:nz8/tXPMb5o2yv8g4+NsvDu0dPyrY6iZyXZ1EprenlM= -github.com/nitrictech/nitric/cloud/gcp v0.0.0-20231107054537-4c0047677b3e h1:FHHUTUTuwyZhtnEkrRlHsYz/e5z5ohZ6yTsQ76I59aI= -github.com/nitrictech/nitric/cloud/gcp v0.0.0-20231107054537-4c0047677b3e/go.mod h1:5XvVPEAHn5gV5bbTrnSe1VFKDHSXv3Dq1eLRgtO+9pY= -github.com/nitrictech/nitric/core v0.0.0-20231107054537-4c0047677b3e h1:cRUdiyWj7ukEW9x+qgc7CaAhZmHrEMDmebKWqLCxlxA= -github.com/nitrictech/nitric/core v0.0.0-20231107054537-4c0047677b3e/go.mod h1:iz/seHApmfpML52NVjankr+9izPddUUwZHdcSQEvm9E= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI= -github.com/onsi/ginkgo/v2 v2.8.0/go.mod h1:6JsQiECmxCa3V5st74AL/AmsV482EDdVrGaVW6z3oYU= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= -github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= -github.com/opentracing/basictracer-go v1.1.0 h1:Oa1fTSBvAl8pa3U+IJYqrKm0NALwH9OsgwOqDv4xJW0= -github.com/opentracing/basictracer-go v1.1.0/go.mod h1:V2HZueSJEp879yv285Aap1BS69fQMD+MNP1mRs6mBQc= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= -github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/term v1.1.0 h1:xIAAdCMh3QIAy+5FrE8Ad8XoDhEU4ufwbaSozViP9kk= -github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/pulumi/pulumi/sdk/v3 v3.65.1 h1:cF8n1PLqJ7O6Fj/E015XzLAixaeL3I52BvguAdlRn88= -github.com/pulumi/pulumi/sdk/v3 v3.65.1/go.mod h1:hK2uQnf2SwwvCcaAco3l9+g5mGOkRfR7uqUaZpY/fD8= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI= -github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs= -github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 h1:uIkTLo0AGRc8l7h5l9r+GcYi9qfVPt6lD4/bhmzfiKo= -github.com/santhosh-tekuri/jsonschema/v5 v5.3.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= -github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= -github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/texttheater/golang-levenshtein v1.0.1 h1:+cRNoVrfiwufQPhoMzB6N0Yf/Mqajr6t1lOv8GyGE2U= -github.com/texttheater/golang-levenshtein v1.0.1/go.mod h1:PYAKrbF5sAiq9wd+H82hs7gNaen0CplQ9uvm6+enD/8= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= -github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7 h1:X9dsIWPuuEJlPX//UmRKophhOKCGXc46RVIGuttks68= -github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7/go.mod h1:UxoP3EypF8JfGEjAII8jx1q8rQyDnX8qdTCs/UQBVIE= -github.com/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaOOb6ThwMmTEbhRwtKR97o= -github.com/uber/jaeger-client-go v2.30.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVKhn2Um6rjCsSsg= -github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= -github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= -github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= -github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E= -github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= -github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs= -github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.mongodb.org/mongo-driver v1.11.1 h1:QP0znIRTuL0jf1oBQoAoM0C6ZJfBK4kx0Uumtv1A7w8= -go.mongodb.org/mongo-driver v1.11.1/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.36.4 h1:E85NvhZcKfJtiCI+E2sNjrBHE/anyA3MjbTTiRngGoQ= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.36.4/go.mod h1:sNHaxla2G+y6M3/Jfb3N06CVn/kAZf+8yFwxkIVa/pI= -go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= -go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= -go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -golang.org/x/arch v0.1.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= -golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= -golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= -golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/api v0.114.0 h1:1xQPji6cO2E2vLiI+C/XiFAnsn1WV3mjaEwGLhi3grE= -google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -lukechampine.com/frand v1.4.2 h1:RzFIpOvkMXuPMBb9maa4ND4wjBn71E1Jpf8BzJHMaVw= -lukechampine.com/frand v1.4.2/go.mod h1:4S/TM2ZgrKejMcKMbeLjISpJMO+/eZ1zu3vYX9dtj3s= -pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= -pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= -sourcegraph.com/sourcegraph/appdash v0.0.0-20211028080628-e2786a622600 h1:hfyJ5ku9yFtLVOiSxa3IN+dx5eBQT9mPmKFypAmg8XM= -sourcegraph.com/sourcegraph/appdash v0.0.0-20211028080628-e2786a622600/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/go.work b/go.work index 416326eb5..1155f90e7 100644 --- a/go.work +++ b/go.work @@ -7,5 +7,4 @@ use ( ./cloud/debug ./cloud/gcp ./core - ./e2e ) diff --git a/go.work.sum b/go.work.sum index f61a5f16d..c95e99840 100644 --- a/go.work.sum +++ b/go.work.sum @@ -283,6 +283,7 @@ cloud.google.com/go/iot v1.6.0 h1:39W5BFSarRNZfVG0eXI5LYux+OVQT8GkgpHCnrZL2vM= cloud.google.com/go/iot v1.6.0/go.mod h1:IqdAsmE2cTYYNO1Fvjfzo9po179rAtJeVGUvkLN3rLE= cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0= cloud.google.com/go/kms v1.9.0/go.mod h1:qb1tPTgfF9RQP8e1wq4cLFErVuTJv7UsSC915J8dh3w= +cloud.google.com/go/kms v1.10.1/go.mod h1:rIWk/TryCkR59GMC3YtHtXeLzd634lBbKenvyySAyYI= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.8.0 h1:3Wa+IUMamL4JH3Zd3cDZUHpwyqplTACt6UZKRD2eCL4= cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEyygwpgVKB8= diff --git a/nitric/proto/deployments/v1/deployments.proto b/nitric/proto/deployments/v1/deployments.proto index b76fdc989..5d9bc92f3 100644 --- a/nitric/proto/deployments/v1/deployments.proto +++ b/nitric/proto/deployments/v1/deployments.proto @@ -182,7 +182,7 @@ message Topic { repeated SubscriptionTarget subscriptions = 1; } -message Collection { +message KeyValueStore { } @@ -284,7 +284,7 @@ message Resource { Api api = 13; Policy policy = 14; Schedule schedule = 15; - Collection collection = 16; + KeyValueStore key_value_store = 16; Secret secret = 17; Websocket websocket = 18; Http http = 19; diff --git a/nitric/proto/documents/v1/documents.proto b/nitric/proto/documents/v1/documents.proto deleted file mode 100644 index fdf897ac7..000000000 --- a/nitric/proto/documents/v1/documents.proto +++ /dev/null @@ -1,143 +0,0 @@ -syntax = "proto3"; -package nitric.proto.documents.v1; - -import "google/protobuf/struct.proto"; - -// protoc plugin options for code generation -// option go_package = "nitric/v1;v1"; -option go_package = "github.com/nitrictech/nitric/core/pkg/proto/documents/v1;documentspb"; -option java_package = "io.nitric.proto.documents.v1"; -option java_multiple_files = true; -option java_outer_classname = "Documents"; -option php_namespace = "Nitric\\Proto\\Documents\\V1"; -option csharp_namespace = "Nitric.Proto.Documents.v1"; - -// Service for storage and retrieval of simple JSON keyValue -service Documents { - // Get an existing document - rpc Get (DocumentGetRequest) returns (DocumentGetResponse); - - // Create a new or overwrite an existing document - rpc Set (DocumentSetRequest) returns (DocumentSetResponse); - - // Delete an existing document - rpc Delete (DocumentDeleteRequest) returns (DocumentDeleteResponse); - - // Query the document collection (supports pagination) - rpc Query (DocumentQueryRequest) returns (DocumentQueryResponse); - - // Query the document collection (supports streaming) - rpc QueryStream (DocumentQueryStreamRequest) returns (stream DocumentQueryStreamResponse); -} - -// Message Types - -// Provides a Collection type for storing documents -message Collection { - // The collection name - string name = 1; - - // Optional parent key, required when the collection is a sub-collection of another document - Key parent = 2; -} - -// Provides a document identifying key type -message Key { - // The item collection - Collection collection = 1; - - // The items unique id - string id = 2; -} - -// Provides a return document type -message Document { - // The document content (JSON object) - google.protobuf.Struct content = 1; - // The document's unique key, including collection/sub-collections - Key key = 2; -} - -message ExpressionValue { - // The kind of value. - oneof kind { - // Represents an integer value. - int64 int_value = 1; - // Represents a double value. - double double_value = 2; - // Represents a string value. - string string_value = 3; - // Represents a boolean value. - bool bool_value = 4; - } -} - -// Provides a query expression type -message Expression { - // The query operand or attribute - string operand = 1; - // The query operator [ == | < | <= | > | >= | startsWith ] - string operator = 2; - // The query expression value - ExpressionValue value = 3; -} - -// Service Request & Response Messages - -message DocumentGetRequest { - // Key of the document to retrieve - Key key = 1; -} - -message DocumentGetResponse { - // The retrieved value - Document document = 1; -} - -message DocumentSetRequest { - // Key of the document to set - Key key = 1 ; - // The document content to store (JSON object) - google.protobuf.Struct content = 3; -} - -message DocumentSetResponse {} - -message DocumentDeleteRequest { - // Key of the document to delete - Key key = 1; -} - -message DocumentDeleteResponse {} - -message DocumentQueryRequest { - // The collection to query - Collection collection = 1; - // Optional query expressions - repeated Expression expressions = 3; - // Optional query fetch limit - int32 limit = 4; - // Optional query paging continuation token - map paging_token = 5; -} - -message DocumentQueryResponse { - // The retrieved values - repeated Document documents = 1; - // The query paging continuation token, when empty no further results are available - map paging_token = 2; -} - -message DocumentQueryStreamRequest { - // The collection to query - Collection collection = 1; - // Optional query expressions - repeated Expression expressions = 3; - // Optional query fetch limit - int32 limit = 4; -} - -message DocumentQueryStreamResponse { - // The stream document - Document document = 1; -} \ No newline at end of file diff --git a/nitric/proto/keyvalue/v1/keyvalue.proto b/nitric/proto/keyvalue/v1/keyvalue.proto new file mode 100644 index 000000000..953b46018 --- /dev/null +++ b/nitric/proto/keyvalue/v1/keyvalue.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; +package nitric.proto.KeyValue.v1; + +import "google/protobuf/struct.proto"; + +// protoc plugin options for code generation +// option go_package = "nitric/v1;v1"; +option go_package = "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1;KeyValuepb"; +option java_package = "io.nitric.proto.keyvalue.v1"; +option java_multiple_files = true; +option java_outer_classname = "KeyValue"; +option php_namespace = "Nitric\\Proto\\KeyValue\\V1"; +option csharp_namespace = "Nitric.Proto.KeyValue.v1"; + +// Service for storage and retrieval of simple JSON keyValue +service KeyValue { + // Get an existing document + rpc Get (KeyValueGetRequest) returns (KeyValueGetResponse); + + // Create a new or overwrite an existing document + rpc Set (KeyValueSetRequest) returns (KeyValueSetResponse); + + // Delete an existing document + rpc Delete (KeyValueDeleteRequest) returns (KeyValueDeleteResponse); +} + +// Provides a Collection type for storing documents +message Store { + // The store name + string name = 1; +} + +// Provides a document identifying key type +message Key { + // The item collection + string store = 1; + + // The items unique key + string key = 2; +} + +// Provides a return document type +message Value { + // The document's unique key, including collection/sub-collections + Key key = 1; + + // The document content (JSON object) + google.protobuf.Struct content = 2; +} + +// Service Request & Response Messages + +message KeyValueGetRequest { + // Key of the document to retrieve + Key key = 1; +} + +message KeyValueGetResponse { + // The retrieved value + Value value = 1; +} + +message KeyValueSetRequest { + // Key of the document to set + Key key = 1 ; + // The document content to store (JSON object) + google.protobuf.Struct content = 3; +} + +message KeyValueSetResponse {} + +message KeyValueDeleteRequest { + // Key of the document to delete + Key key = 1; +} + +message KeyValueDeleteResponse {} diff --git a/nitric/proto/resources/v1/resources.proto b/nitric/proto/resources/v1/resources.proto index 630fca497..a84548bcf 100644 --- a/nitric/proto/resources/v1/resources.proto +++ b/nitric/proto/resources/v1/resources.proto @@ -31,7 +31,7 @@ enum ResourceType { Topic = 3; Schedule = 4; Subscription = 5; - Collection = 6; + KeyValueStore = 6; Policy = 7; Secret = 8; BucketListener = 9; @@ -53,7 +53,7 @@ message ResourceDeclareRequest { PolicyResource policy = 10; BucketResource bucket = 11; TopicResource topic = 12; - CollectionResource collection = 13; + KeyValueStoreResource key_value_store = 13; SecretResource secret = 14; ApiResource api = 15; ApiSecurityDefinitionResource api_security_definition = 16; @@ -62,7 +62,7 @@ message ResourceDeclareRequest { message BucketResource {} message TopicResource {} -message CollectionResource {} +message KeyValueStoreResource {} message SecretResource {} message ApiOpenIdConnectionDefinition { @@ -101,11 +101,9 @@ enum Action { TopicEventPublish = 202; // Collection Permissions: 3XX - CollectionDocumentRead = 300; - CollectionDocumentWrite = 301; - CollectionDocumentDelete = 302; - CollectionQuery = 303; - CollectionList = 304; + KeyValueStoreRead = 300; + KeyValueStoreWrite = 301; + KeyValueStoreDelete = 302; // Secret Permissions: 5XX SecretPut = 400; From fad1553efe20a830b814ae71308172fd82fb1e17 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 09:59:42 +1100 Subject: [PATCH 02/13] add key value store to provider interface. --- cloud/common/deploy/provider/provider.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cloud/common/deploy/provider/provider.go b/cloud/common/deploy/provider/provider.go index 640111db6..452d660dc 100644 --- a/cloud/common/deploy/provider/provider.go +++ b/cloud/common/deploy/provider/provider.go @@ -53,6 +53,8 @@ type NitricPulumiProvider interface { Websocket(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Websocket) error // Policy - Deploy a Policy Policy(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Policy) error + // KeyValueStore - Deploy a Key Value Store + KeyValueStore(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.KeyValueStore) error // Post - Called after all resources have been created, before the Pulumi Context is concluded Post(ctx *pulumi.Context) error From 881b1db39993b020e3d2e34d17c338b3883c2da2 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 10:08:07 +1100 Subject: [PATCH 03/13] add key value store to common and aws. --- cloud/aws/deploy/deploy.go | 4 +- cloud/aws/deploy/keyvalue.go | 93 ++++++++++++++++++++++++ cloud/aws/deploy/keyvalue/dynamodb.go | 68 ----------------- cloud/aws/deploy/policy.go | 11 +-- cloud/common/deploy/provider/provider.go | 1 + cloud/common/deploy/provider/pulumi.go | 2 + 6 files changed, 99 insertions(+), 80 deletions(-) create mode 100644 cloud/aws/deploy/keyvalue.go delete mode 100644 cloud/aws/deploy/keyvalue/dynamodb.go diff --git a/cloud/aws/deploy/deploy.go b/cloud/aws/deploy/deploy.go index 1ea54f37f..d56d3b1a4 100644 --- a/cloud/aws/deploy/deploy.go +++ b/cloud/aws/deploy/deploy.go @@ -62,8 +62,8 @@ type NitricAwsPulumiProvider struct { buckets map[string]*s3.Bucket bucketNotifications map[string]*s3.BucketNotification topics map[string]*topic - collections map[string]*dynamodb.Table websockets map[string]*apigatewayv2.Api + keyValueStores map[string]*dynamodb.Table provider.NitricDefaultOrder @@ -179,8 +179,8 @@ func NewNitricAwsProvider() *NitricAwsPulumiProvider { secrets: make(map[string]*secretsmanager.Secret), buckets: make(map[string]*s3.Bucket), bucketNotifications: make(map[string]*s3.BucketNotification), - collections: make(map[string]*dynamodb.Table), websockets: make(map[string]*apigatewayv2.Api), topics: make(map[string]*topic), + keyValueStores: make(map[string]*dynamodb.Table), } } diff --git a/cloud/aws/deploy/keyvalue.go b/cloud/aws/deploy/keyvalue.go new file mode 100644 index 000000000..90a279498 --- /dev/null +++ b/cloud/aws/deploy/keyvalue.go @@ -0,0 +1,93 @@ +// Copyright Nitric Pty Ltd. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package deploy + +import ( + "github.com/nitrictech/nitric/cloud/common/deploy/resources" + "github.com/nitrictech/nitric/cloud/common/deploy/tags" + deploymentspb "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1" + v1 "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1" + "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/dynamodb" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +) + +type DynamodbKeyValueStore struct { + pulumi.ResourceState + + Table *dynamodb.Table + Name string +} + +type DynamodbKeyValueStoreArgs struct { + StackID string + KeyValueStore *v1.KeyValueStore +} + +func (n *NitricAwsPulumiProvider) KeyValueStore(ctx *pulumi.Context, parent pulumi.Resource, name string, keyvalue *deploymentspb.KeyValueStore) error { + var err error + opts := []pulumi.ResourceOption{pulumi.Parent(parent)} + + n.keyValueStores[name], err = dynamodb.NewTable(ctx, name, &dynamodb.TableArgs{ + Attributes: dynamodb.TableAttributeArray{ + &dynamodb.TableAttributeArgs{ + Name: pulumi.String("_pk"), + Type: pulumi.String("S"), + }, + &dynamodb.TableAttributeArgs{ + Name: pulumi.String("_sk"), + Type: pulumi.String("S"), + }, + }, + HashKey: pulumi.String("_pk"), + RangeKey: pulumi.String("_sk"), + BillingMode: pulumi.String("PAY_PER_REQUEST"), + Tags: pulumi.ToStringMap(tags.Tags(n.stackId, name, resources.Collection)), + }, opts...) + + return err +} + +// func NewDynamodbKeyValueStore(ctx *pulumi.Context, name string, args *DynamodbKeyValueStoreArgs, opts ...pulumi.ResourceOption) (*DynamodbKeyValueStore, error) { +// res := &DynamodbKeyValueStore{Name: name} + +// err := ctx.RegisterComponentResource("nitric:keyvalue:Dynamodb", name, res, opts...) +// if err != nil { +// return nil, err +// } + +// res.Table, err = dynamodb.NewTable(ctx, name, &dynamodb.TableArgs{ +// Attributes: dynamodb.TableAttributeArray{ +// &dynamodb.TableAttributeArgs{ +// Name: pulumi.String("_pk"), +// Type: pulumi.String("S"), +// }, +// &dynamodb.TableAttributeArgs{ +// Name: pulumi.String("_sk"), +// Type: pulumi.String("S"), +// }, +// }, +// HashKey: pulumi.String("_pk"), +// RangeKey: pulumi.String("_sk"), +// BillingMode: pulumi.String("PAY_PER_REQUEST"), +// Tags: pulumi.ToStringMap(tags.Tags(args.StackID, name, resources.Collection)), +// }) +// if err != nil { +// return nil, err +// } + +// return res, nil +// } diff --git a/cloud/aws/deploy/keyvalue/dynamodb.go b/cloud/aws/deploy/keyvalue/dynamodb.go deleted file mode 100644 index 235250ed0..000000000 --- a/cloud/aws/deploy/keyvalue/dynamodb.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright Nitric Pty Ltd. -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package keyvalue - -import ( - "github.com/nitrictech/nitric/cloud/common/deploy/resources" - "github.com/nitrictech/nitric/cloud/common/deploy/tags" - v1 "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1" - "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/dynamodb" - "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -) - -type DynamodbKeyValueStore struct { - pulumi.ResourceState - - Table *dynamodb.Table - Name string -} - -type DynamodbKeyValueStoreArgs struct { - StackID string - KeyValueStore *v1.KeyValueStore -} - -func NewDynamodbKeyValueStore(ctx *pulumi.Context, name string, args *DynamodbKeyValueStoreArgs, opts ...pulumi.ResourceOption) (*DynamodbKeyValueStore, error) { - res := &DynamodbKeyValueStore{Name: name} - - err := ctx.RegisterComponentResource("nitric:keyvalue:Dynamodb", name, res, opts...) - if err != nil { - return nil, err - } - - res.Table, err = dynamodb.NewTable(ctx, name, &dynamodb.TableArgs{ - Attributes: dynamodb.TableAttributeArray{ - &dynamodb.TableAttributeArgs{ - Name: pulumi.String("_pk"), - Type: pulumi.String("S"), - }, - &dynamodb.TableAttributeArgs{ - Name: pulumi.String("_sk"), - Type: pulumi.String("S"), - }, - }, - HashKey: pulumi.String("_pk"), - RangeKey: pulumi.String("_sk"), - BillingMode: pulumi.String("PAY_PER_REQUEST"), - Tags: pulumi.ToStringMap(tags.Tags(args.StackID, name, resources.Collection)), - }) - if err != nil { - return nil, err - } - - return res, nil -} diff --git a/cloud/aws/deploy/policy.go b/cloud/aws/deploy/policy.go index 4da63d11c..21c6ca415 100644 --- a/cloud/aws/deploy/policy.go +++ b/cloud/aws/deploy/policy.go @@ -110,7 +110,7 @@ func (a *NitricAwsPulumiProvider) arnForResource(resource *deploymentspb.Resourc return []interface{}{t.sns.Arn, t.sfn.Arn}, nil } case resourcespb.ResourceType_KeyValueStore: - if c, ok := a.collections[resource.Id.Name]; ok { + if c, ok := a.keyValueStores[resource.Id.Name]; ok { return []interface{}{c.Arn}, nil } case resourcespb.ResourceType_Secret: @@ -145,13 +145,6 @@ func (a *NitricAwsPulumiProvider) roleForPrincipal(resource *deploymentspb.Resou func (a *NitricAwsPulumiProvider) Policy(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Policy) error { opts := []pulumi.ResourceOption{pulumi.Parent(parent)} - // res := &Policy{Name: name, RolePolicies: make([]*iam.RolePolicy, 0)} - - // err := ctx.RegisterComponentResource("nitric:policy:AwsIamPolicy", name, res, opts...) - // if err != nil { - // return nil, err - // } - // Get Actions actions := actionsToAwsActions(config.Actions) @@ -227,8 +220,6 @@ func (a *NitricAwsPulumiProvider) Policy(ctx *pulumi.Context, parent pulumi.Reso if err != nil { return err } - - // res.RolePolicies = append(res.RolePolicies, rolePol) } return nil diff --git a/cloud/common/deploy/provider/provider.go b/cloud/common/deploy/provider/provider.go index 452d660dc..6dc7acbf5 100644 --- a/cloud/common/deploy/provider/provider.go +++ b/cloud/common/deploy/provider/provider.go @@ -78,6 +78,7 @@ func (*NitricDefaultOrder) Order(resources []*deploymentspb.Resource) []*deploym resourcespb.ResourceType_Secret, resourcespb.ResourceType_Topic, resourcespb.ResourceType_Bucket, + resourcespb.ResourceType_KeyValueStore, resourcespb.ResourceType_Api, resourcespb.ResourceType_Http, resourcespb.ResourceType_Policy, diff --git a/cloud/common/deploy/provider/pulumi.go b/cloud/common/deploy/provider/pulumi.go index f5ed26b04..88de43552 100644 --- a/cloud/common/deploy/provider/pulumi.go +++ b/cloud/common/deploy/provider/pulumi.go @@ -78,6 +78,8 @@ func createPulumiProgramForNitricProvider(req *deploymentspb.DeploymentUpRequest err = nitricProvider.Policy(ctx, parent, res.Id.Name, t.Policy) case *deploymentspb.Resource_Http: err = nitricProvider.Http(ctx, parent, res.Id.Name, t.Http) + case *deploymentspb.Resource_KeyValueStore: + err = nitricProvider.KeyValueStore(ctx, parent, res.Id.Name, t.KeyValueStore) } if err != nil { return err From 6801381cea19f5d177a957aa62cb814c43d015f0 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 10:14:40 +1100 Subject: [PATCH 04/13] add storage table deployments to azure. --- cloud/azure/deploy/deploy.go | 11 +++++++---- cloud/azure/deploy/keyvalue.go | 20 ++++++++++++++++++++ cloud/gcp/deploy/keyvalue.go | 11 +++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 cloud/azure/deploy/keyvalue.go create mode 100644 cloud/gcp/deploy/keyvalue.go diff --git a/cloud/azure/deploy/deploy.go b/cloud/azure/deploy/deploy.go index caad2ccda..e54cc705c 100644 --- a/cloud/azure/deploy/deploy.go +++ b/cloud/azure/deploy/deploy.go @@ -69,6 +69,8 @@ type NitricAzurePulumiProvider struct { containerApps map[string]*ContainerApp topics map[string]*eventgrid.Topic + keyValueStores map[string]*storage.Table + roles *Roles provider.NitricDefaultOrder } @@ -270,9 +272,10 @@ func (a *NitricAzurePulumiProvider) Post(ctx *pulumi.Context) error { func NewNitricAzurePulumiProvider() *NitricAzurePulumiProvider { return &NitricAzurePulumiProvider{ - buckets: make(map[string]*storage.BlobContainer), - containerApps: map[string]*ContainerApp{}, - topics: map[string]*eventgrid.Topic{}, - principals: map[resourcespb.ResourceType]map[string]*ServicePrincipal{}, + buckets: make(map[string]*storage.BlobContainer), + containerApps: map[string]*ContainerApp{}, + topics: map[string]*eventgrid.Topic{}, + principals: map[resourcespb.ResourceType]map[string]*ServicePrincipal{}, + keyValueStores: map[string]*storage.Table{}, } } diff --git a/cloud/azure/deploy/keyvalue.go b/cloud/azure/deploy/keyvalue.go new file mode 100644 index 000000000..b13a6db78 --- /dev/null +++ b/cloud/azure/deploy/keyvalue.go @@ -0,0 +1,20 @@ +package deploy + +import ( + deploymentspb "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1" + "github.com/pulumi/pulumi-azure-native-sdk/storage" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +) + +func (p *NitricAzurePulumiProvider) KeyValueStore(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.KeyValueStore) error { + var err error + opts := []pulumi.ResourceOption{pulumi.Parent(parent)} + + p.keyValueStores[name], err = storage.NewTable(ctx, name, &storage.TableArgs{ + AccountName: p.storageAccount.Name, + ResourceGroupName: p.resourceGroup.Name, + TableName: pulumi.String(name), + }, opts...) + + return err +} diff --git a/cloud/gcp/deploy/keyvalue.go b/cloud/gcp/deploy/keyvalue.go new file mode 100644 index 000000000..d0a60fe10 --- /dev/null +++ b/cloud/gcp/deploy/keyvalue.go @@ -0,0 +1,11 @@ +package deploy + +import ( + deploymentspb "github.com/nitrictech/nitric/core/pkg/proto/deployments/v1" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" +) + +func (p *NitricGcpPulumiProvider) KeyValueStore(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.KeyValueStore) error { + // keyvalue stores are created at runtime in GCP, so we don't need to do anything here. + return nil +} From f52793a9fed10c6c598600bf3e1e190bb0c80e61 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 11:37:59 +1100 Subject: [PATCH 05/13] add azure storage tables keyvalue implementation. --- cloud/azure/runtime/env/variables.go | 8 +- cloud/azure/runtime/keyvalue/keyvalue.go | 215 +++++++++++++++++++++++ cloud/gcp/go.mod | 20 ++- cloud/gcp/go.sum | 50 ++++++ go.work.sum | 13 +- 5 files changed, 294 insertions(+), 12 deletions(-) create mode 100644 cloud/azure/runtime/keyvalue/keyvalue.go diff --git a/cloud/azure/runtime/env/variables.go b/cloud/azure/runtime/env/variables.go index 9c83499b9..e49ac4476 100644 --- a/cloud/azure/runtime/env/variables.go +++ b/cloud/azure/runtime/env/variables.go @@ -24,10 +24,10 @@ var ( var KVAULT_NAME = env.GetEnv("KVAULT_NAME", "") -var ( - AZURE_STORAGE_BLOB_ENDPOINT = env.GetEnv("AZURE_STORAGE_ACCOUNT_BLOB_ENDPOINT", "") - AZURE_STORAGE_QUEUE_ENDPOINT = env.GetEnv("AZURE_STORAGE_ACCOUNT_QUEUE_ENDPOINT", "") -) +var AZURE_STORAGE_ACCOUNT_NAME = env.GetEnv("AZURE_STORAGE_ACCOUNT_NAME", "") + +var AZURE_STORAGE_BLOB_ENDPOINT = env.GetEnv("AZURE_STORAGE_ACCOUNT_BLOB_ENDPOINT", "") +var AZURE_STORAGE_QUEUE_ENDPOINT = env.GetEnv("AZURE_STORAGE_ACCOUNT_QUEUE_ENDPOINT", "") // mongoDBConnectionString := utils.GetEnv(mongoDBConnectionStringEnvVarName, "") diff --git a/cloud/azure/runtime/keyvalue/keyvalue.go b/cloud/azure/runtime/keyvalue/keyvalue.go new file mode 100644 index 000000000..4d8067170 --- /dev/null +++ b/cloud/azure/runtime/keyvalue/keyvalue.go @@ -0,0 +1,215 @@ +// Copyright 2021 Nitric Pty Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package keyvalue + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/data/aztables" + "github.com/nitrictech/nitric/cloud/aws/runtime/resource" + "github.com/nitrictech/nitric/cloud/azure/runtime/env" + document "github.com/nitrictech/nitric/core/pkg/decorators/keyvalue" + grpc_errors "github.com/nitrictech/nitric/core/pkg/grpc/errors" + keyvaluepb "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1" + "github.com/pkg/errors" + "google.golang.org/grpc/codes" + "google.golang.org/protobuf/types/known/structpb" +) + +// DynamoKeyValueService - an AWS DynamoDB implementation of the Nitric Document Service +type AzureStorageTableKeyValueService struct { + clientFactory AzureStorageClientFactory +} + +var _ keyvaluepb.KeyValueServer = &AzureStorageTableKeyValueService{} + +type AztableEntity struct { + aztables.Entity + + Content *structpb.Struct +} + +// Get a document from the DynamoDB table +func (s *AzureStorageTableKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValueGetRequest) (*keyvaluepb.KeyValueGetResponse, error) { + newErr := grpc_errors.ErrorsWithScope("AzureStorageTableKeyValueService.Get") + client, err := s.clientFactory(req.Key.Store) + + if err != nil { + return nil, newErr( + codes.Internal, + "Unable to create client", + err, + ) + } + + err = document.ValidateKey(req.Key) + if err != nil { + return nil, newErr( + codes.InvalidArgument, + "Invalid key", + err, + ) + } + + response, err := client.GetEntity(ctx, req.Key.Store, req.Key.Key, nil) + if err != nil { + return nil, newErr( + codes.InvalidArgument, + "failed to call aztables:GetEntity", + err, + ) + } + + var entity AztableEntity + err = json.Unmarshal(response.Value, &entity) + if err != nil { + return nil, newErr( + codes.Internal, + "Unable to convert value to pb struct", + err, + ) + } + + return &keyvaluepb.KeyValueGetResponse{ + Value: &keyvaluepb.Value{ + Key: req.Key, + Content: entity.Content, + }, + }, nil +} + +// Set a document in the DynamoDB table +func (s *AzureStorageTableKeyValueService) Set(ctx context.Context, req *keyvaluepb.KeyValueSetRequest) (*keyvaluepb.KeyValueSetResponse, error) { + newErr := grpc_errors.ErrorsWithScope("AzureStorageTableKeyValueService.Set") + client, err := s.clientFactory(req.Key.Store) + + if err != nil { + return nil, newErr( + codes.Internal, + "Unable to create client", + err, + ) + } + + if err := document.ValidateKey(req.Key); err != nil { + return nil, newErr( + codes.InvalidArgument, + "invalid key", + err, + ) + } + + entity := AztableEntity{ + Entity: aztables.Entity{ + PartitionKey: req.Key.Store, + RowKey: req.Key.Key, + }, + Content: req.Content, + } + + entityJson, err := json.Marshal(entity) + if err != nil { + return nil, newErr( + codes.Internal, + "Unable to struct to json", + err, + ) + } + + _, err = client.UpsertEntity(ctx, entityJson, nil) + if err != nil { + return nil, newErr( + codes.Internal, + "Unable to call aztables.UpsertEntity", + err, + ) + } + + return &keyvaluepb.KeyValueSetResponse{}, nil +} + +// Delete a document from the DynamoDB table +func (s *AzureStorageTableKeyValueService) Delete(ctx context.Context, req *keyvaluepb.KeyValueDeleteRequest) (*keyvaluepb.KeyValueDeleteResponse, error) { + newErr := grpc_errors.ErrorsWithScope("AzureStorageTableKeyValueService.Delete") + client, err := s.clientFactory(req.Key.Store) + + if err != nil { + return nil, newErr( + codes.Internal, + "Unable to create client", + err, + ) + } + + if err := document.ValidateKey(req.Key); err != nil { + return nil, newErr( + codes.InvalidArgument, + "invalid key", + err, + ) + } + + _, err = client.DeleteEntity(ctx, req.Key.Store, req.Key.Key, nil) + if err != nil { + return nil, newErr( + codes.Internal, + "failed to call aztables.DeleteEntity", + err, + ) + } + + return &keyvaluepb.KeyValueDeleteResponse{}, nil +} + +type AzureStorageClientFactory func(tableName string) (*aztables.Client, error) + +func newStorageTablesClientFactory(creds *azidentity.DefaultAzureCredential, storageAccountName string) AzureStorageClientFactory { + return func(tableName string) (*aztables.Client, error) { + serviceURL := fmt.Sprintf("https://%s.table.core.windows.net/%s", storageAccountName, tableName) + return aztables.NewClient(serviceURL, creds, nil) + } +} + +// New creates a new AWS DynamoDB implementation of a DocumentServiceServer +func New(provider resource.AwsResourceProvider) (*AzureStorageTableKeyValueService, error) { + storageAccountName := env.AZURE_STORAGE_ACCOUNT_NAME.String() + if storageAccountName == "" { + return nil, fmt.Errorf("failed to determine Azure Storage Account name, environment variable not set") + } + + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + return nil, errors.Wrap(err, "failed to locate default azure credential") + } + + return &AzureStorageTableKeyValueService{ + clientFactory: newStorageTablesClientFactory(cred, storageAccountName), + }, nil + +} + +// NewWithClient creates a DocumentServiceServer with an given DynamoDB client instance. +// +// Primarily used for testing +func NewWithClient(provider resource.AwsResourceProvider, clientFactory AzureStorageClientFactory) (*AzureStorageTableKeyValueService, error) { + return &AzureStorageTableKeyValueService{ + // storageAccountName: storageAccountName, + // defaultCredential: cred, + clientFactory: clientFactory, + }, nil +} diff --git a/cloud/gcp/go.mod b/cloud/gcp/go.mod index 5ed9adcb5..0ca0b534b 100644 --- a/cloud/gcp/go.mod +++ b/cloud/gcp/go.mod @@ -77,8 +77,8 @@ require ( github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - golang.org/x/crypto v0.8.0 // indirect - golang.org/x/term v0.7.0 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/term v0.15.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect lukechampine.com/frand v1.4.2 // indirect sourcegraph.com/sourcegraph/appdash v0.0.0-20211028080628-e2786a622600 // indirect @@ -97,7 +97,12 @@ require ( github.com/Abirdcfly/dupword v0.0.11 // indirect github.com/Antonboom/errname v0.1.9 // indirect github.com/Antonboom/nilnil v0.1.3 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.1.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 // indirect github.com/BurntSushi/toml v1.2.1 // indirect github.com/Djarvur/go-err113 v0.1.0 // indirect github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect @@ -155,6 +160,7 @@ require ( github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.8.1 // indirect + github.com/golang-jwt/jwt/v5 v5.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect @@ -168,7 +174,7 @@ require ( github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/licenseclassifier v0.0.0-20201113175434-78a70215ca36 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/google/uuid v1.5.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect github.com/gookit/color v1.5.2 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect @@ -194,6 +200,7 @@ require ( github.com/klauspost/compress v1.16.3 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.6 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/ldez/gomoddirectives v0.2.3 // indirect github.com/ldez/tagliatelle v0.4.0 // indirect @@ -231,6 +238,7 @@ require ( github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polyfloyd/go-errorlint v1.4.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect @@ -300,10 +308,10 @@ require ( golang.org/x/exp v0.0.0-20221114191408-850992195362 // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.9.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.7.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.8.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect diff --git a/cloud/gcp/go.sum b/cloud/gcp/go.sum index abad65e66..e8c68870a 100644 --- a/cloud/gcp/go.sum +++ b/cloud/gcp/go.sum @@ -74,8 +74,22 @@ github.com/Antonboom/errname v0.1.9 h1:BZDX4r3l4TBZxZ2o2LNrlGxSHran4d1u4veZdoORT github.com/Antonboom/errname v0.1.9/go.mod h1:nLTcJzevREuAsgTbG85UsuiWpMpAqbKD1HNZ29OzE58= github.com/Antonboom/nilnil v0.1.3 h1:6RTbx3d2mcEu3Zwq9TowQpQMVpP75zugwOtqY1RTtcE= github.com/Antonboom/nilnil v0.1.3/go.mod h1:iOov/7gRcXkeEU+EMGpBu2ORih3iyVEiWjeste1SJm8= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 h1:lGlwhPtrX6EVml1hO0ivjkUxsSyl4dsiw9qcA1k/3IQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1/go.mod h1:RKUqNu35KJYcVG/fqTRqmuXJZYNhYkBrnC/hX7yGbTA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo= +github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.1.0 h1:ONYihl/vbwtVAmEmqoVDCGyhad2CIMN2kg3BO8Y5cFk= +github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.1.0/go.mod h1:PMB5kQ1apg/irrvpPryVdchapVIYP+VV9iHJQ2CHwG8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 h1:6oNBlSdi1QqM1PNW7FPA6xOGA5UNsXnkaYZz9vdPGhA= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -134,6 +148,7 @@ github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5Fc github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= +github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -167,6 +182,7 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= github.com/charmbracelet/bubbletea v0.24.2 h1:uaQIKx9Ai6Gdh5zpTbGiWpytMU+CfsPp06RaW2cx/SY= +github.com/charmbracelet/bubbletea v0.24.2/go.mod h1:XdrNrV4J8GiyshTtx3DNuYkR1FDaJmO3l2nejekbsgg= github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 h1:W9o46d2kbNL06lq7UNDPV0zYLzkrde/bjIqO02eoll0= github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8/go.mod h1:gakxgyXaaPkxvLw1XQxNGK4I37ys9iBRzNUx/B7pUCo= github.com/cheggaaa/pb v1.0.29 h1:FckUN5ngEk2LpvuG0fw1GEFx6LtyY2pWI/Z2QgCnEYo= @@ -188,6 +204,7 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= +github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -314,6 +331,8 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= +github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.1 h1:jxpi2eWoU84wbX9iIEyAeeoac3FLuifZpY9tcNUD9kw= @@ -411,6 +430,9 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -521,6 +543,8 @@ github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= github.com/kunwardeep/paralleltest v1.0.6 h1:FCKYMF1OF2+RveWlABsdnmsvJrei5aoyZoaGS+Ugg8g= github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= @@ -559,8 +583,10 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= +github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -590,9 +616,13 @@ github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9k github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34= +github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= +github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= +github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= @@ -649,6 +679,8 @@ github.com/perimeterx/marshmallow v1.1.4 h1:pZLDH9RjlLGGorbXhcaQLhfuV0pFMNfPO55F github.com/perimeterx/marshmallow v1.1.4/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -712,6 +744,7 @@ github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -802,6 +835,7 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= @@ -918,6 +952,9 @@ golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58 golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1020,6 +1057,10 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1127,6 +1168,9 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1140,6 +1184,8 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1156,6 +1202,10 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/go.work.sum b/go.work.sum index c95e99840..62fa0fe7d 100644 --- a/go.work.sum +++ b/go.work.sum @@ -688,6 +688,7 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczC github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954 h1:RMLoZVzv4GliuWafOuPuQDKSm1SJph7uCRnnS61JAn4= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog= @@ -811,6 +812,7 @@ github.com/google/trillian v1.3.11/go.mod h1:0tPraVHrSDkA3BO6vKX67zgLXs6SsOAbHEi github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/wire v0.5.0 h1:I7ELFeVBr3yfPIcc8+MWvrjk+3VjbcSzoXm3JVa+jD8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= @@ -961,8 +963,6 @@ github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kulti/thelper v0.5.1/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= github.com/kunwardeep/paralleltest v1.0.3/go.mod h1:vLydzomDFpk7yu5UX02RmP0H8QfRPOV/oFhWN85Mjb4= github.com/kurin/blazer v0.5.3 h1:SAgYv0TKU0kN/ETfO5ExjNAPyMt2FocO2s/UlCHfjAk= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= github.com/ldez/gomoddirectives v0.2.2/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= @@ -1038,6 +1038,8 @@ github.com/mmcloughlin/avo v0.5.0 h1:nAco9/aI9Lg2kiuROBY6BhCI/z0t5jEvJfjWbL8qXLU github.com/moby/moby v20.10.21+incompatible h1:LfdCNzNpDYtOTtlO5wxLcUEk0nyM3KqPyeIyXVdvl/U= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/montanaflynn/stats v0.7.0 h1:r3y12KyNxj/Sb/iOE46ws+3mS1+MZca1wlHQFPsY/JU= +github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1/go.mod h1:FIczTrinKo8VaLxe6PWTPEXRXDIHz2QAwiaBaP5/4a8= github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5 h1:0KqC6/sLy7fDpBdybhVkkv4Yz+PmB7c9Dz9z3dLW804= github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s= @@ -1100,6 +1102,7 @@ github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c h1:xpW9bvK+HuuTm github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00 h1:C3N3itkduZXDZFh4N3vQ5HEtld3S+Y+StULhWVvumU0= github.com/pingcap/kvproto v0.0.0-20221026112947-f8d61344b172 h1:FYgKV9znRQmzVrrJDZ0gUfMIvKLAMU1tu1UKJib8bEQ= github.com/pingcap/log v1.1.1-0.20221015072633-39906604fb81 h1:URLoJ61DmmY++Sa/yyPEQHG2s/ZBeV1FbIswHEMrdoY= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= github.com/pkg/sftp v1.13.1 h1:I2qBYMChEhIjOgazfJmV3/mZM256btk6wkCDRmW7JYs= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -1374,6 +1377,8 @@ golang.org/x/crypto v0.0.0-20221012134737-56aed061732a/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= @@ -1412,6 +1417,7 @@ golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220805013720-a33c5aa5df48/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= @@ -1467,7 +1473,10 @@ golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220823224334-20c2bfdbfe24/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 3c346b23a47144040dcb5403c5d0a5424fb04673 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 11:39:45 +1100 Subject: [PATCH 06/13] plugin new aztables implementation and remove mongodb implementation. --- cloud/azure/cmd/runtime/main.go | 4 +- cloud/azure/runtime/document/mongodb.go | 250 ----------------------- cloud/azure/runtime/keyvalue/keyvalue.go | 2 +- 3 files changed, 3 insertions(+), 253 deletions(-) delete mode 100644 cloud/azure/runtime/document/mongodb.go diff --git a/cloud/azure/cmd/runtime/main.go b/cloud/azure/cmd/runtime/main.go index b9ad066b7..1cadc2dca 100644 --- a/cloud/azure/cmd/runtime/main.go +++ b/cloud/azure/cmd/runtime/main.go @@ -24,8 +24,8 @@ import ( "github.com/nitrictech/nitric/cloud/azure/runtime/api" "github.com/nitrictech/nitric/cloud/azure/runtime/resource" - mongodb_service "github.com/nitrictech/nitric/cloud/azure/runtime/document" http_service "github.com/nitrictech/nitric/cloud/azure/runtime/gateway" + aztables_service "github.com/nitrictech/nitric/cloud/azure/runtime/keyvalue" key_vault "github.com/nitrictech/nitric/cloud/azure/runtime/secret" azblob_service "github.com/nitrictech/nitric/cloud/azure/runtime/storage" event_grid "github.com/nitrictech/nitric/cloud/azure/runtime/topic" @@ -47,7 +47,7 @@ func main() { membraneOpts.ApiPlugin = api.NewAzureApiGatewayProvider(provider) - membraneOpts.KeyValuePlugin, err = mongodb_service.New() + membraneOpts.KeyValuePlugin, err = aztables_service.New() if err != nil { log.Default().Println("Failed to load document plugin:", err.Error()) } diff --git a/cloud/azure/runtime/document/mongodb.go b/cloud/azure/runtime/document/mongodb.go deleted file mode 100644 index 3f1c1d4ff..000000000 --- a/cloud/azure/runtime/document/mongodb.go +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package document - -import ( - "context" - "errors" - "fmt" - "time" - - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" - "google.golang.org/grpc/codes" - "google.golang.org/protobuf/types/known/structpb" - - "github.com/nitrictech/nitric/cloud/azure/runtime/env" - "github.com/nitrictech/nitric/core/pkg/decorators/keyvalue" - grpc_errors "github.com/nitrictech/nitric/core/pkg/grpc/errors" - keyvaluepb "github.com/nitrictech/nitric/core/pkg/proto/keyvalue/v1" -) - -const ( - // environment variables - mongoDBConnectionStringEnvVarName = "MONGODB_CONNECTION_STRING" - mongoDBDatabaseEnvVarName = "MONGODB_DATABASE" - mongoDBSetDirectEnvVarName = "MONGODB_DIRECT" - - primaryKeyAttr = "_id" - parentKeyAttr = "_parent_id" - childrenAttr = "_child_colls" -) - -type MongoDocService struct { - client *mongo.Client - db *mongo.Database -} - -var _ keyvaluepb.KeyValueServer = &MongoDocService{} - -// Get a document from the mongo collection -func (s *MongoDocService) Get(ctx context.Context, req *keyvaluepb.KeyValueGetRequest) (*keyvaluepb.KeyValueGetResponse, error) { - newErr := grpc_errors.ErrorsWithScope("MongoDocService.Get") - - if err := keyvalue.ValidateKey(req.Key); err != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid key", - err, - ) - } - - col := s.getCollection(req.Key) - docRef := bson.M{primaryKeyAttr: req.Key.Key} - - var value map[string]interface{} - - opts := options.FindOne() - - // Remove meta data IDs and child collections - opts.SetProjection(bson.M{primaryKeyAttr: 0, parentKeyAttr: 0, childrenAttr: 0}) - - err := col.FindOne(ctx, docRef, opts).Decode(&value) - if err != nil { - if errors.Is(err, mongo.ErrNoDocuments) { - return nil, newErr( - codes.NotFound, - "document not found", - err, - ) - } - - return nil, newErr( - codes.Unknown, - "error getting document", - err, - ) - } - - content, err := structpb.NewStruct(value) - if err != nil { - return nil, newErr( - codes.Internal, - "error creating struct from document content", - err, - ) - } - - return &keyvaluepb.KeyValueGetResponse{ - Value: &keyvaluepb.Value{ - Key: req.Key, - Content: content, - }, - }, nil -} - -// Set a document in the mongo collection -func (s *MongoDocService) Set(ctx context.Context, req *keyvaluepb.KeyValueSetRequest) (*keyvaluepb.KeyValueSetResponse, error) { - newErr := grpc_errors.ErrorsWithScope("MongoDocService.Set") - - if err := keyvalue.ValidateKey(req.Key); err != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid key", - err, - ) - } - - if req.Content == nil { - return nil, newErr( - codes.InvalidArgument, - "document value cannot be empty", - nil, - ) - } - - coll := s.getCollection(req.Key) - - mapContent := req.Content.AsMap() - - value := mapKeys(req.Key, mapContent) - - opts := options.Update().SetUpsert(true) - - filter := bson.M{primaryKeyAttr: req.Key.Key} - - update := bson.D{{Key: "$set", Value: value}} - - _, err := coll.UpdateOne(ctx, filter, update, opts) - if err != nil { - return nil, newErr( - codes.Internal, - "error updating value", - err, - ) - } - - return &keyvaluepb.KeyValueSetResponse{}, nil -} - -// Delete a document from the mongo collection -func (s *MongoDocService) Delete(ctx context.Context, req *keyvaluepb.KeyValueDeleteRequest) (*keyvaluepb.KeyValueDeleteResponse, error) { - newErr := grpc_errors.ErrorsWithScope("MongoDocService.Delete") - - if err := keyvalue.ValidateKey(req.Key); err != nil { - return nil, newErr( - codes.InvalidArgument, - "invalid key", - err, - ) - } - - coll := s.getCollection(req.Key) - - filter := bson.M{primaryKeyAttr: req.Key.Key} - - opts := options.FindOneAndDelete().SetProjection(bson.M{childrenAttr: 1, primaryKeyAttr: 0}) - - var deletedKeyValue map[string]interface{} - - // Delete document - if err := coll.FindOneAndDelete(ctx, filter, opts).Decode(&deletedKeyValue); err != nil { - return nil, newErr( - codes.Internal, - "error deleting document", - err, - ) - } - - return &keyvaluepb.KeyValueDeleteResponse{}, nil -} - -func New() (*MongoDocService, error) { - mongoDBConnectionString := env.MONGODB_CONNECTION_STRING.String() - if mongoDBConnectionString == "" { - return nil, fmt.Errorf("MongoDB missing environment variable: %v", mongoDBConnectionStringEnvVarName) - } - - database := env.MONGODB_DATABASE.String() - if database == "" { - return nil, fmt.Errorf("MongoDB missing environment variable: %v", mongoDBDatabaseEnvVarName) - } - - ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) - defer cancel() - - mongoDBSetDirect, err := env.MONGODB_DIRECT.Bool() - if err != nil { - return nil, err - } - - clientOptions := options.Client().ApplyURI(mongoDBConnectionString).SetDirect(mongoDBSetDirect) - - client, clientError := mongo.NewClient(clientOptions) - - if clientError != nil { - return nil, fmt.Errorf("mongodb error creating client: %w", clientError) - } - - connectError := client.Connect(ctx) - - if connectError != nil { - return nil, fmt.Errorf("mongodb unable to initialize connection: %w", connectError) - } - - db := client.Database(database) - - return &MongoDocService{ - client: client, - db: db, - }, nil -} - -func NewWithClient(client *mongo.Client, database string) *MongoDocService { - db := client.Database(database) - - return &MongoDocService{ - client: client, - db: db, - } -} - -func mapKeys(key *keyvaluepb.Key, source map[string]interface{}) map[string]interface{} { - // Copy map - newMap := make(map[string]interface{}) - - for key, value := range source { - newMap[key] = value - } - - newMap[primaryKeyAttr] = key.Key - - return newMap -} - -func (s *MongoDocService) getCollection(key *keyvaluepb.Key) *mongo.Collection { - return s.db.Collection(key.Store) -} diff --git a/cloud/azure/runtime/keyvalue/keyvalue.go b/cloud/azure/runtime/keyvalue/keyvalue.go index 4d8067170..5d7e25fbf 100644 --- a/cloud/azure/runtime/keyvalue/keyvalue.go +++ b/cloud/azure/runtime/keyvalue/keyvalue.go @@ -186,7 +186,7 @@ func newStorageTablesClientFactory(creds *azidentity.DefaultAzureCredential, sto } // New creates a new AWS DynamoDB implementation of a DocumentServiceServer -func New(provider resource.AwsResourceProvider) (*AzureStorageTableKeyValueService, error) { +func New() (*AzureStorageTableKeyValueService, error) { storageAccountName := env.AZURE_STORAGE_ACCOUNT_NAME.String() if storageAccountName == "" { return nil, fmt.Errorf("failed to determine Azure Storage Account name, environment variable not set") From 46032069ce3ef8ee45a31593c3e1764eecdf99c6 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 11:45:25 +1100 Subject: [PATCH 07/13] add least priveledge for kv stores in azure. --- cloud/azure/deploy/policy.go | 71 ++++++++---------------------------- cloud/azure/deploy/roles.go | 44 ++++++++++++++++++++++ 2 files changed, 59 insertions(+), 56 deletions(-) diff --git a/cloud/azure/deploy/policy.go b/cloud/azure/deploy/policy.go index d5aaa3f7e..2a2d3b3f0 100644 --- a/cloud/azure/deploy/policy.go +++ b/cloud/azure/deploy/policy.go @@ -72,6 +72,21 @@ func (p *NitricAzurePulumiProvider) scopeFromResource(resource *deploymentspb.Re topic.Name, ), }, nil + case resourcespb.ResourceType_KeyValueStore: + kv, ok := p.keyValueStores[resource.Id.Name] + if !ok { + return nil, fmt.Errorf("key value store %s not found", resource.Id.Name) + } + + return &resourceScope{ + scope: pulumi.Sprintf( + "subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/tableServices/default/tables/%s", + p.clientConfig.SubscriptionId, + p.resourceGroup.Name, + p.storageAccount.Name, + kv.Name, + ), + }, nil case resourcespb.ResourceType_Bucket: bucket, ok := p.buckets[resource.Id.Name] if !ok { @@ -118,10 +133,6 @@ func (p *NitricAzurePulumiProvider) Policy(ctx *pulumi.Context, parent pulumi.Re opts := []pulumi.ResourceOption{pulumi.Parent(parent)} for _, resource := range policy.Resources { - if resource.Id.Type == resourcespb.ResourceType_KeyValueStore { - continue - } - for _, principal := range policy.Principals { // The roles we need to assign roles := actionsToAzureRoleDefinitions(p.roles.RoleDefinitions, policy.Actions) @@ -160,55 +171,3 @@ func (p *NitricAzurePulumiProvider) Policy(ctx *pulumi.Context, parent pulumi.Re return nil } - -// func NewAzureADPolicy(ctx *pulumi.Context, name string, args *PolicyArgs, opts ...pulumi.ResourceOption) (*Policy, error) { -// res := &Policy{Name: name, RolePolicies: make([]*iam.RolePolicy, 0)} - -// err := ctx.RegisterComponentResource("nitric:policy:AazureADPolicy", name, res, opts...) -// if err != nil { -// return nil, err -// } - -// for _, resource := range args.Policy.Resources { -// if resource.Id.Type == resourcespb.ResourceType_Collection { -// continue -// } - -// for _, principal := range args.Policy.Principals { -// // The roles we need to assign -// roles := actionsToAzureRoleDefinitions(args.Roles.RoleDefinitions, args.Policy.Actions) -// if len(roles) == 0 { -// return nil, fmt.Errorf("policy contained not assignable actions %+v, %+v", args.Policy, args.Roles.RoleDefinitions) -// } - -// sp, ok := args.Principals[principal.Id.Type][principal.Id.Name] -// if !ok { -// return nil, fmt.Errorf("principal %s of type %s not found", principal.Id.Name, principal.Id.Type) -// } - -// // We have the principal and the roles we need to assign -// // just need to scope the resource type to the RoleAssignments -// for roleName, role := range roles { -// // FIXME: Implement collection and secret least priveledge -// scope, err := p.scopeFromResource(resource) -// if err != nil { -// return nil, err -// } - -// _, err = authorization.NewRoleAssignment(ctx, fmt.Sprintf("%s-%s", principal.Id.Name, roleName), &authorization.RoleAssignmentArgs{ -// PrincipalId: sp.ServicePrincipalId, -// PrincipalType: pulumi.String("ServicePrincipal"), -// RoleDefinitionId: role.ID(), -// // Convert the target resources into a scope -// Scope: scope.scope, -// Condition: scope.condition, -// }, pulumi.Parent(res)) -// if err != nil { -// return nil, fmt.Errorf("there was an error creating the role assignment: %w", err) -// } -// } -// } -// } - -// return res, nil -// } diff --git a/cloud/azure/deploy/roles.go b/cloud/azure/deploy/roles.go index bf86bdbaa..02c0f441e 100644 --- a/cloud/azure/deploy/roles.go +++ b/cloud/azure/deploy/roles.go @@ -42,6 +42,50 @@ type RoleDefinition struct { } var roleDefinitions = map[resourcespb.Action]RoleDefinition{ + resourcespb.Action_KeyValueStoreRead: { + Description: pulumi.String("keyvalue read access"), + Permissions: authorization.PermissionArray{ + authorization.PermissionArgs{ + Actions: pulumi.StringArray{}, + DataActions: pulumi.StringArray{ + pulumi.String("Microsoft.Storage/storageAccounts/tableServices/tables/entities/read"), + }, + NotActions: pulumi.StringArray{}, + }, + }, + AssignableScopes: pulumi.ToStringArray([]string{ + "/", + }), + resourcespb.Action_KeyValueStoreWrite: { + Description: pulumi.String("keyvalue write access"), + Permissions: authorization.PermissionArray{ + authorization.PermissionArgs{ + Actions: pulumi.StringArray{}, + DataActions: pulumi.StringArray{ + pulumi.String("Microsoft.Storage/storageAccounts/tableServices/tables/entities/write"), + }, + NotActions: pulumi.StringArray{}, + }, + }, + AssignableScopes: pulumi.ToStringArray([]string{ + "/", + }), + }, + resourcespb.Action_KeyValueStoreDelete: { + Description: pulumi.String("keyvalue delete access"), + Permissions: authorization.PermissionArray{ + authorization.PermissionArgs{ + Actions: pulumi.StringArray{}, + DataActions: pulumi.StringArray{ + pulumi.String("Microsoft.Storage/storageAccounts/tableServices/tables/entities/delete"), + }, + NotActions: pulumi.StringArray{}, + }, + }, + AssignableScopes: pulumi.ToStringArray([]string{ + "/", + }), + }, resourcespb.Action_BucketFileGet: { Description: pulumi.String("bucket read access"), Permissions: authorization.PermissionArray{ From 0230178ca7526446e988444f9420b18382c1e9e1 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 11:46:22 +1100 Subject: [PATCH 08/13] fix syntax error. --- cloud/azure/deploy/roles.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cloud/azure/deploy/roles.go b/cloud/azure/deploy/roles.go index 02c0f441e..8e23cefc4 100644 --- a/cloud/azure/deploy/roles.go +++ b/cloud/azure/deploy/roles.go @@ -42,7 +42,7 @@ type RoleDefinition struct { } var roleDefinitions = map[resourcespb.Action]RoleDefinition{ - resourcespb.Action_KeyValueStoreRead: { + resourcespb.Action_KeyValueStoreRead: { Description: pulumi.String("keyvalue read access"), Permissions: authorization.PermissionArray{ authorization.PermissionArgs{ @@ -56,7 +56,8 @@ var roleDefinitions = map[resourcespb.Action]RoleDefinition{ AssignableScopes: pulumi.ToStringArray([]string{ "/", }), - resourcespb.Action_KeyValueStoreWrite: { + }, + resourcespb.Action_KeyValueStoreWrite: { Description: pulumi.String("keyvalue write access"), Permissions: authorization.PermissionArray{ authorization.PermissionArgs{ From a3e03fd1abdf96aa6add7c885dd69fc249b45eee Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 11:47:43 +1100 Subject: [PATCH 09/13] add name descriptions for keyvalue custom roles. --- cloud/azure/deploy/roles.go | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/cloud/azure/deploy/roles.go b/cloud/azure/deploy/roles.go index 8e23cefc4..178a8d357 100644 --- a/cloud/azure/deploy/roles.go +++ b/cloud/azure/deploy/roles.go @@ -148,21 +148,6 @@ var roleDefinitions = map[resourcespb.Action]RoleDefinition{ "/", }), }, - // resourcespb.Action_QueueList: { - // Description: pulumi.String("queue list access"), - // Permissions: authorization.PermissionArray{ - // authorization.PermissionArgs{ - // Actions: pulumi.StringArray{ - // pulumi.String("Microsoft.Storage/storageAccounts/queueServices/queues/read"), - // }, - // DataActions: pulumi.StringArray{}, - // NotActions: pulumi.StringArray{}, - // }, - // }, - // AssignableScopes: pulumi.ToStringArray([]string{ - // "/", - // }), - // }, resourcespb.Action_TopicDetail: { Description: pulumi.String("topic detail access"), Permissions: authorization.PermissionArray{ @@ -252,15 +237,18 @@ type Roles struct { } var actionNames = map[resourcespb.Action]string{ - resourcespb.Action_BucketFileGet: "BucketFileGet", - resourcespb.Action_BucketFilePut: "BucketFilePut", - resourcespb.Action_BucketFileDelete: "BucketFileDelete", - resourcespb.Action_BucketFileList: "BucketFileList", - resourcespb.Action_TopicDetail: "TopicDetail", - resourcespb.Action_TopicEventPublish: "TopicPublish", - resourcespb.Action_TopicList: "TopicList", - resourcespb.Action_SecretAccess: "SecretAccess", - resourcespb.Action_SecretPut: "SecretPut", + resourcespb.Action_BucketFileGet: "BucketFileGet", + resourcespb.Action_BucketFilePut: "BucketFilePut", + resourcespb.Action_BucketFileDelete: "BucketFileDelete", + resourcespb.Action_BucketFileList: "BucketFileList", + resourcespb.Action_TopicDetail: "TopicDetail", + resourcespb.Action_TopicEventPublish: "TopicPublish", + resourcespb.Action_TopicList: "TopicList", + resourcespb.Action_SecretAccess: "SecretAccess", + resourcespb.Action_SecretPut: "SecretPut", + resourcespb.Action_KeyValueStoreDelete: "KeyValueStoreDelete", + resourcespb.Action_KeyValueStoreRead: "KeyValueStoreRead", + resourcespb.Action_KeyValueStoreWrite: "KeyValueStoreWrite", } func CreateRoles(ctx *pulumi.Context, stackId string, subscriptionId string, rgName pulumi.StringInput) (*Roles, error) { From 3cfb68b00b9876eb4f4e419d1a6cc58964171349 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Tue, 23 Jan 2024 11:50:16 +1100 Subject: [PATCH 10/13] add storage account name to container env. --- cloud/azure/deploy/containerenv.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cloud/azure/deploy/containerenv.go b/cloud/azure/deploy/containerenv.go index 8c347713f..bc5317cac 100644 --- a/cloud/azure/deploy/containerenv.go +++ b/cloud/azure/deploy/containerenv.go @@ -75,6 +75,10 @@ func (p *NitricAzurePulumiProvider) newContainerEnv(ctx *pulumi.Context, name st env := app.EnvironmentVarArray{} if p.storageAccount != nil { + env = append(env, app.EnvironmentVarArgs{ + Name: pulumi.String("AZURE_STORAGE_ACCOUNT_NAME"), + Value: p.storageAccount.Name, + }) env = append(env, app.EnvironmentVarArgs{ Name: pulumi.String("AZURE_STORAGE_ACCOUNT_BLOB_ENDPOINT"), Value: p.storageAccount.PrimaryEndpoints.Blob(), From b71bb3d3c9e3cb4f1e3c6aaa28f59ab93bf15d4f Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Wed, 24 Jan 2024 12:55:15 +1100 Subject: [PATCH 11/13] fix fmt and test. --- cloud/aws/runtime/keyvalue/dynamodb.go | 1 - cloud/azure/deploy/keyvalue.go | 14 +++ cloud/azure/runtime/env/variables.go | 6 +- cloud/azure/runtime/keyvalue/keyvalue.go | 4 - cloud/gcp/deploy/keyvalue.go | 14 +++ cloud/gcp/runtime/cmd/README.md | 37 -------- cloud/gcp/runtime/cmd/membrane.go | 92 ------------------ cloud/gcp/runtime/cmd/trace.go | 93 ------------------- .../{document => keyvalue}/firestore.go | 1 - 9 files changed, 32 insertions(+), 230 deletions(-) delete mode 100644 cloud/gcp/runtime/cmd/README.md delete mode 100644 cloud/gcp/runtime/cmd/membrane.go delete mode 100644 cloud/gcp/runtime/cmd/trace.go rename cloud/gcp/runtime/{document => keyvalue}/firestore.go (99%) diff --git a/cloud/aws/runtime/keyvalue/dynamodb.go b/cloud/aws/runtime/keyvalue/dynamodb.go index cc7d80b1f..527da095e 100644 --- a/cloud/aws/runtime/keyvalue/dynamodb.go +++ b/cloud/aws/runtime/keyvalue/dynamodb.go @@ -146,7 +146,6 @@ func (s *DynamoKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValu Content: documentContent, }, }, nil - } // Set a document in the DynamoDB table diff --git a/cloud/azure/deploy/keyvalue.go b/cloud/azure/deploy/keyvalue.go index b13a6db78..1f9431057 100644 --- a/cloud/azure/deploy/keyvalue.go +++ b/cloud/azure/deploy/keyvalue.go @@ -1,3 +1,17 @@ +// Copyright 2021 Nitric Technologies Pty Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package deploy import ( diff --git a/cloud/azure/runtime/env/variables.go b/cloud/azure/runtime/env/variables.go index e49ac4476..3cdb9ab7c 100644 --- a/cloud/azure/runtime/env/variables.go +++ b/cloud/azure/runtime/env/variables.go @@ -26,8 +26,10 @@ var KVAULT_NAME = env.GetEnv("KVAULT_NAME", "") var AZURE_STORAGE_ACCOUNT_NAME = env.GetEnv("AZURE_STORAGE_ACCOUNT_NAME", "") -var AZURE_STORAGE_BLOB_ENDPOINT = env.GetEnv("AZURE_STORAGE_ACCOUNT_BLOB_ENDPOINT", "") -var AZURE_STORAGE_QUEUE_ENDPOINT = env.GetEnv("AZURE_STORAGE_ACCOUNT_QUEUE_ENDPOINT", "") +var ( + AZURE_STORAGE_BLOB_ENDPOINT = env.GetEnv("AZURE_STORAGE_ACCOUNT_BLOB_ENDPOINT", "") + AZURE_STORAGE_QUEUE_ENDPOINT = env.GetEnv("AZURE_STORAGE_ACCOUNT_QUEUE_ENDPOINT", "") +) // mongoDBConnectionString := utils.GetEnv(mongoDBConnectionStringEnvVarName, "") diff --git a/cloud/azure/runtime/keyvalue/keyvalue.go b/cloud/azure/runtime/keyvalue/keyvalue.go index 5d7e25fbf..223ff35f5 100644 --- a/cloud/azure/runtime/keyvalue/keyvalue.go +++ b/cloud/azure/runtime/keyvalue/keyvalue.go @@ -48,7 +48,6 @@ type AztableEntity struct { func (s *AzureStorageTableKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValueGetRequest) (*keyvaluepb.KeyValueGetResponse, error) { newErr := grpc_errors.ErrorsWithScope("AzureStorageTableKeyValueService.Get") client, err := s.clientFactory(req.Key.Store) - if err != nil { return nil, newErr( codes.Internal, @@ -97,7 +96,6 @@ func (s *AzureStorageTableKeyValueService) Get(ctx context.Context, req *keyvalu func (s *AzureStorageTableKeyValueService) Set(ctx context.Context, req *keyvaluepb.KeyValueSetRequest) (*keyvaluepb.KeyValueSetResponse, error) { newErr := grpc_errors.ErrorsWithScope("AzureStorageTableKeyValueService.Set") client, err := s.clientFactory(req.Key.Store) - if err != nil { return nil, newErr( codes.Internal, @@ -147,7 +145,6 @@ func (s *AzureStorageTableKeyValueService) Set(ctx context.Context, req *keyvalu func (s *AzureStorageTableKeyValueService) Delete(ctx context.Context, req *keyvaluepb.KeyValueDeleteRequest) (*keyvaluepb.KeyValueDeleteResponse, error) { newErr := grpc_errors.ErrorsWithScope("AzureStorageTableKeyValueService.Delete") client, err := s.clientFactory(req.Key.Store) - if err != nil { return nil, newErr( codes.Internal, @@ -200,7 +197,6 @@ func New() (*AzureStorageTableKeyValueService, error) { return &AzureStorageTableKeyValueService{ clientFactory: newStorageTablesClientFactory(cred, storageAccountName), }, nil - } // NewWithClient creates a DocumentServiceServer with an given DynamoDB client instance. diff --git a/cloud/gcp/deploy/keyvalue.go b/cloud/gcp/deploy/keyvalue.go index d0a60fe10..44980d7bd 100644 --- a/cloud/gcp/deploy/keyvalue.go +++ b/cloud/gcp/deploy/keyvalue.go @@ -1,3 +1,17 @@ +// Copyright 2021 Nitric Technologies Pty Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package deploy import ( diff --git a/cloud/gcp/runtime/cmd/README.md b/cloud/gcp/runtime/cmd/README.md deleted file mode 100644 index aade4b75a..000000000 --- a/cloud/gcp/runtime/cmd/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Nitric plugins for GCP - -## Development - -### Requirements - - Git - - Nitric Membrane Project - - Golang - - Make - - Docker - -### Getting Started - -### Building Static Membrane Image -From the repository root run -```bash -make gcp-docker-static -``` - -### Building Plugin Images - - -> __Note:__ Prior to building these plugins, the nitric pluggable membrane image must be built for local development - - -Alpine Linux -```bash -make gcp-docker-alpine -``` - -Debian -```bash -make gcp-docker-debian -``` - -> __Note:__ Seperate distributions required between glibc/musl as dynamic linker is used for golang plugin support - diff --git a/cloud/gcp/runtime/cmd/membrane.go b/cloud/gcp/runtime/cmd/membrane.go deleted file mode 100644 index 2b038acf0..000000000 --- a/cloud/gcp/runtime/cmd/membrane.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "fmt" - "log" - "os" - "os/signal" - "syscall" - - firestore_service "github.com/nitrictech/nitric/cloud/gcp/runtime/document" - cloudrun_plugin "github.com/nitrictech/nitric/cloud/gcp/runtime/gateway" - "github.com/nitrictech/nitric/cloud/gcp/runtime/resource" - secret_manager_secret_service "github.com/nitrictech/nitric/cloud/gcp/runtime/secret" - storage_service "github.com/nitrictech/nitric/cloud/gcp/runtime/storage" - pubsub_service "github.com/nitrictech/nitric/cloud/gcp/runtime/topic" - "github.com/nitrictech/nitric/core/pkg/membrane" -) - -func main() { - // Setup signal interrupt handling for graceful shutdown - var err error - term := make(chan os.Signal, 1) - signal.Notify(term, syscall.SIGTERM, syscall.SIGINT) - - membraneOpts := membrane.DefaultMembraneOptions() - provider, err := resource.New() - if err != nil { - log.Default().Fatalf("Failed create core provider: %s", err.Error()) - } - - membraneOpts.SecretManagerPlugin, err = secret_manager_secret_service.New() - if err != nil { - log.Default().Println("Failed to load secret plugin:", err.Error()) - } - - membraneOpts.KeyValuePlugin, err = firestore_service.New() - if err != nil { - log.Default().Println("Failed to load document plugin:", err.Error()) - } - - membraneOpts.TopicsPlugin, err = pubsub_service.New(provider) - if err != nil { - log.Default().Println("Failed to load events plugin:", err.Error()) - } - - membraneOpts.StoragePlugin, err = storage_service.New() - if err != nil { - log.Default().Println("Failed to load storage plugin:", err.Error()) - } - - membraneOpts.GatewayPlugin, err = cloudrun_plugin.New(provider) - if err != nil { - log.Default().Println("Failed to load gateway plugin:", err.Error()) - } - - membraneOpts.ResourcesPlugin = provider - membraneOpts.CreateTracerProvider = newTraceProvider - - m, err := membrane.New(membraneOpts) - if err != nil { - log.Fatalf("There was an error initialising the membrane server: %v", err) - } - - errChan := make(chan error) - // Start the Membrane server - go func(chan error) { - errChan <- m.Start() - }(errChan) - - select { - case membraneError := <-errChan: - log.Default().Println(fmt.Sprintf("Membrane Error: %v, exiting", membraneError)) - case sigTerm := <-term: - log.Default().Println(fmt.Sprintf("Received %v, exiting", sigTerm)) - } - - m.Stop() -} diff --git a/cloud/gcp/runtime/cmd/trace.go b/cloud/gcp/runtime/cmd/trace.go deleted file mode 100644 index 0d08d8c59..000000000 --- a/cloud/gcp/runtime/cmd/trace.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2021 Nitric Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "context" - "os" - "strconv" - - "github.com/GoogleCloudPlatform/opentelemetry-operations-go/propagator" - "github.com/pkg/errors" - "go.opentelemetry.io/contrib/detectors/gcp" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" - "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.4.0" - - commonenv "github.com/nitrictech/nitric/cloud/common/runtime/env" - "github.com/nitrictech/nitric/core/pkg/telemetry" -) - -// PercentFromIntString returns a float between 0.0 to 1 representing a percentage. -// this is converted from a string int in the range "0" to "100". -func decimalFromPercentIntString(in string) (float64, error) { - intVar, err := strconv.Atoi(in) - if err != nil { - return 0, err - } - - if intVar >= 100 { - return 1, nil - } else if intVar <= 0 { - return 0, nil - } - - return float64(intVar) / float64(100), nil -} - -func newTraceProvider(ctx context.Context) (*sdktrace.TracerProvider, error) { - telemetry.FunctionName = os.Getenv("K_SERVICE") - telemetry.UseFuncNameAsSpanName = false - - exp, err := otlptracegrpc.New(ctx, otlptracegrpc.WithInsecure()) - if err != nil { - return nil, err - } - - res, err := resource.New(ctx, - resource.WithDetectors(gcp.NewDetector()), - resource.WithAttributes( - semconv.CloudProviderGCP, - semconv.CloudPlatformGCPCloudRun, - attribute.Key("component").String("Nitric membrane"), - semconv.ServiceNameKey.String(telemetry.FunctionName), - semconv.ServiceNamespaceKey.String(commonenv.NITRIC_STACK_ID.String()), - ), - ) - if err != nil { - return nil, err - } - - otel.SetTextMapPropagator( - propagation.NewCompositeTextMapPropagator( - propagator.CloudTraceFormatPropagator{}, - propagation.TraceContext{}, - )) - - rate, err := decimalFromPercentIntString(commonenv.NITRIC_TRACE_SAMPLE_PERCENT.String()) - if err != nil { - return nil, errors.WithMessagef(err, "NITRIC_TRACE_SAMPLE_PERCENT should be an int") - } - - return sdktrace.NewTracerProvider( - sdktrace.WithSampler(sdktrace.ParentBased(sdktrace.TraceIDRatioBased(rate))), - sdktrace.WithResource(res), - sdktrace.WithBatcher(exp), - ), nil -} diff --git a/cloud/gcp/runtime/document/firestore.go b/cloud/gcp/runtime/keyvalue/firestore.go similarity index 99% rename from cloud/gcp/runtime/document/firestore.go rename to cloud/gcp/runtime/keyvalue/firestore.go index 85b9ebe25..587fc59a6 100644 --- a/cloud/gcp/runtime/document/firestore.go +++ b/cloud/gcp/runtime/keyvalue/firestore.go @@ -16,7 +16,6 @@ package document import ( "context" - "errors" "fmt" "github.com/nitrictech/nitric/core/pkg/decorators/keyvalue" From 7d55af0b72094d7a6ef2bf04cc5dd1f33e8af0b1 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Thu, 25 Jan 2024 10:41:06 +1100 Subject: [PATCH 12/13] fix import --- cloud/gcp/cmd/runtime/membrane.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud/gcp/cmd/runtime/membrane.go b/cloud/gcp/cmd/runtime/membrane.go index 73c05bdc5..f074d52cc 100644 --- a/cloud/gcp/cmd/runtime/membrane.go +++ b/cloud/gcp/cmd/runtime/membrane.go @@ -22,8 +22,8 @@ import ( "syscall" "github.com/nitrictech/nitric/cloud/gcp/runtime/api" - firestore_service "github.com/nitrictech/nitric/cloud/gcp/runtime/document" cloudrun_plugin "github.com/nitrictech/nitric/cloud/gcp/runtime/gateway" + firestore_service "github.com/nitrictech/nitric/cloud/gcp/runtime/keyvalue" "github.com/nitrictech/nitric/cloud/gcp/runtime/resource" secret_manager_secret_service "github.com/nitrictech/nitric/cloud/gcp/runtime/secret" storage_service "github.com/nitrictech/nitric/cloud/gcp/runtime/storage" From b589cd7f50f84378ee7635e397f84b0dc1b76699 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Thu, 25 Jan 2024 10:41:22 +1100 Subject: [PATCH 13/13] rename key/value ref object --- cloud/aws/runtime/keyvalue/dynamodb.go | 38 ++-- cloud/azure/runtime/keyvalue/keyvalue.go | 22 +- cloud/gcp/runtime/keyvalue/firestore.go | 18 +- core/pkg/decorators/keyvalue/keyvalue.go | 4 +- core/pkg/decorators/keyvalue/validate_test.go | 6 +- core/pkg/proto/keyvalue/v1/keyvalue.pb.go | 205 +++++++++--------- nitric/proto/keyvalue/v1/keyvalue.proto | 32 +-- 7 files changed, 163 insertions(+), 162 deletions(-) diff --git a/cloud/aws/runtime/keyvalue/dynamodb.go b/cloud/aws/runtime/keyvalue/dynamodb.go index 527da095e..14726af4b 100644 --- a/cloud/aws/runtime/keyvalue/dynamodb.go +++ b/cloud/aws/runtime/keyvalue/dynamodb.go @@ -64,7 +64,7 @@ func isDynamoAccessDeniedErr(err error) bool { func (s *DynamoKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValueGetRequest) (*keyvaluepb.KeyValueGetResponse, error) { newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Get") - err := document.ValidateKey(req.Key) + err := document.ValidateValueRef(req.Ref) if err != nil { return nil, newErr( codes.InvalidArgument, @@ -73,7 +73,7 @@ func (s *DynamoKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValu ) } - keyMap := createKeyMap(req.Key) + keyMap := createKeyMap(req.Ref) attributeMap, err := attributevalue.MarshalMap(keyMap) if err != nil { return nil, newErr( @@ -83,7 +83,7 @@ func (s *DynamoKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValu ) } - tableName, err := s.getTableName(ctx, req.Key.Store) + tableName, err := s.getTableName(ctx, req.Ref.Store) if err != nil { return nil, err } @@ -105,7 +105,7 @@ func (s *DynamoKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValu return nil, newErr( codes.Internal, - fmt.Sprintf("error retrieving key %v", req.Key), + fmt.Sprintf("error retrieving value with key %s from store %s", req.Ref.Key, req.Ref.Store), err, ) } @@ -113,7 +113,7 @@ func (s *DynamoKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValu if result.Item == nil { return nil, newErr( codes.NotFound, - fmt.Sprintf("%v not found", req.Key), + fmt.Sprintf("%v not found", req.Ref), err, ) } @@ -142,7 +142,7 @@ func (s *DynamoKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValu return &keyvaluepb.KeyValueGetResponse{ Value: &keyvaluepb.Value{ - Key: req.Key, + Ref: req.Ref, Content: documentContent, }, }, nil @@ -152,7 +152,7 @@ func (s *DynamoKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValu func (s *DynamoKeyValueService) Set(ctx context.Context, req *keyvaluepb.KeyValueSetRequest) (*keyvaluepb.KeyValueSetResponse, error) { newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Set") - if err := document.ValidateKey(req.Key); err != nil { + if err := document.ValidateValueRef(req.Ref); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -169,7 +169,7 @@ func (s *DynamoKeyValueService) Set(ctx context.Context, req *keyvaluepb.KeyValu } // Construct DynamoDB attribute value object - itemMap := createItemMap(req.Content.AsMap(), req.Key) + itemMap := createItemMap(req.Content.AsMap(), req.Ref) itemAttributeMap, err := attributevalue.MarshalMap(itemMap) if err != nil { return nil, newErr( @@ -179,7 +179,7 @@ func (s *DynamoKeyValueService) Set(ctx context.Context, req *keyvaluepb.KeyValu ) } - tableName, err := s.getTableName(ctx, req.Key.Store) + tableName, err := s.getTableName(ctx, req.Ref.Store) if err != nil { return nil, newErr( codes.NotFound, @@ -217,7 +217,7 @@ func (s *DynamoKeyValueService) Set(ctx context.Context, req *keyvaluepb.KeyValu func (s *DynamoKeyValueService) Delete(ctx context.Context, req *keyvaluepb.KeyValueDeleteRequest) (*keyvaluepb.KeyValueDeleteResponse, error) { newErr := grpc_errors.ErrorsWithScope("DynamoDocService.Delete") - if err := document.ValidateKey(req.Key); err != nil { + if err := document.ValidateValueRef(req.Ref); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -225,17 +225,17 @@ func (s *DynamoKeyValueService) Delete(ctx context.Context, req *keyvaluepb.KeyV ) } - keyMap := createKeyMap(req.Key) + keyMap := createKeyMap(req.Ref) attributeMap, err := attributevalue.MarshalMap(keyMap) if err != nil { return nil, newErr( codes.InvalidArgument, - fmt.Sprintf("failed to marshal keys: %v", req.Key), + fmt.Sprintf("failed to marshal keys: %v", req.Ref), err, ) } - tableName, err := s.getTableName(ctx, req.Key.Store) + tableName, err := s.getTableName(ctx, req.Ref.Store) if err != nil { return nil, newErr( codes.NotFound, @@ -261,7 +261,7 @@ func (s *DynamoKeyValueService) Delete(ctx context.Context, req *keyvaluepb.KeyV return nil, newErr( codes.Internal, - fmt.Sprintf("error deleting %v item %v : %v", req.Key.Store, req.Key.Key, err), + fmt.Sprintf("error deleting %v item %v : %v", req.Ref.Store, req.Ref.Key, err), err, ) } @@ -299,23 +299,23 @@ func NewWithClient(provider resource.AwsResourceProvider, client *dynamodb.Clien }, nil } -func createKeyMap(key *keyvaluepb.Key) map[string]string { +func createKeyMap(ref *keyvaluepb.ValueRef) map[string]string { keyMap := make(map[string]string) - keyMap[AttribPk] = key.Key - keyMap[AttribSk] = key.Store + "#" + keyMap[AttribPk] = ref.Key + keyMap[AttribSk] = ref.Store + "#" return keyMap } -func createItemMap(source map[string]interface{}, key *keyvaluepb.Key) map[string]interface{} { +func createItemMap(source map[string]interface{}, ref *keyvaluepb.ValueRef) map[string]interface{} { // Copy map newMap := make(map[string]interface{}) for key, value := range source { newMap[key] = value } - keyMap := createKeyMap(key) + keyMap := createKeyMap(ref) // Add key attributes newMap[AttribPk] = keyMap[AttribPk] diff --git a/cloud/azure/runtime/keyvalue/keyvalue.go b/cloud/azure/runtime/keyvalue/keyvalue.go index 223ff35f5..b8268a107 100644 --- a/cloud/azure/runtime/keyvalue/keyvalue.go +++ b/cloud/azure/runtime/keyvalue/keyvalue.go @@ -47,7 +47,7 @@ type AztableEntity struct { // Get a document from the DynamoDB table func (s *AzureStorageTableKeyValueService) Get(ctx context.Context, req *keyvaluepb.KeyValueGetRequest) (*keyvaluepb.KeyValueGetResponse, error) { newErr := grpc_errors.ErrorsWithScope("AzureStorageTableKeyValueService.Get") - client, err := s.clientFactory(req.Key.Store) + client, err := s.clientFactory(req.Ref.Store) if err != nil { return nil, newErr( codes.Internal, @@ -56,7 +56,7 @@ func (s *AzureStorageTableKeyValueService) Get(ctx context.Context, req *keyvalu ) } - err = document.ValidateKey(req.Key) + err = document.ValidateValueRef(req.Ref) if err != nil { return nil, newErr( codes.InvalidArgument, @@ -65,7 +65,7 @@ func (s *AzureStorageTableKeyValueService) Get(ctx context.Context, req *keyvalu ) } - response, err := client.GetEntity(ctx, req.Key.Store, req.Key.Key, nil) + response, err := client.GetEntity(ctx, req.Ref.Store, req.Ref.Key, nil) if err != nil { return nil, newErr( codes.InvalidArgument, @@ -86,7 +86,7 @@ func (s *AzureStorageTableKeyValueService) Get(ctx context.Context, req *keyvalu return &keyvaluepb.KeyValueGetResponse{ Value: &keyvaluepb.Value{ - Key: req.Key, + Ref: req.Ref, Content: entity.Content, }, }, nil @@ -95,7 +95,7 @@ func (s *AzureStorageTableKeyValueService) Get(ctx context.Context, req *keyvalu // Set a document in the DynamoDB table func (s *AzureStorageTableKeyValueService) Set(ctx context.Context, req *keyvaluepb.KeyValueSetRequest) (*keyvaluepb.KeyValueSetResponse, error) { newErr := grpc_errors.ErrorsWithScope("AzureStorageTableKeyValueService.Set") - client, err := s.clientFactory(req.Key.Store) + client, err := s.clientFactory(req.Ref.Store) if err != nil { return nil, newErr( codes.Internal, @@ -104,7 +104,7 @@ func (s *AzureStorageTableKeyValueService) Set(ctx context.Context, req *keyvalu ) } - if err := document.ValidateKey(req.Key); err != nil { + if err := document.ValidateValueRef(req.Ref); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -114,8 +114,8 @@ func (s *AzureStorageTableKeyValueService) Set(ctx context.Context, req *keyvalu entity := AztableEntity{ Entity: aztables.Entity{ - PartitionKey: req.Key.Store, - RowKey: req.Key.Key, + PartitionKey: req.Ref.Store, + RowKey: req.Ref.Key, }, Content: req.Content, } @@ -144,7 +144,7 @@ func (s *AzureStorageTableKeyValueService) Set(ctx context.Context, req *keyvalu // Delete a document from the DynamoDB table func (s *AzureStorageTableKeyValueService) Delete(ctx context.Context, req *keyvaluepb.KeyValueDeleteRequest) (*keyvaluepb.KeyValueDeleteResponse, error) { newErr := grpc_errors.ErrorsWithScope("AzureStorageTableKeyValueService.Delete") - client, err := s.clientFactory(req.Key.Store) + client, err := s.clientFactory(req.Ref.Store) if err != nil { return nil, newErr( codes.Internal, @@ -153,7 +153,7 @@ func (s *AzureStorageTableKeyValueService) Delete(ctx context.Context, req *keyv ) } - if err := document.ValidateKey(req.Key); err != nil { + if err := document.ValidateValueRef(req.Ref); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -161,7 +161,7 @@ func (s *AzureStorageTableKeyValueService) Delete(ctx context.Context, req *keyv ) } - _, err = client.DeleteEntity(ctx, req.Key.Store, req.Key.Key, nil) + _, err = client.DeleteEntity(ctx, req.Ref.Store, req.Ref.Key, nil) if err != nil { return nil, newErr( codes.Internal, diff --git a/cloud/gcp/runtime/keyvalue/firestore.go b/cloud/gcp/runtime/keyvalue/firestore.go index 587fc59a6..553e622f1 100644 --- a/cloud/gcp/runtime/keyvalue/firestore.go +++ b/cloud/gcp/runtime/keyvalue/firestore.go @@ -41,7 +41,7 @@ var _ v1.KeyValueServer = &FirestoreDocService{} func (s *FirestoreDocService) Get(ctx context.Context, req *v1.KeyValueGetRequest) (*v1.KeyValueGetResponse, error) { newErr := grpc_errors.ErrorsWithScope("FirestoreDocService.Get") - if err := keyvalue.ValidateKey(req.Key); err != nil { + if err := keyvalue.ValidateValueRef(req.Ref); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -49,7 +49,7 @@ func (s *FirestoreDocService) Get(ctx context.Context, req *v1.KeyValueGetReques ) } - doc := s.getDocRef(req.Key) + doc := s.getDocRef(req.Ref) value, err := doc.Get(ctx) if err != nil { @@ -79,7 +79,7 @@ func (s *FirestoreDocService) Get(ctx context.Context, req *v1.KeyValueGetReques return &v1.KeyValueGetResponse{ Value: &v1.Value{ - Key: req.Key, + Ref: req.Ref, Content: documentContent, }, }, nil @@ -88,7 +88,7 @@ func (s *FirestoreDocService) Get(ctx context.Context, req *v1.KeyValueGetReques func (s *FirestoreDocService) Set(ctx context.Context, req *v1.KeyValueSetRequest) (*v1.KeyValueSetResponse, error) { newErr := grpc_errors.ErrorsWithScope("FirestoreDocService.Set") - if err := keyvalue.ValidateKey(req.Key); err != nil { + if err := keyvalue.ValidateValueRef(req.Ref); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -104,7 +104,7 @@ func (s *FirestoreDocService) Set(ctx context.Context, req *v1.KeyValueSetReques ) } - doc := s.getDocRef(req.Key) + doc := s.getDocRef(req.Ref) if _, err := doc.Set(ctx, req.Content.AsMap()); err != nil { if status.Code(err) == grpcCodes.PermissionDenied { @@ -128,7 +128,7 @@ func (s *FirestoreDocService) Set(ctx context.Context, req *v1.KeyValueSetReques func (s *FirestoreDocService) Delete(ctx context.Context, req *v1.KeyValueDeleteRequest) (*v1.KeyValueDeleteResponse, error) { newErr := grpc_errors.ErrorsWithScope("FirestoreDocService.Delete") - if err := keyvalue.ValidateKey(req.Key); err != nil { + if err := keyvalue.ValidateValueRef(req.Ref); err != nil { return nil, newErr( codes.InvalidArgument, "invalid key", @@ -136,7 +136,7 @@ func (s *FirestoreDocService) Delete(ctx context.Context, req *v1.KeyValueDelete ) } - doc := s.getDocRef(req.Key) + doc := s.getDocRef(req.Ref) // Delete document if _, err := doc.Delete(ctx); err != nil { @@ -182,6 +182,6 @@ func NewWithClient(client *firestore.Client) (v1.KeyValueServer, error) { }, nil } -func (s *FirestoreDocService) getDocRef(key *v1.Key) *firestore.DocumentRef { - return s.client.Collection(key.Store).Doc(key.Key) +func (s *FirestoreDocService) getDocRef(ref *v1.ValueRef) *firestore.DocumentRef { + return s.client.Collection(ref.Store).Doc(ref.Key) } diff --git a/core/pkg/decorators/keyvalue/keyvalue.go b/core/pkg/decorators/keyvalue/keyvalue.go index fc1ffb862..b5a70ff38 100644 --- a/core/pkg/decorators/keyvalue/keyvalue.go +++ b/core/pkg/decorators/keyvalue/keyvalue.go @@ -30,8 +30,8 @@ import ( // "startsWith": true, // } -// ValidateKey - validates a document key, used for operations on a single document e.g. Get, Set, Delete -func ValidateKey(key *v1.Key) error { +// ValidateValueRef - validates a document key, used for operations on a single document e.g. Get, Set, Delete +func ValidateValueRef(key *v1.ValueRef) error { if key == nil { return fmt.Errorf("provide non-nil key") } diff --git a/core/pkg/decorators/keyvalue/validate_test.go b/core/pkg/decorators/keyvalue/validate_test.go index b4587194b..48576677d 100644 --- a/core/pkg/decorators/keyvalue/validate_test.go +++ b/core/pkg/decorators/keyvalue/validate_test.go @@ -27,13 +27,13 @@ var _ = Describe("Document Plugin", func() { When("ValidateKey", func() { When("Nil key", func() { It("should return error", func() { - err := document.ValidateKey(nil) + err := document.ValidateValueRef(nil) Expect(err.Error()).To(ContainSubstring("provide non-nil key")) }) }) When("Blank key.Collection", func() { It("should return error", func() { - err := document.ValidateKey(&keyvaluepb.Key{}) + err := document.ValidateValueRef(&keyvaluepb.Key{}) Expect(err.Error()).To(ContainSubstring("provide non-blank key.Id")) }) }) @@ -42,7 +42,7 @@ var _ = Describe("Document Plugin", func() { key := &keyvaluepb.Key{ Store: "users", } - err := document.ValidateKey(key) + err := document.ValidateValueRef(key) Expect(err.Error()).To(ContainSubstring("provide non-blank key.Id")) }) }) diff --git a/core/pkg/proto/keyvalue/v1/keyvalue.pb.go b/core/pkg/proto/keyvalue/v1/keyvalue.pb.go index 82398742e..90c97ebbb 100644 --- a/core/pkg/proto/keyvalue/v1/keyvalue.pb.go +++ b/core/pkg/proto/keyvalue/v1/keyvalue.pb.go @@ -21,7 +21,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Provides a Collection type for storing documents +// Provides a Key Value Store type for storing documents type Store struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -70,20 +70,20 @@ func (x *Store) GetName() string { return "" } -// Provides a document identifying key type -type Key struct { +// ValueRef provides a unique identifier for a value +type ValueRef struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The item collection + // The key/value store name Store string `protobuf:"bytes,1,opt,name=store,proto3" json:"store,omitempty"` - // The items unique key + // The item's unique key within the store Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` } -func (x *Key) Reset() { - *x = Key{} +func (x *ValueRef) Reset() { + *x = ValueRef{} if protoimpl.UnsafeEnabled { mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -91,13 +91,13 @@ func (x *Key) Reset() { } } -func (x *Key) String() string { +func (x *ValueRef) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Key) ProtoMessage() {} +func (*ValueRef) ProtoMessage() {} -func (x *Key) ProtoReflect() protoreflect.Message { +func (x *ValueRef) ProtoReflect() protoreflect.Message { mi := &file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -109,34 +109,34 @@ func (x *Key) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Key.ProtoReflect.Descriptor instead. -func (*Key) Descriptor() ([]byte, []int) { +// Deprecated: Use ValueRef.ProtoReflect.Descriptor instead. +func (*ValueRef) Descriptor() ([]byte, []int) { return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{1} } -func (x *Key) GetStore() string { +func (x *ValueRef) GetStore() string { if x != nil { return x.Store } return "" } -func (x *Key) GetKey() string { +func (x *ValueRef) GetKey() string { if x != nil { return x.Key } return "" } -// Provides a return document type +// Value provides a return value type type Value struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The document's unique key, including collection/sub-collections - Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // The document content (JSON object) + // ValueRef of the key/value pair, which includes the store and key + Ref *ValueRef `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` + // The content (JSON object) Content *structpb.Struct `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` } @@ -172,9 +172,9 @@ func (*Value) Descriptor() ([]byte, []int) { return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{2} } -func (x *Value) GetKey() *Key { +func (x *Value) GetRef() *ValueRef { if x != nil { - return x.Key + return x.Ref } return nil } @@ -191,8 +191,8 @@ type KeyValueGetRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Key of the document to retrieve - Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // ValueRef of the key/value pair to get, which includes the store and key + Ref *ValueRef `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` } func (x *KeyValueGetRequest) Reset() { @@ -227,9 +227,9 @@ func (*KeyValueGetRequest) Descriptor() ([]byte, []int) { return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{3} } -func (x *KeyValueGetRequest) GetKey() *Key { +func (x *KeyValueGetRequest) GetRef() *ValueRef { if x != nil { - return x.Key + return x.Ref } return nil } @@ -287,9 +287,9 @@ type KeyValueSetRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Key of the document to set - Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // The document content to store (JSON object) + // ValueRef of the key/value pair to set, which includes the store and key + Ref *ValueRef `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` + // The value content to store (JSON object) Content *structpb.Struct `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` } @@ -325,9 +325,9 @@ func (*KeyValueSetRequest) Descriptor() ([]byte, []int) { return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{5} } -func (x *KeyValueSetRequest) GetKey() *Key { +func (x *KeyValueSetRequest) GetRef() *ValueRef { if x != nil { - return x.Key + return x.Ref } return nil } @@ -382,8 +382,8 @@ type KeyValueDeleteRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Key of the document to delete - Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // ValueRef of the key/value pair to delete, which includes the store and key + Ref *ValueRef `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` } func (x *KeyValueDeleteRequest) Reset() { @@ -418,9 +418,9 @@ func (*KeyValueDeleteRequest) Descriptor() ([]byte, []int) { return file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP(), []int{7} } -func (x *KeyValueDeleteRequest) GetKey() *Key { +func (x *KeyValueDeleteRequest) GetRef() *ValueRef { if x != nil { - return x.Key + return x.Ref } return nil } @@ -473,73 +473,74 @@ var file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDesc = []byte{ 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1b, 0x0a, 0x05, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2d, - 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x6b, 0x0a, - 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2f, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, - 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, - 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x45, 0x0a, 0x12, 0x4b, 0x65, - 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x2f, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x22, 0x4c, 0x0a, 0x13, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x78, 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, - 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x4b, 0x65, 0x79, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x48, 0x0a, 0x15, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x18, 0x0a, 0x16, 0x4b, 0x65, - 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xbf, 0x02, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x62, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x2c, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x32, + 0x0a, 0x08, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x22, 0x70, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x34, 0x0a, 0x03, 0x72, + 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, + 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x66, 0x52, 0x03, 0x72, 0x65, + 0x66, 0x12, 0x31, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x22, 0x4a, 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x03, 0x72, 0x65, + 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x66, 0x52, 0x03, 0x72, 0x65, 0x66, + 0x22, 0x4c, 0x0a, 0x13, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x2c, 0x2e, 0x6e, - 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6e, 0x69, 0x74, + 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x7d, + 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x03, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x65, 0x66, 0x52, 0x03, 0x72, 0x65, 0x66, 0x12, 0x31, 0x0a, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x15, 0x0a, + 0x13, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4d, 0x0a, 0x15, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, + 0x03, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x06, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x12, 0x2f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, + 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x66, 0x52, 0x03, + 0x72, 0x65, 0x66, 0x22, 0x18, 0x0a, 0x16, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xbf, 0x02, + 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x62, 0x0a, 0x03, 0x47, 0x65, + 0x74, 0x12, 0x2c, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, + 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, + 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x2c, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, - 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa3, 0x01, 0x0a, 0x1b, 0x69, 0x6f, 0x2e, 0x6e, 0x69, - 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x6b, 0x65, 0x79, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, - 0x69, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x63, 0x68, 0x2f, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, - 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x6b, 0x65, 0x79, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x4b, 0x65, 0x79, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x70, 0x62, 0xaa, 0x02, 0x18, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, - 0x31, 0xca, 0x02, 0x18, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x5c, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x2f, 0x2e, 0x6e, + 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, + 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0xa3, 0x01, 0x0a, 0x1b, 0x69, 0x6f, 0x2e, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x6b, 0x65, 0x79, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0x42, + 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x50, 0x01, 0x5a, 0x42, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, + 0x63, 0x68, 0x2f, 0x6e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x70, + 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, 0x65, 0x79, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x70, 0x62, 0xaa, + 0x02, 0x18, 0x4e, 0x69, 0x74, 0x72, 0x69, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, + 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x76, 0x31, 0xca, 0x02, 0x18, 0x4e, 0x69, 0x74, + 0x72, 0x69, 0x63, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5c, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -557,7 +558,7 @@ func file_nitric_proto_keyvalue_v1_keyvalue_proto_rawDescGZIP() []byte { var file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_nitric_proto_keyvalue_v1_keyvalue_proto_goTypes = []interface{}{ (*Store)(nil), // 0: nitric.proto.KeyValue.v1.Store - (*Key)(nil), // 1: nitric.proto.KeyValue.v1.Key + (*ValueRef)(nil), // 1: nitric.proto.KeyValue.v1.ValueRef (*Value)(nil), // 2: nitric.proto.KeyValue.v1.Value (*KeyValueGetRequest)(nil), // 3: nitric.proto.KeyValue.v1.KeyValueGetRequest (*KeyValueGetResponse)(nil), // 4: nitric.proto.KeyValue.v1.KeyValueGetResponse @@ -568,13 +569,13 @@ var file_nitric_proto_keyvalue_v1_keyvalue_proto_goTypes = []interface{}{ (*structpb.Struct)(nil), // 9: google.protobuf.Struct } var file_nitric_proto_keyvalue_v1_keyvalue_proto_depIdxs = []int32{ - 1, // 0: nitric.proto.KeyValue.v1.Value.key:type_name -> nitric.proto.KeyValue.v1.Key + 1, // 0: nitric.proto.KeyValue.v1.Value.ref:type_name -> nitric.proto.KeyValue.v1.ValueRef 9, // 1: nitric.proto.KeyValue.v1.Value.content:type_name -> google.protobuf.Struct - 1, // 2: nitric.proto.KeyValue.v1.KeyValueGetRequest.key:type_name -> nitric.proto.KeyValue.v1.Key + 1, // 2: nitric.proto.KeyValue.v1.KeyValueGetRequest.ref:type_name -> nitric.proto.KeyValue.v1.ValueRef 2, // 3: nitric.proto.KeyValue.v1.KeyValueGetResponse.value:type_name -> nitric.proto.KeyValue.v1.Value - 1, // 4: nitric.proto.KeyValue.v1.KeyValueSetRequest.key:type_name -> nitric.proto.KeyValue.v1.Key + 1, // 4: nitric.proto.KeyValue.v1.KeyValueSetRequest.ref:type_name -> nitric.proto.KeyValue.v1.ValueRef 9, // 5: nitric.proto.KeyValue.v1.KeyValueSetRequest.content:type_name -> google.protobuf.Struct - 1, // 6: nitric.proto.KeyValue.v1.KeyValueDeleteRequest.key:type_name -> nitric.proto.KeyValue.v1.Key + 1, // 6: nitric.proto.KeyValue.v1.KeyValueDeleteRequest.ref:type_name -> nitric.proto.KeyValue.v1.ValueRef 3, // 7: nitric.proto.KeyValue.v1.KeyValue.Get:input_type -> nitric.proto.KeyValue.v1.KeyValueGetRequest 5, // 8: nitric.proto.KeyValue.v1.KeyValue.Set:input_type -> nitric.proto.KeyValue.v1.KeyValueSetRequest 7, // 9: nitric.proto.KeyValue.v1.KeyValue.Delete:input_type -> nitric.proto.KeyValue.v1.KeyValueDeleteRequest @@ -607,7 +608,7 @@ func file_nitric_proto_keyvalue_v1_keyvalue_proto_init() { } } file_nitric_proto_keyvalue_v1_keyvalue_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Key); i { + switch v := v.(*ValueRef); i { case 0: return &v.state case 1: diff --git a/nitric/proto/keyvalue/v1/keyvalue.proto b/nitric/proto/keyvalue/v1/keyvalue.proto index 953b46018..e328dcf70 100644 --- a/nitric/proto/keyvalue/v1/keyvalue.proto +++ b/nitric/proto/keyvalue/v1/keyvalue.proto @@ -24,35 +24,35 @@ service KeyValue { rpc Delete (KeyValueDeleteRequest) returns (KeyValueDeleteResponse); } -// Provides a Collection type for storing documents +// Provides a Key Value Store type for storing documents message Store { // The store name string name = 1; } -// Provides a document identifying key type -message Key { - // The item collection +// ValueRef provides a unique identifier for a value +message ValueRef { + // The key/value store name string store = 1; - // The items unique key + // The item's unique key within the store string key = 2; } -// Provides a return document type +// Value provides a return value type message Value { - // The document's unique key, including collection/sub-collections - Key key = 1; + // ValueRef of the key/value pair, which includes the store and key + ValueRef ref = 1; - // The document content (JSON object) + // The content (JSON object) google.protobuf.Struct content = 2; } // Service Request & Response Messages message KeyValueGetRequest { - // Key of the document to retrieve - Key key = 1; + // ValueRef of the key/value pair to get, which includes the store and key + ValueRef ref = 1; } message KeyValueGetResponse { @@ -61,17 +61,17 @@ message KeyValueGetResponse { } message KeyValueSetRequest { - // Key of the document to set - Key key = 1 ; - // The document content to store (JSON object) + // ValueRef of the key/value pair to set, which includes the store and key + ValueRef ref = 1 ; + // The value content to store (JSON object) google.protobuf.Struct content = 3; } message KeyValueSetResponse {} message KeyValueDeleteRequest { - // Key of the document to delete - Key key = 1; + // ValueRef of the key/value pair to delete, which includes the store and key + ValueRef ref = 1; } message KeyValueDeleteResponse {}