@@ -89,6 +89,16 @@ export interface CronJobsFetchResponse {
|
||||
type: 'cronjobs';
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface CustomObjectsByEntityRequest {
|
||||
// (undocumented)
|
||||
auth: KubernetesRequestAuth;
|
||||
// (undocumented)
|
||||
customResources: CustomResourceMatcher[];
|
||||
// (undocumented)
|
||||
entity: Entity;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface CustomResourceFetchResponse {
|
||||
// (undocumented)
|
||||
@@ -243,4 +253,12 @@ export interface StatefulSetsFetchResponse {
|
||||
// (undocumented)
|
||||
type: 'statefulsets';
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface WorkloadsByEntityRequest {
|
||||
// (undocumented)
|
||||
auth: KubernetesRequestAuth;
|
||||
// (undocumented)
|
||||
entity: Entity;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -46,6 +46,19 @@ export interface CustomResourceMatcher {
|
||||
plural: string;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface WorkloadsByEntityRequest {
|
||||
auth: KubernetesRequestAuth;
|
||||
entity: Entity;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface CustomObjectsByEntityRequest {
|
||||
auth: KubernetesRequestAuth;
|
||||
customResources: CustomResourceMatcher[];
|
||||
entity: Entity;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface KubernetesRequestBody {
|
||||
auth?: KubernetesRequestAuth;
|
||||
|
||||
@@ -10,12 +10,11 @@ import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { ClientPodStatus } from '@backstage/plugin-kubernetes-common';
|
||||
import { ClusterAttributes } from '@backstage/plugin-kubernetes-common';
|
||||
import { ClusterObjects } from '@backstage/plugin-kubernetes-common';
|
||||
import { CustomResourceMatcher } from '@backstage/plugin-kubernetes-common';
|
||||
import { CustomObjectsByEntityRequest } from '@backstage/plugin-kubernetes-common';
|
||||
import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { IdentityApi } from '@backstage/core-plugin-api';
|
||||
import type { JsonObject } from '@backstage/types';
|
||||
import { KubernetesRequestAuth } from '@backstage/plugin-kubernetes-common';
|
||||
import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';
|
||||
import { OAuthApi } from '@backstage/core-plugin-api';
|
||||
import { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common';
|
||||
@@ -33,6 +32,7 @@ import { V1Pod } from '@kubernetes/client-node';
|
||||
import { V1ReplicaSet } from '@kubernetes/client-node';
|
||||
import { V1Service } from '@kubernetes/client-node';
|
||||
import { V1StatefulSet } from '@kubernetes/client-node';
|
||||
import { WorkloadsByEntityRequest } from '@backstage/plugin-kubernetes-common';
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "ClusterProps" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "Cluster" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
@@ -248,9 +248,7 @@ export interface KubernetesApi {
|
||||
>;
|
||||
// (undocumented)
|
||||
getCustomObjectsByEntity(
|
||||
auth: KubernetesRequestAuth,
|
||||
customResources: CustomResourceMatcher[],
|
||||
entity: Entity,
|
||||
request: CustomObjectsByEntityRequest,
|
||||
): Promise<ObjectsByEntityResponse>;
|
||||
// (undocumented)
|
||||
getObjectsByEntity(
|
||||
@@ -258,8 +256,7 @@ export interface KubernetesApi {
|
||||
): Promise<ObjectsByEntityResponse>;
|
||||
// (undocumented)
|
||||
getWorkloadsByEntity(
|
||||
auth: KubernetesRequestAuth,
|
||||
entity: Entity,
|
||||
request: WorkloadsByEntityRequest,
|
||||
): Promise<ObjectsByEntityResponse>;
|
||||
}
|
||||
|
||||
@@ -318,9 +315,7 @@ export class KubernetesBackendClient implements KubernetesApi {
|
||||
>;
|
||||
// (undocumented)
|
||||
getCustomObjectsByEntity(
|
||||
auth: KubernetesRequestAuth,
|
||||
customResources: CustomResourceMatcher[],
|
||||
entity: Entity,
|
||||
request: CustomObjectsByEntityRequest,
|
||||
): Promise<ObjectsByEntityResponse>;
|
||||
// (undocumented)
|
||||
getObjectsByEntity(
|
||||
@@ -328,8 +323,7 @@ export class KubernetesBackendClient implements KubernetesApi {
|
||||
): Promise<ObjectsByEntityResponse>;
|
||||
// (undocumented)
|
||||
getWorkloadsByEntity(
|
||||
auth: KubernetesRequestAuth,
|
||||
entity: Entity,
|
||||
request: WorkloadsByEntityRequest,
|
||||
): Promise<ObjectsByEntityResponse>;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
import { KubernetesApi } from './types';
|
||||
import {
|
||||
KubernetesRequestAuth,
|
||||
KubernetesRequestBody,
|
||||
ObjectsByEntityResponse,
|
||||
CustomResourceMatcher,
|
||||
WorkloadsByEntityRequest,
|
||||
CustomObjectsByEntityRequest,
|
||||
} from '@backstage/plugin-kubernetes-common';
|
||||
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { Entity, stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { stringifyEntityRef } from '@backstage/catalog-model';
|
||||
|
||||
export class KubernetesBackendClient implements KubernetesApi {
|
||||
private readonly discoveryApi: DiscoveryApi;
|
||||
@@ -79,24 +79,21 @@ export class KubernetesBackendClient implements KubernetesApi {
|
||||
}
|
||||
|
||||
async getWorkloadsByEntity(
|
||||
auth: KubernetesRequestAuth,
|
||||
entity: Entity,
|
||||
request: WorkloadsByEntityRequest,
|
||||
): Promise<ObjectsByEntityResponse> {
|
||||
return await this.postRequired('/resources/workloads/query', {
|
||||
auth,
|
||||
entityRef: stringifyEntityRef(entity),
|
||||
auth: request.auth,
|
||||
entityRef: stringifyEntityRef(request.entity),
|
||||
});
|
||||
}
|
||||
|
||||
async getCustomObjectsByEntity(
|
||||
auth: KubernetesRequestAuth,
|
||||
customResources: CustomResourceMatcher[],
|
||||
entity: Entity,
|
||||
request: CustomObjectsByEntityRequest,
|
||||
): Promise<ObjectsByEntityResponse> {
|
||||
return await this.postRequired(`/resources/custom/query`, {
|
||||
entityRef: stringifyEntityRef(entity),
|
||||
auth,
|
||||
customResources,
|
||||
entityRef: stringifyEntityRef(request.entity),
|
||||
auth: request.auth,
|
||||
customResources: request.customResources,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,13 +15,12 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
KubernetesRequestAuth,
|
||||
KubernetesRequestBody,
|
||||
ObjectsByEntityResponse,
|
||||
CustomResourceMatcher,
|
||||
WorkloadsByEntityRequest,
|
||||
CustomObjectsByEntityRequest,
|
||||
} from '@backstage/plugin-kubernetes-common';
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
export const kubernetesApiRef = createApiRef<KubernetesApi>({
|
||||
id: 'plugin.kubernetes.service',
|
||||
@@ -39,12 +38,9 @@ export interface KubernetesApi {
|
||||
}[]
|
||||
>;
|
||||
getWorkloadsByEntity(
|
||||
auth: KubernetesRequestAuth,
|
||||
entity: Entity,
|
||||
request: WorkloadsByEntityRequest,
|
||||
): Promise<ObjectsByEntityResponse>;
|
||||
getCustomObjectsByEntity(
|
||||
auth: KubernetesRequestAuth,
|
||||
customResources: CustomResourceMatcher[],
|
||||
entity: Entity,
|
||||
request: CustomObjectsByEntityRequest,
|
||||
): Promise<ObjectsByEntityResponse>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user