Skip to content

# Class: KubeApi<T>

Renderer.K8sApi.KubeApi

## Type parameters

Name | Type
--- | ---
`T` | `T`: KubeObject = `any`

## Hierarchy

- KubeApi

↳ PodsApi

↳ NodesApi

↳ DeploymentApi

↳ IngressApi

↳ PersistentVolumeClaimsApi

## Table of contents

### Constructors

- constructor

### Properties

- apiBase
- apiGroup
- apiPrefix
- apiResource
- apiVersion
- apiVersionPreferred
- isNamespaced
- kind
- objectConstructor
- options
- request
- resourceVersions
- watchDisposer

### Accessors

- apiVersionWithGroup

### Methods

- checkPreferredVersion
- create
- delete
- get
- getResourceVersion
- getUrl
- getWatchUrl
- list
- modifyWatchEvent
- normalizeQuery
- parseResponse
- refreshResourceVersion
- setResourceVersion
- update
- watch

## Constructors

### constructor

• new KubeApi<T>(`options`)

#### Type parameters

Name | Type
--- | ---
`T` | `T`: KubeObject<IKubeObjectMetadata, any, any, T> = `any`

#### Parameters

Name | Type
--- | ---
`options` | `IKubeApiOptions`<T>

## Properties

### apiBase

• `Readonly` apiBase: `string`

### apiGroup

• `Readonly` apiGroup: `string`

### apiPrefix

• `Readonly` apiPrefix: `string`

### apiResource

• `Readonly` apiResource: `string`

### apiVersion

• `Readonly` apiVersion: `string`

### apiVersionPreferred

• `Optional` `Readonly` apiVersionPreferred: `string`

### isNamespaced

• `Readonly` isNamespaced: `boolean`

### kind

• `Readonly` kind: `string`

### objectConstructor

• objectConstructor: `IKubeObjectConstructor`<T>

### options

• `Protected` options: `IKubeApiOptions`<T>

### request

• `Protected` request: `KubeJsonApi`

### resourceVersions

• `Protected` resourceVersions: `Map`<string, string>

### watchDisposer

• `Protected` watchDisposer: () => `void`

#### Type declaration

▸ (): `void`

##### Returns

`void`

## Accessors

### apiVersionWithGroup

• `get` apiVersionWithGroup(): `string`

#### Returns

`string`

## Methods

### checkPreferredVersion

▸ `Protected` checkPreferredVersion(): `Promise`<void>

#### Returns

`Promise`<void>

### create

▸ create(`__namedParameters?`, `data?`): `Promise`<T>

#### Parameters

Name | Type
--- | ---
`__namedParameters` | `Object`
`__namedParameters.name` |
`__namedParameters.namespace` |
`data?` | `Partial`<T>

#### Returns

`Promise`<T>

### delete

▸ delete(`__namedParameters`): `Promise`<KubeJsonApiData>

#### Parameters

Name | Type
--- | ---
`__namedParameters` | `Object`

#### Returns

`Promise`<KubeJsonApiData>

### get

▸ get(`__namedParameters?`, `query?`): `Promise`<T>

#### Parameters

Name | Type
--- | ---
`__namedParameters` | `Object`
`__namedParameters.name` |
`__namedParameters.namespace` |
`query?` | `IKubeApiQueryParams`

#### Returns

`Promise`<T>

### getResourceVersion

▸ getResourceVersion(`namespace?`): `string`

#### Parameters

Name | Type | Default value
--- | --- | ---
`namespace` | `string` | ""

#### Returns

`string`

### getUrl

▸ getUrl(`__namedParameters?`, `query?`): `string`

#### Parameters

Name | Type
--- | ---
`__namedParameters` | `Object`
`__namedParameters.name` |
`__namedParameters.namespace` |
`query?` | `Partial`<IKubeApiQueryParams>

#### Returns

`string`

### getWatchUrl

▸ getWatchUrl(`namespace?`, `query?`): `string`

#### Parameters

Name | Type | Default value
--- | --- | ---
`namespace` | `string` | ""
`query` | `IKubeApiQueryParams` | {}

#### Returns

`string`

### list

▸ list(`__namedParameters?`, `query?`): `Promise`<T[]>

#### Parameters

Name | Type
--- | ---
`__namedParameters` | `KubeApiListOptions`
`query?` | `IKubeApiQueryParams`

#### Returns

`Promise`<T[]>

### modifyWatchEvent

▸ `Protected` modifyWatchEvent(`event`): `void`

#### Parameters

Name | Type
--- | ---
`event` | `IKubeWatchEvent`<KubeJsonApiData>

#### Returns

`void`

### normalizeQuery

▸ `Protected` normalizeQuery(`query?`): `Partial`<IKubeApiQueryParams>

#### Parameters

Name | Type
--- | ---
`query` | `Partial`<IKubeApiQueryParams>

#### Returns

`Partial`<IKubeApiQueryParams>

### parseResponse

▸ `Protected` parseResponse(`data`, `namespace?`): `T` | `T`[]

#### Parameters

Name | Type
--- | ---
`data` | `unknown`
`namespace?` | `string`

#### Returns

`T` | `T`[]

### refreshResourceVersion

▸ refreshResourceVersion(`params?`): `Promise`<T[]>

#### Parameters

Name | Type
--- | ---
`params?` | `KubeApiListOptions`

#### Returns

`Promise`<T[]>

### setResourceVersion

▸ setResourceVersion(`namespace?`, `newVersion`): `void`

#### Parameters

Name | Type | Default value
--- | --- | ---
`namespace` | `string` | ""
`newVersion` | `string` | `undefined`

#### Returns

`void`

### update

▸ update(`__namedParameters?`, `data?`): `Promise`<T>

#### Parameters

Name | Type
--- | ---
`__namedParameters` | `Object`
`__namedParameters.name` |
`__namedParameters.namespace` |
`data?` | `Partial`<T>

#### Returns

`Promise`<T>

### watch

▸ watch(`opts?`): () => `void`

#### Parameters

Name | Type
--- | ---
`opts` | `KubeApiWatchOptions`

#### Returns

`fn`

▸ (): `void`

##### Returns

`void`