import { File as ProjectFile } from "@atomist/automation-client/lib/project/File";
import { GitProject } from "@atomist/automation-client/lib/project/git/GitProject";
import { Project } from "@atomist/automation-client/lib/project/Project";
import * as k8s from "@kubernetes/client-node";
import { KubernetesSyncOptions } from "../config";
import { KubernetesDelete } from "../kubernetes/request";
export declare type SyncAction = "upsert" | "delete";
/**
 * Synchronize changes from deploying app to the configured syncRepo.
 * If no syncRepo is configured, do nothing.
 *
 * @param app Kubernetes application change that triggered the sync
 * @param resources Kubernetes resource objects to synchronize
 * @param action Action performed, "upsert" or "delete"
 */
export declare function syncApplication(app: KubernetesDelete, resources: k8s.KubernetesObject[], action?: SyncAction): Promise<void>;
export interface ProjectFileSpec {
    file: ProjectFile;
    spec: k8s.KubernetesObject;
}
/**
 * Update the sync repo with the changed resources from a
 * KubernetesApplication.  For each changed resource in `resources`,
 * loop through all the existing Kubernetes spec files, i.e., those
 * that match [[k8sSpecGlob]], to see if the apiVersion, kind, name,
 * and namespace, which may be undefined, match.  If a match is found,
 * update that spec file.  If no match is found, create a unique file
 * name and store the resource spec in it.  If changes are made,
 * commit and push the changes.
 *
 * @param app Kubernetes application object
 * @param resources Resources that were upserted as part of this application
 * @param action Action performed, "upsert" or "delete"
 * @param opts Repo sync options, passed to the sync action
 * @return Function that updates the sync repo with the resource specs
 */
export declare function syncResources(app: KubernetesDelete, resources: k8s.KubernetesObject[], action: SyncAction, opts: KubernetesSyncOptions): (p: GitProject) => Promise<void>;
/**
 * Determine if two Kubernetes resource specifications represent the
 * same object.  When determining if they are the same, only the kind,
 * name, and namespace, which may be `undefined`, must match.  The
 * apiVersion is not considered when matching because the same
 * resource can appear under different API versions.  Other object
 * properties are not considered.
 *
 * @param a First Kubernetes object spec to match
 * @param b Second Kubernetes object spec to match
 * @return `true` if specs match, `false` otherwise
 */
export declare function sameObject(a: k8s.KubernetesObject, b: k8s.KubernetesObject): boolean;
/**
 * Search `fileSpecs` for a spec that matches `spec`.  To be
 * considered a match, the kind, name, and namespace, which may be
 * undefined, must match.  The apiVersion is not considered when
 * matching because the same resource can appear under different API
 * versions.
 *
 * @param spec Kubernetes object spec to match
 * @param fileSpecs Array of spec and file objects to search
 * @return First file and spec object to match spec or `undefined` if no match is found
 */
export declare function matchSpec(spec: k8s.KubernetesObject, fileSpecs: ProjectFileSpec[]): ProjectFileSpec | undefined;
/**
 * Return a unique name for a resource spec that lexically sorts so
 * resources that should be created earlier than others sort earlier
 * than others.
 *
 * @param resource Kubernetes object spec
 * @param p Kubernetes spec project
 * @return Unique spec file name that sorts properly
 */
export declare function uniqueSpecFile(resource: k8s.KubernetesObject, p: Project, format: KubernetesSyncOptions["specFormat"]): Promise<string>;
//# sourceMappingURL=application.d.ts.map