*/
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
}