refactor: remove redundant ClusterDetails subtypes

Signed-off-by: Jamie Klassen <jklassen@vmware.com>
This commit is contained in:
Jamie Klassen
2023-09-05 16:14:10 -04:00
parent 7982094539
commit 8dd179ac2f
6 changed files with 22 additions and 44 deletions
+7 -13
View File
@@ -41,9 +41,6 @@ export class AwsIamKubernetesAuthTranslator
): Promise<ClusterDetails>;
}
// @public (undocumented)
export interface AzureClusterDetails extends ClusterDetails {}
// @public (undocumented)
export class AzureIdentityKubernetesAuthTranslator
implements KubernetesAuthTranslator
@@ -51,8 +48,8 @@ export class AzureIdentityKubernetesAuthTranslator
constructor(logger: Logger, tokenCredential?: TokenCredential);
// (undocumented)
decorateClusterDetailsWithAuth(
clusterDetails: AzureClusterDetails,
): Promise<AzureClusterDetails>;
clusterDetails: ClusterDetails,
): Promise<ClusterDetails>;
}
// @public (undocumented)
@@ -123,18 +120,15 @@ export interface FetchResponseWrapper {
responses: FetchResponse[];
}
// @public (undocumented)
export interface GKEClusterDetails extends ClusterDetails {}
// @public (undocumented)
export class GoogleKubernetesAuthTranslator
implements KubernetesAuthTranslator
{
// (undocumented)
decorateClusterDetailsWithAuth(
clusterDetails: GKEClusterDetails,
clusterDetails: ClusterDetails,
authConfig: KubernetesRequestAuth,
): Promise<GKEClusterDetails>;
): Promise<ClusterDetails>;
}
// @public (undocumented)
@@ -143,8 +137,8 @@ export class GoogleServiceAccountAuthTranslator
{
// (undocumented)
decorateClusterDetailsWithAuth(
clusterDetails: GKEClusterDetails,
): Promise<GKEClusterDetails>;
clusterDetails: ClusterDetails,
): Promise<ClusterDetails>;
}
// @public
@@ -398,7 +392,7 @@ export class NoopKubernetesAuthTranslator implements KubernetesAuthTranslator {
// @public (undocumented)
export interface ObjectFetchParams {
// (undocumented)
clusterDetails: GKEClusterDetails | ClusterDetails;
clusterDetails: ClusterDetails;
// (undocumented)
customResources: CustomResource[];
// (undocumented)
@@ -19,11 +19,7 @@ import { ForwardedError } from '@backstage/errors';
import * as container from '@google-cloud/container';
import { Duration } from 'luxon';
import { runPeriodically } from '../service/runPeriodically';
import {
ClusterDetails,
GKEClusterDetails,
KubernetesClustersSupplier,
} from '../types/types';
import { ClusterDetails, KubernetesClustersSupplier } from '../types/types';
interface MatchResourceLabelEntry {
key: string;
@@ -43,7 +39,7 @@ export class GkeClusterLocator implements KubernetesClustersSupplier {
constructor(
private readonly options: GkeClusterLocatorOptions,
private readonly client: container.v1.ClusterManagerClient,
private clusterDetails: GKEClusterDetails[] | undefined = undefined,
private clusterDetails: ClusterDetails[] | undefined = undefined,
private hasClusterDetails: boolean = false,
) {}
@@ -16,7 +16,7 @@
import { Logger } from 'winston';
import { KubernetesAuthTranslator } from './types';
import { AzureClusterDetails } from '../types/types';
import { ClusterDetails } from '../types/types';
import {
AccessToken,
DefaultAzureCredential,
@@ -41,9 +41,9 @@ export class AzureIdentityKubernetesAuthTranslator
) {}
async decorateClusterDetailsWithAuth(
clusterDetails: AzureClusterDetails,
): Promise<AzureClusterDetails> {
const clusterDetailsWithAuthToken: AzureClusterDetails = Object.assign(
clusterDetails: ClusterDetails,
): Promise<ClusterDetails> {
const clusterDetailsWithAuthToken: ClusterDetails = Object.assign(
{},
clusterDetails,
);
@@ -15,7 +15,7 @@
*/
import { KubernetesAuthTranslator } from './types';
import { GKEClusterDetails } from '../types/types';
import { ClusterDetails } from '../types/types';
import { KubernetesRequestAuth } from '@backstage/plugin-kubernetes-common';
/**
@@ -26,10 +26,10 @@ export class GoogleKubernetesAuthTranslator
implements KubernetesAuthTranslator
{
async decorateClusterDetailsWithAuth(
clusterDetails: GKEClusterDetails,
clusterDetails: ClusterDetails,
authConfig: KubernetesRequestAuth,
): Promise<GKEClusterDetails> {
const clusterDetailsWithAuthToken: GKEClusterDetails = Object.assign(
): Promise<ClusterDetails> {
const clusterDetailsWithAuthToken: ClusterDetails = Object.assign(
{},
clusterDetails,
);
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { KubernetesAuthTranslator } from './types';
import { GKEClusterDetails } from '../types/types';
import { ClusterDetails } from '../types/types';
import * as container from '@google-cloud/container';
/**
@@ -25,9 +25,9 @@ export class GoogleServiceAccountAuthTranslator
implements KubernetesAuthTranslator
{
async decorateClusterDetailsWithAuth(
clusterDetails: GKEClusterDetails,
): Promise<GKEClusterDetails> {
const clusterDetailsWithAuthToken: GKEClusterDetails = Object.assign(
clusterDetails: ClusterDetails,
): Promise<ClusterDetails> {
const clusterDetailsWithAuthToken: ClusterDetails = Object.assign(
{},
clusterDetails,
);
+1 -13
View File
@@ -33,7 +33,7 @@ import { Config } from '@backstage/config';
*/
export interface ObjectFetchParams {
serviceId: string;
clusterDetails: GKEClusterDetails | ClusterDetails;
clusterDetails: ClusterDetails;
objectTypesToFetch: Set<ObjectToFetch>;
labelSelector: string;
customResources: CustomResource[];
@@ -208,18 +208,6 @@ export interface ClusterDetails {
authMetadata?: Record<string, string>;
}
/**
*
* @public
*/
export interface GKEClusterDetails extends ClusterDetails {}
/**
*
* @public
*/
export interface AzureClusterDetails extends ClusterDetails {}
/**
*
* @public