@lxdhub/api
Version:
Display, search and copy LXD-images using a web interface.
51 lines (50 loc) • 2.07 kB
TypeScript
import { Image, Remote } from '@lxdhub/db';
import Axios from 'axios';
import { LXDHubAPISettings } from '..';
import { SourceImageFactory } from './factories';
export declare class LXDService {
private readonly axios;
private sourceImageFactory;
private settings;
private logger;
constructor(axios: typeof Axios, sourceImageFactory: SourceImageFactory, settings: LXDHubAPISettings);
private getAxiosHttpsInstance;
/**
* Requests a new image on the given remote
* @param url The url to which the image should be request
* @param sourceImageDto The image
*/
private requestNewImage;
/**
* Waits for the given operation to end
* @param url The operation url
*/
private waitForOperation;
/**
* Clones the image from the given sourceRemote to the given destinationRemote
* @param image The image to be cloned
* @param sourceRemote The source remote, from which the images comes from
* @param destinationRemote The destination Remote
*/
cloneImage(image: Image, sourceRemote: Remote, destinationRemote: Remote): Promise<string>;
/**
* Waits for the clone operation and returns the result
* @param destinationRemote The destination remote
* @param operation The operation UUID from the LXD server
*/
wait(remote: string, operation: string): Promise<any>;
/**
* Adds an image to a any given remote
* @param image The image binary data
* @param remote The remote to add the image to (format: https://localhost:8334)
*/
importImage(remote: string, image: any): Promise<any>;
/**
* Tags an image with some aliases
* @param remote The remote to add the aliases to (format: https://localhost:8334)
* @param fingerprint The SHA-fingerprint of the image to add the alias to
* @param aliases The aliases to add
* @param force Wether to overwrite already existing aliases
*/
addImageAlias(remote: string, fingerprint: string, aliases: string[], force?: boolean): Promise<void>;
}