@homeflare/distilled-opnsense 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +95 -0
- package/dist/credentials.d.ts +39 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +78 -0
- package/dist/credentials.js.map +1 -0
- package/dist/errors.d.ts +110 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +63 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +13 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +115 -0
- package/dist/protocol.js.map +1 -0
- package/dist/retry.d.ts +56 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +49 -0
- package/dist/retry.js.map +1 -0
- package/dist/services/firewall_alias.d.ts +243 -0
- package/dist/services/firewall_alias.d.ts.map +1 -0
- package/dist/services/firewall_alias.js +222 -0
- package/dist/services/firewall_alias.js.map +1 -0
- package/dist/services/firewall_category.d.ts +122 -0
- package/dist/services/firewall_category.d.ts.map +1 -0
- package/dist/services/firewall_category.js +161 -0
- package/dist/services/firewall_category.js.map +1 -0
- package/dist/services/firewall_filter.d.ts +289 -0
- package/dist/services/firewall_filter.d.ts.map +1 -0
- package/dist/services/firewall_filter.js +225 -0
- package/dist/services/firewall_filter.js.map +1 -0
- package/dist/services/firewall_group.d.ts +122 -0
- package/dist/services/firewall_group.d.ts.map +1 -0
- package/dist/services/firewall_group.js +154 -0
- package/dist/services/firewall_group.js.map +1 -0
- package/dist/services/index.d.ts +9 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +10 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/quagga_bgp.d.ts +1135 -0
- package/dist/services/quagga_bgp.d.ts.map +1 -0
- package/dist/services/quagga_bgp.js +1263 -0
- package/dist/services/quagga_bgp.js.map +1 -0
- package/dist/services/quagga_general.d.ts +55 -0
- package/dist/services/quagga_general.d.ts.map +1 -0
- package/dist/services/quagga_general.js +48 -0
- package/dist/services/quagga_general.js.map +1 -0
- package/dist/services/quagga_service.d.ts +60 -0
- package/dist/services/quagga_service.d.ts.map +1 -0
- package/dist/services/quagga_service.js +77 -0
- package/dist/services/quagga_service.js.map +1 -0
- package/dist/services/routing_settings.d.ts +192 -0
- package/dist/services/routing_settings.d.ts.map +1 -0
- package/dist/services/routing_settings.js +169 -0
- package/dist/services/routing_settings.js.map +1 -0
- package/dist/traits.d.ts +11 -0
- package/dist/traits.d.ts.map +1 -0
- package/dist/traits.js +11 -0
- package/dist/traits.js.map +1 -0
- package/package.json +75 -0
- package/src/credentials.ts +111 -0
- package/src/errors.ts +115 -0
- package/src/index.ts +32 -0
- package/src/protocol.ts +177 -0
- package/src/retry.ts +80 -0
- package/src/services/firewall_alias.ts +572 -0
- package/src/services/firewall_category.ts +359 -0
- package/src/services/firewall_filter.ts +671 -0
- package/src/services/firewall_group.ts +350 -0
- package/src/services/index.ts +9 -0
- package/src/services/quagga_bgp.ts +2955 -0
- package/src/services/quagga_general.ts +132 -0
- package/src/services/quagga_service.ts +182 -0
- package/src/services/routing_settings.ts +419 -0
- package/src/traits.ts +36 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-opnsense). Do not edit.
|
|
2
|
+
import * as S from "@distilled.cloud/core/schema";
|
|
3
|
+
import * as API from "@distilled.cloud/core/api";
|
|
4
|
+
import * as T from "../traits.ts";
|
|
5
|
+
import {
|
|
6
|
+
OpnsenseProtocol,
|
|
7
|
+
type OpnsenseOpError,
|
|
8
|
+
type OpnsenseOpContext,
|
|
9
|
+
} from "../protocol.ts";
|
|
10
|
+
import * as Retry from "../retry.ts";
|
|
11
|
+
|
|
12
|
+
export type { OpnsenseOpError, OpnsenseOpContext };
|
|
13
|
+
|
|
14
|
+
export interface CategoryItem {
|
|
15
|
+
/** Item id, assigned by OPNsense on creation. */
|
|
16
|
+
uuid?: string;
|
|
17
|
+
/** OPNsense FieldType: TextField; pattern /[^,]+/ */
|
|
18
|
+
name: string;
|
|
19
|
+
/** OPNsense FieldType: BooleanField */
|
|
20
|
+
auto?: string;
|
|
21
|
+
/** OPNsense FieldType: TextField; pattern /^([0-9a-fA-F]){6,6}$/u */
|
|
22
|
+
color?: string;
|
|
23
|
+
}
|
|
24
|
+
export const CategoryItem = /*@__PURE__*/ S.suspend(() =>
|
|
25
|
+
S.Struct({
|
|
26
|
+
uuid: S.optional(S.String),
|
|
27
|
+
name: S.String,
|
|
28
|
+
auto: S.optional(S.String),
|
|
29
|
+
color: S.optional(S.String),
|
|
30
|
+
}),
|
|
31
|
+
).annotate({ identifier: "CategoryItem" }) as any as S.Schema<CategoryItem>;
|
|
32
|
+
|
|
33
|
+
export interface AddCategoryRequest {
|
|
34
|
+
category?: CategoryItem;
|
|
35
|
+
}
|
|
36
|
+
export const AddCategoryRequest = /*@__PURE__*/ S.suspend(() =>
|
|
37
|
+
S.Struct({
|
|
38
|
+
category: S.optional(CategoryItem),
|
|
39
|
+
}).pipe(
|
|
40
|
+
T.Http({
|
|
41
|
+
method: "POST",
|
|
42
|
+
uri: "/api/firewall/category/addItem",
|
|
43
|
+
code: 200,
|
|
44
|
+
}),
|
|
45
|
+
),
|
|
46
|
+
).annotate({
|
|
47
|
+
identifier: "AddCategoryRequest",
|
|
48
|
+
}) as any as S.Schema<AddCategoryRequest>;
|
|
49
|
+
|
|
50
|
+
export type AddCategoryResult = "saved";
|
|
51
|
+
export const AddCategoryResult = S.String;
|
|
52
|
+
|
|
53
|
+
export interface AddCategoryResponse {
|
|
54
|
+
result?: AddCategoryResult;
|
|
55
|
+
/** The new item's uuid. */
|
|
56
|
+
uuid?: string;
|
|
57
|
+
}
|
|
58
|
+
export const AddCategoryResponse = /*@__PURE__*/ S.suspend(() =>
|
|
59
|
+
S.Struct({
|
|
60
|
+
result: S.optional(AddCategoryResult),
|
|
61
|
+
uuid: S.optional(S.String),
|
|
62
|
+
}),
|
|
63
|
+
).annotate({
|
|
64
|
+
identifier: "AddCategoryResponse",
|
|
65
|
+
}) as any as S.Schema<AddCategoryResponse>;
|
|
66
|
+
|
|
67
|
+
export interface DelCategoryRequest {
|
|
68
|
+
uuid: string;
|
|
69
|
+
}
|
|
70
|
+
export const DelCategoryRequest = /*@__PURE__*/ S.suspend(() =>
|
|
71
|
+
S.Struct({
|
|
72
|
+
uuid: S.String.pipe(T.Label()),
|
|
73
|
+
}).pipe(
|
|
74
|
+
T.Http({
|
|
75
|
+
method: "POST",
|
|
76
|
+
uri: "/api/firewall/category/delItem/{uuid}",
|
|
77
|
+
code: 200,
|
|
78
|
+
}),
|
|
79
|
+
),
|
|
80
|
+
).annotate({
|
|
81
|
+
identifier: "DelCategoryRequest",
|
|
82
|
+
}) as any as S.Schema<DelCategoryRequest>;
|
|
83
|
+
|
|
84
|
+
export type DelCategoryResult = "deleted" | "not found";
|
|
85
|
+
export const DelCategoryResult = S.String;
|
|
86
|
+
|
|
87
|
+
export interface DelCategoryResponse {
|
|
88
|
+
result?: DelCategoryResult;
|
|
89
|
+
}
|
|
90
|
+
export const DelCategoryResponse = /*@__PURE__*/ S.suspend(() =>
|
|
91
|
+
S.Struct({
|
|
92
|
+
result: S.optional(DelCategoryResult),
|
|
93
|
+
}),
|
|
94
|
+
).annotate({
|
|
95
|
+
identifier: "DelCategoryResponse",
|
|
96
|
+
}) as any as S.Schema<DelCategoryResponse>;
|
|
97
|
+
|
|
98
|
+
export interface GetRequest {}
|
|
99
|
+
export const GetRequest = /*@__PURE__*/ S.suspend(() =>
|
|
100
|
+
S.Struct({}).pipe(
|
|
101
|
+
T.Http({ method: "GET", uri: "/api/firewall/category/get", code: 200 }),
|
|
102
|
+
),
|
|
103
|
+
).annotate({ identifier: "GetRequest" }) as any as S.Schema<GetRequest>;
|
|
104
|
+
|
|
105
|
+
export type ModelCategoryItem = CategoryItem;
|
|
106
|
+
export const ModelCategoryItem = CategoryItem;
|
|
107
|
+
|
|
108
|
+
export type ModelCategoryItemMap = { [key: string]: CategoryItem | undefined };
|
|
109
|
+
export const ModelCategoryItemMap = /*@__PURE__*/ S.Record(
|
|
110
|
+
S.String,
|
|
111
|
+
CategoryItem,
|
|
112
|
+
) as any as S.Schema<ModelCategoryItemMap>;
|
|
113
|
+
|
|
114
|
+
export interface ModelCategories {
|
|
115
|
+
category?: ModelCategoryItemMap;
|
|
116
|
+
}
|
|
117
|
+
export const ModelCategories = /*@__PURE__*/ S.suspend(() =>
|
|
118
|
+
S.Struct({
|
|
119
|
+
category: S.optional(ModelCategoryItemMap),
|
|
120
|
+
}),
|
|
121
|
+
).annotate({
|
|
122
|
+
identifier: "ModelCategories",
|
|
123
|
+
}) as any as S.Schema<ModelCategories>;
|
|
124
|
+
|
|
125
|
+
export interface Model {
|
|
126
|
+
categories?: ModelCategories;
|
|
127
|
+
}
|
|
128
|
+
export const Model = /*@__PURE__*/ S.suspend(() =>
|
|
129
|
+
S.Struct({
|
|
130
|
+
categories: S.optional(ModelCategories),
|
|
131
|
+
}),
|
|
132
|
+
).annotate({ identifier: "Model" }) as any as S.Schema<Model>;
|
|
133
|
+
|
|
134
|
+
export interface GetResponse {
|
|
135
|
+
category?: Model;
|
|
136
|
+
}
|
|
137
|
+
export const GetResponse = /*@__PURE__*/ S.suspend(() =>
|
|
138
|
+
S.Struct({
|
|
139
|
+
category: S.optional(Model),
|
|
140
|
+
}),
|
|
141
|
+
).annotate({ identifier: "GetResponse" }) as any as S.Schema<GetResponse>;
|
|
142
|
+
|
|
143
|
+
export interface GetCategoryRequest {}
|
|
144
|
+
export const GetCategoryRequest = /*@__PURE__*/ S.suspend(() =>
|
|
145
|
+
S.Struct({}).pipe(
|
|
146
|
+
T.Http({ method: "GET", uri: "/api/firewall/category/getItem", code: 200 }),
|
|
147
|
+
),
|
|
148
|
+
).annotate({
|
|
149
|
+
identifier: "GetCategoryRequest",
|
|
150
|
+
}) as any as S.Schema<GetCategoryRequest>;
|
|
151
|
+
|
|
152
|
+
export interface GetCategoryResponse {
|
|
153
|
+
category?: CategoryItem;
|
|
154
|
+
}
|
|
155
|
+
export const GetCategoryResponse = /*@__PURE__*/ S.suspend(() =>
|
|
156
|
+
S.Struct({
|
|
157
|
+
category: S.optional(CategoryItem),
|
|
158
|
+
}),
|
|
159
|
+
).annotate({
|
|
160
|
+
identifier: "GetCategoryResponse",
|
|
161
|
+
}) as any as S.Schema<GetCategoryResponse>;
|
|
162
|
+
|
|
163
|
+
export interface SearchCategoryRequest {}
|
|
164
|
+
export const SearchCategoryRequest = /*@__PURE__*/ S.suspend(() =>
|
|
165
|
+
S.Struct({}).pipe(
|
|
166
|
+
T.Http({
|
|
167
|
+
method: "POST",
|
|
168
|
+
uri: "/api/firewall/category/searchItem",
|
|
169
|
+
code: 200,
|
|
170
|
+
}),
|
|
171
|
+
),
|
|
172
|
+
).annotate({
|
|
173
|
+
identifier: "SearchCategoryRequest",
|
|
174
|
+
}) as any as S.Schema<SearchCategoryRequest>;
|
|
175
|
+
|
|
176
|
+
export type CategoryList = Array<CategoryItem>;
|
|
177
|
+
export const CategoryList = /*@__PURE__*/ S.Array(
|
|
178
|
+
CategoryItem,
|
|
179
|
+
) as any as S.Schema<CategoryList>;
|
|
180
|
+
|
|
181
|
+
export interface SearchCategoryResponse {
|
|
182
|
+
/** Total matching items before pagination. */
|
|
183
|
+
total?: number;
|
|
184
|
+
rowCount?: number;
|
|
185
|
+
/** Current page number. */
|
|
186
|
+
current?: number;
|
|
187
|
+
rows?: CategoryList;
|
|
188
|
+
}
|
|
189
|
+
export const SearchCategoryResponse = /*@__PURE__*/ S.suspend(() =>
|
|
190
|
+
S.Struct({
|
|
191
|
+
total: S.optional(S.Number),
|
|
192
|
+
rowCount: S.optional(S.Number),
|
|
193
|
+
current: S.optional(S.Number),
|
|
194
|
+
rows: S.optional(CategoryList),
|
|
195
|
+
}),
|
|
196
|
+
).annotate({
|
|
197
|
+
identifier: "SearchCategoryResponse",
|
|
198
|
+
}) as any as S.Schema<SearchCategoryResponse>;
|
|
199
|
+
|
|
200
|
+
export interface SetRequest {
|
|
201
|
+
category?: Model;
|
|
202
|
+
}
|
|
203
|
+
export const SetRequest = /*@__PURE__*/ S.suspend(() =>
|
|
204
|
+
S.Struct({
|
|
205
|
+
category: S.optional(Model),
|
|
206
|
+
}).pipe(
|
|
207
|
+
T.Http({ method: "POST", uri: "/api/firewall/category/set", code: 200 }),
|
|
208
|
+
),
|
|
209
|
+
).annotate({ identifier: "SetRequest" }) as any as S.Schema<SetRequest>;
|
|
210
|
+
|
|
211
|
+
export type SetResult = "saved";
|
|
212
|
+
export const SetResult = S.String;
|
|
213
|
+
|
|
214
|
+
export interface SetResponse {
|
|
215
|
+
result?: SetResult;
|
|
216
|
+
}
|
|
217
|
+
export const SetResponse = /*@__PURE__*/ S.suspend(() =>
|
|
218
|
+
S.Struct({
|
|
219
|
+
result: S.optional(SetResult),
|
|
220
|
+
}),
|
|
221
|
+
).annotate({ identifier: "SetResponse" }) as any as S.Schema<SetResponse>;
|
|
222
|
+
|
|
223
|
+
export interface SetCategoryRequest {
|
|
224
|
+
uuid: string;
|
|
225
|
+
category?: CategoryItem;
|
|
226
|
+
}
|
|
227
|
+
export const SetCategoryRequest = /*@__PURE__*/ S.suspend(() =>
|
|
228
|
+
S.Struct({
|
|
229
|
+
uuid: S.String.pipe(T.Label()),
|
|
230
|
+
category: S.optional(CategoryItem),
|
|
231
|
+
}).pipe(
|
|
232
|
+
T.Http({
|
|
233
|
+
method: "POST",
|
|
234
|
+
uri: "/api/firewall/category/setItem/{uuid}",
|
|
235
|
+
code: 200,
|
|
236
|
+
}),
|
|
237
|
+
),
|
|
238
|
+
).annotate({
|
|
239
|
+
identifier: "SetCategoryRequest",
|
|
240
|
+
}) as any as S.Schema<SetCategoryRequest>;
|
|
241
|
+
|
|
242
|
+
export type SetCategoryResult = "saved";
|
|
243
|
+
export const SetCategoryResult = S.String;
|
|
244
|
+
|
|
245
|
+
export interface SetCategoryResponse {
|
|
246
|
+
result?: SetCategoryResult;
|
|
247
|
+
}
|
|
248
|
+
export const SetCategoryResponse = /*@__PURE__*/ S.suspend(() =>
|
|
249
|
+
S.Struct({
|
|
250
|
+
result: S.optional(SetCategoryResult),
|
|
251
|
+
}),
|
|
252
|
+
).annotate({
|
|
253
|
+
identifier: "SetCategoryResponse",
|
|
254
|
+
}) as any as S.Schema<SetCategoryResponse>;
|
|
255
|
+
|
|
256
|
+
export type AddCategoryError = OpnsenseOpError;
|
|
257
|
+
/** Add a new categories.category item. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
|
|
258
|
+
export const addCategory: API.OperationMethod<
|
|
259
|
+
AddCategoryRequest,
|
|
260
|
+
AddCategoryResponse,
|
|
261
|
+
AddCategoryError,
|
|
262
|
+
OpnsenseOpContext
|
|
263
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
264
|
+
input: AddCategoryRequest,
|
|
265
|
+
output: AddCategoryResponse,
|
|
266
|
+
errors: [],
|
|
267
|
+
protocol: OpnsenseProtocol,
|
|
268
|
+
retry: Retry.Retry,
|
|
269
|
+
}));
|
|
270
|
+
|
|
271
|
+
export type DelCategoryError = OpnsenseOpError;
|
|
272
|
+
/** Delete a categories.category item by uuid. */
|
|
273
|
+
export const delCategory: API.OperationMethod<
|
|
274
|
+
DelCategoryRequest,
|
|
275
|
+
DelCategoryResponse,
|
|
276
|
+
DelCategoryError,
|
|
277
|
+
OpnsenseOpContext
|
|
278
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
279
|
+
input: DelCategoryRequest,
|
|
280
|
+
output: DelCategoryResponse,
|
|
281
|
+
errors: [],
|
|
282
|
+
protocol: OpnsenseProtocol,
|
|
283
|
+
retry: Retry.Retry,
|
|
284
|
+
}));
|
|
285
|
+
|
|
286
|
+
export type GetError = OpnsenseOpError;
|
|
287
|
+
/** Fetch the entire model tree (every section and array collection). */
|
|
288
|
+
export const get: API.OperationMethod<
|
|
289
|
+
GetRequest,
|
|
290
|
+
GetResponse,
|
|
291
|
+
GetError,
|
|
292
|
+
OpnsenseOpContext
|
|
293
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
294
|
+
input: GetRequest,
|
|
295
|
+
output: GetResponse,
|
|
296
|
+
errors: [],
|
|
297
|
+
protocol: OpnsenseProtocol,
|
|
298
|
+
retry: Retry.Retry,
|
|
299
|
+
}));
|
|
300
|
+
|
|
301
|
+
export type GetCategoryError = OpnsenseOpError;
|
|
302
|
+
/** Fetch one categories.category item by uuid. */
|
|
303
|
+
export const getCategory: API.OperationMethod<
|
|
304
|
+
GetCategoryRequest,
|
|
305
|
+
GetCategoryResponse,
|
|
306
|
+
GetCategoryError,
|
|
307
|
+
OpnsenseOpContext
|
|
308
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
309
|
+
input: GetCategoryRequest,
|
|
310
|
+
output: GetCategoryResponse,
|
|
311
|
+
errors: [],
|
|
312
|
+
protocol: OpnsenseProtocol,
|
|
313
|
+
retry: Retry.Retry,
|
|
314
|
+
}));
|
|
315
|
+
|
|
316
|
+
export type SearchCategoryError = OpnsenseOpError;
|
|
317
|
+
/** Search categories.category items (paginated). */
|
|
318
|
+
export const searchCategory: API.OperationMethod<
|
|
319
|
+
SearchCategoryRequest,
|
|
320
|
+
SearchCategoryResponse,
|
|
321
|
+
SearchCategoryError,
|
|
322
|
+
OpnsenseOpContext
|
|
323
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
324
|
+
input: SearchCategoryRequest,
|
|
325
|
+
output: SearchCategoryResponse,
|
|
326
|
+
errors: [],
|
|
327
|
+
protocol: OpnsenseProtocol,
|
|
328
|
+
retry: Retry.Retry,
|
|
329
|
+
}));
|
|
330
|
+
|
|
331
|
+
export type SetError = OpnsenseOpError;
|
|
332
|
+
/** Replace the entire model tree in one call. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
|
|
333
|
+
export const set: API.OperationMethod<
|
|
334
|
+
SetRequest,
|
|
335
|
+
SetResponse,
|
|
336
|
+
SetError,
|
|
337
|
+
OpnsenseOpContext
|
|
338
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
339
|
+
input: SetRequest,
|
|
340
|
+
output: SetResponse,
|
|
341
|
+
errors: [],
|
|
342
|
+
protocol: OpnsenseProtocol,
|
|
343
|
+
retry: Retry.Retry,
|
|
344
|
+
}));
|
|
345
|
+
|
|
346
|
+
export type SetCategoryError = OpnsenseOpError;
|
|
347
|
+
/** Update an existing categories.category item. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
|
|
348
|
+
export const setCategory: API.OperationMethod<
|
|
349
|
+
SetCategoryRequest,
|
|
350
|
+
SetCategoryResponse,
|
|
351
|
+
SetCategoryError,
|
|
352
|
+
OpnsenseOpContext
|
|
353
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
354
|
+
input: SetCategoryRequest,
|
|
355
|
+
output: SetCategoryResponse,
|
|
356
|
+
errors: [],
|
|
357
|
+
protocol: OpnsenseProtocol,
|
|
358
|
+
retry: Retry.Retry,
|
|
359
|
+
}));
|