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 | };
|
21 | export declare type ListOptions = SelectorOptions;
|
22 | export interface WatchResult {
|
23 | resourceVersion: number;
|
24 | resyncRequired?: boolean;
|
25 | }
|
26 | export declare const patchKindStrategicMergePatch = "application/stategic-merge-patch+json";
|
27 | export declare const patchKindMergePatch = "application/merge-patch+json";
|
28 | export declare const patchKindJSONPatch = "application/json-patch+json";
|
29 | export declare type PatchKind = typeof patchKindStrategicMergePatch | typeof patchKindMergePatch | typeof patchKindJSONPatch;
|
30 | export interface IKubernetesRESTClient {
|
31 | post<R = any>(url: string, body: any): Promise<R>;
|
32 | put<R = any>(url: string, body: any): Promise<R>;
|
33 | patch<R = any>(url: string, body: any, patchKind: PatchKind): Promise<R>;
|
34 | delete<R = any>(url: string, opts?: DeleteOptions, queryParams?: {
|
35 | [k: string]: string;
|
36 | }, body?: any): Promise<R>;
|
37 | get<R = any>(url: string, opts?: ListOptions): Promise<R | undefined>;
|
38 | watch<R extends MetadataObject = MetadataObject>(url: string, onUpdate: (o: WatchEvent<R>) => any, onError: (err: any) => any, opts?: WatchOptions): Promise<WatchResult>;
|
39 | }
|
40 | export declare class KubernetesRESTClient implements IKubernetesRESTClient {
|
41 | private config;
|
42 | constructor(config: IKubernetesClientConfig);
|
43 | private request;
|
44 | post<R = any>(url: string, body: any): Promise<R>;
|
45 | put<R = any>(url: string, body: any): Promise<R>;
|
46 | patch<R = any>(url: string, body: any, patchKind: PatchKind): Promise<R>;
|
47 | delete<R = any>(url: string, deleteOptions?: ListOptions, queryParams?: {
|
48 | [k: string]: string;
|
49 | }, body?: any): Promise<R>;
|
50 | watch<R extends MetadataObject = MetadataObject>(url: string, onUpdate: (o: WatchEvent<R>) => any, onError: (err: any) => any, watchOpts?: WatchOptions): Promise<WatchResult>;
|
51 | get<R = any>(url: string, listOptions?: ListOptions): Promise<R | undefined>;
|
52 | }
|
53 |
|
\ | No newline at end of file |