/* * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.restconf.server.api; import java.net.URI; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.restconf.api.ApiPath; import org.opendaylight.restconf.api.FormattableBody; import org.opendaylight.yangtools.yang.common.Empty; /** * An implementation of a RESTCONF server, implementing the * RESTCONF API Resource. */ @NonNullByDefault public interface RestconfServer { /** * Delete a data resource. * * @param request {@link ServerRequest} for this request * @param identifier resource identifier */ @SuppressWarnings("checkstyle:abbreviationAsWordInName") void dataDELETE(ServerRequest request, ApiPath identifier); /** * Return the content of the datastore. * * @param request {@link ServerRequest} for this request */ void dataGET(ServerRequest request); /** * Return the content of a data resource. * * @param request {@link ServerRequest} for this request * @param identifier resource identifier */ void dataGET(ServerRequest request, ApiPath identifier); /** * Partially modify the target data resource, as defined in * RFC8040, section 4.6.1. * * @param request {@link ServerRequest} for this request * @param body data node for put to config DS */ void dataPATCH(ServerRequest request, ResourceBody body); /** * Partially modify the target data resource, as defined in * RFC8040, section 4.6.1. * * @param request {@link ServerRequest} for this request * @param identifier resource identifier * @param body data node for put to config DS */ void dataPATCH(ServerRequest request, ApiPath identifier, ResourceBody body); /** * Ordered list of edits that are applied to the datastore by the server, as defined in * RFC8072, section 2. * * @param request {@link ServerRequest} for this request * @param body YANG Patch body */ void dataPATCH(ServerRequest request, PatchBody body); /** * Ordered list of edits that are applied to the datastore by the server, as defined in * RFC8072, section 2. * * @param request {@link ServerRequest} for this request * @param identifier path to target * @param body YANG Patch body */ void dataPATCH(ServerRequest request, ApiPath identifier, PatchBody body); void dataPOST(ServerRequest request, ChildBody body); /** * Create or invoke a operation, as described in * RFC8040 section 4.4. * * @param request {@link ServerRequest} for this request * @param identifier path to target * @param body body of the post request */ void dataPOST(ServerRequest request, ApiPath identifier, DataPostBody body); /** * Replace the data store, as described in * RFC8040 section 4.5. * * @param request {@link ServerRequest} for this request * @param body data node for put to config DS */ void dataPUT(ServerRequest request, ResourceBody body); /** * Create or replace a data store resource, as described in * RFC8040 section 4.5. * * @param request {@link ServerRequest} for this request * @param identifier resource identifier * @param body data node for put to config DS */ void dataPUT(ServerRequest request, ApiPath identifier, ResourceBody body); /** * Return the set of supported RPCs supported by * {@link #operationsPOST(ServerRequest, URI, ApiPath, OperationInputBody)}, * as expressed in the ietf-restconf.yang * {@code container operations} statement. * * @param request {@link ServerRequest} for this request */ void operationsGET(ServerRequest request); /* * Return the details about a particular operation supported by * {@link #operationsPOST(URI, String, OperationInputBody)}, as expressed in the * ietf-restconfig.yang * {@code container operations} statement. * * @param request {@link ServerRequest} for this request * @param operation An operation */ void operationsGET(ServerRequest request, ApiPath operation); /** * Invoke an RPC operation, as defined in * RFC8040 Operation Resource. * * @param request {@link ServerRequest} for this request * @param restconfURI Base URI of the request, the absolute equivalent to {@code {+restconf}} URI with a trailing * slash * @param operation {@code } path, really an {@link ApiPath} to an {@code rpc} * @param body RPC operation */ // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support yang-ext:mount, // and hence it is a path right now void operationsPOST(ServerRequest request, URI restconfURI, ApiPath operation, OperationInputBody body); /** * Return the revision of {@code ietf-yang-library} module implemented by this server, as defined in * RFC8040 {+restconf}/yang-library-version. * * @param request {@link ServerRequest} for this request */ void yangLibraryVersionGET(ServerRequest request); void modulesYangGET(ServerRequest request, String fileName, @Nullable String revision); void modulesYangGET(ServerRequest request, ApiPath mountPath, String fileName, @Nullable String revision); void modulesYinGET(ServerRequest request, String fileName, @Nullable String revision); void modulesYinGET(ServerRequest request, ApiPath mountPath, String fileName, @Nullable String revision); }