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.restful.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.netconf.sal.rest.impl.PATCH;
24 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
25 import org.opendaylight.netconf.sal.restconf.impl.PATCHContext;
26 import org.opendaylight.netconf.sal.restconf.impl.PATCHStatusContext;
27 import org.opendaylight.restconf.Draft17;
28 import org.opendaylight.restconf.utils.RestconfConstants;
31 * The "{+restconf}/data" subtree represents the datastore resource type, which
32 * is a collection of configuration data and state data nodes
35 public interface RestconfDataService {
38 * Get target data resource.
44 * @return {@link NormalizedNodeContext}
47 @Path("/data/{identifier:.+}")
48 @Produces({ Draft17.MediaTypes.DATA + RestconfConstants.JSON, Draft17.MediaTypes.DATA, MediaType.APPLICATION_JSON,
49 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
50 Response readData(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
53 * Get target data resource from data root.
57 * @return {@link NormalizedNodeContext}
61 @Produces({ Draft17.MediaTypes.DATA + RestconfConstants.JSON, Draft17.MediaTypes.DATA, MediaType.APPLICATION_JSON,
62 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
63 Response readData(@Context UriInfo uriInfo);
66 * Create or replace the target data resource.
71 * - data node for put to config DS
72 * @return {@link Response}
75 @Path("/data/{identifier:.+}")
76 @Consumes({ Draft17.MediaTypes.DATA + RestconfConstants.JSON, Draft17.MediaTypes.DATA, MediaType.APPLICATION_JSON,
77 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
78 Response putData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload);
81 * Create a data resource in target.
89 * @return {@link Response}
92 @Path("/data/{identifier:.+}")
93 @Consumes({ Draft17.MediaTypes.DATA + RestconfConstants.JSON, Draft17.MediaTypes.DATA, MediaType.APPLICATION_JSON,
94 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
95 Response postData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
96 @Context UriInfo uriInfo);
99 * Create a data resource.
105 * @return {@link Response}
109 @Consumes({ Draft17.MediaTypes.DATA + RestconfConstants.JSON, Draft17.MediaTypes.DATA, MediaType.APPLICATION_JSON,
110 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
111 Response postData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
114 * Delete the target data resource.
118 * @return {@link Response}
121 @Path("/data/{identifier:.+}")
122 Response deleteData(@Encoded @PathParam("identifier") String identifier);
125 * Ordered list of edits that are applied to the target datastore by the
134 * @return {@link PATCHStatusContext}
137 @Path("/data/{identifier:.+}")
138 @Consumes({ Draft17.MediaTypes.PATCH + RestconfConstants.JSON, Draft17.MediaTypes.PATCH + RestconfConstants.XML })
139 @Produces({ Draft17.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
140 Draft17.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
141 PATCHStatusContext patchData(@Encoded @PathParam("identifier") String identifier, PATCHContext context,
142 @Context UriInfo uriInfo);
145 * Ordered list of edits that are applied to the datastore by the server.
151 * @return {@link PATCHStatusContext}
155 @Consumes({ Draft17.MediaTypes.PATCH + RestconfConstants.JSON, Draft17.MediaTypes.PATCH + RestconfConstants.XML })
156 @Produces({ Draft17.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
157 Draft17.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
158 PATCHStatusContext patchData(PATCHContext context, @Context UriInfo uriInfo);