Init: Create & Init dayu Project...

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-07-03 15:50:59 +08:00
commit c47137ec4a
92 changed files with 2793 additions and 0 deletions

26
packages/faas/src/api.ts Normal file
View File

@@ -0,0 +1,26 @@
import * as faas from './interfaces'
import axios, { AxiosRequestConfig } from 'axios'
const instanceConfig: AxiosRequestConfig = {
baseURL: 'https://faas.yumc.pw',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic YWRtaW46MmQ2MzdiYzQ4MWQxYThhMjg2M2E2ZTIzOTY1ZWRlNDI0ZTRjMTk2OTQyMzU5N2M5MzRlNGQyY2FlZTNkMjk2OA=='
},
timeout: 5000
}
let api = axios.create(instanceConfig)
async function get<T>(path: string) {
let result = await api.get(path);
return result.data as T;
}
export async function getFunctions() {
return await get<faas.Function[]>('/system/functions');
}
export async function getFunction(name: string) {
return await get<faas.Function>(`/system/function/${name}`);
}

View File

@@ -0,0 +1 @@
export * from './api'

View File

@@ -0,0 +1,13 @@
export interface Labels {
[key: string]: string
}
export interface Function {
name: string;
image: string;
invocationCount: number;
replicas: number;
envProcess: string;
availableReplicas: number;
labels: Labels;
annotations?: any;
}