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.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({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.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({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.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({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
77 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
78 Response putData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
79 @Context UriInfo uriInfo);
82 * Create a data resource in target.
90 * @return {@link Response}
93 @Path("/data/{identifier:.+}")
94 @Consumes({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
95 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
96 Response postData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
97 @Context UriInfo uriInfo);
100 * Create a data resource.
106 * @return {@link Response}
110 @Consumes({ Rfc8040.MediaTypes.DATA + RestconfConstants.JSON, Rfc8040.MediaTypes.DATA, MediaType.APPLICATION_JSON,
111 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
112 Response postData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
115 * Delete the target data resource.
119 * @return {@link Response}
122 @Path("/data/{identifier:.+}")
123 Response deleteData(@Encoded @PathParam("identifier") String identifier);
126 * Ordered list of edits that are applied to the target datastore by the
135 * @return {@link PatchStatusContext}
138 @Path("/data/{identifier:.+}")
139 @Consumes({ Rfc8040.MediaTypes.PATCH + RestconfConstants.JSON, Rfc8040.MediaTypes.PATCH + RestconfConstants.XML })
140 @Produces({ Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
141 Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
142 PatchStatusContext patchData(@Encoded @PathParam("identifier") String identifier, PatchContext context,
143 @Context UriInfo uriInfo);
146 * Ordered list of edits that are applied to the datastore by the server.
152 * @return {@link PatchStatusContext}
156 @Consumes({ Rfc8040.MediaTypes.PATCH + RestconfConstants.JSON, Rfc8040.MediaTypes.PATCH + RestconfConstants.XML })
157 @Produces({ Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
158 Rfc8040.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
159 PatchStatusContext patchData(PatchContext context, @Context UriInfo uriInfo);