summaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react/src/api/ControlLoopService.js
diff options
context:
space:
mode:
Diffstat (limited to 'gui-clamp/ui-react/src/api/ControlLoopService.js')
-rw-r--r--gui-clamp/ui-react/src/api/ControlLoopService.js53
1 files changed, 50 insertions, 3 deletions
diff --git a/gui-clamp/ui-react/src/api/ControlLoopService.js b/gui-clamp/ui-react/src/api/ControlLoopService.js
index 30b0522..1f3cbed 100644
--- a/gui-clamp/ui-react/src/api/ControlLoopService.js
+++ b/gui-clamp/ui-react/src/api/ControlLoopService.js
@@ -68,11 +68,37 @@ export default class ControlLoopService {
const response = await fetch(windowLocationPathname +
'/restservices/clds/v2/toscaControlLoop/getToscaTemplate' + '?' + (new URLSearchParams(params)));
- if (!response.ok) {
- const message = `An error has occurred: ${response.status}`;
- throw new Error(message);
+ const data = await response;
+
+ return data;
+ }
+
+ static async deleteToscaTemplate(name, version, windowLocationPathname) {
+ const params = {
+ name: name,
+ version: version
}
+ const response = await fetch(windowLocationPathname +
+ '/restservices/clds/v2/toscaControlLoop/decommissionToscaTemplate' + '?' + (new URLSearchParams(params)),
+ {
+ method: 'DELETE'
+ });
+
+ this.checkResponseForError(response);
+
+ const data = await response;
+
+ return data;
+ }
+
+ static async getToscaControlLoopDefinitions(windowLocationPathname) {
+
+ const response = await fetch(windowLocationPathname +
+ '/restservices/clds/v2/toscaControlLoop/getElementDefinitions');
+
+ this.checkResponseForError(response);
+
const data = await response;
return data;
@@ -92,4 +118,25 @@ export default class ControlLoopService {
return response
}
+
+ static async getToscaServiceTemplateSchema(section, windowLocationPathName) {
+
+ const params = {
+ section: section
+ }
+
+ const response = await fetch(windowLocationPathName +
+ '/restservices/clds/v2/toscaControlLoop/getJsonSchema' + '?' + (new URLSearchParams(params)));
+
+ this.checkResponseForError(response);
+
+ return response;
+ }
+
+ static checkResponseForError (response) {
+ if (!response.ok) {
+ const message = `An error has occurred: ${response.status}`;
+ throw new Error(message);
+ }
+ }
}