backend-common: Move PluginEndpointDiscovery type to backend-plugin-api
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/backend-plugin-api': patch
|
||||
'@backstage/backend-common': patch
|
||||
---
|
||||
|
||||
Moved `PluginEndpointDiscovery` type from backend-common to backend-plugin-api.
|
||||
@@ -30,6 +30,7 @@ import { KubeConfig } from '@kubernetes/client-node';
|
||||
import { LoadConfigOptionsRemote } from '@backstage/config-loader';
|
||||
import { Logger } from 'winston';
|
||||
import { MergeResult } from 'isomorphic-git';
|
||||
import { DiscoveryService as PluginEndpointDiscovery } from '@backstage/backend-plugin-api';
|
||||
import { PushResult } from 'isomorphic-git';
|
||||
import { Readable } from 'stream';
|
||||
import { ReadCommitResult } from 'isomorphic-git';
|
||||
@@ -530,11 +531,7 @@ export interface PluginDatabaseManager {
|
||||
};
|
||||
}
|
||||
|
||||
// @public
|
||||
export type PluginEndpointDiscovery = {
|
||||
getBaseUrl(pluginId: string): Promise<string>;
|
||||
getExternalBaseUrl(pluginId: string): Promise<string>;
|
||||
};
|
||||
export { PluginEndpointDiscovery };
|
||||
|
||||
// @public
|
||||
export type ReaderFactory = (options: {
|
||||
|
||||
@@ -14,50 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The PluginEndpointDiscovery is used to provide a mechanism for backend
|
||||
* plugins to discover the endpoints for itself or other backend plugins.
|
||||
*
|
||||
* The purpose of the discovery API is to allow for many different deployment
|
||||
* setups and routing methods through a central configuration, instead
|
||||
* of letting each individual plugin manage that configuration.
|
||||
*
|
||||
* Implementations of the discovery API can be as simple as a URL pattern
|
||||
* using the pluginId, but could also have overrides for individual plugins,
|
||||
* or query a separate discovery service.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type PluginEndpointDiscovery = {
|
||||
/**
|
||||
* Returns the internal HTTP base URL for a given plugin, without a trailing slash.
|
||||
*
|
||||
* The returned URL should point to an internal endpoint for the plugin, with
|
||||
* the shortest route possible. The URL should be used for service-to-service
|
||||
* communication within a Backstage backend deployment.
|
||||
*
|
||||
* This method must always be called just before making a request, as opposed to
|
||||
* fetching the URL when constructing an API client. That is to ensure that more
|
||||
* flexible routing patterns can be supported.
|
||||
*
|
||||
* For example, asking for the URL for `catalog` may return something
|
||||
* like `http://10.1.2.3/api/catalog`
|
||||
*/
|
||||
getBaseUrl(pluginId: string): Promise<string>;
|
||||
|
||||
/**
|
||||
* Returns the external HTTP base backend URL for a given plugin, without a trailing slash.
|
||||
*
|
||||
* The returned URL should point to an external endpoint for the plugin, such that
|
||||
* it is reachable from the Backstage frontend and other external services. The returned
|
||||
* URL should be usable for example as a callback / webhook URL.
|
||||
*
|
||||
* The returned URL should be stable and in general not change unless other static
|
||||
* or external configuration is changed. Changes should not come as a surprise
|
||||
* to an operator of the Backstage backend.
|
||||
*
|
||||
* For example, asking for the URL for `catalog` may return something
|
||||
* like `https://backstage.example.com/api/catalog`
|
||||
*/
|
||||
getExternalBaseUrl(pluginId: string): Promise<string>;
|
||||
};
|
||||
export type { DiscoveryService as PluginEndpointDiscovery } from '@backstage/backend-plugin-api';
|
||||
|
||||
@@ -12,7 +12,6 @@ import { PermissionAuthorizer } from '@backstage/plugin-permission-common';
|
||||
import { PermissionEvaluator } from '@backstage/plugin-permission-common';
|
||||
import { PluginCacheManager } from '@backstage/backend-common';
|
||||
import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
||||
import { Readable } from 'stream';
|
||||
import { TokenManager } from '@backstage/backend-common';
|
||||
@@ -169,11 +168,14 @@ export type DatabaseService = PluginDatabaseManager;
|
||||
// @public (undocumented)
|
||||
const databaseServiceRef: ServiceRef<PluginDatabaseManager, 'plugin'>;
|
||||
|
||||
// @public (undocumented)
|
||||
export type DiscoveryService = PluginEndpointDiscovery;
|
||||
// @public
|
||||
export type DiscoveryService = {
|
||||
getBaseUrl(pluginId: string): Promise<string>;
|
||||
getExternalBaseUrl(pluginId: string): Promise<string>;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
const discoveryServiceRef: ServiceRef<PluginEndpointDiscovery, 'plugin'>;
|
||||
const discoveryServiceRef: ServiceRef<DiscoveryService, 'plugin'>;
|
||||
|
||||
// @public
|
||||
export type ExtensionPoint<T> = {
|
||||
|
||||
@@ -15,10 +15,54 @@
|
||||
*/
|
||||
|
||||
import { createServiceRef } from '../system/types';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
|
||||
/** @public */
|
||||
export type DiscoveryService = PluginEndpointDiscovery;
|
||||
/**
|
||||
* The DiscoveryService is used to provide a mechanism for backend
|
||||
* plugins to discover the endpoints for itself or other backend plugins.
|
||||
*
|
||||
* The purpose of the discovery API is to allow for many different deployment
|
||||
* setups and routing methods through a central configuration, instead
|
||||
* of letting each individual plugin manage that configuration.
|
||||
*
|
||||
* Implementations of the discovery API can be as simple as a URL pattern
|
||||
* using the pluginId, but could also have overrides for individual plugins,
|
||||
* or query a separate discovery service.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type DiscoveryService = {
|
||||
/**
|
||||
* Returns the internal HTTP base URL for a given plugin, without a trailing slash.
|
||||
*
|
||||
* The returned URL should point to an internal endpoint for the plugin, with
|
||||
* the shortest route possible. The URL should be used for service-to-service
|
||||
* communication within a Backstage backend deployment.
|
||||
*
|
||||
* This method must always be called just before making a request, as opposed to
|
||||
* fetching the URL when constructing an API client. That is to ensure that more
|
||||
* flexible routing patterns can be supported.
|
||||
*
|
||||
* For example, asking for the URL for `catalog` may return something
|
||||
* like `http://10.1.2.3/api/catalog`
|
||||
*/
|
||||
getBaseUrl(pluginId: string): Promise<string>;
|
||||
|
||||
/**
|
||||
* Returns the external HTTP base backend URL for a given plugin, without a trailing slash.
|
||||
*
|
||||
* The returned URL should point to an external endpoint for the plugin, such that
|
||||
* it is reachable from the Backstage frontend and other external services. The returned
|
||||
* URL should be usable for example as a callback / webhook URL.
|
||||
*
|
||||
* The returned URL should be stable and in general not change unless other static
|
||||
* or external configuration is changed. Changes should not come as a surprise
|
||||
* to an operator of the Backstage backend.
|
||||
*
|
||||
* For example, asking for the URL for `catalog` may return something
|
||||
* like `https://backstage.example.com/api/catalog`
|
||||
*/
|
||||
getExternalBaseUrl(pluginId: string): Promise<string>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
||||
Reference in New Issue
Block a user