2 * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.restconf.server.api;
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.databind.ResourceBody;
18 import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
19 import org.opendaylight.restconf.server.spi.OperationOutput;
20 import org.opendaylight.yangtools.yang.common.Empty;
23 * An implementation of a RESTCONF server, implementing the
24 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.3">RESTCONF API Resource</a>.
27 public interface RestconfServer {
29 * Delete a data resource.
31 * @param identifier resource identifier
32 * @return A {@link RestconfFuture} of the operation
34 @SuppressWarnings("checkstyle:abbreviationAsWordInName")
35 RestconfFuture<Empty> dataDELETE(String identifier);
38 * Return the content of the datastore.
40 * @param readParams {@link ReadDataParams} for this request
41 * @return A {@link RestconfFuture} of the {@link NormalizedNodePayload} content
43 RestconfFuture<NormalizedNodePayload> dataGET(ReadDataParams readParams);
46 * Return the content of a data resource.
48 * @param identifier resource identifier
49 * @param readParams {@link ReadDataParams} for this request
50 * @return A {@link RestconfFuture} of the {@link NormalizedNodePayload} content
52 RestconfFuture<NormalizedNodePayload> dataGET(String identifier, ReadDataParams readParams);
55 * Partially modify the target data resource, as defined in
56 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.6.1">RFC8040, section 4.6.1</a>.
58 * @param body data node for put to config DS
59 * @return A {@link RestconfFuture} of the operation
61 RestconfFuture<Empty> dataPATCH(ResourceBody body);
64 * Partially modify the target data resource, as defined in
65 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.6.1">RFC8040, section 4.6.1</a>.
67 * @param identifier resource identifier
68 * @param body data node for put to config DS
69 * @return A {@link RestconfFuture} of the operation
71 RestconfFuture<Empty> dataPATCH(String identifier, ResourceBody body);
74 * Return the set of supported RPCs supported by {@link #operationsPOST(URI, String, OperationInputBody)}.
76 * @return An {@link OperationsContent}
78 OperationsContent operationsGET();
81 * Return the details about a particular operation supported by
82 * {@link #operationsPOST(URI, String, OperationInputBody)}, as expressed in the
83 * <a href="https://www.rfc-editor.org/rfc/rfc8040#page-84>RFC8040<a> {@code container operations} statement.
85 * @param operation An operation
86 * @return An {@link OperationsContent}, or {@code null} if {@code operation} does not point to an {@code rpc}
88 // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support ang-ext:mount,
89 // and hence it is a path right now
90 // FIXME: use ApiPath instead of String
91 @Nullable OperationsContent operationsGET(String operation);
94 * Invoke an RPC operation, as defined in
95 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.6">RFC8040 Operation Resource</a>.
97 * @param restconfURI Base URI of the request
98 * @param operation {@code <operation>} path, really an {@link ApiPath} to an {@code rpc}
99 * @param body RPC operation
100 * @return A {@link RestconfFuture} of the {@link OperationOutput operation result}
102 // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support ang-ext:mount,
103 // and hence it is a path right now
104 // FIXME: use ApiPath instead of String
105 RestconfFuture<OperationOutput> operationsPOST(URI restconfURI, String operation, OperationInputBody body);
108 * Return the revision of {@code ietf-yang-library} module implemented by this server, as defined in
109 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.3.3">RFC8040 {+restconf}/yang-library-version</a>.
111 * @return A {@code yang-library-version} element
113 // FIXME: this is a simple coning-variadic return, similar to how OperationsContent is handled use a common
114 // construct for both cases
115 // FIXME: RestconfFuture if we transition to being used by restconf-client implementation
116 NormalizedNodePayload yangLibraryVersionGET();