diff options
Diffstat (limited to 'opendc-web/opendc-web-ui/src/api/routes/topologies.js')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/api/routes/topologies.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-ui/src/api/routes/topologies.js b/opendc-web/opendc-web-ui/src/api/routes/topologies.js new file mode 100644 index 00000000..a8f0d6b1 --- /dev/null +++ b/opendc-web/opendc-web-ui/src/api/routes/topologies.js @@ -0,0 +1,42 @@ +import { deleteById, getById } from './util' +import { sendRequest } from '../index' + +export function addTopology(topology) { + return sendRequest({ + path: '/projects/{projectId}/topologies', + method: 'POST', + parameters: { + body: { + topology, + }, + path: { + projectId: topology.projectId, + }, + query: {}, + }, + }) +} + +export function getTopology(topologyId) { + return getById('/topologies/{topologyId}', { topologyId }) +} + +export function updateTopology(topology) { + return sendRequest({ + path: '/topologies/{topologyId}', + method: 'PUT', + parameters: { + body: { + topology, + }, + path: { + topologyId: topology._id, + }, + query: {}, + }, + }) +} + +export function deleteTopology(topologyId) { + return deleteById('/topologies/{topologyId}', { topologyId }) +} |
