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.Draft16;
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({ Draft16.MediaTypes.DATA + RestconfConstants.JSON, Draft16.MediaTypes.DATA, MediaType.APPLICATION_JSON,
49 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
50 Response readData(@Encoded @PathParam("identifier") String identifier,
51 @Context UriInfo uriInfo);
54 * Create or replace the target data resource.
59 * - data node for put to config DS
60 * @return {@link Response}
63 @Path("/data/{identifier:.+}")
64 @Consumes({ Draft16.MediaTypes.DATA + RestconfConstants.JSON, Draft16.MediaTypes.DATA, MediaType.APPLICATION_JSON,
65 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
66 Response putData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload);
69 * Create a data resource in target.
77 * @return {@link Response}
80 @Path("/data/{identifier:.+}")
81 @Consumes({ Draft16.MediaTypes.DATA + RestconfConstants.JSON, Draft16.MediaTypes.DATA, MediaType.APPLICATION_JSON,
82 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
83 Response postData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
84 @Context UriInfo uriInfo);
87 * Create a data resource.
93 * @return {@link Response}
97 @Consumes({ Draft16.MediaTypes.DATA + RestconfConstants.JSON, Draft16.MediaTypes.DATA, MediaType.APPLICATION_JSON,
98 MediaType.APPLICATION_XML, MediaType.TEXT_XML })
99 Response postData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
102 * Delete the target data resource.
106 * @return {@link Response}
109 @Path("/data/{identifier:.+}")
110 Response deleteData(@Encoded @PathParam("identifier") String identifier);
113 * Ordered list of edits that are applied to the target datastore by the
122 * @return {@link PATCHStatusContext}
125 @Path("/data/{identifier:.+}")
126 @Consumes({ Draft16.MediaTypes.PATCH + RestconfConstants.JSON, Draft16.MediaTypes.PATCH + RestconfConstants.XML })
127 @Produces({ Draft16.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
128 Draft16.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
129 PATCHStatusContext patchData(@Encoded @PathParam("identifier") String identifier, PATCHContext context,
130 @Context UriInfo uriInfo);
133 * Ordered list of edits that are applied to the datastore by the server.
139 * @return {@link PATCHStatusContext}
143 @Consumes({ Draft16.MediaTypes.PATCH + RestconfConstants.JSON, Draft16.MediaTypes.PATCH + RestconfConstants.XML })
144 @Produces({ Draft16.MediaTypes.PATCH_STATUS + RestconfConstants.JSON,
145 Draft16.MediaTypes.PATCH_STATUS + RestconfConstants.XML })
146 PATCHStatusContext patchData(PATCHContext context, @Context UriInfo uriInfo);