diff options
Diffstat (limited to 'src/api/routes')
| -rw-r--r-- | src/api/routes/datacenters.js | 34 | ||||
| -rw-r--r-- | src/api/routes/experiments.js | 20 | ||||
| -rw-r--r-- | src/api/routes/jobs.js | 4 | ||||
| -rw-r--r-- | src/api/routes/paths.js | 36 | ||||
| -rw-r--r-- | src/api/routes/room-types.js | 6 | ||||
| -rw-r--r-- | src/api/routes/rooms.js | 62 | ||||
| -rw-r--r-- | src/api/routes/schedulers.js | 4 | ||||
| -rw-r--r-- | src/api/routes/sections.js | 4 | ||||
| -rw-r--r-- | src/api/routes/simulations.js | 90 | ||||
| -rw-r--r-- | src/api/routes/specifications.js | 30 | ||||
| -rw-r--r-- | src/api/routes/tiles.js | 160 | ||||
| -rw-r--r-- | src/api/routes/token-signin.js | 12 | ||||
| -rw-r--r-- | src/api/routes/traces.js | 6 | ||||
| -rw-r--r-- | src/api/routes/users.js | 104 | ||||
| -rw-r--r-- | src/api/routes/util.js | 56 |
15 files changed, 316 insertions, 312 deletions
diff --git a/src/api/routes/datacenters.js b/src/api/routes/datacenters.js index df621a62..20cf4935 100644 --- a/src/api/routes/datacenters.js +++ b/src/api/routes/datacenters.js @@ -1,26 +1,26 @@ -import {sendRequest} from "../index"; -import {getById} from "./util"; +import { sendRequest } from "../index"; +import { getById } from "./util"; export function getDatacenter(datacenterId) { - return getById("/datacenters/{datacenterId}", {datacenterId}); + return getById("/datacenters/{datacenterId}", { datacenterId }); } export function getRoomsOfDatacenter(datacenterId) { - return getById("/datacenters/{datacenterId}/rooms", {datacenterId}); + return getById("/datacenters/{datacenterId}/rooms", { datacenterId }); } export function addRoomToDatacenter(room) { - return sendRequest({ - path: "/datacenters/{datacenterId}/rooms", - method: "POST", - parameters: { - body: { - room - }, - path: { - datacenterId: room.datacenterId - }, - query: {} - } - }); + return sendRequest({ + path: "/datacenters/{datacenterId}/rooms", + method: "POST", + parameters: { + body: { + room + }, + path: { + datacenterId: room.datacenterId + }, + query: {} + } + }); } diff --git a/src/api/routes/experiments.js b/src/api/routes/experiments.js index 84edae2f..f61698c5 100644 --- a/src/api/routes/experiments.js +++ b/src/api/routes/experiments.js @@ -1,29 +1,33 @@ -import {deleteById, getById} from "./util"; +import { deleteById, getById } from "./util"; export function getExperiment(experimentId) { - return getById("/experiments/{experimentId}", {experimentId}); + return getById("/experiments/{experimentId}", { experimentId }); } export function deleteExperiment(experimentId) { - return deleteById("/experiments/{experimentId}", {experimentId}); + return deleteById("/experiments/{experimentId}", { experimentId }); } export function getLastSimulatedTick(experimentId) { - return getById("/experiments/{experimentId}/last-simulated-tick", {experimentId}); + return getById("/experiments/{experimentId}/last-simulated-tick", { + experimentId + }); } export function getAllMachineStates(experimentId) { - return getById("/experiments/{experimentId}/machine-states", {experimentId}); + return getById("/experiments/{experimentId}/machine-states", { + experimentId + }); } export function getAllRackStates(experimentId) { - return getById("/experiments/{experimentId}/rack-states", {experimentId}); + return getById("/experiments/{experimentId}/rack-states", { experimentId }); } export function getAllRoomStates(experimentId) { - return getById("/experiments/{experimentId}/room-states", {experimentId}); + return getById("/experiments/{experimentId}/room-states", { experimentId }); } export function getAllTaskStates(experimentId) { - return getById("/experiments/{experimentId}/task-states", {experimentId}); + return getById("/experiments/{experimentId}/task-states", { experimentId }); } diff --git a/src/api/routes/jobs.js b/src/api/routes/jobs.js index e96c12ba..355acc32 100644 --- a/src/api/routes/jobs.js +++ b/src/api/routes/jobs.js @@ -1,5 +1,5 @@ -import {getById} from "./util"; +import { getById } from "./util"; export function getTasksOfJob(jobId) { - return getById("/jobs/{jobId}/tasks", {jobId}); + return getById("/jobs/{jobId}/tasks", { jobId }); } diff --git a/src/api/routes/paths.js b/src/api/routes/paths.js index 073cbe7e..78ef7d6e 100644 --- a/src/api/routes/paths.js +++ b/src/api/routes/paths.js @@ -1,30 +1,30 @@ -import {sendRequest} from "../index"; -import {getById} from "./util"; +import { sendRequest } from "../index"; +import { getById } from "./util"; export function getPath(pathId) { - return getById("/paths/{pathId}", {pathId}); + return getById("/paths/{pathId}", { pathId }); } export function getBranchesOfPath(pathId) { - return getById("/paths/{pathId}/branches", {pathId}); + return getById("/paths/{pathId}/branches", { pathId }); } export function branchFromPath(pathId, section) { - return sendRequest({ - path: "/paths/{pathId}/branches", - method: "POST", - parameters: { - body: { - section - }, - path: { - pathId - }, - query: {} - } - }); + return sendRequest({ + path: "/paths/{pathId}/branches", + method: "POST", + parameters: { + body: { + section + }, + path: { + pathId + }, + query: {} + } + }); } export function getSectionsOfPath(pathId) { - return getById("/paths/{pathId}/sections", {pathId}); + return getById("/paths/{pathId}/sections", { pathId }); } diff --git a/src/api/routes/room-types.js b/src/api/routes/room-types.js index 339896d2..8a3eac58 100644 --- a/src/api/routes/room-types.js +++ b/src/api/routes/room-types.js @@ -1,9 +1,9 @@ -import {getAll, getById} from "./util"; +import { getAll, getById } from "./util"; export function getAvailableRoomTypes() { - return getAll("/room-types"); + return getAll("/room-types"); } export function getAllowedObjectsOfRoomType(name) { - return getById("/room-types/{name}/allowed-objects", {name}); + return getById("/room-types/{name}/allowed-objects", { name }); } diff --git a/src/api/routes/rooms.js b/src/api/routes/rooms.js index 1a7a7453..56395d7f 100644 --- a/src/api/routes/rooms.js +++ b/src/api/routes/rooms.js @@ -1,46 +1,46 @@ -import {sendRequest} from "../index"; -import {deleteById, getById} from "./util"; +import { sendRequest } from "../index"; +import { deleteById, getById } from "./util"; export function getRoom(roomId) { - return getById("/rooms/{roomId}", {roomId}); + return getById("/rooms/{roomId}", { roomId }); } export function updateRoom(room) { - return sendRequest({ - path: "/rooms/{roomId}", - method: "PUT", - parameters: { - body: { - room - }, - path: { - roomId: room.id - }, - query: {} - } - }); + return sendRequest({ + path: "/rooms/{roomId}", + method: "PUT", + parameters: { + body: { + room + }, + path: { + roomId: room.id + }, + query: {} + } + }); } export function deleteRoom(roomId) { - return deleteById("/rooms/{roomId}", {roomId}); + return deleteById("/rooms/{roomId}", { roomId }); } export function getTilesOfRoom(roomId) { - return getById("/rooms/{roomId}/tiles", {roomId}); + return getById("/rooms/{roomId}/tiles", { roomId }); } export function addTileToRoom(tile) { - return sendRequest({ - path: "/rooms/{roomId}/tiles", - method: "POST", - parameters: { - body: { - tile - }, - path: { - roomId: tile.roomId - }, - query: {} - } - }); + return sendRequest({ + path: "/rooms/{roomId}/tiles", + method: "POST", + parameters: { + body: { + tile + }, + path: { + roomId: tile.roomId + }, + query: {} + } + }); } diff --git a/src/api/routes/schedulers.js b/src/api/routes/schedulers.js index 246abf32..ea360967 100644 --- a/src/api/routes/schedulers.js +++ b/src/api/routes/schedulers.js @@ -1,5 +1,5 @@ -import {getAll} from "./util"; +import { getAll } from "./util"; export function getAllSchedulers() { - return getAll("/schedulers"); + return getAll("/schedulers"); } diff --git a/src/api/routes/sections.js b/src/api/routes/sections.js index 8d71d768..5e1a077d 100644 --- a/src/api/routes/sections.js +++ b/src/api/routes/sections.js @@ -1,5 +1,5 @@ -import {getById} from "./util"; +import { getById } from "./util"; export function getSection(sectionId) { - return getById("/sections/{sectionId}", {sectionId}); + return getById("/sections/{sectionId}", { sectionId }); } diff --git a/src/api/routes/simulations.js b/src/api/routes/simulations.js index 09f4b6d7..dcb9ac5f 100644 --- a/src/api/routes/simulations.js +++ b/src/api/routes/simulations.js @@ -1,68 +1,70 @@ -import {sendRequest} from "../index"; -import {deleteById, getById} from "./util"; +import { sendRequest } from "../index"; +import { deleteById, getById } from "./util"; export function getSimulation(simulationId) { - return getById("/simulations/{simulationId}", {simulationId}); + return getById("/simulations/{simulationId}", { simulationId }); } export function addSimulation(simulation) { - return sendRequest({ - path: "/simulations", - method: "POST", - parameters: { - body: { - simulation - }, - path: {}, - query: {} - } - }); + return sendRequest({ + path: "/simulations", + method: "POST", + parameters: { + body: { + simulation + }, + path: {}, + query: {} + } + }); } export function updateSimulation(simulation) { - return sendRequest({ - path: "/simulations/{simulationId}", - method: "PUT", - parameters: { - body: { - simulation - }, - path: { - simulationId: simulation.id - }, - query: {} - } - }); + return sendRequest({ + path: "/simulations/{simulationId}", + method: "PUT", + parameters: { + body: { + simulation + }, + path: { + simulationId: simulation.id + }, + query: {} + } + }); } export function deleteSimulation(simulationId) { - return deleteById("/simulations/{simulationId}", {simulationId}); + return deleteById("/simulations/{simulationId}", { simulationId }); } export function getAuthorizationsBySimulation(simulationId) { - return getById("/simulations/{simulationId}/authorizations", {simulationId}); + return getById("/simulations/{simulationId}/authorizations", { + simulationId + }); } export function getPathsOfSimulation(simulationId) { - return getById("/simulations/{simulationId}/paths", {simulationId}); + return getById("/simulations/{simulationId}/paths", { simulationId }); } export function getExperimentsOfSimulation(simulationId) { - return getById("/simulations/{simulationId}/experiments", {simulationId}); + return getById("/simulations/{simulationId}/experiments", { simulationId }); } export function addExperiment(simulationId, experiment) { - return sendRequest({ - path: "/simulations/{simulationId}/experiments", - method: "POST", - parameters: { - body: { - experiment - }, - path: { - simulationId - }, - query: {} - } - }); + return sendRequest({ + path: "/simulations/{simulationId}/experiments", + method: "POST", + parameters: { + body: { + experiment + }, + path: { + simulationId + }, + query: {} + } + }); } diff --git a/src/api/routes/specifications.js b/src/api/routes/specifications.js index 676d9441..0f60b571 100644 --- a/src/api/routes/specifications.js +++ b/src/api/routes/specifications.js @@ -1,57 +1,57 @@ -import {getAll, getById} from "./util"; +import { getAll, getById } from "./util"; export function getAllCoolingItems() { - return getAll("/specifications/cooling-items"); + return getAll("/specifications/cooling-items"); } export function getCoolingItem(id) { - return getById("/specifications/cooling-items/{id}", {id}); + return getById("/specifications/cooling-items/{id}", { id }); } export function getAllCPUs() { - return getAll("/specifications/cpus"); + return getAll("/specifications/cpus"); } export function getCPU(id) { - return getById("/specifications/cpus/{id}", {id}); + return getById("/specifications/cpus/{id}", { id }); } export function getAllFailureModels() { - return getAll("/specifications/failure-models"); + return getAll("/specifications/failure-models"); } export function getFailureModel(id) { - return getById("/specifications/failure-models/{id}", {id}); + return getById("/specifications/failure-models/{id}", { id }); } export function getAllGPUs() { - return getAll("/specifications/gpus"); + return getAll("/specifications/gpus"); } export function getGPU(id) { - return getById("/specifications/gpus/{id}", {id}); + return getById("/specifications/gpus/{id}", { id }); } export function getAllMemories() { - return getAll("/specifications/memories"); + return getAll("/specifications/memories"); } export function getMemory(id) { - return getById("/specifications/memories/{id}", {id}); + return getById("/specifications/memories/{id}", { id }); } export function getAllPSUs() { - return getAll("/specifications/psus"); + return getAll("/specifications/psus"); } export function getPSU(id) { - return getById("/specifications/psus/{id}", {id}); + return getById("/specifications/psus/{id}", { id }); } export function getAllStorages() { - return getAll("/specifications/storages"); + return getAll("/specifications/storages"); } export function getStorage(id) { - return getById("/specifications/storages/{id}", {id}); + return getById("/specifications/storages/{id}", { id }); } diff --git a/src/api/routes/tiles.js b/src/api/routes/tiles.js index b1c594d5..08481ef4 100644 --- a/src/api/routes/tiles.js +++ b/src/api/routes/tiles.js @@ -1,146 +1,146 @@ -import {sendRequest} from "../index"; -import {deleteById, getById} from "./util"; +import { sendRequest } from "../index"; +import { deleteById, getById } from "./util"; export function getTile(tileId) { - return getById("/tiles/{tileId}", {tileId}); + return getById("/tiles/{tileId}", { tileId }); } export function deleteTile(tileId) { - return deleteById("/tiles/{tileId}", {tileId}); + return deleteById("/tiles/{tileId}", { tileId }); } export function getRackByTile(tileId) { - return getTileObject(tileId, "/rack"); + return getTileObject(tileId, "/rack"); } export function addRackToTile(tileId, rack) { - return addTileObject(tileId, {rack}, "/rack"); + return addTileObject(tileId, { rack }, "/rack"); } export function updateRackOnTile(tileId, rack) { - return updateTileObject(tileId, {rack}, "/rack"); + return updateTileObject(tileId, { rack }, "/rack"); } export function deleteRackFromTile(tileId) { - return deleteTileObject(tileId, "/rack"); + return deleteTileObject(tileId, "/rack"); } export function getMachinesOfRackByTile(tileId) { - return getById("/tiles/{tileId}/rack/machines", {tileId}); + return getById("/tiles/{tileId}/rack/machines", { tileId }); } export function addMachineToRackOnTile(tileId, machine) { - return sendRequest({ - path: "/tiles/{tileId}/rack/machines", - method: "POST", - parameters: { - body: { - machine - }, - path: { - tileId - }, - query: {} - } - }); + return sendRequest({ + path: "/tiles/{tileId}/rack/machines", + method: "POST", + parameters: { + body: { + machine + }, + path: { + tileId + }, + query: {} + } + }); } export function updateMachineInRackOnTile(tileId, position, machine) { - return sendRequest({ - path: "/tiles/{tileId}/rack/machines/{position}", - method: "PUT", - parameters: { - body: { - machine - }, - path: { - tileId, - position - }, - query: {} - } - }); + return sendRequest({ + path: "/tiles/{tileId}/rack/machines/{position}", + method: "PUT", + parameters: { + body: { + machine + }, + path: { + tileId, + position + }, + query: {} + } + }); } export function deleteMachineInRackOnTile(tileId, position) { - return sendRequest({ - path: "/tiles/{tileId}/rack/machines/{position}", - method: "DELETE", - parameters: { - body: {}, - path: { - tileId, - position - }, - query: {} - } - }); + return sendRequest({ + path: "/tiles/{tileId}/rack/machines/{position}", + method: "DELETE", + parameters: { + body: {}, + path: { + tileId, + position + }, + query: {} + } + }); } export function getCoolingItemByTile(tileId) { - return getTileObject(tileId, "/cooling-item"); + return getTileObject(tileId, "/cooling-item"); } export function addCoolingItemToTile(tileId, coolingItemId) { - return addTileObject(tileId, {coolingItemId}, "/cooling-item"); + return addTileObject(tileId, { coolingItemId }, "/cooling-item"); } export function updateCoolingItemOnTile(tileId, coolingItemId) { - return updateTileObject(tileId, {coolingItemId}, "/cooling-item"); + return updateTileObject(tileId, { coolingItemId }, "/cooling-item"); } export function deleteCoolingItemFromTile(tileId) { - return deleteTileObject(tileId, "/cooling-item"); + return deleteTileObject(tileId, "/cooling-item"); } export function getPSUByTile(tileId) { - return getTileObject(tileId, "/psu"); + return getTileObject(tileId, "/psu"); } export function addPSUToTile(tileId, psuId) { - return addTileObject(tileId, {psuId}, "/psu"); + return addTileObject(tileId, { psuId }, "/psu"); } export function updatePSUOnTile(tileId, psuId) { - return updateTileObject(tileId, {psuId}, "/psu"); + return updateTileObject(tileId, { psuId }, "/psu"); } export function deletePSUFromTile(tileId) { - return deleteTileObject(tileId, "/psu"); + return deleteTileObject(tileId, "/psu"); } function getTileObject(tileId, endpoint) { - return getById("/tiles/{tileId}" + endpoint, {tileId}); + return getById("/tiles/{tileId}" + endpoint, { tileId }); } function addTileObject(tileId, objectBody, endpoint) { - return sendRequest({ - path: "/tiles/{tileId}" + endpoint, - method: "POST", - parameters: { - body: objectBody, - path: { - tileId - }, - query: {} - } - }); + return sendRequest({ + path: "/tiles/{tileId}" + endpoint, + method: "POST", + parameters: { + body: objectBody, + path: { + tileId + }, + query: {} + } + }); } function updateTileObject(tileId, objectBody, endpoint) { - return sendRequest({ - path: "/tiles/{tileId}" + endpoint, - method: "PUT", - parameters: { - body: objectBody, - path: { - tileId - }, - query: {} - } - }); + return sendRequest({ + path: "/tiles/{tileId}" + endpoint, + method: "PUT", + parameters: { + body: objectBody, + path: { + tileId + }, + query: {} + } + }); } function deleteTileObject(tileId, endpoint) { - return deleteById("/tiles/{tileId}" + endpoint, {tileId}); + return deleteById("/tiles/{tileId}" + endpoint, { tileId }); } diff --git a/src/api/routes/token-signin.js b/src/api/routes/token-signin.js index dbf70869..26875606 100644 --- a/src/api/routes/token-signin.js +++ b/src/api/routes/token-signin.js @@ -1,9 +1,7 @@ export function performTokenSignIn(token) { - return new Promise(resolve => { - window["jQuery"].post( - "/tokensignin", - {idtoken: token}, - data => resolve(data) - ) - }); + return new Promise(resolve => { + window["jQuery"].post("/tokensignin", { idtoken: token }, data => + resolve(data) + ); + }); } diff --git a/src/api/routes/traces.js b/src/api/routes/traces.js index 6a34ca7c..a9ee4fae 100644 --- a/src/api/routes/traces.js +++ b/src/api/routes/traces.js @@ -1,9 +1,9 @@ -import {getAll, getById} from "./util"; +import { getAll, getById } from "./util"; export function getAllTraces() { - return getAll("/traces"); + return getAll("/traces"); } export function getJobsOfTrace(traceId) { - return getById("/traces/{traceId}/jobs", {traceId}); + return getById("/traces/{traceId}/jobs", { traceId }); } diff --git a/src/api/routes/users.js b/src/api/routes/users.js index 7b931d66..f8d8039c 100644 --- a/src/api/routes/users.js +++ b/src/api/routes/users.js @@ -1,71 +1,71 @@ -import {sendRequest} from "../index"; -import {deleteById, getById} from "./util"; +import { sendRequest } from "../index"; +import { deleteById, getById } from "./util"; export function getUserByEmail(email) { - return sendRequest({ - path: "/users", - method: "GET", - parameters: { - body: {}, - path: {}, - query: { - email - } - } - }); + return sendRequest({ + path: "/users", + method: "GET", + parameters: { + body: {}, + path: {}, + query: { + email + } + } + }); } export function addUser(user) { - return sendRequest({ - path: "/users", - method: "POST", - parameters: { - body: { - user: user - }, - path: {}, - query: {} - } - }); + return sendRequest({ + path: "/users", + method: "POST", + parameters: { + body: { + user: user + }, + path: {}, + query: {} + } + }); } export function getUser(userId) { - return sendRequest({ - path: "/users/{userId}", - method: "GET", - parameters: { - body: {}, - path: { - userId - }, - query: {} - } - }); + return sendRequest({ + path: "/users/{userId}", + method: "GET", + parameters: { + body: {}, + path: { + userId + }, + query: {} + } + }); } export function updateUser(userId, user) { - return sendRequest({ - path: "/users/{userId}", - method: "PUT", - parameters: { - body: { - user: { - givenName: user.givenName, - familyName: user.familyName - } - }, - path: { - userId - }, - query: {} + return sendRequest({ + path: "/users/{userId}", + method: "PUT", + parameters: { + body: { + user: { + givenName: user.givenName, + familyName: user.familyName } - }); + }, + path: { + userId + }, + query: {} + } + }); } export function deleteUser(userId) { - return deleteById("/users/{userId}", {userId}); + return deleteById("/users/{userId}", { userId }); } export function getAuthorizationsByUser(userId) { - return getById("/users/{userId}/authorizations", {userId}); + return getById("/users/{userId}/authorizations", { userId }); } diff --git a/src/api/routes/util.js b/src/api/routes/util.js index ff21d4f4..35a40333 100644 --- a/src/api/routes/util.js +++ b/src/api/routes/util.js @@ -1,37 +1,37 @@ -import {sendRequest} from "../index"; +import { sendRequest } from "../index"; export function getAll(path) { - return sendRequest({ - path, - method: "GET", - parameters: { - body: {}, - path: {}, - query: {} - } - }); + return sendRequest({ + path, + method: "GET", + parameters: { + body: {}, + path: {}, + query: {} + } + }); } export function getById(path, pathObject) { - return sendRequest({ - path, - method: "GET", - parameters: { - body: {}, - path: pathObject, - query: {} - } - }); + return sendRequest({ + path, + method: "GET", + parameters: { + body: {}, + path: pathObject, + query: {} + } + }); } export function deleteById(path, pathObject) { - return sendRequest({ - path, - method: "DELETE", - parameters: { - body: {}, - path: pathObject, - query: {} - } - }); + return sendRequest({ + path, + method: "DELETE", + parameters: { + body: {}, + path: pathObject, + query: {} + } + }); } |
