-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
268 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
backend/src/main/java/com/bakdata/conquery/resources/admin/rest/ConfigApiProcessor.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
backend/src/main/java/com/bakdata/conquery/resources/admin/rest/ConfigApiResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.bakdata.conquery.resources.admin.rest; | ||
|
||
import java.util.List; | ||
import jakarta.inject.Inject; | ||
|
||
import com.bakdata.conquery.commands.ManagerNode; | ||
import com.bakdata.conquery.models.api.openapi.ConfigApi; | ||
import com.bakdata.conquery.models.config.FormBackendConfig; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor(onConstructor_ = @Inject) | ||
public class ConfigApiResource implements ConfigApi { | ||
|
||
private final ManagerNode managerNode; | ||
|
||
@Override | ||
public String deleteFormBackend(String configId) { | ||
String providerName = managerNode.getFormScanner().unregisterFrontendFormConfigProvider(configId).getProviderName(); | ||
try { | ||
managerNode.getFormScanner().execute(null, null); | ||
} | ||
catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
return providerName; | ||
} | ||
|
||
@Override | ||
public List<String> listFormBackends() { | ||
return List.copyOf(managerNode.getFormScanner().listFrontendFormConfigProviders()); | ||
} | ||
|
||
@Override | ||
public String registerFormBackend(FormBackendConfig pluginConfig) { | ||
pluginConfig.initialize(managerNode); | ||
try { | ||
managerNode.getFormScanner().execute(null, null); | ||
} | ||
catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
return pluginConfig.getId(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,10 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", | ||
"version": "1.0.7", | ||
"title": "Swagger Petstore", | ||
"termsOfService": "http://swagger.io/terms/", | ||
"contact": { | ||
"email": "[email protected]" | ||
}, | ||
"license": { | ||
"name": "Apache 2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
} | ||
"description": "Partial description of the conquery admin REST api", | ||
"version": "1.0.0", | ||
"title": "Conquery Admin" | ||
}, | ||
"host": "petstore.swagger.io", | ||
"basePath": "/admin", | ||
"tags": [ | ||
{ | ||
|
@@ -29,11 +20,10 @@ | |
"/config/plugins/form-backend": { | ||
"post": { | ||
"tags": [ | ||
"plugin" | ||
"config" | ||
], | ||
"summary": "adds a form backend config", | ||
"description": "", | ||
"operationId": "addPlugin", | ||
"summary": "adds a form backend configurations", | ||
"operationId": "registerFormBackend", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
|
@@ -46,73 +36,125 @@ | |
"name": "pluginConfig", | ||
"schema": { | ||
"$ref": "#/definitions/FormBackendConfig" | ||
}, | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "successful operation", | ||
"schema": { | ||
"type": "string", | ||
"description": "Id of the registered form backend configuration" | ||
} | ||
} | ||
} | ||
}, | ||
"get": { | ||
"tags": [ | ||
"config" | ||
], | ||
"summary": "lists all registered form backend configurations", | ||
"operationId": "listFormBackends", | ||
"produces": [ | ||
"application/json" | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "successful operation", | ||
"schema": { | ||
"$ref": "#/definitions/ApiResponse" | ||
"description": "Ids of the registered form providers", | ||
"type":"array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"security": [ | ||
} | ||
} | ||
}, | ||
"/config/plugins/form-backend/{configId}":{ | ||
"delete": { | ||
"tags": [ | ||
"config" | ||
], | ||
"summary": "unegister form backend configuration", | ||
"operationId": "deleteFormBackend", | ||
"parameters": [ | ||
{ | ||
"api_key": [ | ||
"write:pets", | ||
"read:pets" | ||
] | ||
"in": "path", | ||
"name": "configId", | ||
"type": "string", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "successful operation", | ||
"schema": { | ||
"type": "string", | ||
"description": "Id of the deleted form backend configuration" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"securityDefinitions": { | ||
"api_key": { | ||
"type": "apiKey", | ||
"name": "api_key", | ||
"in": "header" | ||
} | ||
}, | ||
"definitions": { | ||
"ApiResponse": { | ||
"FormBackendConfig": { | ||
"type": "object", | ||
"x-discriminator-value": "type", | ||
"properties": { | ||
"code": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"type": { | ||
"type": "string" | ||
}, | ||
"message": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"Test": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"format": "int64" | ||
}, | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"FormBackendConfig": { | ||
"type": "object", | ||
"x-discriminator-value": "type", | ||
"properties": { | ||
"type": { | ||
"type": "string" | ||
}, | ||
"baseURI": { | ||
"type":"string", | ||
"format": "uri" | ||
}, | ||
"conqueryApiUrl": { | ||
"type":"string", | ||
"format": "uri" | ||
}, | ||
"formConfigPath":{ | ||
"type": "string", | ||
"format": "uri", | ||
"default": "form-config" | ||
}, | ||
"postFormPath":{ | ||
"type": "string", | ||
"format": "uri", | ||
"default": "task" | ||
}, | ||
"statusTemplatePath":{ | ||
"type": "string", | ||
"format": "uri", | ||
"default": "task/{task-id}" | ||
}, | ||
"cancelTaskPath":{ | ||
"type": "string", | ||
"format": "uri", | ||
"default": "task/{task-id}/cancel" | ||
}, | ||
"healthCheckPath":{ | ||
"type": "string", | ||
"format": "uri", | ||
"default": "health" | ||
}, | ||
"versionPath":{ | ||
"type": "string", | ||
"format": "uri", | ||
"default": "version" | ||
} | ||
}, | ||
"required": [ | ||
"type" | ||
"type", | ||
"id", | ||
"baseURI", | ||
"conqueryApiUrl" | ||
] | ||
} | ||
} | ||
|
Oops, something went wrong.