OpenApi add POST request to device root
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / server / api / DataPostResult.java
index a78f842053259ecea304e22beb27ef2cb0a9f0c6..4062dbfa7dcfefe2e1ef92b39d793b62a23588a3 100644 (file)
@@ -7,46 +7,10 @@
  */
 package org.opendaylight.restconf.server.api;
 
-import static java.util.Objects.requireNonNull;
-
-import java.time.Instant;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-
 /**
  * Result of a {@code POST} request as defined in
  * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.4">RFC8040 section 4.4</a>.
  */
-public sealed interface DataPostResult {
-    /**
-     * Result of a {@code POST} request in as defined in
-     * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.4.1">RFC8040 Create Resource Mode</a>.
-     *
-     * @param createdPath API path of the newly-created resource
-     * @param entityTag response {@code ETag} header, or {@code null} if not applicable
-     * @param lastModified response {@code Last-Modified} header, or {@code null} if not applicable
-     */
-    record CreateResource(
-            // FIXME: use ApiPath instead of String
-            @NonNull String createdPath,
-            @Nullable EntityTag entityTag,
-            @Nullable Instant lastModified) implements DataPostResult, ConfigurationMetadata {
-        public CreateResource {
-            requireNonNull(createdPath);
-        }
-
-        public CreateResource(final @NonNull String createdPath) {
-            this(createdPath, null, null);
-        }
-    }
-
-    /**
-     * Result of a {@code POST} request as defined in
-     * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.4.2">RFC8040 Invoke Operation Mode</a>.
-     *
-     * @param output Non-empty operation output, or {@code null}
-     */
-    record InvokeOperation(@Nullable OperationOutputBody output) implements DataPostResult {
-        public static final @NonNull InvokeOperation EMPTY = new InvokeOperation(null);
-    }
+public sealed interface DataPostResult permits CreateResourceResult, InvokeResult {
+    // Just a marker
 }