62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import type { CloudlyApiClient } from './classes.cloudlyapiclient.js';
|
|
|
|
export class Backup {
|
|
public static async createServiceBackup(
|
|
cloudlyClientRef: CloudlyApiClient,
|
|
optionsArg: {
|
|
serviceId: string;
|
|
clusterId?: string;
|
|
tags?: Record<string, string>;
|
|
},
|
|
) {
|
|
const request = cloudlyClientRef.typedsocketClient.createTypedRequest<any>(
|
|
'createServiceBackup',
|
|
);
|
|
return await request.fire({
|
|
identity: cloudlyClientRef.identity,
|
|
...optionsArg,
|
|
});
|
|
}
|
|
|
|
public static async getServiceBackups(
|
|
cloudlyClientRef: CloudlyApiClient,
|
|
optionsArg: {
|
|
serviceId?: string;
|
|
status?: string;
|
|
} = {},
|
|
) {
|
|
const request = cloudlyClientRef.typedsocketClient.createTypedRequest<any>(
|
|
'getServiceBackups',
|
|
);
|
|
return await request.fire({
|
|
identity: cloudlyClientRef.identity,
|
|
...optionsArg,
|
|
});
|
|
}
|
|
|
|
public static async getBackupById(cloudlyClientRef: CloudlyApiClient, backupIdArg: string) {
|
|
const request = cloudlyClientRef.typedsocketClient.createTypedRequest<any>('getBackupById');
|
|
return await request.fire({
|
|
identity: cloudlyClientRef.identity,
|
|
backupId: backupIdArg,
|
|
});
|
|
}
|
|
|
|
public static async restoreServiceBackup(
|
|
cloudlyClientRef: CloudlyApiClient,
|
|
optionsArg: {
|
|
backupId: string;
|
|
clear?: boolean;
|
|
resourceTypes?: Array<'volume' | 'database' | 'objectstorage'>;
|
|
},
|
|
) {
|
|
const request = cloudlyClientRef.typedsocketClient.createTypedRequest<any>(
|
|
'restoreServiceBackup',
|
|
);
|
|
return await request.fire({
|
|
identity: cloudlyClientRef.identity,
|
|
...optionsArg,
|
|
});
|
|
}
|
|
}
|