@highstate/library 0.18.0 → 0.20.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/dist/highstate.library.msgpack +0 -0
- package/dist/index.js +2314 -1141
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/abbreviations.ts +3 -0
- package/src/common/access-point.ts +23 -4
- package/src/common/files.ts +27 -17
- package/src/common/server.ts +28 -7
- package/src/databases/etcd.ts +142 -37
- package/src/databases/index.ts +8 -7
- package/src/databases/influxdb3.ts +103 -0
- package/src/databases/minio.ts +157 -0
- package/src/databases/mongodb.ts +122 -40
- package/src/databases/mysql.ts +172 -0
- package/src/databases/postgresql.ts +133 -39
- package/src/databases/redis.ts +118 -43
- package/src/databases/s3.ts +49 -126
- package/src/dns.ts +12 -7
- package/src/index.ts +1 -1
- package/src/k3s.ts +7 -0
- package/src/k8s/apps/etcd.ts +3 -3
- package/src/k8s/apps/gitea.ts +1 -1
- package/src/k8s/apps/grafana.ts +48 -0
- package/src/k8s/apps/index.ts +4 -2
- package/src/k8s/apps/mariadb.ts +7 -38
- package/src/k8s/apps/matrix-stack.ts +62 -0
- package/src/k8s/apps/minio.ts +38 -45
- package/src/k8s/apps/mongodb.ts +6 -38
- package/src/k8s/apps/portal.ts +27 -0
- package/src/k8s/apps/postgresql.ts +7 -41
- package/src/k8s/apps/refluxdb.ts +49 -0
- package/src/k8s/apps/remnawave.ts +17 -1
- package/src/k8s/apps/shared.ts +16 -15
- package/src/k8s/apps/traefik.ts +5 -0
- package/src/k8s/apps/valkey.ts +5 -5
- package/src/k8s/apps/vaultwarden.ts +2 -6
- package/src/k8s/apps/workload.ts +14 -11
- package/src/k8s/cert-manager.ts +22 -0
- package/src/k8s/cilium.ts +17 -2
- package/src/k8s/resources.ts +50 -9
- package/src/k8s/service.ts +7 -2
- package/src/k8s/shared.ts +50 -18
- package/src/k8s/workload.ts +65 -42
- package/src/network/address-space.ts +17 -7
- package/src/network/address.ts +14 -2
- package/src/network/endpoint-container.ts +235 -0
- package/src/network/endpoint-schema.ts +8 -0
- package/src/network/endpoint.ts +23 -39
- package/src/network/index.ts +1 -1
- package/src/network/subnet.ts +5 -2
- package/src/proxmox.ts +27 -7
- package/src/restic.ts +9 -2
- package/src/ssh.ts +63 -31
- package/src/talos.ts +10 -1
- package/src/third-party/cloudflare.ts +4 -4
- package/src/third-party/timeweb.ts +18 -3
- package/src/third-party/yandex.ts +203 -86
- package/src/tls.ts +22 -0
- package/src/utils.ts +16 -1
- package/src/wireguard.ts +352 -120
- package/src/databases/mariadb.ts +0 -90
- package/src/databases/shared.ts +0 -67
- package/src/k8s/apps/kubernetes-dashboard.ts +0 -28
- package/src/k8s/apps/maybe.ts +0 -39
- package/src/network/dynamic-endpoint.ts +0 -39
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
z,
|
|
7
|
+
} from "@highstate/contract"
|
|
3
8
|
import { subnetEntity } from "./subnet"
|
|
4
9
|
|
|
5
|
-
export type AddressSpace =
|
|
10
|
+
export type AddressSpace = EntityValue<typeof addressSpaceEntity>
|
|
11
|
+
export type AddressSpaceInput = EntityInput<typeof addressSpaceEntity>
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* The entity representing a network address space.
|
|
@@ -17,6 +23,7 @@ export const addressSpaceEntity = defineEntity({
|
|
|
17
23
|
subnets: {
|
|
18
24
|
entity: subnetEntity,
|
|
19
25
|
multiple: true,
|
|
26
|
+
required: false,
|
|
20
27
|
},
|
|
21
28
|
},
|
|
22
29
|
|
|
@@ -24,6 +31,9 @@ export const addressSpaceEntity = defineEntity({
|
|
|
24
31
|
|
|
25
32
|
meta: {
|
|
26
33
|
color: "#3F51B5",
|
|
34
|
+
title: "Address Space",
|
|
35
|
+
icon: "mdi:network",
|
|
36
|
+
iconColor: "#3F51B5",
|
|
27
37
|
},
|
|
28
38
|
})
|
|
29
39
|
|
|
@@ -56,19 +66,19 @@ export const addressSpace = defineUnit({
|
|
|
56
66
|
|
|
57
67
|
inputs: {
|
|
58
68
|
/**
|
|
59
|
-
* The
|
|
69
|
+
* The subnets to include in the address space.
|
|
60
70
|
*/
|
|
61
71
|
included: {
|
|
62
|
-
entity:
|
|
72
|
+
entity: subnetEntity,
|
|
63
73
|
multiple: true,
|
|
64
74
|
required: false,
|
|
65
75
|
},
|
|
66
76
|
|
|
67
77
|
/**
|
|
68
|
-
* The
|
|
78
|
+
* The subnets to exclude from the `included` list.
|
|
69
79
|
*/
|
|
70
80
|
excluded: {
|
|
71
|
-
entity:
|
|
81
|
+
entity: subnetEntity,
|
|
72
82
|
multiple: true,
|
|
73
83
|
required: false,
|
|
74
84
|
},
|
package/src/network/address.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineEntity, z } from "@highstate/contract"
|
|
1
|
+
import { defineEntity, type EntityInput, type EntityValue, z } from "@highstate/contract"
|
|
2
2
|
import { addressTypeSchema, subnetEntity } from "./subnet"
|
|
3
3
|
|
|
4
|
-
export type Address =
|
|
4
|
+
export type Address = EntityValue<typeof addressEntity>
|
|
5
|
+
export type AddressInput = EntityInput<typeof addressEntity>
|
|
5
6
|
|
|
6
7
|
export const addressEntity = defineEntity({
|
|
7
8
|
type: "network.address.v1",
|
|
@@ -11,6 +12,12 @@ export const addressEntity = defineEntity({
|
|
|
11
12
|
* The subnet to which the address belongs.
|
|
12
13
|
*/
|
|
13
14
|
subnet: subnetEntity,
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The subnet containing the single address.
|
|
18
|
+
* Can be used to provide address entity where subnet entity is expected.
|
|
19
|
+
*/
|
|
20
|
+
asSubnet: subnetEntity,
|
|
14
21
|
},
|
|
15
22
|
|
|
16
23
|
schema: z.object({
|
|
@@ -30,4 +37,9 @@ export const addressEntity = defineEntity({
|
|
|
30
37
|
*/
|
|
31
38
|
value: z.string(),
|
|
32
39
|
}),
|
|
40
|
+
|
|
41
|
+
meta: {
|
|
42
|
+
title: "Address",
|
|
43
|
+
icon: "mdi:ip",
|
|
44
|
+
},
|
|
33
45
|
})
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$args,
|
|
3
|
+
defineEntity,
|
|
4
|
+
defineUnit,
|
|
5
|
+
type EntityInput,
|
|
6
|
+
type EntityValue,
|
|
7
|
+
z,
|
|
8
|
+
} from "@highstate/contract"
|
|
9
|
+
import { pick } from "remeda"
|
|
10
|
+
import { addressEntity } from "./address"
|
|
11
|
+
import {
|
|
12
|
+
l3EndpointEntity,
|
|
13
|
+
l4EndpointEntity,
|
|
14
|
+
l7EndpointEntity,
|
|
15
|
+
optionalNetworkArgs,
|
|
16
|
+
} from "./endpoint"
|
|
17
|
+
|
|
18
|
+
export const l3EndpointContainer = defineEntity({
|
|
19
|
+
type: "network.l3-endpoint-container.v1",
|
|
20
|
+
|
|
21
|
+
includes: {
|
|
22
|
+
endpoints: {
|
|
23
|
+
entity: l3EndpointEntity,
|
|
24
|
+
multiple: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
schema: z.unknown(),
|
|
29
|
+
|
|
30
|
+
meta: {
|
|
31
|
+
color: "#4CAF50",
|
|
32
|
+
title: "L3 Endpoint Container",
|
|
33
|
+
icon: "mdi:network-outline",
|
|
34
|
+
iconColor: "#4CAF50",
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export const l4EndpointContainer = defineEntity({
|
|
39
|
+
type: "network.l4-endpoint-container.v1",
|
|
40
|
+
|
|
41
|
+
includes: {
|
|
42
|
+
endpoints: {
|
|
43
|
+
entity: l4EndpointEntity,
|
|
44
|
+
multiple: true,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
schema: z.unknown(),
|
|
49
|
+
|
|
50
|
+
meta: {
|
|
51
|
+
color: "#2196F3",
|
|
52
|
+
title: "L4 Endpoint Container",
|
|
53
|
+
icon: "mdi:network-outline",
|
|
54
|
+
iconColor: "#2196F3",
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
export const l7EndpointContainer = defineEntity({
|
|
59
|
+
type: "network.l7-endpoint-container.v1",
|
|
60
|
+
|
|
61
|
+
includes: {
|
|
62
|
+
endpoints: {
|
|
63
|
+
entity: l7EndpointEntity,
|
|
64
|
+
multiple: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
schema: z.unknown(),
|
|
69
|
+
|
|
70
|
+
meta: {
|
|
71
|
+
color: "#FF9800",
|
|
72
|
+
title: "L7 Endpoint Container",
|
|
73
|
+
icon: "mdi:network-outline",
|
|
74
|
+
iconColor: "#FF9800",
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const endpointReplacerArgs = $args({
|
|
79
|
+
/**
|
|
80
|
+
* The strings to parse as endpoints and add to the replacement list.
|
|
81
|
+
*/
|
|
82
|
+
endpoints: z.string().array().default([]),
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Whether to add current endpoints of the entity to the replacement list.
|
|
86
|
+
*
|
|
87
|
+
* Defaults to `true`.
|
|
88
|
+
*/
|
|
89
|
+
includeCurrent: z.boolean().default(true),
|
|
90
|
+
|
|
91
|
+
...pick(optionalNetworkArgs, ["endpointFilter"]),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Replaces the L3 endpoints in the entity.
|
|
96
|
+
*/
|
|
97
|
+
export const l3EndpointReplacer = defineUnit({
|
|
98
|
+
type: "network.l3-endpoint-replacer.v1",
|
|
99
|
+
|
|
100
|
+
args: endpointReplacerArgs,
|
|
101
|
+
|
|
102
|
+
inputs: {
|
|
103
|
+
/**
|
|
104
|
+
* The entity containing the "endpoints" inclusion to replace.
|
|
105
|
+
*/
|
|
106
|
+
entity: l3EndpointContainer,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The endpoints to add to the replacement list.
|
|
110
|
+
*/
|
|
111
|
+
endpoints: {
|
|
112
|
+
entity: l3EndpointEntity,
|
|
113
|
+
multiple: true,
|
|
114
|
+
required: false,
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The IP addresses to parse as endpoints and add to the replacement list.
|
|
119
|
+
*/
|
|
120
|
+
addresses: {
|
|
121
|
+
entity: addressEntity,
|
|
122
|
+
multiple: true,
|
|
123
|
+
required: false,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
outputs: {
|
|
128
|
+
entity: { fromInput: "entity" },
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
meta: {
|
|
132
|
+
title: "L3 Endpoint Replacer",
|
|
133
|
+
icon: "mdi:network-outline",
|
|
134
|
+
iconColor: "#FF9800",
|
|
135
|
+
secondaryIcon: "mdi:swap-horizontal-bold",
|
|
136
|
+
category: "Network",
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
source: {
|
|
140
|
+
package: "@highstate/common",
|
|
141
|
+
path: "units/network/l3-endpoint-replacer",
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Replaces the L4 endpoints in the entity.
|
|
147
|
+
*/
|
|
148
|
+
export const l4EndpointReplacer = defineUnit({
|
|
149
|
+
type: "network.l4-endpoint-replacer.v1",
|
|
150
|
+
|
|
151
|
+
args: endpointReplacerArgs,
|
|
152
|
+
|
|
153
|
+
inputs: {
|
|
154
|
+
/**
|
|
155
|
+
* The entity containing the "endpoints" inclusion to replace.
|
|
156
|
+
*/
|
|
157
|
+
entity: l4EndpointContainer,
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The endpoints to add to the replacement list.
|
|
161
|
+
*/
|
|
162
|
+
endpoints: {
|
|
163
|
+
entity: l4EndpointEntity,
|
|
164
|
+
multiple: true,
|
|
165
|
+
required: false,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
outputs: {
|
|
170
|
+
entity: { fromInput: "entity" },
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
meta: {
|
|
174
|
+
title: "L4 Endpoint Replacer",
|
|
175
|
+
icon: "mdi:network-outline",
|
|
176
|
+
iconColor: "#FF9800",
|
|
177
|
+
secondaryIcon: "mdi:swap-horizontal-bold",
|
|
178
|
+
category: "Network",
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
source: {
|
|
182
|
+
package: "@highstate/common",
|
|
183
|
+
path: "units/network/l4-endpoint-replacer",
|
|
184
|
+
},
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Replaces the L7 endpoints in the entity.
|
|
189
|
+
*/
|
|
190
|
+
export const l7EndpointReplacer = defineUnit({
|
|
191
|
+
type: "network.l7-endpoint-replacer.v1",
|
|
192
|
+
|
|
193
|
+
args: endpointReplacerArgs,
|
|
194
|
+
|
|
195
|
+
inputs: {
|
|
196
|
+
/**
|
|
197
|
+
* The entity containing the "endpoints" inclusion to replace.
|
|
198
|
+
*/
|
|
199
|
+
entity: l7EndpointContainer,
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The endpoints to add to the replacement list.
|
|
203
|
+
*/
|
|
204
|
+
endpoints: {
|
|
205
|
+
entity: l7EndpointEntity,
|
|
206
|
+
multiple: true,
|
|
207
|
+
required: false,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
outputs: {
|
|
212
|
+
entity: { fromInput: "entity" },
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
meta: {
|
|
216
|
+
title: "L7 Endpoint Replacer",
|
|
217
|
+
icon: "mdi:network-outline",
|
|
218
|
+
iconColor: "#FF9800",
|
|
219
|
+
secondaryIcon: "mdi:swap-horizontal-bold",
|
|
220
|
+
category: "Network",
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
source: {
|
|
224
|
+
package: "@highstate/common",
|
|
225
|
+
path: "units/network/l7-endpoint-replacer",
|
|
226
|
+
},
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
export type L3EndpointContainer = EntityValue<typeof l3EndpointContainer>
|
|
230
|
+
export type L4EndpointContainer = EntityValue<typeof l4EndpointContainer>
|
|
231
|
+
export type L7EndpointContainer = EntityValue<typeof l7EndpointContainer>
|
|
232
|
+
|
|
233
|
+
export type L3EndpointContainerInput = EntityInput<typeof l3EndpointContainer>
|
|
234
|
+
export type L4EndpointContainerInput = EntityInput<typeof l4EndpointContainer>
|
|
235
|
+
export type L7EndpointContainerInput = EntityInput<typeof l7EndpointContainer>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "@highstate/contract"
|
|
2
|
+
import { implementationReferenceSchema } from "../impl-ref"
|
|
2
3
|
import { metadataSchema } from "../utils"
|
|
3
4
|
import { addressEntity } from "./address"
|
|
4
5
|
|
|
@@ -33,6 +34,13 @@ function createEndpointSchema<TLevel extends number, TShape extends z.core.$ZodS
|
|
|
33
34
|
}),
|
|
34
35
|
),
|
|
35
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The implementation reference that will be used to resolve the endpoint at runtime.
|
|
39
|
+
*
|
|
40
|
+
* Used primarily to expose endpoints from private networks to the Pulumi program.
|
|
41
|
+
*/
|
|
42
|
+
implRef: implementationReferenceSchema.optional(),
|
|
43
|
+
|
|
36
44
|
...shape,
|
|
37
45
|
}),
|
|
38
46
|
z.union([
|
package/src/network/endpoint.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { Simplify } from "type-fest"
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
$args,
|
|
4
|
+
defineEntity,
|
|
5
|
+
defineUnit,
|
|
6
|
+
type EntityInput,
|
|
7
|
+
type EntityValue,
|
|
8
|
+
z,
|
|
9
|
+
} from "@highstate/contract"
|
|
3
10
|
import { mapValues, pick } from "remeda"
|
|
4
11
|
import { metadataSchema } from "../utils"
|
|
5
12
|
import { addressEntity } from "./address"
|
|
6
|
-
import {
|
|
7
|
-
dynamicL3EndpointEntity,
|
|
8
|
-
dynamicL4EndpointEntity,
|
|
9
|
-
dynamicL7EndpointEntity,
|
|
10
|
-
} from "./dynamic-endpoint"
|
|
11
13
|
import {
|
|
12
14
|
l3EndpointSchema,
|
|
13
15
|
l4EndpointSchema,
|
|
@@ -46,22 +48,15 @@ export const l3EndpointEntity = defineEntity({
|
|
|
46
48
|
entity: addressEntity,
|
|
47
49
|
required: false,
|
|
48
50
|
},
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The dynamic endpoint which statically resolves to this endpoint.
|
|
52
|
-
*
|
|
53
|
-
* Allows to use any static endpoint as a dynamic without extra units.
|
|
54
|
-
*/
|
|
55
|
-
dynamic: {
|
|
56
|
-
entity: dynamicL3EndpointEntity,
|
|
57
|
-
required: false,
|
|
58
|
-
},
|
|
59
51
|
},
|
|
60
52
|
|
|
61
53
|
schema: l3EndpointSchema,
|
|
62
54
|
|
|
63
55
|
meta: {
|
|
64
56
|
color: "#4CAF50",
|
|
57
|
+
title: "L3 Endpoint",
|
|
58
|
+
icon: "mdi:network-outline",
|
|
59
|
+
iconColor: "#4CAF50",
|
|
65
60
|
},
|
|
66
61
|
})
|
|
67
62
|
|
|
@@ -84,20 +79,13 @@ export const l4EndpointEntity = defineEntity({
|
|
|
84
79
|
type: "network.l4-endpoint.v1",
|
|
85
80
|
|
|
86
81
|
extends: { l3EndpointEntity },
|
|
87
|
-
|
|
88
|
-
includes: {
|
|
89
|
-
/**
|
|
90
|
-
* The dynamic endpoint which statically resolves to this endpoint.
|
|
91
|
-
*
|
|
92
|
-
* Allows to use any static endpoint as a dynamic without extra units.
|
|
93
|
-
*/
|
|
94
|
-
dynamic: dynamicL4EndpointEntity,
|
|
95
|
-
},
|
|
96
|
-
|
|
97
82
|
schema: l4EndpointSchema,
|
|
98
83
|
|
|
99
84
|
meta: {
|
|
100
85
|
color: "#2196F3",
|
|
86
|
+
title: "L4 Endpoint",
|
|
87
|
+
icon: "mdi:network-outline",
|
|
88
|
+
iconColor: "#2196F3",
|
|
101
89
|
},
|
|
102
90
|
})
|
|
103
91
|
|
|
@@ -110,20 +98,13 @@ export const l7EndpointEntity = defineEntity({
|
|
|
110
98
|
type: "network.l7-endpoint.v1",
|
|
111
99
|
|
|
112
100
|
extends: { l4EndpointEntity },
|
|
113
|
-
|
|
114
|
-
includes: {
|
|
115
|
-
/**
|
|
116
|
-
* The dynamic endpoint which statically resolves to this endpoint.
|
|
117
|
-
*
|
|
118
|
-
* Allows to use any static endpoint as a dynamic without extra units.
|
|
119
|
-
*/
|
|
120
|
-
dynamic: dynamicL7EndpointEntity,
|
|
121
|
-
},
|
|
122
|
-
|
|
123
101
|
schema: l7EndpointSchema,
|
|
124
102
|
|
|
125
103
|
meta: {
|
|
126
104
|
color: "#FF9800",
|
|
105
|
+
title: "L7 Endpoint",
|
|
106
|
+
icon: "mdi:network-outline",
|
|
107
|
+
iconColor: "#FF9800",
|
|
127
108
|
},
|
|
128
109
|
})
|
|
129
110
|
|
|
@@ -331,11 +312,14 @@ export const endpointFilter = defineUnit({
|
|
|
331
312
|
},
|
|
332
313
|
})
|
|
333
314
|
|
|
334
|
-
export type L3Endpoint = Simplify<
|
|
335
|
-
export type
|
|
315
|
+
export type L3Endpoint = Simplify<EntityValue<typeof l3EndpointEntity>>
|
|
316
|
+
export type L3EndpointInput = EntityInput<typeof l3EndpointEntity>
|
|
317
|
+
export type L4Endpoint = Simplify<EntityValue<typeof l4EndpointEntity>>
|
|
318
|
+
export type L4EndpointInput = EntityInput<typeof l4EndpointEntity>
|
|
336
319
|
export type L4Protocol = z.infer<typeof l4ProtocolSchema>
|
|
337
320
|
export type L4PortInfo = z.infer<typeof l4PortInfoSchema>
|
|
338
|
-
export type L7Endpoint = Simplify<
|
|
321
|
+
export type L7Endpoint = Simplify<EntityValue<typeof l7EndpointEntity>>
|
|
322
|
+
export type L7EndpointInput = EntityInput<typeof l7EndpointEntity>
|
|
339
323
|
export type L7AppInfo = z.infer<typeof l7AppInfoSchema>
|
|
340
324
|
|
|
341
325
|
export type EndpointLevel = L3Endpoint["level"]
|
package/src/network/index.ts
CHANGED
package/src/network/subnet.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineEntity, z } from "@highstate/contract"
|
|
1
|
+
import { defineEntity, type EntityInput, type EntityValue, z } from "@highstate/contract"
|
|
2
2
|
|
|
3
|
-
export type Subnet =
|
|
3
|
+
export type Subnet = EntityValue<typeof subnetEntity>
|
|
4
|
+
export type SubnetInput = EntityInput<typeof subnetEntity>
|
|
4
5
|
export type AddressType = z.infer<typeof addressTypeSchema>
|
|
5
6
|
|
|
6
7
|
export const addressTypeSchema = z.enum(["ipv4", "ipv6"])
|
|
@@ -26,6 +27,8 @@ export const subnetEntity = defineEntity({
|
|
|
26
27
|
}),
|
|
27
28
|
|
|
28
29
|
meta: {
|
|
30
|
+
title: "Subnet",
|
|
31
|
+
icon: "ri:network-line",
|
|
29
32
|
color: "#3F51B5",
|
|
30
33
|
},
|
|
31
34
|
})
|
package/src/proxmox.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
secretSchema,
|
|
7
|
+
z,
|
|
8
|
+
} from "@highstate/contract"
|
|
2
9
|
import {
|
|
3
10
|
checksumSchema,
|
|
4
11
|
fileEntity,
|
|
@@ -13,6 +20,18 @@ import * as ssh from "./ssh"
|
|
|
13
20
|
export const clusterEntity = defineEntity({
|
|
14
21
|
type: "proxmox.cluster.v1",
|
|
15
22
|
|
|
23
|
+
includes: {
|
|
24
|
+
/**
|
|
25
|
+
* The SSH configuration for the Proxmox nodes.
|
|
26
|
+
*
|
|
27
|
+
* If not specified, it will be assumed that the nodes are not accessible via SSH.
|
|
28
|
+
*/
|
|
29
|
+
ssh: {
|
|
30
|
+
entity: ssh.connectionEntity,
|
|
31
|
+
required: false,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
|
|
16
35
|
schema: z.object({
|
|
17
36
|
endpoint: l7EndpointEntity.schema,
|
|
18
37
|
insecure: z.boolean().optional(),
|
|
@@ -21,10 +40,8 @@ export const clusterEntity = defineEntity({
|
|
|
21
40
|
defaultNodeName: z.string(),
|
|
22
41
|
defaultDatastoreId: z.string(),
|
|
23
42
|
|
|
24
|
-
password: z.string().optional(),
|
|
25
|
-
apiToken: z.string().optional(),
|
|
26
|
-
|
|
27
|
-
ssh: ssh.connectionSchema.optional(),
|
|
43
|
+
password: secretSchema(z.string()).optional(),
|
|
44
|
+
apiToken: secretSchema(z.string()).optional(),
|
|
28
45
|
}),
|
|
29
46
|
|
|
30
47
|
meta: {
|
|
@@ -430,5 +447,8 @@ export const virtualMachine = defineUnit({
|
|
|
430
447
|
},
|
|
431
448
|
})
|
|
432
449
|
|
|
433
|
-
export type Cluster =
|
|
434
|
-
export type Image =
|
|
450
|
+
export type Cluster = EntityValue<typeof clusterEntity>
|
|
451
|
+
export type Image = EntityValue<typeof imageEntity>
|
|
452
|
+
|
|
453
|
+
export type ClusterInput = EntityInput<typeof clusterEntity>
|
|
454
|
+
export type ImageInput = EntityInput<typeof imageEntity>
|
package/src/restic.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
z,
|
|
7
|
+
} from "@highstate/contract"
|
|
2
8
|
import { l3EndpointEntity, l4EndpointEntity } from "./network"
|
|
3
9
|
|
|
4
10
|
export const repositoryEntity = defineEntity({
|
|
@@ -82,4 +88,5 @@ export const repository = defineUnit({
|
|
|
82
88
|
},
|
|
83
89
|
})
|
|
84
90
|
|
|
85
|
-
export type Repository =
|
|
91
|
+
export type Repository = EntityValue<typeof repositoryEntity>
|
|
92
|
+
export type RepositoryInput = EntityInput<typeof repositoryEntity>
|
package/src/ssh.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
$inputs,
|
|
3
|
+
$secrets,
|
|
4
|
+
defineEntity,
|
|
5
|
+
defineUnit,
|
|
6
|
+
type EntityInput,
|
|
7
|
+
type EntityValue,
|
|
8
|
+
secretSchema,
|
|
9
|
+
z,
|
|
10
|
+
} from "@highstate/contract"
|
|
3
11
|
import { l4EndpointEntity, portSchema } from "./network"
|
|
4
12
|
|
|
5
13
|
export const keyTypeSchema = z.enum(["ed25519"])
|
|
@@ -43,44 +51,66 @@ export const keyPairEntity = defineEntity({
|
|
|
43
51
|
/**
|
|
44
52
|
* The private key in PEM format.
|
|
45
53
|
*/
|
|
46
|
-
privateKey: z.string(),
|
|
54
|
+
privateKey: secretSchema(z.string()),
|
|
47
55
|
}),
|
|
48
56
|
|
|
49
57
|
meta: {
|
|
50
58
|
color: "#2b5797",
|
|
59
|
+
title: "SSH Key Pair",
|
|
60
|
+
icon: "charm:key",
|
|
61
|
+
iconColor: "#ffffff",
|
|
62
|
+
secondaryIcon: "mdi:lock",
|
|
63
|
+
secondaryIconColor: "#ffffff",
|
|
51
64
|
},
|
|
52
65
|
})
|
|
53
66
|
|
|
54
67
|
/**
|
|
55
|
-
* The schema for the SSH connection
|
|
56
|
-
*
|
|
57
|
-
* Contains enough information to connect to an SSH server.
|
|
68
|
+
* The schema for the SSH connection credentials.
|
|
58
69
|
*/
|
|
59
|
-
export const
|
|
60
|
-
|
|
61
|
-
* The list of L4 endpoints which can be used to connect to the SSH server.
|
|
62
|
-
*/
|
|
63
|
-
endpoints: l4EndpointEntity.schema.array(),
|
|
70
|
+
export const connectionEntity = defineEntity({
|
|
71
|
+
type: "ssh.connection.v1",
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
includes: {
|
|
74
|
+
/**
|
|
75
|
+
* The endpoints to connect to.
|
|
76
|
+
*/
|
|
77
|
+
endpoints: {
|
|
78
|
+
entity: l4EndpointEntity,
|
|
79
|
+
multiple: true,
|
|
80
|
+
},
|
|
69
81
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
/**
|
|
83
|
+
* The SSH key pair to use for authentication.
|
|
84
|
+
*/
|
|
85
|
+
keyPair: {
|
|
86
|
+
entity: keyPairEntity,
|
|
87
|
+
required: false,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
74
90
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
schema: z.object({
|
|
92
|
+
/**
|
|
93
|
+
* The host key of the SSH server which will be used to verify the server's identity.
|
|
94
|
+
*/
|
|
95
|
+
hostKey: z.string(),
|
|
79
96
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
/**
|
|
98
|
+
* The user to connect as.
|
|
99
|
+
*/
|
|
100
|
+
user: z.string(),
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The password to use for authentication.
|
|
104
|
+
*/
|
|
105
|
+
password: secretSchema(z.string()).optional(),
|
|
106
|
+
}),
|
|
107
|
+
|
|
108
|
+
meta: {
|
|
109
|
+
color: "#2b5797",
|
|
110
|
+
title: "SSH Connection",
|
|
111
|
+
icon: "mdi:terminal",
|
|
112
|
+
iconColor: "#2b5797",
|
|
113
|
+
},
|
|
84
114
|
})
|
|
85
115
|
|
|
86
116
|
export const argsSchema = z.object({
|
|
@@ -189,7 +219,6 @@ export const keyPair = defineUnit({
|
|
|
189
219
|
|
|
190
220
|
outputs: {
|
|
191
221
|
keyPair: keyPairEntity,
|
|
192
|
-
publicKeyFile: fileEntity,
|
|
193
222
|
},
|
|
194
223
|
|
|
195
224
|
meta: {
|
|
@@ -209,6 +238,9 @@ export const keyPair = defineUnit({
|
|
|
209
238
|
|
|
210
239
|
export type Args = z.infer<typeof argsSchema>
|
|
211
240
|
export type KeyType = z.infer<typeof keyTypeSchema>
|
|
212
|
-
export type PublicKey =
|
|
213
|
-
export type KeyPair =
|
|
214
|
-
export type Connection =
|
|
241
|
+
export type PublicKey = EntityValue<typeof publicKeyEntity>
|
|
242
|
+
export type KeyPair = EntityValue<typeof keyPairEntity>
|
|
243
|
+
export type Connection = EntityValue<typeof connectionEntity>
|
|
244
|
+
|
|
245
|
+
export type PublicKeyInput = EntityInput<typeof publicKeyEntity>
|
|
246
|
+
export type KeyPairInput = EntityInput<typeof keyPairEntity>
|