Class: Endpoint

endpoints~ Endpoint

Exposes all methods for an API resource endpoint. If there are any nested resources, they are exposed as methods of the parent resource. The HTTP verb used for the nested resource is prepended to the name.

new Endpoint(client, resource, nested, options)

Kubernetes API Endpoint

Define a new Endpoint object corresponding to a resource on the API server. Specify options to override the library defaults for this endpoint.

This:
Parameters:
Name Type Argument Description
client module:client.KubernetesClient

Sets Endpoint#client

resource string

Sets Endpoint#resource

nested Array.<NestedResourceDefinition> <optional>
<nullable>

List of nested endpoints

options object <optional>
<nullable>

Sets Endpoint#options

Properties
Name Type Argument Description
version string

API version name

prefix string <optional>

Custom API prefix

methods Array.<string> <optional>

If defined, only the listed base methods will be available to the Endpoint

Members

client :module:client.KubernetesClient

Reference to the parent client object

Type:

<nullable> options :object

Endpoint option overrides

Type:
  • object

resource :string

Server resource name

Type:
  • string

Methods

create(body, opts, next) → {Promise.<KubernetesResource>}

Create new resource on the API server

Corresponds to the 'POST' http method.

This:
Parameters:
Name Type Argument Description
body KubernetesResource | *

Resource object to send

opts object <optional>
<nullable>

Method options

next function | * <optional>

Node.js callback (replaces Promise output)

Returns:
Type
Promise.<KubernetesResource>

delete(query, opts, next) → {Promise.<KubernetesResource>}

Delete resource on the API server

Corresponds to the 'DELETE' http method.

This:
Parameters:
Name Type Argument Description
query string

Server resource resource

opts object <optional>
<nullable>

Method options

next function | * <optional>

Node.js callback (replaces Promise output)

Returns:
Type
Promise.<KubernetesResource>

get(query, opts, next) → {Promise.<(KubernetesResource|KubernetesList)>}

Request resources from the API server

Corresponds to the 'GET' http method.

Missing parameters can be stripped from the beginning of the parameter list and will be checked for type appropriately. If query is not defined, the returned Promise will be for a KubernetesList. Otherwise it will be a Promise for a KubernetesResource.

This:
Parameters:
Name Type Argument Description
query string <optional>
<nullable>

Server resource name

opts object <optional>
<nullable>

Method options

next function | * <optional>

Node.js callback (replaces Promise output)

Returns:
Type
Promise.<(KubernetesResource|KubernetesList)>

patch(query, body, opts, next) → {Promise.<KubernetesResource>}

Partially update resource on the API server

Corresponds to the 'PATCH' http method.

Currently only the application/strategic-merge-patch+json content type is supported by default, but other types may be used by manually setting the Content-Type header in the method options.

This:
Parameters:
Name Type Argument Description
query string

Server resource resource

body object

Resource patch to send

opts object <optional>
<nullable>

Method options

next function | * <optional>

Node.js callback (replaces Promise output)

Returns:
Type
Promise.<KubernetesResource>

update(query, body, opts, next) → {Promise.<KubernetesResource>}

Update resource on the API server

Corresponds to the 'PUT' http method.

This:
Parameters:
Name Type Argument Description
query string

Server resource resource

body KubernetesResource | *

Resource object to send

opts object <optional>
<nullable>

Method options

next function | * <optional>

Node.js callback (replaces Promise output)

Returns:
Type
Promise.<KubernetesResource>

watch(query, opts, next) → {module.endpoints~WatchEmitter}

Watch server resource(s) for changes

Corresponds to the 'GET' http method with the watch query parameter set.

Gets the current state of the requested resources and returns a custom event emitter (see below) with the current state set to the initialState property. Watch events will not be received until the start method is called on the emitter. This allows the user to define all event listeners before requesting events from the API server and prevent events from being missed during the initial setup.

Missing parameters can be stripped from the beginning of the parameter list and will be checked for type appropriately. If query is not defined, the watched resource will be a KubernetesList. Otherwise it will be a KubernetesResource.

This:
Parameters:
Name Type Argument Description
query string <optional>
<nullable>

Server resource resource

opts object | * <optional>

Method options

Properties
Name Type Argument Default Description
verbose boolean <optional>
false

Return full response instead of body only

child string <optional>
<nullable>

Name of nested child resource

next function | * <optional>

Node.js callback (replaces Promise output)

Returns:
Type
module.endpoints~WatchEmitter