@microagi/alchemy-gcp 0.3.0 → 0.5.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/CHANGELOG.md +100 -0
- package/lib/ArtifactRegistry/Operations.d.ts +47 -0
- package/lib/ArtifactRegistry/Operations.d.ts.map +1 -0
- package/lib/ArtifactRegistry/Operations.js +47 -0
- package/lib/ArtifactRegistry/Operations.js.map +1 -0
- package/lib/ArtifactRegistry/Repository.d.ts +263 -0
- package/lib/ArtifactRegistry/Repository.d.ts.map +1 -0
- package/lib/ArtifactRegistry/Repository.js +257 -0
- package/lib/ArtifactRegistry/Repository.js.map +1 -0
- package/lib/ArtifactRegistry/Types.d.ts +32 -0
- package/lib/ArtifactRegistry/Types.d.ts.map +1 -0
- package/lib/ArtifactRegistry/Types.js +12 -0
- package/lib/ArtifactRegistry/Types.js.map +1 -0
- package/lib/ArtifactRegistry/Validation.d.ts +43 -0
- package/lib/ArtifactRegistry/Validation.d.ts.map +1 -0
- package/lib/ArtifactRegistry/Validation.js +95 -0
- package/lib/ArtifactRegistry/Validation.js.map +1 -0
- package/lib/ArtifactRegistry/index.d.ts +4 -0
- package/lib/ArtifactRegistry/index.d.ts.map +1 -0
- package/lib/ArtifactRegistry/index.js +2 -0
- package/lib/ArtifactRegistry/index.js.map +1 -0
- package/lib/Providers.d.ts.map +1 -1
- package/lib/Providers.js +9 -1
- package/lib/Providers.js.map +1 -1
- package/lib/Sqladmin/Database.d.ts +82 -0
- package/lib/Sqladmin/Database.d.ts.map +1 -0
- package/lib/Sqladmin/Database.js +87 -0
- package/lib/Sqladmin/Database.js.map +1 -0
- package/lib/Sqladmin/Instance.d.ts +234 -0
- package/lib/Sqladmin/Instance.d.ts.map +1 -0
- package/lib/Sqladmin/Instance.js +251 -0
- package/lib/Sqladmin/Instance.js.map +1 -0
- package/lib/Sqladmin/Operations.d.ts +41 -0
- package/lib/Sqladmin/Operations.d.ts.map +1 -0
- package/lib/Sqladmin/Operations.js +42 -0
- package/lib/Sqladmin/Operations.js.map +1 -0
- package/lib/Sqladmin/Types.d.ts +82 -0
- package/lib/Sqladmin/Types.d.ts.map +1 -0
- package/lib/Sqladmin/Types.js +28 -0
- package/lib/Sqladmin/Types.js.map +1 -0
- package/lib/Sqladmin/User.d.ts +110 -0
- package/lib/Sqladmin/User.d.ts.map +1 -0
- package/lib/Sqladmin/User.js +156 -0
- package/lib/Sqladmin/User.js.map +1 -0
- package/lib/Sqladmin/Validation.d.ts +60 -0
- package/lib/Sqladmin/Validation.d.ts.map +1 -0
- package/lib/Sqladmin/Validation.js +125 -0
- package/lib/Sqladmin/Validation.js.map +1 -0
- package/lib/Sqladmin/index.d.ts +9 -0
- package/lib/Sqladmin/index.d.ts.map +1 -0
- package/lib/Sqladmin/index.js +5 -0
- package/lib/Sqladmin/index.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/src/ArtifactRegistry/Operations.ts +79 -0
- package/src/ArtifactRegistry/Repository.ts +624 -0
- package/src/ArtifactRegistry/Types.ts +49 -0
- package/src/ArtifactRegistry/Validation.ts +112 -0
- package/src/ArtifactRegistry/index.ts +10 -0
- package/src/Providers.ts +15 -0
- package/src/Sqladmin/Database.ts +209 -0
- package/src/Sqladmin/Instance.ts +620 -0
- package/src/Sqladmin/Operations.ts +73 -0
- package/src/Sqladmin/Types.ts +101 -0
- package/src/Sqladmin/User.ts +333 -0
- package/src/Sqladmin/Validation.ts +148 -0
- package/src/Sqladmin/index.ts +19 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { SqlDatabase, SqlDatabaseProvider } from "./Database.ts";
|
|
2
|
+
export type { SqlDatabaseAttributes, SqlDatabaseProps } from "./Database.ts";
|
|
3
|
+
export { SqlInstance, SqlInstanceProvider } from "./Instance.ts";
|
|
4
|
+
export type { SqlInstanceAttributes, SqlInstanceIpAddress, SqlInstanceProps, } from "./Instance.ts";
|
|
5
|
+
export { isIamUserType } from "./Types.ts";
|
|
6
|
+
export type { PostgresVersion, SqlActivationPolicy, SqlAvailabilityType, SqlDataDiskType, SqlEdition, SqlUserType, } from "./Types.ts";
|
|
7
|
+
export { SqlUser, SqlUserProvider } from "./User.ts";
|
|
8
|
+
export type { SqlUserAttributes, SqlUserProps } from "./User.ts";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Sqladmin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACjE,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACjE,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Sqladmin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAMjE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAS3C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { Credentials, fromADC, fromAuthProvider } from "./Auth/Credentials.ts";
|
|
2
2
|
export { GCP_AUTH_PROVIDER_NAME, GCPAuth, } from "./Auth/AuthProvider.ts";
|
|
3
3
|
export type { GCPAuthConfig, GCPResolvedCredentials, } from "./Auth/AuthProvider.ts";
|
|
4
|
+
export * from "./ArtifactRegistry/index.ts";
|
|
4
5
|
export * from "./CloudResourceManager/index.ts";
|
|
5
6
|
export * from "./Compute/index.ts";
|
|
6
7
|
export * from "./Container/index.ts";
|
|
7
8
|
export * from "./ManagedLustre/index.ts";
|
|
8
9
|
export * from "./Run/index.ts";
|
|
9
10
|
export * from "./ServiceNetworking/index.ts";
|
|
11
|
+
export * from "./Sqladmin/index.ts";
|
|
10
12
|
export * from "./ServiceUsage/index.ts";
|
|
11
13
|
export * from "./Providers.ts";
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,sBAAsB,EACtB,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,aAAa,EACb,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,sBAAsB,EACtB,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,aAAa,EACb,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export { Credentials, fromADC, fromAuthProvider } from "./Auth/Credentials.js";
|
|
2
2
|
export { GCP_AUTH_PROVIDER_NAME, GCPAuth, } from "./Auth/AuthProvider.js";
|
|
3
|
+
export * from "./ArtifactRegistry/index.js";
|
|
3
4
|
export * from "./CloudResourceManager/index.js";
|
|
4
5
|
export * from "./Compute/index.js";
|
|
5
6
|
export * from "./Container/index.js";
|
|
6
7
|
export * from "./ManagedLustre/index.js";
|
|
7
8
|
export * from "./Run/index.js";
|
|
8
9
|
export * from "./ServiceNetworking/index.js";
|
|
10
|
+
export * from "./Sqladmin/index.js";
|
|
9
11
|
export * from "./ServiceUsage/index.js";
|
|
10
12
|
export * from "./Providers.js";
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,sBAAsB,EACtB,OAAO,GACR,MAAM,wBAAwB,CAAC;AAKhC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,sBAAsB,EACtB,OAAO,GACR,MAAM,wBAAwB,CAAC;AAKhC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microagi/alchemy-gcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "GCP provider for Alchemy v2 (Effect-based IaC). Resources for Project, Cluster, NodePool, Compute, ManagedLustre, ServiceUsage, ServiceNetworking, Cloud Run (Service + Job + IAM), with ADC-backed credentials and target-side IAM bindings.",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "GCP provider for Alchemy v2 (Effect-based IaC). Resources for Project, Cluster, NodePool, Compute, ManagedLustre, ServiceUsage, ServiceNetworking, Cloud Run (Service + Job + IAM), Cloud SQL (Instance + Database + User with IAM database authn), Artifact Registry (Docker repositories, standard + remote pull-through caches), with ADC-backed credentials and target-side IAM bindings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alchemy",
|
|
7
7
|
"alchemy-effect",
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ConfigError } from "@distilled.cloud/gcp";
|
|
2
|
+
import * as ar from "@distilled.cloud/gcp/artifactregistry-v1";
|
|
3
|
+
import type { ScopedPlanStatusSession } from "alchemy/Cli/Cli";
|
|
4
|
+
import * as Duration from "effect/Duration";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Schedule from "effect/Schedule";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resolved callable signature of `ar.getProjectsLocationsOperations`.
|
|
10
|
+
*
|
|
11
|
+
* `ar.getProjectsLocationsOperations` is itself an
|
|
12
|
+
* `Effect<callable, never, Credentials | HttpClient>`, so
|
|
13
|
+
* `Effect.Success` extracts the callable type. Using a derived alias
|
|
14
|
+
* keeps the helper aligned with the SDK without us hand-writing the
|
|
15
|
+
* input/output/error union, which would drift if the patch set changes.
|
|
16
|
+
*/
|
|
17
|
+
type GetOperations = Effect.Success<typeof ar.getProjectsLocationsOperations>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Build the Artifact Registry long-running-operation polling helper.
|
|
21
|
+
*
|
|
22
|
+
* Artifact Registry `Operation`s use the standard
|
|
23
|
+
* `GoogleLongrunningOperation` shape — doneness is `.done === true`
|
|
24
|
+
* (NOT `.status === "DONE"` like the GKE Container API and NOT
|
|
25
|
+
* Sqladmin's tri-state `.status`). Verified at
|
|
26
|
+
* `vendor/distilled/packages/gcp/src/services/artifactregistry-v1.ts:308–328`.
|
|
27
|
+
*
|
|
28
|
+
* Operation names returned by `artifactregistry-v1`
|
|
29
|
+
* (`createProjectsLocationsRepositories`,
|
|
30
|
+
* `patchProjectsLocationsRepositories`,
|
|
31
|
+
* `deleteProjectsLocationsRepositories`) are already fully qualified
|
|
32
|
+
* (`projects/{p}/locations/{l}/operations/{id}`), so callers pass them
|
|
33
|
+
* straight through to `getProjectsLocationsOperations` — no qualify
|
|
34
|
+
* dance needed (unlike Container, which returns bare ids).
|
|
35
|
+
*
|
|
36
|
+
* Schedule: exponential 1s → 1.5× growth, capped per-poll at 10s via
|
|
37
|
+
* `Schedule.either`, then a hard count cap of 60 retries → ~10 min wall
|
|
38
|
+
* ceiling. Repository CRUD is fast (seconds); the only long-running
|
|
39
|
+
* case is a delete on a repository with many cached images, where AR
|
|
40
|
+
* has to GC the underlying blobs.
|
|
41
|
+
*
|
|
42
|
+
* The helper is a factory — the caller resolves
|
|
43
|
+
* `ar.getProjectsLocationsOperations` once at provider construction
|
|
44
|
+
* and passes the resulting callable here, so we never re-resolve
|
|
45
|
+
* services on each await.
|
|
46
|
+
*/
|
|
47
|
+
export const makeAwaitOperation = (getOperations: GetOperations) =>
|
|
48
|
+
Effect.fn(function* (
|
|
49
|
+
operationName: string,
|
|
50
|
+
session: ScopedPlanStatusSession,
|
|
51
|
+
) {
|
|
52
|
+
const op = yield* getOperations({ name: operationName }).pipe(
|
|
53
|
+
Effect.flatMap((current) =>
|
|
54
|
+
current.done === true
|
|
55
|
+
? Effect.succeed(current)
|
|
56
|
+
: Effect.fail({ _tag: "OperationPending" as const }),
|
|
57
|
+
),
|
|
58
|
+
Effect.retry({
|
|
59
|
+
while: (e: { _tag?: string }) => e?._tag === "OperationPending",
|
|
60
|
+
schedule: Schedule.exponential(Duration.seconds(1), 1.5).pipe(
|
|
61
|
+
Schedule.either(Schedule.spaced(Duration.seconds(10))),
|
|
62
|
+
Schedule.both(Schedule.recurs(60)),
|
|
63
|
+
Schedule.tapOutput(() =>
|
|
64
|
+
session.note(
|
|
65
|
+
`Waiting for Artifact Registry operation ${operationName}…`,
|
|
66
|
+
),
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
if (op.error) {
|
|
72
|
+
return yield* new ConfigError({
|
|
73
|
+
message: `Artifact Registry operation ${operationName} failed: ${
|
|
74
|
+
op.error.message ?? JSON.stringify(op.error)
|
|
75
|
+
}`,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return op;
|
|
79
|
+
});
|