Skip to content

Commit cf687b9

Browse files
committed
feat: update generated APIs
1 parent 7d0a7fb commit cf687b9

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

packages/clients/src/api/mongodb/v1alpha1/api.gen.ts

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {
88
waitForResource,
99
} from '../../../bridge'
1010
import type { Region, WaitForOptions } from '../../../bridge'
11-
import { INSTANCE_TRANSIENT_STATUSES } from './content.gen'
11+
import {
12+
INSTANCE_TRANSIENT_STATUSES,
13+
SNAPSHOT_TRANSIENT_STATUSES,
14+
} from './content.gen'
1215
import {
1316
marshalCreateInstanceRequest,
1417
marshalCreateSnapshotRequest,
@@ -33,6 +36,7 @@ import type {
3336
DeleteSnapshotRequest,
3437
GetInstanceCertificateRequest,
3538
GetInstanceRequest,
39+
GetSnapshotRequest,
3640
Instance,
3741
ListInstancesRequest,
3842
ListInstancesResponse,
@@ -320,6 +324,43 @@ export class API extends ParentAPI {
320324
unmarshalSnapshot,
321325
)
322326

327+
/**
328+
* Get a Database Instance snapshot. Retrieve information about a given
329+
* snapshot of a Database Instance. You must specify, in the endpoint, the
330+
* `snapshot_id` parameter of the snapshot you want to retrieve.
331+
*
332+
* @param request - The request {@link GetSnapshotRequest}
333+
* @returns A Promise of Snapshot
334+
*/
335+
getSnapshot = (request: Readonly<GetSnapshotRequest>) =>
336+
this.client.fetch<Snapshot>(
337+
{
338+
method: 'GET',
339+
path: `/mongodb/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`,
340+
},
341+
unmarshalSnapshot,
342+
)
343+
344+
/**
345+
* Waits for {@link Snapshot} to be in a final state.
346+
*
347+
* @param request - The request {@link GetSnapshotRequest}
348+
* @param options - The waiting options
349+
* @returns A Promise of Snapshot
350+
*/
351+
waitForSnapshot = (
352+
request: Readonly<GetSnapshotRequest>,
353+
options?: Readonly<WaitForOptions<Snapshot>>,
354+
) =>
355+
waitForResource(
356+
options?.stop ??
357+
(res =>
358+
Promise.resolve(!SNAPSHOT_TRANSIENT_STATUSES.includes(res.status))),
359+
this.getSnapshot,
360+
request,
361+
options,
362+
)
363+
323364
updateSnapshot = (request: Readonly<UpdateSnapshotRequest>) =>
324365
this.client.fetch<Snapshot>(
325366
{

packages/clients/src/api/mongodb/v1alpha1/index.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type {
1616
EndpointSpecPublicDetails,
1717
GetInstanceCertificateRequest,
1818
GetInstanceRequest,
19+
GetSnapshotRequest,
1920
Instance,
2021
InstanceSetting,
2122
InstanceStatus,

packages/clients/src/api/mongodb/v1alpha1/types.gen.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,16 @@ export type GetInstanceRequest = {
340340
instanceId: string
341341
}
342342

343+
export type GetSnapshotRequest = {
344+
/**
345+
* Region to target. If none is passed will use default region from the
346+
* config.
347+
*/
348+
region?: Region
349+
/** UUID of the snapshot. */
350+
snapshotId: string
351+
}
352+
343353
export type ListInstancesRequest = {
344354
/**
345355
* Region to target. If none is passed will use default region from the

0 commit comments

Comments
 (0)