Skip to main content

CustomResources

@webda/kubernetes


Class: CustomResources

Defined in: kubernetes/src/stores/resources.ts:83

CRUD on the custom resources of one type, namespaced or cluster scoped

Constructors​

Constructor​

new CustomResources(api, type, tracker?): CustomResources

Defined in: kubernetes/src/stores/resources.ts:89

Parameters​

api​

ObjectCustomObjectsApi

the custom objects API

type​

CustomResourceType

the resources type

tracker?​

WriteTracker

records the writes, when the store watches the resources

Returns​

CustomResources

Properties​

api​

protected api: ObjectCustomObjectsApi

Defined in: kubernetes/src/stores/resources.ts:90

the custom objects API


tracker?​

readonly optional tracker?: WriteTracker

Defined in: kubernetes/src/stores/resources.ts:92

records the writes, when the store watches the resources


type​

readonly type: CustomResourceType

Defined in: kubernetes/src/stores/resources.ts:91

the resources type

Accessors​

apiVersion​

Get Signature​

get apiVersion(): string

Defined in: kubernetes/src/stores/resources.ts:108

Returns​

string

group/version

Methods​

create()​

create(body): Promise<CustomResource>

Defined in: kubernetes/src/stores/resources.ts:173

Create a resource

Parameters​

body​

CustomResource

the resource

Returns​

Promise<CustomResource>

the created resource

Throws​

ApiException 409 when it exists


delete()​

delete(name, resourceVersion?): Promise<void>

Defined in: kubernetes/src/stores/resources.ts:217

Delete a resource

Parameters​

name​

string

the name

resourceVersion?​

string

only delete this version of the resource

Returns​

Promise<void>

Throws​

ApiException 404 when not found, 409 when the version changed


get()​

get(name): Promise<CustomResource>

Defined in: kubernetes/src/stores/resources.ts:127

Get a resource

Parameters​

name​

string

the name

Returns​

Promise<CustomResource>

the resource

Throws​

ApiException 404 when not found


list()​

list(options?): Promise<{ items: CustomResource[]; metadata?: { continue?: string; }; }>

Defined in: kubernetes/src/stores/resources.ts:141

List one page of resources

Parameters​

options?​

the list options

_continue?​

string

continue token of the previous page

labelSelector?​

string

only the resources matching it

limit?​

number

page size

Returns​

Promise<{ items: CustomResource[]; metadata?: { continue?: string; }; }>

the resources and the continue token of the next page


listAll()​

listAll(labelSelector?, pageSize?): Promise<CustomResource[]>

Defined in: kubernetes/src/stores/resources.ts:156

List every resource, page by page

Parameters​

labelSelector?​

string

only the resources matching it

pageSize?​

number = 500

resources per request

Returns​

Promise<CustomResource[]>

the resources


params()​

protected params(): object

Defined in: kubernetes/src/stores/resources.ts:116

Common parameters of the requests

Returns​

object

group, version, plural and namespace when namespaced

group​

group: string

namespace​

namespace: string

plural​

plural: string

version​

version: string


replace()​

replace(body): Promise<CustomResource>

Defined in: kubernetes/src/stores/resources.ts:187

Replace a resource, but its status

Parameters​

body​

CustomResource

the resource, with the resourceVersion it was read with

Returns​

Promise<CustomResource>

the replaced resource

Throws​

ApiException 409 when the resourceVersion is outdated


replaceStatus()​

replaceStatus(body): Promise<CustomResource>

Defined in: kubernetes/src/stores/resources.ts:202

Replace the status of a resource

Parameters​

body​

CustomResource

the resource, with the resourceVersion it was read with

Returns​

Promise<CustomResource>

the replaced resource

Throws​

ApiException 409 when the resourceVersion is outdated


track()​

protected track(resource): CustomResource

Defined in: kubernetes/src/stores/resources.ts:100

Record a write in the tracker

Parameters​

resource​

CustomResource

the resource returned by the write

Returns​

CustomResource

the resource