Skip to content

Commit

Permalink
Run buf format
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Nov 21, 2024
1 parent 439b86d commit 589873c
Show file tree
Hide file tree
Showing 15 changed files with 523 additions and 523 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: "https://github.com/bufbuild/buf"
rev: "v1.6.0"
rev: "v1.47.2"
hooks:
- id: "buf-lint"
- repo: "https://github.com/adrienverge/yamllint.git"
Expand Down
2 changes: 1 addition & 1 deletion authzed/api/materialize/v0/watchpermissions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package authzed.api.materialize.v0;
import "authzed/api/v1/core.proto";

option go_package = "github.com/authzed/authzed-go/proto/authzed/api/materialize/v0";
option java_package = "com.authzed.api.materialize.v0";
option java_multiple_files = true;
option java_package = "com.authzed.api.materialize.v0";

service WatchPermissionsService {
// WatchPermissions returns a stream of PermissionChange events for the given permissions.
Expand Down
28 changes: 14 additions & 14 deletions authzed/api/materialize/v0/watchpermissionsets.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package authzed.api.materialize.v0;
import "authzed/api/v1/core.proto";

option go_package = "github.com/authzed/authzed-go/proto/authzed/api/materialize/v0";
option java_package = "com.authzed.api.materialize.v0";
option java_multiple_files = true;
option java_package = "com.authzed.api.materialize.v0";

service WatchPermissionSetsService {
// WatchPermissionSets returns a stream of changes to the sets which can be used to compute the watched permissions.
Expand Down Expand Up @@ -55,7 +55,7 @@ service WatchPermissionSetsService {
// and the revision token from the last LookupPermissionSets response.
rpc LookupPermissionSets(LookupPermissionSetsRequest) returns (stream LookupPermissionSetsResponse) {}
}

message WatchPermissionSetsRequest {
// optional_starting_after is used to specify the SpiceDB revision to start watching from.
// If not specified, the watch will start from the current SpiceDB revision time of the request ("head revision").
Expand Down Expand Up @@ -152,21 +152,21 @@ message PermissionSetChange {
}

message SetReference {
// object_type is the type of object in a permission set
string object_type = 1;
// object_id is the ID of a permission set
string object_id = 2;
// permission_or_relation is the permission or relation referenced by this permission set
string permission_or_relation = 3;
// object_type is the type of object in a permission set
string object_type = 1;
// object_id is the ID of a permission set
string object_id = 2;
// permission_or_relation is the permission or relation referenced by this permission set
string permission_or_relation = 3;
}

message MemberReference {
// object_type is the type of object of a permission set member
string object_type = 1;
// object_id is the ID of a permission set member
string object_id = 2;
// optional_permission_or_relation is the permission or relation referenced by this permission set member
string optional_permission_or_relation = 3;
// object_type is the type of object of a permission set member
string object_type = 1;
// object_id is the ID of a permission set member
string object_id = 2;
// optional_permission_or_relation is the permission or relation referenced by this permission set member
string optional_permission_or_relation = 3;
}

// LookupPermissionSetsRequired is a signal that the consumer should perform a LookupPermissionSets call because
Expand Down
53 changes: 26 additions & 27 deletions authzed/api/v0/core.proto
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
syntax = "proto3";
package authzed.api.v0;

import "validate/validate.proto";

option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v0";
option java_package = "com.authzed.api.v0";

import "validate/validate.proto";

message RelationTuple {
// Each tupleset specifies keys of a set of relation tuples. The set can
// include a single tuple key, or all tuples with a given object ID or
Expand All @@ -18,41 +18,40 @@ message RelationTuple {
// doc:12345#writer#* (all tuples with direct write relationship with the
// document) doc:#writer#group:eng#member (all tuples that eng group has write
// relationship)
ObjectAndRelation object_and_relation = 1
[ (validate.rules).message.required = true ];
User user = 2 [ (validate.rules).message.required = true ];
ObjectAndRelation object_and_relation = 1 [(validate.rules).message.required = true];
User user = 2 [(validate.rules).message.required = true];
}

message ObjectAndRelation {
string namespace = 1 [ (validate.rules).string = {
pattern : "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$",
max_bytes : 128,
} ];
string object_id = 2 [ (validate.rules).string = {
pattern : "^(([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})|\\*)$",
max_bytes : 128,
} ];
string relation = 3 [ (validate.rules).string = {
pattern : "^(\\.\\.\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$",
max_bytes : 64,
} ];
string namespace = 1 [(validate.rules).string = {
pattern: "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$"
max_bytes: 128
}];
string object_id = 2 [(validate.rules).string = {
pattern: "^(([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})|\\*)$"
max_bytes: 128
}];
string relation = 3 [(validate.rules).string = {
pattern: "^(\\.\\.\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$"
max_bytes: 64
}];
}

message RelationReference {
string namespace = 1 [ (validate.rules).string = {
pattern : "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$",
max_bytes : 128,
} ];
string relation = 3 [ (validate.rules).string = {
pattern : "^(\\.\\.\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$",
max_bytes : 64,
} ];
string namespace = 1 [(validate.rules).string = {
pattern: "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)?[a-z][a-z0-9_]{1,62}[a-z0-9]$"
max_bytes: 128
}];
string relation = 3 [(validate.rules).string = {
pattern: "^(\\.\\.\\.|[a-z][a-z0-9_]{1,62}[a-z0-9])$"
max_bytes: 64
}];
}

message User {
oneof user_oneof {
option (validate.required) = true;

ObjectAndRelation userset = 2 [ (validate.rules).message.required = true ];
ObjectAndRelation userset = 2 [(validate.rules).message.required = true];
}
}
}
6 changes: 3 additions & 3 deletions authzed/api/v0/developer.proto
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
syntax = "proto3";
package authzed.api.v0;

import "authzed/api/v0/core.proto";

option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v0";
option java_package = "com.authzed.api.v0";

import "authzed/api/v0/core.proto";

service DeveloperService {
rpc EditCheck(EditCheckRequest) returns (EditCheckResponse) {}
rpc Validate(ValidateRequest) returns (ValidateResponse) {}
Expand Down Expand Up @@ -126,7 +126,7 @@ message DeveloperError {
uint32 column = 3;
Source source = 4;
ErrorKind kind = 5;

repeated string path = 6;

// context holds the context for the error. For schema issues, this will be the
Expand Down
89 changes: 47 additions & 42 deletions authzed/api/v1/core.proto
Original file line number Diff line number Diff line change
@@ -1,90 +1,87 @@
syntax = "proto3";
package authzed.api.v1;

option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1";
option java_package = "com.authzed.api.v1";
option java_multiple_files = true;

import "google/protobuf/struct.proto";
import "validate/validate.proto";

option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1";
option java_multiple_files = true;
option java_package = "com.authzed.api.v1";

// Relationship specifies how a resource relates to a subject. Relationships
// form the data for the graph over which all permissions questions are
// answered.
message Relationship {
// resource is the resource to which the subject is related, in some manner
ObjectReference resource = 1 [ (validate.rules).message.required = true ];
ObjectReference resource = 1 [(validate.rules).message.required = true];

// relation is how the resource and subject are related.
string relation = 2 [ (validate.rules).string = {
pattern : "^[a-z][a-z0-9_]{1,62}[a-z0-9]$",
max_bytes : 64,
} ];
string relation = 2 [(validate.rules).string = {
pattern: "^[a-z][a-z0-9_]{1,62}[a-z0-9]$"
max_bytes: 64
}];

// subject is the subject to which the resource is related, in some manner.
SubjectReference subject = 3 [ (validate.rules).message.required = true ];
SubjectReference subject = 3 [(validate.rules).message.required = true];

// optional_caveat is a reference to a the caveat that must be enforced over the relationship
ContextualizedCaveat optional_caveat = 4 [ (validate.rules).message.required = false ];
ContextualizedCaveat optional_caveat = 4 [(validate.rules).message.required = false];
}

// ContextualizedCaveat represents a reference to a caveat to be used by caveated relationships.
// The context consists of key-value pairs that will be injected at evaluation time.
// The keys must match the arguments defined on the caveat in the schema.
message ContextualizedCaveat {
// caveat_name is the name of the caveat expression to use, as defined in the schema
string caveat_name = 1 [ (validate.rules).string = {
pattern : "^([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})$",
max_bytes : 128,
} ];
string caveat_name = 1 [(validate.rules).string = {
pattern: "^([a-zA-Z0-9_][a-zA-Z0-9/_|-]{0,127})$"
max_bytes: 128
}];

// context consists of any named values that are defined at write time for the caveat expression
google.protobuf.Struct context = 2 [ (validate.rules).message.required = false ];
google.protobuf.Struct context = 2 [(validate.rules).message.required = false];
}

// SubjectReference is used for referring to the subject portion of a
// Relationship. The relation component is optional and is used for defining a
// sub-relation on the subject, e.g. group:123#members
message SubjectReference {
ObjectReference object = 1 [ (validate.rules).message.required = true ];
string optional_relation = 2 [ (validate.rules).string = {
pattern : "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$",
max_bytes : 64,
} ];
ObjectReference object = 1 [(validate.rules).message.required = true];
string optional_relation = 2 [(validate.rules).string = {
pattern: "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$"
max_bytes: 64
}];
}

// ObjectReference is used to refer to a specific object in the system.
message ObjectReference {
string object_type = 1 [ (validate.rules).string = {
pattern : "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)*[a-z][a-z0-9_]{1,62}[a-z0-9]$",
max_bytes : 128,
} ];
string object_id = 2 [ (validate.rules).string = {
pattern : "^(([a-zA-Z0-9/_|\\-=+]{1,})|\\*)$",
max_bytes : 1024,
} ];
string object_type = 1 [(validate.rules).string = {
pattern: "^([a-z][a-z0-9_]{1,61}[a-z0-9]/)*[a-z][a-z0-9_]{1,62}[a-z0-9]$"
max_bytes: 128
}];
string object_id = 2 [(validate.rules).string = {
pattern: "^(([a-zA-Z0-9/_|\\-=+]{1,})|\\*)$"
max_bytes: 1024
}];
}

// ZedToken is used to provide causality metadata between Write and Check
// requests.
//
// See the authzed.api.v1.Consistency message for more information.
message ZedToken {
string token = 1 [ (validate.rules).string = {
min_bytes : 1,
} ];
string token = 1 [(validate.rules).string = {min_bytes: 1}];
}

// Cursor is used to provide resumption of listing between calls to APIs
// such as LookupResources.
message Cursor {
string token = 1 [ (validate.rules).string = {
min_bytes : 1,
max_bytes : 102400,
} ];
string token = 1 [(validate.rules).string = {
min_bytes: 1
max_bytes: 102400
}];
}


// RelationshipUpdate is used for mutating a single relationship within the
// service.
//
Expand All @@ -103,8 +100,11 @@ message RelationshipUpdate {
OPERATION_TOUCH = 2;
OPERATION_DELETE = 3;
}
Operation operation = 1 [ (validate.rules).enum = {defined_only: true, not_in: [0]} ];
Relationship relationship = 2 [ (validate.rules).message.required = true ];
Operation operation = 1 [(validate.rules).enum = {
defined_only: true
not_in: [0]
}];
Relationship relationship = 2 [(validate.rules).message.required = true];
}

// PermissionRelationshipTree is used for representing a tree of a resource and
Expand Down Expand Up @@ -138,12 +138,17 @@ message AlgebraicSubjectSet {
OPERATION_EXCLUSION = 3;
}

Operation operation = 1 [ (validate.rules).enum = {defined_only: true, not_in: [0]} ];
repeated PermissionRelationshipTree children = 2 [ (validate.rules).repeated.items.message.required = true ];
Operation operation = 1 [(validate.rules).enum = {
defined_only: true
not_in: [0]
}];
repeated PermissionRelationshipTree children = 2 [(validate.rules).repeated.items.message.required = true];
}

// DirectSubjectSet is a subject set which is simply a collection of subjects.
message DirectSubjectSet { repeated SubjectReference subjects = 1; }
message DirectSubjectSet {
repeated SubjectReference subjects = 1;
}

// PartialCaveatInfo carries information necessary for the client to take action
// in the event a response contains a partially evaluated caveat
Expand Down
24 changes: 15 additions & 9 deletions authzed/api/v1/debug.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ syntax = "proto3";
package authzed.api.v1;

import "authzed/api/v1/core.proto";
import "validate/validate.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
import "validate/validate.proto";

option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1";
option java_package = "com.authzed.api.v1";
option java_multiple_files = true;
option java_package = "com.authzed.api.v1";

// DebugInformation defines debug information returned by an API call in a footer when
// requested with a specific debugging header.
Expand Down Expand Up @@ -45,21 +45,27 @@ message CheckDebugTrace {
}

// resource holds the resource on which the Check was performed.
ObjectReference resource = 1 [ (validate.rules).message.required = true ];
ObjectReference resource = 1 [(validate.rules).message.required = true];

// permission holds the name of the permission or relation on which the Check was performed.
string permission = 2;

// permission_type holds information indicating whether it was a permission or relation.
PermissionType permission_type = 3 [ (validate.rules).enum = {defined_only: true, not_in: [0]} ];
PermissionType permission_type = 3 [(validate.rules).enum = {
defined_only: true
not_in: [0]
}];

// subject holds the subject on which the Check was performed. This will be static across all calls within
// the same Check tree.
SubjectReference subject = 4 [ (validate.rules).message.required = true ];
SubjectReference subject = 4 [(validate.rules).message.required = true];

// result holds the result of the Check call.
Permissionship result = 5 [ (validate.rules).enum = {defined_only: true, not_in: [0]} ];

Permissionship result = 5 [(validate.rules).enum = {
defined_only: true
not_in: [0]
}];

// caveat_evaluation_info holds information about the caveat evaluated for this step of the trace.
CaveatEvalInfo caveat_evaluation_info = 8;

Expand Down Expand Up @@ -105,4 +111,4 @@ message CaveatEvalInfo {

// caveat_name is the name of the caveat that was executed, if applicable.
string caveat_name = 5;
}
}
Loading

0 comments on commit 589873c

Please sign in to comment.