feat: add baseos contracts
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
export type TBaseOsRuntimeLevel = 'app-layer' | 'host-os' | 'target-state';
|
||||
|
||||
export type TBaseOsCloudlyConnectionStatus =
|
||||
| 'not-configured'
|
||||
| 'connecting'
|
||||
| 'connected'
|
||||
| 'failed';
|
||||
|
||||
export interface IBalenaDeviceState {
|
||||
api_port?: number;
|
||||
ip_address?: string;
|
||||
mac_address?: string;
|
||||
commit?: string;
|
||||
status?: string;
|
||||
os_version?: string;
|
||||
supervisor_version?: string;
|
||||
update_pending?: boolean;
|
||||
update_downloaded?: boolean;
|
||||
update_failed?: boolean;
|
||||
download_progress?: number | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface IBalenaStateStatus {
|
||||
status?: string;
|
||||
appState?: string;
|
||||
overallDownloadProgress?: number | null;
|
||||
release?: string;
|
||||
containers?: Array<Record<string, unknown>>;
|
||||
images?: Array<Record<string, unknown>>;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface IBaseOsRuntimeInfo {
|
||||
runtime: 'baseos';
|
||||
runtimeLevel: TBaseOsRuntimeLevel;
|
||||
nodeId: string;
|
||||
cloudlyUrl?: string;
|
||||
cloudlyConnectionStatus: TBaseOsCloudlyConnectionStatus;
|
||||
supervisorAvailable: boolean;
|
||||
supervisorAddress?: string;
|
||||
deviceState?: IBalenaDeviceState;
|
||||
stateStatus?: IBalenaStateStatus;
|
||||
checkedAt: number;
|
||||
}
|
||||
|
||||
export interface IBaseOsDesiredState {
|
||||
release?: string;
|
||||
targetState?: Record<string, unknown>;
|
||||
updatedAt?: number;
|
||||
}
|
||||
|
||||
export interface IBaseOsNode {
|
||||
id: string;
|
||||
data: {
|
||||
runtimeInfo: IBaseOsRuntimeInfo;
|
||||
desiredState?: IBaseOsDesiredState;
|
||||
createdAt: number;
|
||||
updatedAt: number;
|
||||
lastHeartbeatAt?: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IBaseOsRegisterResult {
|
||||
nodeId?: string;
|
||||
nodeToken?: string;
|
||||
accepted: boolean;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface IBaseOsHeartbeatResult {
|
||||
accepted: boolean;
|
||||
message?: string;
|
||||
desiredState?: IBaseOsDesiredState;
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export * from './registry.js';
|
||||
export * from './secretbundle.js';
|
||||
export * from './secretgroup.js';
|
||||
export * from './baremetal.js';
|
||||
export * from './baseos.js';
|
||||
export * from './backup.js';
|
||||
export * from './clusternode.js';
|
||||
export * from './settings.js';
|
||||
|
||||
@@ -9,6 +9,9 @@ export interface ICloudlySettings {
|
||||
hetznerToken?: string;
|
||||
cloudflareToken?: string;
|
||||
|
||||
// BaseOS enrollment
|
||||
baseosJoinToken?: string;
|
||||
|
||||
// AWS Credentials
|
||||
awsAccessKey?: string;
|
||||
awsSecretKey?: string;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import type {
|
||||
IBaseOsHeartbeatResult,
|
||||
IBaseOsNode,
|
||||
IBaseOsRegisterResult,
|
||||
IBaseOsRuntimeInfo,
|
||||
} from '../data/baseos.js';
|
||||
import type { IIdentity } from '../data/user.js';
|
||||
|
||||
export interface IRequest_BaseOs_Cloudly_RegisterNode {
|
||||
method: 'baseOsRegisterNode';
|
||||
request: {
|
||||
joinToken?: string;
|
||||
nodeToken?: string;
|
||||
status: IBaseOsRuntimeInfo;
|
||||
};
|
||||
response: IBaseOsRegisterResult;
|
||||
}
|
||||
|
||||
export interface IRequest_BaseOs_Cloudly_SendHeartbeat {
|
||||
method: 'baseOsSendHeartbeat';
|
||||
request: {
|
||||
nodeToken: string;
|
||||
status: IBaseOsRuntimeInfo;
|
||||
};
|
||||
response: IBaseOsHeartbeatResult;
|
||||
}
|
||||
|
||||
export interface IRequest_Any_Cloudly_GetBaseOsNodes {
|
||||
method: 'getBaseOsNodes';
|
||||
request: {
|
||||
identity: IIdentity;
|
||||
};
|
||||
response: {
|
||||
nodes: IBaseOsNode[];
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import * as plugins from '../plugins.js';
|
||||
|
||||
import * as adminRequests from './admin.js';
|
||||
import * as baremetalRequests from './baremetal.js';
|
||||
import * as baseOsRequests from './baseos.js';
|
||||
import * as backupRequests from './backup.js';
|
||||
import * as certificateRequests from './certificate.js';
|
||||
import * as clusterRequests from './cluster.js';
|
||||
@@ -30,6 +31,7 @@ import * as versionRequests from './version.js';
|
||||
export {
|
||||
adminRequests as admin,
|
||||
baremetalRequests as baremetal,
|
||||
baseOsRequests as baseos,
|
||||
backupRequests as backup,
|
||||
certificateRequests as certificate,
|
||||
clusterRequests as cluster,
|
||||
|
||||
Reference in New Issue
Block a user