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.legacy.NormalizedNodePayload;
18 import org.opendaylight.restconf.server.spi.OperationOutput;
21 * An implementation of a RESTCONF server, implementing the
22 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.3">RESTCONF API Resource</a>.
25 public interface RestconfServer {
27 * Return the content of the datastore.
29 * @param readParams {@link ReadDataParams} for this request
30 * @return A {@link RestconfFuture} of the {@link NormalizedNodePayload} content
32 RestconfFuture<NormalizedNodePayload> dataGET(ReadDataParams readParams);
35 * Return the content of a resource.
37 * @param identifier resource identifier
38 * @param readParams {@link ReadDataParams} for this request
39 * @return A {@link RestconfFuture} of the {@link NormalizedNodePayload} content
41 RestconfFuture<NormalizedNodePayload> dataGET(String identifier, ReadDataParams readParams);
44 * Return the set of supported RPCs supported by {@link #operationsPOST(URI, String, OperationInputBody)}.
46 * @return An {@link OperationsContent}
48 OperationsContent operationsGET();
51 * Return the details about a particular operation supported by
52 * {@link #operationsPOST(URI, String, OperationInputBody)}, as expressed in the
53 * <a href="https://www.rfc-editor.org/rfc/rfc8040#page-84>RFC8040<a> {@code container operations} statement.
55 * @param operation An operation
56 * @return An {@link OperationsContent}, or {@code null} if {@code operation} does not point to an {@code rpc}
58 // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support ang-ext:mount,
59 // and hence it is a path right now
60 // FIXME: use ApiPath instead of String
61 @Nullable OperationsContent operationsGET(String operation);
64 * Invoke an RPC operation, as defined in
65 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.6">RFC8040 Operation Resource</a>.
67 * @param restconfURI Base URI of the request
68 * @param operation {@code <operation>} path, really an {@link ApiPath} to an {@code rpc}
69 * @param body RPC operation
70 * @return A {@link RestconfFuture} of the {@link OperationOutput operation result}
72 // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support ang-ext:mount,
73 // and hence it is a path right now
74 // FIXME: use ApiPath instead of String
75 RestconfFuture<OperationOutput> operationsPOST(URI restconfURI, String operation, OperationInputBody body);
78 * Return the revision of {@code ietf-yang-library} module implemented by this server, as defined in
79 * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.3.3">RFC8040 {+restconf}/yang-library-version</a>.
81 * @return A {@code yang-library-version} element
83 // FIXME: this is a simple coning-variadic return, similar to how OperationsContent is handled use a common
84 // construct for both cases
85 // FIXME: RestconfFuture if we transition to being used by restconf-client implementation
86 NormalizedNodePayload yangLibraryVersionGET();