mirror of
https://github.com/moghtech/komodo.git
synced 2026-04-28 11:49:39 -05:00
improve typeshare types
This commit is contained in:
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@@ -85,7 +85,7 @@
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"command": "typeshare . --lang=typescript --output-file=./lib/ts_client/src/types.ts",
|
||||
"command": "RUST_BACKTRACE=1 typeshare . --lang=typescript --output-file=./client/ts/src/types.ts",
|
||||
"label": "generate typescript types",
|
||||
"problemMatcher": []
|
||||
}
|
||||
|
||||
@@ -1,94 +1,71 @@
|
||||
import {
|
||||
AllSystemStats,
|
||||
BasicContainerInfo,
|
||||
BasicSystemStats,
|
||||
Build,
|
||||
CpuUsage,
|
||||
CreateLocalUserResponse,
|
||||
CreateLoginSecretResponse,
|
||||
Deployment,
|
||||
DiskUsage,
|
||||
DockerNetwork,
|
||||
ExchangeForJwtResponse,
|
||||
GetLoginOptionsResponse,
|
||||
GetPeripheryVersionResponse,
|
||||
ImageSummary,
|
||||
LoginLocalUserResponse,
|
||||
LoginWithSecretResponse,
|
||||
NetworkUsage,
|
||||
Server,
|
||||
SystemComponent,
|
||||
SystemInformation,
|
||||
SystemProcess,
|
||||
Update,
|
||||
} from "./types";
|
||||
import * as Res from "./types";
|
||||
|
||||
export type AuthResponses = {
|
||||
GetLoginOptions: GetLoginOptionsResponse;
|
||||
CreateLocalUser: CreateLocalUserResponse;
|
||||
LoginLocalUser: LoginLocalUserResponse;
|
||||
ExchangeForJwt: ExchangeForJwtResponse;
|
||||
LoginWithSecret: LoginWithSecretResponse;
|
||||
GetLoginOptions: Res.GetLoginOptionsResponse;
|
||||
CreateLocalUser: Res.CreateLocalUserResponse;
|
||||
LoginLocalUser: Res.LoginLocalUserResponse;
|
||||
ExchangeForJwt: Res.ExchangeForJwtResponse;
|
||||
LoginWithSecret: Res.LoginWithSecretResponse;
|
||||
};
|
||||
|
||||
export type ApiResponses = {
|
||||
// ==== SECRET ====
|
||||
CreateLoginSecret: CreateLoginSecretResponse;
|
||||
CreateLoginSecret: Res.CreateLoginSecretResponse;
|
||||
DeleteLoginSecret: undefined;
|
||||
|
||||
//
|
||||
// ==== SERVER ====
|
||||
//
|
||||
GetPeripheryVersion: GetPeripheryVersionResponse;
|
||||
GetSystemInformation: SystemInformation;
|
||||
GetDockerContainers: BasicContainerInfo[];
|
||||
GetDockerImages: ImageSummary[];
|
||||
GetDockerNetworks: DockerNetwork[];
|
||||
GetServer: Server;
|
||||
ListServers: Server[];
|
||||
GetPeripheryVersion: Res.GetPeripheryVersionResponse;
|
||||
GetSystemInformation: Res.SystemInformation;
|
||||
GetDockerContainers: Res.BasicContainerInfo[];
|
||||
GetDockerImages: Res.ImageSummary[];
|
||||
GetDockerNetworks: Res.DockerNetwork[];
|
||||
GetServer: Res.Server;
|
||||
ListServers: Res.Server[];
|
||||
// CRUD
|
||||
CreateServer: Server;
|
||||
DeleteServer: Server;
|
||||
UpdateServer: Server;
|
||||
RenameServer: Update;
|
||||
CreateServer: Res.Server;
|
||||
DeleteServer: Res.Server;
|
||||
UpdateServer: Res.Server;
|
||||
RenameServer: Res.Update;
|
||||
// STATS
|
||||
GetAllSystemStats: AllSystemStats;
|
||||
GetBasicSystemStats: BasicSystemStats;
|
||||
GetCpuUsage: CpuUsage;
|
||||
GetDiskUsage: DiskUsage;
|
||||
GetNetworkUsage: NetworkUsage;
|
||||
GetSystemProcesses: SystemProcess[];
|
||||
GetSystemComponents: SystemComponent[];
|
||||
GetAllSystemStats: Res.AllSystemStats;
|
||||
GetBasicSystemStats: Res.BasicSystemStats;
|
||||
GetCpuUsage: Res.CpuUsage;
|
||||
GetDiskUsage: Res.DiskUsage;
|
||||
GetNetworkUsage: Res.NetworkUsage;
|
||||
GetSystemProcesses: Res.SystemProcess[];
|
||||
GetSystemComponents: Res.SystemComponent[];
|
||||
// ACTIONS
|
||||
PruneContainers: Update;
|
||||
PruneImages: Update;
|
||||
PruneNetworks: Update;
|
||||
PruneContainers: Res.Update;
|
||||
PruneImages: Res.Update;
|
||||
PruneNetworks: Res.Update;
|
||||
|
||||
//
|
||||
// ==== DEPLOYMENT ====
|
||||
//
|
||||
GetDeployment: Deployment;
|
||||
ListDeployments: Deployment[];
|
||||
GetDeployment: Res.Deployment;
|
||||
ListDeployments: Res.Deployment[];
|
||||
// CRUD
|
||||
CreateDeployment: Deployment;
|
||||
DeleteDeployment: Deployment;
|
||||
UpdateDeployment: Deployment;
|
||||
RenameDeployment: Update;
|
||||
CreateDeployment: Res.Deployment;
|
||||
DeleteDeployment: Res.Deployment;
|
||||
UpdateDeployment: Res.Deployment;
|
||||
RenameDeployment: Res.Update;
|
||||
// ACTIONS
|
||||
Deploy: Update;
|
||||
StartContainer: Update;
|
||||
StopContainer: Update;
|
||||
RemoveContainer: Update;
|
||||
Deploy: Res.Update;
|
||||
StartContainer: Res.Update;
|
||||
StopContainer: Res.Update;
|
||||
RemoveContainer: Res.Update;
|
||||
|
||||
//
|
||||
// ==== BUILD ====
|
||||
//
|
||||
GetBuild: Build;
|
||||
ListBuilds: Build[];
|
||||
GetBuild: Res.Build;
|
||||
ListBuilds: Res.Build[];
|
||||
// CRUD
|
||||
CreateBuild: Build;
|
||||
DeleteBuild: Build;
|
||||
UpdateBuild: Build;
|
||||
CreateBuild: Res.Build;
|
||||
DeleteBuild: Res.Build;
|
||||
UpdateBuild: Res.Build;
|
||||
// ACTIONS
|
||||
RunBuild: Update;
|
||||
RunBuild: Res.Update;
|
||||
};
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
Generated by typeshare 1.6.0
|
||||
*/
|
||||
|
||||
export type _PartialBuilderConfig = Partial<BuilderConfig>;
|
||||
|
||||
export type _PartialAwsBuilder = Partial<AwsBuilder>;
|
||||
|
||||
export enum PermissionLevel {
|
||||
None = "none",
|
||||
Read = "read",
|
||||
@@ -13,8 +17,24 @@ export type PermissionsMap = Record<string, PermissionLevel>;
|
||||
|
||||
export type I64 = number;
|
||||
|
||||
export type U64 = number;
|
||||
|
||||
export type MongoDocument = any;
|
||||
|
||||
export interface MongoIdObj {
|
||||
$oid: string;
|
||||
}
|
||||
|
||||
export type MongoId = MongoIdObj;
|
||||
|
||||
export type _PartialBuildConfig = Partial<BuildConfig>;
|
||||
|
||||
export type _PartialDeploymentConfig = Partial<DeploymentConfig>;
|
||||
|
||||
export type _PartialRepoConfig = Partial<RepoConfig>;
|
||||
|
||||
export type _PartialServerConfig = Partial<ServerConfig>;
|
||||
|
||||
export type BuildBuilderConfig =
|
||||
| { type: "Server", params: {
|
||||
server_id: string;
|
||||
@@ -54,17 +74,17 @@ export interface BuildConfig {
|
||||
build_args?: EnvironmentVar[];
|
||||
extra_args?: string[];
|
||||
use_buildx?: boolean;
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
export interface Build {
|
||||
_id?: string;
|
||||
_id?: MongoId;
|
||||
name: string;
|
||||
description?: string;
|
||||
permissions?: PermissionsMap;
|
||||
created_at?: I64;
|
||||
updated_at?: I64;
|
||||
last_built_at?: I64;
|
||||
tags?: string[];
|
||||
config: BuildConfig;
|
||||
}
|
||||
|
||||
@@ -77,7 +97,7 @@ export type BuilderConfig =
|
||||
| { type: "AwsBuilder", params: AwsBuilder };
|
||||
|
||||
export interface Builder {
|
||||
_id?: string;
|
||||
_id?: MongoId;
|
||||
name: string;
|
||||
description?: string;
|
||||
permissions?: PermissionsMap;
|
||||
@@ -147,29 +167,29 @@ export interface DeploymentConfig {
|
||||
container_user?: string;
|
||||
extra_args?: string[];
|
||||
docker_account?: string;
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
export interface Deployment {
|
||||
_id?: string;
|
||||
_id?: MongoId;
|
||||
name: string;
|
||||
description?: string;
|
||||
permissions?: PermissionsMap;
|
||||
created_at?: I64;
|
||||
updated_at?: I64;
|
||||
tags?: string[];
|
||||
config: DeploymentConfig;
|
||||
}
|
||||
|
||||
export enum DockerContainerState {
|
||||
Unknown = "Unknown",
|
||||
NotDeployed = "NotDeployed",
|
||||
Created = "Created",
|
||||
Restarting = "Restarting",
|
||||
Running = "Running",
|
||||
Removing = "Removing",
|
||||
Paused = "Paused",
|
||||
Exited = "Exited",
|
||||
Dead = "Dead",
|
||||
Unknown = "unknown",
|
||||
NotDeployed = "not_deployed",
|
||||
Created = "created",
|
||||
Restarting = "restarting",
|
||||
Running = "running",
|
||||
Removing = "removing",
|
||||
Paused = "paused",
|
||||
Exited = "exited",
|
||||
Dead = "dead",
|
||||
}
|
||||
|
||||
export interface BasicContainerInfo {
|
||||
@@ -195,10 +215,9 @@ export interface DeploymentActionState {
|
||||
stopping: boolean;
|
||||
starting: boolean;
|
||||
removing: boolean;
|
||||
pulling: boolean;
|
||||
recloning: boolean;
|
||||
updating: boolean;
|
||||
renaming: boolean;
|
||||
deleting: boolean;
|
||||
}
|
||||
|
||||
export interface CloneArgs {
|
||||
@@ -211,24 +230,33 @@ export interface CloneArgs {
|
||||
}
|
||||
|
||||
export interface RepoConfig {
|
||||
server_id: string;
|
||||
repo: string;
|
||||
branch: string;
|
||||
github_account: string;
|
||||
on_clone: SystemCommand;
|
||||
on_pull: SystemCommand;
|
||||
github_account?: string;
|
||||
on_clone?: SystemCommand;
|
||||
on_pull?: SystemCommand;
|
||||
}
|
||||
|
||||
export interface Repo {
|
||||
_id?: string;
|
||||
_id?: MongoId;
|
||||
name: string;
|
||||
description?: string;
|
||||
permissions?: PermissionsMap;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
created_at?: I64;
|
||||
updated_at?: I64;
|
||||
last_pulled_at?: I64;
|
||||
tags?: string[];
|
||||
config: RepoConfig;
|
||||
}
|
||||
|
||||
export interface RepoActionState {
|
||||
cloning: boolean;
|
||||
pulling: boolean;
|
||||
updating: boolean;
|
||||
deleting: boolean;
|
||||
}
|
||||
|
||||
export interface ImageSummary {
|
||||
/** ID is the content-addressable ID of an image. This identifier is a content-addressable digest calculated from the image's configuration (which includes the digests of layers used by the image). Note that this digest differs from the `RepoDigests` below, which holds digests of image manifests that reference the image. */
|
||||
Id: string;
|
||||
@@ -304,16 +332,16 @@ export interface ServerConfig {
|
||||
disk_warning: number;
|
||||
disk_critical: number;
|
||||
to_notify?: string[];
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
export interface Server {
|
||||
_id?: string;
|
||||
_id?: MongoId;
|
||||
name: string;
|
||||
description?: string;
|
||||
permissions?: PermissionsMap;
|
||||
created_at?: I64;
|
||||
updated_at?: I64;
|
||||
tags?: string[];
|
||||
config: ServerConfig;
|
||||
}
|
||||
|
||||
@@ -448,12 +476,13 @@ export interface ServerHealth {
|
||||
temps: Record<string, StatsState>;
|
||||
}
|
||||
|
||||
export type UpdateTarget =
|
||||
export type ResourceTarget =
|
||||
| { type: "System", id?: undefined }
|
||||
| { type: "Build", id: string }
|
||||
| { type: "Builder", id: string }
|
||||
| { type: "Deployment", id: string }
|
||||
| { type: "Server", id: string };
|
||||
| { type: "Server", id: string }
|
||||
| { type: "Repo", id: string };
|
||||
|
||||
export enum Operation {
|
||||
None = "None",
|
||||
@@ -468,6 +497,9 @@ export enum Operation {
|
||||
UpdateBuild = "UpdateBuild",
|
||||
DeleteBuild = "DeleteBuild",
|
||||
RunBuild = "RunBuild",
|
||||
CreateBuilder = "CreateBuilder",
|
||||
UpdateBuilder = "UpdateBuilder",
|
||||
DeleteBuilder = "DeleteBuilder",
|
||||
CreateDeployment = "CreateDeployment",
|
||||
UpdateDeployment = "UpdateDeployment",
|
||||
DeleteDeployment = "DeleteDeployment",
|
||||
@@ -475,23 +507,14 @@ export enum Operation {
|
||||
StopContainer = "StopContainer",
|
||||
StartContainer = "StartContainer",
|
||||
RemoveContainer = "RemoveContainer",
|
||||
PullDeployment = "PullDeployment",
|
||||
RecloneDeployment = "RecloneDeployment",
|
||||
RenameDeployment = "RenameDeployment",
|
||||
CreateProcedure = "CreateProcedure",
|
||||
UpdateProcedure = "UpdateProcedure",
|
||||
DeleteProcedure = "DeleteProcedure",
|
||||
CreateCommand = "CreateCommand",
|
||||
UpdateCommand = "UpdateCommand",
|
||||
DeleteCommand = "DeleteCommand",
|
||||
RunCommand = "RunCommand",
|
||||
CreateGroup = "CreateGroup",
|
||||
UpdateGroup = "UpdateGroup",
|
||||
DeleteGroup = "DeleteGroup",
|
||||
ModifyUserEnabled = "ModifyUserEnabled",
|
||||
ModifyUserCreateServerPermissions = "ModifyUserCreateServerPermissions",
|
||||
ModifyUserCreateBuildPermissions = "ModifyUserCreateBuildPermissions",
|
||||
ModifyUserPermissions = "ModifyUserPermissions",
|
||||
CreateRepo = "CreateRepo",
|
||||
UpdateRepo = "UpdateRepo",
|
||||
DeleteRepo = "DeleteRepo",
|
||||
CloneRepo = "CloneRepo",
|
||||
PullRepo = "PullRepo",
|
||||
UpdateUserPermissions = "UpdateUserPermissions",
|
||||
UpdateUserPermissionsOnTarget = "UpdateUserPermissionsOnTarget",
|
||||
AutoBuild = "AutoBuild",
|
||||
AutoPull = "AutoPull",
|
||||
}
|
||||
@@ -513,8 +536,8 @@ export enum UpdateStatus {
|
||||
}
|
||||
|
||||
export interface Update {
|
||||
_id?: string;
|
||||
target: UpdateTarget;
|
||||
_id?: MongoId;
|
||||
target: ResourceTarget;
|
||||
operation: Operation;
|
||||
logs: Log[];
|
||||
start_ts: I64;
|
||||
@@ -533,7 +556,7 @@ export interface ApiSecret {
|
||||
}
|
||||
|
||||
export interface User {
|
||||
_id?: string;
|
||||
_id?: MongoId;
|
||||
username: string;
|
||||
enabled?: boolean;
|
||||
admin?: boolean;
|
||||
@@ -544,189 +567,11 @@ export interface User {
|
||||
password?: string;
|
||||
github_id?: string;
|
||||
google_id?: string;
|
||||
last_update_view?: I64;
|
||||
created_at?: I64;
|
||||
updated_at?: I64;
|
||||
}
|
||||
|
||||
export interface GetBuild {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ListBuilds {
|
||||
query?: MongoDocument;
|
||||
}
|
||||
|
||||
export interface CreateBuild {
|
||||
name: string;
|
||||
config: Partial<BuildConfig>;
|
||||
}
|
||||
|
||||
export interface DeleteBuild {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface UpdateBuild {
|
||||
id: string;
|
||||
config: Partial<BuildConfig>;
|
||||
}
|
||||
|
||||
export interface RunBuild {
|
||||
build_id: string;
|
||||
}
|
||||
|
||||
export interface GetDeployment {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ListDeployments {
|
||||
query?: MongoDocument;
|
||||
}
|
||||
|
||||
export interface CreateDeployment {
|
||||
name: string;
|
||||
config: Partial<DeploymentConfig>;
|
||||
}
|
||||
|
||||
export interface DeleteDeployment {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface UpdateDeployment {
|
||||
id: string;
|
||||
config: Partial<DeploymentConfig>;
|
||||
}
|
||||
|
||||
export interface RenameDeployment {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Deploy {
|
||||
deployment_id: string;
|
||||
stop_signal?: TerminationSignal;
|
||||
stop_time?: number;
|
||||
}
|
||||
|
||||
export interface StartContainer {
|
||||
deployment_id: string;
|
||||
}
|
||||
|
||||
export interface StopContainer {
|
||||
deployment_id: string;
|
||||
signal?: TerminationSignal;
|
||||
time?: number;
|
||||
}
|
||||
|
||||
export interface RemoveContainer {
|
||||
deployment_id: string;
|
||||
signal?: TerminationSignal;
|
||||
time?: number;
|
||||
}
|
||||
|
||||
export interface CreateLoginSecret {
|
||||
name: string;
|
||||
expires?: I64;
|
||||
}
|
||||
|
||||
export interface CreateLoginSecretResponse {
|
||||
secret: string;
|
||||
}
|
||||
|
||||
export interface DeleteLoginSecret {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface GetServer {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ListServers {
|
||||
query?: MongoDocument;
|
||||
}
|
||||
|
||||
export interface CreateServer {
|
||||
name: string;
|
||||
config: Partial<ServerConfig>;
|
||||
}
|
||||
|
||||
export interface DeleteServer {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface UpdateServer {
|
||||
id: string;
|
||||
config: Partial<ServerConfig>;
|
||||
}
|
||||
|
||||
export interface RenameServer {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface GetPeripheryVersion {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetPeripheryVersionResponse {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface GetSystemInformation {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetAllSystemStats {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetBasicSystemStats {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetCpuUsage {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetDiskUsage {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetNetworkUsage {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetSystemProcesses {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetSystemComponents {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetDockerNetworks {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface PruneDockerNetworks {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetDockerImages {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface PruneDockerImages {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetDockerContainers {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface PruneDockerContainers {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetLoginOptions {
|
||||
}
|
||||
|
||||
@@ -771,46 +616,380 @@ export interface LoginWithSecretResponse {
|
||||
jwt: string;
|
||||
}
|
||||
|
||||
export type ApiRequest =
|
||||
| { type: "CreateLoginSecret", params: CreateLoginSecret }
|
||||
| { type: "DeleteLoginSecret", params: DeleteLoginSecret }
|
||||
| { type: "GetPeripheryVersion", params: GetPeripheryVersion }
|
||||
| { type: "GetSystemInformation", params: GetSystemInformation }
|
||||
| { type: "GetDockerContainers", params: GetDockerContainers }
|
||||
| { type: "GetDockerImages", params: GetDockerImages }
|
||||
| { type: "GetDockerNetworks", params: GetDockerNetworks }
|
||||
| { type: "GetServer", params: GetServer }
|
||||
| { type: "ListServers", params: ListServers }
|
||||
| { type: "CreateServer", params: CreateServer }
|
||||
| { type: "DeleteServer", params: DeleteServer }
|
||||
| { type: "UpdateServer", params: UpdateServer }
|
||||
| { type: "RenameServer", params: RenameServer }
|
||||
| { type: "GetAllSystemStats", params: GetAllSystemStats }
|
||||
| { type: "GetBasicSystemStats", params: GetBasicSystemStats }
|
||||
| { type: "GetCpuUsage", params: GetCpuUsage }
|
||||
| { type: "GetDiskUsage", params: GetDiskUsage }
|
||||
| { type: "GetNetworkUsage", params: GetNetworkUsage }
|
||||
| { type: "GetSystemProcesses", params: GetSystemProcesses }
|
||||
| { type: "GetSystemComponents", params: GetSystemComponents }
|
||||
| { type: "PruneContainers", params: PruneDockerContainers }
|
||||
| { type: "PruneImages", params: PruneDockerImages }
|
||||
| { type: "PruneNetworks", params: PruneDockerNetworks }
|
||||
| { type: "GetDeployment", params: GetDeployment }
|
||||
| { type: "ListDeployments", params: ListDeployments }
|
||||
| { type: "CreateDeployment", params: CreateDeployment }
|
||||
| { type: "DeleteDeployment", params: DeleteDeployment }
|
||||
| { type: "UpdateDeployment", params: UpdateDeployment }
|
||||
| { type: "RenameDeployment", params: RenameDeployment }
|
||||
| { type: "Deploy", params: Deploy }
|
||||
| { type: "StartContainer", params: StartContainer }
|
||||
| { type: "StopContainer", params: StopContainer }
|
||||
| { type: "RemoveContainer", params: RemoveContainer }
|
||||
| { type: "GetBuild", params: GetBuild }
|
||||
| { type: "ListBuilds", params: ListBuilds }
|
||||
| { type: "CreateBuild", params: CreateBuild }
|
||||
| { type: "DeleteBuild", params: DeleteBuild }
|
||||
| { type: "UpdateBuild", params: UpdateBuild }
|
||||
| { type: "RunBuild", params: RunBuild };
|
||||
export interface RunBuild {
|
||||
build_id: string;
|
||||
}
|
||||
|
||||
export interface Deploy {
|
||||
deployment_id: string;
|
||||
stop_signal?: TerminationSignal;
|
||||
stop_time?: number;
|
||||
}
|
||||
|
||||
export interface StartContainer {
|
||||
deployment_id: string;
|
||||
}
|
||||
|
||||
export interface StopContainer {
|
||||
deployment_id: string;
|
||||
signal?: TerminationSignal;
|
||||
time?: number;
|
||||
}
|
||||
|
||||
export interface RemoveContainer {
|
||||
deployment_id: string;
|
||||
signal?: TerminationSignal;
|
||||
time?: number;
|
||||
}
|
||||
|
||||
export interface CloneRepo {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface PullRepo {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface PruneDockerNetworks {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface PruneDockerImages {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface PruneDockerContainers {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetBuild {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ListBuilds {
|
||||
query?: MongoDocument;
|
||||
}
|
||||
|
||||
export interface BuildListItem {
|
||||
id: string;
|
||||
name: string;
|
||||
last_built_at: I64;
|
||||
version: Version;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
export interface GetBuildActionState {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetBuilder {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ListBuilders {
|
||||
query?: MongoDocument;
|
||||
}
|
||||
|
||||
export interface GetDeployment {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ListDeployments {
|
||||
query?: MongoDocument;
|
||||
}
|
||||
|
||||
export interface DeploymentListItem {
|
||||
id: string;
|
||||
name: string;
|
||||
tags: string[];
|
||||
state: DockerContainerState;
|
||||
status?: string;
|
||||
image: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface GetDeploymentStatus {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetDeploymentStatusResponse {
|
||||
status?: string;
|
||||
state: DockerContainerState;
|
||||
}
|
||||
|
||||
export interface GetLog {
|
||||
deployment_id: string;
|
||||
tail: U64;
|
||||
}
|
||||
|
||||
export interface GetDeployedVersion {
|
||||
deployment_id: string;
|
||||
}
|
||||
|
||||
export interface GetDeployedVersionResponse {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface GetDeploymentStats {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetDeploymentActionState {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetVersion {
|
||||
}
|
||||
|
||||
export interface GetVersionResponse {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface GetRepo {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ListRepos {
|
||||
query?: MongoDocument;
|
||||
}
|
||||
|
||||
export interface RepoListItem {
|
||||
id: string;
|
||||
name: string;
|
||||
last_pulled_at: I64;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
export interface GetRepoActionState {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetServer {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ListServers {
|
||||
query?: MongoDocument;
|
||||
}
|
||||
|
||||
export enum ServerStatus {
|
||||
NotOk = "NotOk",
|
||||
Ok = "Ok",
|
||||
Disabled = "Disabled",
|
||||
}
|
||||
|
||||
export interface ServerListItem {
|
||||
id: string;
|
||||
name: string;
|
||||
status: ServerStatus;
|
||||
}
|
||||
|
||||
export interface GetServerStatus {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetServerStatusResponse {
|
||||
status: ServerStatus;
|
||||
}
|
||||
|
||||
export interface GetServerActionState {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetPeripheryVersion {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetPeripheryVersionResponse {
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface GetSystemInformation {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetAllSystemStats {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetBasicSystemStats {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetCpuUsage {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetDiskUsage {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetNetworkUsage {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetSystemProcesses {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetSystemComponents {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetDockerNetworks {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetDockerImages {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface GetDockerContainers {
|
||||
server_id: string;
|
||||
}
|
||||
|
||||
export interface ListUpdates {
|
||||
query?: MongoDocument;
|
||||
}
|
||||
|
||||
export interface CreateBuild {
|
||||
name: string;
|
||||
config: _PartialBuildConfig;
|
||||
}
|
||||
|
||||
export interface CopyBuild {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface DeleteBuild {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface UpdateBuild {
|
||||
id: string;
|
||||
config: _PartialBuildConfig;
|
||||
}
|
||||
|
||||
export type PartialBuilderConfig =
|
||||
| { type: "AwsBuilder", params: _PartialAwsBuilder };
|
||||
|
||||
export interface CreateBuilder {
|
||||
name: string;
|
||||
config: PartialBuilderConfig;
|
||||
}
|
||||
|
||||
export interface CopyBuilder {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface DeleteBuilder {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface UpdateBuilder {
|
||||
id: string;
|
||||
config: PartialBuilderConfig;
|
||||
}
|
||||
|
||||
export interface CreateDeployment {
|
||||
name: string;
|
||||
config: _PartialDeploymentConfig;
|
||||
}
|
||||
|
||||
export interface CopyDeployment {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface DeleteDeployment {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface UpdateDeployment {
|
||||
id: string;
|
||||
config: _PartialDeploymentConfig;
|
||||
}
|
||||
|
||||
export interface RenameDeployment {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface UpdateUserPermissionsOnTarget {
|
||||
user_id: string;
|
||||
permission: PermissionLevel;
|
||||
target: ResourceTarget;
|
||||
}
|
||||
|
||||
export interface UpdateUserPermissions {
|
||||
user_id: string;
|
||||
enabled?: boolean;
|
||||
create_servers?: boolean;
|
||||
create_builds?: boolean;
|
||||
}
|
||||
|
||||
export interface CreateRepo {
|
||||
name: string;
|
||||
config: _PartialRepoConfig;
|
||||
}
|
||||
|
||||
export interface CopyRepo {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface DeleteRepo {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface UpdateRepo {
|
||||
id: string;
|
||||
config: _PartialRepoConfig;
|
||||
}
|
||||
|
||||
export interface CreateLoginSecret {
|
||||
name: string;
|
||||
expires?: I64;
|
||||
}
|
||||
|
||||
export interface CreateLoginSecretResponse {
|
||||
secret: string;
|
||||
}
|
||||
|
||||
export interface DeleteLoginSecret {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface CreateServer {
|
||||
name: string;
|
||||
config: _PartialServerConfig;
|
||||
}
|
||||
|
||||
export interface DeleteServer {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface UpdateServer {
|
||||
id: string;
|
||||
config: _PartialServerConfig;
|
||||
}
|
||||
|
||||
export interface RenameServer {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface AddTags {
|
||||
target: ResourceTarget;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
export interface RemoveTags {
|
||||
target: ResourceTarget;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
export type AuthRequest =
|
||||
| { type: "GetLoginOptions", params: GetLoginOptions }
|
||||
@@ -819,9 +998,66 @@ export type AuthRequest =
|
||||
| { type: "LoginWithSecret", params: LoginWithSecret }
|
||||
| { type: "ExchangeForJwt", params: ExchangeForJwt };
|
||||
|
||||
export enum ServerStatus {
|
||||
NotOk = "NotOk",
|
||||
Ok = "Ok",
|
||||
Disabled = "Disabled",
|
||||
}
|
||||
export type ExecuteRequest =
|
||||
| { type: "PruneContainers", params: PruneDockerContainers }
|
||||
| { type: "PruneImages", params: PruneDockerImages }
|
||||
| { type: "PruneNetworks", params: PruneDockerNetworks }
|
||||
| { type: "Deploy", params: Deploy }
|
||||
| { type: "StartContainer", params: StartContainer }
|
||||
| { type: "StopContainer", params: StopContainer }
|
||||
| { type: "RemoveContainer", params: RemoveContainer }
|
||||
| { type: "RunBuild", params: RunBuild }
|
||||
| { type: "CloneRepo", params: CloneRepo }
|
||||
| { type: "PullRepo", params: PullRepo };
|
||||
|
||||
export type ReadRequest =
|
||||
| { type: "GetPeripheryVersion", params: GetPeripheryVersion }
|
||||
| { type: "GetSystemInformation", params: GetSystemInformation }
|
||||
| { type: "GetDockerContainers", params: GetDockerContainers }
|
||||
| { type: "GetDockerImages", params: GetDockerImages }
|
||||
| { type: "GetDockerNetworks", params: GetDockerNetworks }
|
||||
| { type: "GetServer", params: GetServer }
|
||||
| { type: "ListServers", params: ListServers }
|
||||
| { type: "GetServerActionState", params: GetServerActionState }
|
||||
| { type: "GetAllSystemStats", params: GetAllSystemStats }
|
||||
| { type: "GetBasicSystemStats", params: GetBasicSystemStats }
|
||||
| { type: "GetCpuUsage", params: GetCpuUsage }
|
||||
| { type: "GetDiskUsage", params: GetDiskUsage }
|
||||
| { type: "GetNetworkUsage", params: GetNetworkUsage }
|
||||
| { type: "GetSystemProcesses", params: GetSystemProcesses }
|
||||
| { type: "GetSystemComponents", params: GetSystemComponents }
|
||||
| { type: "GetDeployment", params: GetDeployment }
|
||||
| { type: "ListDeployments", params: ListDeployments }
|
||||
| { type: "GetDeploymentActionState", params: GetDeploymentActionState }
|
||||
| { type: "GetBuild", params: GetBuild }
|
||||
| { type: "ListBuilds", params: ListBuilds }
|
||||
| { type: "GetBuildActionState", params: GetBuildActionState }
|
||||
| { type: "GetBuilder", params: GetBuilder }
|
||||
| { type: "ListBuilders", params: ListBuilders }
|
||||
| { type: "GetRepo", params: GetRepo }
|
||||
| { type: "ListRepos", params: ListRepos }
|
||||
| { type: "GetRepoActionState", params: GetRepoActionState };
|
||||
|
||||
export type WriteRequest =
|
||||
| { type: "CreateLoginSecret", params: CreateLoginSecret }
|
||||
| { type: "DeleteLoginSecret", params: DeleteLoginSecret }
|
||||
| { type: "UpdateUserPerimissions", params: UpdateUserPermissions }
|
||||
| { type: "UpdateUserPermissionsOnTarget", params: UpdateUserPermissionsOnTarget }
|
||||
| { type: "CreateServer", params: CreateServer }
|
||||
| { type: "DeleteServer", params: DeleteServer }
|
||||
| { type: "UpdateServer", params: UpdateServer }
|
||||
| { type: "RenameServer", params: RenameServer }
|
||||
| { type: "CreateDeployment", params: CreateDeployment }
|
||||
| { type: "DeleteDeployment", params: DeleteDeployment }
|
||||
| { type: "UpdateDeployment", params: UpdateDeployment }
|
||||
| { type: "RenameDeployment", params: RenameDeployment }
|
||||
| { type: "CreateBuild", params: CreateBuild }
|
||||
| { type: "DeleteBuild", params: DeleteBuild }
|
||||
| { type: "UpdateBuild", params: UpdateBuild }
|
||||
| { type: "CreateBuilder", params: CreateBuilder }
|
||||
| { type: "DeleteBuilder", params: DeleteBuilder }
|
||||
| { type: "UpdateBuilder", params: UpdateBuilder }
|
||||
| { type: "CreateRepo", params: CreateRepo }
|
||||
| { type: "UpdateRepo", params: UpdateRepo }
|
||||
| { type: "DeleteRepo", params: DeleteRepo };
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ use crate::{i64_is_zero, MongoId, I64};
|
||||
|
||||
use super::PermissionsMap;
|
||||
|
||||
#[typeshare(serialized_as = "Partial<BuilderConfig>")]
|
||||
pub type _PartialBuilderConfig = PartialBuilderConfig;
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Builder, MungosIndexed)]
|
||||
pub struct Builder {
|
||||
@@ -53,12 +56,15 @@ pub enum BuilderConfig {
|
||||
AwsBuilder(AwsBuilder),
|
||||
}
|
||||
|
||||
#[typeshare(serialized_as = "Partial<AwsBuilder>")]
|
||||
pub type _PartialAwsBuilder = PartialAwsBuilder;
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, MungosIndexed, EnumVariants)]
|
||||
#[variant_derive(Serialize, Deserialize, Debug, Clone, Copy, Display, EnumString)]
|
||||
#[serde(tag = "type", content = "params")]
|
||||
pub enum PartialBuilderConfig {
|
||||
AwsBuilder(PartialAwsBuilder),
|
||||
AwsBuilder(_PartialAwsBuilder),
|
||||
}
|
||||
|
||||
impl From<PartialBuilderConfig> for BuilderConfig {
|
||||
|
||||
@@ -3,6 +3,7 @@ use entities::{
|
||||
build::{Build, BuildConfig},
|
||||
update::Log,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
|
||||
pub mod busy;
|
||||
@@ -12,10 +13,19 @@ pub mod requests;
|
||||
|
||||
#[typeshare(serialized_as = "number")]
|
||||
pub type I64 = i64;
|
||||
#[typeshare(serialized_as = "{ $oid: string }")]
|
||||
pub type MongoId = String;
|
||||
#[typeshare(serialized_as = "number")]
|
||||
pub type U64 = u64;
|
||||
#[typeshare(serialized_as = "any")]
|
||||
pub type MongoDocument = mungos::mongodb::bson::Document;
|
||||
#[typeshare(serialized_as = "MongoIdObj")]
|
||||
pub type MongoId = String;
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct MongoIdObj {
|
||||
#[serde(rename = "$oid")]
|
||||
pub oid: String,
|
||||
}
|
||||
|
||||
fn i64_is_zero(n: &I64) -> bool {
|
||||
*n == 0
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{
|
||||
deployment::{Deployment, DeploymentActionState, DockerContainerStats, DockerContainerState},
|
||||
update::Log,
|
||||
},
|
||||
MongoDocument,
|
||||
MongoDocument, U64,
|
||||
};
|
||||
|
||||
//
|
||||
@@ -64,7 +64,7 @@ pub struct GetDeploymentStatusResponse {
|
||||
pub struct GetLog {
|
||||
pub deployment_id: String,
|
||||
#[serde(default = "default_tail")]
|
||||
pub tail: u64,
|
||||
pub tail: U64,
|
||||
}
|
||||
|
||||
fn default_tail() -> u64 {
|
||||
|
||||
@@ -7,12 +7,14 @@ mod builder;
|
||||
mod deployment;
|
||||
mod repo;
|
||||
mod server;
|
||||
mod update;
|
||||
|
||||
pub use build::*;
|
||||
pub use builder::*;
|
||||
pub use deployment::*;
|
||||
pub use repo::*;
|
||||
pub use server::*;
|
||||
pub use update::*;
|
||||
|
||||
//
|
||||
|
||||
|
||||
12
lib/types/src/requests/read/update.rs
Normal file
12
lib/types/src/requests/read/update.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use resolver_api::derive::Request;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use typeshare::typeshare;
|
||||
|
||||
use crate::{entities::update::Update, MongoDocument};
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
|
||||
#[response(Vec<Update>)]
|
||||
pub struct ListUpdates {
|
||||
pub query: Option<MongoDocument>,
|
||||
}
|
||||
@@ -4,12 +4,17 @@ use typeshare::typeshare;
|
||||
|
||||
use crate::entities::build::{Build, PartialBuildConfig};
|
||||
|
||||
#[typeshare(serialized_as = "Partial<BuildConfig>")]
|
||||
type _PartialBuildConfig = PartialBuildConfig;
|
||||
|
||||
//
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
|
||||
#[response(Build)]
|
||||
pub struct CreateBuild {
|
||||
pub name: String,
|
||||
pub config: PartialBuildConfig,
|
||||
pub config: _PartialBuildConfig,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -38,5 +43,5 @@ pub struct DeleteBuild {
|
||||
#[response(Build)]
|
||||
pub struct UpdateBuild {
|
||||
pub id: String,
|
||||
pub config: PartialBuildConfig,
|
||||
pub config: _PartialBuildConfig,
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ use crate::entities::{
|
||||
update::Update,
|
||||
};
|
||||
|
||||
#[typeshare(serialized_as = "Partial<DeploymentConfig>")]
|
||||
type _PartialDeploymentConfig = PartialDeploymentConfig;
|
||||
|
||||
//
|
||||
|
||||
#[typeshare]
|
||||
@@ -14,7 +17,7 @@ use crate::entities::{
|
||||
#[response(Deployment)]
|
||||
pub struct CreateDeployment {
|
||||
pub name: String,
|
||||
pub config: PartialDeploymentConfig,
|
||||
pub config: _PartialDeploymentConfig,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -43,7 +46,7 @@ pub struct DeleteDeployment {
|
||||
#[response(Deployment)]
|
||||
pub struct UpdateDeployment {
|
||||
pub id: String,
|
||||
pub config: PartialDeploymentConfig,
|
||||
pub config: _PartialDeploymentConfig,
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -4,6 +4,9 @@ use typeshare::typeshare;
|
||||
|
||||
use crate::entities::repo::{PartialRepoConfig, Repo};
|
||||
|
||||
#[typeshare(serialized_as = "Partial<RepoConfig>")]
|
||||
type _PartialRepoConfig = PartialRepoConfig;
|
||||
|
||||
//
|
||||
|
||||
#[typeshare]
|
||||
@@ -11,7 +14,7 @@ use crate::entities::repo::{PartialRepoConfig, Repo};
|
||||
#[response(Repo)]
|
||||
pub struct CreateRepo {
|
||||
pub name: String,
|
||||
pub config: PartialRepoConfig,
|
||||
pub config: _PartialRepoConfig,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -40,5 +43,5 @@ pub struct DeleteRepo {
|
||||
#[response(Repo)]
|
||||
pub struct UpdateRepo {
|
||||
pub id: String,
|
||||
pub config: PartialRepoConfig,
|
||||
pub config: _PartialRepoConfig,
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ use crate::entities::{
|
||||
update::Update,
|
||||
};
|
||||
|
||||
#[typeshare(serialized_as = "Partial<ServerConfig>")]
|
||||
type _PartialServerConfig = PartialServerConfig;
|
||||
|
||||
//
|
||||
|
||||
#[typeshare]
|
||||
@@ -14,7 +17,7 @@ use crate::entities::{
|
||||
#[response(Server)]
|
||||
pub struct CreateServer {
|
||||
pub name: String,
|
||||
pub config: PartialServerConfig,
|
||||
pub config: _PartialServerConfig,
|
||||
}
|
||||
|
||||
//
|
||||
@@ -33,7 +36,7 @@ pub struct DeleteServer {
|
||||
#[response(Server)]
|
||||
pub struct UpdateServer {
|
||||
pub id: String,
|
||||
pub config: PartialServerConfig,
|
||||
pub config: _PartialServerConfig,
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user