Skip to content

@k8slens/extensions / Exports / Main / K8sApi / KubeObject

Class: KubeObject<Metadata, Status, Spec>#

Main.K8sApi.KubeObject

Type parameters#

Name Type
Metadata extends KubeObjectMetadata<KubeObjectScope> = KubeObjectMetadata<KubeObjectScope>
Status unknown
Spec unknown

Hierarchy#

  • KubeObject

Pod

Node

Deployment

DaemonSet

StatefulSet

Job

CronJob

ConfigMap

Secret

ReplicaSet

ResourceQuota

LimitRange

HorizontalPodAutoscaler

PodDisruptionBudget

PriorityClass

Service

Endpoint

Ingress

NetworkPolicy

PersistentVolume

PersistentVolumeClaim

StorageClass

Namespace

KubeEvent

ServiceAccount

Role

RoleBinding

ClusterRole

ClusterRoleBinding

CustomResourceDefinition

Table of contents#

Constructors#

Properties#

Accessors#

Methods#

Constructors#

constructor#

new KubeObject<Metadata, Status, Spec>(data)

Type parameters#

Name Type
Metadata extends KubeObjectMetadata<KubeObjectScope> = KubeObjectMetadata<KubeObjectScope>
Status unknown
Spec unknown

Parameters#

Name Type
data KubeJsonApiData<Metadata, Status, Spec>

Properties#

apiVersion#

apiVersion: string


kind#

kind: string


metadata#

metadata: Metadata


spec#

spec: Spec


status#

Optional status: Status


apiBase#

Static Optional Readonly apiBase: string


create#

Static create: <Metadata, Status, Spec>(data: KubeJsonApiData<Metadata, Status, Spec>) => KubeObject<Metadata, Status, Spec>

Type declaration#

▸ <Metadata, Status, Spec>(data): KubeObject<Metadata, Status, Spec>

Deprecated

Switch to using __type instead

Type parameters#
Name Type
Metadata extends KubeObjectMetadata<KubeObjectScope> = KubeObjectMetadata<KubeObjectScope>
Status unknown
Spec unknown
Parameters#
Name Type
data KubeJsonApiData<Metadata, Status, Spec>
Returns#

KubeObject<Metadata, Status, Spec>


isJsonApiData#

Static isJsonApiData: (object: unknown) => object is KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>

Type declaration#

▸ (object): object is KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>

Deprecated

Switch to using __type instead

Parameters#
Name Type
object unknown
Returns#

object is KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>


isJsonApiDataList#

Static isJsonApiDataList: (object: unknown, verifyItem: (val: unknown) => val is T) => object is KubeJsonApiDataList<T>

Type declaration#

▸ <T>(object, verifyItem): object is KubeJsonApiDataList<T>

Deprecated

Switch to using __type instead

Type parameters#
Name
T
Parameters#
Name Type
object unknown
verifyItem (val: unknown) => val is T
Returns#

object is KubeJsonApiDataList<T>


isKubeJsonApiListMetadata#

Static isKubeJsonApiListMetadata: (object: unknown) => object is KubeJsonApiListMetadata

Type declaration#

▸ (object): object is KubeJsonApiListMetadata

Deprecated

Switch to using __type instead

Parameters#
Name Type
object unknown
Returns#

object is KubeJsonApiListMetadata


isKubeJsonApiMetadata#

Static isKubeJsonApiMetadata: (object: unknown) => object is KubeJsonApiObjectMetadata<KubeObjectScope>

Type declaration#

▸ (object): object is KubeJsonApiObjectMetadata<KubeObjectScope>

Deprecated

Switch to using __type instead

Parameters#
Name Type
object unknown
Returns#

object is KubeJsonApiObjectMetadata<KubeObjectScope>


isNonSystem#

Static isNonSystem: (item: KubeObject<KubeObjectMetadata<KubeObjectScope>, unknown, unknown> | KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>) => boolean

Type declaration#

▸ (item): boolean

Deprecated

Switch to using __type instead

Parameters#
Name Type
item KubeObject<KubeObjectMetadata<KubeObjectScope>, unknown, unknown> | KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>
Returns#

boolean


isPartialJsonApiData#

Static isPartialJsonApiData: (object: unknown) => object is Partial<KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>>

Type declaration#

▸ (object): object is Partial<KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>>

Deprecated

Switch to using __type instead

Parameters#
Name Type
object unknown
Returns#

object is Partial<KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>>


isPartialJsonApiMetadata#

Static isPartialJsonApiMetadata: (object: unknown) => object is Partial<KubeJsonApiObjectMetadata<KubeObjectScope>>

Type declaration#

▸ (object): object is Partial<KubeJsonApiObjectMetadata<KubeObjectScope>>

Deprecated

Switch to using __type instead

Parameters#
Name Type
object unknown
Returns#

object is Partial<KubeJsonApiObjectMetadata<KubeObjectScope>>


kind#

Static Optional Readonly kind: string


namespaced#

Static Optional Readonly namespaced: boolean


stringifyLabels#

Static stringifyLabels: (labels?: Partial<Record<string, string>>) => string[]

Type declaration#

▸ (labels?): string[]

Deprecated

Switch to using __type instead

Parameters#
Name Type
labels? Partial<Record<string, string>>
Returns#

string[]

Accessors#

get selfLink(): string

Returns#

string

Methods#

delete#

delete(params?): void

Deprecated

use KubeApi.delete instead

Parameters#

Name Type
params? object

Returns#

void


getAge#

getAge(humanize?, compact?, fromNow?): string | number

Deprecated

This function computes a new "now" on every call might cause subtle issues if called multiple times

NOTE: this function also is not reactive to updates in the current time so it should not be used for rendering

Parameters#

Name Type
humanize? boolean
compact? boolean
fromNow? boolean

Returns#

string | number


getAnnotations#

getAnnotations(filter?): string[]

Parameters#

Name Type
filter? boolean

Returns#

string[]


getCreationTimestamp#

getCreationTimestamp(): number

This function computes the number of milliseconds from the UNIX EPOCH to the creation timestamp of this object.

Returns#

number


getFinalizers#

getFinalizers(): string[]

Returns#

string[]


getId#

getId(): string

Returns#

string


getLabels#

getLabels(): string[]

Returns#

string[]


getName#

getName(): string

Returns#

string


getNs#

getNs(): Metadata["namespace"]

Returns#

Metadata["namespace"]


getOwnerRefs#

getOwnerRefs(): { apiVersion: string ; blockOwnerDeletion?: boolean ; controller?: boolean ; kind: string ; name: string ; namespace: Metadata["namespace"] ; uid: string }[]

Returns#

{ apiVersion: string ; blockOwnerDeletion?: boolean ; controller?: boolean ; kind: string ; name: string ; namespace: Metadata["namespace"] ; uid: string }[]


getResourceVersion#

getResourceVersion(): string

Returns#

string


getScopedName#

getScopedName(): string

Returns#

string


getSearchFields#

getSearchFields(): (string | Metadata["namespace"])[]

Returns#

(string | Metadata["namespace"])[]


getTimeDiffFromNow#

getTimeDiffFromNow(): number

Deprecated

This function computes a new "now". Switch to using getCreationTimestamp instead

Returns#

number


patch#

patch(patch): Promise<null | KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>>

Deprecated

use KubeApi.patch instead

Parameters#

Name Type
patch Patch

Returns#

Promise<null | KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>>


toPlainObject#

toPlainObject(): Record<string, unknown>

Returns#

Record<string, unknown>


update#

update(data): Promise<null | KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>>

Deprecated

use KubeApi.patch instead

Parameters#

Name Type
data Partial<KubeObject<Metadata, Status, Spec>>

Returns#

Promise<null | KubeJsonApiData<KubeJsonApiObjectMetadata<KubeObjectScope>, unknown, unknown>>