2 * Copyright (c) 2016 Cisco Systems, Inc. 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.nb.rfc8040.rests.services.api;
10 import javax.ws.rs.Consumes;
11 import javax.ws.rs.DELETE;
12 import javax.ws.rs.Encoded;
13 import javax.ws.rs.GET;
14 import javax.ws.rs.POST;
15 import javax.ws.rs.PUT;
16 import javax.ws.rs.Path;
17 import javax.ws.rs.PathParam;
18 import javax.ws.rs.Produces;
19 import javax.ws.rs.core.Context;
20 import javax.ws.rs.core.MediaType;
21 import javax.ws.rs.core.Response;
22 import javax.ws.rs.core.UriInfo;
23 import org.opendaylight.restconf.common.context.NormalizedNodeContext;
24 import org.opendaylight.restconf.common.patch.Patch;
25 import org.opendaylight.restconf.common.patch.PatchContext;
26 import org.opendaylight.restconf.common.patch.PatchStatusContext;
27 import org.opendaylight.restconf.nb.rfc8040.Rfc8040;
28 import org.opendaylight.restconf.nb.rfc8040.services.simple.api.UpdateHandlers;
29 import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
32 * The "{+restconf}/data" subtree represents the datastore resource type, which
33 * is a collection of configuration data and state data nodes.
36 public interface RestconfDataService extends UpdateHandlers {
39 * Get target data resource.
45 * @return {@link NormalizedNodeContext}
48 @Path("/data/{identifier:.+}")
50 Rfc8040.MediaTypes.DATA + RestconfConstants.JSON,
51 Rfc8040.MediaTypes.DATA + RestconfConstants.XML,
52 Rfc8040.MediaTypes.DATA,
53 MediaType.APPLICATION_JSON,
54 MediaType.APPLICATION_XML,
57 Response readData(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
60 * Get target data resource from data root.
64 * @return {@link NormalizedNodeContext}
69 Rfc8040.MediaTypes.DATA + RestconfConstants.JSON,
70 Rfc8040.MediaTypes.DATA + RestconfConstants.XML,
71 Rfc8040.MediaTypes.DATA,
72 MediaType.APPLICATION_JSON,
73 MediaType.APPLICATION_XML,
76 Response readData(@Context UriInfo uriInfo);
79 * Create or replace the target data resource.
84 * data node for put to config DS
85 * @return {@link Response}
88 @Path("/data/{identifier:.+}")
90 Rfc8040.MediaTypes.DATA + RestconfConstants.JSON,
91 Rfc8040.MediaTypes.DATA + RestconfConstants.XML,
92 Rfc8040.MediaTypes.DATA,
93 MediaType.APPLICATION_JSON,
94 MediaType.APPLICATION_XML,
97 Response putData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
98 @Context UriInfo uriInfo);
101 * Create a data resource in target.
109 * @return {@link Response}
112 @Path("/data/{identifier:.+}")
114 Rfc8040.MediaTypes.DATA + RestconfConstants.JSON,
115 Rfc8040.MediaTypes.DATA + RestconfConstants.XML,
116 Rfc8040.MediaTypes.DATA,
117 MediaType.APPLICATION_JSON,
118 MediaType.APPLICATION_XML,
121 Response postData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
122 @Context UriInfo uriInfo);
125 * Create a data resource.
131 * @return {@link Response}
136 Rfc8040.MediaTypes.DATA + RestconfConstants.JSON,
137 Rfc8040.MediaTypes.DATA + RestconfConstants.XML,
138 Rfc8040.MediaTypes.DATA,
139 MediaType.APPLICATION_JSON,
140 MediaType.APPLICATION_XML,
143 Response postData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
146 * Delete the target data resource.
150 * @return {@link Response}
153 @Path("/data/{identifier:.+}")
154 Response deleteData(@Encoded @PathParam("identifier") String identifier);
157 * Ordered list of edits that are applied to the target datastore by the
166 * @return {@link PatchStatusContext}
169 @Path("/data/{identifier:.+}")
171 Rfc8040.MediaTypes.YANG_PATCH + RestconfConstants.JSON,
172 Rfc8040.MediaTypes.YANG_PATCH + RestconfConstants.XML
175 Rfc8040.MediaTypes.YANG_PATCH_STATUS + RestconfConstants.JSON,
176 Rfc8040.MediaTypes.YANG_PATCH_STATUS + RestconfConstants.XML
178 PatchStatusContext patchData(@Encoded @PathParam("identifier") String identifier, PatchContext context,
179 @Context UriInfo uriInfo);
182 * Ordered list of edits that are applied to the datastore by the server.
188 * @return {@link PatchStatusContext}
193 Rfc8040.MediaTypes.YANG_PATCH + RestconfConstants.JSON,
194 Rfc8040.MediaTypes.YANG_PATCH + RestconfConstants.XML
197 Rfc8040.MediaTypes.YANG_PATCH_STATUS + RestconfConstants.JSON,
198 Rfc8040.MediaTypes.YANG_PATCH_STATUS + RestconfConstants.XML
200 PatchStatusContext patchData(PatchContext context, @Context UriInfo uriInfo);
204 * Partially modify the target data resource.
209 * data node for put to config DS
210 * @return {@link Response}
213 @Path("/data/{identifier:.+}")
215 Rfc8040.MediaTypes.DATA + RestconfConstants.JSON,
216 Rfc8040.MediaTypes.DATA + RestconfConstants.XML,
217 Rfc8040.MediaTypes.DATA,
218 MediaType.APPLICATION_JSON,
219 MediaType.APPLICATION_XML,
222 Response patchData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
223 @Context UriInfo uriInfo);