Replace EntityClient with CatalogClient
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -89,7 +89,6 @@ import {
|
||||
Publishers,
|
||||
CreateReactAppTemplater,
|
||||
Templaters,
|
||||
CatalogEntityClient,
|
||||
} from '@backstage/plugin-scaffolder-backend';
|
||||
import { SingleHostDiscovery } from '@backstage/backend-common';
|
||||
import type { PluginEnvironment } from '../types';
|
||||
@@ -114,7 +113,6 @@ export default async function createPlugin({
|
||||
const dockerClient = new Docker();
|
||||
|
||||
const discovery = SingleHostDiscovery.fromConfig(config);
|
||||
const entityClient = new CatalogEntityClient({ discovery });
|
||||
const catalogClient = new CatalogClient({ discoveryApi: discovery });
|
||||
|
||||
return await createRouter({
|
||||
@@ -124,7 +122,6 @@ export default async function createPlugin({
|
||||
logger,
|
||||
config,
|
||||
dockerClient,
|
||||
entityClient,
|
||||
database,
|
||||
catalogClient,
|
||||
});
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^0.5.3",
|
||||
"@backstage/catalog-client": "^0.3.6",
|
||||
"@backstage/catalog-model": "^0.7.1",
|
||||
"@backstage/config": "^0.1.2",
|
||||
"@backstage/plugin-app-backend": "^0.3.7",
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
Publishers,
|
||||
CreateReactAppTemplater,
|
||||
Templaters,
|
||||
CatalogEntityClient,
|
||||
} from '@backstage/plugin-scaffolder-backend';
|
||||
import { SingleHostDiscovery } from '@backstage/backend-common';
|
||||
import type { PluginEnvironment } from '../types';
|
||||
@@ -46,7 +45,6 @@ export default async function createPlugin({
|
||||
const dockerClient = new Docker();
|
||||
|
||||
const discovery = SingleHostDiscovery.fromConfig(config);
|
||||
const entityClient = new CatalogEntityClient({ discovery });
|
||||
const catalogClient = new CatalogClient({ discoveryApi: discovery });
|
||||
|
||||
return await createRouter({
|
||||
@@ -56,7 +54,6 @@ export default async function createPlugin({
|
||||
logger,
|
||||
config,
|
||||
dockerClient,
|
||||
entityClient,
|
||||
database,
|
||||
catalogClient,
|
||||
});
|
||||
|
||||
@@ -16,23 +16,13 @@
|
||||
|
||||
import { TemplateEntityV1alpha1 } from '@backstage/catalog-model';
|
||||
import { CatalogClient } from '@backstage/catalog-client';
|
||||
import {
|
||||
ConflictError,
|
||||
NotFoundError,
|
||||
PluginEndpointDiscovery,
|
||||
} from '@backstage/backend-common';
|
||||
import { ConflictError, NotFoundError } from '@backstage/backend-common';
|
||||
|
||||
/**
|
||||
* A catalog client tailored for reading out entity data from the catalog.
|
||||
*/
|
||||
export class CatalogEntityClient {
|
||||
private readonly catalogClient: CatalogClient;
|
||||
|
||||
constructor(options: { discovery: PluginEndpointDiscovery }) {
|
||||
this.catalogClient = new CatalogClient({
|
||||
discoveryApi: options.discovery,
|
||||
});
|
||||
}
|
||||
constructor(private readonly catalogClient: CatalogClient) {}
|
||||
|
||||
/**
|
||||
* Looks up a single template using a template name.
|
||||
|
||||
@@ -58,7 +58,6 @@ export interface RouterOptions {
|
||||
logger: Logger;
|
||||
config: Config;
|
||||
dockerClient: Docker;
|
||||
entityClient: CatalogEntityClient;
|
||||
database: PluginDatabaseManager;
|
||||
catalogClient: CatalogClient;
|
||||
}
|
||||
@@ -76,7 +75,6 @@ export async function createRouter(
|
||||
logger: parentLogger,
|
||||
config,
|
||||
dockerClient,
|
||||
entityClient,
|
||||
database,
|
||||
catalogClient,
|
||||
} = options;
|
||||
@@ -84,6 +82,7 @@ export async function createRouter(
|
||||
const logger = parentLogger.child({ plugin: 'scaffolder' });
|
||||
const workingDirectory = await getWorkingDirectory(config, logger);
|
||||
const jobProcessor = await JobProcessor.fromConfig({ config, logger });
|
||||
const entityClient = new CatalogEntityClient(catalogClient);
|
||||
|
||||
const databaseTaskStore = await DatabaseTaskStore.create(
|
||||
await database.getClient(),
|
||||
|
||||
@@ -1872,7 +1872,6 @@
|
||||
"@backstage/catalog-model" "^0.7.1"
|
||||
"@backstage/core" "^0.6.1"
|
||||
"@backstage/plugin-catalog-react" "^0.0.3"
|
||||
"@backstage/plugin-scaffolder" "^0.5.0"
|
||||
"@backstage/theme" "^0.2.3"
|
||||
"@material-ui/core" "^4.11.0"
|
||||
"@material-ui/icons" "^4.9.1"
|
||||
@@ -1895,7 +1894,6 @@
|
||||
"@backstage/catalog-model" "^0.7.1"
|
||||
"@backstage/core" "^0.6.1"
|
||||
"@backstage/plugin-catalog-react" "^0.0.3"
|
||||
"@backstage/plugin-scaffolder" "^0.5.0"
|
||||
"@backstage/theme" "^0.2.3"
|
||||
"@material-ui/core" "^4.11.0"
|
||||
"@material-ui/icons" "^4.9.1"
|
||||
@@ -17525,6 +17523,11 @@ luxon@1.25.0, luxon@^1.25.0:
|
||||
resolved "https://registry.npmjs.org/luxon/-/luxon-1.25.0.tgz#d86219e90bc0102c0eb299d65b2f5e95efe1fe72"
|
||||
integrity sha512-hEgLurSH8kQRjY6i4YLey+mcKVAWXbDNlZRmM6AgWDJ1cY3atl8Ztf5wEY7VBReFbmGnwQPz7KYJblL8B2k0jQ==
|
||||
|
||||
luxon@^1.26.0:
|
||||
version "1.26.0"
|
||||
resolved "https://registry.npmjs.org/luxon/-/luxon-1.26.0.tgz#d3692361fda51473948252061d0f8561df02b578"
|
||||
integrity sha512-+V5QIQ5f6CDXQpWNICELwjwuHdqeJM1UenlZWx5ujcRMc9venvluCjFb4t5NYLhb6IhkbMVOxzVuOqkgMxee2A==
|
||||
|
||||
macos-release@^2.2.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f"
|
||||
|
||||
Reference in New Issue
Block a user