Skip to content

Commit e9fd68f

Browse files
committed
build(backend): introduce generated OpenFGA code
Add OpenFGA implementation. The code is generated following the same process included with the new just task "compile-protobuf". Every time there is a change in https://github.com/openfga/api/tree/main/openfga/v1, we should make sure to check the generated code is up to date. In this case, the commit used was `f153694`. Signed-off-by: Damiano Mason <damiano.mason@secomind.com>
1 parent 199d262 commit e9fd68f

10 files changed

Lines changed: 1546 additions & 1 deletion

File tree

backend/.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2021-2023 SECO Mind Srl
1+
# SPDX-FileCopyrightText: 2021-2026 SECO Mind Srl
22
# SPDX-License-Identifier: CC0-1.0
33

44
# The directory Mix will write compiled artifacts to.
@@ -37,3 +37,9 @@ edgehog-*.tar
3737

3838
# Ignore expert lsp files
3939
/.expert
40+
41+
# ProtoBuf compilation dependencies
42+
/priv/api/
43+
/priv/googleapis/
44+
/priv/grpc-gateway/
45+
/priv/protoc-gen-validate/
Lines changed: 326 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,326 @@
1+
# This file is part of Edgehog.
2+
#
3+
# Copyright 2026 SECO Mind Srl
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# SPDX-License-Identifier: Apache-2.0
18+
19+
defmodule Openfga.V1.ConditionParamTypeRef.TypeName do
20+
use Protobuf,
21+
enum: true,
22+
full_name: "openfga.v1.ConditionParamTypeRef.TypeName",
23+
protoc_gen_elixir_version: "0.16.0",
24+
syntax: :proto3
25+
26+
field :TYPE_NAME_UNSPECIFIED, 0
27+
field :TYPE_NAME_ANY, 1
28+
field :TYPE_NAME_BOOL, 2
29+
field :TYPE_NAME_STRING, 3
30+
field :TYPE_NAME_INT, 4
31+
field :TYPE_NAME_UINT, 5
32+
field :TYPE_NAME_DOUBLE, 6
33+
field :TYPE_NAME_DURATION, 7
34+
field :TYPE_NAME_TIMESTAMP, 8
35+
field :TYPE_NAME_MAP, 9
36+
field :TYPE_NAME_LIST, 10
37+
field :TYPE_NAME_IPADDRESS, 11
38+
end
39+
40+
defmodule Openfga.V1.AuthorizationModel.ConditionsEntry do
41+
use Protobuf,
42+
full_name: "openfga.v1.AuthorizationModel.ConditionsEntry",
43+
map: true,
44+
protoc_gen_elixir_version: "0.16.0",
45+
syntax: :proto3
46+
47+
field :key, 1, type: :string
48+
field :value, 2, type: Openfga.V1.Condition
49+
end
50+
51+
defmodule Openfga.V1.AuthorizationModel do
52+
use Protobuf,
53+
full_name: "openfga.v1.AuthorizationModel",
54+
protoc_gen_elixir_version: "0.16.0",
55+
syntax: :proto3
56+
57+
field :id, 1, type: :string, deprecated: false
58+
field :schema_version, 2, type: :string, deprecated: false
59+
field :type_definitions, 3, repeated: true, type: Openfga.V1.TypeDefinition, deprecated: false
60+
61+
field :conditions, 4,
62+
repeated: true,
63+
type: Openfga.V1.AuthorizationModel.ConditionsEntry,
64+
map: true,
65+
deprecated: false
66+
end
67+
68+
defmodule Openfga.V1.TypeDefinition.RelationsEntry do
69+
use Protobuf,
70+
full_name: "openfga.v1.TypeDefinition.RelationsEntry",
71+
map: true,
72+
protoc_gen_elixir_version: "0.16.0",
73+
syntax: :proto3
74+
75+
field :key, 1, type: :string
76+
field :value, 2, type: Openfga.V1.Userset
77+
end
78+
79+
defmodule Openfga.V1.TypeDefinition do
80+
use Protobuf,
81+
full_name: "openfga.v1.TypeDefinition",
82+
protoc_gen_elixir_version: "0.16.0",
83+
syntax: :proto3
84+
85+
field :type, 1, type: :string, deprecated: false
86+
87+
field :relations, 2,
88+
repeated: true,
89+
type: Openfga.V1.TypeDefinition.RelationsEntry,
90+
map: true,
91+
deprecated: false
92+
93+
field :metadata, 3, type: Openfga.V1.Metadata
94+
end
95+
96+
defmodule Openfga.V1.Relation do
97+
use Protobuf,
98+
full_name: "openfga.v1.Relation",
99+
protoc_gen_elixir_version: "0.16.0",
100+
syntax: :proto3
101+
102+
field :name, 1, type: :string, deprecated: false
103+
field :rewrite, 2, type: Openfga.V1.Userset, deprecated: false
104+
field :type_info, 3, type: Openfga.V1.RelationTypeInfo, json_name: "typeInfo"
105+
end
106+
107+
defmodule Openfga.V1.RelationTypeInfo do
108+
use Protobuf,
109+
full_name: "openfga.v1.RelationTypeInfo",
110+
protoc_gen_elixir_version: "0.16.0",
111+
syntax: :proto3
112+
113+
field :directly_related_user_types, 1, repeated: true, type: Openfga.V1.RelationReference
114+
end
115+
116+
defmodule Openfga.V1.Metadata.RelationsEntry do
117+
use Protobuf,
118+
full_name: "openfga.v1.Metadata.RelationsEntry",
119+
map: true,
120+
protoc_gen_elixir_version: "0.16.0",
121+
syntax: :proto3
122+
123+
field :key, 1, type: :string
124+
field :value, 2, type: Openfga.V1.RelationMetadata
125+
end
126+
127+
defmodule Openfga.V1.Metadata do
128+
use Protobuf,
129+
full_name: "openfga.v1.Metadata",
130+
protoc_gen_elixir_version: "0.16.0",
131+
syntax: :proto3
132+
133+
field :relations, 1, repeated: true, type: Openfga.V1.Metadata.RelationsEntry, map: true
134+
field :module, 2, type: :string, deprecated: false
135+
field :source_info, 3, type: Openfga.V1.SourceInfo
136+
end
137+
138+
defmodule Openfga.V1.SourceInfo do
139+
use Protobuf,
140+
full_name: "openfga.v1.SourceInfo",
141+
protoc_gen_elixir_version: "0.16.0",
142+
syntax: :proto3
143+
144+
field :file, 1, type: :string, deprecated: false
145+
end
146+
147+
defmodule Openfga.V1.RelationMetadata do
148+
use Protobuf,
149+
full_name: "openfga.v1.RelationMetadata",
150+
protoc_gen_elixir_version: "0.16.0",
151+
syntax: :proto3
152+
153+
field :directly_related_user_types, 1, repeated: true, type: Openfga.V1.RelationReference
154+
field :module, 2, type: :string, deprecated: false
155+
field :source_info, 3, type: Openfga.V1.SourceInfo
156+
end
157+
158+
defmodule Openfga.V1.RelationReference do
159+
@moduledoc """
160+
RelationReference represents a relation of a particular object type (e.g. 'document#viewer').
161+
"""
162+
163+
use Protobuf,
164+
full_name: "openfga.v1.RelationReference",
165+
protoc_gen_elixir_version: "0.16.0",
166+
syntax: :proto3
167+
168+
oneof(:relation_or_wildcard, 0)
169+
170+
field :type, 1, type: :string, deprecated: false
171+
field :relation, 2, type: :string, oneof: 0, deprecated: false
172+
field :wildcard, 3, type: Openfga.V1.Wildcard, oneof: 0
173+
field :condition, 4, type: :string, deprecated: false
174+
end
175+
176+
defmodule Openfga.V1.Wildcard do
177+
use Protobuf,
178+
full_name: "openfga.v1.Wildcard",
179+
protoc_gen_elixir_version: "0.16.0",
180+
syntax: :proto3
181+
end
182+
183+
defmodule Openfga.V1.Usersets do
184+
use Protobuf,
185+
full_name: "openfga.v1.Usersets",
186+
protoc_gen_elixir_version: "0.16.0",
187+
syntax: :proto3
188+
189+
field :child, 1, repeated: true, type: Openfga.V1.Userset, deprecated: false
190+
end
191+
192+
defmodule Openfga.V1.Difference do
193+
use Protobuf,
194+
full_name: "openfga.v1.Difference",
195+
protoc_gen_elixir_version: "0.16.0",
196+
syntax: :proto3
197+
198+
field :base, 1, type: Openfga.V1.Userset, deprecated: false
199+
field :subtract, 2, type: Openfga.V1.Userset, deprecated: false
200+
end
201+
202+
defmodule Openfga.V1.Userset do
203+
use Protobuf,
204+
full_name: "openfga.v1.Userset",
205+
protoc_gen_elixir_version: "0.16.0",
206+
syntax: :proto3
207+
208+
oneof(:userset, 0)
209+
210+
field :this, 1, type: Openfga.V1.DirectUserset, oneof: 0
211+
212+
field :computed_userset, 2,
213+
type: Openfga.V1.ObjectRelation,
214+
json_name: "computedUserset",
215+
oneof: 0
216+
217+
field :tuple_to_userset, 3,
218+
type: Openfga.V1.TupleToUserset,
219+
json_name: "tupleToUserset",
220+
oneof: 0
221+
222+
field :union, 4, type: Openfga.V1.Usersets, oneof: 0
223+
field :intersection, 5, type: Openfga.V1.Usersets, oneof: 0
224+
field :difference, 6, type: Openfga.V1.Difference, oneof: 0
225+
end
226+
227+
defmodule Openfga.V1.DirectUserset do
228+
@moduledoc """
229+
A DirectUserset is a sentinel message for referencing
230+
the direct members specified by an object/relation mapping.
231+
"""
232+
233+
use Protobuf,
234+
full_name: "openfga.v1.DirectUserset",
235+
protoc_gen_elixir_version: "0.16.0",
236+
syntax: :proto3
237+
end
238+
239+
defmodule Openfga.V1.ObjectRelation do
240+
use Protobuf,
241+
full_name: "openfga.v1.ObjectRelation",
242+
protoc_gen_elixir_version: "0.16.0",
243+
syntax: :proto3
244+
245+
field :object, 1, type: :string, deprecated: false
246+
field :relation, 2, type: :string, deprecated: false
247+
end
248+
249+
defmodule Openfga.V1.ComputedUserset do
250+
use Protobuf,
251+
full_name: "openfga.v1.ComputedUserset",
252+
protoc_gen_elixir_version: "0.16.0",
253+
syntax: :proto3
254+
255+
field :relation, 1, type: :string, deprecated: false
256+
end
257+
258+
defmodule Openfga.V1.TupleToUserset do
259+
use Protobuf,
260+
full_name: "openfga.v1.TupleToUserset",
261+
protoc_gen_elixir_version: "0.16.0",
262+
syntax: :proto3
263+
264+
field :tupleset, 1, type: Openfga.V1.ObjectRelation, deprecated: false
265+
266+
field :computed_userset, 2,
267+
type: Openfga.V1.ObjectRelation,
268+
json_name: "computedUserset",
269+
deprecated: false
270+
end
271+
272+
defmodule Openfga.V1.Condition.ParametersEntry do
273+
use Protobuf,
274+
full_name: "openfga.v1.Condition.ParametersEntry",
275+
map: true,
276+
protoc_gen_elixir_version: "0.16.0",
277+
syntax: :proto3
278+
279+
field :key, 1, type: :string
280+
field :value, 2, type: Openfga.V1.ConditionParamTypeRef
281+
end
282+
283+
defmodule Openfga.V1.Condition do
284+
use Protobuf,
285+
full_name: "openfga.v1.Condition",
286+
protoc_gen_elixir_version: "0.16.0",
287+
syntax: :proto3
288+
289+
field :name, 1, type: :string, deprecated: false
290+
field :expression, 2, type: :string, deprecated: false
291+
292+
field :parameters, 3,
293+
repeated: true,
294+
type: Openfga.V1.Condition.ParametersEntry,
295+
map: true,
296+
deprecated: false
297+
298+
field :metadata, 4, type: Openfga.V1.ConditionMetadata
299+
end
300+
301+
defmodule Openfga.V1.ConditionMetadata do
302+
use Protobuf,
303+
full_name: "openfga.v1.ConditionMetadata",
304+
protoc_gen_elixir_version: "0.16.0",
305+
syntax: :proto3
306+
307+
field :module, 1, type: :string, deprecated: false
308+
field :source_info, 2, type: Openfga.V1.SourceInfo
309+
end
310+
311+
defmodule Openfga.V1.ConditionParamTypeRef do
312+
use Protobuf,
313+
full_name: "openfga.v1.ConditionParamTypeRef",
314+
protoc_gen_elixir_version: "0.16.0",
315+
syntax: :proto3
316+
317+
field :type_name, 1,
318+
type: Openfga.V1.ConditionParamTypeRef.TypeName,
319+
enum: true,
320+
deprecated: false
321+
322+
field :generic_types, 2,
323+
repeated: true,
324+
type: Openfga.V1.ConditionParamTypeRef,
325+
deprecated: false
326+
end

0 commit comments

Comments
 (0)