/// <reference types="node" />
import * as k8s from "@kubernetes/client-node";
import * as http from "http";
import * as request from "request";
/** Response from methods that operate on an resource. */
export interface K8sObjectResponse {
    body: k8s.KubernetesObject;
    response: http.IncomingMessage;
}
/** Response from list method. */
export interface K8sListResponse {
    body: k8s.KubernetesListObject<k8s.KubernetesObject>;
    response: http.IncomingMessage;
}
/** Response from delete method. */
export interface K8sDeleteResponse {
    body: k8s.V1Status;
    response: http.IncomingMessage;
}
/** Response from list API method. */
export interface K8sApiResponse {
    body: k8s.V1APIResourceList;
    response: http.IncomingMessage;
}
/** Kubernetes API verbs. */
export declare type K8sApiAction = "create" | "delete" | "list" | "patch" | "read" | "replace";
/** Type of option argument for object API requests. */
export interface K8sObjectRequestOptions {
    headers: {
        [name: string]: string;
    };
}
/**
 * Valid Content-Type header values for patch operations.  See
 * https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/
 * for details.
 */
export declare enum K8sPatchStrategies {
    /** Diff-like JSON format. */
    JsonPatch = "application/json-patch+json",
    /** Simple merge. */
    MergePatch = "application/merge-patch+json",
    /** Merge with different strategies depending on field metadata. */
    StrategicMergePatch = "application/strategic-merge-patch+json"
}
/**
 * Dynamically construct Kubernetes API request URIs so client does
 * not have to know what type of object it is acting on, create the
 * appropriate client, and call the appropriate method.
 */
export declare class K8sObjectApi extends k8s.ApisApi {
    private static readonly defaultDeleteBody;
    /**
     * Read any Kubernetes resource.
     */
    create(spec: k8s.KubernetesObject, options?: K8sObjectRequestOptions): Promise<K8sObjectResponse>;
    /**
     * Delete any Kubernetes resource.
     */
    delete(spec: k8s.KubernetesObject, body?: k8s.V1DeleteOptions, options?: K8sObjectRequestOptions): Promise<K8sDeleteResponse>;
    /**
     * List any Kubernetes resource.
     */
    list(spec: k8s.KubernetesObject, options?: K8sObjectRequestOptions): Promise<K8sListResponse>;
    /**
     * Patch any Kubernetes resource.
     */
    patch(spec: k8s.KubernetesObject, options?: K8sObjectRequestOptions): Promise<K8sObjectResponse>;
    /**
     * Read any Kubernetes resource.
     */
    read(spec: k8s.KubernetesObject, options?: K8sObjectRequestOptions): Promise<K8sObjectResponse>;
    /**
     * Replace any Kubernetes resource.
     */
    replace(spec: k8s.KubernetesObject, options?: K8sObjectRequestOptions): Promise<K8sObjectResponse>;
    /**
     * Get metadata from Kubernetes API for resources described by
     * `kind` and `apiVersion`.  If it is unable to find the resource
     * `kind` under the provided `apiVersion`, `undefined` is
     * returned.
     */
    resource(apiVersion: string, kind: string): Promise<k8s.V1APIResource | undefined>;
    /**
     * Generate request options.  Largely copied from the common
     * elements of @kubernetes/client-node action methods.
     */
    baseRequestOptions(method?: string, options?: K8sObjectRequestOptions): request.UriOptions & request.CoreOptions;
    /**
     * Use spec information to construct resource URI path.  If any
     * required information in not provided, an Error is thrown.  If an
     * `apiVersion` is not provided, "v1" is used.  If a `metadata.namespace`
     * is not provided for a request that requires one, "default" is used.
     *
     * @param spec resource spec which must kind and apiVersion properties
     * @param action API action, see [[K8sApiAction]]
     * @return tail of resource-specific URI
     */
    specUriPath(spec: k8s.KubernetesObject, action: K8sApiAction): Promise<string>;
    /**
     * Wrap request in a Promise.  Largely copied from @kubernetes/client-node/dist/api.js.
     */
    private requestPromise;
    /**
     * Return default headers based on action.
     */
    private static methodHeaders;
}
/**
 * Return whether the name of the resource should be appended to the
 * API URI path.  When creating and listing resources, it is not
 * appended.
 *
 * @param action API action, see [[K8sApiAction]]
 * @return true if name should be appended to URI
 */
export declare function appendName(action: K8sApiAction): boolean;
/**
 * Return whether namespace must be included in resource API URI.
 * It returns true of the resource is namespaced and the action is
 * not "list".  The namespace can be provided when the action is
 * "list", but it need not be.
 *
 * @param resource resource metadata
 * @param action API action, see [[K8sApiAction]]
 * @return true is the namespace is required in the API URI path
 */
export declare function namespaceRequired(resource: k8s.V1APIResource, action: K8sApiAction): boolean;
//# sourceMappingURL=api.d.ts.map