@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
45 lines • 2.21 kB
TypeScript
import { File as ProjectFile } from "@atomist/automation-client/lib/project/File";
import { Project } from "@atomist/automation-client/lib/project/Project";
import * as k8s from "@kubernetes/client-node";
/**
* Read and parse either JSON or YAML file with basename `base` under
* `.atomist/kubernetes` in project. This function looks for
* `base`.json, `base`.yaml, and then `base`.yml. If it successfully
* reads and parses one of them into a truthy value, it returns its
* parsed value. If there are mulitple files matching those it looks
* for, it does _not_ overlay/merge the parsed values. It stops after
* the first successfully parsed file.
*/
export declare function loadKubernetesSpec(p: Project, base: string): Promise<k8s.KubernetesObject | undefined>;
/**
* Reads and parses Kubernetes JSON or YAML spec from the project.
* It swallows all exceptions, returning undefined if one occurs.
*
* If the `specPath` of the file ends with `.yaml` or `.yml`, the file
* contents are parsed as YAML. Otherwise it is parsed as JSON.
*
* @param p Project to look for spec file in
* @param specPath Path of spec file to load
* @return Parsed object if the spec was successfully read and parsed, undefined otherwise
*/
export declare function parseKubernetesSpec(p: Project, specPath: string): Promise<k8s.KubernetesObject | undefined>;
/**
* Reads and parses Kubernetes JSON or YAML spec from the project.
*
* If the `specFile.path` of the file ends with `.yaml` or `.yml`, the file
* contents are parsed as YAML. Otherwise it is parsed as JSON.
*
* @param specFile File object of spec file to load
* @return Parsed object of the spec
*/
export declare function parseKubernetesSpecFile(specFile: ProjectFile): Promise<k8s.KubernetesObject>;
/**
* Parses content string as Kubernetes JSON or YAML spec. It parses
* the file as YAML, since JSON is valid YAML.
*
* @param specString String representation of Kubernetes spec
* @param specPath File path of Kubernetes spec file
* @return Parsed object of the spec
*/
export declare function parseKubernetesSpecString(specString: string, specPath: string): Promise<k8s.KubernetesObject>;
//# sourceMappingURL=spec.d.ts.map