1 | import { IKubernetesRESTClient, ListOptions, MandatorySelectorOptions, WatchOptions, WatchResult } from "./client";
|
2 | import { APIObject, MetadataObject } from "./types/meta";
|
3 | import { DeleteOptions, WatchEvent } from "./types/meta/v1";
|
4 | import { WatchHandle } from "./watch";
|
5 | import { Registry } from "prom-client";
|
6 | import { JSONPatch, JSONPatchElement, RecursivePartial } from "./api_patch";
|
7 | export interface ListWatchOptions<R extends MetadataObject> extends WatchOptions {
|
8 | onResync?: (objs: R[]) => any;
|
9 | skipAddEventsOnResync?: boolean;
|
10 | }
|
11 | export interface IResourceClient<R extends MetadataObject, K, V, O extends R = R> {
|
12 | list(listOptions?: ListOptions): Promise<Array<APIObject<K, V> & O>>;
|
13 | get(name: string): Promise<(APIObject<K, V> & O) | undefined>;
|
14 | apply(resource: R): Promise<APIObject<K, V> & O>;
|
15 | put(resource: R): Promise<APIObject<K, V> & O>;
|
16 | post(resource: R): Promise<APIObject<K, V> & O>;
|
17 | patchStrategic(resourceOrName: R | string, patch: RecursivePartial<R>): Promise<APIObject<K, V> & O>;
|
18 | patchMerge(resourceOrName: R | string, patch: RecursivePartial<R>): Promise<APIObject<K, V> & O>;
|
19 | patchJSON(resourceOrName: R | string, patch: JSONPatch): Promise<R>;
|
20 | delete(resourceOrName: R | string, deleteOptions?: DeleteOptions): Promise<void>;
|
21 | deleteMany(opts: MandatorySelectorOptions & DeleteOptions): Promise<void>;
|
22 | watch(handler: (event: WatchEvent<O>) => any, errorHandler?: (error: any) => any, opts?: WatchOptions): Promise<WatchResult>;
|
23 | listWatch(handler: (event: WatchEvent<O>) => any, errorHandler?: (error: any) => any, opts?: ListWatchOptions<O>): WatchHandle;
|
24 | }
|
25 | export interface INamespacedResourceClient<R extends MetadataObject, K, V, O extends R = R> extends IResourceClient<R, K, V, O> {
|
26 | namespace(ns: string): INamespacedResourceClient<R, K, V, O>;
|
27 | allNamespaces(): INamespacedResourceClient<R, K, V, O>;
|
28 | }
|
29 | export declare class CustomResourceClient<R extends MetadataObject, K, V, O extends R = R> implements INamespacedResourceClient<R, K, V, O> {
|
30 | private inner;
|
31 | private kind;
|
32 | private apiVersion;
|
33 | constructor(inner: INamespacedResourceClient<R, K, V, O>, kind: K, apiVersion: V);
|
34 | list(listOptions?: ListOptions): Promise<Array<APIObject<K, V> & O>>;
|
35 | get(name: string): Promise<(APIObject<K, V> & O) | undefined>;
|
36 | apply(resource: R): Promise<APIObject<K, V> & O>;
|
37 | put(resource: R): Promise<APIObject<K, V> & O>;
|
38 | post(resource: R): Promise<APIObject<K, V> & O>;
|
39 | delete(resourceOrName: string | R, deleteOptions?: DeleteOptions): Promise<void>;
|
40 | deleteMany(opts: MandatorySelectorOptions & DeleteOptions): Promise<void>;
|
41 | watch(handler: (event: WatchEvent<O>) => any, errorHandler?: (error: any) => any, opts?: WatchOptions): Promise<WatchResult>;
|
42 | listWatch(handler: (event: WatchEvent<O>) => any, errorHandler?: (error: any) => any, opts?: ListWatchOptions<O>): WatchHandle;
|
43 | patchJSON(resourceOrName: string | R, patch: JSONPatchElement[]): Promise<R>;
|
44 | patchStrategic(resourceOrName: string | R, patch: RecursivePartial<R>): Promise<APIObject<K, V> & O>;
|
45 | patchMerge(resourceOrName: string | R, patch: RecursivePartial<R>): Promise<APIObject<K, V> & O>;
|
46 | namespace(ns: string): INamespacedResourceClient<R, K, V, O>;
|
47 | allNamespaces(): INamespacedResourceClient<R, K, V, O>;
|
48 | }
|
49 | export declare class ResourceClient<R extends MetadataObject, K, V, O extends R = R> implements IResourceClient<R, K, V, O> {
|
50 | protected client: IKubernetesRESTClient;
|
51 | protected apiBaseURL: string;
|
52 | protected resourceBaseURL: string;
|
53 | private static watchResyncErrorCount;
|
54 | private static watchOpenCount;
|
55 | protected baseURL: string;
|
56 | supportsCollectionDeletion: boolean;
|
57 | constructor(client: IKubernetesRESTClient, apiBaseURL: string, resourceBaseURL: string, registry: Registry);
|
58 | protected urlForResource(r: R): string;
|
59 | protected urlForResourceOrName(r: R | string): string;
|
60 | list(opts?: ListOptions): Promise<Array<APIObject<K, V> & O>>;
|
61 | get(name: string): Promise<(APIObject<K, V> & O) | undefined>;
|
62 | watch(handler: (event: WatchEvent<O>) => any, errorHandler?: (error: any) => any, opts?: WatchOptions): Promise<WatchResult>;
|
63 | listWatch(handler: (event: WatchEvent<O>) => any, errorHandler?: (error: any) => any, opts?: ListWatchOptions<O>): WatchHandle;
|
64 | apply(resource: R): Promise<APIObject<K, V> & O>;
|
65 | put(resource: R): Promise<APIObject<K, V> & O>;
|
66 | post(resource: R): Promise<APIObject<K, V> & O>;
|
67 | patchStrategic(resourceOrName: R | string, patch: RecursivePartial<R>): Promise<APIObject<K, V> & O>;
|
68 | patchMerge(resourceOrName: R | string, patch: RecursivePartial<R>): Promise<APIObject<K, V> & O>;
|
69 | patchJSON(resourceOrName: R | string, patch: JSONPatch): Promise<APIObject<K, V> & O>;
|
70 | delete(resourceOrName: R | string, deleteOptions?: DeleteOptions): Promise<void>;
|
71 | deleteMany(opts: MandatorySelectorOptions & DeleteOptions): Promise<any>;
|
72 | }
|
73 | export declare class NamespacedResourceClient<R extends MetadataObject, K, V, O extends R = R> extends ResourceClient<R, K, V, O> implements INamespacedResourceClient<R, K, V, O> {
|
74 | private registry;
|
75 | private ns?;
|
76 | constructor(client: IKubernetesRESTClient, apiBaseURL: string, resourceBaseURL: string, registry: Registry, ns?: string);
|
77 | protected urlForResource(r: R): string;
|
78 | namespace(ns: string): INamespacedResourceClient<R, K, V, O>;
|
79 | allNamespaces(): INamespacedResourceClient<R, K, V, O>;
|
80 | post(resource: R): Promise<any>;
|
81 | }
|