UNPKG

@atomist/sdm

Version:

Atomist Software Delivery Machine SDK

58 lines 2.5 kB
import * as k8s from "@kubernetes/client-node"; /** * Create a suitable basename for the spec file for `resource`. The * form of the file name is "NN-NAMESPACE-NAME-KIND", where "NN" is a * numeric prefix so the resources are created in the proper order, * "NAMESPACE-" is omitted if resource is not namespaced, the kind is * converted from PascalCase to kebab-case, and the whole name is * lowercased. * * @param resource Kubernetes resource spec * @return Base file name for resource spec */ export declare function kubernetesSpecFileBasename(resource: k8s.KubernetesObject): string; /** * Options for creating a string representation of a Kubernetes * resource specification. */ export interface KubernetesSpecStringifyOptions { /** * Serialization format, either "json" or "yaml". The default is * "json". */ format?: "json" | "yaml"; /** * The key to use to encrypt v1/Secret data values. See * [[encryptSecret]] for details. If no value is provided, the * secret data values are not encrypted. */ secretKey?: string; } /** * Convert a Kubernetes resource spec into a stable string suitable * for writing to a file or comparisons. * * @param resource Kubernetes resource to stringify * @param options Options for serializing the resource spec * @return Stable string representation of the resource spec */ export declare function kubernetesSpecStringify(spec: k8s.KubernetesObject, options?: KubernetesSpecStringifyOptions): Promise<string>; /** * Parses content of string as Kubernetes JSON or YAML specs. It * parses the file as YAML, since JSON is valid YAML, and returns an * array of [[k8s.KubernetesObject]]s, since a YAML file can contain multiple * documents. It validates that each document parsed looks something * like a Kubernetes spec. If it does not, it is filtered out of the * returned specs. * * @param specString String representation of Kubernetes spec(s) * @return Parsed and filtered Kubernetes spec objects */ export declare function parseKubernetesSpecs(specString: string): k8s.KubernetesObject[]; /** Return unique string for spec. */ export declare function specSlug(spec: k8s.KubernetesObject): string; /** Convert spec to string and shorten it if necessary. */ export declare function specSnippet(spec: k8s.KubernetesObject): string; /** Return beginning snippet from spec string. */ export declare function specStringSnippet(spec: string): string; //# sourceMappingURL=spec.d.ts.map