From d7cf30ae187f5c6247fbcc79a62ee5940e7efcdf Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 6 Jun 2022 13:11:35 -0400 Subject: [PATCH 1/3] Remove the v0 API (except developer) --- .golangci.yaml | 6 - README.md | 1 - buf.gen.yaml | 2 +- proto/apidocs.swagger.json | 506 +----- .../authzed/api/v0/00_legacy_registration.go | 75 - .../authzed/api/v0/01_workaround_num_items.go | 9 - .../api/v0/02_handwritten_validation.go | 74 - proto/authzed/api/v0/acl_service.pb.go | 1410 ----------------- .../authzed/api/v0/acl_service.pb.validate.go | 1287 --------------- proto/authzed/api/v0/acl_service_grpc.pb.go | 299 ---- proto/authzed/api/v0/core.pb.go | 571 +------ proto/authzed/api/v0/core.pb.validate.go | 733 ++++----- proto/authzed/api/v0/developer.pb.go | 360 ++--- proto/authzed/api/v0/developer.pb.validate.go | 837 +++++++++- proto/authzed/api/v0/namespace.pb.go | 1289 --------------- proto/authzed/api/v0/namespace.pb.validate.go | 1318 --------------- proto/authzed/api/v0/namespace_service.pb.go | 565 ------- .../api/v0/namespace_service.pb.validate.go | 561 ------- .../api/v0/namespace_service_grpc.pb.go | 188 --- proto/authzed/api/v0/watch_service.pb.go | 270 ---- .../api/v0/watch_service.pb.validate.go | 227 --- proto/authzed/api/v0/watch_service_grpc.pb.go | 137 -- proto/authzed/api/v1/core.pb.validate.go | 584 ++++++- proto/authzed/api/v1/openapi.pb.validate.go | 2 + .../api/v1/permission_service.pb.validate.go | 1385 +++++++++++++++- .../api/v1/permission_service_grpc.pb.go | 50 +- .../api/v1/schema_service.pb.validate.go | 158 +- .../api/v1/watch_service.pb.validate.go | 154 +- .../api/v1alpha1/schema.pb.validate.go | 170 +- .../watchresources_service.pb.validate.go | 244 ++- .../api/validation_test/tuples_test.go | 58 - v0/client.go | 77 - v0/filter.go | 157 -- v0/filter_test.go | 47 - v0/flatten.go | 165 -- v0/flatten_test.go | 134 -- v0/integration_test.go | 70 - v0/x/nsbuilder/nsbuilder.go | 93 -- v0/x/parallel/parallel.go | 62 - 39 files changed, 3870 insertions(+), 10465 deletions(-) delete mode 100644 proto/authzed/api/v0/00_legacy_registration.go delete mode 100644 proto/authzed/api/v0/01_workaround_num_items.go delete mode 100644 proto/authzed/api/v0/acl_service.pb.go delete mode 100644 proto/authzed/api/v0/acl_service.pb.validate.go delete mode 100644 proto/authzed/api/v0/acl_service_grpc.pb.go delete mode 100644 proto/authzed/api/v0/namespace.pb.go delete mode 100644 proto/authzed/api/v0/namespace.pb.validate.go delete mode 100644 proto/authzed/api/v0/namespace_service.pb.go delete mode 100644 proto/authzed/api/v0/namespace_service.pb.validate.go delete mode 100644 proto/authzed/api/v0/namespace_service_grpc.pb.go delete mode 100644 proto/authzed/api/v0/watch_service.pb.go delete mode 100644 proto/authzed/api/v0/watch_service.pb.validate.go delete mode 100644 proto/authzed/api/v0/watch_service_grpc.pb.go delete mode 100644 v0/client.go delete mode 100644 v0/filter.go delete mode 100644 v0/filter_test.go delete mode 100644 v0/flatten.go delete mode 100644 v0/flatten_test.go delete mode 100644 v0/integration_test.go delete mode 100644 v0/x/nsbuilder/nsbuilder.go delete mode 100644 v0/x/parallel/parallel.go diff --git a/.golangci.yaml b/.golangci.yaml index 3e3bf7a..5960fe0 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -24,9 +24,3 @@ linters: - "typecheck" - "unused" - "varcheck" -issues: - exclude-rules: - - linters: - - "staticcheck" - path: "v0" # Temporarily skip deprecation checks during grace period - text: "SA1019:" diff --git a/README.md b/README.md index b7eda2d..3449946 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ Once stored, data can be performantly queried to answer questions such as "Does Supported client API versions: - [v1](https://buf.build/authzed/api/docs/main/authzed.api.v1) - [v1alpha1](https://buf.build/authzed/api/docs/main/authzed.api.v1alpha1) -- "v0" - deprecated You can find more info about the API in the [Authzed Documentation API Reference] or the [Authzed API Buf Registry repository]. diff --git a/buf.gen.yaml b/buf.gen.yaml index ba8fe8f..5a5f40d 100755 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,4 +1,4 @@ -#!/usr/bin/env -S buf generate buf.build/authzed/api:86da72bc0f5dc8b7e26b2fdd609dec4ff2b09f1f --template +#!/usr/bin/env -S buf generate buf.build/authzed/api:3e463bb359cf56fc95dae28138cbe4f09c67aa17 --template --- version: "v1" plugins: diff --git a/proto/apidocs.swagger.json b/proto/apidocs.swagger.json index 2bbda47..1dda882 100644 --- a/proto/apidocs.swagger.json +++ b/proto/apidocs.swagger.json @@ -14,18 +14,9 @@ } }, "tags": [ - { - "name": "ACLService" - }, { "name": "DeveloperService" }, - { - "name": "NamespaceService" - }, - { - "name": "WatchService" - }, { "name": "PermissionsService" }, @@ -56,7 +47,7 @@ "paths": { "/v1/permissions/check": { "post": { - "summary": "CheckPermission checks whether a subject has a particular permission or is\na member of a particular relation, on a given resource.", + "summary": "CheckPermission determines for a given resource whether a subject computes\nto having a permission or is a direct member of a particular relation.", "operationId": "PermissionsService_CheckPermission", "responses": { "200": { @@ -89,7 +80,7 @@ }, "/v1/permissions/expand": { "post": { - "summary": "ExpandPermissionTree expands the relationships reachable from a particular\npermission or relation of a given resource.", + "summary": "ExpandPermissionTree reveals the graph structure for a resource's\npermission or relation. This RPC does not recurse infinitely deep and may\nrequire multiple calls to fully unnest a deeply nested graph.", "operationId": "PermissionsService_ExpandPermissionTree", "responses": { "200": { @@ -122,7 +113,7 @@ }, "/v1/permissions/resources": { "post": { - "summary": "LookupResources returns the IDs of all resources on which the specified\nsubject has permission or on which the specified subject is a member of the\nrelation.", + "summary": "LookupResources returns all the resources of a given type that a subject\ncan access whether via a computed permission or relation membership.", "operationId": "PermissionsService_LookupResources", "responses": { "200": { @@ -164,7 +155,7 @@ }, "/v1/relationships/delete": { "post": { - "summary": "DeleteRelationships deletes relationships matching one or more filters, in\nbulk.", + "summary": "DeleteRelationships atomically bulk deletes relationships matching one or\nmore filters. An optional set of preconditions can be provided that must\nbe satisfied for the operation to commit.", "operationId": "PermissionsService_DeleteRelationships", "responses": { "200": { @@ -239,7 +230,7 @@ }, "/v1/relationships/write": { "post": { - "summary": "WriteRelationships writes and/or deletes a set of specified relationships,\nwith an optional set of precondition relationships that must exist before\nthe operation can commit.", + "summary": "WriteRelationships atomically writes and/or deletes a set of specified\nrelationships. An optional set of preconditions can be provided that must\nbe satisfied for the operation to commit.", "operationId": "PermissionsService_WriteRelationships", "responses": { "200": { @@ -347,13 +338,13 @@ "type": "object", "properties": { "result": { - "$ref": "#/definitions/apiv1WatchResponse" + "$ref": "#/definitions/v1WatchResponse" }, "error": { "$ref": "#/definitions/rpcStatus" } }, - "title": "Stream result of apiv1WatchResponse" + "title": "Stream result of v1WatchResponse" } }, "default": { @@ -369,7 +360,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/apiv1WatchRequest" + "$ref": "#/definitions/v1WatchRequest" } } ], @@ -422,29 +413,6 @@ } }, "definitions": { - "AllowedRelationPublicWildcard": { - "type": "object" - }, - "CheckResponseMembership": { - "type": "string", - "enum": [ - "UNKNOWN", - "NOT_MEMBER", - "MEMBER" - ], - "default": "UNKNOWN" - }, - "ChildThis": { - "type": "object" - }, - "ComputedUsersetObject": { - "type": "string", - "enum": [ - "TUPLE_OBJECT", - "TUPLE_USERSET_OBJECT" - ], - "default": "TUPLE_OBJECT" - }, "DeveloperErrorErrorKind": { "type": "string", "enum": [ @@ -483,33 +451,6 @@ ], "default": "UNKNOWN_REFERENCE" }, - "RelationTupleFilterFilter": { - "type": "string", - "enum": [ - "UNKNOWN", - "OBJECT_ID", - "RELATION", - "USERSET" - ], - "default": "UNKNOWN" - }, - "SetOperationChild": { - "type": "object", - "properties": { - "This": { - "$ref": "#/definitions/ChildThis" - }, - "computedUserset": { - "$ref": "#/definitions/v0ComputedUserset" - }, - "tupleToUserset": { - "$ref": "#/definitions/v0TupleToUserset" - }, - "usersetRewrite": { - "$ref": "#/definitions/v0UsersetRewrite" - } - } - }, "SubjectFilterRelationFilter": { "type": "object", "properties": { @@ -518,21 +459,6 @@ } } }, - "apiv0WatchResponse": { - "type": "object", - "properties": { - "updates": { - "type": "array", - "items": { - "$ref": "#/definitions/v0RelationTupleUpdate" - }, - "description": "A watch response contains all tuple modification events in ascending\ntimestamp order, from the requested start timestamp to a timestamp\nencoded in a heartbeat zookie included in the watch response. The client\ncan use the heartbeat zookie to resume watching where the previous watch\nresponse left off." - }, - "endRevision": { - "$ref": "#/definitions/v0Zookie" - } - } - }, "apiv1ReadSchemaRequest": { "type": "object", "description": "ReadSchemaRequest returns the schema from the database." @@ -547,36 +473,6 @@ }, "description": "ReadSchemaResponse is the resulting data after having read the Object\nDefinitions from a Schema." }, - "apiv1WatchRequest": { - "type": "object", - "properties": { - "optionalObjectTypes": { - "type": "array", - "items": { - "type": "string" - } - }, - "optionalStartCursor": { - "$ref": "#/definitions/v1ZedToken" - } - }, - "description": "WatchRequest specifies the object definitions for which we want to start\nwatching mutations, and an optional start snapshot for when to start\nwatching." - }, - "apiv1WatchResponse": { - "type": "object", - "properties": { - "updates": { - "type": "array", - "items": { - "$ref": "#/definitions/v1RelationshipUpdate" - } - }, - "changesThrough": { - "$ref": "#/definitions/v1ZedToken" - } - }, - "description": "WatchResponse contains all tuple modification events in ascending\ntimestamp order, from the requested start snapshot to a snapshot\nencoded in the watch response. The client can use the snapshot to resume\nwatching where the previous watch response left off." - }, "apiv1WriteSchemaRequest": { "type": "object", "properties": { @@ -629,12 +525,10 @@ "type": "object", "properties": { "@type": { - "type": "string", - "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + "type": "string" } }, - "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "additionalProperties": {} }, "rpcStatus": { "type": "object", @@ -654,53 +548,6 @@ } } }, - "v0AllowedRelation": { - "type": "object", - "properties": { - "namespace": { - "type": "string" - }, - "relation": { - "type": "string" - }, - "publicWildcard": { - "$ref": "#/definitions/AllowedRelationPublicWildcard" - } - } - }, - "v0CheckResponse": { - "type": "object", - "properties": { - "isMember": { - "type": "boolean" - }, - "revision": { - "$ref": "#/definitions/v0Zookie" - }, - "membership": { - "$ref": "#/definitions/CheckResponseMembership" - } - } - }, - "v0ComputedUserset": { - "type": "object", - "properties": { - "object": { - "$ref": "#/definitions/ComputedUsersetObject" - }, - "relation": { - "type": "string" - } - } - }, - "v0DeleteConfigsResponse": { - "type": "object", - "properties": { - "revision": { - "$ref": "#/definitions/v0Zookie" - } - } - }, "v0DeveloperError": { "type": "object", "properties": { @@ -733,17 +580,6 @@ } } }, - "v0DirectUserset": { - "type": "object", - "properties": { - "users": { - "type": "array", - "items": { - "$ref": "#/definitions/v0User" - } - } - } - }, "v0EditCheckResponse": { "type": "object", "properties": { @@ -775,18 +611,6 @@ } } }, - "v0ExpandResponse": { - "type": "object", - "properties": { - "treeNode": { - "$ref": "#/definitions/v0RelationTupleTreeNode", - "description": "The result is represented by a userset tree whose leaf nodes are user IDs\nor usersets pointing to other ⟨object#relation⟩ pairs, and intermediate\nnodes represent union, intersection, or exclusion operators." - }, - "revision": { - "$ref": "#/definitions/v0Zookie" - } - } - }, "v0FormatSchemaResponse": { "type": "object", "properties": { @@ -798,23 +622,6 @@ } } }, - "v0LookupResponse": { - "type": "object", - "properties": { - "resolvedObjectIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "nextPageReference": { - "type": "string" - }, - "revision": { - "$ref": "#/definitions/v0Zookie" - } - } - }, "v0LookupShareResponse": { "type": "object", "properties": { @@ -835,34 +642,6 @@ } } }, - "v0Metadata": { - "type": "object", - "properties": { - "metadataMessage": { - "type": "array", - "items": { - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "v0NamespaceDefinition": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "relation": { - "type": "array", - "items": { - "$ref": "#/definitions/v0Relation" - } - }, - "metadata": { - "$ref": "#/definitions/v0Metadata" - } - } - }, "v0ObjectAndRelation": { "type": "object", "properties": { @@ -877,73 +656,6 @@ } } }, - "v0ReadConfigResponse": { - "type": "object", - "properties": { - "namespace": { - "type": "string" - }, - "config": { - "$ref": "#/definitions/v0NamespaceDefinition" - }, - "revision": { - "$ref": "#/definitions/v0Zookie" - } - } - }, - "v0ReadResponse": { - "type": "object", - "properties": { - "tuplesets": { - "type": "array", - "items": { - "$ref": "#/definitions/v0ReadResponseTupleset" - } - }, - "revision": { - "$ref": "#/definitions/v0Zookie" - } - } - }, - "v0ReadResponseTupleset": { - "type": "object", - "properties": { - "tuples": { - "type": "array", - "items": { - "$ref": "#/definitions/v0RelationTuple" - } - } - } - }, - "v0Relation": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "usersetRewrite": { - "$ref": "#/definitions/v0UsersetRewrite" - }, - "typeInformation": { - "$ref": "#/definitions/v0TypeInformation" - }, - "metadata": { - "$ref": "#/definitions/v0Metadata" - } - } - }, - "v0RelationReference": { - "type": "object", - "properties": { - "namespace": { - "type": "string" - }, - "relation": { - "type": "string" - } - } - }, "v0RelationTuple": { "type": "object", "properties": { @@ -956,65 +668,6 @@ } } }, - "v0RelationTupleFilter": { - "type": "object", - "properties": { - "namespace": { - "type": "string" - }, - "objectId": { - "type": "string", - "title": "Setting any of these fields requires the appropriate filter type to be\nadded to the filters list as well" - }, - "relation": { - "type": "string" - }, - "userset": { - "$ref": "#/definitions/v0ObjectAndRelation" - }, - "filters": { - "type": "array", - "items": { - "$ref": "#/definitions/RelationTupleFilterFilter" - } - } - } - }, - "v0RelationTupleTreeNode": { - "type": "object", - "properties": { - "intermediateNode": { - "$ref": "#/definitions/v0SetOperationUserset" - }, - "leafNode": { - "$ref": "#/definitions/v0DirectUserset" - }, - "expanded": { - "$ref": "#/definitions/v0ObjectAndRelation" - } - } - }, - "v0RelationTupleUpdate": { - "type": "object", - "properties": { - "operation": { - "$ref": "#/definitions/v0RelationTupleUpdateOperation" - }, - "tuple": { - "$ref": "#/definitions/v0RelationTuple" - } - } - }, - "v0RelationTupleUpdateOperation": { - "type": "string", - "enum": [ - "UNKNOWN", - "CREATE", - "TOUCH", - "DELETE" - ], - "default": "UNKNOWN" - }, "v0RequestContext": { "type": "object", "properties": { @@ -1026,50 +679,9 @@ "items": { "$ref": "#/definitions/v0RelationTuple" } - }, - "legacyNsConfigs": { - "type": "array", - "items": { - "$ref": "#/definitions/v0NamespaceDefinition" - } } } }, - "v0SetOperation": { - "type": "object", - "properties": { - "child": { - "type": "array", - "items": { - "$ref": "#/definitions/SetOperationChild" - } - } - } - }, - "v0SetOperationUserset": { - "type": "object", - "properties": { - "operation": { - "$ref": "#/definitions/v0SetOperationUsersetOperation" - }, - "childNodes": { - "type": "array", - "items": { - "$ref": "#/definitions/v0RelationTupleTreeNode" - } - } - } - }, - "v0SetOperationUsersetOperation": { - "type": "string", - "enum": [ - "INVALID", - "UNION", - "INTERSECTION", - "EXCLUSION" - ], - "default": "INVALID" - }, "v0ShareResponse": { "type": "object", "properties": { @@ -1078,36 +690,6 @@ } } }, - "v0TupleToUserset": { - "type": "object", - "properties": { - "tupleset": { - "$ref": "#/definitions/v0TupleToUsersetTupleset" - }, - "computedUserset": { - "$ref": "#/definitions/v0ComputedUserset" - } - } - }, - "v0TupleToUsersetTupleset": { - "type": "object", - "properties": { - "relation": { - "type": "string" - } - } - }, - "v0TypeInformation": { - "type": "object", - "properties": { - "allowedDirectRelations": { - "type": "array", - "items": { - "$ref": "#/definitions/v0AllowedRelation" - } - } - } - }, "v0UpgradeSchemaResponse": { "type": "object", "properties": { @@ -1127,20 +709,6 @@ } } }, - "v0UsersetRewrite": { - "type": "object", - "properties": { - "union": { - "$ref": "#/definitions/v0SetOperation" - }, - "intersection": { - "$ref": "#/definitions/v0SetOperation" - }, - "exclusion": { - "$ref": "#/definitions/v0SetOperation" - } - } - }, "v0ValidateResponse": { "type": "object", "properties": { @@ -1161,30 +729,6 @@ } } }, - "v0WriteConfigResponse": { - "type": "object", - "properties": { - "revision": { - "$ref": "#/definitions/v0Zookie" - } - } - }, - "v0WriteResponse": { - "type": "object", - "properties": { - "revision": { - "$ref": "#/definitions/v0Zookie" - } - } - }, - "v0Zookie": { - "type": "object", - "properties": { - "token": { - "type": "string" - } - } - }, "v1AlgebraicSubjectSet": { "type": "object", "properties": { @@ -1531,6 +1075,36 @@ }, "title": "SubjectReference is used for referring to the subject portion of a\nRelationship. The relation component is optional and is used for defining a\nsub-relation on the subject, e.g. group:123#members" }, + "v1WatchRequest": { + "type": "object", + "properties": { + "optionalObjectTypes": { + "type": "array", + "items": { + "type": "string" + } + }, + "optionalStartCursor": { + "$ref": "#/definitions/v1ZedToken" + } + }, + "description": "WatchRequest specifies the object definitions for which we want to start\nwatching mutations, and an optional start snapshot for when to start\nwatching." + }, + "v1WatchResponse": { + "type": "object", + "properties": { + "updates": { + "type": "array", + "items": { + "$ref": "#/definitions/v1RelationshipUpdate" + } + }, + "changesThrough": { + "$ref": "#/definitions/v1ZedToken" + } + }, + "description": "WatchResponse contains all tuple modification events in ascending\ntimestamp order, from the requested start snapshot to a snapshot\nencoded in the watch response. The client can use the snapshot to resume\nwatching where the previous watch response left off." + }, "v1WriteRelationshipsRequest": { "type": "object", "properties": { diff --git a/proto/authzed/api/v0/00_legacy_registration.go b/proto/authzed/api/v0/00_legacy_registration.go deleted file mode 100644 index c7c82ee..0000000 --- a/proto/authzed/api/v0/00_legacy_registration.go +++ /dev/null @@ -1,75 +0,0 @@ -package v0 - -import "google.golang.org/grpc" - -// RegisterACLServiceServer registers an ACLService under its legacy -// package-less descriptor. -func RegisterLegacyACLServiceServer(s grpc.ServiceRegistrar, srv ACLServiceServer) { - s.RegisterService(&Legacy_ACLService_ServiceDesc, srv) -} - -// Legacy_ACLService_ServiceDesc is an grpc.ServiceDesc for the original -// ACLService service that had no Protobuf package. -// -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Legacy_ACLService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "ACLService", - HandlerType: (*ACLServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Read", - Handler: _ACLService_Read_Handler, - }, - { - MethodName: "Write", - Handler: _ACLService_Write_Handler, - }, - { - MethodName: "Check", - Handler: _ACLService_Check_Handler, - }, - { - MethodName: "ContentChangeCheck", - Handler: _ACLService_ContentChangeCheck_Handler, - }, - { - MethodName: "Expand", - Handler: _ACLService_Expand_Handler, - }, - { - MethodName: "Lookup", - Handler: _ACLService_Lookup_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "authzed/api/v0/acl_service.proto", -} - -// RegisterLegacyNamespaceServiceServer registers a NamespaceService under -// its legacy package-less descriptor. -func RegisterLegacyNamespaceServiceServer(s grpc.ServiceRegistrar, srv NamespaceServiceServer) { - s.RegisterService(&Legacy_NamespaceService_ServiceDesc, srv) -} - -// Legacy_NamespaceService_ServiceDesc is an grpc.ServiceDesc for the original -// NamespaceService service that had no Protobuf package. -// -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Legacy_NamespaceService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "NamespaceService", - HandlerType: (*NamespaceServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ReadConfig", - Handler: _NamespaceService_ReadConfig_Handler, - }, - { - MethodName: "WriteConfig", - Handler: _NamespaceService_WriteConfig_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "authzed/api/v0/namespace_service.proto", -} diff --git a/proto/authzed/api/v0/01_workaround_num_items.go b/proto/authzed/api/v0/01_workaround_num_items.go deleted file mode 100644 index c8ff1e7..0000000 --- a/proto/authzed/api/v0/01_workaround_num_items.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file has to be manually created to workaround the following issue: -// https://github.com/envoyproxy/protoc-gen-validate/issues/481 - -package v0 - -var _Metadata_MetadataMessage_InLookup = map[string]struct{}{ - "type.googleapis.com/impl.v1.DocComment": {}, - "type.googleapis.com/impl.v1.RelationMetadata": {}, -} diff --git a/proto/authzed/api/v0/02_handwritten_validation.go b/proto/authzed/api/v0/02_handwritten_validation.go index 7f8f6a2..7715218 100644 --- a/proto/authzed/api/v0/02_handwritten_validation.go +++ b/proto/authzed/api/v0/02_handwritten_validation.go @@ -2,50 +2,6 @@ package v0 -func (m *CheckRequest) HandwrittenValidate() error { - if m.GetTestUserset() != nil && m.GetTestUserset().GetObjectId() == "*" { - return ObjectAndRelationValidationError{ - field: "ObjectId", - reason: "alphanumeric value is required", - } - } - - return nil -} - -func (m *ContentChangeCheckRequest) HandwrittenValidate() error { - if m.GetTestUserset() != nil && m.GetTestUserset().GetObjectId() == "*" { - return ObjectAndRelationValidationError{ - field: "ObjectId", - reason: "alphanumeric value is required", - } - } - - return nil -} - -func (m *ExpandRequest) HandwrittenValidate() error { - if m.GetUserset() != nil && m.GetUserset().GetObjectId() == "*" { - return ObjectAndRelationValidationError{ - field: "ObjectId", - reason: "alphanumeric value is required", - } - } - - return nil -} - -func (m *LookupRequest) HandwrittenValidate() error { - if m.GetUser() != nil && m.GetUser().GetObjectId() == "*" { - return ObjectAndRelationValidationError{ - field: "ObjectId", - reason: "alphanumeric value is required", - } - } - - return nil -} - func (m *RelationTuple) HandwrittenValidate() error { if m.GetObjectAndRelation() != nil && m.GetObjectAndRelation().GetObjectId() == "*" { return ObjectAndRelationValidationError{ @@ -56,33 +12,3 @@ func (m *RelationTuple) HandwrittenValidate() error { return nil } - -func (m *RelationTupleUpdate) HandwrittenValidate() error { - if m.GetTuple() != nil { - return m.GetTuple().HandwrittenValidate() - } - - return nil -} - -func (m *WriteRequest) HandwrittenValidate() error { - if m.GetWriteConditions() != nil { - for _, condition := range m.GetWriteConditions() { - err := condition.HandwrittenValidate() - if err != nil { - return err - } - } - } - - if m.GetUpdates() != nil { - for _, update := range m.GetUpdates() { - err := update.HandwrittenValidate() - if err != nil { - return err - } - } - } - - return nil -} diff --git a/proto/authzed/api/v0/acl_service.pb.go b/proto/authzed/api/v0/acl_service.pb.go deleted file mode 100644 index bac1e9f..0000000 --- a/proto/authzed/api/v0/acl_service.pb.go +++ /dev/null @@ -1,1410 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc (unknown) -// authzed/api/v0/acl_service.proto is a deprecated file. - -package v0 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - 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) -) - -type RelationTupleFilter_Filter int32 - -const ( - RelationTupleFilter_UNKNOWN RelationTupleFilter_Filter = 0 - RelationTupleFilter_OBJECT_ID RelationTupleFilter_Filter = 1 - RelationTupleFilter_RELATION RelationTupleFilter_Filter = 2 - RelationTupleFilter_USERSET RelationTupleFilter_Filter = 4 -) - -// Enum value maps for RelationTupleFilter_Filter. -var ( - RelationTupleFilter_Filter_name = map[int32]string{ - 0: "UNKNOWN", - 1: "OBJECT_ID", - 2: "RELATION", - 4: "USERSET", - } - RelationTupleFilter_Filter_value = map[string]int32{ - "UNKNOWN": 0, - "OBJECT_ID": 1, - "RELATION": 2, - "USERSET": 4, - } -) - -func (x RelationTupleFilter_Filter) Enum() *RelationTupleFilter_Filter { - p := new(RelationTupleFilter_Filter) - *p = x - return p -} - -func (x RelationTupleFilter_Filter) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RelationTupleFilter_Filter) Descriptor() protoreflect.EnumDescriptor { - return file_authzed_api_v0_acl_service_proto_enumTypes[0].Descriptor() -} - -func (RelationTupleFilter_Filter) Type() protoreflect.EnumType { - return &file_authzed_api_v0_acl_service_proto_enumTypes[0] -} - -func (x RelationTupleFilter_Filter) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RelationTupleFilter_Filter.Descriptor instead. -func (RelationTupleFilter_Filter) EnumDescriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{0, 0} -} - -type CheckResponse_Membership int32 - -const ( - CheckResponse_UNKNOWN CheckResponse_Membership = 0 - CheckResponse_NOT_MEMBER CheckResponse_Membership = 1 - CheckResponse_MEMBER CheckResponse_Membership = 2 -) - -// Enum value maps for CheckResponse_Membership. -var ( - CheckResponse_Membership_name = map[int32]string{ - 0: "UNKNOWN", - 1: "NOT_MEMBER", - 2: "MEMBER", - } - CheckResponse_Membership_value = map[string]int32{ - "UNKNOWN": 0, - "NOT_MEMBER": 1, - "MEMBER": 2, - } -) - -func (x CheckResponse_Membership) Enum() *CheckResponse_Membership { - p := new(CheckResponse_Membership) - *p = x - return p -} - -func (x CheckResponse_Membership) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CheckResponse_Membership) Descriptor() protoreflect.EnumDescriptor { - return file_authzed_api_v0_acl_service_proto_enumTypes[1].Descriptor() -} - -func (CheckResponse_Membership) Type() protoreflect.EnumType { - return &file_authzed_api_v0_acl_service_proto_enumTypes[1] -} - -func (x CheckResponse_Membership) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CheckResponse_Membership.Descriptor instead. -func (CheckResponse_Membership) EnumDescriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{7, 0} -} - -// Deprecated: Do not use. -type RelationTupleFilter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` - // Setting any of these fields requires the appropriate filter type to be - // added to the filters list as well - ObjectId string `protobuf:"bytes,2,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"` - Relation string `protobuf:"bytes,3,opt,name=relation,proto3" json:"relation,omitempty"` - Userset *ObjectAndRelation `protobuf:"bytes,5,opt,name=userset,proto3" json:"userset,omitempty"` - Filters []RelationTupleFilter_Filter `protobuf:"varint,6,rep,packed,name=filters,proto3,enum=authzed.api.v0.RelationTupleFilter_Filter" json:"filters,omitempty"` -} - -func (x *RelationTupleFilter) Reset() { - *x = RelationTupleFilter{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RelationTupleFilter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RelationTupleFilter) ProtoMessage() {} - -func (x *RelationTupleFilter) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 RelationTupleFilter.ProtoReflect.Descriptor instead. -func (*RelationTupleFilter) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{0} -} - -func (x *RelationTupleFilter) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *RelationTupleFilter) GetObjectId() string { - if x != nil { - return x.ObjectId - } - return "" -} - -func (x *RelationTupleFilter) GetRelation() string { - if x != nil { - return x.Relation - } - return "" -} - -func (x *RelationTupleFilter) GetUserset() *ObjectAndRelation { - if x != nil { - return x.Userset - } - return nil -} - -func (x *RelationTupleFilter) GetFilters() []RelationTupleFilter_Filter { - if x != nil { - return x.Filters - } - return nil -} - -// Deprecated: Do not use. -type ReadRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A read request specifies one or multiple tuplesets and an optional zookie. - Tuplesets []*RelationTupleFilter `protobuf:"bytes,1,rep,name=tuplesets,proto3" json:"tuplesets,omitempty"` - AtRevision *Zookie `protobuf:"bytes,2,opt,name=at_revision,json=atRevision,proto3" json:"at_revision,omitempty"` -} - -func (x *ReadRequest) Reset() { - *x = ReadRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReadRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadRequest) ProtoMessage() {} - -func (x *ReadRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 ReadRequest.ProtoReflect.Descriptor instead. -func (*ReadRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{1} -} - -func (x *ReadRequest) GetTuplesets() []*RelationTupleFilter { - if x != nil { - return x.Tuplesets - } - return nil -} - -func (x *ReadRequest) GetAtRevision() *Zookie { - if x != nil { - return x.AtRevision - } - return nil -} - -// Deprecated: Do not use. -type ReadResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Tuplesets []*ReadResponse_Tupleset `protobuf:"bytes,1,rep,name=tuplesets,proto3" json:"tuplesets,omitempty"` - Revision *Zookie `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"` -} - -func (x *ReadResponse) Reset() { - *x = ReadResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReadResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadResponse) ProtoMessage() {} - -func (x *ReadResponse) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 ReadResponse.ProtoReflect.Descriptor instead. -func (*ReadResponse) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{2} -} - -func (x *ReadResponse) GetTuplesets() []*ReadResponse_Tupleset { - if x != nil { - return x.Tuplesets - } - return nil -} - -func (x *ReadResponse) GetRevision() *Zookie { - if x != nil { - return x.Revision - } - return nil -} - -// Deprecated: Do not use. -type WriteRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Clients may modify a single relation tuple to add or remove an ACL. They - // may also modify all tuples related to an object via a read-modify-write - // process with optimistic concurrency control [21] that uses a read RPC - // followed by a write RPC: - // - // 1. Read all relation tuples of an object, including a per-object “lock” - // tuple. - // 2. Generate the tuples to write or delete. Send the writes, along with a - // touch on the lock tuple, to Zanzibar, with the condition that the - // writes will be committed only if the lock tuple has not been modified - // since the read. - // 3. If the write condition is not met, go back to step 1. - // The lock tuple is just a regular relation tuple used by clients to - // detect write races. - // - // The lock tuple is just a regular relation tuple used by clients to - // detect write races. - WriteConditions []*RelationTuple `protobuf:"bytes,1,rep,name=write_conditions,json=writeConditions,proto3" json:"write_conditions,omitempty"` // To be bounded by configuration - Updates []*RelationTupleUpdate `protobuf:"bytes,2,rep,name=updates,proto3" json:"updates,omitempty"` -} - -func (x *WriteRequest) Reset() { - *x = WriteRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WriteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteRequest) ProtoMessage() {} - -func (x *WriteRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 WriteRequest.ProtoReflect.Descriptor instead. -func (*WriteRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{3} -} - -func (x *WriteRequest) GetWriteConditions() []*RelationTuple { - if x != nil { - return x.WriteConditions - } - return nil -} - -func (x *WriteRequest) GetUpdates() []*RelationTupleUpdate { - if x != nil { - return x.Updates - } - return nil -} - -// Deprecated: Do not use. -type WriteResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Revision *Zookie `protobuf:"bytes,1,opt,name=revision,proto3" json:"revision,omitempty"` -} - -func (x *WriteResponse) Reset() { - *x = WriteResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WriteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteResponse) ProtoMessage() {} - -func (x *WriteResponse) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 WriteResponse.ProtoReflect.Descriptor instead. -func (*WriteResponse) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{4} -} - -func (x *WriteResponse) GetRevision() *Zookie { - if x != nil { - return x.Revision - } - return nil -} - -// Deprecated: Do not use. -type CheckRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A check request specifies a userset, represented by ⟨object#relation⟩, - // a putative user, often represented by an authentication token, and a - // zookie corresponding to the desired object version. - TestUserset *ObjectAndRelation `protobuf:"bytes,1,opt,name=test_userset,json=testUserset,proto3" json:"test_userset,omitempty"` - User *User `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` // TODO swap for putative user - AtRevision *Zookie `protobuf:"bytes,3,opt,name=at_revision,json=atRevision,proto3" json:"at_revision,omitempty"` -} - -func (x *CheckRequest) Reset() { - *x = CheckRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CheckRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CheckRequest) ProtoMessage() {} - -func (x *CheckRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 CheckRequest.ProtoReflect.Descriptor instead. -func (*CheckRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{5} -} - -func (x *CheckRequest) GetTestUserset() *ObjectAndRelation { - if x != nil { - return x.TestUserset - } - return nil -} - -func (x *CheckRequest) GetUser() *User { - if x != nil { - return x.User - } - return nil -} - -func (x *CheckRequest) GetAtRevision() *Zookie { - if x != nil { - return x.AtRevision - } - return nil -} - -// Deprecated: Do not use. -type ContentChangeCheckRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // To authorize application content modifications, our clients send a special - // type of check request, a content-change check. A content-change check - // request does not carry a zookie and is evaluated at the latest snapshot. - TestUserset *ObjectAndRelation `protobuf:"bytes,1,opt,name=test_userset,json=testUserset,proto3" json:"test_userset,omitempty"` - User *User `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` // TODO swap for a putative user -} - -func (x *ContentChangeCheckRequest) Reset() { - *x = ContentChangeCheckRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContentChangeCheckRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContentChangeCheckRequest) ProtoMessage() {} - -func (x *ContentChangeCheckRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 ContentChangeCheckRequest.ProtoReflect.Descriptor instead. -func (*ContentChangeCheckRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{6} -} - -func (x *ContentChangeCheckRequest) GetTestUserset() *ObjectAndRelation { - if x != nil { - return x.TestUserset - } - return nil -} - -func (x *ContentChangeCheckRequest) GetUser() *User { - if x != nil { - return x.User - } - return nil -} - -// Deprecated: Do not use. -type CheckResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - IsMember bool `protobuf:"varint,1,opt,name=is_member,json=isMember,proto3" json:"is_member,omitempty"` - Revision *Zookie `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"` - Membership CheckResponse_Membership `protobuf:"varint,3,opt,name=membership,proto3,enum=authzed.api.v0.CheckResponse_Membership" json:"membership,omitempty"` -} - -func (x *CheckResponse) Reset() { - *x = CheckResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CheckResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CheckResponse) ProtoMessage() {} - -func (x *CheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 CheckResponse.ProtoReflect.Descriptor instead. -func (*CheckResponse) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{7} -} - -func (x *CheckResponse) GetIsMember() bool { - if x != nil { - return x.IsMember - } - return false -} - -func (x *CheckResponse) GetRevision() *Zookie { - if x != nil { - return x.Revision - } - return nil -} - -func (x *CheckResponse) GetMembership() CheckResponse_Membership { - if x != nil { - return x.Membership - } - return CheckResponse_UNKNOWN -} - -// Deprecated: Do not use. -type ExpandRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The Expand API returns the effective userset given an ⟨object#relation⟩ - // pair and an optional zookie. Unlike the Read API, Expand follows indirect - // references expressed through userset rewrite rules. - Userset *ObjectAndRelation `protobuf:"bytes,1,opt,name=userset,proto3" json:"userset,omitempty"` - AtRevision *Zookie `protobuf:"bytes,2,opt,name=at_revision,json=atRevision,proto3" json:"at_revision,omitempty"` -} - -func (x *ExpandRequest) Reset() { - *x = ExpandRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExpandRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExpandRequest) ProtoMessage() {} - -func (x *ExpandRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 ExpandRequest.ProtoReflect.Descriptor instead. -func (*ExpandRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{8} -} - -func (x *ExpandRequest) GetUserset() *ObjectAndRelation { - if x != nil { - return x.Userset - } - return nil -} - -func (x *ExpandRequest) GetAtRevision() *Zookie { - if x != nil { - return x.AtRevision - } - return nil -} - -// Deprecated: Do not use. -type ExpandResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The result is represented by a userset tree whose leaf nodes are user IDs - // or usersets pointing to other ⟨object#relation⟩ pairs, and intermediate - // nodes represent union, intersection, or exclusion operators. - TreeNode *RelationTupleTreeNode `protobuf:"bytes,1,opt,name=tree_node,json=treeNode,proto3" json:"tree_node,omitempty"` - Revision *Zookie `protobuf:"bytes,3,opt,name=revision,proto3" json:"revision,omitempty"` -} - -func (x *ExpandResponse) Reset() { - *x = ExpandResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExpandResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExpandResponse) ProtoMessage() {} - -func (x *ExpandResponse) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 ExpandResponse.ProtoReflect.Descriptor instead. -func (*ExpandResponse) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{9} -} - -func (x *ExpandResponse) GetTreeNode() *RelationTupleTreeNode { - if x != nil { - return x.TreeNode - } - return nil -} - -func (x *ExpandResponse) GetRevision() *Zookie { - if x != nil { - return x.Revision - } - return nil -} - -// Deprecated: Do not use. -type LookupRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ObjectRelation *RelationReference `protobuf:"bytes,1,opt,name=object_relation,json=objectRelation,proto3" json:"object_relation,omitempty"` - User *ObjectAndRelation `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` - AtRevision *Zookie `protobuf:"bytes,3,opt,name=at_revision,json=atRevision,proto3" json:"at_revision,omitempty"` - PageReference string `protobuf:"bytes,4,opt,name=page_reference,json=pageReference,proto3" json:"page_reference,omitempty"` - Limit uint32 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"` -} - -func (x *LookupRequest) Reset() { - *x = LookupRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LookupRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LookupRequest) ProtoMessage() {} - -func (x *LookupRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 LookupRequest.ProtoReflect.Descriptor instead. -func (*LookupRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{10} -} - -func (x *LookupRequest) GetObjectRelation() *RelationReference { - if x != nil { - return x.ObjectRelation - } - return nil -} - -func (x *LookupRequest) GetUser() *ObjectAndRelation { - if x != nil { - return x.User - } - return nil -} - -func (x *LookupRequest) GetAtRevision() *Zookie { - if x != nil { - return x.AtRevision - } - return nil -} - -func (x *LookupRequest) GetPageReference() string { - if x != nil { - return x.PageReference - } - return "" -} - -func (x *LookupRequest) GetLimit() uint32 { - if x != nil { - return x.Limit - } - return 0 -} - -// Deprecated: Do not use. -type LookupResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ResolvedObjectIds []string `protobuf:"bytes,1,rep,name=resolved_object_ids,json=resolvedObjectIds,proto3" json:"resolved_object_ids,omitempty"` - NextPageReference string `protobuf:"bytes,2,opt,name=next_page_reference,json=nextPageReference,proto3" json:"next_page_reference,omitempty"` - Revision *Zookie `protobuf:"bytes,3,opt,name=revision,proto3" json:"revision,omitempty"` -} - -func (x *LookupResponse) Reset() { - *x = LookupResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LookupResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LookupResponse) ProtoMessage() {} - -func (x *LookupResponse) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 LookupResponse.ProtoReflect.Descriptor instead. -func (*LookupResponse) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{11} -} - -func (x *LookupResponse) GetResolvedObjectIds() []string { - if x != nil { - return x.ResolvedObjectIds - } - return nil -} - -func (x *LookupResponse) GetNextPageReference() string { - if x != nil { - return x.NextPageReference - } - return "" -} - -func (x *LookupResponse) GetRevision() *Zookie { - if x != nil { - return x.Revision - } - return nil -} - -type ReadResponse_Tupleset struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Tuples []*RelationTuple `protobuf:"bytes,1,rep,name=tuples,proto3" json:"tuples,omitempty"` -} - -func (x *ReadResponse_Tupleset) Reset() { - *x = ReadResponse_Tupleset{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_acl_service_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReadResponse_Tupleset) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadResponse_Tupleset) ProtoMessage() {} - -func (x *ReadResponse_Tupleset) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_acl_service_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 ReadResponse_Tupleset.ProtoReflect.Descriptor instead. -func (*ReadResponse_Tupleset) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_acl_service_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *ReadResponse_Tupleset) GetTuples() []*RelationTuple { - if x != nil { - return x.Tuples - } - return nil -} - -var File_authzed_api_v0_acl_service_proto protoreflect.FileDescriptor - -var file_authzed_api_v0_acl_service_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, - 0x2f, 0x61, 0x63, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x30, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xec, 0x03, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x66, - 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x48, 0xfa, 0x42, 0x45, 0x72, 0x43, 0x28, 0x80, 0x01, 0x32, 0x3e, 0x5e, 0x28, 0x5b, - 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x31, 0x2c, - 0x36, 0x31, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x2f, 0x29, 0x3f, 0x5b, 0x61, - 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x31, 0x2c, 0x36, - 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0x52, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x4e, 0x0a, 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xfa, 0x42, 0x2e, 0x72, 0x2c, - 0x28, 0x80, 0x01, 0x32, 0x27, 0x5e, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, - 0x39, 0x5f, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0x30, 0x2d, 0x39, 0x2f, 0x5f, 0x7c, - 0x2d, 0x5d, 0x7b, 0x30, 0x2c, 0x31, 0x32, 0x37, 0x7d, 0x29, 0x3f, 0x24, 0x52, 0x08, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x46, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xfa, 0x42, 0x27, 0x72, 0x25, 0x28, - 0x40, 0x32, 0x21, 0x5e, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, - 0x39, 0x5f, 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, - 0x5d, 0x29, 0x3f, 0x24, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, - 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x12, 0x53, 0x0a, 0x07, 0x66, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x92, 0x01, 0x07, - 0x22, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, - 0x22, 0x3f, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4f, 0x42, 0x4a, 0x45, 0x43, - 0x54, 0x5f, 0x49, 0x44, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x49, - 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x53, 0x45, 0x52, 0x53, 0x45, 0x54, 0x10, - 0x04, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x9e, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x52, 0x0a, 0x09, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x65, - 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x0f, 0xfa, - 0x42, 0x0c, 0x92, 0x01, 0x09, 0x08, 0x01, 0x22, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x09, - 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x0b, 0x61, 0x74, 0x5f, - 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, - 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, - 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, - 0x6f, 0x6e, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xce, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x74, 0x75, 0x70, 0x6c, 0x65, - 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x65, - 0x74, 0x52, 0x09, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x73, 0x12, 0x32, 0x0a, 0x08, - 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, - 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, - 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x1a, 0x41, 0x0a, 0x08, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x12, 0x35, 0x0a, 0x06, - 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x52, 0x06, 0x74, 0x75, 0x70, - 0x6c, 0x65, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xb9, 0x01, 0x0a, 0x0c, 0x57, 0x72, 0x69, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x57, 0x0a, 0x10, 0x77, 0x72, 0x69, 0x74, - 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, - 0x65, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x92, 0x01, 0x07, 0x22, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, - 0x52, 0x0f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x4c, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, - 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x92, 0x01, 0x07, 0x22, - 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x3a, - 0x02, 0x18, 0x01, 0x22, 0x47, 0x0a, 0x0d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x08, - 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xcf, 0x01, 0x0a, - 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, - 0x0c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6e, 0x64, 0x52, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, - 0x52, 0x0b, 0x74, 0x65, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x12, 0x32, 0x0a, - 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x55, 0x73, 0x65, - 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x04, 0x75, 0x73, 0x65, - 0x72, 0x12, 0x37, 0x0a, 0x0b, 0x61, 0x74, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x0a, - 0x61, 0x74, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xa3, - 0x01, 0x0a, 0x19, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, 0x0c, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x6c, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x0b, 0x74, 0x65, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x12, 0x32, 0x0a, 0x04, - 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, - 0x3a, 0x02, 0x18, 0x01, 0x22, 0xe5, 0x01, 0x0a, 0x0d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x6d, 0x65, 0x6d, - 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4d, 0x65, 0x6d, - 0x62, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x08, 0x72, - 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x73, 0x68, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, - 0x70, 0x22, 0x35, 0x0a, 0x0a, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, - 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, - 0x4e, 0x4f, 0x54, 0x5f, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, - 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x93, 0x01, 0x0a, - 0x0d, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x45, - 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, 0x75, 0x73, - 0x65, 0x72, 0x73, 0x65, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x61, 0x74, 0x5f, 0x72, 0x65, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, - 0x69, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, - 0x18, 0x01, 0x22, 0x8c, 0x01, 0x0a, 0x0e, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x09, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x6e, 0x6f, - 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x54, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, - 0x08, 0x74, 0x72, 0x65, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, - 0x6b, 0x69, 0x65, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, - 0x01, 0x22, 0xa0, 0x02, 0x0a, 0x0d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x54, 0x0a, 0x0f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, - 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0e, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x04, 0x75, 0x73, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, - 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, - 0x6e, 0x64, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, - 0x01, 0x02, 0x10, 0x01, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x0b, 0x61, 0x74, - 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x52, 0x65, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x67, - 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, - 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x3a, 0x02, 0x18, 0x01, 0x22, 0xa8, 0x01, 0x0a, 0x0e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x72, 0x65, 0x73, 0x6f, 0x6c, - 0x76, 0x65, 0x64, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x6e, 0x65, 0x78, 0x74, 0x5f, - 0x70, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, - 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, - 0x65, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, 0x01, 0x32, - 0xeb, 0x03, 0x0a, 0x0a, 0x41, 0x43, 0x4c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, - 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x1b, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, 0x49, 0x0a, 0x05, 0x57, 0x72, 0x69, 0x74, 0x65, 0x12, - 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, - 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x57, - 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, - 0x01, 0x12, 0x49, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1c, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, 0x63, 0x0a, 0x12, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x12, 0x29, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, - 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, - 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, - 0x01, 0x12, 0x4c, 0x0a, 0x06, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x12, 0x1d, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x45, 0x78, 0x70, - 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x45, 0x78, 0x70, 0x61, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, - 0x4c, 0x0a, 0x06, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x12, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, - 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, - 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x42, 0x4b, 0x0a, - 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2d, - 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0xb8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_authzed_api_v0_acl_service_proto_rawDescOnce sync.Once - file_authzed_api_v0_acl_service_proto_rawDescData = file_authzed_api_v0_acl_service_proto_rawDesc -) - -func file_authzed_api_v0_acl_service_proto_rawDescGZIP() []byte { - file_authzed_api_v0_acl_service_proto_rawDescOnce.Do(func() { - file_authzed_api_v0_acl_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authzed_api_v0_acl_service_proto_rawDescData) - }) - return file_authzed_api_v0_acl_service_proto_rawDescData -} - -var file_authzed_api_v0_acl_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_authzed_api_v0_acl_service_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_authzed_api_v0_acl_service_proto_goTypes = []interface{}{ - (RelationTupleFilter_Filter)(0), // 0: authzed.api.v0.RelationTupleFilter.Filter - (CheckResponse_Membership)(0), // 1: authzed.api.v0.CheckResponse.Membership - (*RelationTupleFilter)(nil), // 2: authzed.api.v0.RelationTupleFilter - (*ReadRequest)(nil), // 3: authzed.api.v0.ReadRequest - (*ReadResponse)(nil), // 4: authzed.api.v0.ReadResponse - (*WriteRequest)(nil), // 5: authzed.api.v0.WriteRequest - (*WriteResponse)(nil), // 6: authzed.api.v0.WriteResponse - (*CheckRequest)(nil), // 7: authzed.api.v0.CheckRequest - (*ContentChangeCheckRequest)(nil), // 8: authzed.api.v0.ContentChangeCheckRequest - (*CheckResponse)(nil), // 9: authzed.api.v0.CheckResponse - (*ExpandRequest)(nil), // 10: authzed.api.v0.ExpandRequest - (*ExpandResponse)(nil), // 11: authzed.api.v0.ExpandResponse - (*LookupRequest)(nil), // 12: authzed.api.v0.LookupRequest - (*LookupResponse)(nil), // 13: authzed.api.v0.LookupResponse - (*ReadResponse_Tupleset)(nil), // 14: authzed.api.v0.ReadResponse.Tupleset - (*ObjectAndRelation)(nil), // 15: authzed.api.v0.ObjectAndRelation - (*Zookie)(nil), // 16: authzed.api.v0.Zookie - (*RelationTuple)(nil), // 17: authzed.api.v0.RelationTuple - (*RelationTupleUpdate)(nil), // 18: authzed.api.v0.RelationTupleUpdate - (*User)(nil), // 19: authzed.api.v0.User - (*RelationTupleTreeNode)(nil), // 20: authzed.api.v0.RelationTupleTreeNode - (*RelationReference)(nil), // 21: authzed.api.v0.RelationReference -} -var file_authzed_api_v0_acl_service_proto_depIdxs = []int32{ - 15, // 0: authzed.api.v0.RelationTupleFilter.userset:type_name -> authzed.api.v0.ObjectAndRelation - 0, // 1: authzed.api.v0.RelationTupleFilter.filters:type_name -> authzed.api.v0.RelationTupleFilter.Filter - 2, // 2: authzed.api.v0.ReadRequest.tuplesets:type_name -> authzed.api.v0.RelationTupleFilter - 16, // 3: authzed.api.v0.ReadRequest.at_revision:type_name -> authzed.api.v0.Zookie - 14, // 4: authzed.api.v0.ReadResponse.tuplesets:type_name -> authzed.api.v0.ReadResponse.Tupleset - 16, // 5: authzed.api.v0.ReadResponse.revision:type_name -> authzed.api.v0.Zookie - 17, // 6: authzed.api.v0.WriteRequest.write_conditions:type_name -> authzed.api.v0.RelationTuple - 18, // 7: authzed.api.v0.WriteRequest.updates:type_name -> authzed.api.v0.RelationTupleUpdate - 16, // 8: authzed.api.v0.WriteResponse.revision:type_name -> authzed.api.v0.Zookie - 15, // 9: authzed.api.v0.CheckRequest.test_userset:type_name -> authzed.api.v0.ObjectAndRelation - 19, // 10: authzed.api.v0.CheckRequest.user:type_name -> authzed.api.v0.User - 16, // 11: authzed.api.v0.CheckRequest.at_revision:type_name -> authzed.api.v0.Zookie - 15, // 12: authzed.api.v0.ContentChangeCheckRequest.test_userset:type_name -> authzed.api.v0.ObjectAndRelation - 19, // 13: authzed.api.v0.ContentChangeCheckRequest.user:type_name -> authzed.api.v0.User - 16, // 14: authzed.api.v0.CheckResponse.revision:type_name -> authzed.api.v0.Zookie - 1, // 15: authzed.api.v0.CheckResponse.membership:type_name -> authzed.api.v0.CheckResponse.Membership - 15, // 16: authzed.api.v0.ExpandRequest.userset:type_name -> authzed.api.v0.ObjectAndRelation - 16, // 17: authzed.api.v0.ExpandRequest.at_revision:type_name -> authzed.api.v0.Zookie - 20, // 18: authzed.api.v0.ExpandResponse.tree_node:type_name -> authzed.api.v0.RelationTupleTreeNode - 16, // 19: authzed.api.v0.ExpandResponse.revision:type_name -> authzed.api.v0.Zookie - 21, // 20: authzed.api.v0.LookupRequest.object_relation:type_name -> authzed.api.v0.RelationReference - 15, // 21: authzed.api.v0.LookupRequest.user:type_name -> authzed.api.v0.ObjectAndRelation - 16, // 22: authzed.api.v0.LookupRequest.at_revision:type_name -> authzed.api.v0.Zookie - 16, // 23: authzed.api.v0.LookupResponse.revision:type_name -> authzed.api.v0.Zookie - 17, // 24: authzed.api.v0.ReadResponse.Tupleset.tuples:type_name -> authzed.api.v0.RelationTuple - 3, // 25: authzed.api.v0.ACLService.Read:input_type -> authzed.api.v0.ReadRequest - 5, // 26: authzed.api.v0.ACLService.Write:input_type -> authzed.api.v0.WriteRequest - 7, // 27: authzed.api.v0.ACLService.Check:input_type -> authzed.api.v0.CheckRequest - 8, // 28: authzed.api.v0.ACLService.ContentChangeCheck:input_type -> authzed.api.v0.ContentChangeCheckRequest - 10, // 29: authzed.api.v0.ACLService.Expand:input_type -> authzed.api.v0.ExpandRequest - 12, // 30: authzed.api.v0.ACLService.Lookup:input_type -> authzed.api.v0.LookupRequest - 4, // 31: authzed.api.v0.ACLService.Read:output_type -> authzed.api.v0.ReadResponse - 6, // 32: authzed.api.v0.ACLService.Write:output_type -> authzed.api.v0.WriteResponse - 9, // 33: authzed.api.v0.ACLService.Check:output_type -> authzed.api.v0.CheckResponse - 9, // 34: authzed.api.v0.ACLService.ContentChangeCheck:output_type -> authzed.api.v0.CheckResponse - 11, // 35: authzed.api.v0.ACLService.Expand:output_type -> authzed.api.v0.ExpandResponse - 13, // 36: authzed.api.v0.ACLService.Lookup:output_type -> authzed.api.v0.LookupResponse - 31, // [31:37] is the sub-list for method output_type - 25, // [25:31] is the sub-list for method input_type - 25, // [25:25] is the sub-list for extension type_name - 25, // [25:25] is the sub-list for extension extendee - 0, // [0:25] is the sub-list for field type_name -} - -func init() { file_authzed_api_v0_acl_service_proto_init() } -func file_authzed_api_v0_acl_service_proto_init() { - if File_authzed_api_v0_acl_service_proto != nil { - return - } - file_authzed_api_v0_core_proto_init() - if !protoimpl.UnsafeEnabled { - file_authzed_api_v0_acl_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RelationTupleFilter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WriteRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WriteResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContentChangeCheckRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExpandRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExpandResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LookupRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LookupResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_acl_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadResponse_Tupleset); 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_authzed_api_v0_acl_service_proto_rawDesc, - NumEnums: 2, - NumMessages: 13, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_authzed_api_v0_acl_service_proto_goTypes, - DependencyIndexes: file_authzed_api_v0_acl_service_proto_depIdxs, - EnumInfos: file_authzed_api_v0_acl_service_proto_enumTypes, - MessageInfos: file_authzed_api_v0_acl_service_proto_msgTypes, - }.Build() - File_authzed_api_v0_acl_service_proto = out.File - file_authzed_api_v0_acl_service_proto_rawDesc = nil - file_authzed_api_v0_acl_service_proto_goTypes = nil - file_authzed_api_v0_acl_service_proto_depIdxs = nil -} diff --git a/proto/authzed/api/v0/acl_service.pb.validate.go b/proto/authzed/api/v0/acl_service.pb.validate.go deleted file mode 100644 index db415bf..0000000 --- a/proto/authzed/api/v0/acl_service.pb.validate.go +++ /dev/null @@ -1,1287 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: authzed/api/v0/acl_service.proto - -package v0 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} -) - -// Validate checks the field values on RelationTupleFilter with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *RelationTupleFilter) Validate() error { - if m == nil { - return nil - } - - if len(m.GetNamespace()) > 128 { - return RelationTupleFilterValidationError{ - field: "Namespace", - reason: "value length must be at most 128 bytes", - } - } - - if !_RelationTupleFilter_Namespace_Pattern.MatchString(m.GetNamespace()) { - return RelationTupleFilterValidationError{ - field: "Namespace", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", - } - } - - if len(m.GetObjectId()) > 128 { - return RelationTupleFilterValidationError{ - field: "ObjectId", - reason: "value length must be at most 128 bytes", - } - } - - if !_RelationTupleFilter_ObjectId_Pattern.MatchString(m.GetObjectId()) { - return RelationTupleFilterValidationError{ - field: "ObjectId", - reason: "value does not match regex pattern \"^([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})?$\"", - } - } - - if len(m.GetRelation()) > 64 { - return RelationTupleFilterValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_RelationTupleFilter_Relation_Pattern.MatchString(m.GetRelation()) { - return RelationTupleFilterValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9])?$\"", - } - } - - if v, ok := interface{}(m.GetUserset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RelationTupleFilterValidationError{ - field: "Userset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetFilters() { - _, _ = idx, item - - if _, ok := RelationTupleFilter_Filter_name[int32(item)]; !ok { - return RelationTupleFilterValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "value must be one of the defined enum values", - } - } - - } - - return nil -} - -// RelationTupleFilterValidationError is the validation error returned by -// RelationTupleFilter.Validate if the designated constraints aren't met. -type RelationTupleFilterValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RelationTupleFilterValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RelationTupleFilterValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RelationTupleFilterValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RelationTupleFilterValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RelationTupleFilterValidationError) ErrorName() string { - return "RelationTupleFilterValidationError" -} - -// Error satisfies the builtin error interface -func (e RelationTupleFilterValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRelationTupleFilter.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RelationTupleFilterValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RelationTupleFilterValidationError{} - -var _RelationTupleFilter_Namespace_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$") - -var _RelationTupleFilter_ObjectId_Pattern = regexp.MustCompile("^([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})?$") - -var _RelationTupleFilter_Relation_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,62}[a-z0-9])?$") - -// Validate checks the field values on ReadRequest with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *ReadRequest) Validate() error { - if m == nil { - return nil - } - - if len(m.GetTuplesets()) < 1 { - return ReadRequestValidationError{ - field: "Tuplesets", - reason: "value must contain at least 1 item(s)", - } - } - - for idx, item := range m.GetTuplesets() { - _, _ = idx, item - - if item == nil { - return ReadRequestValidationError{ - field: fmt.Sprintf("Tuplesets[%v]", idx), - reason: "value is required", - } - } - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ReadRequestValidationError{ - field: fmt.Sprintf("Tuplesets[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if v, ok := interface{}(m.GetAtRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ReadRequestValidationError{ - field: "AtRevision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// ReadRequestValidationError is the validation error returned by -// ReadRequest.Validate if the designated constraints aren't met. -type ReadRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ReadRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ReadRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ReadRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ReadRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ReadRequestValidationError) ErrorName() string { return "ReadRequestValidationError" } - -// Error satisfies the builtin error interface -func (e ReadRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sReadRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ReadRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ReadRequestValidationError{} - -// Validate checks the field values on ReadResponse with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *ReadResponse) Validate() error { - if m == nil { - return nil - } - - for idx, item := range m.GetTuplesets() { - _, _ = idx, item - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ReadResponseValidationError{ - field: fmt.Sprintf("Tuplesets[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if v, ok := interface{}(m.GetRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ReadResponseValidationError{ - field: "Revision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// ReadResponseValidationError is the validation error returned by -// ReadResponse.Validate if the designated constraints aren't met. -type ReadResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ReadResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ReadResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ReadResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ReadResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ReadResponseValidationError) ErrorName() string { return "ReadResponseValidationError" } - -// Error satisfies the builtin error interface -func (e ReadResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sReadResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ReadResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ReadResponseValidationError{} - -// Validate checks the field values on WriteRequest with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *WriteRequest) Validate() error { - if m == nil { - return nil - } - - for idx, item := range m.GetWriteConditions() { - _, _ = idx, item - - if item == nil { - return WriteRequestValidationError{ - field: fmt.Sprintf("WriteConditions[%v]", idx), - reason: "value is required", - } - } - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WriteRequestValidationError{ - field: fmt.Sprintf("WriteConditions[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetUpdates() { - _, _ = idx, item - - if item == nil { - return WriteRequestValidationError{ - field: fmt.Sprintf("Updates[%v]", idx), - reason: "value is required", - } - } - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WriteRequestValidationError{ - field: fmt.Sprintf("Updates[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - return nil -} - -// WriteRequestValidationError is the validation error returned by -// WriteRequest.Validate if the designated constraints aren't met. -type WriteRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WriteRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WriteRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WriteRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WriteRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WriteRequestValidationError) ErrorName() string { return "WriteRequestValidationError" } - -// Error satisfies the builtin error interface -func (e WriteRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWriteRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WriteRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WriteRequestValidationError{} - -// Validate checks the field values on WriteResponse with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *WriteResponse) Validate() error { - if m == nil { - return nil - } - - if v, ok := interface{}(m.GetRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WriteResponseValidationError{ - field: "Revision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// WriteResponseValidationError is the validation error returned by -// WriteResponse.Validate if the designated constraints aren't met. -type WriteResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WriteResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WriteResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WriteResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WriteResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WriteResponseValidationError) ErrorName() string { return "WriteResponseValidationError" } - -// Error satisfies the builtin error interface -func (e WriteResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWriteResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WriteResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WriteResponseValidationError{} - -// Validate checks the field values on CheckRequest with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *CheckRequest) Validate() error { - if m == nil { - return nil - } - - if m.GetTestUserset() == nil { - return CheckRequestValidationError{ - field: "TestUserset", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetTestUserset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CheckRequestValidationError{ - field: "TestUserset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if m.GetUser() == nil { - return CheckRequestValidationError{ - field: "User", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CheckRequestValidationError{ - field: "User", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if v, ok := interface{}(m.GetAtRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CheckRequestValidationError{ - field: "AtRevision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// CheckRequestValidationError is the validation error returned by -// CheckRequest.Validate if the designated constraints aren't met. -type CheckRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CheckRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CheckRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CheckRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CheckRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CheckRequestValidationError) ErrorName() string { return "CheckRequestValidationError" } - -// Error satisfies the builtin error interface -func (e CheckRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCheckRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CheckRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CheckRequestValidationError{} - -// Validate checks the field values on ContentChangeCheckRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *ContentChangeCheckRequest) Validate() error { - if m == nil { - return nil - } - - if m.GetTestUserset() == nil { - return ContentChangeCheckRequestValidationError{ - field: "TestUserset", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetTestUserset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ContentChangeCheckRequestValidationError{ - field: "TestUserset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if m.GetUser() == nil { - return ContentChangeCheckRequestValidationError{ - field: "User", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ContentChangeCheckRequestValidationError{ - field: "User", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// ContentChangeCheckRequestValidationError is the validation error returned by -// ContentChangeCheckRequest.Validate if the designated constraints aren't met. -type ContentChangeCheckRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ContentChangeCheckRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ContentChangeCheckRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ContentChangeCheckRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ContentChangeCheckRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ContentChangeCheckRequestValidationError) ErrorName() string { - return "ContentChangeCheckRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ContentChangeCheckRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sContentChangeCheckRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ContentChangeCheckRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ContentChangeCheckRequestValidationError{} - -// Validate checks the field values on CheckResponse with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *CheckResponse) Validate() error { - if m == nil { - return nil - } - - // no validation rules for IsMember - - if v, ok := interface{}(m.GetRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CheckResponseValidationError{ - field: "Revision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Membership - - return nil -} - -// CheckResponseValidationError is the validation error returned by -// CheckResponse.Validate if the designated constraints aren't met. -type CheckResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CheckResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CheckResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CheckResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CheckResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CheckResponseValidationError) ErrorName() string { return "CheckResponseValidationError" } - -// Error satisfies the builtin error interface -func (e CheckResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCheckResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CheckResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CheckResponseValidationError{} - -// Validate checks the field values on ExpandRequest with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *ExpandRequest) Validate() error { - if m == nil { - return nil - } - - if m.GetUserset() == nil { - return ExpandRequestValidationError{ - field: "Userset", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetUserset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExpandRequestValidationError{ - field: "Userset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if v, ok := interface{}(m.GetAtRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExpandRequestValidationError{ - field: "AtRevision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// ExpandRequestValidationError is the validation error returned by -// ExpandRequest.Validate if the designated constraints aren't met. -type ExpandRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExpandRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExpandRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExpandRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExpandRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExpandRequestValidationError) ErrorName() string { return "ExpandRequestValidationError" } - -// Error satisfies the builtin error interface -func (e ExpandRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExpandRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExpandRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExpandRequestValidationError{} - -// Validate checks the field values on ExpandResponse with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *ExpandResponse) Validate() error { - if m == nil { - return nil - } - - if v, ok := interface{}(m.GetTreeNode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExpandResponseValidationError{ - field: "TreeNode", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if v, ok := interface{}(m.GetRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExpandResponseValidationError{ - field: "Revision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// ExpandResponseValidationError is the validation error returned by -// ExpandResponse.Validate if the designated constraints aren't met. -type ExpandResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExpandResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExpandResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExpandResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExpandResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExpandResponseValidationError) ErrorName() string { return "ExpandResponseValidationError" } - -// Error satisfies the builtin error interface -func (e ExpandResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExpandResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExpandResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExpandResponseValidationError{} - -// Validate checks the field values on LookupRequest with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *LookupRequest) Validate() error { - if m == nil { - return nil - } - - if m.GetObjectRelation() == nil { - return LookupRequestValidationError{ - field: "ObjectRelation", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetObjectRelation()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return LookupRequestValidationError{ - field: "ObjectRelation", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if m.GetUser() == nil { - return LookupRequestValidationError{ - field: "User", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return LookupRequestValidationError{ - field: "User", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if v, ok := interface{}(m.GetAtRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return LookupRequestValidationError{ - field: "AtRevision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for PageReference - - // no validation rules for Limit - - return nil -} - -// LookupRequestValidationError is the validation error returned by -// LookupRequest.Validate if the designated constraints aren't met. -type LookupRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e LookupRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e LookupRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e LookupRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e LookupRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e LookupRequestValidationError) ErrorName() string { return "LookupRequestValidationError" } - -// Error satisfies the builtin error interface -func (e LookupRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sLookupRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = LookupRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = LookupRequestValidationError{} - -// Validate checks the field values on LookupResponse with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *LookupResponse) Validate() error { - if m == nil { - return nil - } - - // no validation rules for NextPageReference - - if v, ok := interface{}(m.GetRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return LookupResponseValidationError{ - field: "Revision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// LookupResponseValidationError is the validation error returned by -// LookupResponse.Validate if the designated constraints aren't met. -type LookupResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e LookupResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e LookupResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e LookupResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e LookupResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e LookupResponseValidationError) ErrorName() string { return "LookupResponseValidationError" } - -// Error satisfies the builtin error interface -func (e LookupResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sLookupResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = LookupResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = LookupResponseValidationError{} - -// Validate checks the field values on ReadResponse_Tupleset with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *ReadResponse_Tupleset) Validate() error { - if m == nil { - return nil - } - - for idx, item := range m.GetTuples() { - _, _ = idx, item - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ReadResponse_TuplesetValidationError{ - field: fmt.Sprintf("Tuples[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - return nil -} - -// ReadResponse_TuplesetValidationError is the validation error returned by -// ReadResponse_Tupleset.Validate if the designated constraints aren't met. -type ReadResponse_TuplesetValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ReadResponse_TuplesetValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ReadResponse_TuplesetValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ReadResponse_TuplesetValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ReadResponse_TuplesetValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ReadResponse_TuplesetValidationError) ErrorName() string { - return "ReadResponse_TuplesetValidationError" -} - -// Error satisfies the builtin error interface -func (e ReadResponse_TuplesetValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sReadResponse_Tupleset.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ReadResponse_TuplesetValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ReadResponse_TuplesetValidationError{} diff --git a/proto/authzed/api/v0/acl_service_grpc.pb.go b/proto/authzed/api/v0/acl_service_grpc.pb.go deleted file mode 100644 index ec9fa2e..0000000 --- a/proto/authzed/api/v0/acl_service_grpc.pb.go +++ /dev/null @@ -1,299 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. - -package v0 - -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 - -// ACLServiceClient is the client API for ACLService 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 ACLServiceClient interface { - // Deprecated: Do not use. - Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) - // Deprecated: Do not use. - Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error) - // Deprecated: Do not use. - Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) - // Deprecated: Do not use. - ContentChangeCheck(ctx context.Context, in *ContentChangeCheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) - // Deprecated: Do not use. - Expand(ctx context.Context, in *ExpandRequest, opts ...grpc.CallOption) (*ExpandResponse, error) - // Deprecated: Do not use. - Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error) -} - -type aCLServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewACLServiceClient(cc grpc.ClientConnInterface) ACLServiceClient { - return &aCLServiceClient{cc} -} - -// Deprecated: Do not use. -func (c *aCLServiceClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) { - out := new(ReadResponse) - err := c.cc.Invoke(ctx, "/authzed.api.v0.ACLService/Read", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *aCLServiceClient) Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error) { - out := new(WriteResponse) - err := c.cc.Invoke(ctx, "/authzed.api.v0.ACLService/Write", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *aCLServiceClient) Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) { - out := new(CheckResponse) - err := c.cc.Invoke(ctx, "/authzed.api.v0.ACLService/Check", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *aCLServiceClient) ContentChangeCheck(ctx context.Context, in *ContentChangeCheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) { - out := new(CheckResponse) - err := c.cc.Invoke(ctx, "/authzed.api.v0.ACLService/ContentChangeCheck", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *aCLServiceClient) Expand(ctx context.Context, in *ExpandRequest, opts ...grpc.CallOption) (*ExpandResponse, error) { - out := new(ExpandResponse) - err := c.cc.Invoke(ctx, "/authzed.api.v0.ACLService/Expand", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *aCLServiceClient) Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error) { - out := new(LookupResponse) - err := c.cc.Invoke(ctx, "/authzed.api.v0.ACLService/Lookup", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ACLServiceServer is the server API for ACLService service. -// All implementations must embed UnimplementedACLServiceServer -// for forward compatibility -type ACLServiceServer interface { - // Deprecated: Do not use. - Read(context.Context, *ReadRequest) (*ReadResponse, error) - // Deprecated: Do not use. - Write(context.Context, *WriteRequest) (*WriteResponse, error) - // Deprecated: Do not use. - Check(context.Context, *CheckRequest) (*CheckResponse, error) - // Deprecated: Do not use. - ContentChangeCheck(context.Context, *ContentChangeCheckRequest) (*CheckResponse, error) - // Deprecated: Do not use. - Expand(context.Context, *ExpandRequest) (*ExpandResponse, error) - // Deprecated: Do not use. - Lookup(context.Context, *LookupRequest) (*LookupResponse, error) - mustEmbedUnimplementedACLServiceServer() -} - -// UnimplementedACLServiceServer must be embedded to have forward compatible implementations. -type UnimplementedACLServiceServer struct { -} - -func (UnimplementedACLServiceServer) Read(context.Context, *ReadRequest) (*ReadResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Read not implemented") -} -func (UnimplementedACLServiceServer) Write(context.Context, *WriteRequest) (*WriteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Write not implemented") -} -func (UnimplementedACLServiceServer) Check(context.Context, *CheckRequest) (*CheckResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Check not implemented") -} -func (UnimplementedACLServiceServer) ContentChangeCheck(context.Context, *ContentChangeCheckRequest) (*CheckResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ContentChangeCheck not implemented") -} -func (UnimplementedACLServiceServer) Expand(context.Context, *ExpandRequest) (*ExpandResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Expand not implemented") -} -func (UnimplementedACLServiceServer) Lookup(context.Context, *LookupRequest) (*LookupResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Lookup not implemented") -} -func (UnimplementedACLServiceServer) mustEmbedUnimplementedACLServiceServer() {} - -// UnsafeACLServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ACLServiceServer will -// result in compilation errors. -type UnsafeACLServiceServer interface { - mustEmbedUnimplementedACLServiceServer() -} - -func RegisterACLServiceServer(s grpc.ServiceRegistrar, srv ACLServiceServer) { - s.RegisterService(&ACLService_ServiceDesc, srv) -} - -func _ACLService_Read_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ACLServiceServer).Read(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/authzed.api.v0.ACLService/Read", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ACLServiceServer).Read(ctx, req.(*ReadRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ACLService_Write_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(WriteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ACLServiceServer).Write(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/authzed.api.v0.ACLService/Write", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ACLServiceServer).Write(ctx, req.(*WriteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ACLService_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ACLServiceServer).Check(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/authzed.api.v0.ACLService/Check", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ACLServiceServer).Check(ctx, req.(*CheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ACLService_ContentChangeCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ContentChangeCheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ACLServiceServer).ContentChangeCheck(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/authzed.api.v0.ACLService/ContentChangeCheck", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ACLServiceServer).ContentChangeCheck(ctx, req.(*ContentChangeCheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ACLService_Expand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExpandRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ACLServiceServer).Expand(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/authzed.api.v0.ACLService/Expand", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ACLServiceServer).Expand(ctx, req.(*ExpandRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ACLService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LookupRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ACLServiceServer).Lookup(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/authzed.api.v0.ACLService/Lookup", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ACLServiceServer).Lookup(ctx, req.(*LookupRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// ACLService_ServiceDesc is the grpc.ServiceDesc for ACLService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ACLService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "authzed.api.v0.ACLService", - HandlerType: (*ACLServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Read", - Handler: _ACLService_Read_Handler, - }, - { - MethodName: "Write", - Handler: _ACLService_Write_Handler, - }, - { - MethodName: "Check", - Handler: _ACLService_Check_Handler, - }, - { - MethodName: "ContentChangeCheck", - Handler: _ACLService_ContentChangeCheck_Handler, - }, - { - MethodName: "Expand", - Handler: _ACLService_Expand_Handler, - }, - { - MethodName: "Lookup", - Handler: _ACLService_Lookup_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "authzed/api/v0/acl_service.proto", -} diff --git a/proto/authzed/api/v0/core.pb.go b/proto/authzed/api/v0/core.pb.go index 7a1228c..915fa20 100644 --- a/proto/authzed/api/v0/core.pb.go +++ b/proto/authzed/api/v0/core.pb.go @@ -21,110 +21,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type RelationTupleUpdate_Operation int32 - -const ( - RelationTupleUpdate_UNKNOWN RelationTupleUpdate_Operation = 0 - RelationTupleUpdate_CREATE RelationTupleUpdate_Operation = 1 - RelationTupleUpdate_TOUCH RelationTupleUpdate_Operation = 2 - RelationTupleUpdate_DELETE RelationTupleUpdate_Operation = 3 -) - -// Enum value maps for RelationTupleUpdate_Operation. -var ( - RelationTupleUpdate_Operation_name = map[int32]string{ - 0: "UNKNOWN", - 1: "CREATE", - 2: "TOUCH", - 3: "DELETE", - } - RelationTupleUpdate_Operation_value = map[string]int32{ - "UNKNOWN": 0, - "CREATE": 1, - "TOUCH": 2, - "DELETE": 3, - } -) - -func (x RelationTupleUpdate_Operation) Enum() *RelationTupleUpdate_Operation { - p := new(RelationTupleUpdate_Operation) - *p = x - return p -} - -func (x RelationTupleUpdate_Operation) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RelationTupleUpdate_Operation) Descriptor() protoreflect.EnumDescriptor { - return file_authzed_api_v0_core_proto_enumTypes[0].Descriptor() -} - -func (RelationTupleUpdate_Operation) Type() protoreflect.EnumType { - return &file_authzed_api_v0_core_proto_enumTypes[0] -} - -func (x RelationTupleUpdate_Operation) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RelationTupleUpdate_Operation.Descriptor instead. -func (RelationTupleUpdate_Operation) EnumDescriptor() ([]byte, []int) { - return file_authzed_api_v0_core_proto_rawDescGZIP(), []int{5, 0} -} - -type SetOperationUserset_Operation int32 - -const ( - SetOperationUserset_INVALID SetOperationUserset_Operation = 0 - SetOperationUserset_UNION SetOperationUserset_Operation = 1 - SetOperationUserset_INTERSECTION SetOperationUserset_Operation = 2 - SetOperationUserset_EXCLUSION SetOperationUserset_Operation = 3 -) - -// Enum value maps for SetOperationUserset_Operation. -var ( - SetOperationUserset_Operation_name = map[int32]string{ - 0: "INVALID", - 1: "UNION", - 2: "INTERSECTION", - 3: "EXCLUSION", - } - SetOperationUserset_Operation_value = map[string]int32{ - "INVALID": 0, - "UNION": 1, - "INTERSECTION": 2, - "EXCLUSION": 3, - } -) - -func (x SetOperationUserset_Operation) Enum() *SetOperationUserset_Operation { - p := new(SetOperationUserset_Operation) - *p = x - return p -} - -func (x SetOperationUserset_Operation) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (SetOperationUserset_Operation) Descriptor() protoreflect.EnumDescriptor { - return file_authzed_api_v0_core_proto_enumTypes[1].Descriptor() -} - -func (SetOperationUserset_Operation) Type() protoreflect.EnumType { - return &file_authzed_api_v0_core_proto_enumTypes[1] -} - -func (x SetOperationUserset_Operation) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use SetOperationUserset_Operation.Descriptor instead. -func (SetOperationUserset_Operation) EnumDescriptor() ([]byte, []int) { - return file_authzed_api_v0_core_proto_rawDescGZIP(), []int{7, 0} -} - type RelationTuple struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -375,298 +271,6 @@ type User_Userset struct { func (*User_Userset) isUser_UserOneof() {} -type Zookie struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` -} - -func (x *Zookie) Reset() { - *x = Zookie{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_core_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Zookie) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Zookie) ProtoMessage() {} - -func (x *Zookie) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_core_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 Zookie.ProtoReflect.Descriptor instead. -func (*Zookie) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_core_proto_rawDescGZIP(), []int{4} -} - -func (x *Zookie) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -type RelationTupleUpdate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Operation RelationTupleUpdate_Operation `protobuf:"varint,1,opt,name=operation,proto3,enum=authzed.api.v0.RelationTupleUpdate_Operation" json:"operation,omitempty"` - Tuple *RelationTuple `protobuf:"bytes,2,opt,name=tuple,proto3" json:"tuple,omitempty"` -} - -func (x *RelationTupleUpdate) Reset() { - *x = RelationTupleUpdate{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_core_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RelationTupleUpdate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RelationTupleUpdate) ProtoMessage() {} - -func (x *RelationTupleUpdate) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_core_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 RelationTupleUpdate.ProtoReflect.Descriptor instead. -func (*RelationTupleUpdate) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_core_proto_rawDescGZIP(), []int{5} -} - -func (x *RelationTupleUpdate) GetOperation() RelationTupleUpdate_Operation { - if x != nil { - return x.Operation - } - return RelationTupleUpdate_UNKNOWN -} - -func (x *RelationTupleUpdate) GetTuple() *RelationTuple { - if x != nil { - return x.Tuple - } - return nil -} - -type RelationTupleTreeNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to NodeType: - // *RelationTupleTreeNode_IntermediateNode - // *RelationTupleTreeNode_LeafNode - NodeType isRelationTupleTreeNode_NodeType `protobuf_oneof:"node_type"` - Expanded *ObjectAndRelation `protobuf:"bytes,3,opt,name=expanded,proto3" json:"expanded,omitempty"` -} - -func (x *RelationTupleTreeNode) Reset() { - *x = RelationTupleTreeNode{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_core_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RelationTupleTreeNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RelationTupleTreeNode) ProtoMessage() {} - -func (x *RelationTupleTreeNode) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_core_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 RelationTupleTreeNode.ProtoReflect.Descriptor instead. -func (*RelationTupleTreeNode) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_core_proto_rawDescGZIP(), []int{6} -} - -func (m *RelationTupleTreeNode) GetNodeType() isRelationTupleTreeNode_NodeType { - if m != nil { - return m.NodeType - } - return nil -} - -func (x *RelationTupleTreeNode) GetIntermediateNode() *SetOperationUserset { - if x, ok := x.GetNodeType().(*RelationTupleTreeNode_IntermediateNode); ok { - return x.IntermediateNode - } - return nil -} - -func (x *RelationTupleTreeNode) GetLeafNode() *DirectUserset { - if x, ok := x.GetNodeType().(*RelationTupleTreeNode_LeafNode); ok { - return x.LeafNode - } - return nil -} - -func (x *RelationTupleTreeNode) GetExpanded() *ObjectAndRelation { - if x != nil { - return x.Expanded - } - return nil -} - -type isRelationTupleTreeNode_NodeType interface { - isRelationTupleTreeNode_NodeType() -} - -type RelationTupleTreeNode_IntermediateNode struct { - IntermediateNode *SetOperationUserset `protobuf:"bytes,1,opt,name=intermediate_node,json=intermediateNode,proto3,oneof"` -} - -type RelationTupleTreeNode_LeafNode struct { - LeafNode *DirectUserset `protobuf:"bytes,2,opt,name=leaf_node,json=leafNode,proto3,oneof"` -} - -func (*RelationTupleTreeNode_IntermediateNode) isRelationTupleTreeNode_NodeType() {} - -func (*RelationTupleTreeNode_LeafNode) isRelationTupleTreeNode_NodeType() {} - -type SetOperationUserset struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Operation SetOperationUserset_Operation `protobuf:"varint,1,opt,name=operation,proto3,enum=authzed.api.v0.SetOperationUserset_Operation" json:"operation,omitempty"` - ChildNodes []*RelationTupleTreeNode `protobuf:"bytes,2,rep,name=child_nodes,json=childNodes,proto3" json:"child_nodes,omitempty"` -} - -func (x *SetOperationUserset) Reset() { - *x = SetOperationUserset{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_core_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetOperationUserset) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetOperationUserset) ProtoMessage() {} - -func (x *SetOperationUserset) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_core_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 SetOperationUserset.ProtoReflect.Descriptor instead. -func (*SetOperationUserset) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_core_proto_rawDescGZIP(), []int{7} -} - -func (x *SetOperationUserset) GetOperation() SetOperationUserset_Operation { - if x != nil { - return x.Operation - } - return SetOperationUserset_INVALID -} - -func (x *SetOperationUserset) GetChildNodes() []*RelationTupleTreeNode { - if x != nil { - return x.ChildNodes - } - return nil -} - -type DirectUserset struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` -} - -func (x *DirectUserset) Reset() { - *x = DirectUserset{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_core_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DirectUserset) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DirectUserset) ProtoMessage() {} - -func (x *DirectUserset) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_core_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 DirectUserset.ProtoReflect.Descriptor instead. -func (*DirectUserset) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_core_proto_rawDescGZIP(), []int{8} -} - -func (x *DirectUserset) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - var File_authzed_api_v0_core_proto protoreflect.FileDescriptor var file_authzed_api_v0_core_proto_rawDesc = []byte{ @@ -721,64 +325,12 @@ var file_authzed_api_v0_core_proto_rawDesc = []byte{ 0x6a, 0x65, 0x63, 0x74, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x42, 0x11, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6f, 0x6e, 0x65, - 0x6f, 0x66, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x27, 0x0a, 0x06, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, - 0x65, 0x12, 0x1d, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x20, 0x01, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x22, 0xe8, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, - 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x55, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, - 0x01, 0x02, 0x10, 0x01, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x3d, 0x0a, 0x05, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, - 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x42, 0x08, 0xfa, - 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x22, 0x3b, - 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, 0x07, 0x55, - 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x52, 0x45, 0x41, - 0x54, 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x4f, 0x55, 0x43, 0x48, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x03, 0x22, 0xf5, 0x01, 0x0a, 0x15, - 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x54, 0x72, 0x65, - 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x52, 0x0a, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, - 0x64, 0x69, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x30, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x65, 0x74, 0x48, 0x00, 0x52, 0x10, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, - 0x64, 0x69, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x6c, 0x65, 0x61, - 0x66, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x48, 0x00, 0x52, 0x08, 0x6c, - 0x65, 0x61, 0x66, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x3d, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x61, 0x6e, - 0x64, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, - 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x41, 0x6e, 0x64, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x65, 0x78, - 0x70, 0x61, 0x6e, 0x64, 0x65, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x22, 0xf0, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, - 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, - 0x53, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x73, 0x65, 0x72, - 0x73, 0x65, 0x74, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x0b, 0x63, 0x68, 0x69, 0x6c, - 0x64, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, - 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, - 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x54, 0x72, 0x65, 0x65, - 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, - 0x22, 0x44, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, - 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x4e, - 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x53, 0x45, - 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x45, 0x58, 0x43, 0x4c, 0x55, - 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x03, 0x22, 0x3b, 0x0a, 0x0d, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, - 0x65, 0x72, 0x73, 0x42, 0x48, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x66, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x42, 0x48, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x5a, 0x32, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, + 0x64, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x30, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -793,38 +345,22 @@ func file_authzed_api_v0_core_proto_rawDescGZIP() []byte { return file_authzed_api_v0_core_proto_rawDescData } -var file_authzed_api_v0_core_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_authzed_api_v0_core_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_authzed_api_v0_core_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_authzed_api_v0_core_proto_goTypes = []interface{}{ - (RelationTupleUpdate_Operation)(0), // 0: authzed.api.v0.RelationTupleUpdate.Operation - (SetOperationUserset_Operation)(0), // 1: authzed.api.v0.SetOperationUserset.Operation - (*RelationTuple)(nil), // 2: authzed.api.v0.RelationTuple - (*ObjectAndRelation)(nil), // 3: authzed.api.v0.ObjectAndRelation - (*RelationReference)(nil), // 4: authzed.api.v0.RelationReference - (*User)(nil), // 5: authzed.api.v0.User - (*Zookie)(nil), // 6: authzed.api.v0.Zookie - (*RelationTupleUpdate)(nil), // 7: authzed.api.v0.RelationTupleUpdate - (*RelationTupleTreeNode)(nil), // 8: authzed.api.v0.RelationTupleTreeNode - (*SetOperationUserset)(nil), // 9: authzed.api.v0.SetOperationUserset - (*DirectUserset)(nil), // 10: authzed.api.v0.DirectUserset + (*RelationTuple)(nil), // 0: authzed.api.v0.RelationTuple + (*ObjectAndRelation)(nil), // 1: authzed.api.v0.ObjectAndRelation + (*RelationReference)(nil), // 2: authzed.api.v0.RelationReference + (*User)(nil), // 3: authzed.api.v0.User } var file_authzed_api_v0_core_proto_depIdxs = []int32{ - 3, // 0: authzed.api.v0.RelationTuple.object_and_relation:type_name -> authzed.api.v0.ObjectAndRelation - 5, // 1: authzed.api.v0.RelationTuple.user:type_name -> authzed.api.v0.User - 3, // 2: authzed.api.v0.User.userset:type_name -> authzed.api.v0.ObjectAndRelation - 0, // 3: authzed.api.v0.RelationTupleUpdate.operation:type_name -> authzed.api.v0.RelationTupleUpdate.Operation - 2, // 4: authzed.api.v0.RelationTupleUpdate.tuple:type_name -> authzed.api.v0.RelationTuple - 9, // 5: authzed.api.v0.RelationTupleTreeNode.intermediate_node:type_name -> authzed.api.v0.SetOperationUserset - 10, // 6: authzed.api.v0.RelationTupleTreeNode.leaf_node:type_name -> authzed.api.v0.DirectUserset - 3, // 7: authzed.api.v0.RelationTupleTreeNode.expanded:type_name -> authzed.api.v0.ObjectAndRelation - 1, // 8: authzed.api.v0.SetOperationUserset.operation:type_name -> authzed.api.v0.SetOperationUserset.Operation - 8, // 9: authzed.api.v0.SetOperationUserset.child_nodes:type_name -> authzed.api.v0.RelationTupleTreeNode - 5, // 10: authzed.api.v0.DirectUserset.users:type_name -> authzed.api.v0.User - 11, // [11:11] is the sub-list for method output_type - 11, // [11:11] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 1, // 0: authzed.api.v0.RelationTuple.object_and_relation:type_name -> authzed.api.v0.ObjectAndRelation + 3, // 1: authzed.api.v0.RelationTuple.user:type_name -> authzed.api.v0.User + 1, // 2: authzed.api.v0.User.userset:type_name -> authzed.api.v0.ObjectAndRelation + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_authzed_api_v0_core_proto_init() } @@ -881,87 +417,22 @@ func file_authzed_api_v0_core_proto_init() { return nil } } - file_authzed_api_v0_core_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Zookie); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_core_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RelationTupleUpdate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_core_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RelationTupleTreeNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_core_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetOperationUserset); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_core_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DirectUserset); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } file_authzed_api_v0_core_proto_msgTypes[3].OneofWrappers = []interface{}{ (*User_Userset)(nil), } - file_authzed_api_v0_core_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*RelationTupleTreeNode_IntermediateNode)(nil), - (*RelationTupleTreeNode_LeafNode)(nil), - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_authzed_api_v0_core_proto_rawDesc, - NumEnums: 2, - NumMessages: 9, + NumEnums: 0, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, GoTypes: file_authzed_api_v0_core_proto_goTypes, DependencyIndexes: file_authzed_api_v0_core_proto_depIdxs, - EnumInfos: file_authzed_api_v0_core_proto_enumTypes, MessageInfos: file_authzed_api_v0_core_proto_msgTypes, }.Build() File_authzed_api_v0_core_proto = out.File diff --git a/proto/authzed/api/v0/core.pb.validate.go b/proto/authzed/api/v0/core.pb.validate.go index d9a252e..82c814d 100644 --- a/proto/authzed/api/v0/core.pb.validate.go +++ b/proto/authzed/api/v0/core.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,24 +32,62 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) // Validate checks the field values on RelationTuple with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *RelationTuple) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RelationTuple with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in RelationTupleMultiError, or +// nil if none found. +func (m *RelationTuple) ValidateAll() error { + return m.validate(true) +} + +func (m *RelationTuple) validate(all bool) error { if m == nil { return nil } + var errors []error + if m.GetObjectAndRelation() == nil { - return RelationTupleValidationError{ + err := RelationTupleValidationError{ field: "ObjectAndRelation", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetObjectAndRelation()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetObjectAndRelation()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RelationTupleValidationError{ + field: "ObjectAndRelation", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RelationTupleValidationError{ + field: "ObjectAndRelation", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetObjectAndRelation()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RelationTupleValidationError{ field: "ObjectAndRelation", @@ -59,13 +98,36 @@ func (m *RelationTuple) Validate() error { } if m.GetUser() == nil { - return RelationTupleValidationError{ + err := RelationTupleValidationError{ field: "User", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetUser()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RelationTupleValidationError{ + field: "User", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RelationTupleValidationError{ + field: "User", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RelationTupleValidationError{ field: "User", @@ -75,9 +137,30 @@ func (m *RelationTuple) Validate() error { } } + if len(errors) > 0 { + return RelationTupleMultiError(errors) + } + return nil } +// RelationTupleMultiError is an error wrapping multiple validation errors +// returned by RelationTuple.ValidateAll() if the designated constraints +// aren't met. +type RelationTupleMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RelationTupleMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RelationTupleMultiError) AllErrors() []error { return m } + // RelationTupleValidationError is the validation error returned by // RelationTuple.Validate if the designated constraints aren't met. type RelationTupleValidationError struct { @@ -133,58 +216,117 @@ var _ interface { } = RelationTupleValidationError{} // Validate checks the field values on ObjectAndRelation with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *ObjectAndRelation) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ObjectAndRelation with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ObjectAndRelationMultiError, or nil if none found. +func (m *ObjectAndRelation) ValidateAll() error { + return m.validate(true) +} + +func (m *ObjectAndRelation) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetNamespace()) > 128 { - return ObjectAndRelationValidationError{ + err := ObjectAndRelationValidationError{ field: "Namespace", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_ObjectAndRelation_Namespace_Pattern.MatchString(m.GetNamespace()) { - return ObjectAndRelationValidationError{ + err := ObjectAndRelationValidationError{ field: "Namespace", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetObjectId()) > 128 { - return ObjectAndRelationValidationError{ + err := ObjectAndRelationValidationError{ field: "ObjectId", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_ObjectAndRelation_ObjectId_Pattern.MatchString(m.GetObjectId()) { - return ObjectAndRelationValidationError{ + err := ObjectAndRelationValidationError{ field: "ObjectId", reason: "value does not match regex pattern \"^(([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})|\\\\*)$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetRelation()) > 64 { - return ObjectAndRelationValidationError{ + err := ObjectAndRelationValidationError{ field: "Relation", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_ObjectAndRelation_Relation_Pattern.MatchString(m.GetRelation()) { - return ObjectAndRelationValidationError{ + err := ObjectAndRelationValidationError{ field: "Relation", reason: "value does not match regex pattern \"^(\\\\.\\\\.\\\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$\"", } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return ObjectAndRelationMultiError(errors) } return nil } +// ObjectAndRelationMultiError is an error wrapping multiple validation errors +// returned by ObjectAndRelation.ValidateAll() if the designated constraints +// aren't met. +type ObjectAndRelationMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ObjectAndRelationMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ObjectAndRelationMultiError) AllErrors() []error { return m } + // ObjectAndRelationValidationError is the validation error returned by // ObjectAndRelation.Validate if the designated constraints aren't met. type ObjectAndRelationValidationError struct { @@ -248,44 +390,95 @@ var _ObjectAndRelation_ObjectId_Pattern = regexp.MustCompile("^(([a-zA-Z0-9_][a- var _ObjectAndRelation_Relation_Pattern = regexp.MustCompile("^(\\.\\.\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$") // Validate checks the field values on RelationReference with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *RelationReference) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RelationReference with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// RelationReferenceMultiError, or nil if none found. +func (m *RelationReference) ValidateAll() error { + return m.validate(true) +} + +func (m *RelationReference) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetNamespace()) > 128 { - return RelationReferenceValidationError{ + err := RelationReferenceValidationError{ field: "Namespace", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_RelationReference_Namespace_Pattern.MatchString(m.GetNamespace()) { - return RelationReferenceValidationError{ + err := RelationReferenceValidationError{ field: "Namespace", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetRelation()) > 64 { - return RelationReferenceValidationError{ + err := RelationReferenceValidationError{ field: "Relation", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_RelationReference_Relation_Pattern.MatchString(m.GetRelation()) { - return RelationReferenceValidationError{ + err := RelationReferenceValidationError{ field: "Relation", reason: "value does not match regex pattern \"^(\\\\.\\\\.\\\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$\"", } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return RelationReferenceMultiError(errors) } return nil } +// RelationReferenceMultiError is an error wrapping multiple validation errors +// returned by RelationReference.ValidateAll() if the designated constraints +// aren't met. +type RelationReferenceMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RelationReferenceMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RelationReferenceMultiError) AllErrors() []error { return m } + // RelationReferenceValidationError is the validation error returned by // RelationReference.Validate if the designated constraints aren't met. type RelationReferenceValidationError struct { @@ -347,24 +540,61 @@ var _RelationReference_Namespace_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{ var _RelationReference_Relation_Pattern = regexp.MustCompile("^(\\.\\.\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$") // Validate checks the field values on User with the rules defined in the proto -// definition for this message. If any rules are violated, an error is returned. +// definition for this message. If any rules are violated, the first error +// encountered is returned, or nil if there are no violations. func (m *User) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on User with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in UserMultiError, or nil if none found. +func (m *User) ValidateAll() error { + return m.validate(true) +} + +func (m *User) validate(all bool) error { if m == nil { return nil } + var errors []error + switch m.UserOneof.(type) { case *User_Userset: if m.GetUserset() == nil { - return UserValidationError{ + err := UserValidationError{ field: "Userset", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetUserset()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetUserset()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UserValidationError{ + field: "Userset", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UserValidationError{ + field: "Userset", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUserset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UserValidationError{ field: "Userset", @@ -375,16 +605,40 @@ func (m *User) Validate() error { } default: - return UserValidationError{ + err := UserValidationError{ field: "UserOneof", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) + + } + if len(errors) > 0 { + return UserMultiError(errors) } return nil } +// UserMultiError is an error wrapping multiple validation errors returned by +// User.ValidateAll() if the designated constraints aren't met. +type UserMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UserMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UserMultiError) AllErrors() []error { return m } + // UserValidationError is the validation error returned by User.Validate if the // designated constraints aren't met. type UserValidationError struct { @@ -438,434 +692,3 @@ var _ interface { Cause() error ErrorName() string } = UserValidationError{} - -// Validate checks the field values on Zookie with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. -func (m *Zookie) Validate() error { - if m == nil { - return nil - } - - if len(m.GetToken()) < 1 { - return ZookieValidationError{ - field: "Token", - reason: "value length must be at least 1 bytes", - } - } - - return nil -} - -// ZookieValidationError is the validation error returned by Zookie.Validate if -// the designated constraints aren't met. -type ZookieValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ZookieValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ZookieValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ZookieValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ZookieValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ZookieValidationError) ErrorName() string { return "ZookieValidationError" } - -// Error satisfies the builtin error interface -func (e ZookieValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sZookie.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ZookieValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ZookieValidationError{} - -// Validate checks the field values on RelationTupleUpdate with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *RelationTupleUpdate) Validate() error { - if m == nil { - return nil - } - - if _, ok := RelationTupleUpdate_Operation_name[int32(m.GetOperation())]; !ok { - return RelationTupleUpdateValidationError{ - field: "Operation", - reason: "value must be one of the defined enum values", - } - } - - if m.GetTuple() == nil { - return RelationTupleUpdateValidationError{ - field: "Tuple", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetTuple()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RelationTupleUpdateValidationError{ - field: "Tuple", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// RelationTupleUpdateValidationError is the validation error returned by -// RelationTupleUpdate.Validate if the designated constraints aren't met. -type RelationTupleUpdateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RelationTupleUpdateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RelationTupleUpdateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RelationTupleUpdateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RelationTupleUpdateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RelationTupleUpdateValidationError) ErrorName() string { - return "RelationTupleUpdateValidationError" -} - -// Error satisfies the builtin error interface -func (e RelationTupleUpdateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRelationTupleUpdate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RelationTupleUpdateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RelationTupleUpdateValidationError{} - -// Validate checks the field values on RelationTupleTreeNode with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *RelationTupleTreeNode) Validate() error { - if m == nil { - return nil - } - - if v, ok := interface{}(m.GetExpanded()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RelationTupleTreeNodeValidationError{ - field: "Expanded", - reason: "embedded message failed validation", - cause: err, - } - } - } - - switch m.NodeType.(type) { - - case *RelationTupleTreeNode_IntermediateNode: - - if v, ok := interface{}(m.GetIntermediateNode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RelationTupleTreeNodeValidationError{ - field: "IntermediateNode", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *RelationTupleTreeNode_LeafNode: - - if v, ok := interface{}(m.GetLeafNode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RelationTupleTreeNodeValidationError{ - field: "LeafNode", - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - return nil -} - -// RelationTupleTreeNodeValidationError is the validation error returned by -// RelationTupleTreeNode.Validate if the designated constraints aren't met. -type RelationTupleTreeNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RelationTupleTreeNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RelationTupleTreeNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RelationTupleTreeNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RelationTupleTreeNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RelationTupleTreeNodeValidationError) ErrorName() string { - return "RelationTupleTreeNodeValidationError" -} - -// Error satisfies the builtin error interface -func (e RelationTupleTreeNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRelationTupleTreeNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RelationTupleTreeNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RelationTupleTreeNodeValidationError{} - -// Validate checks the field values on SetOperationUserset with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *SetOperationUserset) Validate() error { - if m == nil { - return nil - } - - // no validation rules for Operation - - for idx, item := range m.GetChildNodes() { - _, _ = idx, item - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SetOperationUsersetValidationError{ - field: fmt.Sprintf("ChildNodes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - return nil -} - -// SetOperationUsersetValidationError is the validation error returned by -// SetOperationUserset.Validate if the designated constraints aren't met. -type SetOperationUsersetValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetOperationUsersetValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetOperationUsersetValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetOperationUsersetValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetOperationUsersetValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetOperationUsersetValidationError) ErrorName() string { - return "SetOperationUsersetValidationError" -} - -// Error satisfies the builtin error interface -func (e SetOperationUsersetValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetOperationUserset.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetOperationUsersetValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetOperationUsersetValidationError{} - -// Validate checks the field values on DirectUserset with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *DirectUserset) Validate() error { - if m == nil { - return nil - } - - for idx, item := range m.GetUsers() { - _, _ = idx, item - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DirectUsersetValidationError{ - field: fmt.Sprintf("Users[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - return nil -} - -// DirectUsersetValidationError is the validation error returned by -// DirectUserset.Validate if the designated constraints aren't met. -type DirectUsersetValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DirectUsersetValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DirectUsersetValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DirectUsersetValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DirectUsersetValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DirectUsersetValidationError) ErrorName() string { return "DirectUsersetValidationError" } - -// Error satisfies the builtin error interface -func (e DirectUsersetValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDirectUserset.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DirectUsersetValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DirectUsersetValidationError{} diff --git a/proto/authzed/api/v0/developer.pb.go b/proto/authzed/api/v0/developer.pb.go index f63cc2e..7e74688 100644 --- a/proto/authzed/api/v0/developer.pb.go +++ b/proto/authzed/api/v0/developer.pb.go @@ -653,9 +653,8 @@ type RequestContext struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Schema string `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"` - Relationships []*RelationTuple `protobuf:"bytes,2,rep,name=relationships,proto3" json:"relationships,omitempty"` - LegacyNsConfigs []*NamespaceDefinition `protobuf:"bytes,3,rep,name=legacy_ns_configs,json=legacyNsConfigs,proto3" json:"legacy_ns_configs,omitempty"` + Schema string `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"` + Relationships []*RelationTuple `protobuf:"bytes,2,rep,name=relationships,proto3" json:"relationships,omitempty"` } func (x *RequestContext) Reset() { @@ -704,13 +703,6 @@ func (x *RequestContext) GetRelationships() []*RelationTuple { return nil } -func (x *RequestContext) GetLegacyNsConfigs() []*NamespaceDefinition { - if x != nil { - return x.LegacyNsConfigs - } - return nil -} - type EditCheckRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1122,9 +1114,7 @@ var file_authzed_api_v0_developer_proto_rawDesc = []byte{ 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x1a, 0x19, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, - 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x13, 0x46, + 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x13, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x77, 0x0a, 0x14, 0x46, 0x6f, @@ -1187,155 +1177,150 @@ var file_authzed_api_v0_developer_proto_rawDesc = []byte{ 0x54, 0x4f, 0x5f, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x52, 0x45, 0x46, 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x55, 0x50, 0x47, 0x52, 0x41, 0x44, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x46, - 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x22, 0xbe, 0x01, 0x0a, 0x0e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x68, 0x69, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x4f, 0x0a, 0x11, 0x6c, 0x65, 0x67, 0x61, - 0x63, 0x79, 0x5f, 0x6e, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x44, 0x65, - 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, - 0x4e, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x10, 0x45, 0x64, - 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, - 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x22, 0x73, 0x0a, 0x0e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, + 0x69, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x52, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22, 0x9c, 0x01, + 0x0a, 0x10, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x38, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x4e, 0x0a, 0x13, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, + 0x69, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x52, 0x12, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x73, 0x22, 0xa7, 0x01, 0x0a, + 0x0f, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x41, 0x0a, 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x54, 0x75, 0x70, 0x6c, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x68, 0x69, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x34, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x4e, 0x0a, 0x13, 0x63, 0x68, 0x65, 0x63, - 0x6b, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x75, 0x70, 0x6c, 0x65, 0x52, 0x12, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x0f, 0x45, 0x64, 0x69, - 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x41, 0x0a, 0x0c, - 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, - 0x65, 0x52, 0x0c, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x12, - 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x76, - 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x22, 0xa0, 0x01, 0x0a, 0x11, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0e, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x30, 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, - 0x44, 0x0a, 0x0d, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x0c, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xd3, 0x01, 0x0a, 0x0f, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x07, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x34, 0x0a, 0x16, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x59, 0x61, - 0x6d, 0x6c, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x5f, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x73, 0x73, - 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x22, 0xde, 0x01, 0x0a, 0x10, - 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x45, 0x0a, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, - 0x70, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, 0x4b, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x79, 0x61, 0x6d, 0x6c, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x56, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x22, 0xee, 0x04, 0x0a, - 0x0e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, - 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x63, - 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x3d, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, - 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x22, 0x6f, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x10, 0x00, 0x12, 0x0a, - 0x0a, 0x06, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x45, - 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x48, 0x49, 0x50, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, - 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, 0x41, 0x4d, 0x4c, 0x10, - 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x57, 0x41, 0x54, 0x43, 0x48, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x53, 0x53, 0x45, 0x52, 0x54, 0x49, 0x4f, 0x4e, 0x10, - 0x05, 0x22, 0xf9, 0x01, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4b, 0x69, 0x6e, 0x64, 0x12, - 0x10, 0x0a, 0x0c, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x10, - 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x52, 0x53, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, - 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x49, 0x53, 0x53, - 0x55, 0x45, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x55, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, - 0x45, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x48, 0x49, 0x50, 0x10, 0x03, - 0x12, 0x21, 0x0a, 0x1d, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x58, 0x50, 0x45, - 0x43, 0x54, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x48, 0x49, - 0x50, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x58, 0x54, 0x52, 0x41, 0x5f, 0x52, 0x45, 0x4c, - 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, - 0x05, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4f, 0x42, 0x4a, - 0x45, 0x43, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x06, 0x12, 0x14, 0x0a, 0x10, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x07, - 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x41, 0x58, 0x49, 0x4d, 0x55, 0x4d, 0x5f, 0x52, 0x45, 0x43, 0x55, - 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x08, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x53, 0x53, 0x45, 0x52, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x09, 0x32, 0x97, 0x04, - 0x0a, 0x10, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x52, 0x0a, 0x09, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, - 0x20, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x30, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x08, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x05, 0x53, 0x68, 0x61, 0x72, 0x65, - 0x12, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x30, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, + 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xa0, 0x01, 0x0a, 0x11, 0x45, 0x64, 0x69, 0x74, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0e, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x75, 0x74, + 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x45, 0x64, 0x69, 0x74, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x0c, 0x63, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xd3, 0x01, 0x0a, 0x0f, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, + 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x59, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x12, - 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x59, 0x61, 0x6d, 0x6c, + 0x12, 0x34, 0x0a, 0x16, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x14, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x22, + 0xde, 0x01, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, + 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x0d, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, 0x4b, 0x0a, 0x11, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, + 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x79, + 0x61, 0x6d, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x59, 0x61, 0x6d, 0x6c, + 0x22, 0xee, 0x04, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x6c, 0x69, 0x6e, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x3d, 0x0a, 0x06, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, + 0x6f, 0x70, 0x65, 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, + 0x72, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4b, 0x69, 0x6e, 0x64, + 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x06, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x78, 0x74, 0x22, 0x6f, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, + 0x0a, 0x0e, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, + 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x10, 0x01, 0x12, 0x10, + 0x0a, 0x0c, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x48, 0x49, 0x50, 0x10, 0x02, + 0x12, 0x13, 0x0a, 0x0f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, + 0x41, 0x4d, 0x4c, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x57, + 0x41, 0x54, 0x43, 0x48, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x53, 0x53, 0x45, 0x52, 0x54, + 0x49, 0x4f, 0x4e, 0x10, 0x05, 0x22, 0xf9, 0x01, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4b, + 0x69, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x0c, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4b, + 0x49, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x52, 0x53, 0x45, 0x5f, 0x45, + 0x52, 0x52, 0x4f, 0x52, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, + 0x5f, 0x49, 0x53, 0x53, 0x55, 0x45, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x55, 0x50, 0x4c, + 0x49, 0x43, 0x41, 0x54, 0x45, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x48, + 0x49, 0x50, 0x10, 0x03, 0x12, 0x21, 0x0a, 0x1d, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x5f, + 0x45, 0x58, 0x50, 0x45, 0x43, 0x54, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x49, 0x4f, + 0x4e, 0x53, 0x48, 0x49, 0x50, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x58, 0x54, 0x52, 0x41, + 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x48, 0x49, 0x50, 0x5f, 0x46, 0x4f, + 0x55, 0x4e, 0x44, 0x10, 0x05, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x06, 0x12, 0x14, + 0x0a, 0x10, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x49, + 0x4f, 0x4e, 0x10, 0x07, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x41, 0x58, 0x49, 0x4d, 0x55, 0x4d, 0x5f, + 0x52, 0x45, 0x43, 0x55, 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x08, 0x12, 0x14, 0x0a, 0x10, 0x41, + 0x53, 0x53, 0x45, 0x52, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, + 0x09, 0x32, 0x97, 0x04, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x09, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x12, 0x20, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x08, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, + 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x05, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x12, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x59, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x12, 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x68, 0x61, 0x72, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, 0x0a, 0x0d, 0x55, 0x70, - 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x24, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x55, 0x70, 0x67, - 0x72, 0x61, 0x64, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x25, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x30, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x0c, 0x46, 0x6f, - 0x72, 0x6d, 0x61, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x23, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x46, 0x6f, 0x72, 0x6d, - 0x61, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, + 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, + 0x0a, 0x0d, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x24, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x48, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x5a, 0x32, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, - 0x64, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x30, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, + 0x0a, 0x0c, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x23, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, + 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x48, 0x0a, 0x12, 0x63, + 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x30, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2d, 0x67, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x30, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1372,42 +1357,40 @@ var file_authzed_api_v0_developer_proto_goTypes = []interface{}{ (*ValidateResponse)(nil), // 16: authzed.api.v0.ValidateResponse (*DeveloperError)(nil), // 17: authzed.api.v0.DeveloperError (*RelationTuple)(nil), // 18: authzed.api.v0.RelationTuple - (*NamespaceDefinition)(nil), // 19: authzed.api.v0.NamespaceDefinition } var file_authzed_api_v0_developer_proto_depIdxs = []int32{ 17, // 0: authzed.api.v0.FormatSchemaResponse.error:type_name -> authzed.api.v0.DeveloperError 17, // 1: authzed.api.v0.UpgradeSchemaResponse.error:type_name -> authzed.api.v0.DeveloperError 0, // 2: authzed.api.v0.LookupShareResponse.status:type_name -> authzed.api.v0.LookupShareResponse.LookupStatus 18, // 3: authzed.api.v0.RequestContext.relationships:type_name -> authzed.api.v0.RelationTuple - 19, // 4: authzed.api.v0.RequestContext.legacy_ns_configs:type_name -> authzed.api.v0.NamespaceDefinition - 11, // 5: authzed.api.v0.EditCheckRequest.context:type_name -> authzed.api.v0.RequestContext - 18, // 6: authzed.api.v0.EditCheckRequest.check_relationships:type_name -> authzed.api.v0.RelationTuple - 18, // 7: authzed.api.v0.EditCheckResult.relationship:type_name -> authzed.api.v0.RelationTuple - 17, // 8: authzed.api.v0.EditCheckResult.error:type_name -> authzed.api.v0.DeveloperError - 17, // 9: authzed.api.v0.EditCheckResponse.request_errors:type_name -> authzed.api.v0.DeveloperError - 13, // 10: authzed.api.v0.EditCheckResponse.check_results:type_name -> authzed.api.v0.EditCheckResult - 11, // 11: authzed.api.v0.ValidateRequest.context:type_name -> authzed.api.v0.RequestContext - 17, // 12: authzed.api.v0.ValidateResponse.request_errors:type_name -> authzed.api.v0.DeveloperError - 17, // 13: authzed.api.v0.ValidateResponse.validation_errors:type_name -> authzed.api.v0.DeveloperError - 1, // 14: authzed.api.v0.DeveloperError.source:type_name -> authzed.api.v0.DeveloperError.Source - 2, // 15: authzed.api.v0.DeveloperError.kind:type_name -> authzed.api.v0.DeveloperError.ErrorKind - 12, // 16: authzed.api.v0.DeveloperService.EditCheck:input_type -> authzed.api.v0.EditCheckRequest - 15, // 17: authzed.api.v0.DeveloperService.Validate:input_type -> authzed.api.v0.ValidateRequest - 7, // 18: authzed.api.v0.DeveloperService.Share:input_type -> authzed.api.v0.ShareRequest - 9, // 19: authzed.api.v0.DeveloperService.LookupShared:input_type -> authzed.api.v0.LookupShareRequest - 5, // 20: authzed.api.v0.DeveloperService.UpgradeSchema:input_type -> authzed.api.v0.UpgradeSchemaRequest - 3, // 21: authzed.api.v0.DeveloperService.FormatSchema:input_type -> authzed.api.v0.FormatSchemaRequest - 14, // 22: authzed.api.v0.DeveloperService.EditCheck:output_type -> authzed.api.v0.EditCheckResponse - 16, // 23: authzed.api.v0.DeveloperService.Validate:output_type -> authzed.api.v0.ValidateResponse - 8, // 24: authzed.api.v0.DeveloperService.Share:output_type -> authzed.api.v0.ShareResponse - 10, // 25: authzed.api.v0.DeveloperService.LookupShared:output_type -> authzed.api.v0.LookupShareResponse - 6, // 26: authzed.api.v0.DeveloperService.UpgradeSchema:output_type -> authzed.api.v0.UpgradeSchemaResponse - 4, // 27: authzed.api.v0.DeveloperService.FormatSchema:output_type -> authzed.api.v0.FormatSchemaResponse - 22, // [22:28] is the sub-list for method output_type - 16, // [16:22] is the sub-list for method input_type - 16, // [16:16] is the sub-list for extension type_name - 16, // [16:16] is the sub-list for extension extendee - 0, // [0:16] is the sub-list for field type_name + 11, // 4: authzed.api.v0.EditCheckRequest.context:type_name -> authzed.api.v0.RequestContext + 18, // 5: authzed.api.v0.EditCheckRequest.check_relationships:type_name -> authzed.api.v0.RelationTuple + 18, // 6: authzed.api.v0.EditCheckResult.relationship:type_name -> authzed.api.v0.RelationTuple + 17, // 7: authzed.api.v0.EditCheckResult.error:type_name -> authzed.api.v0.DeveloperError + 17, // 8: authzed.api.v0.EditCheckResponse.request_errors:type_name -> authzed.api.v0.DeveloperError + 13, // 9: authzed.api.v0.EditCheckResponse.check_results:type_name -> authzed.api.v0.EditCheckResult + 11, // 10: authzed.api.v0.ValidateRequest.context:type_name -> authzed.api.v0.RequestContext + 17, // 11: authzed.api.v0.ValidateResponse.request_errors:type_name -> authzed.api.v0.DeveloperError + 17, // 12: authzed.api.v0.ValidateResponse.validation_errors:type_name -> authzed.api.v0.DeveloperError + 1, // 13: authzed.api.v0.DeveloperError.source:type_name -> authzed.api.v0.DeveloperError.Source + 2, // 14: authzed.api.v0.DeveloperError.kind:type_name -> authzed.api.v0.DeveloperError.ErrorKind + 12, // 15: authzed.api.v0.DeveloperService.EditCheck:input_type -> authzed.api.v0.EditCheckRequest + 15, // 16: authzed.api.v0.DeveloperService.Validate:input_type -> authzed.api.v0.ValidateRequest + 7, // 17: authzed.api.v0.DeveloperService.Share:input_type -> authzed.api.v0.ShareRequest + 9, // 18: authzed.api.v0.DeveloperService.LookupShared:input_type -> authzed.api.v0.LookupShareRequest + 5, // 19: authzed.api.v0.DeveloperService.UpgradeSchema:input_type -> authzed.api.v0.UpgradeSchemaRequest + 3, // 20: authzed.api.v0.DeveloperService.FormatSchema:input_type -> authzed.api.v0.FormatSchemaRequest + 14, // 21: authzed.api.v0.DeveloperService.EditCheck:output_type -> authzed.api.v0.EditCheckResponse + 16, // 22: authzed.api.v0.DeveloperService.Validate:output_type -> authzed.api.v0.ValidateResponse + 8, // 23: authzed.api.v0.DeveloperService.Share:output_type -> authzed.api.v0.ShareResponse + 10, // 24: authzed.api.v0.DeveloperService.LookupShared:output_type -> authzed.api.v0.LookupShareResponse + 6, // 25: authzed.api.v0.DeveloperService.UpgradeSchema:output_type -> authzed.api.v0.UpgradeSchemaResponse + 4, // 26: authzed.api.v0.DeveloperService.FormatSchema:output_type -> authzed.api.v0.FormatSchemaResponse + 21, // [21:27] is the sub-list for method output_type + 15, // [15:21] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_authzed_api_v0_developer_proto_init() } @@ -1416,7 +1399,6 @@ func file_authzed_api_v0_developer_proto_init() { return } file_authzed_api_v0_core_proto_init() - file_authzed_api_v0_namespace_proto_init() if !protoimpl.UnsafeEnabled { file_authzed_api_v0_developer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FormatSchemaRequest); i { diff --git a/proto/authzed/api/v0/developer.pb.validate.go b/proto/authzed/api/v0/developer.pb.validate.go index e60674c..6621cd4 100644 --- a/proto/authzed/api/v0/developer.pb.validate.go +++ b/proto/authzed/api/v0/developer.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,21 +32,57 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) // Validate checks the field values on FormatSchemaRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *FormatSchemaRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on FormatSchemaRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// FormatSchemaRequestMultiError, or nil if none found. +func (m *FormatSchemaRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *FormatSchemaRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Schema + if len(errors) > 0 { + return FormatSchemaRequestMultiError(errors) + } + return nil } +// FormatSchemaRequestMultiError is an error wrapping multiple validation +// errors returned by FormatSchemaRequest.ValidateAll() if the designated +// constraints aren't met. +type FormatSchemaRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m FormatSchemaRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m FormatSchemaRequestMultiError) AllErrors() []error { return m } + // FormatSchemaRequestValidationError is the validation error returned by // FormatSchemaRequest.Validate if the designated constraints aren't met. type FormatSchemaRequestValidationError struct { @@ -104,13 +141,46 @@ var _ interface { // Validate checks the field values on FormatSchemaResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *FormatSchemaResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on FormatSchemaResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// FormatSchemaResponseMultiError, or nil if none found. +func (m *FormatSchemaResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *FormatSchemaResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetError()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, FormatSchemaResponseValidationError{ + field: "Error", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, FormatSchemaResponseValidationError{ + field: "Error", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return FormatSchemaResponseValidationError{ field: "Error", @@ -122,9 +192,30 @@ func (m *FormatSchemaResponse) Validate() error { // no validation rules for FormattedSchema + if len(errors) > 0 { + return FormatSchemaResponseMultiError(errors) + } + return nil } +// FormatSchemaResponseMultiError is an error wrapping multiple validation +// errors returned by FormatSchemaResponse.ValidateAll() if the designated +// constraints aren't met. +type FormatSchemaResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m FormatSchemaResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m FormatSchemaResponseMultiError) AllErrors() []error { return m } + // FormatSchemaResponseValidationError is the validation error returned by // FormatSchemaResponse.Validate if the designated constraints aren't met. type FormatSchemaResponseValidationError struct { @@ -183,15 +274,50 @@ var _ interface { // Validate checks the field values on UpgradeSchemaRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *UpgradeSchemaRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpgradeSchemaRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UpgradeSchemaRequestMultiError, or nil if none found. +func (m *UpgradeSchemaRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpgradeSchemaRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + + if len(errors) > 0 { + return UpgradeSchemaRequestMultiError(errors) + } + return nil } +// UpgradeSchemaRequestMultiError is an error wrapping multiple validation +// errors returned by UpgradeSchemaRequest.ValidateAll() if the designated +// constraints aren't met. +type UpgradeSchemaRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpgradeSchemaRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UpgradeSchemaRequestMultiError) AllErrors() []error { return m } + // UpgradeSchemaRequestValidationError is the validation error returned by // UpgradeSchemaRequest.Validate if the designated constraints aren't met. type UpgradeSchemaRequestValidationError struct { @@ -250,13 +376,46 @@ var _ interface { // Validate checks the field values on UpgradeSchemaResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *UpgradeSchemaResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpgradeSchemaResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UpgradeSchemaResponseMultiError, or nil if none found. +func (m *UpgradeSchemaResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *UpgradeSchemaResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetError()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UpgradeSchemaResponseValidationError{ + field: "Error", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UpgradeSchemaResponseValidationError{ + field: "Error", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UpgradeSchemaResponseValidationError{ field: "Error", @@ -268,9 +427,30 @@ func (m *UpgradeSchemaResponse) Validate() error { // no validation rules for UpgradedSchema + if len(errors) > 0 { + return UpgradeSchemaResponseMultiError(errors) + } + return nil } +// UpgradeSchemaResponseMultiError is an error wrapping multiple validation +// errors returned by UpgradeSchemaResponse.ValidateAll() if the designated +// constraints aren't met. +type UpgradeSchemaResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpgradeSchemaResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UpgradeSchemaResponseMultiError) AllErrors() []error { return m } + // UpgradeSchemaResponseValidationError is the validation error returned by // UpgradeSchemaResponse.Validate if the designated constraints aren't met. type UpgradeSchemaResponseValidationError struct { @@ -328,13 +508,27 @@ var _ interface { } = UpgradeSchemaResponseValidationError{} // Validate checks the field values on ShareRequest with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *ShareRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ShareRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ShareRequestMultiError, or +// nil if none found. +func (m *ShareRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ShareRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Schema // no validation rules for RelationshipsYaml @@ -343,9 +537,29 @@ func (m *ShareRequest) Validate() error { // no validation rules for AssertionsYaml + if len(errors) > 0 { + return ShareRequestMultiError(errors) + } + return nil } +// ShareRequestMultiError is an error wrapping multiple validation errors +// returned by ShareRequest.ValidateAll() if the designated constraints aren't met. +type ShareRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ShareRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ShareRequestMultiError) AllErrors() []error { return m } + // ShareRequestValidationError is the validation error returned by // ShareRequest.Validate if the designated constraints aren't met. type ShareRequestValidationError struct { @@ -401,18 +615,53 @@ var _ interface { } = ShareRequestValidationError{} // Validate checks the field values on ShareResponse with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *ShareResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ShareResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ShareResponseMultiError, or +// nil if none found. +func (m *ShareResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ShareResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for ShareReference + if len(errors) > 0 { + return ShareResponseMultiError(errors) + } + return nil } +// ShareResponseMultiError is an error wrapping multiple validation errors +// returned by ShareResponse.ValidateAll() if the designated constraints +// aren't met. +type ShareResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ShareResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ShareResponseMultiError) AllErrors() []error { return m } + // ShareResponseValidationError is the validation error returned by // ShareResponse.Validate if the designated constraints aren't met. type ShareResponseValidationError struct { @@ -469,17 +718,52 @@ var _ interface { // Validate checks the field values on LookupShareRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *LookupShareRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on LookupShareRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// LookupShareRequestMultiError, or nil if none found. +func (m *LookupShareRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *LookupShareRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for ShareReference + if len(errors) > 0 { + return LookupShareRequestMultiError(errors) + } + return nil } +// LookupShareRequestMultiError is an error wrapping multiple validation errors +// returned by LookupShareRequest.ValidateAll() if the designated constraints +// aren't met. +type LookupShareRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m LookupShareRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m LookupShareRequestMultiError) AllErrors() []error { return m } + // LookupShareRequestValidationError is the validation error returned by // LookupShareRequest.Validate if the designated constraints aren't met. type LookupShareRequestValidationError struct { @@ -538,12 +822,26 @@ var _ interface { // Validate checks the field values on LookupShareResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *LookupShareResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on LookupShareResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// LookupShareResponseMultiError, or nil if none found. +func (m *LookupShareResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *LookupShareResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Status // no validation rules for Schema @@ -554,9 +852,30 @@ func (m *LookupShareResponse) Validate() error { // no validation rules for AssertionsYaml + if len(errors) > 0 { + return LookupShareResponseMultiError(errors) + } + return nil } +// LookupShareResponseMultiError is an error wrapping multiple validation +// errors returned by LookupShareResponse.ValidateAll() if the designated +// constraints aren't met. +type LookupShareResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m LookupShareResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m LookupShareResponseMultiError) AllErrors() []error { return m } + // LookupShareResponseValidationError is the validation error returned by // LookupShareResponse.Validate if the designated constraints aren't met. type LookupShareResponseValidationError struct { @@ -614,19 +933,52 @@ var _ interface { } = LookupShareResponseValidationError{} // Validate checks the field values on RequestContext with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *RequestContext) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RequestContext with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in RequestContextMultiError, +// or nil if none found. +func (m *RequestContext) ValidateAll() error { + return m.validate(true) +} + +func (m *RequestContext) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Schema for idx, item := range m.GetRelationships() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RequestContextValidationError{ + field: fmt.Sprintf("Relationships[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RequestContextValidationError{ + field: fmt.Sprintf("Relationships[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RequestContextValidationError{ field: fmt.Sprintf("Relationships[%v]", idx), @@ -638,24 +990,30 @@ func (m *RequestContext) Validate() error { } - for idx, item := range m.GetLegacyNsConfigs() { - _, _ = idx, item - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RequestContextValidationError{ - field: fmt.Sprintf("LegacyNsConfigs[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - + if len(errors) > 0 { + return RequestContextMultiError(errors) } return nil } +// RequestContextMultiError is an error wrapping multiple validation errors +// returned by RequestContext.ValidateAll() if the designated constraints +// aren't met. +type RequestContextMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RequestContextMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RequestContextMultiError) AllErrors() []error { return m } + // RequestContextValidationError is the validation error returned by // RequestContext.Validate if the designated constraints aren't met. type RequestContextValidationError struct { @@ -711,14 +1069,47 @@ var _ interface { } = RequestContextValidationError{} // Validate checks the field values on EditCheckRequest with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *EditCheckRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EditCheckRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// EditCheckRequestMultiError, or nil if none found. +func (m *EditCheckRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *EditCheckRequest) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetContext()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetContext()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, EditCheckRequestValidationError{ + field: "Context", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, EditCheckRequestValidationError{ + field: "Context", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetContext()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return EditCheckRequestValidationError{ field: "Context", @@ -731,7 +1122,26 @@ func (m *EditCheckRequest) Validate() error { for idx, item := range m.GetCheckRelationships() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, EditCheckRequestValidationError{ + field: fmt.Sprintf("CheckRelationships[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, EditCheckRequestValidationError{ + field: fmt.Sprintf("CheckRelationships[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return EditCheckRequestValidationError{ field: fmt.Sprintf("CheckRelationships[%v]", idx), @@ -743,9 +1153,30 @@ func (m *EditCheckRequest) Validate() error { } + if len(errors) > 0 { + return EditCheckRequestMultiError(errors) + } + return nil } +// EditCheckRequestMultiError is an error wrapping multiple validation errors +// returned by EditCheckRequest.ValidateAll() if the designated constraints +// aren't met. +type EditCheckRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EditCheckRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EditCheckRequestMultiError) AllErrors() []error { return m } + // EditCheckRequestValidationError is the validation error returned by // EditCheckRequest.Validate if the designated constraints aren't met. type EditCheckRequestValidationError struct { @@ -801,14 +1232,47 @@ var _ interface { } = EditCheckRequestValidationError{} // Validate checks the field values on EditCheckResult with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *EditCheckResult) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EditCheckResult with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// EditCheckResultMultiError, or nil if none found. +func (m *EditCheckResult) ValidateAll() error { + return m.validate(true) +} + +func (m *EditCheckResult) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetRelationship()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetRelationship()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, EditCheckResultValidationError{ + field: "Relationship", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, EditCheckResultValidationError{ + field: "Relationship", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRelationship()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return EditCheckResultValidationError{ field: "Relationship", @@ -820,7 +1284,26 @@ func (m *EditCheckResult) Validate() error { // no validation rules for IsMember - if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetError()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, EditCheckResultValidationError{ + field: "Error", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, EditCheckResultValidationError{ + field: "Error", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return EditCheckResultValidationError{ field: "Error", @@ -830,9 +1313,30 @@ func (m *EditCheckResult) Validate() error { } } + if len(errors) > 0 { + return EditCheckResultMultiError(errors) + } + return nil } +// EditCheckResultMultiError is an error wrapping multiple validation errors +// returned by EditCheckResult.ValidateAll() if the designated constraints +// aren't met. +type EditCheckResultMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EditCheckResultMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EditCheckResultMultiError) AllErrors() []error { return m } + // EditCheckResultValidationError is the validation error returned by // EditCheckResult.Validate if the designated constraints aren't met. type EditCheckResultValidationError struct { @@ -888,17 +1392,50 @@ var _ interface { } = EditCheckResultValidationError{} // Validate checks the field values on EditCheckResponse with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *EditCheckResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EditCheckResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// EditCheckResponseMultiError, or nil if none found. +func (m *EditCheckResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *EditCheckResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetRequestErrors() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, EditCheckResponseValidationError{ + field: fmt.Sprintf("RequestErrors[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, EditCheckResponseValidationError{ + field: fmt.Sprintf("RequestErrors[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return EditCheckResponseValidationError{ field: fmt.Sprintf("RequestErrors[%v]", idx), @@ -913,7 +1450,26 @@ func (m *EditCheckResponse) Validate() error { for idx, item := range m.GetCheckResults() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, EditCheckResponseValidationError{ + field: fmt.Sprintf("CheckResults[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, EditCheckResponseValidationError{ + field: fmt.Sprintf("CheckResults[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return EditCheckResponseValidationError{ field: fmt.Sprintf("CheckResults[%v]", idx), @@ -925,9 +1481,30 @@ func (m *EditCheckResponse) Validate() error { } + if len(errors) > 0 { + return EditCheckResponseMultiError(errors) + } + return nil } +// EditCheckResponseMultiError is an error wrapping multiple validation errors +// returned by EditCheckResponse.ValidateAll() if the designated constraints +// aren't met. +type EditCheckResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EditCheckResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EditCheckResponseMultiError) AllErrors() []error { return m } + // EditCheckResponseValidationError is the validation error returned by // EditCheckResponse.Validate if the designated constraints aren't met. type EditCheckResponseValidationError struct { @@ -985,14 +1562,47 @@ var _ interface { } = EditCheckResponseValidationError{} // Validate checks the field values on ValidateRequest with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *ValidateRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ValidateRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ValidateRequestMultiError, or nil if none found. +func (m *ValidateRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ValidateRequest) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetContext()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetContext()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ValidateRequestValidationError{ + field: "Context", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ValidateRequestValidationError{ + field: "Context", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetContext()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ValidateRequestValidationError{ field: "Context", @@ -1008,9 +1618,30 @@ func (m *ValidateRequest) Validate() error { // no validation rules for AssertionsYaml + if len(errors) > 0 { + return ValidateRequestMultiError(errors) + } + return nil } +// ValidateRequestMultiError is an error wrapping multiple validation errors +// returned by ValidateRequest.ValidateAll() if the designated constraints +// aren't met. +type ValidateRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ValidateRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ValidateRequestMultiError) AllErrors() []error { return m } + // ValidateRequestValidationError is the validation error returned by // ValidateRequest.Validate if the designated constraints aren't met. type ValidateRequestValidationError struct { @@ -1066,17 +1697,50 @@ var _ interface { } = ValidateRequestValidationError{} // Validate checks the field values on ValidateResponse with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *ValidateResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ValidateResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ValidateResponseMultiError, or nil if none found. +func (m *ValidateResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ValidateResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetRequestErrors() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ValidateResponseValidationError{ + field: fmt.Sprintf("RequestErrors[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ValidateResponseValidationError{ + field: fmt.Sprintf("RequestErrors[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ValidateResponseValidationError{ field: fmt.Sprintf("RequestErrors[%v]", idx), @@ -1091,7 +1755,26 @@ func (m *ValidateResponse) Validate() error { for idx, item := range m.GetValidationErrors() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ValidateResponseValidationError{ + field: fmt.Sprintf("ValidationErrors[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ValidateResponseValidationError{ + field: fmt.Sprintf("ValidationErrors[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ValidateResponseValidationError{ field: fmt.Sprintf("ValidationErrors[%v]", idx), @@ -1105,9 +1788,30 @@ func (m *ValidateResponse) Validate() error { // no validation rules for UpdatedValidationYaml + if len(errors) > 0 { + return ValidateResponseMultiError(errors) + } + return nil } +// ValidateResponseMultiError is an error wrapping multiple validation errors +// returned by ValidateResponse.ValidateAll() if the designated constraints +// aren't met. +type ValidateResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ValidateResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ValidateResponseMultiError) AllErrors() []error { return m } + // ValidateResponseValidationError is the validation error returned by // ValidateResponse.Validate if the designated constraints aren't met. type ValidateResponseValidationError struct { @@ -1163,13 +1867,27 @@ var _ interface { } = ValidateResponseValidationError{} // Validate checks the field values on DeveloperError with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *DeveloperError) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeveloperError with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in DeveloperErrorMultiError, +// or nil if none found. +func (m *DeveloperError) ValidateAll() error { + return m.validate(true) +} + +func (m *DeveloperError) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Message // no validation rules for Line @@ -1182,9 +1900,30 @@ func (m *DeveloperError) Validate() error { // no validation rules for Context + if len(errors) > 0 { + return DeveloperErrorMultiError(errors) + } + return nil } +// DeveloperErrorMultiError is an error wrapping multiple validation errors +// returned by DeveloperError.ValidateAll() if the designated constraints +// aren't met. +type DeveloperErrorMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeveloperErrorMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeveloperErrorMultiError) AllErrors() []error { return m } + // DeveloperErrorValidationError is the validation error returned by // DeveloperError.Validate if the designated constraints aren't met. type DeveloperErrorValidationError struct { diff --git a/proto/authzed/api/v0/namespace.pb.go b/proto/authzed/api/v0/namespace.pb.go deleted file mode 100644 index 8d8f262..0000000 --- a/proto/authzed/api/v0/namespace.pb.go +++ /dev/null @@ -1,1289 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc (unknown) -// source: authzed/api/v0/namespace.proto - -package v0 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - 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) -) - -type ComputedUserset_Object int32 - -const ( - ComputedUserset_TUPLE_OBJECT ComputedUserset_Object = 0 - ComputedUserset_TUPLE_USERSET_OBJECT ComputedUserset_Object = 1 -) - -// Enum value maps for ComputedUserset_Object. -var ( - ComputedUserset_Object_name = map[int32]string{ - 0: "TUPLE_OBJECT", - 1: "TUPLE_USERSET_OBJECT", - } - ComputedUserset_Object_value = map[string]int32{ - "TUPLE_OBJECT": 0, - "TUPLE_USERSET_OBJECT": 1, - } -) - -func (x ComputedUserset_Object) Enum() *ComputedUserset_Object { - p := new(ComputedUserset_Object) - *p = x - return p -} - -func (x ComputedUserset_Object) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ComputedUserset_Object) Descriptor() protoreflect.EnumDescriptor { - return file_authzed_api_v0_namespace_proto_enumTypes[0].Descriptor() -} - -func (ComputedUserset_Object) Type() protoreflect.EnumType { - return &file_authzed_api_v0_namespace_proto_enumTypes[0] -} - -func (x ComputedUserset_Object) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ComputedUserset_Object.Descriptor instead. -func (ComputedUserset_Object) EnumDescriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{8, 0} -} - -type Metadata struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MetadataMessage []*anypb.Any `protobuf:"bytes,1,rep,name=metadata_message,json=metadataMessage,proto3" json:"metadata_message,omitempty"` -} - -func (x *Metadata) Reset() { - *x = Metadata{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Metadata) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Metadata) ProtoMessage() {} - -func (x *Metadata) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 Metadata.ProtoReflect.Descriptor instead. -func (*Metadata) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{0} -} - -func (x *Metadata) GetMetadataMessage() []*anypb.Any { - if x != nil { - return x.MetadataMessage - } - return nil -} - -type NamespaceDefinition struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Relation []*Relation `protobuf:"bytes,2,rep,name=relation,proto3" json:"relation,omitempty"` - Metadata *Metadata `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` -} - -func (x *NamespaceDefinition) Reset() { - *x = NamespaceDefinition{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NamespaceDefinition) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NamespaceDefinition) ProtoMessage() {} - -func (x *NamespaceDefinition) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 NamespaceDefinition.ProtoReflect.Descriptor instead. -func (*NamespaceDefinition) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{1} -} - -func (x *NamespaceDefinition) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *NamespaceDefinition) GetRelation() []*Relation { - if x != nil { - return x.Relation - } - return nil -} - -func (x *NamespaceDefinition) GetMetadata() *Metadata { - if x != nil { - return x.Metadata - } - return nil -} - -type Relation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - UsersetRewrite *UsersetRewrite `protobuf:"bytes,2,opt,name=userset_rewrite,json=usersetRewrite,proto3" json:"userset_rewrite,omitempty"` - TypeInformation *TypeInformation `protobuf:"bytes,3,opt,name=type_information,json=typeInformation,proto3" json:"type_information,omitempty"` - Metadata *Metadata `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` -} - -func (x *Relation) Reset() { - *x = Relation{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Relation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Relation) ProtoMessage() {} - -func (x *Relation) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 Relation.ProtoReflect.Descriptor instead. -func (*Relation) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{2} -} - -func (x *Relation) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Relation) GetUsersetRewrite() *UsersetRewrite { - if x != nil { - return x.UsersetRewrite - } - return nil -} - -func (x *Relation) GetTypeInformation() *TypeInformation { - if x != nil { - return x.TypeInformation - } - return nil -} - -func (x *Relation) GetMetadata() *Metadata { - if x != nil { - return x.Metadata - } - return nil -} - -type TypeInformation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AllowedDirectRelations []*AllowedRelation `protobuf:"bytes,1,rep,name=allowed_direct_relations,json=allowedDirectRelations,proto3" json:"allowed_direct_relations,omitempty"` -} - -func (x *TypeInformation) Reset() { - *x = TypeInformation{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TypeInformation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TypeInformation) ProtoMessage() {} - -func (x *TypeInformation) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 TypeInformation.ProtoReflect.Descriptor instead. -func (*TypeInformation) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{3} -} - -func (x *TypeInformation) GetAllowedDirectRelations() []*AllowedRelation { - if x != nil { - return x.AllowedDirectRelations - } - return nil -} - -type AllowedRelation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` - // Types that are assignable to RelationOrWildcard: - // *AllowedRelation_Relation - // *AllowedRelation_PublicWildcard_ - RelationOrWildcard isAllowedRelation_RelationOrWildcard `protobuf_oneof:"relation_or_wildcard"` -} - -func (x *AllowedRelation) Reset() { - *x = AllowedRelation{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AllowedRelation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AllowedRelation) ProtoMessage() {} - -func (x *AllowedRelation) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 AllowedRelation.ProtoReflect.Descriptor instead. -func (*AllowedRelation) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{4} -} - -func (x *AllowedRelation) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (m *AllowedRelation) GetRelationOrWildcard() isAllowedRelation_RelationOrWildcard { - if m != nil { - return m.RelationOrWildcard - } - return nil -} - -func (x *AllowedRelation) GetRelation() string { - if x, ok := x.GetRelationOrWildcard().(*AllowedRelation_Relation); ok { - return x.Relation - } - return "" -} - -func (x *AllowedRelation) GetPublicWildcard() *AllowedRelation_PublicWildcard { - if x, ok := x.GetRelationOrWildcard().(*AllowedRelation_PublicWildcard_); ok { - return x.PublicWildcard - } - return nil -} - -type isAllowedRelation_RelationOrWildcard interface { - isAllowedRelation_RelationOrWildcard() -} - -type AllowedRelation_Relation struct { - Relation string `protobuf:"bytes,3,opt,name=relation,proto3,oneof"` -} - -type AllowedRelation_PublicWildcard_ struct { - PublicWildcard *AllowedRelation_PublicWildcard `protobuf:"bytes,4,opt,name=public_wildcard,json=publicWildcard,proto3,oneof"` -} - -func (*AllowedRelation_Relation) isAllowedRelation_RelationOrWildcard() {} - -func (*AllowedRelation_PublicWildcard_) isAllowedRelation_RelationOrWildcard() {} - -type UsersetRewrite struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to RewriteOperation: - // *UsersetRewrite_Union - // *UsersetRewrite_Intersection - // *UsersetRewrite_Exclusion - RewriteOperation isUsersetRewrite_RewriteOperation `protobuf_oneof:"rewrite_operation"` -} - -func (x *UsersetRewrite) Reset() { - *x = UsersetRewrite{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UsersetRewrite) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UsersetRewrite) ProtoMessage() {} - -func (x *UsersetRewrite) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 UsersetRewrite.ProtoReflect.Descriptor instead. -func (*UsersetRewrite) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{5} -} - -func (m *UsersetRewrite) GetRewriteOperation() isUsersetRewrite_RewriteOperation { - if m != nil { - return m.RewriteOperation - } - return nil -} - -func (x *UsersetRewrite) GetUnion() *SetOperation { - if x, ok := x.GetRewriteOperation().(*UsersetRewrite_Union); ok { - return x.Union - } - return nil -} - -func (x *UsersetRewrite) GetIntersection() *SetOperation { - if x, ok := x.GetRewriteOperation().(*UsersetRewrite_Intersection); ok { - return x.Intersection - } - return nil -} - -func (x *UsersetRewrite) GetExclusion() *SetOperation { - if x, ok := x.GetRewriteOperation().(*UsersetRewrite_Exclusion); ok { - return x.Exclusion - } - return nil -} - -type isUsersetRewrite_RewriteOperation interface { - isUsersetRewrite_RewriteOperation() -} - -type UsersetRewrite_Union struct { - Union *SetOperation `protobuf:"bytes,1,opt,name=union,proto3,oneof"` -} - -type UsersetRewrite_Intersection struct { - Intersection *SetOperation `protobuf:"bytes,2,opt,name=intersection,proto3,oneof"` -} - -type UsersetRewrite_Exclusion struct { - Exclusion *SetOperation `protobuf:"bytes,3,opt,name=exclusion,proto3,oneof"` -} - -func (*UsersetRewrite_Union) isUsersetRewrite_RewriteOperation() {} - -func (*UsersetRewrite_Intersection) isUsersetRewrite_RewriteOperation() {} - -func (*UsersetRewrite_Exclusion) isUsersetRewrite_RewriteOperation() {} - -type SetOperation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Child []*SetOperation_Child `protobuf:"bytes,1,rep,name=child,proto3" json:"child,omitempty"` -} - -func (x *SetOperation) Reset() { - *x = SetOperation{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetOperation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetOperation) ProtoMessage() {} - -func (x *SetOperation) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 SetOperation.ProtoReflect.Descriptor instead. -func (*SetOperation) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{6} -} - -func (x *SetOperation) GetChild() []*SetOperation_Child { - if x != nil { - return x.Child - } - return nil -} - -type TupleToUserset struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Tupleset *TupleToUserset_Tupleset `protobuf:"bytes,1,opt,name=tupleset,proto3" json:"tupleset,omitempty"` - ComputedUserset *ComputedUserset `protobuf:"bytes,2,opt,name=computed_userset,json=computedUserset,proto3" json:"computed_userset,omitempty"` -} - -func (x *TupleToUserset) Reset() { - *x = TupleToUserset{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TupleToUserset) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TupleToUserset) ProtoMessage() {} - -func (x *TupleToUserset) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 TupleToUserset.ProtoReflect.Descriptor instead. -func (*TupleToUserset) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{7} -} - -func (x *TupleToUserset) GetTupleset() *TupleToUserset_Tupleset { - if x != nil { - return x.Tupleset - } - return nil -} - -func (x *TupleToUserset) GetComputedUserset() *ComputedUserset { - if x != nil { - return x.ComputedUserset - } - return nil -} - -type ComputedUserset struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Object ComputedUserset_Object `protobuf:"varint,1,opt,name=object,proto3,enum=authzed.api.v0.ComputedUserset_Object" json:"object,omitempty"` - Relation string `protobuf:"bytes,2,opt,name=relation,proto3" json:"relation,omitempty"` -} - -func (x *ComputedUserset) Reset() { - *x = ComputedUserset{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ComputedUserset) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ComputedUserset) ProtoMessage() {} - -func (x *ComputedUserset) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 ComputedUserset.ProtoReflect.Descriptor instead. -func (*ComputedUserset) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{8} -} - -func (x *ComputedUserset) GetObject() ComputedUserset_Object { - if x != nil { - return x.Object - } - return ComputedUserset_TUPLE_OBJECT -} - -func (x *ComputedUserset) GetRelation() string { - if x != nil { - return x.Relation - } - return "" -} - -type AllowedRelation_PublicWildcard struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AllowedRelation_PublicWildcard) Reset() { - *x = AllowedRelation_PublicWildcard{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AllowedRelation_PublicWildcard) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AllowedRelation_PublicWildcard) ProtoMessage() {} - -func (x *AllowedRelation_PublicWildcard) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 AllowedRelation_PublicWildcard.ProtoReflect.Descriptor instead. -func (*AllowedRelation_PublicWildcard) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{4, 0} -} - -type SetOperation_Child struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to ChildType: - // *SetOperation_Child_XThis - // *SetOperation_Child_ComputedUserset - // *SetOperation_Child_TupleToUserset - // *SetOperation_Child_UsersetRewrite - ChildType isSetOperation_Child_ChildType `protobuf_oneof:"child_type"` -} - -func (x *SetOperation_Child) Reset() { - *x = SetOperation_Child{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetOperation_Child) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetOperation_Child) ProtoMessage() {} - -func (x *SetOperation_Child) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 SetOperation_Child.ProtoReflect.Descriptor instead. -func (*SetOperation_Child) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{6, 0} -} - -func (m *SetOperation_Child) GetChildType() isSetOperation_Child_ChildType { - if m != nil { - return m.ChildType - } - return nil -} - -func (x *SetOperation_Child) GetXThis() *SetOperation_Child_This { - if x, ok := x.GetChildType().(*SetOperation_Child_XThis); ok { - return x.XThis - } - return nil -} - -func (x *SetOperation_Child) GetComputedUserset() *ComputedUserset { - if x, ok := x.GetChildType().(*SetOperation_Child_ComputedUserset); ok { - return x.ComputedUserset - } - return nil -} - -func (x *SetOperation_Child) GetTupleToUserset() *TupleToUserset { - if x, ok := x.GetChildType().(*SetOperation_Child_TupleToUserset); ok { - return x.TupleToUserset - } - return nil -} - -func (x *SetOperation_Child) GetUsersetRewrite() *UsersetRewrite { - if x, ok := x.GetChildType().(*SetOperation_Child_UsersetRewrite); ok { - return x.UsersetRewrite - } - return nil -} - -type isSetOperation_Child_ChildType interface { - isSetOperation_Child_ChildType() -} - -type SetOperation_Child_XThis struct { - XThis *SetOperation_Child_This `protobuf:"bytes,1,opt,name=_this,json=This,proto3,oneof"` -} - -type SetOperation_Child_ComputedUserset struct { - ComputedUserset *ComputedUserset `protobuf:"bytes,2,opt,name=computed_userset,json=computedUserset,proto3,oneof"` -} - -type SetOperation_Child_TupleToUserset struct { - TupleToUserset *TupleToUserset `protobuf:"bytes,3,opt,name=tuple_to_userset,json=tupleToUserset,proto3,oneof"` -} - -type SetOperation_Child_UsersetRewrite struct { - UsersetRewrite *UsersetRewrite `protobuf:"bytes,4,opt,name=userset_rewrite,json=usersetRewrite,proto3,oneof"` -} - -func (*SetOperation_Child_XThis) isSetOperation_Child_ChildType() {} - -func (*SetOperation_Child_ComputedUserset) isSetOperation_Child_ChildType() {} - -func (*SetOperation_Child_TupleToUserset) isSetOperation_Child_ChildType() {} - -func (*SetOperation_Child_UsersetRewrite) isSetOperation_Child_ChildType() {} - -type SetOperation_Child_This struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SetOperation_Child_This) Reset() { - *x = SetOperation_Child_This{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SetOperation_Child_This) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetOperation_Child_This) ProtoMessage() {} - -func (x *SetOperation_Child_This) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 SetOperation_Child_This.ProtoReflect.Descriptor instead. -func (*SetOperation_Child_This) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{6, 0, 0} -} - -type TupleToUserset_Tupleset struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Relation string `protobuf:"bytes,1,opt,name=relation,proto3" json:"relation,omitempty"` -} - -func (x *TupleToUserset_Tupleset) Reset() { - *x = TupleToUserset_Tupleset{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TupleToUserset_Tupleset) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TupleToUserset_Tupleset) ProtoMessage() {} - -func (x *TupleToUserset_Tupleset) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_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 TupleToUserset_Tupleset.ProtoReflect.Descriptor instead. -func (*TupleToUserset_Tupleset) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_proto_rawDescGZIP(), []int{7, 0} -} - -func (x *TupleToUserset_Tupleset) GetRelation() string { - if x != nil { - return x.Relation - } - return "" -} - -var File_authzed_api_v0_namespace_proto protoreflect.FileDescriptor - -var file_authzed_api_v0_namespace_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, - 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xb8, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0xab, 0x01, 0x0a, - 0x10, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x6a, 0xfa, - 0x42, 0x67, 0x92, 0x01, 0x64, 0x08, 0x01, 0x22, 0x60, 0x8a, 0x01, 0x02, 0x10, 0x01, 0xa2, 0x01, - 0x58, 0x08, 0x01, 0x12, 0x26, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, 0x70, 0x6c, 0x2e, 0x76, 0x31, - 0x2e, 0x44, 0x6f, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2c, 0x74, 0x79, 0x70, - 0x65, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x69, 0x6d, 0x70, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0f, 0x6d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xdf, 0x01, 0x0a, 0x13, 0x4e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x5c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x48, 0xfa, 0x42, 0x45, 0x72, 0x43, 0x28, 0x80, 0x01, 0x32, 0x3e, 0x5e, 0x28, 0x5b, 0x61, - 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x31, 0x2c, 0x36, - 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x2f, 0x29, 0x3f, 0x5b, 0x61, 0x2d, - 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x32, - 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x72, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x92, 0x02, 0x0a, - 0x08, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xfa, 0x42, 0x24, 0x72, 0x22, 0x28, 0x40, - 0x32, 0x1e, 0x5e, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, - 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, - 0x74, 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x52, - 0x0e, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x12, - 0x4a, 0x0a, 0x10, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x68, - 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x74, 0x79, 0x70, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, - 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x6c, 0x0a, 0x0f, 0x54, 0x79, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x59, 0x0a, 0x18, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, - 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x16, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, - 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0xce, 0x02, 0x0a, 0x0f, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x66, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x48, 0xfa, 0x42, 0x45, 0x72, 0x43, 0x28, 0x80, 0x01, - 0x32, 0x3e, 0x5e, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, - 0x5f, 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x31, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, - 0x2f, 0x29, 0x3f, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, - 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, - 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x4e, 0x0a, 0x08, 0x72, - 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x30, 0xfa, - 0x42, 0x2d, 0x72, 0x2b, 0x28, 0x40, 0x32, 0x27, 0x5e, 0x28, 0x5c, 0x2e, 0x5c, 0x2e, 0x5c, 0x2e, - 0x7c, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, - 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x29, 0x24, 0x48, - 0x00, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x59, 0x0a, 0x0f, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x52, 0x65, 0x6c, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x57, 0x69, 0x6c, 0x64, - 0x63, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x57, 0x69, - 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x1a, 0x10, 0x0a, 0x0e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x57, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, 0x42, 0x16, 0x0a, 0x14, 0x72, 0x65, 0x6c, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x72, 0x5f, 0x77, 0x69, 0x6c, 0x64, 0x63, 0x61, 0x72, 0x64, - 0x22, 0x80, 0x02, 0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x52, 0x65, 0x77, 0x72, - 0x69, 0x74, 0x65, 0x12, 0x3e, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x05, 0x75, 0x6e, - 0x69, 0x6f, 0x6e, 0x12, 0x4c, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, - 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, - 0x01, 0x48, 0x00, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x46, 0x0a, 0x09, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x09, - 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x18, 0x0a, 0x11, 0x72, 0x65, 0x77, - 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x03, - 0xf8, 0x42, 0x01, 0x22, 0xc1, 0x03, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x05, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x42, 0x0f, 0xfa, 0x42, 0x0c, 0x92, 0x01, 0x09, 0x08, - 0x01, 0x22, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x1a, - 0xe5, 0x02, 0x0a, 0x05, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x12, 0x3e, 0x0a, 0x05, 0x5f, 0x74, 0x68, - 0x69, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x65, 0x74, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x2e, 0x54, 0x68, 0x69, - 0x73, 0x48, 0x00, 0x52, 0x04, 0x54, 0x68, 0x69, 0x73, 0x12, 0x56, 0x0a, 0x10, 0x63, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x65, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, - 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, - 0x74, 0x12, 0x54, 0x0a, 0x10, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x75, 0x73, - 0x65, 0x72, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x54, 0x75, 0x70, - 0x6c, 0x65, 0x54, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, - 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x54, 0x6f, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x12, 0x53, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x73, - 0x65, 0x74, 0x5f, 0x72, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x30, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, - 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x0e, 0x75, 0x73, - 0x65, 0x72, 0x73, 0x65, 0x74, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x1a, 0x06, 0x0a, 0x04, - 0x54, 0x68, 0x69, 0x73, 0x42, 0x11, 0x0a, 0x0a, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x86, 0x02, 0x0a, 0x0e, 0x54, 0x75, 0x70, 0x6c, - 0x65, 0x54, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x12, 0x4d, 0x0a, 0x08, 0x74, 0x75, - 0x70, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x54, 0x75, - 0x70, 0x6c, 0x65, 0x54, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x54, 0x75, 0x70, - 0x6c, 0x65, 0x73, 0x65, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, - 0x08, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x12, 0x54, 0x0a, 0x10, 0x63, 0x6f, 0x6d, - 0x70, 0x75, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x65, 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0f, - 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x65, 0x74, 0x1a, - 0x4f, 0x0a, 0x08, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x12, 0x43, 0x0a, 0x08, 0x72, - 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xfa, - 0x42, 0x24, 0x72, 0x22, 0x28, 0x40, 0x32, 0x1e, 0x5e, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, - 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, - 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0xd6, 0x01, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x65, 0x74, 0x12, 0x48, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x64, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x42, 0x08, 0xfa, 0x42, - 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x43, - 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x27, 0xfa, 0x42, 0x24, 0x72, 0x22, 0x28, 0x40, 0x32, 0x1e, 0x5e, 0x5b, 0x61, 0x2d, 0x7a, - 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, - 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x34, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x10, 0x0a, - 0x0c, 0x54, 0x55, 0x50, 0x4c, 0x45, 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x00, 0x12, - 0x18, 0x0a, 0x14, 0x54, 0x55, 0x50, 0x4c, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x53, 0x45, 0x54, - 0x5f, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x01, 0x42, 0x48, 0x0a, 0x12, 0x63, 0x6f, 0x6d, - 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x5a, - 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, - 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x30, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_authzed_api_v0_namespace_proto_rawDescOnce sync.Once - file_authzed_api_v0_namespace_proto_rawDescData = file_authzed_api_v0_namespace_proto_rawDesc -) - -func file_authzed_api_v0_namespace_proto_rawDescGZIP() []byte { - file_authzed_api_v0_namespace_proto_rawDescOnce.Do(func() { - file_authzed_api_v0_namespace_proto_rawDescData = protoimpl.X.CompressGZIP(file_authzed_api_v0_namespace_proto_rawDescData) - }) - return file_authzed_api_v0_namespace_proto_rawDescData -} - -var file_authzed_api_v0_namespace_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_authzed_api_v0_namespace_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_authzed_api_v0_namespace_proto_goTypes = []interface{}{ - (ComputedUserset_Object)(0), // 0: authzed.api.v0.ComputedUserset.Object - (*Metadata)(nil), // 1: authzed.api.v0.Metadata - (*NamespaceDefinition)(nil), // 2: authzed.api.v0.NamespaceDefinition - (*Relation)(nil), // 3: authzed.api.v0.Relation - (*TypeInformation)(nil), // 4: authzed.api.v0.TypeInformation - (*AllowedRelation)(nil), // 5: authzed.api.v0.AllowedRelation - (*UsersetRewrite)(nil), // 6: authzed.api.v0.UsersetRewrite - (*SetOperation)(nil), // 7: authzed.api.v0.SetOperation - (*TupleToUserset)(nil), // 8: authzed.api.v0.TupleToUserset - (*ComputedUserset)(nil), // 9: authzed.api.v0.ComputedUserset - (*AllowedRelation_PublicWildcard)(nil), // 10: authzed.api.v0.AllowedRelation.PublicWildcard - (*SetOperation_Child)(nil), // 11: authzed.api.v0.SetOperation.Child - (*SetOperation_Child_This)(nil), // 12: authzed.api.v0.SetOperation.Child.This - (*TupleToUserset_Tupleset)(nil), // 13: authzed.api.v0.TupleToUserset.Tupleset - (*anypb.Any)(nil), // 14: google.protobuf.Any -} -var file_authzed_api_v0_namespace_proto_depIdxs = []int32{ - 14, // 0: authzed.api.v0.Metadata.metadata_message:type_name -> google.protobuf.Any - 3, // 1: authzed.api.v0.NamespaceDefinition.relation:type_name -> authzed.api.v0.Relation - 1, // 2: authzed.api.v0.NamespaceDefinition.metadata:type_name -> authzed.api.v0.Metadata - 6, // 3: authzed.api.v0.Relation.userset_rewrite:type_name -> authzed.api.v0.UsersetRewrite - 4, // 4: authzed.api.v0.Relation.type_information:type_name -> authzed.api.v0.TypeInformation - 1, // 5: authzed.api.v0.Relation.metadata:type_name -> authzed.api.v0.Metadata - 5, // 6: authzed.api.v0.TypeInformation.allowed_direct_relations:type_name -> authzed.api.v0.AllowedRelation - 10, // 7: authzed.api.v0.AllowedRelation.public_wildcard:type_name -> authzed.api.v0.AllowedRelation.PublicWildcard - 7, // 8: authzed.api.v0.UsersetRewrite.union:type_name -> authzed.api.v0.SetOperation - 7, // 9: authzed.api.v0.UsersetRewrite.intersection:type_name -> authzed.api.v0.SetOperation - 7, // 10: authzed.api.v0.UsersetRewrite.exclusion:type_name -> authzed.api.v0.SetOperation - 11, // 11: authzed.api.v0.SetOperation.child:type_name -> authzed.api.v0.SetOperation.Child - 13, // 12: authzed.api.v0.TupleToUserset.tupleset:type_name -> authzed.api.v0.TupleToUserset.Tupleset - 9, // 13: authzed.api.v0.TupleToUserset.computed_userset:type_name -> authzed.api.v0.ComputedUserset - 0, // 14: authzed.api.v0.ComputedUserset.object:type_name -> authzed.api.v0.ComputedUserset.Object - 12, // 15: authzed.api.v0.SetOperation.Child._this:type_name -> authzed.api.v0.SetOperation.Child.This - 9, // 16: authzed.api.v0.SetOperation.Child.computed_userset:type_name -> authzed.api.v0.ComputedUserset - 8, // 17: authzed.api.v0.SetOperation.Child.tuple_to_userset:type_name -> authzed.api.v0.TupleToUserset - 6, // 18: authzed.api.v0.SetOperation.Child.userset_rewrite:type_name -> authzed.api.v0.UsersetRewrite - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name -} - -func init() { file_authzed_api_v0_namespace_proto_init() } -func file_authzed_api_v0_namespace_proto_init() { - if File_authzed_api_v0_namespace_proto != nil { - return - } - file_authzed_api_v0_core_proto_init() - if !protoimpl.UnsafeEnabled { - file_authzed_api_v0_namespace_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Metadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NamespaceDefinition); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Relation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TypeInformation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllowedRelation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UsersetRewrite); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetOperation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TupleToUserset); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ComputedUserset); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllowedRelation_PublicWildcard); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetOperation_Child); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetOperation_Child_This); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TupleToUserset_Tupleset); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_authzed_api_v0_namespace_proto_msgTypes[4].OneofWrappers = []interface{}{ - (*AllowedRelation_Relation)(nil), - (*AllowedRelation_PublicWildcard_)(nil), - } - file_authzed_api_v0_namespace_proto_msgTypes[5].OneofWrappers = []interface{}{ - (*UsersetRewrite_Union)(nil), - (*UsersetRewrite_Intersection)(nil), - (*UsersetRewrite_Exclusion)(nil), - } - file_authzed_api_v0_namespace_proto_msgTypes[10].OneofWrappers = []interface{}{ - (*SetOperation_Child_XThis)(nil), - (*SetOperation_Child_ComputedUserset)(nil), - (*SetOperation_Child_TupleToUserset)(nil), - (*SetOperation_Child_UsersetRewrite)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_authzed_api_v0_namespace_proto_rawDesc, - NumEnums: 1, - NumMessages: 13, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_authzed_api_v0_namespace_proto_goTypes, - DependencyIndexes: file_authzed_api_v0_namespace_proto_depIdxs, - EnumInfos: file_authzed_api_v0_namespace_proto_enumTypes, - MessageInfos: file_authzed_api_v0_namespace_proto_msgTypes, - }.Build() - File_authzed_api_v0_namespace_proto = out.File - file_authzed_api_v0_namespace_proto_rawDesc = nil - file_authzed_api_v0_namespace_proto_goTypes = nil - file_authzed_api_v0_namespace_proto_depIdxs = nil -} diff --git a/proto/authzed/api/v0/namespace.pb.validate.go b/proto/authzed/api/v0/namespace.pb.validate.go deleted file mode 100644 index ba763ac..0000000 --- a/proto/authzed/api/v0/namespace.pb.validate.go +++ /dev/null @@ -1,1318 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: authzed/api/v0/namespace.proto - -package v0 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} -) - -// Validate checks the field values on Metadata with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. -func (m *Metadata) Validate() error { - if m == nil { - return nil - } - - if len(m.GetMetadataMessage()) < 1 { - return MetadataValidationError{ - field: "MetadataMessage", - reason: "value must contain at least 1 item(s)", - } - } - - for idx, item := range m.GetMetadataMessage() { - _, _ = idx, item - - if item == nil { - return MetadataValidationError{ - field: fmt.Sprintf("MetadataMessage[%v]", idx), - reason: "value is required", - } - } - - if a := item; a != nil { - - if _, ok := _Metadata_MetadataMessage_InLookup[a.GetTypeUrl()]; !ok { - return MetadataValidationError{ - field: fmt.Sprintf("MetadataMessage[%v]", idx), - reason: "type URL must be in list [type.googleapis.com/impl.v1.DocComment type.googleapis.com/impl.v1.RelationMetadata]", - } - } - - } - - } - - return nil -} - -// MetadataValidationError is the validation error returned by -// Metadata.Validate if the designated constraints aren't met. -type MetadataValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataValidationError) ErrorName() string { return "MetadataValidationError" } - -// Error satisfies the builtin error interface -func (e MetadataValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadata.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataValidationError{} - -// Validate checks the field values on NamespaceDefinition with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *NamespaceDefinition) Validate() error { - if m == nil { - return nil - } - - if len(m.GetName()) > 128 { - return NamespaceDefinitionValidationError{ - field: "Name", - reason: "value length must be at most 128 bytes", - } - } - - if !_NamespaceDefinition_Name_Pattern.MatchString(m.GetName()) { - return NamespaceDefinitionValidationError{ - field: "Name", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", - } - } - - for idx, item := range m.GetRelation() { - _, _ = idx, item - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NamespaceDefinitionValidationError{ - field: fmt.Sprintf("Relation[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NamespaceDefinitionValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// NamespaceDefinitionValidationError is the validation error returned by -// NamespaceDefinition.Validate if the designated constraints aren't met. -type NamespaceDefinitionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e NamespaceDefinitionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e NamespaceDefinitionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e NamespaceDefinitionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e NamespaceDefinitionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e NamespaceDefinitionValidationError) ErrorName() string { - return "NamespaceDefinitionValidationError" -} - -// Error satisfies the builtin error interface -func (e NamespaceDefinitionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sNamespaceDefinition.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = NamespaceDefinitionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = NamespaceDefinitionValidationError{} - -var _NamespaceDefinition_Name_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$") - -// Validate checks the field values on Relation with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. -func (m *Relation) Validate() error { - if m == nil { - return nil - } - - if len(m.GetName()) > 64 { - return RelationValidationError{ - field: "Name", - reason: "value length must be at most 64 bytes", - } - } - - if !_Relation_Name_Pattern.MatchString(m.GetName()) { - return RelationValidationError{ - field: "Name", - reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", - } - } - - if v, ok := interface{}(m.GetUsersetRewrite()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RelationValidationError{ - field: "UsersetRewrite", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if v, ok := interface{}(m.GetTypeInformation()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RelationValidationError{ - field: "TypeInformation", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RelationValidationError{ - field: "Metadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// RelationValidationError is the validation error returned by -// Relation.Validate if the designated constraints aren't met. -type RelationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RelationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RelationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RelationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RelationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RelationValidationError) ErrorName() string { return "RelationValidationError" } - -// Error satisfies the builtin error interface -func (e RelationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRelation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RelationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RelationValidationError{} - -var _Relation_Name_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{1,62}[a-z0-9]$") - -// Validate checks the field values on TypeInformation with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. -func (m *TypeInformation) Validate() error { - if m == nil { - return nil - } - - for idx, item := range m.GetAllowedDirectRelations() { - _, _ = idx, item - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TypeInformationValidationError{ - field: fmt.Sprintf("AllowedDirectRelations[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - return nil -} - -// TypeInformationValidationError is the validation error returned by -// TypeInformation.Validate if the designated constraints aren't met. -type TypeInformationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TypeInformationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TypeInformationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TypeInformationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TypeInformationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TypeInformationValidationError) ErrorName() string { return "TypeInformationValidationError" } - -// Error satisfies the builtin error interface -func (e TypeInformationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTypeInformation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TypeInformationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TypeInformationValidationError{} - -// Validate checks the field values on AllowedRelation with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. -func (m *AllowedRelation) Validate() error { - if m == nil { - return nil - } - - if len(m.GetNamespace()) > 128 { - return AllowedRelationValidationError{ - field: "Namespace", - reason: "value length must be at most 128 bytes", - } - } - - if !_AllowedRelation_Namespace_Pattern.MatchString(m.GetNamespace()) { - return AllowedRelationValidationError{ - field: "Namespace", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", - } - } - - switch m.RelationOrWildcard.(type) { - - case *AllowedRelation_Relation: - - if len(m.GetRelation()) > 64 { - return AllowedRelationValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_AllowedRelation_Relation_Pattern.MatchString(m.GetRelation()) { - return AllowedRelationValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^(\\\\.\\\\.\\\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$\"", - } - } - - case *AllowedRelation_PublicWildcard_: - - if v, ok := interface{}(m.GetPublicWildcard()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AllowedRelationValidationError{ - field: "PublicWildcard", - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - return nil -} - -// AllowedRelationValidationError is the validation error returned by -// AllowedRelation.Validate if the designated constraints aren't met. -type AllowedRelationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AllowedRelationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AllowedRelationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AllowedRelationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AllowedRelationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AllowedRelationValidationError) ErrorName() string { return "AllowedRelationValidationError" } - -// Error satisfies the builtin error interface -func (e AllowedRelationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAllowedRelation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AllowedRelationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AllowedRelationValidationError{} - -var _AllowedRelation_Namespace_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$") - -var _AllowedRelation_Relation_Pattern = regexp.MustCompile("^(\\.\\.\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$") - -// Validate checks the field values on UsersetRewrite with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *UsersetRewrite) Validate() error { - if m == nil { - return nil - } - - switch m.RewriteOperation.(type) { - - case *UsersetRewrite_Union: - - if m.GetUnion() == nil { - return UsersetRewriteValidationError{ - field: "Union", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetUnion()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UsersetRewriteValidationError{ - field: "Union", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *UsersetRewrite_Intersection: - - if m.GetIntersection() == nil { - return UsersetRewriteValidationError{ - field: "Intersection", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetIntersection()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UsersetRewriteValidationError{ - field: "Intersection", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *UsersetRewrite_Exclusion: - - if m.GetExclusion() == nil { - return UsersetRewriteValidationError{ - field: "Exclusion", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetExclusion()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UsersetRewriteValidationError{ - field: "Exclusion", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - return UsersetRewriteValidationError{ - field: "RewriteOperation", - reason: "value is required", - } - - } - - return nil -} - -// UsersetRewriteValidationError is the validation error returned by -// UsersetRewrite.Validate if the designated constraints aren't met. -type UsersetRewriteValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UsersetRewriteValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UsersetRewriteValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UsersetRewriteValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UsersetRewriteValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UsersetRewriteValidationError) ErrorName() string { return "UsersetRewriteValidationError" } - -// Error satisfies the builtin error interface -func (e UsersetRewriteValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUsersetRewrite.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UsersetRewriteValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UsersetRewriteValidationError{} - -// Validate checks the field values on SetOperation with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *SetOperation) Validate() error { - if m == nil { - return nil - } - - if len(m.GetChild()) < 1 { - return SetOperationValidationError{ - field: "Child", - reason: "value must contain at least 1 item(s)", - } - } - - for idx, item := range m.GetChild() { - _, _ = idx, item - - if item == nil { - return SetOperationValidationError{ - field: fmt.Sprintf("Child[%v]", idx), - reason: "value is required", - } - } - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SetOperationValidationError{ - field: fmt.Sprintf("Child[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - return nil -} - -// SetOperationValidationError is the validation error returned by -// SetOperation.Validate if the designated constraints aren't met. -type SetOperationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetOperationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetOperationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetOperationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetOperationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetOperationValidationError) ErrorName() string { return "SetOperationValidationError" } - -// Error satisfies the builtin error interface -func (e SetOperationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetOperation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetOperationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetOperationValidationError{} - -// Validate checks the field values on TupleToUserset with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *TupleToUserset) Validate() error { - if m == nil { - return nil - } - - if m.GetTupleset() == nil { - return TupleToUsersetValidationError{ - field: "Tupleset", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetTupleset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TupleToUsersetValidationError{ - field: "Tupleset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if m.GetComputedUserset() == nil { - return TupleToUsersetValidationError{ - field: "ComputedUserset", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetComputedUserset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TupleToUsersetValidationError{ - field: "ComputedUserset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// TupleToUsersetValidationError is the validation error returned by -// TupleToUserset.Validate if the designated constraints aren't met. -type TupleToUsersetValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TupleToUsersetValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TupleToUsersetValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TupleToUsersetValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TupleToUsersetValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TupleToUsersetValidationError) ErrorName() string { return "TupleToUsersetValidationError" } - -// Error satisfies the builtin error interface -func (e TupleToUsersetValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTupleToUserset.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TupleToUsersetValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TupleToUsersetValidationError{} - -// Validate checks the field values on ComputedUserset with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. -func (m *ComputedUserset) Validate() error { - if m == nil { - return nil - } - - if _, ok := ComputedUserset_Object_name[int32(m.GetObject())]; !ok { - return ComputedUsersetValidationError{ - field: "Object", - reason: "value must be one of the defined enum values", - } - } - - if len(m.GetRelation()) > 64 { - return ComputedUsersetValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_ComputedUserset_Relation_Pattern.MatchString(m.GetRelation()) { - return ComputedUsersetValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", - } - } - - return nil -} - -// ComputedUsersetValidationError is the validation error returned by -// ComputedUserset.Validate if the designated constraints aren't met. -type ComputedUsersetValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ComputedUsersetValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ComputedUsersetValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ComputedUsersetValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ComputedUsersetValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ComputedUsersetValidationError) ErrorName() string { return "ComputedUsersetValidationError" } - -// Error satisfies the builtin error interface -func (e ComputedUsersetValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sComputedUserset.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ComputedUsersetValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ComputedUsersetValidationError{} - -var _ComputedUserset_Relation_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{1,62}[a-z0-9]$") - -// Validate checks the field values on AllowedRelation_PublicWildcard with the -// rules defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *AllowedRelation_PublicWildcard) Validate() error { - if m == nil { - return nil - } - - return nil -} - -// AllowedRelation_PublicWildcardValidationError is the validation error -// returned by AllowedRelation_PublicWildcard.Validate if the designated -// constraints aren't met. -type AllowedRelation_PublicWildcardValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AllowedRelation_PublicWildcardValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AllowedRelation_PublicWildcardValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AllowedRelation_PublicWildcardValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AllowedRelation_PublicWildcardValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AllowedRelation_PublicWildcardValidationError) ErrorName() string { - return "AllowedRelation_PublicWildcardValidationError" -} - -// Error satisfies the builtin error interface -func (e AllowedRelation_PublicWildcardValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAllowedRelation_PublicWildcard.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AllowedRelation_PublicWildcardValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AllowedRelation_PublicWildcardValidationError{} - -// Validate checks the field values on SetOperation_Child with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *SetOperation_Child) Validate() error { - if m == nil { - return nil - } - - switch m.ChildType.(type) { - - case *SetOperation_Child_XThis: - - if v, ok := interface{}(m.GetXThis()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SetOperation_ChildValidationError{ - field: "XThis", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *SetOperation_Child_ComputedUserset: - - if m.GetComputedUserset() == nil { - return SetOperation_ChildValidationError{ - field: "ComputedUserset", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetComputedUserset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SetOperation_ChildValidationError{ - field: "ComputedUserset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *SetOperation_Child_TupleToUserset: - - if m.GetTupleToUserset() == nil { - return SetOperation_ChildValidationError{ - field: "TupleToUserset", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetTupleToUserset()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SetOperation_ChildValidationError{ - field: "TupleToUserset", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *SetOperation_Child_UsersetRewrite: - - if m.GetUsersetRewrite() == nil { - return SetOperation_ChildValidationError{ - field: "UsersetRewrite", - reason: "value is required", - } - } - - if v, ok := interface{}(m.GetUsersetRewrite()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SetOperation_ChildValidationError{ - field: "UsersetRewrite", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - return SetOperation_ChildValidationError{ - field: "ChildType", - reason: "value is required", - } - - } - - return nil -} - -// SetOperation_ChildValidationError is the validation error returned by -// SetOperation_Child.Validate if the designated constraints aren't met. -type SetOperation_ChildValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetOperation_ChildValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetOperation_ChildValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetOperation_ChildValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetOperation_ChildValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetOperation_ChildValidationError) ErrorName() string { - return "SetOperation_ChildValidationError" -} - -// Error satisfies the builtin error interface -func (e SetOperation_ChildValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetOperation_Child.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetOperation_ChildValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetOperation_ChildValidationError{} - -// Validate checks the field values on SetOperation_Child_This with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *SetOperation_Child_This) Validate() error { - if m == nil { - return nil - } - - return nil -} - -// SetOperation_Child_ThisValidationError is the validation error returned by -// SetOperation_Child_This.Validate if the designated constraints aren't met. -type SetOperation_Child_ThisValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SetOperation_Child_ThisValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SetOperation_Child_ThisValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SetOperation_Child_ThisValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SetOperation_Child_ThisValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SetOperation_Child_ThisValidationError) ErrorName() string { - return "SetOperation_Child_ThisValidationError" -} - -// Error satisfies the builtin error interface -func (e SetOperation_Child_ThisValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSetOperation_Child_This.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SetOperation_Child_ThisValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SetOperation_Child_ThisValidationError{} - -// Validate checks the field values on TupleToUserset_Tupleset with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *TupleToUserset_Tupleset) Validate() error { - if m == nil { - return nil - } - - if len(m.GetRelation()) > 64 { - return TupleToUserset_TuplesetValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_TupleToUserset_Tupleset_Relation_Pattern.MatchString(m.GetRelation()) { - return TupleToUserset_TuplesetValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", - } - } - - return nil -} - -// TupleToUserset_TuplesetValidationError is the validation error returned by -// TupleToUserset_Tupleset.Validate if the designated constraints aren't met. -type TupleToUserset_TuplesetValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TupleToUserset_TuplesetValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TupleToUserset_TuplesetValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TupleToUserset_TuplesetValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TupleToUserset_TuplesetValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TupleToUserset_TuplesetValidationError) ErrorName() string { - return "TupleToUserset_TuplesetValidationError" -} - -// Error satisfies the builtin error interface -func (e TupleToUserset_TuplesetValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTupleToUserset_Tupleset.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TupleToUserset_TuplesetValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TupleToUserset_TuplesetValidationError{} - -var _TupleToUserset_Tupleset_Relation_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{1,62}[a-z0-9]$") diff --git a/proto/authzed/api/v0/namespace_service.pb.go b/proto/authzed/api/v0/namespace_service.pb.go deleted file mode 100644 index ba6c9fa..0000000 --- a/proto/authzed/api/v0/namespace_service.pb.go +++ /dev/null @@ -1,565 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc (unknown) -// authzed/api/v0/namespace_service.proto is a deprecated file. - -package v0 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - 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) -) - -// Deprecated: Do not use. -type ReadConfigRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` - AtRevision *Zookie `protobuf:"bytes,2,opt,name=at_revision,json=atRevision,proto3" json:"at_revision,omitempty"` -} - -func (x *ReadConfigRequest) Reset() { - *x = ReadConfigRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReadConfigRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadConfigRequest) ProtoMessage() {} - -func (x *ReadConfigRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_service_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 ReadConfigRequest.ProtoReflect.Descriptor instead. -func (*ReadConfigRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_service_proto_rawDescGZIP(), []int{0} -} - -func (x *ReadConfigRequest) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *ReadConfigRequest) GetAtRevision() *Zookie { - if x != nil { - return x.AtRevision - } - return nil -} - -// Deprecated: Do not use. -type ReadConfigResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` - Config *NamespaceDefinition `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` - Revision *Zookie `protobuf:"bytes,4,opt,name=revision,proto3" json:"revision,omitempty"` -} - -func (x *ReadConfigResponse) Reset() { - *x = ReadConfigResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReadConfigResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadConfigResponse) ProtoMessage() {} - -func (x *ReadConfigResponse) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_service_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 ReadConfigResponse.ProtoReflect.Descriptor instead. -func (*ReadConfigResponse) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_service_proto_rawDescGZIP(), []int{1} -} - -func (x *ReadConfigResponse) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *ReadConfigResponse) GetConfig() *NamespaceDefinition { - if x != nil { - return x.Config - } - return nil -} - -func (x *ReadConfigResponse) GetRevision() *Zookie { - if x != nil { - return x.Revision - } - return nil -} - -// Deprecated: Do not use. -type WriteConfigRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Configs []*NamespaceDefinition `protobuf:"bytes,2,rep,name=configs,proto3" json:"configs,omitempty"` -} - -func (x *WriteConfigRequest) Reset() { - *x = WriteConfigRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WriteConfigRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteConfigRequest) ProtoMessage() {} - -func (x *WriteConfigRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_service_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 WriteConfigRequest.ProtoReflect.Descriptor instead. -func (*WriteConfigRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_service_proto_rawDescGZIP(), []int{2} -} - -func (x *WriteConfigRequest) GetConfigs() []*NamespaceDefinition { - if x != nil { - return x.Configs - } - return nil -} - -// Deprecated: Do not use. -type WriteConfigResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Revision *Zookie `protobuf:"bytes,1,opt,name=revision,proto3" json:"revision,omitempty"` -} - -func (x *WriteConfigResponse) Reset() { - *x = WriteConfigResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WriteConfigResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteConfigResponse) ProtoMessage() {} - -func (x *WriteConfigResponse) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_service_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 WriteConfigResponse.ProtoReflect.Descriptor instead. -func (*WriteConfigResponse) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_service_proto_rawDescGZIP(), []int{3} -} - -func (x *WriteConfigResponse) GetRevision() *Zookie { - if x != nil { - return x.Revision - } - return nil -} - -// Deprecated: Do not use. -type DeleteConfigsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Namespaces []string `protobuf:"bytes,1,rep,name=namespaces,proto3" json:"namespaces,omitempty"` -} - -func (x *DeleteConfigsRequest) Reset() { - *x = DeleteConfigsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteConfigsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteConfigsRequest) ProtoMessage() {} - -func (x *DeleteConfigsRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_service_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 DeleteConfigsRequest.ProtoReflect.Descriptor instead. -func (*DeleteConfigsRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_service_proto_rawDescGZIP(), []int{4} -} - -func (x *DeleteConfigsRequest) GetNamespaces() []string { - if x != nil { - return x.Namespaces - } - return nil -} - -// Deprecated: Do not use. -type DeleteConfigsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Revision *Zookie `protobuf:"bytes,1,opt,name=revision,proto3" json:"revision,omitempty"` -} - -func (x *DeleteConfigsResponse) Reset() { - *x = DeleteConfigsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_namespace_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteConfigsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteConfigsResponse) ProtoMessage() {} - -func (x *DeleteConfigsResponse) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_namespace_service_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 DeleteConfigsResponse.ProtoReflect.Descriptor instead. -func (*DeleteConfigsResponse) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_namespace_service_proto_rawDescGZIP(), []int{5} -} - -func (x *DeleteConfigsResponse) GetRevision() *Zookie { - if x != nil { - return x.Revision - } - return nil -} - -var File_authzed_api_v0_namespace_service_proto protoreflect.FileDescriptor - -var file_authzed_api_v0_namespace_service_proto_rawDesc = []byte{ - 0x0a, 0x26, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, - 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, - 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x19, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x30, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb8, 0x01, 0x0a, - 0x11, 0x52, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x66, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x48, 0xfa, 0x42, 0x45, 0x72, 0x43, 0x28, 0x80, 0x01, 0x32, - 0x3e, 0x5e, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, - 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x2f, - 0x29, 0x3f, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, - 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0x52, - 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x0b, 0x61, 0x74, - 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x52, 0x65, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, 0x01, 0x22, 0xa7, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x61, 0x64, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x06, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, - 0x6b, 0x69, 0x65, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, - 0x01, 0x22, 0x68, 0x0a, 0x12, 0x57, 0x72, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0f, 0xfa, - 0x42, 0x0c, 0x92, 0x01, 0x09, 0x08, 0x01, 0x22, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x4d, 0x0a, 0x13, 0x57, - 0x72, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x08, 0x72, 0x65, - 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x8b, 0x01, 0x0a, 0x14, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x6f, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x4f, 0xfa, 0x42, 0x4c, 0x92, 0x01, 0x49, 0x08, - 0x01, 0x22, 0x45, 0x72, 0x43, 0x28, 0x80, 0x01, 0x32, 0x3e, 0x5e, 0x28, 0x5b, 0x61, 0x2d, 0x7a, - 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, - 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x2f, 0x29, 0x3f, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, - 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, - 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x73, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x4f, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x08, 0x72, 0x65, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, 0x01, 0x32, 0xb1, 0x02, 0x0a, 0x10, 0x4e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, - 0x0a, 0x0a, 0x52, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x21, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, - 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, - 0x2e, 0x52, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, 0x5b, 0x0a, 0x0b, 0x57, 0x72, 0x69, 0x74, - 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, - 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x57, 0x72, 0x69, - 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x03, 0x88, 0x02, 0x01, 0x12, 0x61, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x24, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x1a, 0x03, 0x88, 0x02, 0x01, 0x42, 0x4b, 0x0a, - 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2d, - 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0xb8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_authzed_api_v0_namespace_service_proto_rawDescOnce sync.Once - file_authzed_api_v0_namespace_service_proto_rawDescData = file_authzed_api_v0_namespace_service_proto_rawDesc -) - -func file_authzed_api_v0_namespace_service_proto_rawDescGZIP() []byte { - file_authzed_api_v0_namespace_service_proto_rawDescOnce.Do(func() { - file_authzed_api_v0_namespace_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authzed_api_v0_namespace_service_proto_rawDescData) - }) - return file_authzed_api_v0_namespace_service_proto_rawDescData -} - -var file_authzed_api_v0_namespace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_authzed_api_v0_namespace_service_proto_goTypes = []interface{}{ - (*ReadConfigRequest)(nil), // 0: authzed.api.v0.ReadConfigRequest - (*ReadConfigResponse)(nil), // 1: authzed.api.v0.ReadConfigResponse - (*WriteConfigRequest)(nil), // 2: authzed.api.v0.WriteConfigRequest - (*WriteConfigResponse)(nil), // 3: authzed.api.v0.WriteConfigResponse - (*DeleteConfigsRequest)(nil), // 4: authzed.api.v0.DeleteConfigsRequest - (*DeleteConfigsResponse)(nil), // 5: authzed.api.v0.DeleteConfigsResponse - (*Zookie)(nil), // 6: authzed.api.v0.Zookie - (*NamespaceDefinition)(nil), // 7: authzed.api.v0.NamespaceDefinition -} -var file_authzed_api_v0_namespace_service_proto_depIdxs = []int32{ - 6, // 0: authzed.api.v0.ReadConfigRequest.at_revision:type_name -> authzed.api.v0.Zookie - 7, // 1: authzed.api.v0.ReadConfigResponse.config:type_name -> authzed.api.v0.NamespaceDefinition - 6, // 2: authzed.api.v0.ReadConfigResponse.revision:type_name -> authzed.api.v0.Zookie - 7, // 3: authzed.api.v0.WriteConfigRequest.configs:type_name -> authzed.api.v0.NamespaceDefinition - 6, // 4: authzed.api.v0.WriteConfigResponse.revision:type_name -> authzed.api.v0.Zookie - 6, // 5: authzed.api.v0.DeleteConfigsResponse.revision:type_name -> authzed.api.v0.Zookie - 0, // 6: authzed.api.v0.NamespaceService.ReadConfig:input_type -> authzed.api.v0.ReadConfigRequest - 2, // 7: authzed.api.v0.NamespaceService.WriteConfig:input_type -> authzed.api.v0.WriteConfigRequest - 4, // 8: authzed.api.v0.NamespaceService.DeleteConfigs:input_type -> authzed.api.v0.DeleteConfigsRequest - 1, // 9: authzed.api.v0.NamespaceService.ReadConfig:output_type -> authzed.api.v0.ReadConfigResponse - 3, // 10: authzed.api.v0.NamespaceService.WriteConfig:output_type -> authzed.api.v0.WriteConfigResponse - 5, // 11: authzed.api.v0.NamespaceService.DeleteConfigs:output_type -> authzed.api.v0.DeleteConfigsResponse - 9, // [9:12] is the sub-list for method output_type - 6, // [6:9] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_authzed_api_v0_namespace_service_proto_init() } -func file_authzed_api_v0_namespace_service_proto_init() { - if File_authzed_api_v0_namespace_service_proto != nil { - return - } - file_authzed_api_v0_core_proto_init() - file_authzed_api_v0_namespace_proto_init() - if !protoimpl.UnsafeEnabled { - file_authzed_api_v0_namespace_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadConfigRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadConfigResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WriteConfigRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WriteConfigResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteConfigsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_namespace_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteConfigsResponse); 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_authzed_api_v0_namespace_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_authzed_api_v0_namespace_service_proto_goTypes, - DependencyIndexes: file_authzed_api_v0_namespace_service_proto_depIdxs, - MessageInfos: file_authzed_api_v0_namespace_service_proto_msgTypes, - }.Build() - File_authzed_api_v0_namespace_service_proto = out.File - file_authzed_api_v0_namespace_service_proto_rawDesc = nil - file_authzed_api_v0_namespace_service_proto_goTypes = nil - file_authzed_api_v0_namespace_service_proto_depIdxs = nil -} diff --git a/proto/authzed/api/v0/namespace_service.pb.validate.go b/proto/authzed/api/v0/namespace_service.pb.validate.go deleted file mode 100644 index c35d9bb..0000000 --- a/proto/authzed/api/v0/namespace_service.pb.validate.go +++ /dev/null @@ -1,561 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: authzed/api/v0/namespace_service.proto - -package v0 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} -) - -// Validate checks the field values on ReadConfigRequest with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. -func (m *ReadConfigRequest) Validate() error { - if m == nil { - return nil - } - - if len(m.GetNamespace()) > 128 { - return ReadConfigRequestValidationError{ - field: "Namespace", - reason: "value length must be at most 128 bytes", - } - } - - if !_ReadConfigRequest_Namespace_Pattern.MatchString(m.GetNamespace()) { - return ReadConfigRequestValidationError{ - field: "Namespace", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", - } - } - - if v, ok := interface{}(m.GetAtRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ReadConfigRequestValidationError{ - field: "AtRevision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// ReadConfigRequestValidationError is the validation error returned by -// ReadConfigRequest.Validate if the designated constraints aren't met. -type ReadConfigRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ReadConfigRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ReadConfigRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ReadConfigRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ReadConfigRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ReadConfigRequestValidationError) ErrorName() string { - return "ReadConfigRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ReadConfigRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sReadConfigRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ReadConfigRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ReadConfigRequestValidationError{} - -var _ReadConfigRequest_Namespace_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$") - -// Validate checks the field values on ReadConfigResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *ReadConfigResponse) Validate() error { - if m == nil { - return nil - } - - // no validation rules for Namespace - - if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ReadConfigResponseValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if v, ok := interface{}(m.GetRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ReadConfigResponseValidationError{ - field: "Revision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// ReadConfigResponseValidationError is the validation error returned by -// ReadConfigResponse.Validate if the designated constraints aren't met. -type ReadConfigResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ReadConfigResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ReadConfigResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ReadConfigResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ReadConfigResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ReadConfigResponseValidationError) ErrorName() string { - return "ReadConfigResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ReadConfigResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sReadConfigResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ReadConfigResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ReadConfigResponseValidationError{} - -// Validate checks the field values on WriteConfigRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *WriteConfigRequest) Validate() error { - if m == nil { - return nil - } - - if len(m.GetConfigs()) < 1 { - return WriteConfigRequestValidationError{ - field: "Configs", - reason: "value must contain at least 1 item(s)", - } - } - - for idx, item := range m.GetConfigs() { - _, _ = idx, item - - if item == nil { - return WriteConfigRequestValidationError{ - field: fmt.Sprintf("Configs[%v]", idx), - reason: "value is required", - } - } - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WriteConfigRequestValidationError{ - field: fmt.Sprintf("Configs[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - return nil -} - -// WriteConfigRequestValidationError is the validation error returned by -// WriteConfigRequest.Validate if the designated constraints aren't met. -type WriteConfigRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WriteConfigRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WriteConfigRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WriteConfigRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WriteConfigRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WriteConfigRequestValidationError) ErrorName() string { - return "WriteConfigRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e WriteConfigRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWriteConfigRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WriteConfigRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WriteConfigRequestValidationError{} - -// Validate checks the field values on WriteConfigResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *WriteConfigResponse) Validate() error { - if m == nil { - return nil - } - - if v, ok := interface{}(m.GetRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WriteConfigResponseValidationError{ - field: "Revision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// WriteConfigResponseValidationError is the validation error returned by -// WriteConfigResponse.Validate if the designated constraints aren't met. -type WriteConfigResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WriteConfigResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WriteConfigResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WriteConfigResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WriteConfigResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WriteConfigResponseValidationError) ErrorName() string { - return "WriteConfigResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e WriteConfigResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWriteConfigResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WriteConfigResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WriteConfigResponseValidationError{} - -// Validate checks the field values on DeleteConfigsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *DeleteConfigsRequest) Validate() error { - if m == nil { - return nil - } - - if len(m.GetNamespaces()) < 1 { - return DeleteConfigsRequestValidationError{ - field: "Namespaces", - reason: "value must contain at least 1 item(s)", - } - } - - for idx, item := range m.GetNamespaces() { - _, _ = idx, item - - if len(item) > 128 { - return DeleteConfigsRequestValidationError{ - field: fmt.Sprintf("Namespaces[%v]", idx), - reason: "value length must be at most 128 bytes", - } - } - - if !_DeleteConfigsRequest_Namespaces_Pattern.MatchString(item) { - return DeleteConfigsRequestValidationError{ - field: fmt.Sprintf("Namespaces[%v]", idx), - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", - } - } - - } - - return nil -} - -// DeleteConfigsRequestValidationError is the validation error returned by -// DeleteConfigsRequest.Validate if the designated constraints aren't met. -type DeleteConfigsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteConfigsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteConfigsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteConfigsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteConfigsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteConfigsRequestValidationError) ErrorName() string { - return "DeleteConfigsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteConfigsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteConfigsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteConfigsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteConfigsRequestValidationError{} - -var _DeleteConfigsRequest_Namespaces_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$") - -// Validate checks the field values on DeleteConfigsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, an error is returned. -func (m *DeleteConfigsResponse) Validate() error { - if m == nil { - return nil - } - - if v, ok := interface{}(m.GetRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeleteConfigsResponseValidationError{ - field: "Revision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// DeleteConfigsResponseValidationError is the validation error returned by -// DeleteConfigsResponse.Validate if the designated constraints aren't met. -type DeleteConfigsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteConfigsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteConfigsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteConfigsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteConfigsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteConfigsResponseValidationError) ErrorName() string { - return "DeleteConfigsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteConfigsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteConfigsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteConfigsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteConfigsResponseValidationError{} diff --git a/proto/authzed/api/v0/namespace_service_grpc.pb.go b/proto/authzed/api/v0/namespace_service_grpc.pb.go deleted file mode 100644 index 3ba5040..0000000 --- a/proto/authzed/api/v0/namespace_service_grpc.pb.go +++ /dev/null @@ -1,188 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. - -package v0 - -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 - -// NamespaceServiceClient is the client API for NamespaceService 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. -// -// Deprecated: Do not use. -type NamespaceServiceClient interface { - // Deprecated: Do not use. - ReadConfig(ctx context.Context, in *ReadConfigRequest, opts ...grpc.CallOption) (*ReadConfigResponse, error) - // Deprecated: Do not use. - WriteConfig(ctx context.Context, in *WriteConfigRequest, opts ...grpc.CallOption) (*WriteConfigResponse, error) - // Deprecated: Do not use. - DeleteConfigs(ctx context.Context, in *DeleteConfigsRequest, opts ...grpc.CallOption) (*DeleteConfigsResponse, error) -} - -type namespaceServiceClient struct { - cc grpc.ClientConnInterface -} - -// Deprecated: Do not use. -func NewNamespaceServiceClient(cc grpc.ClientConnInterface) NamespaceServiceClient { - return &namespaceServiceClient{cc} -} - -// Deprecated: Do not use. -func (c *namespaceServiceClient) ReadConfig(ctx context.Context, in *ReadConfigRequest, opts ...grpc.CallOption) (*ReadConfigResponse, error) { - out := new(ReadConfigResponse) - err := c.cc.Invoke(ctx, "/authzed.api.v0.NamespaceService/ReadConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *namespaceServiceClient) WriteConfig(ctx context.Context, in *WriteConfigRequest, opts ...grpc.CallOption) (*WriteConfigResponse, error) { - out := new(WriteConfigResponse) - err := c.cc.Invoke(ctx, "/authzed.api.v0.NamespaceService/WriteConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Deprecated: Do not use. -func (c *namespaceServiceClient) DeleteConfigs(ctx context.Context, in *DeleteConfigsRequest, opts ...grpc.CallOption) (*DeleteConfigsResponse, error) { - out := new(DeleteConfigsResponse) - err := c.cc.Invoke(ctx, "/authzed.api.v0.NamespaceService/DeleteConfigs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// NamespaceServiceServer is the server API for NamespaceService service. -// All implementations must embed UnimplementedNamespaceServiceServer -// for forward compatibility -// -// Deprecated: Do not use. -type NamespaceServiceServer interface { - // Deprecated: Do not use. - ReadConfig(context.Context, *ReadConfigRequest) (*ReadConfigResponse, error) - // Deprecated: Do not use. - WriteConfig(context.Context, *WriteConfigRequest) (*WriteConfigResponse, error) - // Deprecated: Do not use. - DeleteConfigs(context.Context, *DeleteConfigsRequest) (*DeleteConfigsResponse, error) - mustEmbedUnimplementedNamespaceServiceServer() -} - -// UnimplementedNamespaceServiceServer must be embedded to have forward compatible implementations. -type UnimplementedNamespaceServiceServer struct { -} - -func (UnimplementedNamespaceServiceServer) ReadConfig(context.Context, *ReadConfigRequest) (*ReadConfigResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadConfig not implemented") -} -func (UnimplementedNamespaceServiceServer) WriteConfig(context.Context, *WriteConfigRequest) (*WriteConfigResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WriteConfig not implemented") -} -func (UnimplementedNamespaceServiceServer) DeleteConfigs(context.Context, *DeleteConfigsRequest) (*DeleteConfigsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteConfigs not implemented") -} -func (UnimplementedNamespaceServiceServer) mustEmbedUnimplementedNamespaceServiceServer() {} - -// UnsafeNamespaceServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to NamespaceServiceServer will -// result in compilation errors. -type UnsafeNamespaceServiceServer interface { - mustEmbedUnimplementedNamespaceServiceServer() -} - -// Deprecated: Do not use. -func RegisterNamespaceServiceServer(s grpc.ServiceRegistrar, srv NamespaceServiceServer) { - s.RegisterService(&NamespaceService_ServiceDesc, srv) -} - -func _NamespaceService_ReadConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadConfigRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NamespaceServiceServer).ReadConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/authzed.api.v0.NamespaceService/ReadConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NamespaceServiceServer).ReadConfig(ctx, req.(*ReadConfigRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _NamespaceService_WriteConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(WriteConfigRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NamespaceServiceServer).WriteConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/authzed.api.v0.NamespaceService/WriteConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NamespaceServiceServer).WriteConfig(ctx, req.(*WriteConfigRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _NamespaceService_DeleteConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteConfigsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NamespaceServiceServer).DeleteConfigs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/authzed.api.v0.NamespaceService/DeleteConfigs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NamespaceServiceServer).DeleteConfigs(ctx, req.(*DeleteConfigsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// NamespaceService_ServiceDesc is the grpc.ServiceDesc for NamespaceService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var NamespaceService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "authzed.api.v0.NamespaceService", - HandlerType: (*NamespaceServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ReadConfig", - Handler: _NamespaceService_ReadConfig_Handler, - }, - { - MethodName: "WriteConfig", - Handler: _NamespaceService_WriteConfig_Handler, - }, - { - MethodName: "DeleteConfigs", - Handler: _NamespaceService_DeleteConfigs_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "authzed/api/v0/namespace_service.proto", -} diff --git a/proto/authzed/api/v0/watch_service.pb.go b/proto/authzed/api/v0/watch_service.pb.go deleted file mode 100644 index ca7514c..0000000 --- a/proto/authzed/api/v0/watch_service.pb.go +++ /dev/null @@ -1,270 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc (unknown) -// authzed/api/v0/watch_service.proto is a deprecated file. - -package v0 - -import ( - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - 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) -) - -// Deprecated: Do not use. -type WatchRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A watch request specifies one or more namespaces and a zookie - // representing the time to start watching. - Namespaces []string `protobuf:"bytes,1,rep,name=namespaces,proto3" json:"namespaces,omitempty"` - StartRevision *Zookie `protobuf:"bytes,2,opt,name=start_revision,json=startRevision,proto3" json:"start_revision,omitempty"` -} - -func (x *WatchRequest) Reset() { - *x = WatchRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_watch_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WatchRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WatchRequest) ProtoMessage() {} - -func (x *WatchRequest) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_watch_service_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 WatchRequest.ProtoReflect.Descriptor instead. -func (*WatchRequest) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_watch_service_proto_rawDescGZIP(), []int{0} -} - -func (x *WatchRequest) GetNamespaces() []string { - if x != nil { - return x.Namespaces - } - return nil -} - -func (x *WatchRequest) GetStartRevision() *Zookie { - if x != nil { - return x.StartRevision - } - return nil -} - -// Deprecated: Do not use. -type WatchResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // A watch response contains all tuple modification events in ascending - // timestamp order, from the requested start timestamp to a timestamp - // encoded in a heartbeat zookie included in the watch response. The client - // can use the heartbeat zookie to resume watching where the previous watch - // response left off. - Updates []*RelationTupleUpdate `protobuf:"bytes,1,rep,name=updates,proto3" json:"updates,omitempty"` - EndRevision *Zookie `protobuf:"bytes,2,opt,name=end_revision,json=endRevision,proto3" json:"end_revision,omitempty"` -} - -func (x *WatchResponse) Reset() { - *x = WatchResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_authzed_api_v0_watch_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WatchResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WatchResponse) ProtoMessage() {} - -func (x *WatchResponse) ProtoReflect() protoreflect.Message { - mi := &file_authzed_api_v0_watch_service_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 WatchResponse.ProtoReflect.Descriptor instead. -func (*WatchResponse) Descriptor() ([]byte, []int) { - return file_authzed_api_v0_watch_service_proto_rawDescGZIP(), []int{1} -} - -func (x *WatchResponse) GetUpdates() []*RelationTupleUpdate { - if x != nil { - return x.Updates - } - return nil -} - -func (x *WatchResponse) GetEndRevision() *Zookie { - if x != nil { - return x.EndRevision - } - return nil -} - -var File_authzed_api_v0_watch_service_proto protoreflect.FileDescriptor - -var file_authzed_api_v0_watch_service_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, - 0x2f, 0x77, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x30, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc2, 0x01, 0x0a, 0x0c, 0x57, 0x61, 0x74, - 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x6f, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x4f, 0xfa, - 0x42, 0x4c, 0x92, 0x01, 0x49, 0x08, 0x01, 0x22, 0x45, 0x72, 0x43, 0x28, 0x80, 0x01, 0x32, 0x3e, - 0x5e, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, - 0x7b, 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x2f, 0x29, - 0x3f, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, - 0x31, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0x52, 0x0a, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x0e, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x8d, 0x01, - 0x0a, 0x0d, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x3d, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x39, - 0x0a, 0x0c, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x5a, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x52, 0x0b, 0x65, 0x6e, - 0x64, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x02, 0x18, 0x01, 0x32, 0x60, 0x0a, - 0x0c, 0x57, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4b, 0x0a, - 0x05, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x30, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x03, 0x88, 0x02, 0x01, 0x30, 0x01, 0x1a, 0x03, 0x88, 0x02, 0x01, 0x42, - 0x4b, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x30, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, - 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, - 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0xb8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_authzed_api_v0_watch_service_proto_rawDescOnce sync.Once - file_authzed_api_v0_watch_service_proto_rawDescData = file_authzed_api_v0_watch_service_proto_rawDesc -) - -func file_authzed_api_v0_watch_service_proto_rawDescGZIP() []byte { - file_authzed_api_v0_watch_service_proto_rawDescOnce.Do(func() { - file_authzed_api_v0_watch_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_authzed_api_v0_watch_service_proto_rawDescData) - }) - return file_authzed_api_v0_watch_service_proto_rawDescData -} - -var file_authzed_api_v0_watch_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_authzed_api_v0_watch_service_proto_goTypes = []interface{}{ - (*WatchRequest)(nil), // 0: authzed.api.v0.WatchRequest - (*WatchResponse)(nil), // 1: authzed.api.v0.WatchResponse - (*Zookie)(nil), // 2: authzed.api.v0.Zookie - (*RelationTupleUpdate)(nil), // 3: authzed.api.v0.RelationTupleUpdate -} -var file_authzed_api_v0_watch_service_proto_depIdxs = []int32{ - 2, // 0: authzed.api.v0.WatchRequest.start_revision:type_name -> authzed.api.v0.Zookie - 3, // 1: authzed.api.v0.WatchResponse.updates:type_name -> authzed.api.v0.RelationTupleUpdate - 2, // 2: authzed.api.v0.WatchResponse.end_revision:type_name -> authzed.api.v0.Zookie - 0, // 3: authzed.api.v0.WatchService.Watch:input_type -> authzed.api.v0.WatchRequest - 1, // 4: authzed.api.v0.WatchService.Watch:output_type -> authzed.api.v0.WatchResponse - 4, // [4:5] is the sub-list for method output_type - 3, // [3:4] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_authzed_api_v0_watch_service_proto_init() } -func file_authzed_api_v0_watch_service_proto_init() { - if File_authzed_api_v0_watch_service_proto != nil { - return - } - file_authzed_api_v0_core_proto_init() - if !protoimpl.UnsafeEnabled { - file_authzed_api_v0_watch_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WatchRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_authzed_api_v0_watch_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WatchResponse); 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_authzed_api_v0_watch_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_authzed_api_v0_watch_service_proto_goTypes, - DependencyIndexes: file_authzed_api_v0_watch_service_proto_depIdxs, - MessageInfos: file_authzed_api_v0_watch_service_proto_msgTypes, - }.Build() - File_authzed_api_v0_watch_service_proto = out.File - file_authzed_api_v0_watch_service_proto_rawDesc = nil - file_authzed_api_v0_watch_service_proto_goTypes = nil - file_authzed_api_v0_watch_service_proto_depIdxs = nil -} diff --git a/proto/authzed/api/v0/watch_service.pb.validate.go b/proto/authzed/api/v0/watch_service.pb.validate.go deleted file mode 100644 index e0b9375..0000000 --- a/proto/authzed/api/v0/watch_service.pb.validate.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: authzed/api/v0/watch_service.proto - -package v0 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} -) - -// Validate checks the field values on WatchRequest with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *WatchRequest) Validate() error { - if m == nil { - return nil - } - - if len(m.GetNamespaces()) < 1 { - return WatchRequestValidationError{ - field: "Namespaces", - reason: "value must contain at least 1 item(s)", - } - } - - for idx, item := range m.GetNamespaces() { - _, _ = idx, item - - if len(item) > 128 { - return WatchRequestValidationError{ - field: fmt.Sprintf("Namespaces[%v]", idx), - reason: "value length must be at most 128 bytes", - } - } - - if !_WatchRequest_Namespaces_Pattern.MatchString(item) { - return WatchRequestValidationError{ - field: fmt.Sprintf("Namespaces[%v]", idx), - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", - } - } - - } - - if v, ok := interface{}(m.GetStartRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WatchRequestValidationError{ - field: "StartRevision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// WatchRequestValidationError is the validation error returned by -// WatchRequest.Validate if the designated constraints aren't met. -type WatchRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WatchRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WatchRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WatchRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WatchRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WatchRequestValidationError) ErrorName() string { return "WatchRequestValidationError" } - -// Error satisfies the builtin error interface -func (e WatchRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWatchRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WatchRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WatchRequestValidationError{} - -var _WatchRequest_Namespaces_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$") - -// Validate checks the field values on WatchResponse with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. -func (m *WatchResponse) Validate() error { - if m == nil { - return nil - } - - for idx, item := range m.GetUpdates() { - _, _ = idx, item - - if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WatchResponseValidationError{ - field: fmt.Sprintf("Updates[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if v, ok := interface{}(m.GetEndRevision()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return WatchResponseValidationError{ - field: "EndRevision", - reason: "embedded message failed validation", - cause: err, - } - } - } - - return nil -} - -// WatchResponseValidationError is the validation error returned by -// WatchResponse.Validate if the designated constraints aren't met. -type WatchResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e WatchResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e WatchResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e WatchResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e WatchResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e WatchResponseValidationError) ErrorName() string { return "WatchResponseValidationError" } - -// Error satisfies the builtin error interface -func (e WatchResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sWatchResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = WatchResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = WatchResponseValidationError{} diff --git a/proto/authzed/api/v0/watch_service_grpc.pb.go b/proto/authzed/api/v0/watch_service_grpc.pb.go deleted file mode 100644 index 14452ec..0000000 --- a/proto/authzed/api/v0/watch_service_grpc.pb.go +++ /dev/null @@ -1,137 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. - -package v0 - -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 - -// WatchServiceClient is the client API for WatchService 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. -// -// Deprecated: Do not use. -type WatchServiceClient interface { - // Deprecated: Do not use. - Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (WatchService_WatchClient, error) -} - -type watchServiceClient struct { - cc grpc.ClientConnInterface -} - -// Deprecated: Do not use. -func NewWatchServiceClient(cc grpc.ClientConnInterface) WatchServiceClient { - return &watchServiceClient{cc} -} - -// Deprecated: Do not use. -func (c *watchServiceClient) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (WatchService_WatchClient, error) { - stream, err := c.cc.NewStream(ctx, &WatchService_ServiceDesc.Streams[0], "/authzed.api.v0.WatchService/Watch", opts...) - if err != nil { - return nil, err - } - x := &watchServiceWatchClient{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 WatchService_WatchClient interface { - Recv() (*WatchResponse, error) - grpc.ClientStream -} - -type watchServiceWatchClient struct { - grpc.ClientStream -} - -func (x *watchServiceWatchClient) Recv() (*WatchResponse, error) { - m := new(WatchResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// WatchServiceServer is the server API for WatchService service. -// All implementations must embed UnimplementedWatchServiceServer -// for forward compatibility -// -// Deprecated: Do not use. -type WatchServiceServer interface { - // Deprecated: Do not use. - Watch(*WatchRequest, WatchService_WatchServer) error - mustEmbedUnimplementedWatchServiceServer() -} - -// UnimplementedWatchServiceServer must be embedded to have forward compatible implementations. -type UnimplementedWatchServiceServer struct { -} - -func (UnimplementedWatchServiceServer) Watch(*WatchRequest, WatchService_WatchServer) error { - return status.Errorf(codes.Unimplemented, "method Watch not implemented") -} -func (UnimplementedWatchServiceServer) mustEmbedUnimplementedWatchServiceServer() {} - -// UnsafeWatchServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to WatchServiceServer will -// result in compilation errors. -type UnsafeWatchServiceServer interface { - mustEmbedUnimplementedWatchServiceServer() -} - -// Deprecated: Do not use. -func RegisterWatchServiceServer(s grpc.ServiceRegistrar, srv WatchServiceServer) { - s.RegisterService(&WatchService_ServiceDesc, srv) -} - -func _WatchService_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(WatchRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(WatchServiceServer).Watch(m, &watchServiceWatchServer{stream}) -} - -type WatchService_WatchServer interface { - Send(*WatchResponse) error - grpc.ServerStream -} - -type watchServiceWatchServer struct { - grpc.ServerStream -} - -func (x *watchServiceWatchServer) Send(m *WatchResponse) error { - return x.ServerStream.SendMsg(m) -} - -// WatchService_ServiceDesc is the grpc.ServiceDesc for WatchService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var WatchService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "authzed.api.v0.WatchService", - HandlerType: (*WatchServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Watch", - Handler: _WatchService_Watch_Handler, - ServerStreams: true, - }, - }, - Metadata: "authzed/api/v0/watch_service.proto", -} diff --git a/proto/authzed/api/v1/core.pb.validate.go b/proto/authzed/api/v1/core.pb.validate.go index fb3f46b..a971501 100644 --- a/proto/authzed/api/v1/core.pb.validate.go +++ b/proto/authzed/api/v1/core.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,24 +32,62 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) // Validate checks the field values on Relationship with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *Relationship) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Relationship with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in RelationshipMultiError, or +// nil if none found. +func (m *Relationship) ValidateAll() error { + return m.validate(true) +} + +func (m *Relationship) validate(all bool) error { if m == nil { return nil } + var errors []error + if m.GetResource() == nil { - return RelationshipValidationError{ + err := RelationshipValidationError{ field: "Resource", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetResource()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RelationshipValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RelationshipValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RelationshipValidationError{ field: "Resource", @@ -59,27 +98,58 @@ func (m *Relationship) Validate() error { } if len(m.GetRelation()) > 64 { - return RelationshipValidationError{ + err := RelationshipValidationError{ field: "Relation", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_Relationship_Relation_Pattern.MatchString(m.GetRelation()) { - return RelationshipValidationError{ + err := RelationshipValidationError{ field: "Relation", reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } if m.GetSubject() == nil { - return RelationshipValidationError{ + err := RelationshipValidationError{ field: "Subject", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetSubject()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RelationshipValidationError{ + field: "Subject", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RelationshipValidationError{ + field: "Subject", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RelationshipValidationError{ field: "Subject", @@ -89,9 +159,29 @@ func (m *Relationship) Validate() error { } } + if len(errors) > 0 { + return RelationshipMultiError(errors) + } + return nil } +// RelationshipMultiError is an error wrapping multiple validation errors +// returned by Relationship.ValidateAll() if the designated constraints aren't met. +type RelationshipMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RelationshipMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RelationshipMultiError) AllErrors() []error { return m } + // RelationshipValidationError is the validation error returned by // Relationship.Validate if the designated constraints aren't met. type RelationshipValidationError struct { @@ -149,21 +239,58 @@ var _ interface { var _Relationship_Relation_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{1,62}[a-z0-9]$") // Validate checks the field values on SubjectReference with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *SubjectReference) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SubjectReference with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// SubjectReferenceMultiError, or nil if none found. +func (m *SubjectReference) ValidateAll() error { + return m.validate(true) +} + +func (m *SubjectReference) validate(all bool) error { if m == nil { return nil } + var errors []error + if m.GetObject() == nil { - return SubjectReferenceValidationError{ + err := SubjectReferenceValidationError{ field: "Object", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetObject()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetObject()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SubjectReferenceValidationError{ + field: "Object", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SubjectReferenceValidationError{ + field: "Object", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetObject()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SubjectReferenceValidationError{ field: "Object", @@ -174,22 +301,51 @@ func (m *SubjectReference) Validate() error { } if len(m.GetOptionalRelation()) > 64 { - return SubjectReferenceValidationError{ + err := SubjectReferenceValidationError{ field: "OptionalRelation", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_SubjectReference_OptionalRelation_Pattern.MatchString(m.GetOptionalRelation()) { - return SubjectReferenceValidationError{ + err := SubjectReferenceValidationError{ field: "OptionalRelation", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9])?$\"", } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return SubjectReferenceMultiError(errors) } return nil } +// SubjectReferenceMultiError is an error wrapping multiple validation errors +// returned by SubjectReference.ValidateAll() if the designated constraints +// aren't met. +type SubjectReferenceMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SubjectReferenceMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SubjectReferenceMultiError) AllErrors() []error { return m } + // SubjectReferenceValidationError is the validation error returned by // SubjectReference.Validate if the designated constraints aren't met. type SubjectReferenceValidationError struct { @@ -247,44 +403,95 @@ var _ interface { var _SubjectReference_OptionalRelation_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,62}[a-z0-9])?$") // Validate checks the field values on ObjectReference with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *ObjectReference) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ObjectReference with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ObjectReferenceMultiError, or nil if none found. +func (m *ObjectReference) ValidateAll() error { + return m.validate(true) +} + +func (m *ObjectReference) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetObjectType()) > 128 { - return ObjectReferenceValidationError{ + err := ObjectReferenceValidationError{ field: "ObjectType", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_ObjectReference_ObjectType_Pattern.MatchString(m.GetObjectType()) { - return ObjectReferenceValidationError{ + err := ObjectReferenceValidationError{ field: "ObjectType", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetObjectId()) > 128 { - return ObjectReferenceValidationError{ + err := ObjectReferenceValidationError{ field: "ObjectId", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_ObjectReference_ObjectId_Pattern.MatchString(m.GetObjectId()) { - return ObjectReferenceValidationError{ + err := ObjectReferenceValidationError{ field: "ObjectId", reason: "value does not match regex pattern \"^(([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})|\\\\*)$\"", } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return ObjectReferenceMultiError(errors) } return nil } +// ObjectReferenceMultiError is an error wrapping multiple validation errors +// returned by ObjectReference.ValidateAll() if the designated constraints +// aren't met. +type ObjectReferenceMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ObjectReferenceMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ObjectReferenceMultiError) AllErrors() []error { return m } + // ObjectReferenceValidationError is the validation error returned by // ObjectReference.Validate if the designated constraints aren't met. type ObjectReferenceValidationError struct { @@ -344,22 +551,61 @@ var _ObjectReference_ObjectType_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1 var _ObjectReference_ObjectId_Pattern = regexp.MustCompile("^(([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})|\\*)$") // Validate checks the field values on ZedToken with the rules defined in the -// proto definition for this message. If any rules are violated, an error is returned. +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *ZedToken) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ZedToken with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ZedTokenMultiError, or nil +// if none found. +func (m *ZedToken) ValidateAll() error { + return m.validate(true) +} + +func (m *ZedToken) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetToken()) < 1 { - return ZedTokenValidationError{ + err := ZedTokenValidationError{ field: "Token", reason: "value length must be at least 1 bytes", } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return ZedTokenMultiError(errors) } return nil } +// ZedTokenMultiError is an error wrapping multiple validation errors returned +// by ZedToken.ValidateAll() if the designated constraints aren't met. +type ZedTokenMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ZedTokenMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ZedTokenMultiError) AllErrors() []error { return m } + // ZedTokenValidationError is the validation error returned by // ZedToken.Validate if the designated constraints aren't met. type ZedTokenValidationError struct { @@ -416,27 +662,68 @@ var _ interface { // Validate checks the field values on RelationshipUpdate with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *RelationshipUpdate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RelationshipUpdate with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// RelationshipUpdateMultiError, or nil if none found. +func (m *RelationshipUpdate) ValidateAll() error { + return m.validate(true) +} + +func (m *RelationshipUpdate) validate(all bool) error { if m == nil { return nil } + var errors []error + if _, ok := RelationshipUpdate_Operation_name[int32(m.GetOperation())]; !ok { - return RelationshipUpdateValidationError{ + err := RelationshipUpdateValidationError{ field: "Operation", reason: "value must be one of the defined enum values", } + if !all { + return err + } + errors = append(errors, err) } if m.GetRelationship() == nil { - return RelationshipUpdateValidationError{ + err := RelationshipUpdateValidationError{ field: "Relationship", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetRelationship()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetRelationship()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RelationshipUpdateValidationError{ + field: "Relationship", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RelationshipUpdateValidationError{ + field: "Relationship", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRelationship()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RelationshipUpdateValidationError{ field: "Relationship", @@ -446,9 +733,30 @@ func (m *RelationshipUpdate) Validate() error { } } + if len(errors) > 0 { + return RelationshipUpdateMultiError(errors) + } + return nil } +// RelationshipUpdateMultiError is an error wrapping multiple validation errors +// returned by RelationshipUpdate.ValidateAll() if the designated constraints +// aren't met. +type RelationshipUpdateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RelationshipUpdateMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RelationshipUpdateMultiError) AllErrors() []error { return m } + // RelationshipUpdateValidationError is the validation error returned by // RelationshipUpdate.Validate if the designated constraints aren't met. type RelationshipUpdateValidationError struct { @@ -507,13 +815,46 @@ var _ interface { // Validate checks the field values on PermissionRelationshipTree with the // rules defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *PermissionRelationshipTree) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PermissionRelationshipTree with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PermissionRelationshipTreeMultiError, or nil if none found. +func (m *PermissionRelationshipTree) ValidateAll() error { + return m.validate(true) +} + +func (m *PermissionRelationshipTree) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetExpandedObject()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetExpandedObject()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PermissionRelationshipTreeValidationError{ + field: "ExpandedObject", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PermissionRelationshipTreeValidationError{ + field: "ExpandedObject", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetExpandedObject()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PermissionRelationshipTreeValidationError{ field: "ExpandedObject", @@ -529,7 +870,26 @@ func (m *PermissionRelationshipTree) Validate() error { case *PermissionRelationshipTree_Intermediate: - if v, ok := interface{}(m.GetIntermediate()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetIntermediate()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PermissionRelationshipTreeValidationError{ + field: "Intermediate", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PermissionRelationshipTreeValidationError{ + field: "Intermediate", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetIntermediate()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PermissionRelationshipTreeValidationError{ field: "Intermediate", @@ -541,7 +901,26 @@ func (m *PermissionRelationshipTree) Validate() error { case *PermissionRelationshipTree_Leaf: - if v, ok := interface{}(m.GetLeaf()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetLeaf()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PermissionRelationshipTreeValidationError{ + field: "Leaf", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PermissionRelationshipTreeValidationError{ + field: "Leaf", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetLeaf()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PermissionRelationshipTreeValidationError{ field: "Leaf", @@ -552,16 +931,41 @@ func (m *PermissionRelationshipTree) Validate() error { } default: - return PermissionRelationshipTreeValidationError{ + err := PermissionRelationshipTreeValidationError{ field: "TreeType", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } + if len(errors) > 0 { + return PermissionRelationshipTreeMultiError(errors) + } + return nil } +// PermissionRelationshipTreeMultiError is an error wrapping multiple +// validation errors returned by PermissionRelationshipTree.ValidateAll() if +// the designated constraints aren't met. +type PermissionRelationshipTreeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PermissionRelationshipTreeMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PermissionRelationshipTreeMultiError) AllErrors() []error { return m } + // PermissionRelationshipTreeValidationError is the validation error returned // by PermissionRelationshipTree.Validate if the designated constraints aren't met. type PermissionRelationshipTreeValidationError struct { @@ -620,18 +1024,51 @@ var _ interface { // Validate checks the field values on AlgebraicSubjectSet with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *AlgebraicSubjectSet) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on AlgebraicSubjectSet with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// AlgebraicSubjectSetMultiError, or nil if none found. +func (m *AlgebraicSubjectSet) ValidateAll() error { + return m.validate(true) +} + +func (m *AlgebraicSubjectSet) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for Operation for idx, item := range m.GetChildren() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AlgebraicSubjectSetValidationError{ + field: fmt.Sprintf("Children[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AlgebraicSubjectSetValidationError{ + field: fmt.Sprintf("Children[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AlgebraicSubjectSetValidationError{ field: fmt.Sprintf("Children[%v]", idx), @@ -643,9 +1080,30 @@ func (m *AlgebraicSubjectSet) Validate() error { } + if len(errors) > 0 { + return AlgebraicSubjectSetMultiError(errors) + } + return nil } +// AlgebraicSubjectSetMultiError is an error wrapping multiple validation +// errors returned by AlgebraicSubjectSet.ValidateAll() if the designated +// constraints aren't met. +type AlgebraicSubjectSetMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AlgebraicSubjectSetMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m AlgebraicSubjectSetMultiError) AllErrors() []error { return m } + // AlgebraicSubjectSetValidationError is the validation error returned by // AlgebraicSubjectSet.Validate if the designated constraints aren't met. type AlgebraicSubjectSetValidationError struct { @@ -703,17 +1161,50 @@ var _ interface { } = AlgebraicSubjectSetValidationError{} // Validate checks the field values on DirectSubjectSet with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *DirectSubjectSet) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DirectSubjectSet with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// DirectSubjectSetMultiError, or nil if none found. +func (m *DirectSubjectSet) ValidateAll() error { + return m.validate(true) +} + +func (m *DirectSubjectSet) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetSubjects() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, DirectSubjectSetValidationError{ + field: fmt.Sprintf("Subjects[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, DirectSubjectSetValidationError{ + field: fmt.Sprintf("Subjects[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DirectSubjectSetValidationError{ field: fmt.Sprintf("Subjects[%v]", idx), @@ -725,9 +1216,30 @@ func (m *DirectSubjectSet) Validate() error { } + if len(errors) > 0 { + return DirectSubjectSetMultiError(errors) + } + return nil } +// DirectSubjectSetMultiError is an error wrapping multiple validation errors +// returned by DirectSubjectSet.ValidateAll() if the designated constraints +// aren't met. +type DirectSubjectSetMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DirectSubjectSetMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DirectSubjectSetMultiError) AllErrors() []error { return m } + // DirectSubjectSetValidationError is the validation error returned by // DirectSubjectSet.Validate if the designated constraints aren't met. type DirectSubjectSetValidationError struct { diff --git a/proto/authzed/api/v1/openapi.pb.validate.go b/proto/authzed/api/v1/openapi.pb.validate.go index 6c52268..b2d93a6 100644 --- a/proto/authzed/api/v1/openapi.pb.validate.go +++ b/proto/authzed/api/v1/openapi.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,4 +32,5 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) diff --git a/proto/authzed/api/v1/permission_service.pb.validate.go b/proto/authzed/api/v1/permission_service.pb.validate.go index ae25e5d..5388de9 100644 --- a/proto/authzed/api/v1/permission_service.pb.validate.go +++ b/proto/authzed/api/v1/permission_service.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,30 +32,68 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) // Validate checks the field values on Consistency with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *Consistency) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Consistency with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ConsistencyMultiError, or +// nil if none found. +func (m *Consistency) ValidateAll() error { + return m.validate(true) +} + +func (m *Consistency) validate(all bool) error { if m == nil { return nil } + var errors []error + switch m.Requirement.(type) { case *Consistency_MinimizeLatency: if m.GetMinimizeLatency() != true { - return ConsistencyValidationError{ + err := ConsistencyValidationError{ field: "MinimizeLatency", reason: "value must equal true", } + if !all { + return err + } + errors = append(errors, err) } case *Consistency_AtLeastAsFresh: - if v, ok := interface{}(m.GetAtLeastAsFresh()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetAtLeastAsFresh()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ConsistencyValidationError{ + field: "AtLeastAsFresh", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ConsistencyValidationError{ + field: "AtLeastAsFresh", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetAtLeastAsFresh()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ConsistencyValidationError{ field: "AtLeastAsFresh", @@ -66,7 +105,26 @@ func (m *Consistency) Validate() error { case *Consistency_AtExactSnapshot: - if v, ok := interface{}(m.GetAtExactSnapshot()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetAtExactSnapshot()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ConsistencyValidationError{ + field: "AtExactSnapshot", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ConsistencyValidationError{ + field: "AtExactSnapshot", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetAtExactSnapshot()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ConsistencyValidationError{ field: "AtExactSnapshot", @@ -79,23 +137,51 @@ func (m *Consistency) Validate() error { case *Consistency_FullyConsistent: if m.GetFullyConsistent() != true { - return ConsistencyValidationError{ + err := ConsistencyValidationError{ field: "FullyConsistent", reason: "value must equal true", } + if !all { + return err + } + errors = append(errors, err) } default: - return ConsistencyValidationError{ + err := ConsistencyValidationError{ field: "Requirement", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } + if len(errors) > 0 { + return ConsistencyMultiError(errors) + } + return nil } +// ConsistencyMultiError is an error wrapping multiple validation errors +// returned by Consistency.ValidateAll() if the designated constraints aren't met. +type ConsistencyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ConsistencyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ConsistencyMultiError) AllErrors() []error { return m } + // ConsistencyValidationError is the validation error returned by // Consistency.Validate if the designated constraints aren't met. type ConsistencyValidationError struct { @@ -152,55 +238,112 @@ var _ interface { // Validate checks the field values on RelationshipFilter with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *RelationshipFilter) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RelationshipFilter with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// RelationshipFilterMultiError, or nil if none found. +func (m *RelationshipFilter) ValidateAll() error { + return m.validate(true) +} + +func (m *RelationshipFilter) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetResourceType()) > 128 { - return RelationshipFilterValidationError{ + err := RelationshipFilterValidationError{ field: "ResourceType", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_RelationshipFilter_ResourceType_Pattern.MatchString(m.GetResourceType()) { - return RelationshipFilterValidationError{ + err := RelationshipFilterValidationError{ field: "ResourceType", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetOptionalResourceId()) > 128 { - return RelationshipFilterValidationError{ + err := RelationshipFilterValidationError{ field: "OptionalResourceId", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_RelationshipFilter_OptionalResourceId_Pattern.MatchString(m.GetOptionalResourceId()) { - return RelationshipFilterValidationError{ + err := RelationshipFilterValidationError{ field: "OptionalResourceId", reason: "value does not match regex pattern \"^([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})?$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetOptionalRelation()) > 64 { - return RelationshipFilterValidationError{ + err := RelationshipFilterValidationError{ field: "OptionalRelation", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_RelationshipFilter_OptionalRelation_Pattern.MatchString(m.GetOptionalRelation()) { - return RelationshipFilterValidationError{ + err := RelationshipFilterValidationError{ field: "OptionalRelation", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9])?$\"", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetOptionalSubjectFilter()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetOptionalSubjectFilter()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RelationshipFilterValidationError{ + field: "OptionalSubjectFilter", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RelationshipFilterValidationError{ + field: "OptionalSubjectFilter", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetOptionalSubjectFilter()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RelationshipFilterValidationError{ field: "OptionalSubjectFilter", @@ -210,9 +353,30 @@ func (m *RelationshipFilter) Validate() error { } } + if len(errors) > 0 { + return RelationshipFilterMultiError(errors) + } + return nil } +// RelationshipFilterMultiError is an error wrapping multiple validation errors +// returned by RelationshipFilter.ValidateAll() if the designated constraints +// aren't met. +type RelationshipFilterMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RelationshipFilterMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RelationshipFilterMultiError) AllErrors() []error { return m } + // RelationshipFilterValidationError is the validation error returned by // RelationshipFilter.Validate if the designated constraints aren't met. type RelationshipFilterValidationError struct { @@ -276,42 +440,91 @@ var _RelationshipFilter_OptionalResourceId_Pattern = regexp.MustCompile("^([a-zA var _RelationshipFilter_OptionalRelation_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,62}[a-z0-9])?$") // Validate checks the field values on SubjectFilter with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *SubjectFilter) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SubjectFilter with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in SubjectFilterMultiError, or +// nil if none found. +func (m *SubjectFilter) ValidateAll() error { + return m.validate(true) +} + +func (m *SubjectFilter) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetSubjectType()) > 128 { - return SubjectFilterValidationError{ + err := SubjectFilterValidationError{ field: "SubjectType", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_SubjectFilter_SubjectType_Pattern.MatchString(m.GetSubjectType()) { - return SubjectFilterValidationError{ + err := SubjectFilterValidationError{ field: "SubjectType", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetOptionalSubjectId()) > 128 { - return SubjectFilterValidationError{ + err := SubjectFilterValidationError{ field: "OptionalSubjectId", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_SubjectFilter_OptionalSubjectId_Pattern.MatchString(m.GetOptionalSubjectId()) { - return SubjectFilterValidationError{ + err := SubjectFilterValidationError{ field: "OptionalSubjectId", reason: "value does not match regex pattern \"^(([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})|\\\\*)?$\"", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetOptionalRelation()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetOptionalRelation()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SubjectFilterValidationError{ + field: "OptionalRelation", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SubjectFilterValidationError{ + field: "OptionalRelation", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetOptionalRelation()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SubjectFilterValidationError{ field: "OptionalRelation", @@ -321,9 +534,30 @@ func (m *SubjectFilter) Validate() error { } } + if len(errors) > 0 { + return SubjectFilterMultiError(errors) + } + return nil } +// SubjectFilterMultiError is an error wrapping multiple validation errors +// returned by SubjectFilter.ValidateAll() if the designated constraints +// aren't met. +type SubjectFilterMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SubjectFilterMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SubjectFilterMultiError) AllErrors() []error { return m } + // SubjectFilterValidationError is the validation error returned by // SubjectFilter.Validate if the designated constraints aren't met. type SubjectFilterValidationError struct { @@ -384,13 +618,46 @@ var _SubjectFilter_OptionalSubjectId_Pattern = regexp.MustCompile("^(([a-zA-Z0-9 // Validate checks the field values on ReadRelationshipsRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ReadRelationshipsRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ReadRelationshipsRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ReadRelationshipsRequestMultiError, or nil if none found. +func (m *ReadRelationshipsRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ReadRelationshipsRequest) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetConsistency()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetConsistency()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ReadRelationshipsRequestValidationError{ + field: "Consistency", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ReadRelationshipsRequestValidationError{ + field: "Consistency", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetConsistency()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReadRelationshipsRequestValidationError{ field: "Consistency", @@ -401,13 +668,36 @@ func (m *ReadRelationshipsRequest) Validate() error { } if m.GetRelationshipFilter() == nil { - return ReadRelationshipsRequestValidationError{ + err := ReadRelationshipsRequestValidationError{ field: "RelationshipFilter", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetRelationshipFilter()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetRelationshipFilter()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ReadRelationshipsRequestValidationError{ + field: "RelationshipFilter", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ReadRelationshipsRequestValidationError{ + field: "RelationshipFilter", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRelationshipFilter()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReadRelationshipsRequestValidationError{ field: "RelationshipFilter", @@ -417,9 +707,30 @@ func (m *ReadRelationshipsRequest) Validate() error { } } + if len(errors) > 0 { + return ReadRelationshipsRequestMultiError(errors) + } + return nil } +// ReadRelationshipsRequestMultiError is an error wrapping multiple validation +// errors returned by ReadRelationshipsRequest.ValidateAll() if the designated +// constraints aren't met. +type ReadRelationshipsRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReadRelationshipsRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ReadRelationshipsRequestMultiError) AllErrors() []error { return m } + // ReadRelationshipsRequestValidationError is the validation error returned by // ReadRelationshipsRequest.Validate if the designated constraints aren't met. type ReadRelationshipsRequestValidationError struct { @@ -478,13 +789,46 @@ var _ interface { // Validate checks the field values on ReadRelationshipsResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ReadRelationshipsResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ReadRelationshipsResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ReadRelationshipsResponseMultiError, or nil if none found. +func (m *ReadRelationshipsResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ReadRelationshipsResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetReadAt()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetReadAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ReadRelationshipsResponseValidationError{ + field: "ReadAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ReadRelationshipsResponseValidationError{ + field: "ReadAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetReadAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReadRelationshipsResponseValidationError{ field: "ReadAt", @@ -494,7 +838,26 @@ func (m *ReadRelationshipsResponse) Validate() error { } } - if v, ok := interface{}(m.GetRelationship()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetRelationship()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ReadRelationshipsResponseValidationError{ + field: "Relationship", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ReadRelationshipsResponseValidationError{ + field: "Relationship", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRelationship()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReadRelationshipsResponseValidationError{ field: "Relationship", @@ -504,9 +867,30 @@ func (m *ReadRelationshipsResponse) Validate() error { } } + if len(errors) > 0 { + return ReadRelationshipsResponseMultiError(errors) + } + return nil } +// ReadRelationshipsResponseMultiError is an error wrapping multiple validation +// errors returned by ReadRelationshipsResponse.ValidateAll() if the +// designated constraints aren't met. +type ReadRelationshipsResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReadRelationshipsResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ReadRelationshipsResponseMultiError) AllErrors() []error { return m } + // ReadRelationshipsResponseValidationError is the validation error returned by // ReadRelationshipsResponse.Validate if the designated constraints aren't met. type ReadRelationshipsResponseValidationError struct { @@ -564,28 +948,69 @@ var _ interface { } = ReadRelationshipsResponseValidationError{} // Validate checks the field values on Precondition with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *Precondition) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Precondition with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PreconditionMultiError, or +// nil if none found. +func (m *Precondition) ValidateAll() error { + return m.validate(true) +} + +func (m *Precondition) validate(all bool) error { if m == nil { return nil } + var errors []error + if _, ok := Precondition_Operation_name[int32(m.GetOperation())]; !ok { - return PreconditionValidationError{ + err := PreconditionValidationError{ field: "Operation", reason: "value must be one of the defined enum values", } + if !all { + return err + } + errors = append(errors, err) } if m.GetFilter() == nil { - return PreconditionValidationError{ + err := PreconditionValidationError{ field: "Filter", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetFilter()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PreconditionValidationError{ + field: "Filter", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PreconditionValidationError{ + field: "Filter", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PreconditionValidationError{ field: "Filter", @@ -595,9 +1020,29 @@ func (m *Precondition) Validate() error { } } + if len(errors) > 0 { + return PreconditionMultiError(errors) + } + return nil } +// PreconditionMultiError is an error wrapping multiple validation errors +// returned by Precondition.ValidateAll() if the designated constraints aren't met. +type PreconditionMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PreconditionMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PreconditionMultiError) AllErrors() []error { return m } + // PreconditionValidationError is the validation error returned by // Precondition.Validate if the designated constraints aren't met. type PreconditionValidationError struct { @@ -654,23 +1099,60 @@ var _ interface { // Validate checks the field values on WriteRelationshipsRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *WriteRelationshipsRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WriteRelationshipsRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// WriteRelationshipsRequestMultiError, or nil if none found. +func (m *WriteRelationshipsRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *WriteRelationshipsRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetUpdates() { _, _ = idx, item if item == nil { - return WriteRelationshipsRequestValidationError{ + err := WriteRelationshipsRequestValidationError{ field: fmt.Sprintf("Updates[%v]", idx), reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WriteRelationshipsRequestValidationError{ + field: fmt.Sprintf("Updates[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WriteRelationshipsRequestValidationError{ + field: fmt.Sprintf("Updates[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WriteRelationshipsRequestValidationError{ field: fmt.Sprintf("Updates[%v]", idx), @@ -686,13 +1168,36 @@ func (m *WriteRelationshipsRequest) Validate() error { _, _ = idx, item if item == nil { - return WriteRelationshipsRequestValidationError{ + err := WriteRelationshipsRequestValidationError{ field: fmt.Sprintf("OptionalPreconditions[%v]", idx), reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WriteRelationshipsRequestValidationError{ + field: fmt.Sprintf("OptionalPreconditions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WriteRelationshipsRequestValidationError{ + field: fmt.Sprintf("OptionalPreconditions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WriteRelationshipsRequestValidationError{ field: fmt.Sprintf("OptionalPreconditions[%v]", idx), @@ -704,9 +1209,30 @@ func (m *WriteRelationshipsRequest) Validate() error { } + if len(errors) > 0 { + return WriteRelationshipsRequestMultiError(errors) + } + return nil } +// WriteRelationshipsRequestMultiError is an error wrapping multiple validation +// errors returned by WriteRelationshipsRequest.ValidateAll() if the +// designated constraints aren't met. +type WriteRelationshipsRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WriteRelationshipsRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WriteRelationshipsRequestMultiError) AllErrors() []error { return m } + // WriteRelationshipsRequestValidationError is the validation error returned by // WriteRelationshipsRequest.Validate if the designated constraints aren't met. type WriteRelationshipsRequestValidationError struct { @@ -765,13 +1291,46 @@ var _ interface { // Validate checks the field values on WriteRelationshipsResponse with the // rules defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *WriteRelationshipsResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WriteRelationshipsResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// WriteRelationshipsResponseMultiError, or nil if none found. +func (m *WriteRelationshipsResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *WriteRelationshipsResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetWrittenAt()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetWrittenAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WriteRelationshipsResponseValidationError{ + field: "WrittenAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WriteRelationshipsResponseValidationError{ + field: "WrittenAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetWrittenAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WriteRelationshipsResponseValidationError{ field: "WrittenAt", @@ -781,9 +1340,30 @@ func (m *WriteRelationshipsResponse) Validate() error { } } + if len(errors) > 0 { + return WriteRelationshipsResponseMultiError(errors) + } + return nil } +// WriteRelationshipsResponseMultiError is an error wrapping multiple +// validation errors returned by WriteRelationshipsResponse.ValidateAll() if +// the designated constraints aren't met. +type WriteRelationshipsResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WriteRelationshipsResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WriteRelationshipsResponseMultiError) AllErrors() []error { return m } + // WriteRelationshipsResponseValidationError is the validation error returned // by WriteRelationshipsResponse.Validate if the designated constraints aren't met. type WriteRelationshipsResponseValidationError struct { @@ -842,20 +1422,57 @@ var _ interface { // Validate checks the field values on DeleteRelationshipsRequest with the // rules defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteRelationshipsRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteRelationshipsRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// DeleteRelationshipsRequestMultiError, or nil if none found. +func (m *DeleteRelationshipsRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteRelationshipsRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if m.GetRelationshipFilter() == nil { - return DeleteRelationshipsRequestValidationError{ + err := DeleteRelationshipsRequestValidationError{ field: "RelationshipFilter", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetRelationshipFilter()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetRelationshipFilter()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, DeleteRelationshipsRequestValidationError{ + field: "RelationshipFilter", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, DeleteRelationshipsRequestValidationError{ + field: "RelationshipFilter", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRelationshipFilter()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DeleteRelationshipsRequestValidationError{ field: "RelationshipFilter", @@ -869,13 +1486,36 @@ func (m *DeleteRelationshipsRequest) Validate() error { _, _ = idx, item if item == nil { - return DeleteRelationshipsRequestValidationError{ + err := DeleteRelationshipsRequestValidationError{ field: fmt.Sprintf("OptionalPreconditions[%v]", idx), reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, DeleteRelationshipsRequestValidationError{ + field: fmt.Sprintf("OptionalPreconditions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, DeleteRelationshipsRequestValidationError{ + field: fmt.Sprintf("OptionalPreconditions[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DeleteRelationshipsRequestValidationError{ field: fmt.Sprintf("OptionalPreconditions[%v]", idx), @@ -887,9 +1527,30 @@ func (m *DeleteRelationshipsRequest) Validate() error { } + if len(errors) > 0 { + return DeleteRelationshipsRequestMultiError(errors) + } + return nil } +// DeleteRelationshipsRequestMultiError is an error wrapping multiple +// validation errors returned by DeleteRelationshipsRequest.ValidateAll() if +// the designated constraints aren't met. +type DeleteRelationshipsRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteRelationshipsRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeleteRelationshipsRequestMultiError) AllErrors() []error { return m } + // DeleteRelationshipsRequestValidationError is the validation error returned // by DeleteRelationshipsRequest.Validate if the designated constraints aren't met. type DeleteRelationshipsRequestValidationError struct { @@ -948,13 +1609,46 @@ var _ interface { // Validate checks the field values on DeleteRelationshipsResponse with the // rules defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteRelationshipsResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteRelationshipsResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// DeleteRelationshipsResponseMultiError, or nil if none found. +func (m *DeleteRelationshipsResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteRelationshipsResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetDeletedAt()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetDeletedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, DeleteRelationshipsResponseValidationError{ + field: "DeletedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, DeleteRelationshipsResponseValidationError{ + field: "DeletedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetDeletedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DeleteRelationshipsResponseValidationError{ field: "DeletedAt", @@ -964,9 +1658,30 @@ func (m *DeleteRelationshipsResponse) Validate() error { } } + if len(errors) > 0 { + return DeleteRelationshipsResponseMultiError(errors) + } + return nil } +// DeleteRelationshipsResponseMultiError is an error wrapping multiple +// validation errors returned by DeleteRelationshipsResponse.ValidateAll() if +// the designated constraints aren't met. +type DeleteRelationshipsResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteRelationshipsResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeleteRelationshipsResponseMultiError) AllErrors() []error { return m } + // DeleteRelationshipsResponseValidationError is the validation error returned // by DeleteRelationshipsResponse.Validate if the designated constraints // aren't met. @@ -1026,13 +1741,46 @@ var _ interface { // Validate checks the field values on CheckPermissionRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *CheckPermissionRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CheckPermissionRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CheckPermissionRequestMultiError, or nil if none found. +func (m *CheckPermissionRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *CheckPermissionRequest) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetConsistency()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetConsistency()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CheckPermissionRequestValidationError{ + field: "Consistency", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CheckPermissionRequestValidationError{ + field: "Consistency", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetConsistency()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CheckPermissionRequestValidationError{ field: "Consistency", @@ -1043,13 +1791,36 @@ func (m *CheckPermissionRequest) Validate() error { } if m.GetResource() == nil { - return CheckPermissionRequestValidationError{ + err := CheckPermissionRequestValidationError{ field: "Resource", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetResource()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CheckPermissionRequestValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CheckPermissionRequestValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CheckPermissionRequestValidationError{ field: "Resource", @@ -1060,27 +1831,58 @@ func (m *CheckPermissionRequest) Validate() error { } if len(m.GetPermission()) > 64 { - return CheckPermissionRequestValidationError{ + err := CheckPermissionRequestValidationError{ field: "Permission", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_CheckPermissionRequest_Permission_Pattern.MatchString(m.GetPermission()) { - return CheckPermissionRequestValidationError{ + err := CheckPermissionRequestValidationError{ field: "Permission", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9])?$\"", } + if !all { + return err + } + errors = append(errors, err) } if m.GetSubject() == nil { - return CheckPermissionRequestValidationError{ + err := CheckPermissionRequestValidationError{ field: "Subject", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetSubject()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CheckPermissionRequestValidationError{ + field: "Subject", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CheckPermissionRequestValidationError{ + field: "Subject", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CheckPermissionRequestValidationError{ field: "Subject", @@ -1090,9 +1892,30 @@ func (m *CheckPermissionRequest) Validate() error { } } + if len(errors) > 0 { + return CheckPermissionRequestMultiError(errors) + } + return nil } +// CheckPermissionRequestMultiError is an error wrapping multiple validation +// errors returned by CheckPermissionRequest.ValidateAll() if the designated +// constraints aren't met. +type CheckPermissionRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CheckPermissionRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CheckPermissionRequestMultiError) AllErrors() []error { return m } + // CheckPermissionRequestValidationError is the validation error returned by // CheckPermissionRequest.Validate if the designated constraints aren't met. type CheckPermissionRequestValidationError struct { @@ -1153,13 +1976,46 @@ var _CheckPermissionRequest_Permission_Pattern = regexp.MustCompile("^([a-z][a-z // Validate checks the field values on CheckPermissionResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *CheckPermissionResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CheckPermissionResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CheckPermissionResponseMultiError, or nil if none found. +func (m *CheckPermissionResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *CheckPermissionResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetCheckedAt()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetCheckedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CheckPermissionResponseValidationError{ + field: "CheckedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CheckPermissionResponseValidationError{ + field: "CheckedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCheckedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CheckPermissionResponseValidationError{ field: "CheckedAt", @@ -1171,9 +2027,30 @@ func (m *CheckPermissionResponse) Validate() error { // no validation rules for Permissionship + if len(errors) > 0 { + return CheckPermissionResponseMultiError(errors) + } + return nil } +// CheckPermissionResponseMultiError is an error wrapping multiple validation +// errors returned by CheckPermissionResponse.ValidateAll() if the designated +// constraints aren't met. +type CheckPermissionResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CheckPermissionResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CheckPermissionResponseMultiError) AllErrors() []error { return m } + // CheckPermissionResponseValidationError is the validation error returned by // CheckPermissionResponse.Validate if the designated constraints aren't met. type CheckPermissionResponseValidationError struct { @@ -1232,13 +2109,46 @@ var _ interface { // Validate checks the field values on ExpandPermissionTreeRequest with the // rules defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ExpandPermissionTreeRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ExpandPermissionTreeRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ExpandPermissionTreeRequestMultiError, or nil if none found. +func (m *ExpandPermissionTreeRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ExpandPermissionTreeRequest) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetConsistency()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetConsistency()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ExpandPermissionTreeRequestValidationError{ + field: "Consistency", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ExpandPermissionTreeRequestValidationError{ + field: "Consistency", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetConsistency()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ExpandPermissionTreeRequestValidationError{ field: "Consistency", @@ -1249,13 +2159,36 @@ func (m *ExpandPermissionTreeRequest) Validate() error { } if m.GetResource() == nil { - return ExpandPermissionTreeRequestValidationError{ + err := ExpandPermissionTreeRequestValidationError{ field: "Resource", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetResource()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ExpandPermissionTreeRequestValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ExpandPermissionTreeRequestValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ExpandPermissionTreeRequestValidationError{ field: "Resource", @@ -1266,22 +2199,51 @@ func (m *ExpandPermissionTreeRequest) Validate() error { } if len(m.GetPermission()) > 64 { - return ExpandPermissionTreeRequestValidationError{ + err := ExpandPermissionTreeRequestValidationError{ field: "Permission", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_ExpandPermissionTreeRequest_Permission_Pattern.MatchString(m.GetPermission()) { - return ExpandPermissionTreeRequestValidationError{ + err := ExpandPermissionTreeRequestValidationError{ field: "Permission", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9])?$\"", } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return ExpandPermissionTreeRequestMultiError(errors) } return nil } +// ExpandPermissionTreeRequestMultiError is an error wrapping multiple +// validation errors returned by ExpandPermissionTreeRequest.ValidateAll() if +// the designated constraints aren't met. +type ExpandPermissionTreeRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ExpandPermissionTreeRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ExpandPermissionTreeRequestMultiError) AllErrors() []error { return m } + // ExpandPermissionTreeRequestValidationError is the validation error returned // by ExpandPermissionTreeRequest.Validate if the designated constraints // aren't met. @@ -1343,13 +2305,46 @@ var _ExpandPermissionTreeRequest_Permission_Pattern = regexp.MustCompile("^([a-z // Validate checks the field values on ExpandPermissionTreeResponse with the // rules defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ExpandPermissionTreeResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ExpandPermissionTreeResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ExpandPermissionTreeResponseMultiError, or nil if none found. +func (m *ExpandPermissionTreeResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ExpandPermissionTreeResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetExpandedAt()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetExpandedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ExpandPermissionTreeResponseValidationError{ + field: "ExpandedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ExpandPermissionTreeResponseValidationError{ + field: "ExpandedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetExpandedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ExpandPermissionTreeResponseValidationError{ field: "ExpandedAt", @@ -1359,7 +2354,26 @@ func (m *ExpandPermissionTreeResponse) Validate() error { } } - if v, ok := interface{}(m.GetTreeRoot()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetTreeRoot()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ExpandPermissionTreeResponseValidationError{ + field: "TreeRoot", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ExpandPermissionTreeResponseValidationError{ + field: "TreeRoot", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTreeRoot()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ExpandPermissionTreeResponseValidationError{ field: "TreeRoot", @@ -1369,9 +2383,30 @@ func (m *ExpandPermissionTreeResponse) Validate() error { } } + if len(errors) > 0 { + return ExpandPermissionTreeResponseMultiError(errors) + } + return nil } +// ExpandPermissionTreeResponseMultiError is an error wrapping multiple +// validation errors returned by ExpandPermissionTreeResponse.ValidateAll() if +// the designated constraints aren't met. +type ExpandPermissionTreeResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ExpandPermissionTreeResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ExpandPermissionTreeResponseMultiError) AllErrors() []error { return m } + // ExpandPermissionTreeResponseValidationError is the validation error returned // by ExpandPermissionTreeResponse.Validate if the designated constraints // aren't met. @@ -1431,13 +2466,46 @@ var _ interface { // Validate checks the field values on LookupResourcesRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *LookupResourcesRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on LookupResourcesRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// LookupResourcesRequestMultiError, or nil if none found. +func (m *LookupResourcesRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *LookupResourcesRequest) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetConsistency()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetConsistency()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, LookupResourcesRequestValidationError{ + field: "Consistency", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, LookupResourcesRequestValidationError{ + field: "Consistency", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetConsistency()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return LookupResourcesRequestValidationError{ field: "Consistency", @@ -1448,41 +2516,80 @@ func (m *LookupResourcesRequest) Validate() error { } if len(m.GetResourceObjectType()) > 128 { - return LookupResourcesRequestValidationError{ + err := LookupResourcesRequestValidationError{ field: "ResourceObjectType", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_LookupResourcesRequest_ResourceObjectType_Pattern.MatchString(m.GetResourceObjectType()) { - return LookupResourcesRequestValidationError{ + err := LookupResourcesRequestValidationError{ field: "ResourceObjectType", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetPermission()) > 64 { - return LookupResourcesRequestValidationError{ + err := LookupResourcesRequestValidationError{ field: "Permission", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_LookupResourcesRequest_Permission_Pattern.MatchString(m.GetPermission()) { - return LookupResourcesRequestValidationError{ + err := LookupResourcesRequestValidationError{ field: "Permission", reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } if m.GetSubject() == nil { - return LookupResourcesRequestValidationError{ + err := LookupResourcesRequestValidationError{ field: "Subject", reason: "value is required", } + if !all { + return err + } + errors = append(errors, err) } - if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetSubject()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, LookupResourcesRequestValidationError{ + field: "Subject", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, LookupResourcesRequestValidationError{ + field: "Subject", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return LookupResourcesRequestValidationError{ field: "Subject", @@ -1492,9 +2599,30 @@ func (m *LookupResourcesRequest) Validate() error { } } + if len(errors) > 0 { + return LookupResourcesRequestMultiError(errors) + } + return nil } +// LookupResourcesRequestMultiError is an error wrapping multiple validation +// errors returned by LookupResourcesRequest.ValidateAll() if the designated +// constraints aren't met. +type LookupResourcesRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m LookupResourcesRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m LookupResourcesRequestMultiError) AllErrors() []error { return m } + // LookupResourcesRequestValidationError is the validation error returned by // LookupResourcesRequest.Validate if the designated constraints aren't met. type LookupResourcesRequestValidationError struct { @@ -1557,13 +2685,46 @@ var _LookupResourcesRequest_Permission_Pattern = regexp.MustCompile("^[a-z][a-z0 // Validate checks the field values on LookupResourcesResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *LookupResourcesResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on LookupResourcesResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// LookupResourcesResponseMultiError, or nil if none found. +func (m *LookupResourcesResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *LookupResourcesResponse) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetLookedUpAt()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetLookedUpAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, LookupResourcesResponseValidationError{ + field: "LookedUpAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, LookupResourcesResponseValidationError{ + field: "LookedUpAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetLookedUpAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return LookupResourcesResponseValidationError{ field: "LookedUpAt", @@ -1575,9 +2736,30 @@ func (m *LookupResourcesResponse) Validate() error { // no validation rules for ResourceObjectId + if len(errors) > 0 { + return LookupResourcesResponseMultiError(errors) + } + return nil } +// LookupResourcesResponseMultiError is an error wrapping multiple validation +// errors returned by LookupResourcesResponse.ValidateAll() if the designated +// constraints aren't met. +type LookupResourcesResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m LookupResourcesResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m LookupResourcesResponseMultiError) AllErrors() []error { return m } + // LookupResourcesResponseValidationError is the validation error returned by // LookupResourcesResponse.Validate if the designated constraints aren't met. type LookupResourcesResponseValidationError struct { @@ -1636,29 +2818,72 @@ var _ interface { // Validate checks the field values on SubjectFilter_RelationFilter with the // rules defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *SubjectFilter_RelationFilter) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SubjectFilter_RelationFilter with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// SubjectFilter_RelationFilterMultiError, or nil if none found. +func (m *SubjectFilter_RelationFilter) ValidateAll() error { + return m.validate(true) +} + +func (m *SubjectFilter_RelationFilter) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetRelation()) > 64 { - return SubjectFilter_RelationFilterValidationError{ + err := SubjectFilter_RelationFilterValidationError{ field: "Relation", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_SubjectFilter_RelationFilter_Relation_Pattern.MatchString(m.GetRelation()) { - return SubjectFilter_RelationFilterValidationError{ + err := SubjectFilter_RelationFilterValidationError{ field: "Relation", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9])?$\"", } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return SubjectFilter_RelationFilterMultiError(errors) } return nil } +// SubjectFilter_RelationFilterMultiError is an error wrapping multiple +// validation errors returned by SubjectFilter_RelationFilter.ValidateAll() if +// the designated constraints aren't met. +type SubjectFilter_RelationFilterMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SubjectFilter_RelationFilterMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SubjectFilter_RelationFilterMultiError) AllErrors() []error { return m } + // SubjectFilter_RelationFilterValidationError is the validation error returned // by SubjectFilter_RelationFilter.Validate if the designated constraints // aren't met. diff --git a/proto/authzed/api/v1/permission_service_grpc.pb.go b/proto/authzed/api/v1/permission_service_grpc.pb.go index 6b5564d..7dd4193 100644 --- a/proto/authzed/api/v1/permission_service_grpc.pb.go +++ b/proto/authzed/api/v1/permission_service_grpc.pb.go @@ -21,22 +21,23 @@ type PermissionsServiceClient interface { // ReadRelationships reads a set of the relationships matching one or more // filters. ReadRelationships(ctx context.Context, in *ReadRelationshipsRequest, opts ...grpc.CallOption) (PermissionsService_ReadRelationshipsClient, error) - // WriteRelationships writes and/or deletes a set of specified relationships, - // with an optional set of precondition relationships that must exist before - // the operation can commit. + // WriteRelationships atomically writes and/or deletes a set of specified + // relationships. An optional set of preconditions can be provided that must + // be satisfied for the operation to commit. WriteRelationships(ctx context.Context, in *WriteRelationshipsRequest, opts ...grpc.CallOption) (*WriteRelationshipsResponse, error) - // DeleteRelationships deletes relationships matching one or more filters, in - // bulk. + // DeleteRelationships atomically bulk deletes relationships matching one or + // more filters. An optional set of preconditions can be provided that must + // be satisfied for the operation to commit. DeleteRelationships(ctx context.Context, in *DeleteRelationshipsRequest, opts ...grpc.CallOption) (*DeleteRelationshipsResponse, error) - // CheckPermission checks whether a subject has a particular permission or is - // a member of a particular relation, on a given resource. + // CheckPermission determines for a given resource whether a subject computes + // to having a permission or is a direct member of a particular relation. CheckPermission(ctx context.Context, in *CheckPermissionRequest, opts ...grpc.CallOption) (*CheckPermissionResponse, error) - // ExpandPermissionTree expands the relationships reachable from a particular - // permission or relation of a given resource. + // ExpandPermissionTree reveals the graph structure for a resource's + // permission or relation. This RPC does not recurse infinitely deep and may + // require multiple calls to fully unnest a deeply nested graph. ExpandPermissionTree(ctx context.Context, in *ExpandPermissionTreeRequest, opts ...grpc.CallOption) (*ExpandPermissionTreeResponse, error) - // LookupResources returns the IDs of all resources on which the specified - // subject has permission or on which the specified subject is a member of the - // relation. + // LookupResources returns all the resources of a given type that a subject + // can access whether via a computed permission or relation membership. LookupResources(ctx context.Context, in *LookupResourcesRequest, opts ...grpc.CallOption) (PermissionsService_LookupResourcesClient, error) } @@ -155,22 +156,23 @@ type PermissionsServiceServer interface { // ReadRelationships reads a set of the relationships matching one or more // filters. ReadRelationships(*ReadRelationshipsRequest, PermissionsService_ReadRelationshipsServer) error - // WriteRelationships writes and/or deletes a set of specified relationships, - // with an optional set of precondition relationships that must exist before - // the operation can commit. + // WriteRelationships atomically writes and/or deletes a set of specified + // relationships. An optional set of preconditions can be provided that must + // be satisfied for the operation to commit. WriteRelationships(context.Context, *WriteRelationshipsRequest) (*WriteRelationshipsResponse, error) - // DeleteRelationships deletes relationships matching one or more filters, in - // bulk. + // DeleteRelationships atomically bulk deletes relationships matching one or + // more filters. An optional set of preconditions can be provided that must + // be satisfied for the operation to commit. DeleteRelationships(context.Context, *DeleteRelationshipsRequest) (*DeleteRelationshipsResponse, error) - // CheckPermission checks whether a subject has a particular permission or is - // a member of a particular relation, on a given resource. + // CheckPermission determines for a given resource whether a subject computes + // to having a permission or is a direct member of a particular relation. CheckPermission(context.Context, *CheckPermissionRequest) (*CheckPermissionResponse, error) - // ExpandPermissionTree expands the relationships reachable from a particular - // permission or relation of a given resource. + // ExpandPermissionTree reveals the graph structure for a resource's + // permission or relation. This RPC does not recurse infinitely deep and may + // require multiple calls to fully unnest a deeply nested graph. ExpandPermissionTree(context.Context, *ExpandPermissionTreeRequest) (*ExpandPermissionTreeResponse, error) - // LookupResources returns the IDs of all resources on which the specified - // subject has permission or on which the specified subject is a member of the - // relation. + // LookupResources returns all the resources of a given type that a subject + // can access whether via a computed permission or relation membership. LookupResources(*LookupResourcesRequest, PermissionsService_LookupResourcesServer) error mustEmbedUnimplementedPermissionsServiceServer() } diff --git a/proto/authzed/api/v1/schema_service.pb.validate.go b/proto/authzed/api/v1/schema_service.pb.validate.go index a268117..9bcd8bd 100644 --- a/proto/authzed/api/v1/schema_service.pb.validate.go +++ b/proto/authzed/api/v1/schema_service.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,19 +32,55 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) // Validate checks the field values on ReadSchemaRequest with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *ReadSchemaRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ReadSchemaRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ReadSchemaRequestMultiError, or nil if none found. +func (m *ReadSchemaRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ReadSchemaRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + + if len(errors) > 0 { + return ReadSchemaRequestMultiError(errors) + } + return nil } +// ReadSchemaRequestMultiError is an error wrapping multiple validation errors +// returned by ReadSchemaRequest.ValidateAll() if the designated constraints +// aren't met. +type ReadSchemaRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReadSchemaRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ReadSchemaRequestMultiError) AllErrors() []error { return m } + // ReadSchemaRequestValidationError is the validation error returned by // ReadSchemaRequest.Validate if the designated constraints aren't met. type ReadSchemaRequestValidationError struct { @@ -102,17 +139,52 @@ var _ interface { // Validate checks the field values on ReadSchemaResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ReadSchemaResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ReadSchemaResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ReadSchemaResponseMultiError, or nil if none found. +func (m *ReadSchemaResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ReadSchemaResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for SchemaText + if len(errors) > 0 { + return ReadSchemaResponseMultiError(errors) + } + return nil } +// ReadSchemaResponseMultiError is an error wrapping multiple validation errors +// returned by ReadSchemaResponse.ValidateAll() if the designated constraints +// aren't met. +type ReadSchemaResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReadSchemaResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ReadSchemaResponseMultiError) AllErrors() []error { return m } + // ReadSchemaResponseValidationError is the validation error returned by // ReadSchemaResponse.Validate if the designated constraints aren't met. type ReadSchemaResponseValidationError struct { @@ -171,22 +243,61 @@ var _ interface { // Validate checks the field values on WriteSchemaRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *WriteSchemaRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WriteSchemaRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// WriteSchemaRequestMultiError, or nil if none found. +func (m *WriteSchemaRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *WriteSchemaRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetSchema()) > 262144 { - return WriteSchemaRequestValidationError{ + err := WriteSchemaRequestValidationError{ field: "Schema", reason: "value length must be at most 262144 bytes", } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return WriteSchemaRequestMultiError(errors) } return nil } +// WriteSchemaRequestMultiError is an error wrapping multiple validation errors +// returned by WriteSchemaRequest.ValidateAll() if the designated constraints +// aren't met. +type WriteSchemaRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WriteSchemaRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WriteSchemaRequestMultiError) AllErrors() []error { return m } + // WriteSchemaRequestValidationError is the validation error returned by // WriteSchemaRequest.Validate if the designated constraints aren't met. type WriteSchemaRequestValidationError struct { @@ -245,15 +356,50 @@ var _ interface { // Validate checks the field values on WriteSchemaResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *WriteSchemaResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WriteSchemaResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// WriteSchemaResponseMultiError, or nil if none found. +func (m *WriteSchemaResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *WriteSchemaResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + + if len(errors) > 0 { + return WriteSchemaResponseMultiError(errors) + } + return nil } +// WriteSchemaResponseMultiError is an error wrapping multiple validation +// errors returned by WriteSchemaResponse.ValidateAll() if the designated +// constraints aren't met. +type WriteSchemaResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WriteSchemaResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WriteSchemaResponseMultiError) AllErrors() []error { return m } + // WriteSchemaResponseValidationError is the validation error returned by // WriteSchemaResponse.Validate if the designated constraints aren't met. type WriteSchemaResponseValidationError struct { diff --git a/proto/authzed/api/v1/watch_service.pb.validate.go b/proto/authzed/api/v1/watch_service.pb.validate.go index 2574938..b6c4a82 100644 --- a/proto/authzed/api/v1/watch_service.pb.validate.go +++ b/proto/authzed/api/v1/watch_service.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,36 +32,78 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) // Validate checks the field values on WatchRequest with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *WatchRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WatchRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in WatchRequestMultiError, or +// nil if none found. +func (m *WatchRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *WatchRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetOptionalObjectTypes() { _, _ = idx, item if len(item) > 128 { - return WatchRequestValidationError{ + err := WatchRequestValidationError{ field: fmt.Sprintf("OptionalObjectTypes[%v]", idx), reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_WatchRequest_OptionalObjectTypes_Pattern.MatchString(item) { - return WatchRequestValidationError{ + err := WatchRequestValidationError{ field: fmt.Sprintf("OptionalObjectTypes[%v]", idx), reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } } - if v, ok := interface{}(m.GetOptionalStartCursor()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetOptionalStartCursor()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WatchRequestValidationError{ + field: "OptionalStartCursor", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WatchRequestValidationError{ + field: "OptionalStartCursor", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetOptionalStartCursor()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WatchRequestValidationError{ field: "OptionalStartCursor", @@ -70,9 +113,29 @@ func (m *WatchRequest) Validate() error { } } + if len(errors) > 0 { + return WatchRequestMultiError(errors) + } + return nil } +// WatchRequestMultiError is an error wrapping multiple validation errors +// returned by WatchRequest.ValidateAll() if the designated constraints aren't met. +type WatchRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WatchRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WatchRequestMultiError) AllErrors() []error { return m } + // WatchRequestValidationError is the validation error returned by // WatchRequest.Validate if the designated constraints aren't met. type WatchRequestValidationError struct { @@ -130,17 +193,50 @@ var _ interface { var _WatchRequest_OptionalObjectTypes_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$") // Validate checks the field values on WatchResponse with the rules defined in -// the proto definition for this message. If any rules are violated, an error -// is returned. +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. func (m *WatchResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WatchResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in WatchResponseMultiError, or +// nil if none found. +func (m *WatchResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *WatchResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetUpdates() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WatchResponseValidationError{ + field: fmt.Sprintf("Updates[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WatchResponseValidationError{ + field: fmt.Sprintf("Updates[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WatchResponseValidationError{ field: fmt.Sprintf("Updates[%v]", idx), @@ -152,7 +248,26 @@ func (m *WatchResponse) Validate() error { } - if v, ok := interface{}(m.GetChangesThrough()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetChangesThrough()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WatchResponseValidationError{ + field: "ChangesThrough", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WatchResponseValidationError{ + field: "ChangesThrough", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetChangesThrough()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WatchResponseValidationError{ field: "ChangesThrough", @@ -162,9 +277,30 @@ func (m *WatchResponse) Validate() error { } } + if len(errors) > 0 { + return WatchResponseMultiError(errors) + } + return nil } +// WatchResponseMultiError is an error wrapping multiple validation errors +// returned by WatchResponse.ValidateAll() if the designated constraints +// aren't met. +type WatchResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WatchResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WatchResponseMultiError) AllErrors() []error { return m } + // WatchResponseValidationError is the validation error returned by // WatchResponse.Validate if the designated constraints aren't met. type WatchResponseValidationError struct { diff --git a/proto/authzed/api/v1alpha1/schema.pb.validate.go b/proto/authzed/api/v1alpha1/schema.pb.validate.go index 6dcbee2..2bca8c9 100644 --- a/proto/authzed/api/v1alpha1/schema.pb.validate.go +++ b/proto/authzed/api/v1alpha1/schema.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,38 +32,82 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) // Validate checks the field values on ReadSchemaRequest with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *ReadSchemaRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ReadSchemaRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ReadSchemaRequestMultiError, or nil if none found. +func (m *ReadSchemaRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ReadSchemaRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetObjectDefinitionsNames() { _, _ = idx, item if len(item) > 128 { - return ReadSchemaRequestValidationError{ + err := ReadSchemaRequestValidationError{ field: fmt.Sprintf("ObjectDefinitionsNames[%v]", idx), reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_ReadSchemaRequest_ObjectDefinitionsNames_Pattern.MatchString(item) { - return ReadSchemaRequestValidationError{ + err := ReadSchemaRequestValidationError{ field: fmt.Sprintf("ObjectDefinitionsNames[%v]", idx), reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,62}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } } + if len(errors) > 0 { + return ReadSchemaRequestMultiError(errors) + } + return nil } +// ReadSchemaRequestMultiError is an error wrapping multiple validation errors +// returned by ReadSchemaRequest.ValidateAll() if the designated constraints +// aren't met. +type ReadSchemaRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReadSchemaRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ReadSchemaRequestMultiError) AllErrors() []error { return m } + // ReadSchemaRequestValidationError is the validation error returned by // ReadSchemaRequest.Validate if the designated constraints aren't met. type ReadSchemaRequestValidationError struct { @@ -123,17 +168,52 @@ var _ReadSchemaRequest_ObjectDefinitionsNames_Pattern = regexp.MustCompile("^([a // Validate checks the field values on ReadSchemaResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *ReadSchemaResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ReadSchemaResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ReadSchemaResponseMultiError, or nil if none found. +func (m *ReadSchemaResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ReadSchemaResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for ComputedDefinitionsRevision + if len(errors) > 0 { + return ReadSchemaResponseMultiError(errors) + } + return nil } +// ReadSchemaResponseMultiError is an error wrapping multiple validation errors +// returned by ReadSchemaResponse.ValidateAll() if the designated constraints +// aren't met. +type ReadSchemaResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReadSchemaResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ReadSchemaResponseMultiError) AllErrors() []error { return m } + // ReadSchemaResponseValidationError is the validation error returned by // ReadSchemaResponse.Validate if the designated constraints aren't met. type ReadSchemaResponseValidationError struct { @@ -192,24 +272,63 @@ var _ interface { // Validate checks the field values on WriteSchemaRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *WriteSchemaRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WriteSchemaRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// WriteSchemaRequestMultiError, or nil if none found. +func (m *WriteSchemaRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *WriteSchemaRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetSchema()) > 262144 { - return WriteSchemaRequestValidationError{ + err := WriteSchemaRequestValidationError{ field: "Schema", reason: "value length must be at most 262144 bytes", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for OptionalDefinitionsRevisionPrecondition + if len(errors) > 0 { + return WriteSchemaRequestMultiError(errors) + } + return nil } +// WriteSchemaRequestMultiError is an error wrapping multiple validation errors +// returned by WriteSchemaRequest.ValidateAll() if the designated constraints +// aren't met. +type WriteSchemaRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WriteSchemaRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WriteSchemaRequestMultiError) AllErrors() []error { return m } + // WriteSchemaRequestValidationError is the validation error returned by // WriteSchemaRequest.Validate if the designated constraints aren't met. type WriteSchemaRequestValidationError struct { @@ -268,17 +387,52 @@ var _ interface { // Validate checks the field values on WriteSchemaResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *WriteSchemaResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WriteSchemaResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// WriteSchemaResponseMultiError, or nil if none found. +func (m *WriteSchemaResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *WriteSchemaResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + // no validation rules for ComputedDefinitionsRevision + if len(errors) > 0 { + return WriteSchemaResponseMultiError(errors) + } + return nil } +// WriteSchemaResponseMultiError is an error wrapping multiple validation +// errors returned by WriteSchemaResponse.ValidateAll() if the designated +// constraints aren't met. +type WriteSchemaResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WriteSchemaResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WriteSchemaResponseMultiError) AllErrors() []error { return m } + // WriteSchemaResponseValidationError is the validation error returned by // WriteSchemaResponse.Validate if the designated constraints aren't met. type WriteSchemaResponseValidationError struct { diff --git a/proto/authzed/api/v1alpha1/watchresources_service.pb.validate.go b/proto/authzed/api/v1alpha1/watchresources_service.pb.validate.go index 2540dd8..10418c1 100644 --- a/proto/authzed/api/v1alpha1/watchresources_service.pb.validate.go +++ b/proto/authzed/api/v1alpha1/watchresources_service.pb.validate.go @@ -11,6 +11,7 @@ import ( "net/mail" "net/url" "regexp" + "sort" "strings" "time" "unicode/utf8" @@ -31,49 +32,99 @@ var ( _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} + _ = sort.Sort ) // Validate checks the field values on WatchResourcesRequest with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *WatchResourcesRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WatchResourcesRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// WatchResourcesRequestMultiError, or nil if none found. +func (m *WatchResourcesRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *WatchResourcesRequest) validate(all bool) error { if m == nil { return nil } + var errors []error + if len(m.GetResourceObjectType()) > 128 { - return WatchResourcesRequestValidationError{ + err := WatchResourcesRequestValidationError{ field: "ResourceObjectType", reason: "value length must be at most 128 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_WatchResourcesRequest_ResourceObjectType_Pattern.MatchString(m.GetResourceObjectType()) { - return WatchResourcesRequestValidationError{ + err := WatchResourcesRequestValidationError{ field: "ResourceObjectType", reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } if len(m.GetPermission()) > 64 { - return WatchResourcesRequestValidationError{ + err := WatchResourcesRequestValidationError{ field: "Permission", reason: "value length must be at most 64 bytes", } + if !all { + return err + } + errors = append(errors, err) } if !_WatchResourcesRequest_Permission_Pattern.MatchString(m.GetPermission()) { - return WatchResourcesRequestValidationError{ + err := WatchResourcesRequestValidationError{ field: "Permission", reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{1,62}[a-z0-9]$\"", } + if !all { + return err + } + errors = append(errors, err) } // no validation rules for SubjectObjectType // no validation rules for OptionalSubjectRelation - if v, ok := interface{}(m.GetOptionalStartCursor()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetOptionalStartCursor()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WatchResourcesRequestValidationError{ + field: "OptionalStartCursor", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WatchResourcesRequestValidationError{ + field: "OptionalStartCursor", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetOptionalStartCursor()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WatchResourcesRequestValidationError{ field: "OptionalStartCursor", @@ -83,9 +134,30 @@ func (m *WatchResourcesRequest) Validate() error { } } + if len(errors) > 0 { + return WatchResourcesRequestMultiError(errors) + } + return nil } +// WatchResourcesRequestMultiError is an error wrapping multiple validation +// errors returned by WatchResourcesRequest.ValidateAll() if the designated +// constraints aren't met. +type WatchResourcesRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WatchResourcesRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WatchResourcesRequestMultiError) AllErrors() []error { return m } + // WatchResourcesRequestValidationError is the validation error returned by // WatchResourcesRequest.Validate if the designated constraints aren't met. type WatchResourcesRequestValidationError struct { @@ -147,14 +219,47 @@ var _WatchResourcesRequest_ResourceObjectType_Pattern = regexp.MustCompile("^([a var _WatchResourcesRequest_Permission_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{1,62}[a-z0-9]$") // Validate checks the field values on PermissionUpdate with the rules defined -// in the proto definition for this message. If any rules are violated, an -// error is returned. +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. func (m *PermissionUpdate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PermissionUpdate with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PermissionUpdateMultiError, or nil if none found. +func (m *PermissionUpdate) ValidateAll() error { + return m.validate(true) +} + +func (m *PermissionUpdate) validate(all bool) error { if m == nil { return nil } - if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { + var errors []error + + if all { + switch v := interface{}(m.GetSubject()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PermissionUpdateValidationError{ + field: "Subject", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PermissionUpdateValidationError{ + field: "Subject", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PermissionUpdateValidationError{ field: "Subject", @@ -164,7 +269,26 @@ func (m *PermissionUpdate) Validate() error { } } - if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetResource()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PermissionUpdateValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PermissionUpdateValidationError{ + field: "Resource", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return PermissionUpdateValidationError{ field: "Resource", @@ -178,9 +302,30 @@ func (m *PermissionUpdate) Validate() error { // no validation rules for UpdatedPermission + if len(errors) > 0 { + return PermissionUpdateMultiError(errors) + } + return nil } +// PermissionUpdateMultiError is an error wrapping multiple validation errors +// returned by PermissionUpdate.ValidateAll() if the designated constraints +// aren't met. +type PermissionUpdateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PermissionUpdateMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PermissionUpdateMultiError) AllErrors() []error { return m } + // PermissionUpdateValidationError is the validation error returned by // PermissionUpdate.Validate if the designated constraints aren't met. type PermissionUpdateValidationError struct { @@ -237,16 +382,49 @@ var _ interface { // Validate checks the field values on WatchResourcesResponse with the rules // defined in the proto definition for this message. If any rules are -// violated, an error is returned. +// violated, the first error encountered is returned, or nil if there are no violations. func (m *WatchResourcesResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WatchResourcesResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// WatchResourcesResponseMultiError, or nil if none found. +func (m *WatchResourcesResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *WatchResourcesResponse) validate(all bool) error { if m == nil { return nil } + var errors []error + for idx, item := range m.GetUpdates() { _, _ = idx, item - if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WatchResourcesResponseValidationError{ + field: fmt.Sprintf("Updates[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WatchResourcesResponseValidationError{ + field: fmt.Sprintf("Updates[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WatchResourcesResponseValidationError{ field: fmt.Sprintf("Updates[%v]", idx), @@ -258,7 +436,26 @@ func (m *WatchResourcesResponse) Validate() error { } - if v, ok := interface{}(m.GetChangesThrough()).(interface{ Validate() error }); ok { + if all { + switch v := interface{}(m.GetChangesThrough()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WatchResourcesResponseValidationError{ + field: "ChangesThrough", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WatchResourcesResponseValidationError{ + field: "ChangesThrough", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetChangesThrough()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WatchResourcesResponseValidationError{ field: "ChangesThrough", @@ -268,9 +465,30 @@ func (m *WatchResourcesResponse) Validate() error { } } + if len(errors) > 0 { + return WatchResourcesResponseMultiError(errors) + } + return nil } +// WatchResourcesResponseMultiError is an error wrapping multiple validation +// errors returned by WatchResourcesResponse.ValidateAll() if the designated +// constraints aren't met. +type WatchResourcesResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WatchResourcesResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WatchResourcesResponseMultiError) AllErrors() []error { return m } + // WatchResourcesResponseValidationError is the validation error returned by // WatchResourcesResponse.Validate if the designated constraints aren't met. type WatchResourcesResponseValidationError struct { diff --git a/proto/authzed/api/validation_test/tuples_test.go b/proto/authzed/api/validation_test/tuples_test.go index 0b91c87..6a21fde 100644 --- a/proto/authzed/api/validation_test/tuples_test.go +++ b/proto/authzed/api/validation_test/tuples_test.go @@ -197,64 +197,6 @@ func TestV0CoreObjectValidity(t *testing.T) { } err = asSubject.Validate() require.Equal(v0Valid, err == nil, "should be valid: %v %s", v0Valid, err) - - // test all of the types of tupleset filters - justNS := &v0.RelationTupleFilter{ - Namespace: ns.name, - } - filterValid := ns.valid - err = justNS.Validate() - require.Equal(filterValid, err == nil, "should be valid: %v %s", filterValid, err) - - objectIDFilter := &v0.RelationTupleFilter{ - Namespace: ns.name, - ObjectId: objectID.name, - Filters: []v0.RelationTupleFilter_Filter{ - v0.RelationTupleFilter_OBJECT_ID, - }, - } - filterValid = ns.valid && (objectID.valid || objectID.name == "") - err = objectIDFilter.Validate() - require.Equal(filterValid, err == nil, "should be valid: %v %s", filterValid, err) - - objectRelationFilter := &v0.RelationTupleFilter{ - Namespace: ns.name, - Relation: relation.name, - Filters: []v0.RelationTupleFilter_Filter{ - v0.RelationTupleFilter_RELATION, - }, - } - filterValid = ns.valid && (relation.validity == alwaysValid || relation.name == "") - err = objectRelationFilter.Validate() - require.Equal(filterValid, err == nil, "should be valid: %v %s", filterValid, err) - - fullObjectFilter := &v0.RelationTupleFilter{ - Namespace: ns.name, - ObjectId: objectID.name, - Relation: relation.name, - Filters: []v0.RelationTupleFilter_Filter{ - v0.RelationTupleFilter_OBJECT_ID, - v0.RelationTupleFilter_RELATION, - }, - } - filterValid = ns.valid && (objectID.valid || objectID.name == "") && - (relation.validity == alwaysValid || relation.name == "") - err = fullObjectFilter.Validate() - require.Equal(filterValid, err == nil, "should be valid: %v %s", filterValid, err) - - subjectFilter := &v0.RelationTupleFilter{ - Namespace: knownGoodObjectRef.ObjectType, - Userset: &v0.ObjectAndRelation{ - Namespace: ns.name, - ObjectId: subjectID.name, - Relation: relation.name, - }, - Filters: []v0.RelationTupleFilter_Filter{ - v0.RelationTupleFilter_USERSET, - }, - } - err = subjectFilter.Validate() - require.Equal(v0SubjectValid, err == nil, "should be valid: %v %s", v0SubjectValid, err) }) } } diff --git a/v0/client.go b/v0/client.go deleted file mode 100644 index ebba6af..0000000 --- a/v0/client.go +++ /dev/null @@ -1,77 +0,0 @@ -// Deprecated: Do not use. -package authzed - -import ( - "context" - "crypto/tls" - "crypto/x509" - - "github.com/jzelinskie/stringz" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - - v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" -) - -// Client represents an open connection to Authzed. -// -// Clients are backed by a gRPC client and as such are thread-safe. -// Deprecated: Do not use. -type Client struct { - v0.ACLServiceClient - v0.NamespaceServiceClient -} - -type grpcMetadataCreds map[string]string - -func (gmc grpcMetadataCreds) RequireTransportSecurity() bool { return true } -func (gmc grpcMetadataCreds) GetRequestMetadata(context.Context, ...string) (map[string]string, error) { - return gmc, nil -} - -// CertVerification is an enumeration of how secure TLS should be configured. -type CertVerification bool - -const ( - // VerifyCA will verify the certificate authority has been verified. - VerifyCA CertVerification = false - - // SkipVerifyCA will not verify the certificate authority when using TLS. - SkipVerifyCA CertVerification = true -) - -// Token is the client option that is used for authenticating to Authzed. -func Token(token string) grpc.DialOption { - return grpc.WithPerRPCCredentials(grpcMetadataCreds{"authorization": "Bearer " + token}) -} - -// SystemCerts is the client option that is used for establish a secure -// connection to Authzed. -func SystemCerts(v CertVerification) grpc.DialOption { - certPool, err := x509.SystemCertPool() - if err != nil { - panic(err) - } - - return grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{ - RootCAs: certPool, - InsecureSkipVerify: bool(v), - })) -} - -// NewClient initializes a brand new client for interacting with Authzed. -// Deprecated: Do not use. -func NewClient(endpoint string, opts ...grpc.DialOption) (*Client, error) { - conn, err := grpc.Dial( - stringz.DefaultEmpty(endpoint, "grpc.authzed.com:443"), - opts..., - ) - if err != nil { - return nil, err - } - - return &Client{ - v0.NewACLServiceClient(conn), - v0.NewNamespaceServiceClient(conn), - }, nil -} diff --git a/v0/filter.go b/v0/filter.go deleted file mode 100644 index 06b01e0..0000000 --- a/v0/filter.go +++ /dev/null @@ -1,157 +0,0 @@ -package authzed - -import ( - "context" - "fmt" - "reflect" - - v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" - "github.com/authzed/authzed-go/v0/x/parallel" -) - -const ( - initialBatchSize = 8 - growthFactor = 2 -) - -// NewFilterIter returns a `FilterIter` that outputs only items from the -// provided slice that are accessible: -// - by the provided user -// - via the provided relation -// - at the optional revision -// -// The provided slice value must be `[]T` where `T` implements `Checkable` or -// `CheckableAtRevision`. If `CheckableAtRevision` is implemented, the revision -// returned by `Revision()` is used instead of the optional one provided as an -// arugment to this function. -func (c *Client) NewFilterIter(slice interface{}, user *v0.User, relation string, optionalRevision *v0.Zookie) FilterIter { - return &iter{ - client: c, - user: user, - relation: relation, - revision: optionalRevision, - - batchSize: initialBatchSize, - batchIndex: 0, - unfiltered: reflect.Indirect(reflect.ValueOf(slice)), - filtered: nil, - } -} - -// Checkable represents any object that can be represented as an -// ObjectAndRelation. -type Checkable interface { - AsObjectAndRelation(relation string) *v0.ObjectAndRelation -} - -// CheckableAtRevision represents any object that can be represented at a -// specific revision. -type CheckableAtRevision interface { - Checkable - Revision() *v0.Zookie -} - -// FilterIter represents an iterator over a list of values that have been -// filtered based on access. -type FilterIter interface { - Next(context.Context) bool - Err() error - Item() interface{} -} - -type iter struct { - client *Client - user *v0.User - relation string - revision *v0.Zookie - - batchSize int - batchIndex int - unfiltered reflect.Value - filtered []interface{} - err error -} - -func (it *iter) Next(ctx context.Context) bool { - if it.err != nil { - return false - } - - if len(it.filtered) == 0 && it.batchIndex >= it.unfiltered.Len() { - return false - } - - for len(it.filtered) == 0 && it.batchIndex < it.unfiltered.Len() { - batchStartIndex := it.batchIndex - batchEndIndex := min(it.unfiltered.Len()-it.batchIndex, it.batchIndex+it.batchSize) - - it.batchIndex = batchEndIndex - it.batchSize = it.batchSize * growthFactor - - reqs := make([]*v0.CheckRequest, 0, batchEndIndex-batchStartIndex) - for i := batchStartIndex; i < batchEndIndex; i++ { - req, err := intoRequest(it.unfiltered.Index(i).Interface(), it.user, it.relation, it.revision) - if err != nil { - it.err = err - return false - } - reqs = append(reqs, req) - } - - resps, err := parallel.Check(ctx, it.client, reqs) - if err != nil { - it.err = err - return false - } - - for i, resp := range resps { - if resp.Membership == v0.CheckResponse_MEMBER { - it.filtered = append(it.filtered, it.unfiltered.Index(i+batchStartIndex).Interface()) - } - } - } - - return len(it.filtered) > 0 -} - -func (it *iter) Item() interface{} { - if it.err != nil { - panic("call to Item() when FilterIter was in an errored state") - } - - if len(it.filtered) == 0 { - panic("call to exhausted FilterIter; use Next() before calling") - } - - head := it.filtered[0] - it.filtered = it.filtered[1:] - return head -} - -func (it *iter) Err() error { return it.err } - -func intoRequest(i interface{}, user *v0.User, relation string, rev *v0.Zookie) (*v0.CheckRequest, error) { - switch x := i.(type) { - case CheckableAtRevision: - return &v0.CheckRequest{ - TestUserset: x.AsObjectAndRelation(relation), - User: user, - AtRevision: x.Revision(), - }, nil - case Checkable: - return &v0.CheckRequest{ - TestUserset: x.AsObjectAndRelation(relation), - User: user, - AtRevision: rev, - }, nil - default: - return nil, fmt.Errorf("type provided was not Checkable: %t", x) - } -} - -func min(a, b int) int { - if a < b { - return a - } - return b -} diff --git a/v0/filter_test.go b/v0/filter_test.go deleted file mode 100644 index ea14d49..0000000 --- a/v0/filter_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build TODO -// +build TODO - -package authzed - -import ( - "context" - "testing" - - v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" -) - -type doc struct { - ID string -} - -var _ Checkable = doc{} - -func (d doc) AsObjectAndRelation(relation string) *v0.ObjectAndRelation { - return &v0.ObjectAndRelation{ - Namespace: "test/document", - ObjectId: d.ID, - Relation: relation, - } -} - -func TestFilterIter(t *testing.T) { - client := setupTenant(t) - docs := []doc{{ID: "firstdoc"}, {ID: "seconddoc"}} - iter := client.NewFilterIter(docs, fred, "reader", nil) - - var allowedDocs []doc - for iter.Next(context.Background()) { - allowedDocs = append(allowedDocs, iter.Item().(doc)) - } - if err := iter.Err(); err != nil { - t.Fatal(err) - } - - if len(allowedDocs) != 1 { - t.Fatal("expected fred to only have access one item") - } - - if allowedDocs[0].ID != "firstdoc" { - t.Fatal("expected fred to only have access to firstdoc") - } -} diff --git a/v0/flatten.go b/v0/flatten.go deleted file mode 100644 index 2322c5f..0000000 --- a/v0/flatten.go +++ /dev/null @@ -1,165 +0,0 @@ -package authzed - -import ( - "fmt" - - v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" -) - -// FlattenExpand reduces an ExpandResponse into the slice of Users present in -// the expansion. -// -// Notably, this removes the context of which relations caused users to be -// included in the expansion, but often you only need to know which users are -// present. -func FlattenExpand(resp *v0.ExpandResponse) ([]*v0.User, error) { return flatten(resp.TreeNode), nil } - -func flatten(node *v0.RelationTupleTreeNode) []*v0.User { - switch typed := node.NodeType.(type) { - case *v0.RelationTupleTreeNode_IntermediateNode: - switch typed.IntermediateNode.Operation { - case v0.SetOperationUserset_UNION: - return flattenUnion(typed.IntermediateNode.ChildNodes) - case v0.SetOperationUserset_INTERSECTION: - return flattenIntersection(typed.IntermediateNode.ChildNodes) - case v0.SetOperationUserset_EXCLUSION: - return flattenExclusion(typed.IntermediateNode.ChildNodes) - } - case *v0.RelationTupleTreeNode_LeafNode: - users := newUserSet() - users.add(typed.LeafNode.Users...) - return users.toSlice() - } - return nil -} - -func flattenUnion(children []*v0.RelationTupleTreeNode) []*v0.User { - users := newUserSet() - for _, child := range children { - users.add(flatten(child)...) - } - return users.toSlice() -} - -func flattenIntersection(children []*v0.RelationTupleTreeNode) []*v0.User { - firstChildChildren := flatten(children[0]) - - if len(children) == 1 { - return firstChildChildren - } - - inOthers := newUserSet() - inOthers.add(flattenIntersection(children[1:])...) - - maxChildren := len(firstChildChildren) - if len(inOthers) < maxChildren { - maxChildren = len(inOthers) - } - - toReturn := make([]*v0.User, 0, maxChildren) - for _, child := range firstChildChildren { - if inOthers.contains(child) { - toReturn = append(toReturn, child) - } - } - - return toReturn -} - -func flattenExclusion(children []*v0.RelationTupleTreeNode) []*v0.User { - firstChildChildren := flatten(children[0]) - - if len(children) == 1 || len(firstChildChildren) == 0 { - return firstChildChildren - } - - users := newUserSet() - users.add(firstChildChildren...) - for _, child := range children[1:] { - users.remove(flatten(child)...) - } - - return users.toSlice() -} - -func leaf(start *v0.ObjectAndRelation, children ...*v0.User) *v0.RelationTupleTreeNode { - return &v0.RelationTupleTreeNode{ - NodeType: &v0.RelationTupleTreeNode_LeafNode{ - LeafNode: &v0.DirectUserset{ - Users: children, - }, - }, - Expanded: start, - } -} - -func setResult( - op v0.SetOperationUserset_Operation, - start *v0.ObjectAndRelation, - children []*v0.RelationTupleTreeNode, -) *v0.RelationTupleTreeNode { - return &v0.RelationTupleTreeNode{ - NodeType: &v0.RelationTupleTreeNode_IntermediateNode{ - IntermediateNode: &v0.SetOperationUserset{ - Operation: op, - ChildNodes: children, - }, - }, - Expanded: start, - } -} - -func union(start *v0.ObjectAndRelation, children ...*v0.RelationTupleTreeNode) *v0.RelationTupleTreeNode { - return setResult(v0.SetOperationUserset_UNION, start, children) -} - -func intersection(start *v0.ObjectAndRelation, children ...*v0.RelationTupleTreeNode) *v0.RelationTupleTreeNode { - return setResult(v0.SetOperationUserset_INTERSECTION, start, children) -} - -func exclusion(start *v0.ObjectAndRelation, children ...*v0.RelationTupleTreeNode) *v0.RelationTupleTreeNode { - return setResult(v0.SetOperationUserset_EXCLUSION, start, children) -} - -type userSet map[string]struct{} - -func newUserSet() userSet { - return make(map[string]struct{}) -} - -func (us userSet) add(users ...*v0.User) { - for _, usr := range users { - us[toKey(usr)] = struct{}{} - } -} - -func (us userSet) contains(usr *v0.User) bool { - _, ok := us[toKey(usr)] - return ok -} - -func (us userSet) remove(users ...*v0.User) { - for _, usr := range users { - delete(us, toKey(usr)) - } -} - -func (us userSet) toSlice() []*v0.User { - users := make([]*v0.User, 0, len(us)) - for key := range us { - users = append(users, fromKey(key)) - } - return users -} - -func toKey(usr *v0.User) string { - return fmt.Sprintf("%s %s %s", usr.GetUserset().Namespace, usr.GetUserset().ObjectId, usr.GetUserset().Relation) -} - -func fromKey(key string) *v0.User { - userset := &v0.ObjectAndRelation{} - fmt.Sscanf(key, "%s %s %s", &userset.Namespace, &userset.ObjectId, &userset.Relation) - return &v0.User{ - UserOneof: &v0.User_Userset{Userset: userset}, - } -} diff --git a/v0/flatten_test.go b/v0/flatten_test.go deleted file mode 100644 index eadfc7a..0000000 --- a/v0/flatten_test.go +++ /dev/null @@ -1,134 +0,0 @@ -package authzed - -import ( - "testing" - - v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" -) - -func user(namespace, object, relation string) *v0.User { - return &v0.User{UserOneof: &v0.User_Userset{Userset: onr(namespace, object, relation)}} -} - -func onr(namespace, object, relation string) *v0.ObjectAndRelation { - return &v0.ObjectAndRelation{ - Namespace: namespace, - ObjectId: object, - Relation: relation, - } -} - -func TestFlatten(t *testing.T) { - testCases := []struct { - name string - tree *v0.RelationTupleTreeNode - expected []*v0.ObjectAndRelation - }{ - { - "simple leaf", - leaf(nil, user("user", "user1", "...")), - []*v0.ObjectAndRelation{onr("user", "user1", "...")}, - }, - { - "simple union", - union(nil, - leaf(nil, user("user", "user1", "...")), - leaf(nil, user("user", "user2", "...")), - leaf(nil, user("user", "user3", "...")), - ), - []*v0.ObjectAndRelation{ - onr("user", "user1", "..."), - onr("user", "user2", "..."), - onr("user", "user3", "..."), - }, - }, - { - "simple intersection", - intersection(nil, - leaf(nil, - user("user", "user1", "..."), - user("user", "user2", "..."), - ), - leaf(nil, - user("user", "user2", "..."), - user("user", "user3", "..."), - ), - leaf(nil, - user("user", "user2", "..."), - user("user", "user4", "..."), - ), - ), - []*v0.ObjectAndRelation{onr("user", "user2", "...")}, - }, - { - "empty intersection", - intersection(nil, - leaf(nil, - user("user", "user1", "..."), - user("user", "user2", "..."), - ), - leaf(nil, - user("user", "user3", "..."), - user("user", "user4", "..."), - ), - ), - []*v0.ObjectAndRelation{}, - }, - { - "simple exclusion", - exclusion(nil, - leaf(nil, - user("user", "user1", "..."), - user("user", "user2", "..."), - ), - leaf(nil, user("user", "user2", "...")), - leaf(nil, user("user", "user3", "...")), - ), - []*v0.ObjectAndRelation{onr("user", "user1", "...")}, - }, - { - "empty exclusion", - exclusion(nil, - leaf(nil, - user("user", "user1", "..."), - user("user", "user2", "..."), - ), - leaf(nil, user("user", "user1", "...")), - leaf(nil, user("user", "user2", "...")), - ), - []*v0.ObjectAndRelation{}, - }, - { - "nested union", - union(nil, - leaf(nil, user("user", "user1", "...")), - union(nil, leaf(nil, user("user", "user2", "..."))), - ), - []*v0.ObjectAndRelation{ - onr("user", "user1", "..."), - onr("user", "user2", "..."), - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - var flattened userSet = make(map[string]struct{}) - flattened.add(flatten(tc.tree)...) - - for _, onr := range tc.expected { - usr := user(onr.Namespace, onr.ObjectId, onr.Relation) - if !flattened.contains(usr) { - t.Fatalf("flattened tree failed to contain expected user: %s", usr) - } - flattened.remove(usr) - } - - if len(flattened) != 0 { - t.Fatalf("additional users found in flattened tree: %s", flattened) - } - }) - } -} diff --git a/v0/integration_test.go b/v0/integration_test.go deleted file mode 100644 index 324096b..0000000 --- a/v0/integration_test.go +++ /dev/null @@ -1,70 +0,0 @@ -//go:build TODO -// +build TODO - -package authzed - -import ( - "context" - "sync" - "testing" - - "google.golang.org/grpc" - - v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" - "github.com/authzed/authzed-go/v0/x/nsbuilder" -) - -var setupOnce sync.Once - -var ( - namespaceUser = nsbuilder.Namespace("test/user") - namespaceDoc = nsbuilder.Namespace("test/document", - nsbuilder.Relation("writer", nil), - nsbuilder.Relation("reader", nsbuilder.Union(nsbuilder.This(), nsbuilder.ComputedUserset("writer"))), - ) -) - -var fred = &v0.User{UserOneof: &v0.User_Userset{ - Userset: &v0.ObjectAndRelation{ - Namespace: "test/user", - ObjectId: "fred", - Relation: "...", - }, -}} - -func setupTenant(t *testing.T) *Client { - client, err := NewClient("localhost:50051", grpc.WithInsecure()) - if err != nil { - t.Fatal(err) - } - - setupOnce.Do(func() { - if _, err := client.WriteConfig(context.Background(), &v0.WriteConfigRequest{Configs: []*v0.NamespaceDefinition{ - namespaceUser, - namespaceDoc, - }}); err != nil { - t.Fatal(err) - } - - _, err := client.Write(context.Background(), &v0.WriteRequest{ - Updates: []*v0.RelationTupleUpdate{ - { - Operation: v0.RelationTupleUpdate_CREATE, - Tuple: &v0.RelationTuple{ - ObjectAndRelation: &v0.ObjectAndRelation{ - Namespace: "test/document", - ObjectId: "firstdoc", - Relation: "writer", - }, - User: fred, - }, - }, - }, - }) - if err != nil { - t.Fatal(err) - } - }) - - return client -} diff --git a/v0/x/nsbuilder/nsbuilder.go b/v0/x/nsbuilder/nsbuilder.go deleted file mode 100644 index 0a5a2b6..0000000 --- a/v0/x/nsbuilder/nsbuilder.go +++ /dev/null @@ -1,93 +0,0 @@ -// Package nsbuilder implements a builder-pattern for defining Authzed -// Namespaces. -package nsbuilder - -import v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" - -// Namespace creates a namespace definition with one or more defined relations. -func Namespace(name string, relations ...*v0.Relation) *v0.NamespaceDefinition { - return &v0.NamespaceDefinition{ - Name: name, - Relation: relations, - } -} - -// Relation creates a relation definition with an optional rewrite definition. -func Relation(name string, rewrite *v0.UsersetRewrite) *v0.Relation { - return &v0.Relation{ - Name: name, - UsersetRewrite: rewrite, - } -} - -// Union creates a rewrite definition that combines/considers usersets in all children. -func Union(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite { - return &v0.UsersetRewrite{ - RewriteOperation: &v0.UsersetRewrite_Union{ - Union: setOperation(firstChild, rest), - }, - } -} - -// Intersection creates a rewrite definition that returns/considers only usersets present in all children. -func Intersection(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite { - return &v0.UsersetRewrite{ - RewriteOperation: &v0.UsersetRewrite_Intersection{ - Intersection: setOperation(firstChild, rest), - }, - } -} - -// Exclusion creates a rewrite definition that starts with the usersets of the first child -// and iteratively removes usersets that appear in the remaining children. -func Exclusion(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite { - return &v0.UsersetRewrite{ - RewriteOperation: &v0.UsersetRewrite_Exclusion{ - Exclusion: setOperation(firstChild, rest), - }, - } -} - -func setOperation(firstChild *v0.SetOperation_Child, rest []*v0.SetOperation_Child) *v0.SetOperation { - children := append([]*v0.SetOperation_Child{firstChild}, rest...) - return &v0.SetOperation{ - Child: children, - } -} - -// This creates a child for a set operation that references only direct usersets with the parent relation. -func This() *v0.SetOperation_Child { - return &v0.SetOperation_Child{ - ChildType: &v0.SetOperation_Child_XThis{}, - } -} - -// ComputedUserset creates a child for a set operation that follows a relation on the given starting object. -func ComputedUserset(relation string) *v0.SetOperation_Child { - return &v0.SetOperation_Child{ - ChildType: &v0.SetOperation_Child_ComputedUserset{ - ComputedUserset: &v0.ComputedUserset{ - Relation: relation, - }, - }, - } -} - -// TupleToUserset creates a child which first loads all tuples with the specific relation, -// and then unions all children on the usersets found by following a relation on those loaded -// tuples. -func TupleToUserset(tuplesetRelation, usersetRelation string) *v0.SetOperation_Child { - return &v0.SetOperation_Child{ - ChildType: &v0.SetOperation_Child_TupleToUserset{ - TupleToUserset: &v0.TupleToUserset{ - Tupleset: &v0.TupleToUserset_Tupleset{ - Relation: tuplesetRelation, - }, - ComputedUserset: &v0.ComputedUserset{ - Relation: usersetRelation, - Object: v0.ComputedUserset_TUPLE_USERSET_OBJECT, - }, - }, - }, - } -} diff --git a/v0/x/parallel/parallel.go b/v0/x/parallel/parallel.go deleted file mode 100644 index 2853a56..0000000 --- a/v0/x/parallel/parallel.go +++ /dev/null @@ -1,62 +0,0 @@ -// Package parallel implements experimental utilities for performing parallel -// client interactions with the Authzed API. -package parallel - -import ( - "context" - - "google.golang.org/grpc" - - "github.com/authzed/authzed-go/internal/ctxgroup" - v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" -) - -// Check performs the provided list of CheckRequests in parallel and returns -// a slice of responses that are stored at their respective indices. -func Check(ctx context.Context, client v0.ACLServiceClient, in []*v0.CheckRequest, opts ...grpc.CallOption) ([]*v0.CheckResponse, error) { - results := make([]*v0.CheckResponse, len(in)) - g := ctxgroup.WithContext(ctx) - for i, request := range in { - i, request := i, request // close over the value that will not change - g.GoCtx(func(ctx context.Context) (err error) { - results[i], err = client.Check(ctx, request, opts...) - return err - }) - } - - if err := g.Wait(); err != nil { - return nil, err - } - return results, nil -} - -// ContentChangeCheck performs the provided list of ContentChangeCheckRequests -// in parallel and returns a slice of responses that are stored at their -// respective indices. -func ContentChangeCheck(ctx context.Context, client v0.ACLServiceClient, in []*v0.ContentChangeCheckRequest, opts ...grpc.CallOption) ([]*v0.CheckResponse, error) { - results := make([]*v0.CheckResponse, len(in)) - g := ctxgroup.WithContext(ctx) - for i, request := range in { - i, request := i, request // close over the value that will not change - g.GoCtx(func(ctx context.Context) (err error) { - results[i], err = client.ContentChangeCheck(ctx, request, opts...) - return err - }) - } - - if err := g.Wait(); err != nil { - return nil, err - } - return results, nil -} - -// AllChecksAreMember returns true if every provided CheckResponse has -// membership. -func AllChecksAreMember(resps []*v0.CheckResponse) bool { - for _, resp := range resps { - if resp.Membership != v0.CheckResponse_MEMBER { - return false - } - } - return true -} From 38dad0ec99778a2c19fcb70f41a349b56eef19f3 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 6 Jun 2022 13:15:23 -0400 Subject: [PATCH 2/3] Upgrade to buf 1.3.1 --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1f7c265..fb5d018 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -48,6 +48,6 @@ jobs: - uses: "actions/checkout@v2" - uses: "bufbuild/buf-setup-action@v0.6.0" with: - version: "1.0.0-rc12" + version: "1.3.1" - name: "Generate & Diff Protos" run: "./buf.gen.yaml && git diff --text && bash -c '[ $(git status --porcelain | tee /dev/fd/2 | wc -c) -eq 0 ]'" From 6d1c60d578158bd6cc36a130d35ea8e0199a57e8 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 6 Jun 2022 13:30:12 -0400 Subject: [PATCH 3/3] Update protoc-gen-validate --- .github/workflows/build.yaml | 2 +- go.mod | 3 +-- go.sum | 14 ++++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fb5d018..77c8e21 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -44,7 +44,7 @@ jobs: with: go-version: "^1.16" - name: "Install local Go Protobuf plugins" - run: "go install github.com/envoyproxy/protoc-gen-validate@v0.6.1" + run: "go install github.com/envoyproxy/protoc-gen-validate@v0.6.7" - uses: "actions/checkout@v2" - uses: "bufbuild/buf-setup-action@v0.6.0" with: diff --git a/go.mod b/go.mod index cf1b9ec..52757d0 100644 --- a/go.mod +++ b/go.mod @@ -4,14 +4,13 @@ go 1.16 require ( github.com/authzed/grpcutil v0.0.0-20210913124023-cad23ae5a9e8 - github.com/envoyproxy/protoc-gen-validate v0.6.1 + github.com/envoyproxy/protoc-gen-validate v0.6.7 github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 github.com/jzelinskie/stringz v0.0.0-20210414224931-d6a8ce844a70 github.com/stretchr/testify v1.7.0 golang.org/x/net v0.0.0-20210913180222-943fd674d43e // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0 // indirect - golang.org/x/text v0.3.7 // indirect google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 diff --git a/go.sum b/go.sum index 06c68c8..49091c2 100644 --- a/go.sum +++ b/go.sum @@ -56,8 +56,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.6.1 h1:4CF52PCseTFt4bE+Yk3dIpdVi7XWuPVMhPtm4FaIJPM= -github.com/envoyproxy/protoc-gen-validate v0.6.1/go.mod h1:txg5va2Qkip90uYoSKH+nkAAmXrb2j3iq4FLwdrCbXQ= +github.com/envoyproxy/protoc-gen-validate v0.6.7 h1:qcZcULcd/abmQg6dwigimCNEyi4gg31M/xaciQlDml8= +github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -129,7 +129,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 h1:rgxjzoDmDXw5q8HONgyHhBas4to0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0/go.mod h1:qrJPVzv9YlhsrxJc3P/Q85nr0w1lIRikTl4JlhdDH5w= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/iancoleman/strcase v0.0.0-20180726023541-3605ed457bf7/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= @@ -145,7 +145,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lyft/protoc-gen-star v0.5.1/go.mod h1:9toiA3cC7z5uVbODF7kEQ91Xn7XNFkVUl+SrEe+ZORU= +github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= @@ -157,7 +157,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.3.4/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -218,6 +218,7 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB 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.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= 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-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -246,6 +247,7 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210913180222-943fd674d43e h1:+b/22bPvDYt4NPDcy4xAGCmON713ONAWFeY3Z7I3tR8= golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -297,6 +299,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w 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-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0 h1:xrCZDmdtoloIiooiA9q0OQb9r8HejIHYoHGhGCe1pGg= golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -348,7 +351,6 @@ golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=