-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export type { | ||
Dashboard, | ||
DashboardMetric, | ||
GetDashboardMetricRes, | ||
ListDashboardMetricsRes, | ||
ListDashboardsQueryParams, | ||
ListDashboardsRes, | ||
} from './spec/model/dashboard.js'; | ||
export { | ||
type ListRunnablesQueryParams, | ||
type ListRunnablesRes, | ||
type Runnable, | ||
type RunnableMetric, | ||
type RunnableOperationRes, | ||
type RunnableSSH, | ||
type RunnableScope, | ||
type RunnableScopes, | ||
RunnableStatus, | ||
} from './spec/model/runnable.js'; | ||
export type { ErrorRes } from './spec/schema/error.js'; | ||
export type { ListQueryParams, ListRes } from './spec/schema/list.js'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { ListQueryParams, ListRes } from '../schema/list.js'; | ||
/** | ||
* A collection of metrics | ||
*/ | ||
export interface Dashboard { | ||
id: string; | ||
metrics: DashboardMetric[] | null; | ||
name: string; | ||
} | ||
export interface DashboardMetric { | ||
id: string; | ||
/** | ||
* Unlike `RunnableMetric`, this label can be longer to fit your needs | ||
*/ | ||
label: string | null; | ||
/** | ||
* Try to keep it short to have a great and more readable display (i.e. "MB", "%", "GB/s") | ||
*/ | ||
unit: string | null; | ||
/** | ||
* Format it so it's displayed correctly in the app. | ||
* If it's a percentage, unlike ratio, put directly the actual value (i.e. 25 and not 0.25) | ||
*/ | ||
value: number | null; | ||
} | ||
export type GetDashboardMetricRes = DashboardMetric; | ||
export interface ListDashboardsQueryParams extends ListQueryParams { | ||
/** | ||
* Filter on one or multiple properties. It's up to you to implement the filtering that you want. It can be as simple as equality check on one specific field (e.g. `name`). It can also be a partial check (e.g. `ILIKE` pattern) on multiple fields. | ||
*/ | ||
q?: string; | ||
} | ||
export type ListDashboardsRes = ListRes<Dashboard>; | ||
export type ListDashboardMetricsRes = ListRes<DashboardMetric>; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import type { ListQueryParams, ListRes } from '../schema/list.js'; | ||
export interface ListRunnablesQueryParams extends ListQueryParams { | ||
/** | ||
* Filter on one or multiple properties. It's up to you to implement the filtering that you want. It can be as simple as equality check on one specific field (e.g. `name`). It can also be a partial check (e.g. `ILIKE` pattern) on multiple fields. | ||
*/ | ||
q?: string; | ||
} | ||
export type ListRunnablesRes = ListRes<Runnable>; | ||
/** | ||
* A metric associated to a runnable | ||
*/ | ||
export interface RunnableMetric { | ||
/** | ||
* Try to keep it short to have a great and more readable display in the app (i.e. "CPU", "RAM", "Proc #") | ||
*/ | ||
label: string | null; | ||
/** | ||
* The ratio of the value compared to its maximum. | ||
* For example, if you have 1024 of RAM and 256 are being used, the ratio should be 256 / 1024 = 0.25 | ||
* @maximum 1.0 | ||
* @minimum 0.0 | ||
*/ | ||
ratio: number | null; | ||
/** | ||
* If provided, it must be an array of two numbers. | ||
* They respectively define the limits for "warning" and "danger". | ||
* To illustrate with CPU usage, these values could be [60, 80]. | ||
* In this case, if value < 60, it will be "success". | ||
* If value < 80 it will be "warning". | ||
* Everything else will be "danger". | ||
* If the first value is greater than the second one (i.e. higher is better), the semantics are reversed. | ||
* @maxItems 2 | ||
* @minItems 2 | ||
*/ | ||
thresholds: number[] | null; | ||
/** | ||
* Like for the label, try to keep it short to have a great and more readable display (i.e. "MB", "%", "GB/s") | ||
*/ | ||
unit: string | null; | ||
/** | ||
* Format it so it's displayed correctly in the app. | ||
* If it's a percentage, unlike ratio, put directly the actual value (i.e. 25 and not 0.25) | ||
*/ | ||
value: number | null; | ||
} | ||
/** | ||
* The status of a runnable | ||
* Any intermediary status that you have on your side must be mapped to the `pending` status. | ||
*/ | ||
export declare enum RunnableStatus { | ||
OFF = 'off', | ||
ON = 'on', | ||
PENDING = 'pending', | ||
UNKNOWN = 'unknown', | ||
} | ||
/** | ||
* The context in which a runnable is | ||
* It can be `geo`, defining the geographical zone where the runnable is (e.g. AWS regions code). | ||
* It can also be `logical`, defining an abstract structure where the runnable is (e.g. GCP project). | ||
*/ | ||
export interface RunnableScope { | ||
label: string; | ||
value: string; | ||
} | ||
/** | ||
* The configuration to define how to SSH into the runnable | ||
*/ | ||
export interface RunnableSSH { | ||
keyName: string | null; | ||
/** | ||
* @isInt | ||
* @minimum 0 | ||
*/ | ||
port: number; | ||
username: string; | ||
} | ||
/** | ||
* The scopes in which the runnable is | ||
*/ | ||
export interface RunnableScopes { | ||
geo: RunnableScope | null; | ||
logical: RunnableScope | null; | ||
} | ||
/** | ||
* Anything that runs, can be stopped and rebooted | ||
* Typical examples are cloud VMs, containers, PaaS applications, etc. | ||
*/ | ||
export interface Runnable { | ||
flavor: string | null; | ||
fqdn: string | null; | ||
id: string; | ||
ipv4: string | null; | ||
metrics: RunnableMetric[] | null; | ||
name: string; | ||
scopes: RunnableScopes; | ||
ssh: RunnableSSH | null; | ||
stack: string | null; | ||
status: RunnableStatus; | ||
} | ||
/** | ||
* The response of a reboot, stop operation | ||
*/ | ||
export interface RunnableOperationRes { | ||
/** | ||
* If the operation is triggered via an asynchronous queue and will eventually succeed, the id can be provided here for information | ||
*/ | ||
jobId: string | null; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface ErrorRes { | ||
/** | ||
* Provided in english in a human readable way | ||
*/ | ||
message: string; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export interface ListQueryParams { | ||
/** | ||
* Max number of items to return in the response. Set a reasonable default value (e.g. `50`) in your implementation. Avoid returning too many items at once for client performance reasons. | ||
* @isInt | ||
* @minimum 0 | ||
*/ | ||
limit?: number; | ||
/** | ||
* Cursor from where to start fetching when paginating. The default value should be `0`. | ||
* @isInt | ||
* @minimum 0 | ||
*/ | ||
offset?: number; | ||
} | ||
export interface ListRes<T extends {}> { | ||
items: T[]; | ||
/** | ||
* @isInt | ||
* @minimum 0 | ||
*/ | ||
total: number; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export type { | ||
Dashboard, | ||
DashboardMetric, | ||
GetDashboardMetricRes, | ||
ListDashboardMetricsRes, | ||
ListDashboardsQueryParams, | ||
ListDashboardsRes, | ||
} from './spec/model/dashboard.js'; | ||
export { | ||
type ListRunnablesQueryParams, | ||
type ListRunnablesRes, | ||
type Runnable, | ||
type RunnableMetric, | ||
type RunnableOperationRes, | ||
type RunnableSSH, | ||
type RunnableScope, | ||
type RunnableScopes, | ||
RunnableStatus, | ||
} from './spec/model/runnable.js'; | ||
|
||
export type { ErrorRes } from './spec/schema/error.js'; | ||
export type { ListQueryParams, ListRes } from './spec/schema/list.js'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": false, | ||
"outDir": "./dist" | ||
}, | ||
"include": ["index.ts"] | ||
} |