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.container.AsyncResponse;
20 import javax.ws.rs.container.Suspended;
21 import javax.ws.rs.core.Context;
22 import javax.ws.rs.core.MediaType;
23 import javax.ws.rs.core.Response;
24 import javax.ws.rs.core.UriInfo;
25 import org.opendaylight.restconf.common.patch.Patch;
26 import org.opendaylight.restconf.common.patch.PatchContext;
27 import org.opendaylight.restconf.common.patch.PatchStatusContext;
28 import org.opendaylight.restconf.nb.rfc8040.MediaTypes;
29 import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
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 {
38 * Get target data resource.
44 * @return {@link NormalizedNodePayload}
47 @Path("/data/{identifier:.+}")
49 MediaTypes.APPLICATION_YANG_DATA_JSON,
50 MediaTypes.APPLICATION_YANG_DATA_XML,
51 MediaType.APPLICATION_JSON,
52 MediaType.APPLICATION_XML,
55 Response readData(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
58 * Get target data resource from data root.
62 * @return {@link NormalizedNodePayload}
67 MediaTypes.APPLICATION_YANG_DATA_JSON,
68 MediaTypes.APPLICATION_YANG_DATA_XML,
69 MediaType.APPLICATION_JSON,
70 MediaType.APPLICATION_XML,
73 Response readData(@Context UriInfo uriInfo);
76 * Create or replace the target data resource.
81 * data node for put to config DS
82 * @return {@link Response}
85 @Path("/data/{identifier:.+}")
87 MediaTypes.APPLICATION_YANG_DATA_JSON,
88 MediaTypes.APPLICATION_YANG_DATA_XML,
89 MediaType.APPLICATION_JSON,
90 MediaType.APPLICATION_XML,
93 Response putData(@Encoded @PathParam("identifier") String identifier, NormalizedNodePayload payload,
94 @Context UriInfo uriInfo);
97 * Create a data resource in target.
105 * @return {@link Response}
108 @Path("/data/{identifier:.+}")
110 MediaTypes.APPLICATION_YANG_DATA_JSON,
111 MediaTypes.APPLICATION_YANG_DATA_XML,
112 MediaType.APPLICATION_JSON,
113 MediaType.APPLICATION_XML,
116 Response postData(@Encoded @PathParam("identifier") String identifier, NormalizedNodePayload payload,
117 @Context UriInfo uriInfo);
120 * Create a data resource.
126 * @return {@link Response}
131 MediaTypes.APPLICATION_YANG_DATA_JSON,
132 MediaTypes.APPLICATION_YANG_DATA_XML,
133 MediaType.APPLICATION_JSON,
134 MediaType.APPLICATION_XML,
137 Response postData(NormalizedNodePayload payload, @Context UriInfo uriInfo);
140 * Delete the target data resource.
142 * @param identifier path to target
143 * @param ar {@link AsyncResponse} which needs to be completed
146 @Path("/data/{identifier:.+}")
147 void deleteData(@Encoded @PathParam("identifier") String identifier, @Suspended AsyncResponse ar);
150 * Ordered list of edits that are applied to the target datastore by the
159 * @return {@link PatchStatusContext}
162 @Path("/data/{identifier:.+}")
164 MediaTypes.APPLICATION_YANG_PATCH_JSON,
165 MediaTypes.APPLICATION_YANG_PATCH_XML
168 MediaTypes.APPLICATION_YANG_DATA_JSON,
169 MediaTypes.APPLICATION_YANG_DATA_XML
171 PatchStatusContext patchData(@Encoded @PathParam("identifier") String identifier, PatchContext context,
172 @Context UriInfo uriInfo);
175 * Ordered list of edits that are applied to the datastore by the server.
181 * @return {@link PatchStatusContext}
186 MediaTypes.APPLICATION_YANG_PATCH_JSON,
187 MediaTypes.APPLICATION_YANG_PATCH_XML
190 MediaTypes.APPLICATION_YANG_DATA_JSON,
191 MediaTypes.APPLICATION_YANG_DATA_XML
193 PatchStatusContext patchData(PatchContext context, @Context UriInfo uriInfo);
196 * Partially modify the target data resource.
198 * @param identifier path to target
199 * @param payload data node for put to config DS
200 * @param ar {@link AsyncResponse} which needs to be completed
203 @Path("/data/{identifier:.+}")
205 MediaTypes.APPLICATION_YANG_DATA_JSON,
206 MediaTypes.APPLICATION_YANG_DATA_XML,
207 MediaType.APPLICATION_JSON,
208 MediaType.APPLICATION_XML,
211 void patchData(@Encoded @PathParam("identifier") String identifier, NormalizedNodePayload payload,
212 @Context UriInfo uriInfo, @Suspended AsyncResponse ar);