Options
All
  • Public
  • Public/Protected
  • All
Menu

Module kube-interface/utils

Utility functions for KubeInterface.

Index

Type aliases

EndpointMetadata

EndpointMetadata: { apiGroup?: string; kind: string; name?: string; namespace?: string; resourceVersion: string }

Metadata required to identify the Kubernetes API Endpoint.

Type declaration

  • Optional apiGroup?: string

    Kubernetes API Group (example: batch).

  • kind: string

    Kubernetes Resource kind.

  • Optional name?: string

    Kubernetes Resource name.

  • Optional namespace?: string

    Kubernetes Resource namespace.

  • resourceVersion: string

    Kubernetes API Resource Version (example: v1).

Variables

Const response

response: { assertStatusCode: (resp: Response) => void; unwrap: (resp: Response, many?: boolean) => Resource | Resource[] } = ...

Kubernetes Response Parser.

Type declaration

  • assertStatusCode: (resp: Response) => void
      • (resp: Response): void
      • Throw a KubeError if the response is not successful.

        Parameters

        • resp: Response

          Response to validate.

        Returns void

  • unwrap: (resp: Response, many?: boolean) => Resource | Resource[]
      • Fetch response's body.

        Parameters

        • resp: Response

          Response to parse.

        • many: boolean = false

          true if the body contains a collection of items, false otherwise (the default).

        Returns Resource | Resource[]

        Response's body.

Functions

Const defaultCallback

  • defaultCallback(resource: Resource): Promise<{ condition: boolean; res: any }>
  • Parameters

    Returns Promise<{ condition: boolean; res: any }>

Const getEndpoint

  • getEndpoint(client: Client, meta: EndpointMetadata, watch?: boolean): Endpoint
  • Get Kubernetes API endpoint from resource metadata.

    Parameters

    • client: Client

      Kubernetes Client.

    • meta: EndpointMetadata

      Kubernetes resource metadata.

    • watch: boolean = false

      true if it's a WATCH endpoint, false otherwise (the default).

    Returns Endpoint

    Kubernetes API endpoint.

Const makeReviewer

  • Generate the method to perform a Kubernetes Access Review.

    Parameters

    • kubectl: KubeInterface
    • reviewKind: string

      Kubernetes Resource Kind for the review (example: SelfSubjectAccessReview)

    Returns (__namedParameters: ReviewAction) => Promise<any>

    Status of the Kubernetes Access Review response

Const parseApiVersion

  • parseApiVersion(apiVersion: string): ParsedApiVersion
  • Parse Kubernetes API Version into API Group and API Resource Version.

    Parameters

    • apiVersion: string

      Kubernetes API Version (example: batch/v1).

    Returns ParsedApiVersion

    API Group and Resource Version (example: {apiGroup: 'batch', resourceVersion: 'v1}).

Generated using TypeDoc