Refactoring KubernetesBuilder.test.ts to use kubernetesObjectsProviderExtensionPoint, kubernetesClusterSupplierExtensionPoint, kubernetesAuthStrategyExtensionPoint, kubernetesFetcherExtensionPoint and kubernetesServiceLocatorExtensionPoint
Signed-off-by: Andres Mauricio Gomez P <andmagom@outlook.com>
This commit is contained in:
@@ -3,19 +3,131 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { AuthenticationStrategy as AuthenticationStrategy_2 } from '@backstage/plugin-kubernetes-node';
|
||||
import { CustomResourceMatcher } from '@backstage/plugin-kubernetes-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
import { FetchResponse } from '@backstage/plugin-kubernetes-common';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { KubernetesClustersSupplier as KubernetesClustersSupplier_2 } from '@backstage/plugin-kubernetes-node';
|
||||
import { KubernetesFetcher as KubernetesFetcher_2 } from '@backstage/plugin-kubernetes-node';
|
||||
import { KubernetesFetchError } from '@backstage/plugin-kubernetes-common';
|
||||
import { KubernetesObjectsProvider as KubernetesObjectsProvider_2 } from '@backstage/plugin-kubernetes-node';
|
||||
import { KubernetesRequestAuth } from '@backstage/plugin-kubernetes-common';
|
||||
import { KubernetesServiceLocator as KubernetesServiceLocator_2 } from '@backstage/plugin-kubernetes-node';
|
||||
import { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common';
|
||||
|
||||
// @public (undocumented)
|
||||
export interface AuthenticationStrategy {
|
||||
// (undocumented)
|
||||
getCredential(
|
||||
clusterDetails: ClusterDetails,
|
||||
authConfig: KubernetesRequestAuth,
|
||||
): Promise<KubernetesCredential>;
|
||||
// (undocumented)
|
||||
validateCluster(authMetadata: AuthMetadata): Error[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export type AuthMetadata = Record<string, string>;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ClusterDetails {
|
||||
// (undocumented)
|
||||
authMetadata: AuthMetadata;
|
||||
// (undocumented)
|
||||
caData?: string | undefined;
|
||||
// (undocumented)
|
||||
caFile?: string | undefined;
|
||||
customResources?: CustomResourceMatcher[];
|
||||
dashboardApp?: string;
|
||||
dashboardParameters?: JsonObject;
|
||||
dashboardUrl?: string;
|
||||
name: string;
|
||||
skipMetricsLookup?: boolean;
|
||||
// (undocumented)
|
||||
skipTLSVerify?: boolean;
|
||||
// (undocumented)
|
||||
url: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface CustomResource extends ObjectToFetch {
|
||||
// (undocumented)
|
||||
objectType: 'customresources';
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface CustomResourcesByEntity extends KubernetesObjectsByEntity {
|
||||
// (undocumented)
|
||||
customResources: CustomResourceMatcher[];
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface FetchResponseWrapper {
|
||||
// (undocumented)
|
||||
errors: KubernetesFetchError[];
|
||||
// (undocumented)
|
||||
responses: FetchResponse[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface KubernetesAuthStrategyExtensionPoint {
|
||||
// (undocumented)
|
||||
addAuthStrategy(key: string, strategy: AuthenticationStrategy_2): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const kubernetesAuthStrategyExtensionPoint: ExtensionPoint<KubernetesAuthStrategyExtensionPoint>;
|
||||
|
||||
// @public
|
||||
export interface KubernetesClustersSupplier {
|
||||
getClusters(): Promise<ClusterDetails[]>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface KubernetesClusterSupplierExtensionPoint {
|
||||
// (undocumented)
|
||||
addClusterSupplier(clusterSupplier: KubernetesClustersSupplier_2): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const kubernetesClusterSupplierExtensionPoint: ExtensionPoint<KubernetesClusterSupplierExtensionPoint>;
|
||||
|
||||
// @public
|
||||
export type KubernetesCredential =
|
||||
| {
|
||||
type: 'bearer token';
|
||||
token: string;
|
||||
}
|
||||
| {
|
||||
type: 'anonymous';
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface KubernetesFetcher {
|
||||
// (undocumented)
|
||||
fetchObjectsForService(
|
||||
params: ObjectFetchParams,
|
||||
): Promise<FetchResponseWrapper>;
|
||||
// (undocumented)
|
||||
fetchPodMetricsByNamespaces(
|
||||
clusterDetails: ClusterDetails,
|
||||
credential: KubernetesCredential,
|
||||
namespaces: Set<string>,
|
||||
labelSelector?: string,
|
||||
): Promise<FetchResponseWrapper>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface KubernetesFetcherExtensionPoint {
|
||||
// (undocumented)
|
||||
addFetcher(fetcher: KubernetesFetcher_2): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const kubernetesFetcherExtensionPoint: ExtensionPoint<KubernetesFetcherExtensionPoint>;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface KubernetesObjectsByEntity {
|
||||
// (undocumented)
|
||||
@@ -44,4 +156,79 @@ export interface KubernetesObjectsProviderExtensionPoint {
|
||||
|
||||
// @public
|
||||
export const kubernetesObjectsProviderExtensionPoint: ExtensionPoint<KubernetesObjectsProviderExtensionPoint>;
|
||||
|
||||
// @public (undocumented)
|
||||
export type KubernetesObjectTypes =
|
||||
| 'pods'
|
||||
| 'services'
|
||||
| 'configmaps'
|
||||
| 'deployments'
|
||||
| 'limitranges'
|
||||
| 'resourcequotas'
|
||||
| 'replicasets'
|
||||
| 'horizontalpodautoscalers'
|
||||
| 'jobs'
|
||||
| 'cronjobs'
|
||||
| 'ingresses'
|
||||
| 'customresources'
|
||||
| 'statefulsets'
|
||||
| 'daemonsets';
|
||||
|
||||
// @public
|
||||
export interface KubernetesServiceLocator {
|
||||
// (undocumented)
|
||||
getClustersByEntity(
|
||||
entity: Entity,
|
||||
requestContext: ServiceLocatorRequestContext,
|
||||
): Promise<{
|
||||
clusters: ClusterDetails[];
|
||||
}>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface KubernetesServiceLocatorExtensionPoint {
|
||||
// (undocumented)
|
||||
addServiceLocator(serviceLocator: KubernetesServiceLocator_2): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const kubernetesServiceLocatorExtensionPoint: ExtensionPoint<KubernetesServiceLocatorExtensionPoint>;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ObjectFetchParams {
|
||||
// (undocumented)
|
||||
clusterDetails: ClusterDetails;
|
||||
// (undocumented)
|
||||
credential: KubernetesCredential;
|
||||
// (undocumented)
|
||||
customResources: CustomResource[];
|
||||
// (undocumented)
|
||||
labelSelector?: string;
|
||||
// (undocumented)
|
||||
namespace?: string;
|
||||
// (undocumented)
|
||||
objectTypesToFetch: Set<ObjectToFetch>;
|
||||
// (undocumented)
|
||||
serviceId: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ObjectToFetch {
|
||||
// (undocumented)
|
||||
apiVersion: string;
|
||||
// (undocumented)
|
||||
group: string;
|
||||
// (undocumented)
|
||||
objectType: KubernetesObjectTypes;
|
||||
// (undocumented)
|
||||
plural: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ServiceLocatorRequestContext {
|
||||
// (undocumented)
|
||||
customResources: CustomResourceMatcher[];
|
||||
// (undocumented)
|
||||
objectTypesToFetch: Set<ObjectToFetch>;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"dependencies": {
|
||||
"@backstage/backend-plugin-api": "workspace:^",
|
||||
"@backstage/catalog-model": "workspace:^",
|
||||
"@backstage/plugin-kubernetes-backend": "workspace:^",
|
||||
"@backstage/plugin-kubernetes-common": "workspace:^",
|
||||
"@backstage/types": "workspace:^"
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { KubernetesObjectTypes } from '@backstage/plugin-kubernetes-backend';
|
||||
import {
|
||||
CustomResourceMatcher,
|
||||
FetchResponse,
|
||||
@@ -154,6 +153,28 @@ export interface AuthenticationStrategy {
|
||||
validateCluster(authMetadata: AuthMetadata): Error[];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type KubernetesObjectTypes =
|
||||
| 'pods'
|
||||
| 'services'
|
||||
| 'configmaps'
|
||||
| 'deployments'
|
||||
| 'limitranges'
|
||||
| 'resourcequotas'
|
||||
| 'replicasets'
|
||||
| 'horizontalpodautoscalers'
|
||||
| 'jobs'
|
||||
| 'cronjobs'
|
||||
| 'ingresses'
|
||||
| 'customresources'
|
||||
| 'statefulsets'
|
||||
| 'daemonsets';
|
||||
// If updating this list, also make sure to update
|
||||
// `objectTypes` and `apiVersionOverrides` in config.d.ts on @backstage/plugin-kubernetes-backend!
|
||||
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
|
||||
Reference in New Issue
Block a user