Add RestconfServer.dataDELETE()
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / server / api / RestconfServer.java
1 /*
2  * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.restconf.server.api;
9
10 import java.net.URI;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.restconf.api.ApiPath;
14 import org.opendaylight.restconf.common.errors.RestconfFuture;
15 import org.opendaylight.restconf.nb.rfc8040.ReadDataParams;
16 import org.opendaylight.restconf.nb.rfc8040.databind.OperationInputBody;
17 import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
18 import org.opendaylight.restconf.server.spi.OperationOutput;
19 import org.opendaylight.yangtools.yang.common.Empty;
20
21 /**
22  * An implementation of a RESTCONF server, implementing the
23  * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.3">RESTCONF API Resource</a>.
24  */
25 @NonNullByDefault
26 public interface RestconfServer {
27     /**
28      * Delete a data resource.
29      *
30      * @param identifier resource identifier
31      * @return A {@link RestconfFuture} of the operation
32      */
33     @SuppressWarnings("checkstyle:abbreviationAsWordInName")
34     RestconfFuture<Empty> dataDELETE(String identifier);
35
36     /**
37      * Return the content of the datastore.
38      *
39      * @param readParams {@link ReadDataParams} for this request
40      * @return A {@link RestconfFuture} of the {@link NormalizedNodePayload} content
41      */
42     RestconfFuture<NormalizedNodePayload> dataGET(ReadDataParams readParams);
43
44     /**
45      * Return the content of a data resource.
46      *
47      * @param identifier resource identifier
48      * @param readParams {@link ReadDataParams} for this request
49      * @return A {@link RestconfFuture} of the {@link NormalizedNodePayload} content
50      */
51     RestconfFuture<NormalizedNodePayload> dataGET(String identifier, ReadDataParams readParams);
52
53     /**
54      * Return the set of supported RPCs supported by {@link #operationsPOST(URI, String, OperationInputBody)}.
55      *
56      * @return An {@link OperationsContent}
57      */
58     OperationsContent operationsGET();
59
60     /*
61      * Return the details about a particular operation supported by
62      * {@link #operationsPOST(URI, String, OperationInputBody)}, as expressed in the
63      * <a href="https://www.rfc-editor.org/rfc/rfc8040#page-84>RFC8040<a> {@code container operations} statement.
64      *
65      * @param operation An operation
66      * @return An {@link OperationsContent}, or {@code null} if {@code operation} does not point to an {@code rpc}
67      */
68     // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support ang-ext:mount,
69     //        and hence it is a path right now
70     // FIXME: use ApiPath instead of String
71     @Nullable OperationsContent operationsGET(String operation);
72
73     /**
74      * Invoke an RPC operation, as defined in
75      * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.6">RFC8040 Operation Resource</a>.
76      *
77      * @param restconfURI Base URI of the request
78      * @param operation {@code <operation>} path, really an {@link ApiPath} to an {@code rpc}
79      * @param body RPC operation
80      * @return A {@link RestconfFuture} of the {@link OperationOutput operation result}
81      */
82     // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support ang-ext:mount,
83     //        and hence it is a path right now
84     // FIXME: use ApiPath instead of String
85     RestconfFuture<OperationOutput> operationsPOST(URI restconfURI, String operation, OperationInputBody body);
86
87     /**
88      * Return the revision of {@code ietf-yang-library} module implemented by this server, as defined in
89      * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.3.3">RFC8040 {+restconf}/yang-library-version</a>.
90      *
91      * @return A {@code yang-library-version} element
92      */
93     // FIXME: this is a simple coning-variadic return, similar to how OperationsContent is handled use a common
94     //        construct for both cases
95     // FIXME: RestconfFuture if we transition to being used by restconf-client implementation
96     NormalizedNodePayload yangLibraryVersionGET();
97 }