summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto')
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/JobState.java53
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/OperationalPhenomena.java28
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/ProtocolError.java28
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Targets.java34
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Trace.java32
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Workload.java43
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Job.java51
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/JobService.java60
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Portfolio.java37
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Scenario.java41
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Topology.java34
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Machine.java38
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/MemoryUnit.java28
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/ProcessingUnit.java29
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Rack.java30
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Room.java30
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/RoomTile.java28
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Job.java34
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Portfolio.java58
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Project.java38
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/ProjectRole.java43
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Scenario.java83
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Topology.java59
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/User.java28
-rw-r--r--opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/UserAccounting.java30
25 files changed, 997 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/JobState.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/JobState.java
new file mode 100644
index 00000000..14a0faba
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/JobState.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto;
+
+/**
+ * State of a scenario for the simulator runner.
+ */
+public enum JobState {
+ /**
+ * The job is pending to be claimed by a runner.
+ */
+ PENDING,
+
+ /**
+ * The job is claimed by a runner.
+ */
+ CLAIMED,
+
+ /**
+ * The job is currently running.
+ */
+ RUNNING,
+
+ /**
+ * The job has finished.
+ */
+ FINISHED,
+
+ /**
+ * The job has failed.
+ */
+ FAILED
+}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/OperationalPhenomena.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/OperationalPhenomena.java
new file mode 100644
index 00000000..cf492e38
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/OperationalPhenomena.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto;
+
+/**
+ * Object describing the enabled operational phenomena for a scenario.
+ */
+public record OperationalPhenomena(boolean failures, boolean interference) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/ProtocolError.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/ProtocolError.java
new file mode 100644
index 00000000..cb9324ea
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/ProtocolError.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto;
+
+/**
+ * Container for reporting errors.
+ */
+public record ProtocolError(int code, String message) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Targets.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Targets.java
new file mode 100644
index 00000000..4823bb66
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Targets.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto;
+
+import jakarta.validation.constraints.Min;
+import java.util.Set;
+
+/**
+ * The targets of a portfolio.
+ *
+ * @param metrics The selected metrics to track during simulation.
+ * @param repeats The number of repetitions per scenario.
+ */
+public record Targets(Set<String> metrics, @Min(1) int repeats) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Trace.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Trace.java
new file mode 100644
index 00000000..adf916d3
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Trace.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto;
+
+/**
+ * A workload trace available for simulation.
+ *
+ * @param id The unique identifier of the trace.
+ * @param name The name of the trace.
+ * @param type The type of trace.
+ */
+public record Trace(String id, String name, String type) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Workload.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Workload.java
new file mode 100644
index 00000000..e8f552d6
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/Workload.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto;
+
+import jakarta.validation.constraints.DecimalMax;
+import jakarta.validation.constraints.DecimalMin;
+
+/**
+ * The workload to simulate for a scenario.
+ */
+public record Workload(Trace trace, double samplingFraction) {
+ /**
+ * Specification for a workload.
+ *
+ * @param trace The unique identifier of the trace.
+ * @param samplingFraction The fraction of the workload to sample.
+ */
+ public record Spec(
+ String trace,
+ @DecimalMin(value = "0.001", message = "Sampling fraction must be non-zero")
+ @DecimalMax(value = "1", message = "Sampling fraction cannot exceed one")
+ double samplingFraction) {}
+}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Job.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Job.java
new file mode 100644
index 00000000..587fe451
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Job.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.runner;
+
+import java.time.Instant;
+import java.util.Map;
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.opendc.web.proto.JobState;
+
+/**
+ * A simulation job to be simulated by a runner.
+ */
+@Schema(name = "Runner.Job")
+public record Job(
+ long id,
+ Scenario scenario,
+ JobState state,
+ Instant createdAt,
+ Instant updatedAt,
+ int runtime,
+ Map<String, ?> results) {
+ /**
+ * A request to update the state of a job.
+ *
+ * @param state The next state of the job.
+ * @param runtime The runtime of the job (in seconds).
+ * @param results The results of the job.
+ */
+ @Schema(name = "Runner.Job.Update")
+ public record Update(JobState state, int runtime, Map<String, ?> results) {}
+}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/JobService.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/JobService.java
new file mode 100644
index 00000000..33b520a0
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/JobService.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.runner;
+
+import jakarta.validation.Valid;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import java.util.List;
+import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
+
+/**
+ * Service for interacting with the OpenDC job server.
+ */
+@Path("/jobs")
+@RegisterRestClient
+public interface JobService {
+ /**
+ * Obtain all pending simulation jobs.
+ */
+ @GET
+ List<Job> queryPending();
+
+ /**
+ * Get a job by identifier.
+ */
+ @GET
+ @Path("{job}")
+ Job get(@PathParam("job") long id);
+
+ /**
+ * Atomically update the state of a job.
+ */
+ @POST
+ @Path("{job}")
+ @Consumes("application/json")
+ Job update(@PathParam("job") long id, @Valid Job.Update update);
+}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Portfolio.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Portfolio.java
new file mode 100644
index 00000000..44f0b500
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Portfolio.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.runner;
+
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.opendc.web.proto.Targets;
+
+/**
+ * A {@link Portfolio} as seen from the runner's perspective.
+ *
+ * @param id The unique identifier of the portfolio.
+ * @param number The number of the portfolio for the project.
+ * @param name The name of the portfolio.
+ * @param targets The targets of the portfolio.
+ */
+@Schema(name = "Runner.Portfolio")
+public record Portfolio(long id, int number, String name, Targets targets) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Scenario.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Scenario.java
new file mode 100644
index 00000000..8005ac3b
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Scenario.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.runner;
+
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.opendc.web.proto.OperationalPhenomena;
+import org.opendc.web.proto.Workload;
+
+/**
+ * A {@link Scenario} that is exposed to an OpenDC runner.
+ */
+@Schema(name = "Runner.Scenario")
+public record Scenario(
+ long id,
+ int number,
+ Portfolio portfolio,
+ String name,
+ Workload workload,
+ Topology topology,
+ OperationalPhenomena phenomena,
+ String schedulerName) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Topology.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Topology.java
new file mode 100644
index 00000000..fdabd12d
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/runner/Topology.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.runner;
+
+import java.time.Instant;
+import java.util.List;
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.opendc.web.proto.topology.Room;
+
+/**
+ * A [Topology] that is exposed to an OpenDC runner.
+ */
+@Schema(name = "Runner.Topology")
+public record Topology(long id, int number, String name, List<Room> rooms, Instant createdAt, Instant updatedAt) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Machine.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Machine.java
new file mode 100644
index 00000000..ec78f249
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Machine.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.topology;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+/**
+ * A machine in a rack.
+ */
+public record Machine(
+ String id,
+ int position,
+ List<ProcessingUnit> cpus,
+ List<ProcessingUnit> gpus,
+ @JsonProperty("memories") List<MemoryUnit> memory,
+ @JsonProperty("storages") List<MemoryUnit> storage,
+ String rackId) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/MemoryUnit.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/MemoryUnit.java
new file mode 100644
index 00000000..a53b584a
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/MemoryUnit.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.topology;
+
+/**
+ * A memory unit in a system.
+ */
+public record MemoryUnit(String id, String name, double speedMbPerS, double sizeMb, double energyConsumptionW) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/ProcessingUnit.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/ProcessingUnit.java
new file mode 100644
index 00000000..baa61aac
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/ProcessingUnit.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.topology;
+
+/**
+ * A CPU model.
+ */
+public record ProcessingUnit(
+ String id, String name, double clockRateMhz, int numberOfCores, double energyConsumptionW) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Rack.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Rack.java
new file mode 100644
index 00000000..b68fddd3
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Rack.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.topology;
+
+import java.util.List;
+
+/**
+ * A rack in a datacenter.
+ */
+public record Rack(String id, String name, int capacity, double powerCapacityW, List<Machine> machines) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Room.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Room.java
new file mode 100644
index 00000000..530d21f5
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/Room.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.topology;
+
+import java.util.Set;
+
+/**
+ * A room in a datacenter.
+ */
+public record Room(String id, String name, Set<RoomTile> tiles, String topologyId) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/RoomTile.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/RoomTile.java
new file mode 100644
index 00000000..a7240541
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/topology/RoomTile.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.topology;
+
+/**
+ * A location in a room.
+ */
+public record RoomTile(String id, double positionX, double positionY, Rack rack, String roomId) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Job.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Job.java
new file mode 100644
index 00000000..480efdad
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Job.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.user;
+
+import java.time.Instant;
+import java.util.Map;
+import org.opendc.web.proto.JobState;
+
+/**
+ * A simulation job that is associated with a {@link Scenario}.
+ * <p>
+ * This entity is exposed in the runner-facing API via {@link Job}.
+ */
+public record Job(long id, JobState state, Instant createdAt, Instant updatedAt, Map<String, ?> results) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Portfolio.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Portfolio.java
new file mode 100644
index 00000000..ff8d9e82
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Portfolio.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.user;
+
+import jakarta.validation.constraints.NotBlank;
+import java.util.List;
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.opendc.web.proto.Targets;
+
+/**
+ * A portfolio is the composition of multiple scenarios.
+ *
+ * @param id The unique identifier of the portfolio.
+ * @param number The number of the portfolio with respect to the project.
+ * @param project The project to which the portfolio belongs.
+ * @param name The name of the portfolio.
+ * @param targets The targets of the portfolio.
+ * @param scenarios The scenarios in the portfolio.
+ */
+public record Portfolio(
+ long id, int number, Project project, String name, Targets targets, List<Scenario.Summary> scenarios) {
+ /**
+ * A request to create a new portfolio.
+ */
+ @Schema(name = "Portfolio.Update")
+ public record Create(@NotBlank(message = "Name must not be empty") String name, Targets targets) {}
+
+ /**
+ * A summary view of a [Portfolio] provided for nested relations.
+ *
+ * @param id The unique identifier of the portfolio.
+ * @param number The number of the portfolio for the project.
+ * @param name The name of the portfolio.
+ * @param targets The targets of the portfolio.
+ */
+ @Schema(name = "Portfolio.Summary")
+ public record Summary(long id, int number, String name, Targets targets) {}
+}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Project.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Project.java
new file mode 100644
index 00000000..534fdb26
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Project.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.user;
+
+import jakarta.validation.constraints.NotBlank;
+import java.time.Instant;
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+
+/**
+ * A project in OpenDC encapsulates all the datacenter designs and simulation runs for a set of users.
+ */
+public record Project(long id, String name, Instant createdAt, Instant updatedAt, ProjectRole role) {
+ /**
+ * A request to create a new project.
+ */
+ @Schema(name = "Project.Create")
+ public record Create(@NotBlank(message = "Name must not be empty") String name) {}
+}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/ProjectRole.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/ProjectRole.java
new file mode 100644
index 00000000..434ab472
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/ProjectRole.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.user;
+
+/**
+ * The role of a user in a project.
+ */
+public enum ProjectRole {
+ /**
+ * The user is allowed to view the project.
+ */
+ VIEWER,
+
+ /**
+ * The user is allowed to edit the project.
+ */
+ EDITOR,
+
+ /**
+ * The user owns the project (so he can delete it).
+ */
+ OWNER,
+}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Scenario.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Scenario.java
new file mode 100644
index 00000000..7add5656
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Scenario.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.user;
+
+import jakarta.validation.constraints.NotBlank;
+import java.util.List;
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.opendc.web.proto.OperationalPhenomena;
+import org.opendc.web.proto.Workload;
+
+/**
+ * A single scenario to be explored by the simulator.
+ */
+public record Scenario(
+ long id,
+ int number,
+ Project project,
+ Portfolio.Summary portfolio,
+ String name,
+ Workload workload,
+ Topology.Summary topology,
+ OperationalPhenomena phenomena,
+ String schedulerName,
+ List<Job> jobs) {
+ /**
+ * Create a new scenario.
+ *
+ * @param name The name of the scenario.
+ * @param workload The workload specification to use for the scenario.
+ * @param topology The number of the topology to use.
+ * @param phenomena The phenomena to model during simulation.
+ * @param schedulerName The name of the scheduler.
+ */
+ @Schema(name = "Scenario.Create")
+ public record Create(
+ @NotBlank(message = "Name must not be empty") String name,
+ Workload.Spec workload,
+ long topology,
+ OperationalPhenomena phenomena,
+ String schedulerName) {}
+
+ /**
+ * A summary view of a [Scenario] provided for nested relations.
+ *
+ * @param id The unique identifier of the scenario.
+ * @param number The number of the scenario for the project.
+ * @param name The name of the scenario.
+ * @param workload The workload to be modeled by the scenario.
+ * @param phenomena The phenomena simulated for this scenario.
+ * @param schedulerName The scheduler name to use for the experiment.
+ * @param jobs The simulation jobs associated with the scenario.
+ */
+ @Schema(name = "Scenario.Summary")
+ public record Summary(
+ long id,
+ int number,
+ String name,
+ Workload workload,
+ Topology.Summary topology,
+ OperationalPhenomena phenomena,
+ String schedulerName,
+ List<Job> jobs) {}
+}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Topology.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Topology.java
new file mode 100644
index 00000000..7291c77b
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/Topology.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.user;
+
+import jakarta.validation.constraints.NotBlank;
+import java.time.Instant;
+import java.util.List;
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.opendc.web.proto.topology.Room;
+
+/**
+ * Model for an OpenDC topology.
+ */
+public record Topology(
+ long id, int number, Project project, String name, List<Room> rooms, Instant createdAt, Instant updatedAt) {
+ /**
+ * Create a new topology for a project.
+ */
+ @Schema(name = "Topology.Create")
+ public record Create(@NotBlank(message = "Name must not be empty") String name, List<Room> rooms) {}
+
+ /**
+ * Update an existing topology.
+ */
+ @Schema(name = "Topology.Update")
+ public record Update(List<Room> rooms) {}
+
+ /**
+ * A summary view of a [Topology] provided for nested relations.
+ *
+ * @param id The unique identifier of the topology.
+ * @param number The number of the topology for the project.
+ * @param name The name of the topology.
+ * @param createdAt The instant at which the topology was created.
+ * @param updatedAt The instant at which the topology was updated.
+ */
+ @Schema(name = "Topology.Summary")
+ public record Summary(long id, int number, String name, Instant createdAt, Instant updatedAt) {}
+}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/User.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/User.java
new file mode 100644
index 00000000..030d9207
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/User.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.user;
+
+/**
+ * A user of OpenDC.
+ */
+public record User(String userId, UserAccounting accounting) {}
diff --git a/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/UserAccounting.java b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/UserAccounting.java
new file mode 100644
index 00000000..3831381f
--- /dev/null
+++ b/opendc-web/opendc-web-proto/src/main/java/org/opendc/web/proto/user/UserAccounting.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2023 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.opendc.web.proto.user;
+
+import java.time.LocalDate;
+
+/**
+ * Accounting data for a user.
+ */
+public record UserAccounting(LocalDate periodEnd, int simulationTime, int simulationTimeBudget) {}