initial
This commit is contained in:
48
ts/interfaces/api.ts
Normal file
48
ts/interfaces/api.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Options for the SocketClient.
|
||||
*/
|
||||
export interface ISocketClientOptions {
|
||||
/** Path to the Firecracker Unix domain socket. */
|
||||
socketPath: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standardized API response from the socket client.
|
||||
*/
|
||||
export interface IApiResponse<T = any> {
|
||||
/** HTTP status code. */
|
||||
statusCode: number;
|
||||
/** Parsed response body. */
|
||||
body: T;
|
||||
/** Whether the request was successful (2xx). */
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for spawning a Firecracker process.
|
||||
*/
|
||||
export interface IFirecrackerProcessOptions {
|
||||
/** Path to the firecracker binary. */
|
||||
binaryPath: string;
|
||||
/** Path for the API Unix domain socket. */
|
||||
socketPath: string;
|
||||
/** Log level for Firecracker. */
|
||||
logLevel?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom error class for SmartVM operations.
|
||||
*/
|
||||
export class SmartVMError extends Error {
|
||||
public code: string;
|
||||
public statusCode?: number;
|
||||
public details?: any;
|
||||
|
||||
constructor(message: string, code: string, statusCode?: number, details?: any) {
|
||||
super(message);
|
||||
this.name = 'SmartVMError';
|
||||
this.code = code;
|
||||
this.statusCode = statusCode;
|
||||
this.details = details;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user