forked from authzed/authzed-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
permission_service_grpc.pb.go
449 lines (404 loc) · 18.7 KB
/
permission_service_grpc.pb.go
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: authzed/api/v1/permission_service.proto
package v1
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
const (
PermissionsService_ReadRelationships_FullMethodName = "/authzed.api.v1.PermissionsService/ReadRelationships"
PermissionsService_WriteRelationships_FullMethodName = "/authzed.api.v1.PermissionsService/WriteRelationships"
PermissionsService_DeleteRelationships_FullMethodName = "/authzed.api.v1.PermissionsService/DeleteRelationships"
PermissionsService_CheckPermission_FullMethodName = "/authzed.api.v1.PermissionsService/CheckPermission"
PermissionsService_ExpandPermissionTree_FullMethodName = "/authzed.api.v1.PermissionsService/ExpandPermissionTree"
PermissionsService_LookupResources_FullMethodName = "/authzed.api.v1.PermissionsService/LookupResources"
PermissionsService_LookupSubjects_FullMethodName = "/authzed.api.v1.PermissionsService/LookupSubjects"
)
// PermissionsServiceClient is the client API for PermissionsService 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 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 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 atomically bulk deletes all relationships matching the
// provided filter. If no relationships match, none will be deleted and the
// operation will succeed. 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 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 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 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)
// LookupSubjects returns all the subjects of a given type that
// have access whether via a computed permission or relation membership.
LookupSubjects(ctx context.Context, in *LookupSubjectsRequest, opts ...grpc.CallOption) (PermissionsService_LookupSubjectsClient, error)
}
type permissionsServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPermissionsServiceClient(cc grpc.ClientConnInterface) PermissionsServiceClient {
return &permissionsServiceClient{cc}
}
func (c *permissionsServiceClient) ReadRelationships(ctx context.Context, in *ReadRelationshipsRequest, opts ...grpc.CallOption) (PermissionsService_ReadRelationshipsClient, error) {
stream, err := c.cc.NewStream(ctx, &PermissionsService_ServiceDesc.Streams[0], PermissionsService_ReadRelationships_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &permissionsServiceReadRelationshipsClient{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 PermissionsService_ReadRelationshipsClient interface {
Recv() (*ReadRelationshipsResponse, error)
grpc.ClientStream
}
type permissionsServiceReadRelationshipsClient struct {
grpc.ClientStream
}
func (x *permissionsServiceReadRelationshipsClient) Recv() (*ReadRelationshipsResponse, error) {
m := new(ReadRelationshipsResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *permissionsServiceClient) WriteRelationships(ctx context.Context, in *WriteRelationshipsRequest, opts ...grpc.CallOption) (*WriteRelationshipsResponse, error) {
out := new(WriteRelationshipsResponse)
err := c.cc.Invoke(ctx, PermissionsService_WriteRelationships_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *permissionsServiceClient) DeleteRelationships(ctx context.Context, in *DeleteRelationshipsRequest, opts ...grpc.CallOption) (*DeleteRelationshipsResponse, error) {
out := new(DeleteRelationshipsResponse)
err := c.cc.Invoke(ctx, PermissionsService_DeleteRelationships_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *permissionsServiceClient) CheckPermission(ctx context.Context, in *CheckPermissionRequest, opts ...grpc.CallOption) (*CheckPermissionResponse, error) {
out := new(CheckPermissionResponse)
err := c.cc.Invoke(ctx, PermissionsService_CheckPermission_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *permissionsServiceClient) ExpandPermissionTree(ctx context.Context, in *ExpandPermissionTreeRequest, opts ...grpc.CallOption) (*ExpandPermissionTreeResponse, error) {
out := new(ExpandPermissionTreeResponse)
err := c.cc.Invoke(ctx, PermissionsService_ExpandPermissionTree_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *permissionsServiceClient) LookupResources(ctx context.Context, in *LookupResourcesRequest, opts ...grpc.CallOption) (PermissionsService_LookupResourcesClient, error) {
stream, err := c.cc.NewStream(ctx, &PermissionsService_ServiceDesc.Streams[1], PermissionsService_LookupResources_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &permissionsServiceLookupResourcesClient{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 PermissionsService_LookupResourcesClient interface {
Recv() (*LookupResourcesResponse, error)
grpc.ClientStream
}
type permissionsServiceLookupResourcesClient struct {
grpc.ClientStream
}
func (x *permissionsServiceLookupResourcesClient) Recv() (*LookupResourcesResponse, error) {
m := new(LookupResourcesResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *permissionsServiceClient) LookupSubjects(ctx context.Context, in *LookupSubjectsRequest, opts ...grpc.CallOption) (PermissionsService_LookupSubjectsClient, error) {
stream, err := c.cc.NewStream(ctx, &PermissionsService_ServiceDesc.Streams[2], PermissionsService_LookupSubjects_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &permissionsServiceLookupSubjectsClient{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 PermissionsService_LookupSubjectsClient interface {
Recv() (*LookupSubjectsResponse, error)
grpc.ClientStream
}
type permissionsServiceLookupSubjectsClient struct {
grpc.ClientStream
}
func (x *permissionsServiceLookupSubjectsClient) Recv() (*LookupSubjectsResponse, error) {
m := new(LookupSubjectsResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// PermissionsServiceServer is the server API for PermissionsService service.
// All implementations must embed UnimplementedPermissionsServiceServer
// for forward compatibility
type PermissionsServiceServer interface {
// ReadRelationships reads a set of the relationships matching one or more
// filters.
ReadRelationships(*ReadRelationshipsRequest, PermissionsService_ReadRelationshipsServer) error
// 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 atomically bulk deletes all relationships matching the
// provided filter. If no relationships match, none will be deleted and the
// operation will succeed. An optional set of preconditions can be provided that must
// be satisfied for the operation to commit.
DeleteRelationships(context.Context, *DeleteRelationshipsRequest) (*DeleteRelationshipsResponse, error)
// 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 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 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
// LookupSubjects returns all the subjects of a given type that
// have access whether via a computed permission or relation membership.
LookupSubjects(*LookupSubjectsRequest, PermissionsService_LookupSubjectsServer) error
mustEmbedUnimplementedPermissionsServiceServer()
}
// UnimplementedPermissionsServiceServer must be embedded to have forward compatible implementations.
type UnimplementedPermissionsServiceServer struct {
}
func (UnimplementedPermissionsServiceServer) ReadRelationships(*ReadRelationshipsRequest, PermissionsService_ReadRelationshipsServer) error {
return status.Errorf(codes.Unimplemented, "method ReadRelationships not implemented")
}
func (UnimplementedPermissionsServiceServer) WriteRelationships(context.Context, *WriteRelationshipsRequest) (*WriteRelationshipsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method WriteRelationships not implemented")
}
func (UnimplementedPermissionsServiceServer) DeleteRelationships(context.Context, *DeleteRelationshipsRequest) (*DeleteRelationshipsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteRelationships not implemented")
}
func (UnimplementedPermissionsServiceServer) CheckPermission(context.Context, *CheckPermissionRequest) (*CheckPermissionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckPermission not implemented")
}
func (UnimplementedPermissionsServiceServer) ExpandPermissionTree(context.Context, *ExpandPermissionTreeRequest) (*ExpandPermissionTreeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ExpandPermissionTree not implemented")
}
func (UnimplementedPermissionsServiceServer) LookupResources(*LookupResourcesRequest, PermissionsService_LookupResourcesServer) error {
return status.Errorf(codes.Unimplemented, "method LookupResources not implemented")
}
func (UnimplementedPermissionsServiceServer) LookupSubjects(*LookupSubjectsRequest, PermissionsService_LookupSubjectsServer) error {
return status.Errorf(codes.Unimplemented, "method LookupSubjects not implemented")
}
func (UnimplementedPermissionsServiceServer) mustEmbedUnimplementedPermissionsServiceServer() {}
// UnsafePermissionsServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PermissionsServiceServer will
// result in compilation errors.
type UnsafePermissionsServiceServer interface {
mustEmbedUnimplementedPermissionsServiceServer()
}
func RegisterPermissionsServiceServer(s grpc.ServiceRegistrar, srv PermissionsServiceServer) {
s.RegisterService(&PermissionsService_ServiceDesc, srv)
}
func _PermissionsService_ReadRelationships_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(ReadRelationshipsRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(PermissionsServiceServer).ReadRelationships(m, &permissionsServiceReadRelationshipsServer{stream})
}
type PermissionsService_ReadRelationshipsServer interface {
Send(*ReadRelationshipsResponse) error
grpc.ServerStream
}
type permissionsServiceReadRelationshipsServer struct {
grpc.ServerStream
}
func (x *permissionsServiceReadRelationshipsServer) Send(m *ReadRelationshipsResponse) error {
return x.ServerStream.SendMsg(m)
}
func _PermissionsService_WriteRelationships_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(WriteRelationshipsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionsServiceServer).WriteRelationships(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionsService_WriteRelationships_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionsServiceServer).WriteRelationships(ctx, req.(*WriteRelationshipsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PermissionsService_DeleteRelationships_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteRelationshipsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionsServiceServer).DeleteRelationships(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionsService_DeleteRelationships_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionsServiceServer).DeleteRelationships(ctx, req.(*DeleteRelationshipsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PermissionsService_CheckPermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckPermissionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionsServiceServer).CheckPermission(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionsService_CheckPermission_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionsServiceServer).CheckPermission(ctx, req.(*CheckPermissionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PermissionsService_ExpandPermissionTree_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ExpandPermissionTreeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PermissionsServiceServer).ExpandPermissionTree(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PermissionsService_ExpandPermissionTree_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PermissionsServiceServer).ExpandPermissionTree(ctx, req.(*ExpandPermissionTreeRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PermissionsService_LookupResources_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(LookupResourcesRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(PermissionsServiceServer).LookupResources(m, &permissionsServiceLookupResourcesServer{stream})
}
type PermissionsService_LookupResourcesServer interface {
Send(*LookupResourcesResponse) error
grpc.ServerStream
}
type permissionsServiceLookupResourcesServer struct {
grpc.ServerStream
}
func (x *permissionsServiceLookupResourcesServer) Send(m *LookupResourcesResponse) error {
return x.ServerStream.SendMsg(m)
}
func _PermissionsService_LookupSubjects_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(LookupSubjectsRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(PermissionsServiceServer).LookupSubjects(m, &permissionsServiceLookupSubjectsServer{stream})
}
type PermissionsService_LookupSubjectsServer interface {
Send(*LookupSubjectsResponse) error
grpc.ServerStream
}
type permissionsServiceLookupSubjectsServer struct {
grpc.ServerStream
}
func (x *permissionsServiceLookupSubjectsServer) Send(m *LookupSubjectsResponse) error {
return x.ServerStream.SendMsg(m)
}
// PermissionsService_ServiceDesc is the grpc.ServiceDesc for PermissionsService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PermissionsService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "authzed.api.v1.PermissionsService",
HandlerType: (*PermissionsServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "WriteRelationships",
Handler: _PermissionsService_WriteRelationships_Handler,
},
{
MethodName: "DeleteRelationships",
Handler: _PermissionsService_DeleteRelationships_Handler,
},
{
MethodName: "CheckPermission",
Handler: _PermissionsService_CheckPermission_Handler,
},
{
MethodName: "ExpandPermissionTree",
Handler: _PermissionsService_ExpandPermissionTree_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "ReadRelationships",
Handler: _PermissionsService_ReadRelationships_Handler,
ServerStreams: true,
},
{
StreamName: "LookupResources",
Handler: _PermissionsService_LookupResources_Handler,
ServerStreams: true,
},
{
StreamName: "LookupSubjects",
Handler: _PermissionsService_LookupSubjects_Handler,
ServerStreams: true,
},
},
Metadata: "authzed/api/v1/permission_service.proto",
}