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:.+}")
49 @Produces({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
50 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
51 Response readData(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
54 * Get target data resource from data root.
58 * @return {@link NormalizedNodeContext}
62 @Produces({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
63 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
64 Response readData(@Context UriInfo uriInfo);
67 * Create or replace the target data resource.
72 * data node for put to config DS
73 * @return {@link Response}
76 @Path("/data/{identifier:.+}")
77 @Consumes({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
78 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
79 Response putData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
80 @Context UriInfo uriInfo);
83 * Create a data resource in target.
91 * @return {@link Response}
94 @Path("/data/{identifier:.+}")
95 @Consumes({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
96 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
97 Response postData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
98 @Context UriInfo uriInfo);
101 * Create a data resource.
107 * @return {@link Response}
111 @Consumes({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
112 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
113 Response postData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
116 * Delete the target data resource.
120 * @return {@link Response}
123 @Path("/data/{identifier:.+}")
124 Response deleteData(@Encoded @PathParam("identifier") String identifier);
127 * Ordered list of edits that are applied to the target datastore by the
136 * @return {@link PatchStatusContext}
139 @Path("/data/{identifier:.+}")
140 @Consumes({ Rfc8040.MediaTypes.PATCH + RestconfConstants.JSON, Rfc8040.MediaTypes.PATCH + RestconfConstants.XML })
141 @Produces({ Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
142 Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
143 PatchStatusContext patchData(@Encoded @PathParam("identifier") String identifier, PatchContext context,
144 @Context UriInfo uriInfo);
147 * Ordered list of edits that are applied to the datastore by the server.
153 * @return {@link PatchStatusContext}
157 @Consumes({ Rfc8040.MediaTypes.PATCH + RestconfConstants.JSON, Rfc8040.MediaTypes.PATCH + RestconfConstants.XML })
158 @Produces({ Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
159 Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
160 PatchStatusContext patchData(PatchContext context, @Context UriInfo uriInfo);