@microagi/alchemy-gcp 0.3.0 → 0.5.1
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 +124 -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 +256 -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/Auth/Credentials.d.ts +2 -1
- package/lib/Auth/Credentials.d.ts.map +1 -1
- package/lib/Auth/Credentials.js +3 -2
- package/lib/Auth/Credentials.js.map +1 -1
- package/lib/CloudResourceManager/Project.d.ts +1 -1
- package/lib/Compute/GlobalAddress.d.ts +1 -1
- package/lib/Compute/Network.d.ts +1 -1
- package/lib/Compute/SharedVpcHost.d.ts +1 -1
- package/lib/Compute/SharedVpcServiceProject.d.ts +1 -1
- package/lib/Compute/Subnetwork.d.ts +1 -1
- package/lib/Container/Cluster.d.ts +1 -1
- package/lib/Container/NodePool.d.ts +1 -1
- package/lib/ManagedLustre/Instance.d.ts +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/Run/Job.d.ts +1 -1
- package/lib/Run/Service.d.ts +1 -1
- package/lib/ServiceNetworking/PsaConnection.d.ts +1 -1
- package/lib/ServiceUsage/ApiEnable.d.ts +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/Tags.d.ts +4 -4
- 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 +628 -0
- package/src/ArtifactRegistry/Types.ts +49 -0
- package/src/ArtifactRegistry/Validation.ts +112 -0
- package/src/ArtifactRegistry/index.ts +10 -0
- package/src/Auth/Credentials.ts +3 -2
- 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,251 @@
|
|
|
1
|
+
import * as sql from "@distilled.cloud/gcp/sqladmin-v1";
|
|
2
|
+
import { Resource } from "alchemy";
|
|
3
|
+
import { Unowned } from "alchemy/AdoptPolicy";
|
|
4
|
+
import { deepEqual, isResolved, somePropsAreDifferent } from "alchemy/Diff";
|
|
5
|
+
import { createPhysicalName } from "alchemy/PhysicalName";
|
|
6
|
+
import * as Provider from "alchemy/Provider";
|
|
7
|
+
import { diffTags } from "alchemy/Tags";
|
|
8
|
+
import * as Duration from "effect/Duration";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Redacted from "effect/Redacted";
|
|
11
|
+
import * as Schedule from "effect/Schedule";
|
|
12
|
+
import { gcpInternalLabels, hasAlchemyLabels } from "../Tags.js";
|
|
13
|
+
import { makeAwaitOperation } from "./Operations.js";
|
|
14
|
+
import { reshapeBadRequest, validateInstanceName } from "./Validation.js";
|
|
15
|
+
export const SqlInstance = Resource("GCP.SqlInstance");
|
|
16
|
+
const toAddress = (m) => ({
|
|
17
|
+
type: m.type,
|
|
18
|
+
ipAddress: m.ipAddress,
|
|
19
|
+
});
|
|
20
|
+
const toAttributes = (i, parent) => {
|
|
21
|
+
const ipAddresses = (i.ipAddresses ?? []).map(toAddress);
|
|
22
|
+
return {
|
|
23
|
+
name: parent.name,
|
|
24
|
+
selfLink: i.selfLink ?? "",
|
|
25
|
+
project: parent.project,
|
|
26
|
+
region: parent.region,
|
|
27
|
+
connectionName: i.connectionName ?? `${parent.project}:${parent.region}:${parent.name}`,
|
|
28
|
+
databaseVersion: i.databaseVersion ?? "",
|
|
29
|
+
state: i.state ?? "",
|
|
30
|
+
ipAddresses,
|
|
31
|
+
privateIpAddress: ipAddresses.find((a) => a.type === "PRIVATE")?.ipAddress,
|
|
32
|
+
publicIpAddress: ipAddresses.find((a) => a.type === "PRIMARY")?.ipAddress,
|
|
33
|
+
serverCaCert: i.serverCaCert
|
|
34
|
+
? {
|
|
35
|
+
cert: i.serverCaCert.cert,
|
|
36
|
+
commonName: i.serverCaCert.commonName,
|
|
37
|
+
expirationTime: i.serverCaCert.expirationTime,
|
|
38
|
+
sha1Fingerprint: i.serverCaCert.sha1Fingerprint,
|
|
39
|
+
}
|
|
40
|
+
: undefined,
|
|
41
|
+
settingsVersion: i.settings?.settingsVersion,
|
|
42
|
+
labels: { ...(i.settings?.userLabels ?? {}) },
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Build the `Settings` body sent to the API.
|
|
47
|
+
*
|
|
48
|
+
* Only sets fields the user has populated, so distinct from a settings
|
|
49
|
+
* stanza diff: server-injected defaults aren't overwritten by an
|
|
50
|
+
* `undefined` from us.
|
|
51
|
+
*/
|
|
52
|
+
const toSettingsBody = (s, userLabels, settingsVersion) => ({
|
|
53
|
+
tier: s.tier,
|
|
54
|
+
userLabels,
|
|
55
|
+
...(s.edition ? { edition: s.edition } : {}),
|
|
56
|
+
...(s.dataDiskSizeGb !== undefined
|
|
57
|
+
? { dataDiskSizeGb: String(s.dataDiskSizeGb) }
|
|
58
|
+
: {}),
|
|
59
|
+
...(s.dataDiskType ? { dataDiskType: s.dataDiskType } : {}),
|
|
60
|
+
...(s.diskAutoresize !== undefined
|
|
61
|
+
? { storageAutoResize: s.diskAutoresize }
|
|
62
|
+
: {}),
|
|
63
|
+
...(s.diskAutoresizeLimit !== undefined
|
|
64
|
+
? { storageAutoResizeLimit: String(s.diskAutoresizeLimit) }
|
|
65
|
+
: {}),
|
|
66
|
+
...(s.ipConfiguration
|
|
67
|
+
? {
|
|
68
|
+
ipConfiguration: {
|
|
69
|
+
...(s.ipConfiguration.ipv4Enabled !== undefined
|
|
70
|
+
? { ipv4Enabled: s.ipConfiguration.ipv4Enabled }
|
|
71
|
+
: {}),
|
|
72
|
+
...(s.ipConfiguration.privateNetwork
|
|
73
|
+
? { privateNetwork: s.ipConfiguration.privateNetwork }
|
|
74
|
+
: {}),
|
|
75
|
+
...(s.ipConfiguration.enablePrivatePathForGoogleCloudServices !==
|
|
76
|
+
undefined
|
|
77
|
+
? {
|
|
78
|
+
enablePrivatePathForGoogleCloudServices: s.ipConfiguration.enablePrivatePathForGoogleCloudServices,
|
|
79
|
+
}
|
|
80
|
+
: {}),
|
|
81
|
+
...(s.ipConfiguration.requireSsl !== undefined
|
|
82
|
+
? { requireSsl: s.ipConfiguration.requireSsl }
|
|
83
|
+
: {}),
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
: {}),
|
|
87
|
+
...(s.backupConfiguration ? { backupConfiguration: s.backupConfiguration } : {}),
|
|
88
|
+
...(s.databaseFlags ? { databaseFlags: s.databaseFlags } : {}),
|
|
89
|
+
...(s.deletionProtectionEnabled !== undefined
|
|
90
|
+
? { deletionProtectionEnabled: s.deletionProtectionEnabled }
|
|
91
|
+
: {}),
|
|
92
|
+
...(s.activationPolicy ? { activationPolicy: s.activationPolicy } : {}),
|
|
93
|
+
...(s.availabilityType ? { availabilityType: s.availabilityType } : {}),
|
|
94
|
+
...(settingsVersion !== undefined ? { settingsVersion } : {}),
|
|
95
|
+
});
|
|
96
|
+
export const SqlInstanceProvider = () => Provider.effect(SqlInstance, Effect.gen(function* () {
|
|
97
|
+
const getInstances = yield* sql.getInstances;
|
|
98
|
+
const insertInstances = yield* sql.insertInstances;
|
|
99
|
+
const patchInstances = yield* sql.patchInstances;
|
|
100
|
+
const deleteInstances = yield* sql.deleteInstances;
|
|
101
|
+
const getOperations = yield* sql.getOperations;
|
|
102
|
+
const awaitOperation = makeAwaitOperation(getOperations);
|
|
103
|
+
const observe = (project, name) => getInstances({ project, instance: name }).pipe(Effect.catchTag("NotFound", () => Effect.succeed(undefined)), Effect.catchTag("Forbidden", () => Effect.succeed(undefined)));
|
|
104
|
+
const syncMutable = Effect.fn(function* (args) {
|
|
105
|
+
const obsSettings = args.observed.settings ?? {};
|
|
106
|
+
const desiredSettingsForCompare = toSettingsBody(args.news.settings, args.desiredLabels);
|
|
107
|
+
// Per-field diff — settingsVersion is added below only if we
|
|
108
|
+
// actually need to patch, so it's not part of the no-op check.
|
|
109
|
+
let needPatch = false;
|
|
110
|
+
const reasons = [];
|
|
111
|
+
const compare = (key, a, b) => {
|
|
112
|
+
if (!deepEqual(a, b)) {
|
|
113
|
+
needPatch = true;
|
|
114
|
+
reasons.push(key);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
compare("tier", obsSettings.tier, desiredSettingsForCompare.tier);
|
|
118
|
+
compare("edition", obsSettings.edition, desiredSettingsForCompare.edition);
|
|
119
|
+
compare("dataDiskSizeGb", obsSettings.dataDiskSizeGb, desiredSettingsForCompare.dataDiskSizeGb);
|
|
120
|
+
compare("dataDiskType", obsSettings.dataDiskType, desiredSettingsForCompare.dataDiskType);
|
|
121
|
+
compare("storageAutoResize", obsSettings.storageAutoResize, desiredSettingsForCompare.storageAutoResize);
|
|
122
|
+
compare("storageAutoResizeLimit", obsSettings.storageAutoResizeLimit, desiredSettingsForCompare.storageAutoResizeLimit);
|
|
123
|
+
compare("ipConfiguration", obsSettings.ipConfiguration, desiredSettingsForCompare.ipConfiguration);
|
|
124
|
+
compare("backupConfiguration", obsSettings.backupConfiguration, desiredSettingsForCompare.backupConfiguration);
|
|
125
|
+
compare("databaseFlags", obsSettings.databaseFlags ?? [], desiredSettingsForCompare.databaseFlags ?? []);
|
|
126
|
+
compare("deletionProtectionEnabled", obsSettings.deletionProtectionEnabled, desiredSettingsForCompare.deletionProtectionEnabled);
|
|
127
|
+
compare("activationPolicy", obsSettings.activationPolicy, desiredSettingsForCompare.activationPolicy);
|
|
128
|
+
compare("availabilityType", obsSettings.availabilityType, desiredSettingsForCompare.availabilityType);
|
|
129
|
+
const labelDiff = diffTags({ ...(obsSettings.userLabels ?? {}) }, args.desiredLabels);
|
|
130
|
+
if (labelDiff.removed.length > 0 || labelDiff.upsert.length > 0) {
|
|
131
|
+
needPatch = true;
|
|
132
|
+
reasons.push("userLabels");
|
|
133
|
+
}
|
|
134
|
+
if (!needPatch)
|
|
135
|
+
return;
|
|
136
|
+
// Thread the observed settingsVersion through the patch body
|
|
137
|
+
// — Cloud SQL uses it as the optimistic-concurrency token
|
|
138
|
+
// (etag is deprecated on this resource).
|
|
139
|
+
const body = {
|
|
140
|
+
settings: toSettingsBody(args.news.settings, args.desiredLabels, obsSettings.settingsVersion),
|
|
141
|
+
};
|
|
142
|
+
const op = yield* patchInstances({
|
|
143
|
+
project: args.project,
|
|
144
|
+
instance: args.name,
|
|
145
|
+
body,
|
|
146
|
+
}).pipe(Effect.catchTag("BadRequest", reshapeBadRequest("Instance", "patch")));
|
|
147
|
+
if (op.name)
|
|
148
|
+
yield* awaitOperation(args.project, op.name, args.session);
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
stables: ["name", "selfLink", "project", "region", "connectionName"],
|
|
152
|
+
diff: Effect.fn(function* ({ news, olds = {} }) {
|
|
153
|
+
if (!isResolved(news))
|
|
154
|
+
return undefined;
|
|
155
|
+
if (somePropsAreDifferent(olds, news, [
|
|
156
|
+
"project",
|
|
157
|
+
"region",
|
|
158
|
+
"name",
|
|
159
|
+
"databaseVersion",
|
|
160
|
+
])) {
|
|
161
|
+
return { action: "replace" };
|
|
162
|
+
}
|
|
163
|
+
return undefined;
|
|
164
|
+
}),
|
|
165
|
+
reconcile: Effect.fn(function* ({ id, news, session }) {
|
|
166
|
+
const internalLabels = yield* gcpInternalLabels(id);
|
|
167
|
+
const desiredName = news.name ??
|
|
168
|
+
(yield* createPhysicalName({ id, maxLength: 98 })).toLowerCase();
|
|
169
|
+
yield* validateInstanceName(desiredName);
|
|
170
|
+
const desiredLabels = {
|
|
171
|
+
...(news.labels ?? {}),
|
|
172
|
+
...internalLabels,
|
|
173
|
+
};
|
|
174
|
+
// 1. Observe — collapse 403 to "missing" alongside 404.
|
|
175
|
+
let observed = yield* observe(news.project, desiredName);
|
|
176
|
+
// 2. Ensure — insert. Like Cloud Run / GKE, sqladmin can 403
|
|
177
|
+
// with "Cloud SQL Admin API has not been used in project
|
|
178
|
+
// ... If you enabled this API recently, wait …" for ~1–2
|
|
179
|
+
// minutes after ApiEnable lands. Retry the insert on that
|
|
180
|
+
// specific 403; other Forbidden cases propagate.
|
|
181
|
+
if (!observed) {
|
|
182
|
+
const op = yield* insertInstances({
|
|
183
|
+
project: news.project,
|
|
184
|
+
body: {
|
|
185
|
+
name: desiredName,
|
|
186
|
+
region: news.region,
|
|
187
|
+
databaseVersion: news.databaseVersion,
|
|
188
|
+
...(news.rootPassword
|
|
189
|
+
? { rootPassword: Redacted.value(news.rootPassword) }
|
|
190
|
+
: {}),
|
|
191
|
+
settings: toSettingsBody(news.settings, desiredLabels),
|
|
192
|
+
},
|
|
193
|
+
}).pipe(Effect.retry({
|
|
194
|
+
while: (e) => e?._tag === "Forbidden" &&
|
|
195
|
+
/enabled this API recently|has not been used/i.test(e.message ?? ""),
|
|
196
|
+
schedule: Schedule.spaced(Duration.seconds(15)).pipe(Schedule.both(Schedule.recurs(20)), Schedule.tapOutput(() => session.note("Waiting for Cloud SQL Admin API enablement to propagate…"))),
|
|
197
|
+
}), Effect.catchTag("Conflict", () => Effect.succeed(undefined)), Effect.catchTag("BadRequest", reshapeBadRequest("Instance", "insert")));
|
|
198
|
+
if (op?.name)
|
|
199
|
+
yield* awaitOperation(news.project, op.name, session);
|
|
200
|
+
observed = yield* getInstances({
|
|
201
|
+
project: news.project,
|
|
202
|
+
instance: desiredName,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
// 3. Sync — single patch with the full settings body when any
|
|
206
|
+
// field drifts. settingsVersion threaded through for OCC.
|
|
207
|
+
yield* syncMutable({
|
|
208
|
+
project: news.project,
|
|
209
|
+
name: desiredName,
|
|
210
|
+
observed,
|
|
211
|
+
news,
|
|
212
|
+
desiredLabels,
|
|
213
|
+
session,
|
|
214
|
+
});
|
|
215
|
+
const final = yield* getInstances({
|
|
216
|
+
project: news.project,
|
|
217
|
+
instance: desiredName,
|
|
218
|
+
});
|
|
219
|
+
return toAttributes(final, {
|
|
220
|
+
project: news.project,
|
|
221
|
+
region: news.region,
|
|
222
|
+
name: desiredName,
|
|
223
|
+
});
|
|
224
|
+
}),
|
|
225
|
+
delete: Effect.fn(function* ({ output, session }) {
|
|
226
|
+
yield* deleteInstances({
|
|
227
|
+
project: output.project,
|
|
228
|
+
instance: output.name,
|
|
229
|
+
}).pipe(Effect.flatMap((op) => op.name
|
|
230
|
+
? awaitOperation(output.project, op.name, session)
|
|
231
|
+
: Effect.succeed(op)), Effect.catchTag("NotFound", () => Effect.void), Effect.catchTag("BadRequest", reshapeBadRequest("Instance", "delete")));
|
|
232
|
+
}),
|
|
233
|
+
read: Effect.fn(function* ({ id, output, olds }) {
|
|
234
|
+
const project = output?.project ?? olds?.project;
|
|
235
|
+
const region = output?.region ?? olds?.region;
|
|
236
|
+
if (!project || !region)
|
|
237
|
+
return undefined;
|
|
238
|
+
const name = output?.name ??
|
|
239
|
+
olds?.name ??
|
|
240
|
+
(yield* createPhysicalName({ id, maxLength: 98 })).toLowerCase();
|
|
241
|
+
const observed = yield* observe(project, name);
|
|
242
|
+
if (!observed)
|
|
243
|
+
return undefined;
|
|
244
|
+
const attrs = toAttributes(observed, { project, region, name });
|
|
245
|
+
return (yield* hasAlchemyLabels(id, observed.settings?.userLabels))
|
|
246
|
+
? attrs
|
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AAQ,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;YAC7C,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,IAAI,IAAI,EAAE,OAAO,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,CAAC;YAC9C,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM;gBAAE,OAAO,SAAS,CAAC;YAC1C,MAAM,IAAI,GACR,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;gBACV,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACnE,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC/C,IAAI,CAAC,QAAQ;gBAAE,OAAO,SAAS,CAAC;YAChC,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YAChE,OAAO,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;gBACjE,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ConfigError } from "@distilled.cloud/gcp";
|
|
2
|
+
import * as sql from "@distilled.cloud/gcp/sqladmin-v1";
|
|
3
|
+
import type { ScopedPlanStatusSession } from "alchemy/Cli/Cli";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
/**
|
|
6
|
+
* Resolved callable signature of `sql.getOperations`.
|
|
7
|
+
*
|
|
8
|
+
* `sql.getOperations` is itself an `Effect<callable, never, Credentials |
|
|
9
|
+
* HttpClient>`, so `Effect.Success` extracts the callable. Using a
|
|
10
|
+
* derived alias keeps the helper aligned with the SDK without us
|
|
11
|
+
* hand-writing the input/output/error union, which would drift if the
|
|
12
|
+
* patch set changes.
|
|
13
|
+
*/
|
|
14
|
+
type GetOperations = Effect.Success<typeof sql.getOperations>;
|
|
15
|
+
/**
|
|
16
|
+
* Build the Cloud SQL Admin long-running-operation polling helper.
|
|
17
|
+
*
|
|
18
|
+
* Sqladmin `Operation`s carry `.status: "PENDING" | "RUNNING" | "DONE"`
|
|
19
|
+
* (NOT `.done: boolean` like Cloud Resource Manager / Cloud Run, and
|
|
20
|
+
* NOT `.status === "DONE"` against a different enum). Verified at
|
|
21
|
+
* `vendor/distilled/packages/gcp/src/services/sqladmin-v1.ts:606–612`.
|
|
22
|
+
*
|
|
23
|
+
* Unlike Cloud Run, Sqladmin operations are NOT fully-qualified path
|
|
24
|
+
* names — the API returns a bare operation id (e.g. `e9e88dca-...`),
|
|
25
|
+
* and `getOperations` takes `{ project, operation }`. Callers therefore
|
|
26
|
+
* pass the bare id alongside the parent project context.
|
|
27
|
+
*
|
|
28
|
+
* Schedule: exponential 1s → 1.5× growth, capped via the count cap of
|
|
29
|
+
* 60 retries → roughly a few minutes wall ceiling. Most Cloud SQL
|
|
30
|
+
* operations (CREATE_USER, CREATE_DATABASE, UPDATE settings) finish
|
|
31
|
+
* in 1–30 s; instance CREATE / patch involving a restart are the long
|
|
32
|
+
* pole at 4–10 min, so callers running those should be aware that
|
|
33
|
+
* recurs(60) may bottom out and surface as a retry budget exhaustion.
|
|
34
|
+
*
|
|
35
|
+
* @see https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1/operations
|
|
36
|
+
*/
|
|
37
|
+
export declare const makeAwaitOperation: (getOperations: GetOperations) => (project: string, operationName: string, session: ScopedPlanStatusSession) => Effect.Effect<sql.Operation, ConfigError | sql.GetOperationsError | {
|
|
38
|
+
_tag: "OperationPending";
|
|
39
|
+
}, never>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=Operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operations.d.ts","sourceRoot":"","sources":["../../src/Sqladmin/Operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,kCAAkC,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC;;;;;;;;GAQG;AACH,KAAK,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,CAAC,aAAa,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kBAAkB,GAAI,eAAe,aAAa;;SAgC3D,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
* Build the Cloud SQL Admin long-running-operation polling helper.
|
|
7
|
+
*
|
|
8
|
+
* Sqladmin `Operation`s carry `.status: "PENDING" | "RUNNING" | "DONE"`
|
|
9
|
+
* (NOT `.done: boolean` like Cloud Resource Manager / Cloud Run, and
|
|
10
|
+
* NOT `.status === "DONE"` against a different enum). Verified at
|
|
11
|
+
* `vendor/distilled/packages/gcp/src/services/sqladmin-v1.ts:606–612`.
|
|
12
|
+
*
|
|
13
|
+
* Unlike Cloud Run, Sqladmin operations are NOT fully-qualified path
|
|
14
|
+
* names — the API returns a bare operation id (e.g. `e9e88dca-...`),
|
|
15
|
+
* and `getOperations` takes `{ project, operation }`. Callers therefore
|
|
16
|
+
* pass the bare id alongside the parent project context.
|
|
17
|
+
*
|
|
18
|
+
* Schedule: exponential 1s → 1.5× growth, capped via the count cap of
|
|
19
|
+
* 60 retries → roughly a few minutes wall ceiling. Most Cloud SQL
|
|
20
|
+
* operations (CREATE_USER, CREATE_DATABASE, UPDATE settings) finish
|
|
21
|
+
* in 1–30 s; instance CREATE / patch involving a restart are the long
|
|
22
|
+
* pole at 4–10 min, so callers running those should be aware that
|
|
23
|
+
* recurs(60) may bottom out and surface as a retry budget exhaustion.
|
|
24
|
+
*
|
|
25
|
+
* @see https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1/operations
|
|
26
|
+
*/
|
|
27
|
+
export const makeAwaitOperation = (getOperations) => Effect.fn(function* (project, operationName, session) {
|
|
28
|
+
const op = yield* getOperations({ project, operation: operationName }).pipe(Effect.flatMap((current) => current.status === "DONE"
|
|
29
|
+
? Effect.succeed(current)
|
|
30
|
+
: Effect.fail({ _tag: "OperationPending" })), Effect.retry({
|
|
31
|
+
while: (e) => e?._tag === "OperationPending",
|
|
32
|
+
schedule: Schedule.exponential(Duration.seconds(1), 1.5).pipe(Schedule.either(Schedule.spaced(Duration.seconds(10))), Schedule.both(Schedule.recurs(60)), Schedule.tapOutput(() => session.note(`Waiting for Cloud SQL operation ${operationName}…`))),
|
|
33
|
+
}));
|
|
34
|
+
if (op.error) {
|
|
35
|
+
const firstErr = op.error.errors?.[0];
|
|
36
|
+
return yield* new ConfigError({
|
|
37
|
+
message: `Cloud SQL operation ${operationName} failed: ${firstErr?.message ?? JSON.stringify(op.error)}`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return op;
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=Operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operations.js","sourceRoot":"","sources":["../../src/Sqladmin/Operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,KAAK,QAAQ,MAAM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G,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC;YAC5B,OAAO,EAAE,uBAAuB,aAAa,YAC3C,QAAQ,EAAE,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAC9C,EAAE;SACH,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branded literal-union types for Cloud SQL props.
|
|
3
|
+
*
|
|
4
|
+
* Distilled's generated `databaseVersion` field is an open-tailed union
|
|
5
|
+
* (`"POSTGRES_15" | … | (string & {})`) so the GCP server can ship new
|
|
6
|
+
* versions without breaking SDK consumers. For our props we narrow to
|
|
7
|
+
* the subset we actually support — at the moment, the supported
|
|
8
|
+
* Postgres versions for greenfield instances. This gives consumers
|
|
9
|
+
* compile-time autocomplete and rejects typos like `"POSTGES_15"`.
|
|
10
|
+
*
|
|
11
|
+
* MySQL / SQL Server enum members are intentionally omitted — we only
|
|
12
|
+
* provision Postgres. Add a sibling `MySqlVersion` / `SqlServerVersion`
|
|
13
|
+
* type if/when those land as targets.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Supported Postgres major versions for new Cloud SQL instances.
|
|
17
|
+
*
|
|
18
|
+
* Cloud SQL only allows creating instances on currently-supported
|
|
19
|
+
* majors. As of 2026-06, that's 13–17 for greenfield; we expose 15+
|
|
20
|
+
* since that's what new MicroAGI stacks target. Older versions can be
|
|
21
|
+
* read/managed but should be migrated.
|
|
22
|
+
*
|
|
23
|
+
* @see https://cloud.google.com/sql/docs/postgres/db-versions
|
|
24
|
+
*/
|
|
25
|
+
export type PostgresVersion = "POSTGRES_15" | "POSTGRES_16" | "POSTGRES_17";
|
|
26
|
+
/**
|
|
27
|
+
* Cloud SQL edition. `ENTERPRISE_PLUS` unlocks Data Cache, near-zero
|
|
28
|
+
* downtime planned maintenance, and longer log retention; `ENTERPRISE`
|
|
29
|
+
* is the standard tier.
|
|
30
|
+
*
|
|
31
|
+
* @see https://cloud.google.com/sql/docs/postgres/editions-intro
|
|
32
|
+
*/
|
|
33
|
+
export type SqlEdition = "ENTERPRISE" | "ENTERPRISE_PLUS";
|
|
34
|
+
/**
|
|
35
|
+
* Data-disk type. PD_SSD is the default and what any new workload
|
|
36
|
+
* should pick. PD_HDD is legacy and slower; only useful for archival
|
|
37
|
+
* read replicas.
|
|
38
|
+
*
|
|
39
|
+
* @see https://cloud.google.com/sql/docs/postgres/instance-settings#storage-type-2ndgen
|
|
40
|
+
*/
|
|
41
|
+
export type SqlDataDiskType = "PD_SSD" | "PD_HDD";
|
|
42
|
+
/**
|
|
43
|
+
* Availability type. `ZONAL` runs in one zone; `REGIONAL` runs a
|
|
44
|
+
* standby in a second zone for HA at ~2× the cost.
|
|
45
|
+
*
|
|
46
|
+
* @see https://cloud.google.com/sql/docs/postgres/high-availability
|
|
47
|
+
*/
|
|
48
|
+
export type SqlAvailabilityType = "ZONAL" | "REGIONAL";
|
|
49
|
+
/**
|
|
50
|
+
* Activation policy. `ALWAYS` keeps the instance on; `NEVER` parks
|
|
51
|
+
* it (useful for occasional dev databases).
|
|
52
|
+
*
|
|
53
|
+
* @see https://cloud.google.com/sql/docs/postgres/start-stop-restart-instance
|
|
54
|
+
*/
|
|
55
|
+
export type SqlActivationPolicy = "ALWAYS" | "NEVER";
|
|
56
|
+
/**
|
|
57
|
+
* Cloud SQL user auth type.
|
|
58
|
+
*
|
|
59
|
+
* - `BUILT_IN` — classic username + password Postgres role. The
|
|
60
|
+
* provider requires a `password` Redacted for this type.
|
|
61
|
+
* - `CLOUD_IAM_USER` — a human IAM principal authenticated via the
|
|
62
|
+
* Cloud SQL Auth Proxy / IAM database authn token exchange.
|
|
63
|
+
* - `CLOUD_IAM_SERVICE_ACCOUNT` — a GCP service-account principal,
|
|
64
|
+
* same auth mechanism as `CLOUD_IAM_USER`. The Postgres role name
|
|
65
|
+
* is the SA email **with the trailing `.gserviceaccount.com`
|
|
66
|
+
* stripped** (Cloud SQL caps role names at 63 chars; SA emails are
|
|
67
|
+
* longer than that).
|
|
68
|
+
* - Open tail `(string & {})` keeps forward compatibility for
|
|
69
|
+
* `CLOUD_IAM_GROUP`, `CLOUD_IAM_GROUP_SERVICE_ACCOUNT`, etc.
|
|
70
|
+
*
|
|
71
|
+
* @see https://cloud.google.com/sql/docs/postgres/iam-authentication
|
|
72
|
+
*/
|
|
73
|
+
export type SqlUserType = "BUILT_IN" | "CLOUD_IAM_USER" | "CLOUD_IAM_SERVICE_ACCOUNT" | "CLOUD_IAM_GROUP" | (string & {});
|
|
74
|
+
/**
|
|
75
|
+
* Convenience predicate: `true` for any IAM-backed user type, where
|
|
76
|
+
* passwords are forbidden and the principal is a GCP identity.
|
|
77
|
+
*
|
|
78
|
+
* Used by `Validation.ts` and `User.ts` to fan out between the
|
|
79
|
+
* built-in password path and the IAM token-exchange path.
|
|
80
|
+
*/
|
|
81
|
+
export declare const isIamUserType: (type: SqlUserType | undefined) => boolean;
|
|
82
|
+
//# sourceMappingURL=Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/Sqladmin/Types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC;AAE5E;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,UAAU,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,gBAAgB,GAChB,2BAA2B,GAC3B,iBAAiB,GACjB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GACxB,MAAM,WAAW,GAAG,SAAS,KAC5B,OAMsB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branded literal-union types for Cloud SQL props.
|
|
3
|
+
*
|
|
4
|
+
* Distilled's generated `databaseVersion` field is an open-tailed union
|
|
5
|
+
* (`"POSTGRES_15" | … | (string & {})`) so the GCP server can ship new
|
|
6
|
+
* versions without breaking SDK consumers. For our props we narrow to
|
|
7
|
+
* the subset we actually support — at the moment, the supported
|
|
8
|
+
* Postgres versions for greenfield instances. This gives consumers
|
|
9
|
+
* compile-time autocomplete and rejects typos like `"POSTGES_15"`.
|
|
10
|
+
*
|
|
11
|
+
* MySQL / SQL Server enum members are intentionally omitted — we only
|
|
12
|
+
* provision Postgres. Add a sibling `MySqlVersion` / `SqlServerVersion`
|
|
13
|
+
* type if/when those land as targets.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Convenience predicate: `true` for any IAM-backed user type, where
|
|
17
|
+
* passwords are forbidden and the principal is a GCP identity.
|
|
18
|
+
*
|
|
19
|
+
* Used by `Validation.ts` and `User.ts` to fan out between the
|
|
20
|
+
* built-in password path and the IAM token-exchange path.
|
|
21
|
+
*/
|
|
22
|
+
export const isIamUserType = (type) => type === "CLOUD_IAM_USER" ||
|
|
23
|
+
type === "CLOUD_IAM_SERVICE_ACCOUNT" ||
|
|
24
|
+
type === "CLOUD_IAM_GROUP" ||
|
|
25
|
+
type === "CLOUD_IAM_GROUP_USER" ||
|
|
26
|
+
type === "CLOUD_IAM_GROUP_SERVICE_ACCOUNT" ||
|
|
27
|
+
type === "ENTRAID_USER";
|
|
28
|
+
//# sourceMappingURL=Types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../src/Sqladmin/Types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,IAA6B,EACpB,EAAE,CACX,IAAI,KAAK,gBAAgB;IACzB,IAAI,KAAK,2BAA2B;IACpC,IAAI,KAAK,iBAAiB;IAC1B,IAAI,KAAK,sBAAsB;IAC/B,IAAI,KAAK,iCAAiC;IAC1C,IAAI,KAAK,cAAc,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Resource } from "alchemy";
|
|
2
|
+
import * as Provider from "alchemy/Provider";
|
|
3
|
+
import * as Redacted from "effect/Redacted";
|
|
4
|
+
import type * as GCP from "../Providers.ts";
|
|
5
|
+
import { type SqlUserType } from "./Types.ts";
|
|
6
|
+
/**
|
|
7
|
+
* A Cloud SQL user (database role + auth binding).
|
|
8
|
+
*
|
|
9
|
+
* **Three auth modes:**
|
|
10
|
+
*
|
|
11
|
+
* - `BUILT_IN` — classic Postgres username/password. Requires
|
|
12
|
+
* `password`. The role exists only inside Postgres.
|
|
13
|
+
* - `CLOUD_IAM_USER` — a human IAM principal. `name` is the user's
|
|
14
|
+
* email. Authenticates via the Cloud SQL Auth Proxy / IAM token
|
|
15
|
+
* exchange; no password.
|
|
16
|
+
* - `CLOUD_IAM_SERVICE_ACCOUNT` — a GCP service account principal.
|
|
17
|
+
* `name` is the SA email with the trailing `.gserviceaccount.com`
|
|
18
|
+
* stripped (Postgres role names cap at 63 chars; full SA emails
|
|
19
|
+
* often exceed that). No password.
|
|
20
|
+
*
|
|
21
|
+
* The Postgres role itself is granted no privileges by default — wire
|
|
22
|
+
* up grants via SQL (psql / migrations) once the user exists. Cloud
|
|
23
|
+
* SQL IAM authn is independent of grant management.
|
|
24
|
+
*
|
|
25
|
+
* **Adoption.** Users carry no labels and no useful comparable shape
|
|
26
|
+
* beyond `(name, host, type)`. `read` returns the observed user if it
|
|
27
|
+
* exists at this address, `undefined` otherwise. No `Unowned` wrapper
|
|
28
|
+
* — adoption is implicit; the worst case is alchemy issuing a no-op
|
|
29
|
+
* patch / a delete on what it thinks is its own.
|
|
30
|
+
*
|
|
31
|
+
* **Replace triggers.** `project`, `instance`, `name`, `host`, `type`.
|
|
32
|
+
* Type changes need a drop/recreate because Cloud SQL stores the auth
|
|
33
|
+
* shape immutably; we surface that via replace.
|
|
34
|
+
*
|
|
35
|
+
* @example IAM service-account user (workload identity → DB role)
|
|
36
|
+
* ```typescript
|
|
37
|
+
* yield* GCP.SqlUser("AppSaUser", {
|
|
38
|
+
* project: instance.project,
|
|
39
|
+
* instance: instance.name,
|
|
40
|
+
* // App SA email is `app@my-project.iam.gserviceaccount.com` — strip
|
|
41
|
+
* // `.gserviceaccount.com` so the Postgres role name fits in 63 chars.
|
|
42
|
+
* name: "app@my-project.iam",
|
|
43
|
+
* type: "CLOUD_IAM_SERVICE_ACCOUNT",
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example Built-in user with a Redacted password
|
|
48
|
+
* ```typescript
|
|
49
|
+
* yield* GCP.SqlUser("MigratorUser", {
|
|
50
|
+
* project: instance.project,
|
|
51
|
+
* instance: instance.name,
|
|
52
|
+
* name: "migrator",
|
|
53
|
+
* password: Redacted.make(process.env.MIGRATOR_PASSWORD!),
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users
|
|
58
|
+
* @see https://cloud.google.com/sql/docs/postgres/iam-authentication
|
|
59
|
+
*/
|
|
60
|
+
export type SqlUserProps = {
|
|
61
|
+
/**
|
|
62
|
+
* GCP project ID hosting the parent instance. Immutable — replace.
|
|
63
|
+
* @see https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users#User
|
|
64
|
+
*/
|
|
65
|
+
project: string;
|
|
66
|
+
/**
|
|
67
|
+
* Parent Cloud SQL instance name. Immutable — replace.
|
|
68
|
+
*/
|
|
69
|
+
instance: string;
|
|
70
|
+
/**
|
|
71
|
+
* User/role name. For `BUILT_IN`, any valid Postgres identifier.
|
|
72
|
+
* For `CLOUD_IAM_USER`, the principal's email. For
|
|
73
|
+
* `CLOUD_IAM_SERVICE_ACCOUNT`, the SA email **with the trailing
|
|
74
|
+
* `.gserviceaccount.com` stripped** — Postgres role names cap at
|
|
75
|
+
* 63 chars; full SA emails are typically 70+. Immutable — replace.
|
|
76
|
+
*/
|
|
77
|
+
name: string;
|
|
78
|
+
/**
|
|
79
|
+
* Host the user can connect from. PostgreSQL ignores this and
|
|
80
|
+
* defaults to `%` (any host). For MySQL it's load-bearing.
|
|
81
|
+
* Immutable — replace.
|
|
82
|
+
*/
|
|
83
|
+
host?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Auth backend. Defaults to `BUILT_IN` if unset.
|
|
86
|
+
* @see https://cloud.google.com/sql/docs/postgres/iam-authentication
|
|
87
|
+
*/
|
|
88
|
+
type?: SqlUserType;
|
|
89
|
+
/**
|
|
90
|
+
* Password for `BUILT_IN` users. Required for that type; forbidden
|
|
91
|
+
* for any IAM type (validated at plan time).
|
|
92
|
+
*/
|
|
93
|
+
password?: Redacted.Redacted<string>;
|
|
94
|
+
};
|
|
95
|
+
export type SqlUserAttributes = {
|
|
96
|
+
/** User name. */
|
|
97
|
+
name: string;
|
|
98
|
+
/** Parent instance name. */
|
|
99
|
+
instance: string;
|
|
100
|
+
/** Project ID. */
|
|
101
|
+
project: string;
|
|
102
|
+
/** Connecting host (defaults to `%` for Postgres). */
|
|
103
|
+
host: string;
|
|
104
|
+
/** Auth backend in effect. */
|
|
105
|
+
type: string;
|
|
106
|
+
};
|
|
107
|
+
export type SqlUser = Resource<"GCP.SqlUser", SqlUserProps, SqlUserAttributes, never, GCP.Providers>;
|
|
108
|
+
export declare const SqlUser: import("alchemy").ResourceClass<SqlUser>;
|
|
109
|
+
export declare const SqlUserProvider: () => import("effect/Layer").Layer<Provider.Provider<SqlUser>, never, import("@distilled.cloud/gcp").Credentials | import("effect/unstable/http/HttpClient").HttpClient>;
|
|
110
|
+
//# sourceMappingURL=User.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../src/Sqladmin/User.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb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