@microagi/alchemy-gcp 0.1.2
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 +88 -0
- package/lib/Auth/AuthProvider.d.ts +48 -0
- package/lib/Auth/AuthProvider.d.ts.map +1 -0
- package/lib/Auth/AuthProvider.js +84 -0
- package/lib/Auth/AuthProvider.js.map +1 -0
- package/lib/Auth/Credentials.d.ts +28 -0
- package/lib/Auth/Credentials.d.ts.map +1 -0
- package/lib/Auth/Credentials.js +41 -0
- package/lib/Auth/Credentials.js.map +1 -0
- package/lib/CloudResourceManager/Project.d.ts +143 -0
- package/lib/CloudResourceManager/Project.d.ts.map +1 -0
- package/lib/CloudResourceManager/Project.js +272 -0
- package/lib/CloudResourceManager/Project.js.map +1 -0
- package/lib/CloudResourceManager/index.d.ts +3 -0
- package/lib/CloudResourceManager/index.d.ts.map +1 -0
- package/lib/CloudResourceManager/index.js +2 -0
- package/lib/CloudResourceManager/index.js.map +1 -0
- package/lib/Compute/GlobalAddress.d.ts +101 -0
- package/lib/Compute/GlobalAddress.d.ts.map +1 -0
- package/lib/Compute/GlobalAddress.js +134 -0
- package/lib/Compute/GlobalAddress.js.map +1 -0
- package/lib/Compute/Network.d.ts +114 -0
- package/lib/Compute/Network.d.ts.map +1 -0
- package/lib/Compute/Network.js +145 -0
- package/lib/Compute/Network.js.map +1 -0
- package/lib/Compute/Operations.d.ts +34 -0
- package/lib/Compute/Operations.d.ts.map +1 -0
- package/lib/Compute/Operations.js +62 -0
- package/lib/Compute/Operations.js.map +1 -0
- package/lib/Compute/SharedVpcHost.d.ts +44 -0
- package/lib/Compute/SharedVpcHost.d.ts.map +1 -0
- package/lib/Compute/SharedVpcHost.js +71 -0
- package/lib/Compute/SharedVpcHost.js.map +1 -0
- package/lib/Compute/SharedVpcServiceProject.d.ts +46 -0
- package/lib/Compute/SharedVpcServiceProject.d.ts.map +1 -0
- package/lib/Compute/SharedVpcServiceProject.js +96 -0
- package/lib/Compute/SharedVpcServiceProject.js.map +1 -0
- package/lib/Compute/Subnetwork.d.ts +108 -0
- package/lib/Compute/Subnetwork.d.ts.map +1 -0
- package/lib/Compute/Subnetwork.js +201 -0
- package/lib/Compute/Subnetwork.js.map +1 -0
- package/lib/Compute/index.d.ts +6 -0
- package/lib/Compute/index.d.ts.map +1 -0
- package/lib/Compute/index.js +6 -0
- package/lib/Compute/index.js.map +1 -0
- package/lib/Container/Cluster.d.ts +216 -0
- package/lib/Container/Cluster.d.ts.map +1 -0
- package/lib/Container/Cluster.js +326 -0
- package/lib/Container/Cluster.js.map +1 -0
- package/lib/Container/NodePool.d.ts +214 -0
- package/lib/Container/NodePool.d.ts.map +1 -0
- package/lib/Container/NodePool.js +344 -0
- package/lib/Container/NodePool.js.map +1 -0
- package/lib/Container/Operations.d.ts +50 -0
- package/lib/Container/Operations.d.ts.map +1 -0
- package/lib/Container/Operations.js +51 -0
- package/lib/Container/Operations.js.map +1 -0
- package/lib/Container/index.d.ts +5 -0
- package/lib/Container/index.d.ts.map +1 -0
- package/lib/Container/index.js +3 -0
- package/lib/Container/index.js.map +1 -0
- package/lib/Parallelstore/Instance.d.ts +119 -0
- package/lib/Parallelstore/Instance.d.ts.map +1 -0
- package/lib/Parallelstore/Instance.js +180 -0
- package/lib/Parallelstore/Instance.js.map +1 -0
- package/lib/Parallelstore/index.d.ts +2 -0
- package/lib/Parallelstore/index.d.ts.map +1 -0
- package/lib/Parallelstore/index.js +2 -0
- package/lib/Parallelstore/index.js.map +1 -0
- package/lib/Providers.d.ts +24 -0
- package/lib/Providers.d.ts.map +1 -0
- package/lib/Providers.js +51 -0
- package/lib/Providers.js.map +1 -0
- package/lib/ServiceNetworking/PsaConnection.d.ts +84 -0
- package/lib/ServiceNetworking/PsaConnection.d.ts.map +1 -0
- package/lib/ServiceNetworking/PsaConnection.js +130 -0
- package/lib/ServiceNetworking/PsaConnection.js.map +1 -0
- package/lib/ServiceNetworking/index.d.ts +2 -0
- package/lib/ServiceNetworking/index.d.ts.map +1 -0
- package/lib/ServiceNetworking/index.js +2 -0
- package/lib/ServiceNetworking/index.js.map +1 -0
- package/lib/ServiceUsage/ApiEnable.d.ts +78 -0
- package/lib/ServiceUsage/ApiEnable.d.ts.map +1 -0
- package/lib/ServiceUsage/ApiEnable.js +132 -0
- package/lib/ServiceUsage/ApiEnable.js.map +1 -0
- package/lib/ServiceUsage/index.d.ts +3 -0
- package/lib/ServiceUsage/index.d.ts.map +1 -0
- package/lib/ServiceUsage/index.js +2 -0
- package/lib/ServiceUsage/index.js.map +1 -0
- package/lib/Tags.d.ts +57 -0
- package/lib/Tags.d.ts.map +1 -0
- package/lib/Tags.js +106 -0
- package/lib/Tags.js.map +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/package.json +70 -0
- package/src/Auth/AuthProvider.ts +180 -0
- package/src/Auth/Credentials.ts +69 -0
- package/src/CloudResourceManager/Project.ts +517 -0
- package/src/CloudResourceManager/index.ts +2 -0
- package/src/Compute/GlobalAddress.ts +283 -0
- package/src/Compute/Network.ts +306 -0
- package/src/Compute/Operations.ts +108 -0
- package/src/Compute/SharedVpcHost.ts +141 -0
- package/src/Compute/SharedVpcServiceProject.ts +185 -0
- package/src/Compute/Subnetwork.ts +375 -0
- package/src/Compute/index.ts +5 -0
- package/src/Container/Cluster.ts +599 -0
- package/src/Container/NodePool.ts +620 -0
- package/src/Container/Operations.ts +88 -0
- package/src/Container/index.ts +8 -0
- package/src/Parallelstore/Instance.ts +371 -0
- package/src/Parallelstore/index.ts +1 -0
- package/src/Providers.ts +84 -0
- package/src/ServiceNetworking/PsaConnection.ts +269 -0
- package/src/ServiceNetworking/index.ts +1 -0
- package/src/ServiceUsage/ApiEnable.ts +267 -0
- package/src/ServiceUsage/index.ts +2 -0
- package/src/Tags.ts +130 -0
- package/src/index.ts +16 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ConfigError } from "@distilled.cloud/gcp";
|
|
2
|
+
import * as Duration from "effect/Duration";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Schedule from "effect/Schedule";
|
|
5
|
+
/**
|
|
6
|
+
* Qualify a GKE operation name. The Container API returns
|
|
7
|
+
* `Operation.name` as a bare ID like `operation-1778057673333-...`,
|
|
8
|
+
* but `getProjectsLocationsOperations` expects the fully-qualified
|
|
9
|
+
* path `projects/{p}/locations/{l}/operations/{id}`. Already-qualified
|
|
10
|
+
* names are passed through unchanged so callers can stay agnostic.
|
|
11
|
+
*
|
|
12
|
+
* (CRM operations don't need this because CRM returns names as
|
|
13
|
+
* `operations/...` and its `getOperations` takes the bare path
|
|
14
|
+
* directly.)
|
|
15
|
+
*/
|
|
16
|
+
export const qualifyOperationName = (project, location, name) => name.startsWith("projects/")
|
|
17
|
+
? name
|
|
18
|
+
: `projects/${project}/locations/${location}/operations/${name}`;
|
|
19
|
+
/**
|
|
20
|
+
* Build the GKE long-running-operation polling helper.
|
|
21
|
+
*
|
|
22
|
+
* Container `Operation`s carry `.status: "PENDING" | "RUNNING" | "DONE"
|
|
23
|
+
* | "ABORTING"` (NOT `.done: boolean` like Cloud Resource Manager —
|
|
24
|
+
* verified at `vendor/distilled/packages/gcp/src/services/container-v1.ts:919–976`).
|
|
25
|
+
* The doneness predicate compares `.status === "DONE"` accordingly.
|
|
26
|
+
*
|
|
27
|
+
* Schedule: exponential 2s → 1.5× growth, capped per-poll at 15s via
|
|
28
|
+
* `Schedule.either`, then a hard count cap of 80 retries via
|
|
29
|
+
* `Schedule.both(Schedule.recurs(80))` → ~20 min wall ceiling, well
|
|
30
|
+
* above the worst observed GKE op time (cluster create runs 5–10 min).
|
|
31
|
+
*
|
|
32
|
+
* The helper is a factory — the caller resolves
|
|
33
|
+
* `cont.getProjectsLocationsOperations` once at provider construction
|
|
34
|
+
* (see `Project.ts` for the same idiom) and passes the resulting
|
|
35
|
+
* callable here, so we never re-resolve services on each await.
|
|
36
|
+
*/
|
|
37
|
+
export const makeAwaitOperation = (getOperations) => Effect.fn(function* (operationName, session) {
|
|
38
|
+
const op = yield* getOperations({ name: operationName }).pipe(Effect.flatMap((current) => current.status === "DONE"
|
|
39
|
+
? Effect.succeed(current)
|
|
40
|
+
: Effect.fail({ _tag: "OperationPending" })), Effect.retry({
|
|
41
|
+
while: (e) => e?._tag === "OperationPending",
|
|
42
|
+
schedule: Schedule.exponential(Duration.seconds(2), 1.5).pipe(Schedule.either(Schedule.spaced(Duration.seconds(15))), Schedule.both(Schedule.recurs(80)), Schedule.tapOutput(() => session.note(`Waiting for GKE operation ${operationName}…`))),
|
|
43
|
+
}));
|
|
44
|
+
if (op.error) {
|
|
45
|
+
return yield* new ConfigError({
|
|
46
|
+
message: `GKE operation ${operationName} failed: ${op.error.message ?? JSON.stringify(op.error)}`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return op;
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=Operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operations.js","sourceRoot":"","sources":["../../src/Container/Operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,OAAe,EACf,QAAgB,EAChB,IAAY,EACJ,EAAE,CACV,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;IAC1B,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,YAAY,OAAO,cAAc,QAAQ,eAAe,IAAI,EAAE,CAAC;AAcrE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM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ACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Cluster, ClusterProvider } from "./Cluster.ts";
|
|
2
|
+
export type { ClusterAttributes, ClusterInitialNodePool, ClusterProps, } from "./Cluster.ts";
|
|
3
|
+
export { NodePool, NodePoolProvider } from "./NodePool.ts";
|
|
4
|
+
export type { NodePoolAttributes, NodePoolProps } from "./NodePool.ts";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAMxD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Resource } from "alchemy";
|
|
2
|
+
import * as Provider from "alchemy/Provider";
|
|
3
|
+
import type { NetworkRef } from "../Compute/Network.ts";
|
|
4
|
+
import type * as GCP from "../Providers.ts";
|
|
5
|
+
/**
|
|
6
|
+
* A Parallelstore instance — a high-throughput, POSIX-style filesystem
|
|
7
|
+
* Google sells for AI training/inference shared storage. Backed by DAOS
|
|
8
|
+
* under the hood; mounted in clusters via the Parallelstore CSI driver.
|
|
9
|
+
*
|
|
10
|
+
* **Network preconditions.** The instance attaches to a VPC over PSA
|
|
11
|
+
* (Private Services Access). The consumer VPC must already have:
|
|
12
|
+
* 1. A `GCP.GlobalAddress` reservation (`purpose=VPC_PEERING`,
|
|
13
|
+
* `addressType=INTERNAL`, ≥/24 prefix length).
|
|
14
|
+
* 2. A `GCP.PsaConnection` to `servicenetworking.googleapis.com`
|
|
15
|
+
* consuming that range.
|
|
16
|
+
* See the Shared VPC + Parallelstore wiring in the apps/cluster stack.
|
|
17
|
+
*
|
|
18
|
+
* **Capacity.** `capacityGib` must be a multiple of 12000 GiB and
|
|
19
|
+
* between 12000 (12 TiB) and 100800 (98.4 TiB). Smaller deployments
|
|
20
|
+
* may use 100 GiB increments depending on the SKU; the API surfaces
|
|
21
|
+
* the floor at create time.
|
|
22
|
+
*
|
|
23
|
+
* Parallelstore operations use a CRM-style `Operation.done: boolean`
|
|
24
|
+
* (verified at `parallelstore-v1.ts`).
|
|
25
|
+
*
|
|
26
|
+
* @section Creating a Parallelstore instance
|
|
27
|
+
* @example 20 TiB scratch instance
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const fs = yield* GCP.ParallelstoreInstance("ModelsFs", {
|
|
30
|
+
* project: hostProject.projectId,
|
|
31
|
+
* location: "us-central1-a",
|
|
32
|
+
* capacityGib: "20480",
|
|
33
|
+
* network: GCP.networkRef(hostProject.projectNumber, vpc.name),
|
|
34
|
+
* reservedIpRange: psaRange.name,
|
|
35
|
+
* deploymentType: "SCRATCH",
|
|
36
|
+
* fileStripeLevel: "FILE_STRIPE_LEVEL_BALANCED",
|
|
37
|
+
* directoryStripeLevel: "DIRECTORY_STRIPE_LEVEL_BALANCED",
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export type ParallelstoreInstanceProps = {
|
|
42
|
+
/** GCP project ID hosting the instance. Immutable — replace if changed. */
|
|
43
|
+
project: string;
|
|
44
|
+
/**
|
|
45
|
+
* Parallelstore location. **Zone, not region** — Parallelstore is a
|
|
46
|
+
* zonal product. Common: `us-central1-a`. Immutable — replace.
|
|
47
|
+
*/
|
|
48
|
+
location: string;
|
|
49
|
+
/**
|
|
50
|
+
* Instance ID. Defaults to `createPhysicalName({ id, lowercase: true,
|
|
51
|
+
* maxLength: 63 })`. Lowercase letters/numbers/hyphens, must start
|
|
52
|
+
* with a letter, end with a letter or number. Immutable — replace.
|
|
53
|
+
*/
|
|
54
|
+
instanceId?: string;
|
|
55
|
+
/** User-visible description. Mutable via `patch`. */
|
|
56
|
+
description?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Capacity in **GiB** (1024-based). Sent to the API as a string per
|
|
59
|
+
* Parallelstore's int64-encoded-as-string convention. Replace-only —
|
|
60
|
+
* Parallelstore doesn't currently support online resize.
|
|
61
|
+
*/
|
|
62
|
+
capacityGib: string;
|
|
63
|
+
/**
|
|
64
|
+
* Fully-qualified consumer VPC in project-number form. Build with
|
|
65
|
+
* `networkRef(project.projectNumber, vpc.name)` — the `NetworkRef`
|
|
66
|
+
* template literal type rejects project-ID-form strings at compile
|
|
67
|
+
* time. Immutable — replace.
|
|
68
|
+
*/
|
|
69
|
+
network: NetworkRef;
|
|
70
|
+
/**
|
|
71
|
+
* Name (or self-link) of a `GCP.GlobalAddress` PSA reservation in
|
|
72
|
+
* the same VPC. Immutable — replace.
|
|
73
|
+
*/
|
|
74
|
+
reservedIpRange?: string;
|
|
75
|
+
/** `SCRATCH` (default) or `PERSISTENT`. Immutable — replace. */
|
|
76
|
+
deploymentType?: "SCRATCH" | "PERSISTENT";
|
|
77
|
+
/** File stripe level. Replace-only. */
|
|
78
|
+
fileStripeLevel?: "FILE_STRIPE_LEVEL_MIN" | "FILE_STRIPE_LEVEL_BALANCED" | "FILE_STRIPE_LEVEL_MAX";
|
|
79
|
+
/** Directory stripe level. Replace-only. */
|
|
80
|
+
directoryStripeLevel?: "DIRECTORY_STRIPE_LEVEL_MIN" | "DIRECTORY_STRIPE_LEVEL_BALANCED" | "DIRECTORY_STRIPE_LEVEL_MAX";
|
|
81
|
+
/**
|
|
82
|
+
* Resource labels. Alchemy internal labels (`alchemy_app`,
|
|
83
|
+
* `alchemy_stage`, `alchemy_id`) are merged on top automatically.
|
|
84
|
+
* Mutable via `patch`.
|
|
85
|
+
*/
|
|
86
|
+
labels?: Record<string, string>;
|
|
87
|
+
};
|
|
88
|
+
export type ParallelstoreInstanceAttributes = {
|
|
89
|
+
/** Bare instance id. */
|
|
90
|
+
instanceId: string;
|
|
91
|
+
/** Project ID. */
|
|
92
|
+
project: string;
|
|
93
|
+
/** Zone. */
|
|
94
|
+
location: string;
|
|
95
|
+
/** Resource name `projects/{p}/locations/{l}/instances/{id}`. */
|
|
96
|
+
name: string;
|
|
97
|
+
/** Description, mirroring props. */
|
|
98
|
+
description: string | undefined;
|
|
99
|
+
/** Capacity in GiB. */
|
|
100
|
+
capacityGib: string;
|
|
101
|
+
/** Consumer VPC URL (project-number form). */
|
|
102
|
+
network: NetworkRef;
|
|
103
|
+
/** Reserved IP range used (server-resolved). */
|
|
104
|
+
reservedIpRange: string | undefined;
|
|
105
|
+
/** Effective reserved range (post-allocation). */
|
|
106
|
+
effectiveReservedIpRange: string | undefined;
|
|
107
|
+
/** Lifecycle state — `ACTIVE` once ready. */
|
|
108
|
+
state: string | undefined;
|
|
109
|
+
/** Active deployment type. */
|
|
110
|
+
deploymentType: string | undefined;
|
|
111
|
+
/** DNS access points VMs mount via. */
|
|
112
|
+
accessPoints: ReadonlyArray<string>;
|
|
113
|
+
/** Labels currently set, including internals. */
|
|
114
|
+
labels: Record<string, string>;
|
|
115
|
+
};
|
|
116
|
+
export type ParallelstoreInstance = Resource<"GCP.ParallelstoreInstance", ParallelstoreInstanceProps, ParallelstoreInstanceAttributes, never, GCP.Providers>;
|
|
117
|
+
export declare const ParallelstoreInstance: import("alchemy").ResourceClass<ParallelstoreInstance>;
|
|
118
|
+
export declare const ParallelstoreInstanceProvider: () => import("effect/Layer").Layer<Provider.Provider<ParallelstoreInstance>, never, import("effect/unstable/http/HttpClient").HttpClient | import("alchemy").Stage | import("alchemy").Stack | import("@distilled.cloud/gcp").Credentials>;
|
|
119
|
+
//# sourceMappingURL=Instance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Instance.d.ts","sourceRoot":"","sources":["../../src/Parallelstore/Instance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKnC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAK7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,EAAE,UAAU,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,cAAc,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IAC1C,uCAAuC;IACvC,eAAe,CAAC,EACZ,uBAAuB,GACvB,4BAA4B,GAC5B,uBAAuB,CAAC;IAC5B,4CAA4C;IAC5C,oBAAoB,CAAC,EACjB,4BAA4B,GAC5B,iCAAiC,GACjC,4BAA4B,CAAC;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,OAAO,EAAE,UAAU,CAAC;IACpB,gDAAgD;IAChD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,kDAAkD;IAClD,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,6CAA6C;IAC7C,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,8BAA8B;IAC9B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,uCAAuC;IACvC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAC1C,2BAA2B,EAC3B,0BAA0B,EAC1B,+BAA+B,EAC/B,KAAK,EACL,GAAG,CAAC,SAAS,CACd,CAAC;AACF,eAAO,MAAM,qBAAqB,wDAEjC,CAAC;AA+BF,eAAO,MAAM,6BAA6B,4OAmMvC,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { ConfigError } from "@distilled.cloud/gcp";
|
|
2
|
+
import * as ps from "@distilled.cloud/gcp/parallelstore-v1";
|
|
3
|
+
import { Resource } from "alchemy";
|
|
4
|
+
import { Unowned } from "alchemy/AdoptPolicy";
|
|
5
|
+
import { isResolved, somePropsAreDifferent } from "alchemy/Diff";
|
|
6
|
+
import { createPhysicalName } from "alchemy/PhysicalName";
|
|
7
|
+
import * as Provider from "alchemy/Provider";
|
|
8
|
+
import { diffTags } from "alchemy/Tags";
|
|
9
|
+
import * as Duration from "effect/Duration";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Schedule from "effect/Schedule";
|
|
12
|
+
import { gcpInternalLabels, hasAlchemyLabels } from "../Tags.js";
|
|
13
|
+
export const ParallelstoreInstance = Resource("GCP.ParallelstoreInstance");
|
|
14
|
+
const toAttributes = (i, parent) => ({
|
|
15
|
+
instanceId: parent.instanceId,
|
|
16
|
+
project: parent.project,
|
|
17
|
+
location: parent.location,
|
|
18
|
+
name: i.name ?? `projects/${parent.project}/locations/${parent.location}/instances/${parent.instanceId}`,
|
|
19
|
+
description: i.description,
|
|
20
|
+
capacityGib: i.capacityGib ?? "",
|
|
21
|
+
// The server-echoed `i.network` matches what we sent up at create
|
|
22
|
+
// time, but we thread `parent.network` through to preserve the
|
|
23
|
+
// `NetworkRef` type without a cast — same pattern as project /
|
|
24
|
+
// location, both of which would otherwise lose their typing through
|
|
25
|
+
// the SDK's `string | undefined` fields.
|
|
26
|
+
network: parent.network,
|
|
27
|
+
reservedIpRange: i.reservedIpRange,
|
|
28
|
+
effectiveReservedIpRange: i.effectiveReservedIpRange,
|
|
29
|
+
state: i.state,
|
|
30
|
+
deploymentType: i.deploymentType,
|
|
31
|
+
accessPoints: i.accessPoints ?? [],
|
|
32
|
+
labels: { ...(i.labels ?? {}) },
|
|
33
|
+
});
|
|
34
|
+
export const ParallelstoreInstanceProvider = () => Provider.effect(ParallelstoreInstance, Effect.gen(function* () {
|
|
35
|
+
const getInstance = yield* ps.getProjectsLocationsInstances;
|
|
36
|
+
const createInstance = yield* ps.createProjectsLocationsInstances;
|
|
37
|
+
const patchInstance = yield* ps.patchProjectsLocationsInstances;
|
|
38
|
+
const deleteInstance = yield* ps.deleteProjectsLocationsInstances;
|
|
39
|
+
const getOperation = yield* ps.getProjectsLocationsOperations;
|
|
40
|
+
const awaitOperation = Effect.fn(function* (operationName, session) {
|
|
41
|
+
const op = yield* getOperation({ name: operationName }).pipe(Effect.flatMap((current) => current.done === true
|
|
42
|
+
? Effect.succeed(current)
|
|
43
|
+
: Effect.fail({ _tag: "OperationPending" })), Effect.retry({
|
|
44
|
+
while: (e) => e?._tag === "OperationPending",
|
|
45
|
+
schedule: Schedule.exponential(Duration.seconds(5), 1.5).pipe(Schedule.either(Schedule.spaced(Duration.seconds(30))),
|
|
46
|
+
// Parallelstore creates routinely run 10–25 min for
|
|
47
|
+
// multi-TiB instances. 200 × 30s ≈ 100 min wall ceiling.
|
|
48
|
+
Schedule.both(Schedule.recurs(200)), Schedule.tapOutput(() => session.note(`Waiting for Parallelstore operation ${operationName}…`))),
|
|
49
|
+
}));
|
|
50
|
+
if (op.error) {
|
|
51
|
+
return yield* new ConfigError({
|
|
52
|
+
message: `Parallelstore operation ${operationName} failed: ${op.error.message ?? JSON.stringify(op.error)}`,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return op;
|
|
56
|
+
});
|
|
57
|
+
const fqName = (project, location, instanceId) => `projects/${project}/locations/${location}/instances/${instanceId}`;
|
|
58
|
+
const observe = (project, location, instanceId) => getInstance({ name: fqName(project, location, instanceId) }).pipe(Effect.catchTag("NotFound", () => Effect.succeed(undefined)), Effect.catchTag("Forbidden", () => Effect.succeed(undefined)));
|
|
59
|
+
const syncMutable = Effect.fn(function* (args) {
|
|
60
|
+
const updateMaskFields = [];
|
|
61
|
+
if ((args.observed.description ?? undefined) !== args.desired.description) {
|
|
62
|
+
updateMaskFields.push("description");
|
|
63
|
+
}
|
|
64
|
+
const observedLabels = { ...(args.observed.labels ?? {}) };
|
|
65
|
+
const labelDiff = diffTags(observedLabels, args.desired.labels);
|
|
66
|
+
if (labelDiff.removed.length > 0 || labelDiff.upsert.length > 0) {
|
|
67
|
+
updateMaskFields.push("labels");
|
|
68
|
+
}
|
|
69
|
+
if (updateMaskFields.length === 0)
|
|
70
|
+
return;
|
|
71
|
+
const op = yield* patchInstance({
|
|
72
|
+
name: args.name,
|
|
73
|
+
updateMask: updateMaskFields.join(","),
|
|
74
|
+
body: {
|
|
75
|
+
description: args.desired.description,
|
|
76
|
+
labels: args.desired.labels,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
if (op.name)
|
|
80
|
+
yield* awaitOperation(op.name, args.session);
|
|
81
|
+
});
|
|
82
|
+
return {
|
|
83
|
+
stables: ["instanceId", "project", "location", "name"],
|
|
84
|
+
diff: Effect.fn(function* ({ news, olds = {} }) {
|
|
85
|
+
if (!isResolved(news))
|
|
86
|
+
return undefined;
|
|
87
|
+
if (somePropsAreDifferent(olds, news, [
|
|
88
|
+
"project",
|
|
89
|
+
"location",
|
|
90
|
+
"instanceId",
|
|
91
|
+
"network",
|
|
92
|
+
"reservedIpRange",
|
|
93
|
+
"deploymentType",
|
|
94
|
+
"fileStripeLevel",
|
|
95
|
+
"directoryStripeLevel",
|
|
96
|
+
"capacityGib",
|
|
97
|
+
])) {
|
|
98
|
+
return { action: "replace" };
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}),
|
|
102
|
+
reconcile: Effect.fn(function* ({ id, news, session }) {
|
|
103
|
+
const internalLabels = yield* gcpInternalLabels(id);
|
|
104
|
+
const desiredId = news.instanceId ??
|
|
105
|
+
(yield* createPhysicalName({ id, maxLength: 63 })).toLowerCase();
|
|
106
|
+
const parent = `projects/${news.project}/locations/${news.location}`;
|
|
107
|
+
const name = fqName(news.project, news.location, desiredId);
|
|
108
|
+
const desiredLabels = {
|
|
109
|
+
...(news.labels ?? {}),
|
|
110
|
+
...internalLabels,
|
|
111
|
+
};
|
|
112
|
+
let observed = yield* observe(news.project, news.location, desiredId);
|
|
113
|
+
if (!observed) {
|
|
114
|
+
const body = {
|
|
115
|
+
capacityGib: news.capacityGib,
|
|
116
|
+
network: news.network,
|
|
117
|
+
...(news.description ? { description: news.description } : {}),
|
|
118
|
+
...(news.reservedIpRange ? { reservedIpRange: news.reservedIpRange } : {}),
|
|
119
|
+
...(news.deploymentType ? { deploymentType: news.deploymentType } : {}),
|
|
120
|
+
...(news.fileStripeLevel ? { fileStripeLevel: news.fileStripeLevel } : {}),
|
|
121
|
+
...(news.directoryStripeLevel
|
|
122
|
+
? { directoryStripeLevel: news.directoryStripeLevel }
|
|
123
|
+
: {}),
|
|
124
|
+
labels: desiredLabels,
|
|
125
|
+
};
|
|
126
|
+
const op = yield* createInstance({
|
|
127
|
+
parent,
|
|
128
|
+
instanceId: desiredId,
|
|
129
|
+
body,
|
|
130
|
+
}).pipe(Effect.catchTag("Conflict", () => Effect.succeed(undefined)));
|
|
131
|
+
if (op?.name)
|
|
132
|
+
yield* awaitOperation(op.name, session);
|
|
133
|
+
observed = yield* getInstance({ name });
|
|
134
|
+
}
|
|
135
|
+
yield* syncMutable({
|
|
136
|
+
name,
|
|
137
|
+
observed,
|
|
138
|
+
desired: { description: news.description, labels: desiredLabels },
|
|
139
|
+
session,
|
|
140
|
+
});
|
|
141
|
+
const final = yield* getInstance({ name });
|
|
142
|
+
return toAttributes(final, {
|
|
143
|
+
project: news.project,
|
|
144
|
+
location: news.location,
|
|
145
|
+
instanceId: desiredId,
|
|
146
|
+
network: news.network,
|
|
147
|
+
});
|
|
148
|
+
}),
|
|
149
|
+
delete: Effect.fn(function* ({ output, session }) {
|
|
150
|
+
yield* deleteInstance({ name: output.name }).pipe(Effect.flatMap((op) => op.name ? awaitOperation(op.name, session) : Effect.succeed(op)), Effect.catchTag("NotFound", () => Effect.void));
|
|
151
|
+
}),
|
|
152
|
+
read: Effect.fn(function* ({ id, output, olds }) {
|
|
153
|
+
const project = output?.project ?? olds?.project;
|
|
154
|
+
const location = output?.location ?? olds?.location;
|
|
155
|
+
// `network` only narrows to NetworkRef when it comes from
|
|
156
|
+
// post-create `output`. `olds` is the snapshot of *props*
|
|
157
|
+
// including a NetworkRef, so both feed into the same typed
|
|
158
|
+
// pipeline.
|
|
159
|
+
const network = output?.network ?? olds?.network;
|
|
160
|
+
if (!project || !location || !network)
|
|
161
|
+
return undefined;
|
|
162
|
+
const instanceId = output?.instanceId ??
|
|
163
|
+
olds?.instanceId ??
|
|
164
|
+
(yield* createPhysicalName({ id, maxLength: 63 })).toLowerCase();
|
|
165
|
+
const observed = yield* observe(project, location, instanceId);
|
|
166
|
+
if (!observed)
|
|
167
|
+
return undefined;
|
|
168
|
+
const attrs = toAttributes(observed, {
|
|
169
|
+
project,
|
|
170
|
+
location,
|
|
171
|
+
instanceId,
|
|
172
|
+
network,
|
|
173
|
+
});
|
|
174
|
+
return (yield* hasAlchemyLabels(id, observed.labels))
|
|
175
|
+
? attrs
|
|
176
|
+
: Unowned(attrs);
|
|
177
|
+
}),
|
|
178
|
+
};
|
|
179
|
+
}));
|
|
180
|
+
//# sourceMappingURL=Instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Instance.js","sourceRoot":"","sources":["../../src/Parallelstore/Instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAa,UAAU,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAiIjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAA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IAAI,CAAC,QAAQ;gBAAE,OAAO,SAAS,CAAC;YAChC,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE;gBACnC,OAAO;gBACP,QAAQ;gBACR,UAAU;gBACV,OAAO;aACR,CAAC,CAAC;YACH,OAAO,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACnD,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Parallelstore/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Parallelstore/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as Provider from "alchemy/Provider";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
declare const Providers_base: Provider.ProviderCollection<Providers, "GCP">;
|
|
4
|
+
export declare class Providers extends Providers_base {
|
|
5
|
+
}
|
|
6
|
+
export type ProviderRequirements = Layer.Services<ReturnType<typeof providers>>;
|
|
7
|
+
/**
|
|
8
|
+
* Bundle the GCP resource providers, AuthProvider-backed credentials, and an
|
|
9
|
+
* HTTP client into a single Layer suitable for `Alchemy.Stack({ providers })`.
|
|
10
|
+
*
|
|
11
|
+
* Credentials resolve through the Alchemy AuthProvider registry — the active
|
|
12
|
+
* profile (from `ALCHEMY_PROFILE`, default `"default"`) configures `project`
|
|
13
|
+
* and optional `keyFile` overrides; everything else (ADC discovery, env-var
|
|
14
|
+
* key files, metadata server) is delegated to `google-auth-library`. To
|
|
15
|
+
* bypass the registry, import {@link fromADC} directly.
|
|
16
|
+
*
|
|
17
|
+
* `FetchHttpClient.layer` is provided once at the Stack level (see
|
|
18
|
+
* `vendor/alchemy/packages/alchemy/src/Stack.ts`); we intentionally do NOT
|
|
19
|
+
* re-provide it here, mirroring `AWS/Providers.ts` and
|
|
20
|
+
* `Cloudflare/Providers.ts`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const providers: () => Layer.Layer<import("@distilled.cloud/gcp").Credentials | Providers, never, import("effect/FileSystem").FileSystem | import("effect/unstable/http/HttpClient").HttpClient | import("alchemy").AuthProviders | import("alchemy").Stage | import("alchemy").Stack>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=Providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Providers.d.ts","sourceRoot":"","sources":["../src/Providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;;AAwBtC,qBAAa,SAAU,SAAQ,cAA+C;CAAG;AAEjF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,uQAuCnB,CAAC"}
|
package/lib/Providers.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as Provider from "alchemy/Provider";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { GCPAuth } from "./Auth/AuthProvider.js";
|
|
4
|
+
import { fromAuthProvider } from "./Auth/Credentials.js";
|
|
5
|
+
import { Project, ProjectProvider } from "./CloudResourceManager/Project.js";
|
|
6
|
+
import { GlobalAddress, GlobalAddressProvider } from "./Compute/GlobalAddress.js";
|
|
7
|
+
import { Network, NetworkProvider } from "./Compute/Network.js";
|
|
8
|
+
import { SharedVpcHost, SharedVpcHostProvider } from "./Compute/SharedVpcHost.js";
|
|
9
|
+
import { SharedVpcServiceProject, SharedVpcServiceProjectProvider, } from "./Compute/SharedVpcServiceProject.js";
|
|
10
|
+
import { Subnetwork, SubnetworkProvider } from "./Compute/Subnetwork.js";
|
|
11
|
+
import { Cluster, ClusterProvider } from "./Container/Cluster.js";
|
|
12
|
+
import { NodePool, NodePoolProvider } from "./Container/NodePool.js";
|
|
13
|
+
import { ParallelstoreInstance, ParallelstoreInstanceProvider, } from "./Parallelstore/Instance.js";
|
|
14
|
+
import { PsaConnection, PsaConnectionProvider, } from "./ServiceNetworking/PsaConnection.js";
|
|
15
|
+
import { ApiEnable, ApiEnableProvider } from "./ServiceUsage/ApiEnable.js";
|
|
16
|
+
export class Providers extends Provider.ProviderCollection()("GCP") {
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Bundle the GCP resource providers, AuthProvider-backed credentials, and an
|
|
20
|
+
* HTTP client into a single Layer suitable for `Alchemy.Stack({ providers })`.
|
|
21
|
+
*
|
|
22
|
+
* Credentials resolve through the Alchemy AuthProvider registry — the active
|
|
23
|
+
* profile (from `ALCHEMY_PROFILE`, default `"default"`) configures `project`
|
|
24
|
+
* and optional `keyFile` overrides; everything else (ADC discovery, env-var
|
|
25
|
+
* key files, metadata server) is delegated to `google-auth-library`. To
|
|
26
|
+
* bypass the registry, import {@link fromADC} directly.
|
|
27
|
+
*
|
|
28
|
+
* `FetchHttpClient.layer` is provided once at the Stack level (see
|
|
29
|
+
* `vendor/alchemy/packages/alchemy/src/Stack.ts`); we intentionally do NOT
|
|
30
|
+
* re-provide it here, mirroring `AWS/Providers.ts` and
|
|
31
|
+
* `Cloudflare/Providers.ts`.
|
|
32
|
+
*/
|
|
33
|
+
export const providers = () => Layer.effect(Providers, Provider.collection([
|
|
34
|
+
Project,
|
|
35
|
+
Cluster,
|
|
36
|
+
NodePool,
|
|
37
|
+
ApiEnable,
|
|
38
|
+
Network,
|
|
39
|
+
Subnetwork,
|
|
40
|
+
GlobalAddress,
|
|
41
|
+
SharedVpcHost,
|
|
42
|
+
SharedVpcServiceProject,
|
|
43
|
+
PsaConnection,
|
|
44
|
+
ParallelstoreInstance,
|
|
45
|
+
])).pipe(Layer.provide(Layer.mergeAll(ProjectProvider(), ClusterProvider(), NodePoolProvider(), ApiEnableProvider(), NetworkProvider(), SubnetworkProvider(), GlobalAddressProvider(), SharedVpcHostProvider(), SharedVpcServiceProjectProvider(), PsaConnectionProvider(), ParallelstoreInstanceProvider())), Layer.provideMerge(fromAuthProvider()), Layer.provideMerge(GCPAuth),
|
|
46
|
+
// Auth/config failures (missing ADC, malformed profile) become
|
|
47
|
+
// unrecoverable defects rather than typed errors — mirrors
|
|
48
|
+
// `AWS/Providers.ts` and `Cloudflare/Providers.ts`. Resource lifecycle
|
|
49
|
+
// handlers still surface their own typed errors normally.
|
|
50
|
+
Layer.orDie);
|
|
51
|
+
//# sourceMappingURL=Providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Providers.js","sourceRoot":"","sources":["../src/Providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EACL,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAA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
|
+
import { Resource } from "alchemy";
|
|
2
|
+
import * as Provider from "alchemy/Provider";
|
|
3
|
+
import type { NetworkRef } from "../Compute/Network.ts";
|
|
4
|
+
import type * as GCP from "../Providers.ts";
|
|
5
|
+
/**
|
|
6
|
+
* A **Private Services Access (PSA)** connection that peers a Google
|
|
7
|
+
* service-producer VPC into the consumer VPC, drawing from one or more
|
|
8
|
+
* pre-allocated `GCP.GlobalAddress` ranges.
|
|
9
|
+
*
|
|
10
|
+
* Identity: `(network, service)`. There can only be one PSA connection
|
|
11
|
+
* per `(VPC, service)` pair, so the resource is keyed by both. The
|
|
12
|
+
* peering name (used in delete/patch URLs) is server-assigned —
|
|
13
|
+
* canonically `servicenetworking-googleapis-com` for the standard
|
|
14
|
+
* Service Networking peering — and is read off the live connection
|
|
15
|
+
* rather than reconstructed.
|
|
16
|
+
*
|
|
17
|
+
* Service Networking operations use a CRM-style `Operation.done:
|
|
18
|
+
* boolean`, not the compute `.status: "DONE"` shape, so this resource
|
|
19
|
+
* uses its own polling helper rather than the Compute one.
|
|
20
|
+
*
|
|
21
|
+
* @section Setting up PSA for Parallelstore
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Reserve the range first.
|
|
25
|
+
* const psaRange = yield* GCP.GlobalAddress("PsaRange", {
|
|
26
|
+
* project: hostProject.projectId,
|
|
27
|
+
* network: vpc.selfLink,
|
|
28
|
+
* purpose: "VPC_PEERING",
|
|
29
|
+
* addressType: "INTERNAL",
|
|
30
|
+
* prefixLength: 20,
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Then peer. `networkRef` enforces the project-number form at the
|
|
34
|
+
* // type level — `Project.projectNumber` is typed as `${number}` so
|
|
35
|
+
* // this composes without manual casts.
|
|
36
|
+
* yield* GCP.PsaConnection("Psa", {
|
|
37
|
+
* network: GCP.networkRef(hostProject.projectNumber, vpc.name),
|
|
38
|
+
* reservedPeeringRanges: [psaRange.name],
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* The `network` field is typed as `NetworkRef` —
|
|
43
|
+
* `projects/{projectNumber}/global/networks/{name}` — because the
|
|
44
|
+
* service producer's backend resolves peerings against the numeric
|
|
45
|
+
* project id, not the project id string. Use `networkRef` to build
|
|
46
|
+
* the value; passing a project ID will fail to typecheck.
|
|
47
|
+
*/
|
|
48
|
+
export type PsaConnectionProps = {
|
|
49
|
+
/**
|
|
50
|
+
* Fully-qualified consumer VPC in project-number form. Build with
|
|
51
|
+
* `networkRef(project.projectNumber, vpc.name)` from `Compute/Network.ts`
|
|
52
|
+
* — that helper composes the right shape and the type system rejects
|
|
53
|
+
* passing a project ID. Immutable — replace.
|
|
54
|
+
*/
|
|
55
|
+
network: NetworkRef;
|
|
56
|
+
/**
|
|
57
|
+
* Service Networking service. Defaults to `servicenetworking.googleapis.com`
|
|
58
|
+
* (the only producer that PSA-aware GCP services like Parallelstore,
|
|
59
|
+
* Cloud SQL, Memorystore peer through).
|
|
60
|
+
*/
|
|
61
|
+
service?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Names of `GCP.GlobalAddress` ranges (with `purpose=VPC_PEERING`) to
|
|
64
|
+
* cede to the service producer. Mutable via `patchServicesConnections`.
|
|
65
|
+
* Removing a range previously assigned requires `force=true` server-
|
|
66
|
+
* side; this provider always passes `force=true` on patch to honour
|
|
67
|
+
* the user's declared shape.
|
|
68
|
+
*/
|
|
69
|
+
reservedPeeringRanges: ReadonlyArray<string>;
|
|
70
|
+
};
|
|
71
|
+
export type PsaConnectionAttributes = {
|
|
72
|
+
/** Consumer VPC URL, threaded through from props. */
|
|
73
|
+
network: NetworkRef;
|
|
74
|
+
/** `services/<service>` resource name, threaded through from props. */
|
|
75
|
+
serviceName: string;
|
|
76
|
+
/** Server-assigned peering name (e.g. `servicenetworking-googleapis-com`). */
|
|
77
|
+
peering: string;
|
|
78
|
+
/** Reserved peering ranges currently in use. */
|
|
79
|
+
reservedPeeringRanges: ReadonlyArray<string>;
|
|
80
|
+
};
|
|
81
|
+
export type PsaConnection = Resource<"GCP.PsaConnection", PsaConnectionProps, PsaConnectionAttributes, never, GCP.Providers>;
|
|
82
|
+
export declare const PsaConnection: import("alchemy").ResourceClass<PsaConnection>;
|
|
83
|
+
export declare const PsaConnectionProvider: () => import("effect/Layer").Layer<Provider.Provider<PsaConnection>, never, import("effect/unstable/http/HttpClient").HttpClient | import("@distilled.cloud/gcp").Credentials>;
|
|
84
|
+
//# sourceMappingURL=PsaConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PsaConnection.d.ts","sourceRoot":"","sources":["../../src/ServiceNetworking/PsaConnection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAI7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;OAKG;IACH,OAAO,EAAE,UAAU,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,qDAAqD;IACrD,OAAO,EAAE,UAAU,CAAC;IACpB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,QAAQ,CAClC,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,EACL,GAAG,CAAC,SAAS,CACd,CAAC;AACF,eAAO,MAAM,aAAa,gDAA+C,CAAC;AAO1E,eAAO,MAAM,qBAAqB,gLAoK/B,CAAC"}
|