@microagi/alchemy-gcp 0.5.1 → 0.6.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/lib/Auth/Credentials.d.ts +10 -4
- package/lib/Auth/Credentials.d.ts.map +1 -1
- package/lib/Auth/Credentials.js +13 -4
- package/lib/Auth/Credentials.js.map +1 -1
- package/lib/Compute/Address.d.ts +97 -0
- package/lib/Compute/Address.d.ts.map +1 -0
- package/lib/Compute/Address.js +143 -0
- package/lib/Compute/Address.js.map +1 -0
- package/lib/Compute/Firewall.d.ts +108 -0
- package/lib/Compute/Firewall.d.ts.map +1 -0
- package/lib/Compute/Firewall.js +163 -0
- package/lib/Compute/Firewall.js.map +1 -0
- package/lib/Compute/ForwardingRule.d.ts +106 -0
- package/lib/Compute/ForwardingRule.d.ts.map +1 -0
- package/lib/Compute/ForwardingRule.js +152 -0
- package/lib/Compute/ForwardingRule.js.map +1 -0
- package/lib/Compute/index.d.ts +3 -0
- package/lib/Compute/index.d.ts.map +1 -1
- package/lib/Compute/index.js +3 -0
- package/lib/Compute/index.js.map +1 -1
- package/lib/Container/Cluster.d.ts +20 -0
- package/lib/Container/Cluster.d.ts.map +1 -1
- package/lib/Container/Cluster.js +5 -2
- package/lib/Container/Cluster.js.map +1 -1
- package/lib/Container/NodePool.d.ts +26 -1
- package/lib/Container/NodePool.d.ts.map +1 -1
- package/lib/Container/NodePool.js +45 -8
- package/lib/Container/NodePool.js.map +1 -1
- package/lib/Kubernetes/Secret.d.ts +89 -0
- package/lib/Kubernetes/Secret.d.ts.map +1 -0
- package/lib/Kubernetes/Secret.js +139 -0
- package/lib/Kubernetes/Secret.js.map +1 -0
- package/lib/Kubernetes/client.d.ts +58 -0
- package/lib/Kubernetes/client.d.ts.map +1 -0
- package/lib/Kubernetes/client.js +131 -0
- package/lib/Kubernetes/client.js.map +1 -0
- package/lib/Kubernetes/index.d.ts +2 -0
- package/lib/Kubernetes/index.d.ts.map +1 -0
- package/lib/Kubernetes/index.js +2 -0
- package/lib/Kubernetes/index.js.map +1 -0
- package/lib/ManagedLustre/Instance.d.ts.map +1 -1
- package/lib/ManagedLustre/Instance.js +25 -5
- package/lib/ManagedLustre/Instance.js.map +1 -1
- package/lib/Providers.d.ts +1 -1
- package/lib/Providers.d.ts.map +1 -1
- package/lib/Providers.js +9 -1
- package/lib/Providers.js.map +1 -1
- package/lib/Sqladmin/Instance.d.ts.map +1 -1
- package/lib/Sqladmin/Instance.js +28 -6
- package/lib/Sqladmin/Instance.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Auth/Credentials.ts +15 -5
- package/src/Compute/Address.ts +288 -0
- package/src/Compute/Firewall.ts +330 -0
- package/src/Compute/ForwardingRule.ts +301 -0
- package/src/Compute/index.ts +3 -0
- package/src/Container/Cluster.ts +25 -2
- package/src/Container/NodePool.ts +87 -13
- package/src/Kubernetes/Secret.ts +274 -0
- package/src/Kubernetes/client.ts +219 -0
- package/src/Kubernetes/index.ts +1 -0
- package/src/ManagedLustre/Instance.ts +35 -6
- package/src/Providers.ts +18 -0
- package/src/Sqladmin/Instance.ts +36 -7
- package/src/index.ts +1 -0
|
@@ -229,6 +229,7 @@ export const ManagedLustreInstanceProvider = () =>
|
|
|
229
229
|
ManagedLustreInstance,
|
|
230
230
|
Effect.gen(function* () {
|
|
231
231
|
const getInstance = yield* lustre.getProjectsLocationsInstances;
|
|
232
|
+
const listInstances = yield* lustre.listProjectsLocationsInstances;
|
|
232
233
|
const createInstance = yield* lustre.createProjectsLocationsInstances;
|
|
233
234
|
const patchInstance = yield* lustre.patchProjectsLocationsInstances;
|
|
234
235
|
const deleteInstance = yield* lustre.deleteProjectsLocationsInstances;
|
|
@@ -403,12 +404,40 @@ export const ManagedLustreInstanceProvider = () =>
|
|
|
403
404
|
const location = output?.location ?? olds?.location;
|
|
404
405
|
const network = output?.network ?? olds?.network;
|
|
405
406
|
if (!project || !location || !network) return undefined;
|
|
406
|
-
const instanceId
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
const persistedId = output?.instanceId ?? olds?.instanceId;
|
|
408
|
+
let observed: lustre.Instance | undefined;
|
|
409
|
+
if (persistedId) {
|
|
410
|
+
observed = yield* observe(project, location, persistedId);
|
|
411
|
+
} else {
|
|
412
|
+
// Cold recovery (lost state): the instance id carries a
|
|
413
|
+
// random per-instance suffix that lived only in state, so a
|
|
414
|
+
// probe against a freshly-generated id can never hit. Scan
|
|
415
|
+
// the location's instances for our alchemy labels instead.
|
|
416
|
+
const page = yield* listInstances({
|
|
417
|
+
parent: `projects/${project}/locations/${location}`,
|
|
418
|
+
}).pipe(
|
|
419
|
+
Effect.catchTag("NotFound", () =>
|
|
420
|
+
Effect.succeed(
|
|
421
|
+
undefined as lustre.ListInstancesResponse | undefined,
|
|
422
|
+
),
|
|
423
|
+
),
|
|
424
|
+
Effect.catchTag("Forbidden", () =>
|
|
425
|
+
Effect.succeed(
|
|
426
|
+
undefined as lustre.ListInstancesResponse | undefined,
|
|
427
|
+
),
|
|
428
|
+
),
|
|
429
|
+
);
|
|
430
|
+
for (const candidate of page?.instances ?? []) {
|
|
431
|
+
if (yield* hasAlchemyLabels(id, candidate.labels)) {
|
|
432
|
+
observed = candidate;
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if (!observed?.name) return undefined;
|
|
438
|
+
// `name` is the full resource path; the instance id is its
|
|
439
|
+
// last segment.
|
|
440
|
+
const instanceId = observed.name.split("/").pop()!;
|
|
412
441
|
const attrs = toAttributes(observed, {
|
|
413
442
|
project,
|
|
414
443
|
location,
|
package/src/Providers.ts
CHANGED
|
@@ -7,6 +7,12 @@ import {
|
|
|
7
7
|
import { GCPAuth } from "./Auth/AuthProvider.ts";
|
|
8
8
|
import { fromAuthProvider } from "./Auth/Credentials.ts";
|
|
9
9
|
import { Project, ProjectProvider } from "./CloudResourceManager/Project.ts";
|
|
10
|
+
import { Address, AddressProvider } from "./Compute/Address.ts";
|
|
11
|
+
import { Firewall, FirewallProvider } from "./Compute/Firewall.ts";
|
|
12
|
+
import {
|
|
13
|
+
ForwardingRule,
|
|
14
|
+
ForwardingRuleProvider,
|
|
15
|
+
} from "./Compute/ForwardingRule.ts";
|
|
10
16
|
import { GlobalAddress, GlobalAddressProvider } from "./Compute/GlobalAddress.ts";
|
|
11
17
|
import { Network, NetworkProvider } from "./Compute/Network.ts";
|
|
12
18
|
import { SharedVpcHost, SharedVpcHostProvider } from "./Compute/SharedVpcHost.ts";
|
|
@@ -17,6 +23,10 @@ import {
|
|
|
17
23
|
import { Subnetwork, SubnetworkProvider } from "./Compute/Subnetwork.ts";
|
|
18
24
|
import { Cluster, ClusterProvider } from "./Container/Cluster.ts";
|
|
19
25
|
import { NodePool, NodePoolProvider } from "./Container/NodePool.ts";
|
|
26
|
+
import {
|
|
27
|
+
KubernetesSecret,
|
|
28
|
+
KubernetesSecretProvider,
|
|
29
|
+
} from "./Kubernetes/Secret.ts";
|
|
20
30
|
import {
|
|
21
31
|
ManagedLustreInstance,
|
|
22
32
|
ManagedLustreInstanceProvider,
|
|
@@ -61,6 +71,9 @@ export const providers = () =>
|
|
|
61
71
|
ApiEnable,
|
|
62
72
|
Network,
|
|
63
73
|
Subnetwork,
|
|
74
|
+
Firewall,
|
|
75
|
+
Address,
|
|
76
|
+
ForwardingRule,
|
|
64
77
|
GlobalAddress,
|
|
65
78
|
SharedVpcHost,
|
|
66
79
|
SharedVpcServiceProject,
|
|
@@ -72,6 +85,7 @@ export const providers = () =>
|
|
|
72
85
|
SqlDatabase,
|
|
73
86
|
SqlUser,
|
|
74
87
|
ArtifactRegistryRepository,
|
|
88
|
+
KubernetesSecret,
|
|
75
89
|
]),
|
|
76
90
|
).pipe(
|
|
77
91
|
Layer.provide(
|
|
@@ -82,6 +96,9 @@ export const providers = () =>
|
|
|
82
96
|
ApiEnableProvider(),
|
|
83
97
|
NetworkProvider(),
|
|
84
98
|
SubnetworkProvider(),
|
|
99
|
+
FirewallProvider(),
|
|
100
|
+
AddressProvider(),
|
|
101
|
+
ForwardingRuleProvider(),
|
|
85
102
|
GlobalAddressProvider(),
|
|
86
103
|
SharedVpcHostProvider(),
|
|
87
104
|
SharedVpcServiceProjectProvider(),
|
|
@@ -93,6 +110,7 @@ export const providers = () =>
|
|
|
93
110
|
SqlDatabaseProvider(),
|
|
94
111
|
SqlUserProvider(),
|
|
95
112
|
ArtifactRegistryRepositoryProvider(),
|
|
113
|
+
KubernetesSecretProvider(),
|
|
96
114
|
),
|
|
97
115
|
),
|
|
98
116
|
Layer.provideMerge(fromAuthProvider()),
|
package/src/Sqladmin/Instance.ts
CHANGED
|
@@ -355,6 +355,7 @@ export const SqlInstanceProvider = () =>
|
|
|
355
355
|
SqlInstance,
|
|
356
356
|
Effect.gen(function* () {
|
|
357
357
|
const getInstances = yield* sql.getInstances;
|
|
358
|
+
const listInstances = yield* sql.listInstances;
|
|
358
359
|
const insertInstances = yield* sql.insertInstances;
|
|
359
360
|
const patchInstances = yield* sql.patchInstances;
|
|
360
361
|
const deleteInstances = yield* sql.deleteInstances;
|
|
@@ -604,13 +605,41 @@ export const SqlInstanceProvider = () =>
|
|
|
604
605
|
const project = output?.project ?? olds?.project;
|
|
605
606
|
const region = output?.region ?? olds?.region;
|
|
606
607
|
if (!project || !region) return undefined;
|
|
607
|
-
const name =
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
608
|
+
const name = output?.name ?? olds?.name;
|
|
609
|
+
let observed: sql.DatabaseInstance | undefined;
|
|
610
|
+
if (name) {
|
|
611
|
+
observed = yield* observe(project, name);
|
|
612
|
+
} else {
|
|
613
|
+
// Cold recovery (lost state): the physical name carries a
|
|
614
|
+
// random per-instance suffix that lived only in state, so a
|
|
615
|
+
// probe against a freshly-generated name can never hit. Scan
|
|
616
|
+
// the project's instances for our alchemy labels instead.
|
|
617
|
+
const page = yield* listInstances({
|
|
618
|
+
project,
|
|
619
|
+
maxResults: 500,
|
|
620
|
+
}).pipe(
|
|
621
|
+
Effect.catchTag("NotFound", () =>
|
|
622
|
+
Effect.succeed(undefined as sql.InstancesListResponse | undefined),
|
|
623
|
+
),
|
|
624
|
+
Effect.catchTag("Forbidden", () =>
|
|
625
|
+
Effect.succeed(undefined as sql.InstancesListResponse | undefined),
|
|
626
|
+
),
|
|
627
|
+
);
|
|
628
|
+
for (const candidate of page?.items ?? []) {
|
|
629
|
+
if (
|
|
630
|
+
yield* hasAlchemyLabels(id, candidate.settings?.userLabels)
|
|
631
|
+
) {
|
|
632
|
+
observed = candidate;
|
|
633
|
+
break;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
if (!observed?.name) return undefined;
|
|
638
|
+
const attrs = toAttributes(observed, {
|
|
639
|
+
project,
|
|
640
|
+
region,
|
|
641
|
+
name: observed.name,
|
|
642
|
+
});
|
|
614
643
|
return (yield* hasAlchemyLabels(id, observed.settings?.userLabels))
|
|
615
644
|
? attrs
|
|
616
645
|
: Unowned(attrs);
|
package/src/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./ArtifactRegistry/index.ts";
|
|
|
11
11
|
export * from "./CloudResourceManager/index.ts";
|
|
12
12
|
export * from "./Compute/index.ts";
|
|
13
13
|
export * from "./Container/index.ts";
|
|
14
|
+
export * from "./Kubernetes/index.ts";
|
|
14
15
|
export * from "./ManagedLustre/index.ts";
|
|
15
16
|
export * from "./Run/index.ts";
|
|
16
17
|
export * from "./ServiceNetworking/index.ts";
|