@openshift-console/dynamic-plugin-sdk
Version:
Provides core APIs, types and utilities used by dynamic plugins at runtime.
59 lines (58 loc) • 3.52 kB
TypeScript
import { K8sModel } from '../../api/common-types';
import { GetAPIVersionForModel, GetGroupVersionKindForResource, GetGroupVersionKindForModel } from '../../api/k8s-types';
import { K8sGroupVersionKind, K8sResourceKindReference } from '../../extensions/console-types';
/**
* @deprecated - This will become obsolete when we move away from K8sResourceKindReference to K8sGroupVersionKind
* Provides a reference string that uniquely identifies the group, version, and kind of a k8s resource.
* @param K8sGroupVersionKind Pass K8sGroupVersionKind which will have group, version, and kind of a k8s resource.
* @param K8sGroupVersionKind.group Pass group of k8s resource or model.
* @param K8sGroupVersionKind.version Pass version of k8s resource or model.
* @param K8sGroupVersionKind.kind Pass kind of k8s resource or model.
* @returns The reference for any k8s resource i.e `group~version~kind`.
* If the group will not be present then "core" will be returned as part of the group in reference.
*/
export declare const getReference: ({ group, version, kind, }: K8sGroupVersionKind) => K8sResourceKindReference;
/**
* @deprecated - This will become obsolete when we move away from K8sResourceKindReference to K8sGroupVersionKind
* @see getGroupVersionKindForModel
* Provides a reference string that uniquely identifies the group, version, and kind of a k8s model.
* @param model k8s model
* @returns The reference for model i.e `group~version~kind`.
*/
export declare const getReferenceForModel: (model: K8sModel) => K8sResourceKindReference;
/**
* Provides `apiVersion` for a Kubernetes model.
* @param model Kubernetes model
* @returns The apiVersion for the model i.e `group/version`.
* */
export declare const getAPIVersionForModel: GetAPIVersionForModel;
/**
* Provides a group, version, and kind for a resource.
* @param resource Kubernetes resource
* @returns The group, version, kind for the provided resource.
* If the resource does not have an API group, the group `core` is returned.
* If the resource has an invalid apiVersion then it'll throw Error.
* */
export declare const getGroupVersionKindForResource: GetGroupVersionKindForResource;
/**
* Provides a group, version, and kind for a k8s model.
* @param model Kubernetes model
* @returns The group, version, kind for the provided model.
* If the model does not have an apiGroup, group `core` will be returned.
* */
export declare const getGroupVersionKindForModel: GetGroupVersionKindForModel;
/**
* @deprecated - This will become obsolete when we move away from K8sResourceKindReference to K8sGroupVersionKind
* Provides a group, version, and kind for a reference.
* @param reference reference for group, version, kind i.e `group~version~kind`.
* @returns The group, version, kind for the provided reference.
* If the group's value is "core" it denotes resource does not have an API group.
* */
export declare const getGroupVersionKindForReference: (reference: K8sResourceKindReference) => K8sGroupVersionKind;
/**
* @deprecated - This will become obsolete when we move away from K8sResourceKindReference to K8sGroupVersionKind
* Provides a reference string that uniquely identifies the group, version, and kind of K8sGroupVersionKind.
* @param kind kind can be of type K8sResourceKindReference or K8sGroupVersionKind
* @returns The reference i.e `group~version~kind`.
*/
export declare const transformGroupVersionKindToReference: (kind: K8sResourceKindReference | K8sGroupVersionKind) => K8sResourceKindReference;