Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @kosko/yaml

Index

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

loadFile

  • loadFile(path: string, options?: LoadOptions): (Anonymous function)
  • Load a Kubernetes YAML file from path.

    Parameters

    • path: string

      Path to the Kubernetes YAML file.

    • Optional options: LoadOptions

    Returns (Anonymous function)

loadString

  • loadString(content: string, __namedParameters?: { transform: any }): ReadonlyArray<Manifest>
  • 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

    • content: string
    • Default value __namedParameters: { transform: any } = {}

    Returns ReadonlyArray<Manifest>

loadUrl

  • loadUrl(url: RequestInfo, options?: LoadOptions & RequestInit): () => Promise<ReadonlyArray<Manifest>>

resetResourceModules

  • resetResourceModules(): void
  • Returns void

setResourceModule

Generated using TypeDoc