@@ -3,4 +3,14 @@ import * as common from './common'
|
||||
export declare namespace service {
|
||||
export interface ListOpts extends common.query.FilterOpt {
|
||||
}
|
||||
export interface LogsOpts {
|
||||
details?: boolean;
|
||||
follow?: boolean;
|
||||
stdout?: boolean;
|
||||
stderr?: boolean;
|
||||
since?: number;
|
||||
until?: number;
|
||||
timestamps?: boolean;
|
||||
tail?: number | "all";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as api from '../utils/api';
|
||||
import * as opts from '../api/opts';
|
||||
import * as types from '../api/types';
|
||||
import * as http from 'http'
|
||||
|
||||
export namespace service {
|
||||
export async function list(filters?: opts.service.ListOpts) {
|
||||
@@ -15,4 +16,14 @@ export namespace service {
|
||||
export async function update(id: string, query: { version: number, registryAuthFrom?: string, rollback?: string }, data: any) {
|
||||
return await api.post<any>(api.getUri(`/services/${id}/update`, query), data)
|
||||
}
|
||||
export async function logs(id: string, opts: opts.service.LogsOpts = {}): Promise<http.ServerResponse> {
|
||||
let data = {
|
||||
follow: true,
|
||||
stdout: true,
|
||||
stderr: true,
|
||||
tail: 10,
|
||||
...opts
|
||||
}
|
||||
return await api.stream(`/services/${id}/logs`, data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user