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