@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.
Files changed (78) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +95 -0
  3. package/dist/credentials.d.ts +39 -0
  4. package/dist/credentials.d.ts.map +1 -0
  5. package/dist/credentials.js +78 -0
  6. package/dist/credentials.js.map +1 -0
  7. package/dist/errors.d.ts +110 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +63 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/index.d.ts +29 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +29 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/protocol.d.ts +13 -0
  16. package/dist/protocol.d.ts.map +1 -0
  17. package/dist/protocol.js +115 -0
  18. package/dist/protocol.js.map +1 -0
  19. package/dist/retry.d.ts +56 -0
  20. package/dist/retry.d.ts.map +1 -0
  21. package/dist/retry.js +49 -0
  22. package/dist/retry.js.map +1 -0
  23. package/dist/services/firewall_alias.d.ts +243 -0
  24. package/dist/services/firewall_alias.d.ts.map +1 -0
  25. package/dist/services/firewall_alias.js +222 -0
  26. package/dist/services/firewall_alias.js.map +1 -0
  27. package/dist/services/firewall_category.d.ts +122 -0
  28. package/dist/services/firewall_category.d.ts.map +1 -0
  29. package/dist/services/firewall_category.js +161 -0
  30. package/dist/services/firewall_category.js.map +1 -0
  31. package/dist/services/firewall_filter.d.ts +289 -0
  32. package/dist/services/firewall_filter.d.ts.map +1 -0
  33. package/dist/services/firewall_filter.js +225 -0
  34. package/dist/services/firewall_filter.js.map +1 -0
  35. package/dist/services/firewall_group.d.ts +122 -0
  36. package/dist/services/firewall_group.d.ts.map +1 -0
  37. package/dist/services/firewall_group.js +154 -0
  38. package/dist/services/firewall_group.js.map +1 -0
  39. package/dist/services/index.d.ts +9 -0
  40. package/dist/services/index.d.ts.map +1 -0
  41. package/dist/services/index.js +10 -0
  42. package/dist/services/index.js.map +1 -0
  43. package/dist/services/quagga_bgp.d.ts +1135 -0
  44. package/dist/services/quagga_bgp.d.ts.map +1 -0
  45. package/dist/services/quagga_bgp.js +1263 -0
  46. package/dist/services/quagga_bgp.js.map +1 -0
  47. package/dist/services/quagga_general.d.ts +55 -0
  48. package/dist/services/quagga_general.d.ts.map +1 -0
  49. package/dist/services/quagga_general.js +48 -0
  50. package/dist/services/quagga_general.js.map +1 -0
  51. package/dist/services/quagga_service.d.ts +60 -0
  52. package/dist/services/quagga_service.d.ts.map +1 -0
  53. package/dist/services/quagga_service.js +77 -0
  54. package/dist/services/quagga_service.js.map +1 -0
  55. package/dist/services/routing_settings.d.ts +192 -0
  56. package/dist/services/routing_settings.d.ts.map +1 -0
  57. package/dist/services/routing_settings.js +169 -0
  58. package/dist/services/routing_settings.js.map +1 -0
  59. package/dist/traits.d.ts +11 -0
  60. package/dist/traits.d.ts.map +1 -0
  61. package/dist/traits.js +11 -0
  62. package/dist/traits.js.map +1 -0
  63. package/package.json +75 -0
  64. package/src/credentials.ts +111 -0
  65. package/src/errors.ts +115 -0
  66. package/src/index.ts +32 -0
  67. package/src/protocol.ts +177 -0
  68. package/src/retry.ts +80 -0
  69. package/src/services/firewall_alias.ts +572 -0
  70. package/src/services/firewall_category.ts +359 -0
  71. package/src/services/firewall_filter.ts +671 -0
  72. package/src/services/firewall_group.ts +350 -0
  73. package/src/services/index.ts +9 -0
  74. package/src/services/quagga_bgp.ts +2955 -0
  75. package/src/services/quagga_general.ts +132 -0
  76. package/src/services/quagga_service.ts +182 -0
  77. package/src/services/routing_settings.ts +419 -0
  78. package/src/traits.ts +36 -0
@@ -0,0 +1,132 @@
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 GetRequest {}
15
+ export const GetRequest = /*@__PURE__*/ S.suspend(() =>
16
+ S.Struct({}).pipe(
17
+ T.Http({ method: "GET", uri: "/api/quagga/general/get", code: 200 }),
18
+ ),
19
+ ).annotate({ identifier: "GetRequest" }) as any as S.Schema<GetRequest>;
20
+
21
+ export type ModelDaemons = "bfd" | "bgp" | "ospf" | "ospf6" | "rip" | "static";
22
+ export const ModelDaemons = S.String;
23
+
24
+ export type ModelProfile = "traditional" | "datacenter";
25
+ export const ModelProfile = S.String;
26
+
27
+ export type ModelSysloglevel =
28
+ | "critical"
29
+ | "emergencies"
30
+ | "errors"
31
+ | "alerts"
32
+ | "warnings"
33
+ | "notifications"
34
+ | "informational"
35
+ | "debugging";
36
+ export const ModelSysloglevel = S.String;
37
+
38
+ export interface Model {
39
+ /** OPNsense FieldType: BooleanField */
40
+ enabled: string;
41
+ /** OPNsense FieldType: .\EnableDaemonField; multi-select: wire value is a single comma-joined string, not a JSON array */
42
+ daemons?: ModelDaemons | (string & {});
43
+ /** OPNsense FieldType: BooleanField */
44
+ manual_config: string;
45
+ /** OPNsense FieldType: OptionField */
46
+ profile: ModelProfile | (string & {});
47
+ /** OPNsense FieldType: BooleanField */
48
+ enablecarp: string;
49
+ /** OPNsense FieldType: BooleanField */
50
+ enablesyslog: string;
51
+ /** OPNsense FieldType: BooleanField */
52
+ enablesnmp: string;
53
+ /** OPNsense FieldType: OptionField */
54
+ sysloglevel: ModelSysloglevel | (string & {});
55
+ /** OPNsense FieldType: BooleanField */
56
+ fwrules: string;
57
+ }
58
+ export const Model = /*@__PURE__*/ S.suspend(() =>
59
+ S.Struct({
60
+ enabled: S.String,
61
+ daemons: S.optional(ModelDaemons),
62
+ manual_config: S.String,
63
+ profile: ModelProfile,
64
+ enablecarp: S.String,
65
+ enablesyslog: S.String,
66
+ enablesnmp: S.String,
67
+ sysloglevel: ModelSysloglevel,
68
+ fwrules: S.String,
69
+ }),
70
+ ).annotate({ identifier: "Model" }) as any as S.Schema<Model>;
71
+
72
+ export interface GetResponse {
73
+ general?: Model;
74
+ }
75
+ export const GetResponse = /*@__PURE__*/ S.suspend(() =>
76
+ S.Struct({
77
+ general: S.optional(Model),
78
+ }),
79
+ ).annotate({ identifier: "GetResponse" }) as any as S.Schema<GetResponse>;
80
+
81
+ export interface SetRequest {
82
+ general?: Model;
83
+ }
84
+ export const SetRequest = /*@__PURE__*/ S.suspend(() =>
85
+ S.Struct({
86
+ general: S.optional(Model),
87
+ }).pipe(
88
+ T.Http({ method: "POST", uri: "/api/quagga/general/set", code: 200 }),
89
+ ),
90
+ ).annotate({ identifier: "SetRequest" }) as any as S.Schema<SetRequest>;
91
+
92
+ export type SetResult = "saved";
93
+ export const SetResult = S.String;
94
+
95
+ export interface SetResponse {
96
+ result?: SetResult;
97
+ }
98
+ export const SetResponse = /*@__PURE__*/ S.suspend(() =>
99
+ S.Struct({
100
+ result: S.optional(SetResult),
101
+ }),
102
+ ).annotate({ identifier: "SetResponse" }) as any as S.Schema<SetResponse>;
103
+
104
+ export type GetError = OpnsenseOpError;
105
+ /** Fetch the entire model tree (every section and array collection). */
106
+ export const get: API.OperationMethod<
107
+ GetRequest,
108
+ GetResponse,
109
+ GetError,
110
+ OpnsenseOpContext
111
+ > = /*@__PURE__*/ API.make(() => ({
112
+ input: GetRequest,
113
+ output: GetResponse,
114
+ errors: [],
115
+ protocol: OpnsenseProtocol,
116
+ retry: Retry.Retry,
117
+ }));
118
+
119
+ export type SetError = OpnsenseOpError;
120
+ /** Replace the entire model tree in one call. On a validation failure the call fails with ValidationFailed instead of decoding this response. */
121
+ export const set: API.OperationMethod<
122
+ SetRequest,
123
+ SetResponse,
124
+ SetError,
125
+ OpnsenseOpContext
126
+ > = /*@__PURE__*/ API.make(() => ({
127
+ input: SetRequest,
128
+ output: SetResponse,
129
+ errors: [],
130
+ protocol: OpnsenseProtocol,
131
+ retry: Retry.Retry,
132
+ }));
@@ -0,0 +1,182 @@
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 ReconfigureRequest {}
15
+ export const ReconfigureRequest = /*@__PURE__*/ S.suspend(() =>
16
+ S.Struct({}).pipe(
17
+ T.Http({
18
+ method: "POST",
19
+ uri: "/api/quagga/service/reconfigure",
20
+ code: 200,
21
+ }),
22
+ ),
23
+ ).annotate({
24
+ identifier: "ReconfigureRequest",
25
+ }) as any as S.Schema<ReconfigureRequest>;
26
+
27
+ export interface ReconfigureResponse {
28
+ /** "ok" — a non-ok outcome fails the call as a typed error instead. */
29
+ status?: string;
30
+ }
31
+ export const ReconfigureResponse = /*@__PURE__*/ S.suspend(() =>
32
+ S.Struct({
33
+ status: S.optional(S.String),
34
+ }),
35
+ ).annotate({
36
+ identifier: "ReconfigureResponse",
37
+ }) as any as S.Schema<ReconfigureResponse>;
38
+
39
+ export interface RestartRequest {}
40
+ export const RestartRequest = /*@__PURE__*/ S.suspend(() =>
41
+ S.Struct({}).pipe(
42
+ T.Http({ method: "POST", uri: "/api/quagga/service/restart", code: 200 }),
43
+ ),
44
+ ).annotate({ identifier: "RestartRequest" }) as any as S.Schema<RestartRequest>;
45
+
46
+ export interface RestartResponse {
47
+ /** Raw configd output. */
48
+ response?: string;
49
+ }
50
+ export const RestartResponse = /*@__PURE__*/ S.suspend(() =>
51
+ S.Struct({
52
+ response: S.optional(S.String),
53
+ }),
54
+ ).annotate({
55
+ identifier: "RestartResponse",
56
+ }) as any as S.Schema<RestartResponse>;
57
+
58
+ export interface StartRequest {}
59
+ export const StartRequest = /*@__PURE__*/ S.suspend(() =>
60
+ S.Struct({}).pipe(
61
+ T.Http({ method: "POST", uri: "/api/quagga/service/start", code: 200 }),
62
+ ),
63
+ ).annotate({ identifier: "StartRequest" }) as any as S.Schema<StartRequest>;
64
+
65
+ export interface StartResponse {
66
+ /** Raw configd output. */
67
+ response?: string;
68
+ }
69
+ export const StartResponse = /*@__PURE__*/ S.suspend(() =>
70
+ S.Struct({
71
+ response: S.optional(S.String),
72
+ }),
73
+ ).annotate({ identifier: "StartResponse" }) as any as S.Schema<StartResponse>;
74
+
75
+ export interface StatusRequest {}
76
+ export const StatusRequest = /*@__PURE__*/ S.suspend(() =>
77
+ S.Struct({}).pipe(
78
+ T.Http({ method: "GET", uri: "/api/quagga/service/status", code: 200 }),
79
+ ),
80
+ ).annotate({ identifier: "StatusRequest" }) as any as S.Schema<StatusRequest>;
81
+
82
+ export interface StatusResponse {
83
+ /** One of "running", "stopped", "disabled", "unknown". */
84
+ status?: string;
85
+ }
86
+ export const StatusResponse = /*@__PURE__*/ S.suspend(() =>
87
+ S.Struct({
88
+ status: S.optional(S.String),
89
+ }),
90
+ ).annotate({ identifier: "StatusResponse" }) as any as S.Schema<StatusResponse>;
91
+
92
+ export interface StopRequest {}
93
+ export const StopRequest = /*@__PURE__*/ S.suspend(() =>
94
+ S.Struct({}).pipe(
95
+ T.Http({ method: "POST", uri: "/api/quagga/service/stop", code: 200 }),
96
+ ),
97
+ ).annotate({ identifier: "StopRequest" }) as any as S.Schema<StopRequest>;
98
+
99
+ export interface StopResponse {
100
+ /** Raw configd output. */
101
+ response?: string;
102
+ }
103
+ export const StopResponse = /*@__PURE__*/ S.suspend(() =>
104
+ S.Struct({
105
+ response: S.optional(S.String),
106
+ }),
107
+ ).annotate({ identifier: "StopResponse" }) as any as S.Schema<StopResponse>;
108
+
109
+ export type ReconfigureError = OpnsenseOpError;
110
+ /** Regenerate config and reload/restart as needed. */
111
+ export const reconfigure: API.OperationMethod<
112
+ ReconfigureRequest,
113
+ ReconfigureResponse,
114
+ ReconfigureError,
115
+ OpnsenseOpContext
116
+ > = /*@__PURE__*/ API.make(() => ({
117
+ input: ReconfigureRequest,
118
+ output: ReconfigureResponse,
119
+ errors: [],
120
+ protocol: OpnsenseProtocol,
121
+ retry: Retry.Retry,
122
+ }));
123
+
124
+ export type RestartError = OpnsenseOpError;
125
+ /** Restart the daemon. */
126
+ export const restart: API.OperationMethod<
127
+ RestartRequest,
128
+ RestartResponse,
129
+ RestartError,
130
+ OpnsenseOpContext
131
+ > = /*@__PURE__*/ API.make(() => ({
132
+ input: RestartRequest,
133
+ output: RestartResponse,
134
+ errors: [],
135
+ protocol: OpnsenseProtocol,
136
+ retry: Retry.Retry,
137
+ }));
138
+
139
+ export type StartError = OpnsenseOpError;
140
+ /** Start the daemon. */
141
+ export const start: API.OperationMethod<
142
+ StartRequest,
143
+ StartResponse,
144
+ StartError,
145
+ OpnsenseOpContext
146
+ > = /*@__PURE__*/ API.make(() => ({
147
+ input: StartRequest,
148
+ output: StartResponse,
149
+ errors: [],
150
+ protocol: OpnsenseProtocol,
151
+ retry: Retry.Retry,
152
+ }));
153
+
154
+ export type StatusError = OpnsenseOpError;
155
+ /** Current daemon status. */
156
+ export const status: API.OperationMethod<
157
+ StatusRequest,
158
+ StatusResponse,
159
+ StatusError,
160
+ OpnsenseOpContext
161
+ > = /*@__PURE__*/ API.make(() => ({
162
+ input: StatusRequest,
163
+ output: StatusResponse,
164
+ errors: [],
165
+ protocol: OpnsenseProtocol,
166
+ retry: Retry.Retry,
167
+ }));
168
+
169
+ export type StopError = OpnsenseOpError;
170
+ /** Stop the daemon. */
171
+ export const stop: API.OperationMethod<
172
+ StopRequest,
173
+ StopResponse,
174
+ StopError,
175
+ OpnsenseOpContext
176
+ > = /*@__PURE__*/ API.make(() => ({
177
+ input: StopRequest,
178
+ output: StopResponse,
179
+ errors: [],
180
+ protocol: OpnsenseProtocol,
181
+ retry: Retry.Retry,
182
+ }));