aboutsummaryrefslogtreecommitdiff
path: root/crates/secd/proto/authzed/api/v1/error_reason.proto
blob: 401a3d0a9777cd13bd1d87b5070273b21b7d5d61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
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";

// Defines the supported values for `google.rpc.ErrorInfo.reason` for the
// `authzed.com` error domain.
enum ErrorReason {
  // Do not use this default value.
  ERROR_REASON_UNSPECIFIED = 0;

  // The request gave a schema that could not be parsed.
  //
  // Example of an ErrorInfo:
  //
  //     { 
  //       "reason": "ERROR_REASON_SCHEMA_PARSE_ERROR",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "start_line_number": "1",
  //         "start_column_position": "19",
  //         "end_line_number": "1",
  //         "end_column_position": "19",
  //         "source_code": "somedefinition",
  //       }
  //     }
  //
  // The line numbers and column positions are 0-indexed and may not be present.
  ERROR_REASON_SCHEMA_PARSE_ERROR = 1;

  // The request contains a schema with a type error.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_SCHEMA_TYPE_ERROR",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "definition_name": "somedefinition",
  //         ... additional keys based on the kind of type error ...
  //       }
  //     }
  ERROR_REASON_SCHEMA_TYPE_ERROR = 2;

  // The request referenced an unknown object definition in the schema.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_UNKNOWN_DEFINITION",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "definition_name": "somedefinition"
  //       }
  //     }
  ERROR_REASON_UNKNOWN_DEFINITION = 3;

  // The request referenced an unknown relation or permission under a definition in the schema.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_UNKNOWN_RELATION_OR_PERMISSION",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "definition_name": "somedefinition",
  //         "relation_or_permission_name": "somepermission"
  //       }
  //     }
  ERROR_REASON_UNKNOWN_RELATION_OR_PERMISSION = 4;

  // The WriteRelationships request contained more updates than the maximum configured.
  //
  // Example of an ErrorInfo:
  //
  //     { "reason": "ERROR_REASON_TOO_MANY_UPDATES_IN_REQUEST",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "update_count": "525",
  //         "maximum_updates_allowed": "500",
  //       }
  //     }
  ERROR_REASON_TOO_MANY_UPDATES_IN_REQUEST = 5;

  // The request contained more preconditions than the maximum configured.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_TOO_MANY_PRECONDITIONS_IN_REQUEST",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "precondition_count": "525",
  //         "maximum_preconditions_allowed": "500",
  //       }
  //     }
  ERROR_REASON_TOO_MANY_PRECONDITIONS_IN_REQUEST = 6;

  // The request contained a precondition that failed.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_WRITE_OR_DELETE_PRECONDITION_FAILURE",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "precondition_resource_type": "document",
  //         ... other fields for the filter ...
  //         "precondition_operation": "MUST_EXIST",
  //       }
  //     }
  ERROR_REASON_WRITE_OR_DELETE_PRECONDITION_FAILURE = 7;

  // A write or delete request was made to an instance that is deployed in read-only mode.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_SERVICE_READ_ONLY",
  //       "domain": "authzed.com"
  //     }
  ERROR_REASON_SERVICE_READ_ONLY = 8;

  // The request referenced an unknown caveat in the schema.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_UNKNOWN_CAVEAT",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "caveat_name": "somecaveat"
  //       }
  //     }
  ERROR_REASON_UNKNOWN_CAVEAT = 9;

  // The request tries to use a subject type that was not valid for a relation.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_INVALID_SUBJECT_TYPE",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "definition_name": "somedefinition",
  //         "relation_name": "somerelation",
  //         "subject_type": "user:*"
  //       }
  //     }
  ERROR_REASON_INVALID_SUBJECT_TYPE = 10;

  // The request tries to specify a caveat parameter value with the wrong type.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_CAVEAT_PARAMETER_TYPE_ERROR",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "definition_name": "somedefinition",
  //         "relation_name": "somerelation",
  //         "caveat_name": "somecaveat",
  //         "parameter_name": "someparameter",
  //         "expected_type": "int",
  //       }
  //     }
  ERROR_REASON_CAVEAT_PARAMETER_TYPE_ERROR = 11;

  // The request tries to perform two or more updates on the same relationship in the same WriteRelationships call.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_UPDATES_ON_SAME_RELATIONSHIP",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "definition_name": "somedefinition",
  //         "relationship": "somerelationship",
  //       }
  //     }
  ERROR_REASON_UPDATES_ON_SAME_RELATIONSHIP = 12;

  // The request tries to write a relationship on a permission instead of a relation.
  //
  // Example of an ErrorInfo:
  //
  //     {  
  //       "reason": "ERROR_REASON_CANNOT_UPDATE_PERMISSION",
  //       "domain": "authzed.com",
  //       "metadata": {
  //         "definition_name": "somedefinition",
  //         "permission_name": "somerelation",
  //       }
  //     }
  ERROR_REASON_CANNOT_UPDATE_PERMISSION = 13;
}