1 | import { IKubernetesClientConfig } from "./config";
|
2 | import { Selector } from "./label";
|
3 | import { MetadataObject } from "./types/meta";
|
4 | import { DeleteOptions, WatchEvent } from "./types/meta/v1";
|
5 | export declare type RequestMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
6 | export declare type SelectorOptions = {
|
7 | labelSelector?: Selector;
|
8 | fieldSelector?: Selector;
|
9 | };
|
10 | export declare type MandatorySelectorOptions = {
|
11 | labelSelector: Selector;
|
12 | } | {
|
13 | fieldSelector: Selector;
|
14 | };
|
15 | export declare type WatchOptions = SelectorOptions & {
|
16 | resourceVersion?: number;
|
17 | abortAfterErrorCount?: number;
|
18 | resyncAfterIterations?: number;
|
19 | onError?: (err: any) => void;
|
20 | onEstablished?: () => void;
|
21 | pingIntervalSeconds?: number;
|
22 | };
|
23 | export declare type ListOptions = SelectorOptions;
|
24 | export interface WatchResult {
|
25 | resourceVersion: number;
|
26 | resyncRequired?: boolean;
|
27 | }
|
28 | export declare const patchKindStrategicMergePatch = "application/stategic-merge-patch+json";
|
29 | export declare const patchKindMergePatch = "application/merge-patch+json";
|
30 | export declare const patchKindJSONPatch = "application/json-patch+json";
|
31 | export declare type PatchKind = typeof patchKindStrategicMergePatch | typeof patchKindMergePatch | typeof patchKindJSONPatch;
|
32 | export interface IKubernetesRESTClient {
|
33 | post<R = any>(url: string, body: any): Promise<R>;
|
34 | put<R = any>(url: string, body: any): Promise<R>;
|
35 | patch<R = any>(url: string, body: any, patchKind: PatchKind): Promise<R>;
|
36 | delete<R = any>(url: string, opts?: DeleteOptions, queryParams?: {
|
37 | [k: string]: string;
|
38 | }, body?: any): Promise<R>;
|
39 | get<R = any>(url: string, opts?: ListOptions): Promise<R | undefined>;
|
40 | watch<R extends MetadataObject = MetadataObject>(url: string, onUpdate: (o: WatchEvent<R>) => any, onError: (err: any) => any, opts?: WatchOptions): Promise<WatchResult>;
|
41 | }
|
42 | export declare class KubernetesRESTClient implements IKubernetesRESTClient {
|
43 | private config;
|
44 | constructor(config: IKubernetesClientConfig);
|
45 | private request;
|
46 | post<R = any>(url: string, body: any): Promise<R>;
|
47 | put<R = any>(url: string, body: any): Promise<R>;
|
48 | patch<R = any>(url: string, body: any, patchKind: PatchKind): Promise<R>;
|
49 | delete<R = any>(url: string, deleteOptions?: ListOptions, queryParams?: {
|
50 | [k: string]: string;
|
51 | }, body?: any): Promise<R>;
|
52 | watch<R extends MetadataObject = MetadataObject>(url: string, onUpdate: (o: WatchEvent<R>) => any, onError: (err: any) => any, watchOpts?: WatchOptions): Promise<WatchResult>;
|
53 | get<R = any>(url: string, listOptions?: ListOptions): Promise<R | undefined>;
|
54 | }
|
55 |
|
\ | No newline at end of file |