Module: @kosko/yaml#

Index#

References#

Interfaces#

Functions#

References#

LoadOptions#

Re-exports: LoadOptions


Manifest#

Re-exports: Manifest


ResourceKind#

Re-exports: ResourceKind


ResourceModule#

Re-exports: ResourceModule


getResourceModule#

Re-exports: getResourceModule


loadFile#

Re-exports: loadFile


loadString#

Re-exports: loadString


loadUrl#

Re-exports: loadUrl


resetResourceModules#

Re-exports: resetResourceModules


setResourceModule#

Re-exports: setResourceModule

Functions#

getResourceModule#

getResourceModule(res: ResourceKind): ResourceModule | undefined

Defined in packages/yaml/src/module.ts:60

Parameters:#

NameType
resResourceKind

Returns: ResourceModule | undefined


loadFile#

loadFile(path: string, options?: LoadOptions): (Anonymous function)

Defined in packages/yaml/src/load.ts:122

Load a Kubernetes YAML file from path.

Parameters:#

NameTypeDescription
pathstringPath to the Kubernetes YAML file.
options?LoadOptions

Returns: (Anonymous function)


loadString#

loadString(content: string, __namedParameters?: { transform: (x: Manifest) => Manifest }): ReadonlyArray<Manifest>

Defined in packages/yaml/src/load.ts:87

Load a Kubernetes YAML file from a string.

Examples#

Transform manifests#

loadString('', {
transform(manifest) {
if (manifest.apiVersion === "apps/v1" && manifest.kind === "Deployment") {
manifest.spec.replicas = 3;
}
return manifest;
}
});

Filter manifests#

Values are removed from array if transform function returns a falsy value, such as null or undefined.

loadString('', {
transform(manifest) {
if (manifest.metadata.name === 'foo') {
return null;
}
return manifest;
}
});

Parameters:#

NameTypeDefault value
contentstring-
__namedParameters{ transform: (x: Manifest) => Manifest }{}

Returns: ReadonlyArray<Manifest>


loadUrl#

loadUrl(url: RequestInfo, options?: LoadOptions & RequestInit): function

Defined in packages/yaml/src/load.ts:137

Load a Kubernetes YAML file from url.

Parameters:#

NameTypeDefault valueDescription
urlRequestInfo-URL to the Kubernetes YAML file.
optionsLoadOptions & RequestInit{}(https://github.com/node-fetch/node-fetch#options) for the HTTP(S) request.

Returns: function


resetResourceModules#

resetResourceModules(): void

Defined in packages/yaml/src/module.ts:66

Returns: void


setResourceModule#

setResourceModule(res: ResourceKind, mod: ResourceModule): void

Defined in packages/yaml/src/module.ts:22

Parameters:#

NameType
resResourceKind
modResourceModule

Returns: void