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.api.FormattableBody;
15 import org.opendaylight.yangtools.yang.common.Empty;
18 * An implementation of a RESTCONF server, implementing the
19 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.3">RESTCONF API Resource</a>.
22 public interface RestconfServer {
24 * Delete a data resource.
26 * @param request {@link ServerRequest} for this request
27 * @param identifier resource identifier
29 @SuppressWarnings("checkstyle:abbreviationAsWordInName")
30 void dataDELETE(ServerRequest<Empty> request, ApiPath identifier);
33 * Return the content of the datastore.
35 * @param request {@link ServerRequest} for this request
37 void dataGET(ServerRequest<DataGetResult> request);
40 * Return the content of a data resource.
42 * @param request {@link ServerRequest} for this request
43 * @param identifier resource identifier
45 void dataGET(ServerRequest<DataGetResult> request, ApiPath identifier);
48 * Partially modify the target data resource, as defined in
49 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.6.1">RFC8040, section 4.6.1</a>.
51 * @param request {@link ServerRequest} for this request
52 * @param body data node for put to config DS
54 void dataPATCH(ServerRequest<DataPatchResult> request, ResourceBody body);
57 * Partially modify the target data resource, as defined in
58 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.6.1">RFC8040, section 4.6.1</a>.
60 * @param request {@link ServerRequest} for this request
61 * @param identifier resource identifier
62 * @param body data node for put to config DS
64 void dataPATCH(ServerRequest<DataPatchResult> request, ApiPath identifier, ResourceBody body);
67 * Ordered list of edits that are applied to the datastore by the server, as defined in
68 * <a href="https://www.rfc-editor.org/rfc/rfc8072#section-2">RFC8072, section 2</a>.
70 * @param request {@link ServerRequest} for this request
71 * @param body YANG Patch body
73 void dataPATCH(ServerRequest<DataYangPatchResult> request, PatchBody body);
76 * Ordered list of edits that are applied to the datastore by the server, as defined in
77 * <a href="https://www.rfc-editor.org/rfc/rfc8072#section-2">RFC8072, section 2</a>.
79 * @param request {@link ServerRequest} for this request
80 * @param identifier path to target
81 * @param body YANG Patch body
83 void dataPATCH(ServerRequest<DataYangPatchResult> request, ApiPath identifier, PatchBody body);
85 void dataPOST(ServerRequest<CreateResourceResult> request, ChildBody body);
88 * Create or invoke a operation, as described in
89 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.4">RFC8040 section 4.4</a>.
91 * @param request {@link ServerRequest} for this request
92 * @param identifier path to target
93 * @param body body of the post request
95 void dataPOST(ServerRequest<DataPostResult> request, ApiPath identifier, DataPostBody body);
98 * Replace the data store, as described in
99 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.5">RFC8040 section 4.5</a>.
101 * @param request {@link ServerRequest} for this request
102 * @param body data node for put to config DS
104 void dataPUT(ServerRequest<DataPutResult> request, ResourceBody body);
107 * Create or replace a data store resource, as described in
108 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-4.5">RFC8040 section 4.5</a>.
110 * @param request {@link ServerRequest} for this request
111 * @param identifier resource identifier
112 * @param body data node for put to config DS
114 void dataPUT(ServerRequest<DataPutResult> request, ApiPath identifier, ResourceBody body);
117 * Return the set of supported RPCs supported by
118 * {@link #operationsPOST(ServerRequest, URI, ApiPath, OperationInputBody)},
119 * as expressed in the <a href="https://www.rfc-editor.org/rfc/rfc8040#page-84">ietf-restconf.yang</a>
120 * {@code container operations} statement.
122 * @param request {@link ServerRequest} for this request
124 void operationsGET(ServerRequest<FormattableBody> request);
127 * Return the details about a particular operation supported by
128 * {@link #operationsPOST(URI, String, OperationInputBody)}, as expressed in the
129 * <a href="https://www.rfc-editor.org/rfc/rfc8040#page-84">ietf-restconfig.yang</a>
130 * {@code container operations} statement.
132 * @param request {@link ServerRequest} for this request
133 * @param operation An operation
135 void operationsGET(ServerRequest<FormattableBody> request, ApiPath operation);
138 * Invoke an RPC operation, as defined in
139 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.6">RFC8040 Operation Resource</a>.
141 * @param request {@link ServerRequest} for this request
142 * @param restconfURI Base URI of the request, the absolute equivalent to {@code {+restconf}} URI with a trailing
144 * @param operation {@code <operation>} path, really an {@link ApiPath} to an {@code rpc}
145 * @param body RPC operation
147 // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support yang-ext:mount,
148 // and hence it is a path right now
149 void operationsPOST(ServerRequest<InvokeResult> request, URI restconfURI, ApiPath operation,
150 OperationInputBody body);
153 * Return the revision of {@code ietf-yang-library} module implemented by this server, as defined in
154 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.3.3">RFC8040 {+restconf}/yang-library-version</a>.
156 * @param request {@link ServerRequest} for this request
158 void yangLibraryVersionGET(ServerRequest<FormattableBody> request);
160 void modulesYangGET(ServerRequest<ModulesGetResult> request, String fileName, @Nullable String revision);
162 void modulesYangGET(ServerRequest<ModulesGetResult> request, ApiPath mountPath, String fileName,
163 @Nullable String revision);
165 void modulesYinGET(ServerRequest<ModulesGetResult> request, String fileName, @Nullable String revision);
167 void modulesYinGET(ServerRequest<ModulesGetResult> request, ApiPath mountPath, String fileName,
168 @Nullable String revision);