feat: Create SetupHttpHandler

This handler allows users to set up servers with a pod
and without having to enable public access first
This commit is contained in:
Joachim Van Herwegen
2021-09-15 16:52:16 +02:00
parent 02df2905de
commit 4e1a2f5981
11 changed files with 1094 additions and 489 deletions

View File

@@ -26,9 +26,9 @@ export class GeneratedPodManager implements PodManager {
* Creates a new pod, pre-populating it with the resources created by the data generator.
* Will throw an error if the given identifier already has a resource.
*/
public async createPod(identifier: ResourceIdentifier, settings: PodSettings): Promise<void> {
public async createPod(identifier: ResourceIdentifier, settings: PodSettings, overwrite: boolean): Promise<void> {
this.logger.info(`Creating pod ${identifier.path}`);
if (await this.store.resourceExists(identifier)) {
if (!overwrite && await this.store.resourceExists(identifier)) {
throw new ConflictHttpError(`There already is a resource at ${identifier.path}`);
}

View File

@@ -10,6 +10,7 @@ export interface PodManager {
* Creates a pod for the given settings.
* @param identifier - Root identifier indicating where the pod should be created.
* @param settings - Settings describing the pod.
* @param overwrite - If the creation should proceed if there already is a resource there.
*/
createPod: (identifier: ResourceIdentifier, settings: PodSettings) => Promise<void>;
createPod: (identifier: ResourceIdentifier, settings: PodSettings, overwrite: boolean) => Promise<void>;
}