@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,671 @@
|
|
|
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 type RuleItemStatetype =
|
|
15
|
+
| "keep"
|
|
16
|
+
| "sloppy"
|
|
17
|
+
| "modulate"
|
|
18
|
+
| "synproxy"
|
|
19
|
+
| "none";
|
|
20
|
+
export const RuleItemStatetype = S.String;
|
|
21
|
+
|
|
22
|
+
export type RuleItemStatePolicy = "if-bound" | "floating";
|
|
23
|
+
export const RuleItemStatePolicy = S.String;
|
|
24
|
+
|
|
25
|
+
export type RuleItemAction = "pass" | "block" | "reject";
|
|
26
|
+
export const RuleItemAction = S.String;
|
|
27
|
+
|
|
28
|
+
export type RuleItemDirection = "in" | "out" | "any";
|
|
29
|
+
export const RuleItemDirection = S.String;
|
|
30
|
+
|
|
31
|
+
export type RuleItemIpprotocol = "inet" | "inet6" | "inet46";
|
|
32
|
+
export const RuleItemIpprotocol = S.String;
|
|
33
|
+
|
|
34
|
+
export type RuleItemIcmptype =
|
|
35
|
+
| "echoreq"
|
|
36
|
+
| "echorep"
|
|
37
|
+
| "unreach"
|
|
38
|
+
| "redir"
|
|
39
|
+
| "routeradv"
|
|
40
|
+
| "routersol"
|
|
41
|
+
| "timex"
|
|
42
|
+
| "paramprob"
|
|
43
|
+
| "timereq"
|
|
44
|
+
| "timerep"
|
|
45
|
+
| "photuris"
|
|
46
|
+
| "squench"
|
|
47
|
+
| "althost"
|
|
48
|
+
| "inforeq"
|
|
49
|
+
| "inforep"
|
|
50
|
+
| "maskreq"
|
|
51
|
+
| "maskrep"
|
|
52
|
+
| "trace"
|
|
53
|
+
| "dataconv"
|
|
54
|
+
| "mobredir"
|
|
55
|
+
| "ipv6-where"
|
|
56
|
+
| "ipv6-here"
|
|
57
|
+
| "mobregreq"
|
|
58
|
+
| "mobregrep"
|
|
59
|
+
| "skip";
|
|
60
|
+
export const RuleItemIcmptype = S.String;
|
|
61
|
+
|
|
62
|
+
export type RuleItemIcmp6type =
|
|
63
|
+
| "unreach"
|
|
64
|
+
| "toobig"
|
|
65
|
+
| "timex"
|
|
66
|
+
| "paramprob"
|
|
67
|
+
| "echoreq"
|
|
68
|
+
| "echorep"
|
|
69
|
+
| "listqry"
|
|
70
|
+
| "listenrep"
|
|
71
|
+
| "listendone"
|
|
72
|
+
| "routersol"
|
|
73
|
+
| "routeradv"
|
|
74
|
+
| "neighbrsol"
|
|
75
|
+
| "neighbradv"
|
|
76
|
+
| "redir"
|
|
77
|
+
| "routrrenum"
|
|
78
|
+
| "niqry"
|
|
79
|
+
| "nirep"
|
|
80
|
+
| "mtraceresp"
|
|
81
|
+
| "mtrace";
|
|
82
|
+
export const RuleItemIcmp6type = S.String;
|
|
83
|
+
|
|
84
|
+
export type RuleItemPrio =
|
|
85
|
+
| "opt1"
|
|
86
|
+
| "opt0"
|
|
87
|
+
| "opt2"
|
|
88
|
+
| "opt3"
|
|
89
|
+
| "opt4"
|
|
90
|
+
| "opt5"
|
|
91
|
+
| "opt6"
|
|
92
|
+
| "opt7";
|
|
93
|
+
export const RuleItemPrio = S.String;
|
|
94
|
+
|
|
95
|
+
export type RuleItemSetPrio =
|
|
96
|
+
| "opt1"
|
|
97
|
+
| "opt0"
|
|
98
|
+
| "opt2"
|
|
99
|
+
| "opt3"
|
|
100
|
+
| "opt4"
|
|
101
|
+
| "opt5"
|
|
102
|
+
| "opt6"
|
|
103
|
+
| "opt7";
|
|
104
|
+
export const RuleItemSetPrio = S.String;
|
|
105
|
+
|
|
106
|
+
export type RuleItemSetPrioLow =
|
|
107
|
+
| "opt1"
|
|
108
|
+
| "opt0"
|
|
109
|
+
| "opt2"
|
|
110
|
+
| "opt3"
|
|
111
|
+
| "opt4"
|
|
112
|
+
| "opt5"
|
|
113
|
+
| "opt6"
|
|
114
|
+
| "opt7";
|
|
115
|
+
export const RuleItemSetPrioLow = S.String;
|
|
116
|
+
|
|
117
|
+
export type RuleItemTcpflags1 =
|
|
118
|
+
| "syn"
|
|
119
|
+
| "ack"
|
|
120
|
+
| "fin"
|
|
121
|
+
| "rst"
|
|
122
|
+
| "psh"
|
|
123
|
+
| "urg"
|
|
124
|
+
| "ece"
|
|
125
|
+
| "cwr";
|
|
126
|
+
export const RuleItemTcpflags1 = S.String;
|
|
127
|
+
|
|
128
|
+
export type RuleItemTcpflags2 =
|
|
129
|
+
| "syn"
|
|
130
|
+
| "ack"
|
|
131
|
+
| "fin"
|
|
132
|
+
| "rst"
|
|
133
|
+
| "psh"
|
|
134
|
+
| "urg"
|
|
135
|
+
| "ece"
|
|
136
|
+
| "cwr";
|
|
137
|
+
export const RuleItemTcpflags2 = S.String;
|
|
138
|
+
|
|
139
|
+
export interface RuleItem {
|
|
140
|
+
/** Item id, assigned by OPNsense on creation. */
|
|
141
|
+
uuid?: string;
|
|
142
|
+
/** OPNsense FieldType: BooleanField */
|
|
143
|
+
enabled: string;
|
|
144
|
+
/** OPNsense FieldType: OptionField */
|
|
145
|
+
statetype: RuleItemStatetype | (string & {});
|
|
146
|
+
/** OPNsense FieldType: OptionField */
|
|
147
|
+
"state-policy"?: RuleItemStatePolicy | (string & {});
|
|
148
|
+
/** OPNsense FieldType: .\FilterSequenceField; range 1..999999 (as text) */
|
|
149
|
+
sequence: string;
|
|
150
|
+
/** OPNsense FieldType: TextField */
|
|
151
|
+
sort_order?: string;
|
|
152
|
+
/** OPNsense FieldType: TextField */
|
|
153
|
+
prio_group?: string;
|
|
154
|
+
/** OPNsense FieldType: OptionField */
|
|
155
|
+
action: RuleItemAction | (string & {});
|
|
156
|
+
/** OPNsense FieldType: BooleanField */
|
|
157
|
+
quick: string;
|
|
158
|
+
/** OPNsense FieldType: BooleanField */
|
|
159
|
+
interfacenot: string;
|
|
160
|
+
/** OPNsense FieldType: InterfaceField; multi-select: wire value is a single comma-joined string, not a JSON array */
|
|
161
|
+
interface?: string;
|
|
162
|
+
/** OPNsense FieldType: OptionField */
|
|
163
|
+
direction: RuleItemDirection | (string & {});
|
|
164
|
+
/** OPNsense FieldType: OptionField */
|
|
165
|
+
ipprotocol: RuleItemIpprotocol | (string & {});
|
|
166
|
+
/** OPNsense FieldType: ProtocolField */
|
|
167
|
+
protocol: string;
|
|
168
|
+
/** OPNsense FieldType: OptionField; multi-select: wire value is a single comma-joined string, not a JSON array */
|
|
169
|
+
icmptype?: RuleItemIcmptype | (string & {});
|
|
170
|
+
/** OPNsense FieldType: OptionField; multi-select: wire value is a single comma-joined string, not a JSON array */
|
|
171
|
+
icmp6type?: RuleItemIcmp6type | (string & {});
|
|
172
|
+
/** OPNsense FieldType: NetworkAliasField; multi-select: wire value is a single comma-joined string, not a JSON array */
|
|
173
|
+
source_net: string;
|
|
174
|
+
/** OPNsense FieldType: BooleanField */
|
|
175
|
+
source_not: string;
|
|
176
|
+
/** OPNsense FieldType: PortField */
|
|
177
|
+
source_port?: string;
|
|
178
|
+
/** OPNsense FieldType: NetworkAliasField; multi-select: wire value is a single comma-joined string, not a JSON array */
|
|
179
|
+
destination_net: string;
|
|
180
|
+
/** OPNsense FieldType: BooleanField */
|
|
181
|
+
destination_not: string;
|
|
182
|
+
/** OPNsense FieldType: PortField */
|
|
183
|
+
destination_port?: string;
|
|
184
|
+
/** OPNsense FieldType: JsonKeyValueStoreField */
|
|
185
|
+
"divert-to"?: string;
|
|
186
|
+
/** OPNsense FieldType: JsonKeyValueStoreField */
|
|
187
|
+
gateway?: string;
|
|
188
|
+
/** OPNsense FieldType: JsonKeyValueStoreField */
|
|
189
|
+
replyto?: string;
|
|
190
|
+
/** OPNsense FieldType: BooleanField */
|
|
191
|
+
disablereplyto: string;
|
|
192
|
+
/** OPNsense FieldType: BooleanField */
|
|
193
|
+
log: string;
|
|
194
|
+
/** OPNsense FieldType: BooleanField */
|
|
195
|
+
allowopts: string;
|
|
196
|
+
/** OPNsense FieldType: BooleanField */
|
|
197
|
+
nosync: string;
|
|
198
|
+
/** OPNsense FieldType: BooleanField */
|
|
199
|
+
nopfsync: string;
|
|
200
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
201
|
+
statetimeout?: string;
|
|
202
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
203
|
+
"udp-first"?: string;
|
|
204
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
205
|
+
"udp-multiple"?: string;
|
|
206
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
207
|
+
"udp-single"?: string;
|
|
208
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
209
|
+
"max-src-nodes"?: string;
|
|
210
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
211
|
+
"max-src-states"?: string;
|
|
212
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
213
|
+
"max-src-conn"?: string;
|
|
214
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
215
|
+
max?: string;
|
|
216
|
+
/** OPNsense FieldType: IntegerField; range 1..4294967 (as text) */
|
|
217
|
+
"max-src-conn-rate"?: string;
|
|
218
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
219
|
+
"max-src-conn-rates"?: string;
|
|
220
|
+
/** OPNsense FieldType: IntegerField; range 1..4294967 (as text) */
|
|
221
|
+
"max-pkt-rate-number"?: string;
|
|
222
|
+
/** OPNsense FieldType: IntegerField; range 1..2147483647 (as text) */
|
|
223
|
+
"max-pkt-rate-seconds"?: string;
|
|
224
|
+
/** OPNsense FieldType: ModelRelationField */
|
|
225
|
+
overload?: string;
|
|
226
|
+
/** OPNsense FieldType: IntegerField; range 0..2147483647 (as text) */
|
|
227
|
+
adaptivestart?: string;
|
|
228
|
+
/** OPNsense FieldType: IntegerField; range 0..2147483647 (as text) */
|
|
229
|
+
adaptiveend?: string;
|
|
230
|
+
/** OPNsense FieldType: OptionField */
|
|
231
|
+
prio?: RuleItemPrio | (string & {});
|
|
232
|
+
/** OPNsense FieldType: OptionField */
|
|
233
|
+
"set-prio"?: RuleItemSetPrio | (string & {});
|
|
234
|
+
/** OPNsense FieldType: OptionField */
|
|
235
|
+
"set-prio-low"?: RuleItemSetPrioLow | (string & {});
|
|
236
|
+
/** OPNsense FieldType: StrictTextField; pattern /^([0-9a-zA-Z.,_\-]){0,512}$/u */
|
|
237
|
+
tag?: string;
|
|
238
|
+
/** OPNsense FieldType: StrictTextField; pattern /^([0-9a-zA-Z.,_\-]){0,512}$/u */
|
|
239
|
+
tagged?: string;
|
|
240
|
+
/** OPNsense FieldType: OptionField; multi-select: wire value is a single comma-joined string, not a JSON array */
|
|
241
|
+
tcpflags1?: RuleItemTcpflags1 | (string & {});
|
|
242
|
+
/** OPNsense FieldType: OptionField; multi-select: wire value is a single comma-joined string, not a JSON array */
|
|
243
|
+
tcpflags2?: RuleItemTcpflags2 | (string & {});
|
|
244
|
+
/** OPNsense FieldType: BooleanField */
|
|
245
|
+
tcpflags_any?: string;
|
|
246
|
+
/** OPNsense FieldType: ModelRelationField; multi-select: wire value is a single comma-joined string, not a JSON array */
|
|
247
|
+
categories?: string;
|
|
248
|
+
/** OPNsense FieldType: .\ScheduleField */
|
|
249
|
+
sched?: string;
|
|
250
|
+
/** OPNsense FieldType: .\TosField */
|
|
251
|
+
tos?: string;
|
|
252
|
+
/** OPNsense FieldType: ModelRelationField */
|
|
253
|
+
shaper1?: string;
|
|
254
|
+
/** OPNsense FieldType: ModelRelationField */
|
|
255
|
+
shaper2?: string;
|
|
256
|
+
/** OPNsense FieldType: DescriptionField */
|
|
257
|
+
description?: string;
|
|
258
|
+
}
|
|
259
|
+
export const RuleItem = /*@__PURE__*/ S.suspend(() =>
|
|
260
|
+
S.Struct({
|
|
261
|
+
uuid: S.optional(S.String),
|
|
262
|
+
enabled: S.String,
|
|
263
|
+
statetype: RuleItemStatetype,
|
|
264
|
+
"state-policy": S.optional(RuleItemStatePolicy),
|
|
265
|
+
sequence: S.String,
|
|
266
|
+
sort_order: S.optional(S.String),
|
|
267
|
+
prio_group: S.optional(S.String),
|
|
268
|
+
action: RuleItemAction,
|
|
269
|
+
quick: S.String,
|
|
270
|
+
interfacenot: S.String,
|
|
271
|
+
interface: S.optional(S.String),
|
|
272
|
+
direction: RuleItemDirection,
|
|
273
|
+
ipprotocol: RuleItemIpprotocol,
|
|
274
|
+
protocol: S.String,
|
|
275
|
+
icmptype: S.optional(RuleItemIcmptype),
|
|
276
|
+
icmp6type: S.optional(RuleItemIcmp6type),
|
|
277
|
+
source_net: S.String,
|
|
278
|
+
source_not: S.String,
|
|
279
|
+
source_port: S.optional(S.String),
|
|
280
|
+
destination_net: S.String,
|
|
281
|
+
destination_not: S.String,
|
|
282
|
+
destination_port: S.optional(S.String),
|
|
283
|
+
"divert-to": S.optional(S.String),
|
|
284
|
+
gateway: S.optional(S.String),
|
|
285
|
+
replyto: S.optional(S.String),
|
|
286
|
+
disablereplyto: S.String,
|
|
287
|
+
log: S.String,
|
|
288
|
+
allowopts: S.String,
|
|
289
|
+
nosync: S.String,
|
|
290
|
+
nopfsync: S.String,
|
|
291
|
+
statetimeout: S.optional(S.String),
|
|
292
|
+
"udp-first": S.optional(S.String),
|
|
293
|
+
"udp-multiple": S.optional(S.String),
|
|
294
|
+
"udp-single": S.optional(S.String),
|
|
295
|
+
"max-src-nodes": S.optional(S.String),
|
|
296
|
+
"max-src-states": S.optional(S.String),
|
|
297
|
+
"max-src-conn": S.optional(S.String),
|
|
298
|
+
max: S.optional(S.String),
|
|
299
|
+
"max-src-conn-rate": S.optional(S.String),
|
|
300
|
+
"max-src-conn-rates": S.optional(S.String),
|
|
301
|
+
"max-pkt-rate-number": S.optional(S.String),
|
|
302
|
+
"max-pkt-rate-seconds": S.optional(S.String),
|
|
303
|
+
overload: S.optional(S.String),
|
|
304
|
+
adaptivestart: S.optional(S.String),
|
|
305
|
+
adaptiveend: S.optional(S.String),
|
|
306
|
+
prio: S.optional(RuleItemPrio),
|
|
307
|
+
"set-prio": S.optional(RuleItemSetPrio),
|
|
308
|
+
"set-prio-low": S.optional(RuleItemSetPrioLow),
|
|
309
|
+
tag: S.optional(S.String),
|
|
310
|
+
tagged: S.optional(S.String),
|
|
311
|
+
tcpflags1: S.optional(RuleItemTcpflags1),
|
|
312
|
+
tcpflags2: S.optional(RuleItemTcpflags2),
|
|
313
|
+
tcpflags_any: S.optional(S.String),
|
|
314
|
+
categories: S.optional(S.String),
|
|
315
|
+
sched: S.optional(S.String),
|
|
316
|
+
tos: S.optional(S.String),
|
|
317
|
+
shaper1: S.optional(S.String),
|
|
318
|
+
shaper2: S.optional(S.String),
|
|
319
|
+
description: S.optional(S.String),
|
|
320
|
+
}),
|
|
321
|
+
).annotate({ identifier: "RuleItem" }) as any as S.Schema<RuleItem>;
|
|
322
|
+
|
|
323
|
+
export interface AddRuleRequest {
|
|
324
|
+
rule?: RuleItem;
|
|
325
|
+
}
|
|
326
|
+
export const AddRuleRequest = /*@__PURE__*/ S.suspend(() =>
|
|
327
|
+
S.Struct({
|
|
328
|
+
rule: S.optional(RuleItem),
|
|
329
|
+
}).pipe(
|
|
330
|
+
T.Http({ method: "POST", uri: "/api/firewall/filter/addRule", code: 200 }),
|
|
331
|
+
),
|
|
332
|
+
).annotate({ identifier: "AddRuleRequest" }) as any as S.Schema<AddRuleRequest>;
|
|
333
|
+
|
|
334
|
+
export type AddRuleResult = "saved";
|
|
335
|
+
export const AddRuleResult = S.String;
|
|
336
|
+
|
|
337
|
+
export interface AddRuleResponse {
|
|
338
|
+
result?: AddRuleResult;
|
|
339
|
+
/** The new item's uuid. */
|
|
340
|
+
uuid?: string;
|
|
341
|
+
}
|
|
342
|
+
export const AddRuleResponse = /*@__PURE__*/ S.suspend(() =>
|
|
343
|
+
S.Struct({
|
|
344
|
+
result: S.optional(AddRuleResult),
|
|
345
|
+
uuid: S.optional(S.String),
|
|
346
|
+
}),
|
|
347
|
+
).annotate({
|
|
348
|
+
identifier: "AddRuleResponse",
|
|
349
|
+
}) as any as S.Schema<AddRuleResponse>;
|
|
350
|
+
|
|
351
|
+
export interface DelRuleRequest {
|
|
352
|
+
uuid: string;
|
|
353
|
+
}
|
|
354
|
+
export const DelRuleRequest = /*@__PURE__*/ S.suspend(() =>
|
|
355
|
+
S.Struct({
|
|
356
|
+
uuid: S.String.pipe(T.Label()),
|
|
357
|
+
}).pipe(
|
|
358
|
+
T.Http({
|
|
359
|
+
method: "POST",
|
|
360
|
+
uri: "/api/firewall/filter/delRule/{uuid}",
|
|
361
|
+
code: 200,
|
|
362
|
+
}),
|
|
363
|
+
),
|
|
364
|
+
).annotate({ identifier: "DelRuleRequest" }) as any as S.Schema<DelRuleRequest>;
|
|
365
|
+
|
|
366
|
+
export type DelRuleResult = "deleted" | "not found";
|
|
367
|
+
export const DelRuleResult = S.String;
|
|
368
|
+
|
|
369
|
+
export interface DelRuleResponse {
|
|
370
|
+
result?: DelRuleResult;
|
|
371
|
+
}
|
|
372
|
+
export const DelRuleResponse = /*@__PURE__*/ S.suspend(() =>
|
|
373
|
+
S.Struct({
|
|
374
|
+
result: S.optional(DelRuleResult),
|
|
375
|
+
}),
|
|
376
|
+
).annotate({
|
|
377
|
+
identifier: "DelRuleResponse",
|
|
378
|
+
}) as any as S.Schema<DelRuleResponse>;
|
|
379
|
+
|
|
380
|
+
export interface GetRequest {}
|
|
381
|
+
export const GetRequest = /*@__PURE__*/ S.suspend(() =>
|
|
382
|
+
S.Struct({}).pipe(
|
|
383
|
+
T.Http({ method: "GET", uri: "/api/firewall/filter/get", code: 200 }),
|
|
384
|
+
),
|
|
385
|
+
).annotate({ identifier: "GetRequest" }) as any as S.Schema<GetRequest>;
|
|
386
|
+
|
|
387
|
+
export type ModelRuleItemType = "binat" | "nat";
|
|
388
|
+
export const ModelRuleItemType = S.String;
|
|
389
|
+
|
|
390
|
+
export type ModelRuleItemNatreflection = "default" | "enable" | "disable";
|
|
391
|
+
export const ModelRuleItemNatreflection = S.String;
|
|
392
|
+
|
|
393
|
+
export interface ModelRuleItem {
|
|
394
|
+
/** Item id, assigned by OPNsense on creation. */
|
|
395
|
+
uuid?: string;
|
|
396
|
+
/** OPNsense FieldType: BooleanField */
|
|
397
|
+
enabled: string;
|
|
398
|
+
/** OPNsense FieldType: BooleanField */
|
|
399
|
+
log: string;
|
|
400
|
+
/** OPNsense FieldType: .\FilterSequenceField; range 1..999999 (as text) */
|
|
401
|
+
sequence: string;
|
|
402
|
+
/** OPNsense FieldType: TextField */
|
|
403
|
+
sort_order?: string;
|
|
404
|
+
/** OPNsense FieldType: TextField */
|
|
405
|
+
prio_group?: string;
|
|
406
|
+
/** OPNsense FieldType: InterfaceField */
|
|
407
|
+
interface: string;
|
|
408
|
+
/** OPNsense FieldType: OptionField */
|
|
409
|
+
type: ModelRuleItemType | (string & {});
|
|
410
|
+
/** OPNsense FieldType: NetworkAliasField */
|
|
411
|
+
source_net: string;
|
|
412
|
+
/** OPNsense FieldType: BooleanField */
|
|
413
|
+
source_not: string;
|
|
414
|
+
/** OPNsense FieldType: NetworkAliasField */
|
|
415
|
+
destination_net: string;
|
|
416
|
+
/** OPNsense FieldType: BooleanField */
|
|
417
|
+
destination_not: string;
|
|
418
|
+
/** OPNsense FieldType: NetworkField */
|
|
419
|
+
external: string;
|
|
420
|
+
/** OPNsense FieldType: OptionField */
|
|
421
|
+
natreflection?: ModelRuleItemNatreflection | (string & {});
|
|
422
|
+
/** OPNsense FieldType: ModelRelationField; multi-select: wire value is a single comma-joined string, not a JSON array */
|
|
423
|
+
categories?: string;
|
|
424
|
+
/** OPNsense FieldType: DescriptionField */
|
|
425
|
+
description?: string;
|
|
426
|
+
}
|
|
427
|
+
export const ModelRuleItem = /*@__PURE__*/ S.suspend(() =>
|
|
428
|
+
S.Struct({
|
|
429
|
+
uuid: S.optional(S.String),
|
|
430
|
+
enabled: S.String,
|
|
431
|
+
log: S.String,
|
|
432
|
+
sequence: S.String,
|
|
433
|
+
sort_order: S.optional(S.String),
|
|
434
|
+
prio_group: S.optional(S.String),
|
|
435
|
+
interface: S.String,
|
|
436
|
+
type: ModelRuleItemType,
|
|
437
|
+
source_net: S.String,
|
|
438
|
+
source_not: S.String,
|
|
439
|
+
destination_net: S.String,
|
|
440
|
+
destination_not: S.String,
|
|
441
|
+
external: S.String,
|
|
442
|
+
natreflection: S.optional(ModelRuleItemNatreflection),
|
|
443
|
+
categories: S.optional(S.String),
|
|
444
|
+
description: S.optional(S.String),
|
|
445
|
+
}),
|
|
446
|
+
).annotate({ identifier: "ModelRuleItem" }) as any as S.Schema<ModelRuleItem>;
|
|
447
|
+
|
|
448
|
+
export type ModelRuleItemMap = { [key: string]: ModelRuleItem | undefined };
|
|
449
|
+
export const ModelRuleItemMap = /*@__PURE__*/ S.Record(
|
|
450
|
+
S.String,
|
|
451
|
+
ModelRuleItem,
|
|
452
|
+
) as any as S.Schema<ModelRuleItemMap>;
|
|
453
|
+
|
|
454
|
+
export interface ModelRules {
|
|
455
|
+
rule?: ModelRuleItemMap;
|
|
456
|
+
}
|
|
457
|
+
export const ModelRules = /*@__PURE__*/ S.suspend(() =>
|
|
458
|
+
S.Struct({
|
|
459
|
+
rule: S.optional(ModelRuleItemMap),
|
|
460
|
+
}),
|
|
461
|
+
).annotate({ identifier: "ModelRules" }) as any as S.Schema<ModelRules>;
|
|
462
|
+
|
|
463
|
+
export type ModelSnatrules = ModelRules;
|
|
464
|
+
export const ModelSnatrules = ModelRules;
|
|
465
|
+
|
|
466
|
+
export type ModelNpt = ModelRules;
|
|
467
|
+
export const ModelNpt = ModelRules;
|
|
468
|
+
|
|
469
|
+
export type ModelOnetoone = ModelRules;
|
|
470
|
+
export const ModelOnetoone = ModelRules;
|
|
471
|
+
|
|
472
|
+
export interface Model {
|
|
473
|
+
rules?: ModelRules;
|
|
474
|
+
snatrules?: ModelRules;
|
|
475
|
+
npt?: ModelRules;
|
|
476
|
+
onetoone?: ModelRules;
|
|
477
|
+
}
|
|
478
|
+
export const Model = /*@__PURE__*/ S.suspend(() =>
|
|
479
|
+
S.Struct({
|
|
480
|
+
rules: S.optional(ModelRules),
|
|
481
|
+
snatrules: S.optional(ModelRules),
|
|
482
|
+
npt: S.optional(ModelRules),
|
|
483
|
+
onetoone: S.optional(ModelRules),
|
|
484
|
+
}),
|
|
485
|
+
).annotate({ identifier: "Model" }) as any as S.Schema<Model>;
|
|
486
|
+
|
|
487
|
+
export interface GetResponse {
|
|
488
|
+
filter?: Model;
|
|
489
|
+
}
|
|
490
|
+
export const GetResponse = /*@__PURE__*/ S.suspend(() =>
|
|
491
|
+
S.Struct({
|
|
492
|
+
filter: S.optional(Model),
|
|
493
|
+
}),
|
|
494
|
+
).annotate({ identifier: "GetResponse" }) as any as S.Schema<GetResponse>;
|
|
495
|
+
|
|
496
|
+
export interface SetRequest {
|
|
497
|
+
filter?: Model;
|
|
498
|
+
}
|
|
499
|
+
export const SetRequest = /*@__PURE__*/ S.suspend(() =>
|
|
500
|
+
S.Struct({
|
|
501
|
+
filter: S.optional(Model),
|
|
502
|
+
}).pipe(
|
|
503
|
+
T.Http({ method: "POST", uri: "/api/firewall/filter/set", code: 200 }),
|
|
504
|
+
),
|
|
505
|
+
).annotate({ identifier: "SetRequest" }) as any as S.Schema<SetRequest>;
|
|
506
|
+
|
|
507
|
+
export type SetResult = "saved";
|
|
508
|
+
export const SetResult = S.String;
|
|
509
|
+
|
|
510
|
+
export interface SetResponse {
|
|
511
|
+
result?: SetResult;
|
|
512
|
+
}
|
|
513
|
+
export const SetResponse = /*@__PURE__*/ S.suspend(() =>
|
|
514
|
+
S.Struct({
|
|
515
|
+
result: S.optional(SetResult),
|
|
516
|
+
}),
|
|
517
|
+
).annotate({ identifier: "SetResponse" }) as any as S.Schema<SetResponse>;
|
|
518
|
+
|
|
519
|
+
export interface SetRuleRequest {
|
|
520
|
+
uuid: string;
|
|
521
|
+
rule?: RuleItem;
|
|
522
|
+
}
|
|
523
|
+
export const SetRuleRequest = /*@__PURE__*/ S.suspend(() =>
|
|
524
|
+
S.Struct({
|
|
525
|
+
uuid: S.String.pipe(T.Label()),
|
|
526
|
+
rule: S.optional(RuleItem),
|
|
527
|
+
}).pipe(
|
|
528
|
+
T.Http({
|
|
529
|
+
method: "POST",
|
|
530
|
+
uri: "/api/firewall/filter/setRule/{uuid}",
|
|
531
|
+
code: 200,
|
|
532
|
+
}),
|
|
533
|
+
),
|
|
534
|
+
).annotate({ identifier: "SetRuleRequest" }) as any as S.Schema<SetRuleRequest>;
|
|
535
|
+
|
|
536
|
+
export type SetRuleResult = "saved";
|
|
537
|
+
export const SetRuleResult = S.String;
|
|
538
|
+
|
|
539
|
+
export interface SetRuleResponse {
|
|
540
|
+
result?: SetRuleResult;
|
|
541
|
+
}
|
|
542
|
+
export const SetRuleResponse = /*@__PURE__*/ S.suspend(() =>
|
|
543
|
+
S.Struct({
|
|
544
|
+
result: S.optional(SetRuleResult),
|
|
545
|
+
}),
|
|
546
|
+
).annotate({
|
|
547
|
+
identifier: "SetRuleResponse",
|
|
548
|
+
}) as any as S.Schema<SetRuleResponse>;
|
|
549
|
+
|
|
550
|
+
export interface ToggleRuleRequest {
|
|
551
|
+
uuid: string;
|
|
552
|
+
}
|
|
553
|
+
export const ToggleRuleRequest = /*@__PURE__*/ S.suspend(() =>
|
|
554
|
+
S.Struct({
|
|
555
|
+
uuid: S.String.pipe(T.Label()),
|
|
556
|
+
}).pipe(
|
|
557
|
+
T.Http({
|
|
558
|
+
method: "POST",
|
|
559
|
+
uri: "/api/firewall/filter/toggleRule/{uuid}",
|
|
560
|
+
code: 200,
|
|
561
|
+
}),
|
|
562
|
+
),
|
|
563
|
+
).annotate({
|
|
564
|
+
identifier: "ToggleRuleRequest",
|
|
565
|
+
}) as any as S.Schema<ToggleRuleRequest>;
|
|
566
|
+
|
|
567
|
+
export type ToggleRuleResult = "Enabled" | "Disabled" | "failed";
|
|
568
|
+
export const ToggleRuleResult = S.String;
|
|
569
|
+
|
|
570
|
+
export interface ToggleRuleResponse {
|
|
571
|
+
result?: ToggleRuleResult;
|
|
572
|
+
changed?: boolean;
|
|
573
|
+
}
|
|
574
|
+
export const ToggleRuleResponse = /*@__PURE__*/ S.suspend(() =>
|
|
575
|
+
S.Struct({
|
|
576
|
+
result: S.optional(ToggleRuleResult),
|
|
577
|
+
changed: S.optional(S.Boolean),
|
|
578
|
+
}),
|
|
579
|
+
).annotate({
|
|
580
|
+
identifier: "ToggleRuleResponse",
|
|
581
|
+
}) as any as S.Schema<ToggleRuleResponse>;
|
|
582
|
+
|
|
583
|
+
export type AddRuleError = OpnsenseOpError;
|
|
584
|
+
/** Add a new rules.rule item. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
|
|
585
|
+
export const addRule: API.OperationMethod<
|
|
586
|
+
AddRuleRequest,
|
|
587
|
+
AddRuleResponse,
|
|
588
|
+
AddRuleError,
|
|
589
|
+
OpnsenseOpContext
|
|
590
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
591
|
+
input: AddRuleRequest,
|
|
592
|
+
output: AddRuleResponse,
|
|
593
|
+
errors: [],
|
|
594
|
+
protocol: OpnsenseProtocol,
|
|
595
|
+
retry: Retry.Retry,
|
|
596
|
+
}));
|
|
597
|
+
|
|
598
|
+
export type DelRuleError = OpnsenseOpError;
|
|
599
|
+
/** Delete a rules.rule item by uuid. */
|
|
600
|
+
export const delRule: API.OperationMethod<
|
|
601
|
+
DelRuleRequest,
|
|
602
|
+
DelRuleResponse,
|
|
603
|
+
DelRuleError,
|
|
604
|
+
OpnsenseOpContext
|
|
605
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
606
|
+
input: DelRuleRequest,
|
|
607
|
+
output: DelRuleResponse,
|
|
608
|
+
errors: [],
|
|
609
|
+
protocol: OpnsenseProtocol,
|
|
610
|
+
retry: Retry.Retry,
|
|
611
|
+
}));
|
|
612
|
+
|
|
613
|
+
export type GetError = OpnsenseOpError;
|
|
614
|
+
/** Fetch the entire model tree (every section and array collection). */
|
|
615
|
+
export const get: API.OperationMethod<
|
|
616
|
+
GetRequest,
|
|
617
|
+
GetResponse,
|
|
618
|
+
GetError,
|
|
619
|
+
OpnsenseOpContext
|
|
620
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
621
|
+
input: GetRequest,
|
|
622
|
+
output: GetResponse,
|
|
623
|
+
errors: [],
|
|
624
|
+
protocol: OpnsenseProtocol,
|
|
625
|
+
retry: Retry.Retry,
|
|
626
|
+
}));
|
|
627
|
+
|
|
628
|
+
export type SetError = OpnsenseOpError;
|
|
629
|
+
/** Replace the entire model tree in one call. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
|
|
630
|
+
export const set: API.OperationMethod<
|
|
631
|
+
SetRequest,
|
|
632
|
+
SetResponse,
|
|
633
|
+
SetError,
|
|
634
|
+
OpnsenseOpContext
|
|
635
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
636
|
+
input: SetRequest,
|
|
637
|
+
output: SetResponse,
|
|
638
|
+
errors: [],
|
|
639
|
+
protocol: OpnsenseProtocol,
|
|
640
|
+
retry: Retry.Retry,
|
|
641
|
+
}));
|
|
642
|
+
|
|
643
|
+
export type SetRuleError = OpnsenseOpError;
|
|
644
|
+
/** Update an existing rules.rule item. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
|
|
645
|
+
export const setRule: API.OperationMethod<
|
|
646
|
+
SetRuleRequest,
|
|
647
|
+
SetRuleResponse,
|
|
648
|
+
SetRuleError,
|
|
649
|
+
OpnsenseOpContext
|
|
650
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
651
|
+
input: SetRuleRequest,
|
|
652
|
+
output: SetRuleResponse,
|
|
653
|
+
errors: [],
|
|
654
|
+
protocol: OpnsenseProtocol,
|
|
655
|
+
retry: Retry.Retry,
|
|
656
|
+
}));
|
|
657
|
+
|
|
658
|
+
export type ToggleRuleError = OpnsenseOpError;
|
|
659
|
+
/** Flip a rules.rule item's enabled flag by uuid. */
|
|
660
|
+
export const toggleRule: API.OperationMethod<
|
|
661
|
+
ToggleRuleRequest,
|
|
662
|
+
ToggleRuleResponse,
|
|
663
|
+
ToggleRuleError,
|
|
664
|
+
OpnsenseOpContext
|
|
665
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
666
|
+
input: ToggleRuleRequest,
|
|
667
|
+
output: ToggleRuleResponse,
|
|
668
|
+
errors: [],
|
|
669
|
+
protocol: OpnsenseProtocol,
|
|
670
|
+
retry: Retry.Retry,
|
|
671
|
+
}));
|