Bug 5679 - implement ietf-restconf-monitoring - streams
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / netconf / sal / rest / api / RestconfService.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.netconf.sal.rest.api;
9
10 import javax.ws.rs.Consumes;
11 import javax.ws.rs.DELETE;
12 import javax.ws.rs.DefaultValue;
13 import javax.ws.rs.Encoded;
14 import javax.ws.rs.GET;
15 import javax.ws.rs.POST;
16 import javax.ws.rs.PUT;
17 import javax.ws.rs.Path;
18 import javax.ws.rs.PathParam;
19 import javax.ws.rs.Produces;
20 import javax.ws.rs.core.Context;
21 import javax.ws.rs.core.MediaType;
22 import javax.ws.rs.core.Response;
23 import javax.ws.rs.core.UriInfo;
24 import org.opendaylight.netconf.sal.rest.api.Draft02.MediaTypes;
25 import org.opendaylight.netconf.sal.rest.impl.PATCH;
26 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
27 import org.opendaylight.netconf.sal.restconf.impl.PATCHContext;
28 import org.opendaylight.netconf.sal.restconf.impl.PATCHStatusContext;
29 import org.opendaylight.restconf.base.services.api.RestconfOperationsService;
30 import org.opendaylight.restconf.restful.services.api.RestconfDataService;
31 import org.opendaylight.restconf.restful.services.api.RestconfInvokeOperationsService;
32
33 /**
34  * The URI hierarchy for the RESTCONF resources consists of an entry point
35  * container, 4 top-level resources, and 1 field.
36  * <ul>
37  * <li><b>/restconf</b> - {@link #getRoot()}
38  * <ul>
39  * <li><b>/config</b> - {@link #readConfigurationData(String, UriInfo)}
40  * {@link #updateConfigurationData(String, NormalizedNodeContext, UriInfo)}
41  * {@link #createConfigurationData(NormalizedNodeContext, UriInfo)}
42  * {@link #createConfigurationData(String, NormalizedNodeContext, UriInfo)}
43  * {@link #deleteConfigurationData(String)}
44  * <li><b>/operational</b> - {@link #readOperationalData(String, UriInfo)}
45  * <li>/modules - {@link #getModules(UriInfo)}
46  * <ul>
47  * <li>/module
48  * </ul>
49  * <li><b>/operations</b> -
50  * {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
51  * {@link #invokeRpc(String, NormalizedNodeContext, UriInfo)}
52  * <li>/version (field)
53  * </ul>
54  * </ul>
55  */
56 @Path("/")
57 public interface RestconfService {
58
59     public static final String XML = "+xml";
60     public static final String JSON = "+json";
61
62     @GET
63     public Object getRoot();
64
65     /**
66      * @deprecated do not use this method. It will be replaced by
67      *             {@link RestconfDataService#readData(UriInfo)}
68      */
69     @Deprecated
70     @GET
71     @Path("/modules")
72     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
73             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
74     public NormalizedNodeContext getModules(@Context UriInfo uriInfo);
75
76     /**
77      * @deprecated do not use this method. It will be replaced by
78      *             {@link RestconfDataService#readData(String, UriInfo)}
79      */
80     @Deprecated
81     @GET
82     @Path("/modules/{identifier:.+}")
83     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
84             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
85     public NormalizedNodeContext getModules(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
86
87     /**
88      * @deprecated do not use this method. It will be replaced by
89      *             {@link RestconfDataService#readData(String, UriInfo)}
90      */
91     @Deprecated
92     @GET
93     @Path("/modules/module/{identifier:.+}")
94     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
95             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
96     public NormalizedNodeContext getModule(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
97
98     /**
99      * @deprecated do not use this method. It will be replaced by
100      *             {@link RestconfOperationsService#getOperations(UriInfo)}
101      */
102     @Deprecated
103     @GET
104     @Path("/operations")
105     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
106             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
107     public NormalizedNodeContext getOperations(@Context UriInfo uriInfo);
108
109     /**
110      * @deprecated do not use this method. It will be replaced by
111      *             {@link RestconfOperationsService#getOperations(String, UriInfo)}
112      */
113     @Deprecated
114     @GET
115     @Path("/operations/{identifier:.+}")
116     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
117             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
118     public NormalizedNodeContext getOperations(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
119
120     /**
121      * @deprecated do not use this method. It will be replaced by
122      *             {@link RestconfInvokeOperationsService#invokeRpc(String, NormalizedNodeContext, UriInfo)}
123      */
124     @Deprecated
125     @POST
126     @Path("/operations/{identifier:.+}")
127     @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
128             Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
129             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
130     @Consumes({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
131             Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
132             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
133     public NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
134             @Context UriInfo uriInfo);
135
136     @POST
137     @Path("/operations/{identifier:.+}")
138     @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
139             Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
140             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
141     @Deprecated // method isn't use anywhere
142     public NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier,
143             @DefaultValue("") String noPayload, @Context UriInfo uriInfo);
144
145     /**
146      * @deprecated do not use this method. It will be replaced by
147      *             {@link RestconfDataService#readData(String, UriInfo)}
148      */
149     @Deprecated
150     @GET
151     @Path("/config/{identifier:.+}")
152     @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
153             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
154     public NormalizedNodeContext readConfigurationData(@Encoded @PathParam("identifier") String identifier,
155             @Context UriInfo uriInfo);
156
157     /**
158      * @deprecated do not use this method. It will be replaced by
159      *             {@link RestconfDataService#readData(String, UriInfo)}
160      */
161     @Deprecated
162     @GET
163     @Path("/operational/{identifier:.+}")
164     @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
165             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
166     public NormalizedNodeContext readOperationalData(@Encoded @PathParam("identifier") String identifier,
167             @Context UriInfo uriInfo);
168
169     /**
170      * @deprecated do not use this method. It will be replaced by
171      *             {@link RestconfDataService#putData(String, NormalizedNodeContext, UriInfo)}
172      */
173     @Deprecated
174     @PUT
175     @Path("/config/{identifier:.+}")
176     @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
177             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
178     public Response updateConfigurationData(@Encoded @PathParam("identifier") String identifier,
179             NormalizedNodeContext payload, @Context UriInfo uriInfo);
180
181     /**
182      * @deprecated do not use this method. It will be replaced by
183      *             {@link RestconfDataService#postData(String, NormalizedNodeContext, UriInfo)}
184      */
185     @Deprecated
186     @POST
187     @Path("/config/{identifier:.+}")
188     @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
189             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
190     public Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, NormalizedNodeContext payload,
191             @Context UriInfo uriInfo);
192
193     /**
194      * @deprecated do not use this method. It will be replaced by
195      *             {@link RestconfDataService#postData(NormalizedNodeContext, UriInfo)}
196      */
197     @Deprecated
198     @POST
199     @Path("/config")
200     @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
201             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
202     public Response createConfigurationData(NormalizedNodeContext payload, @Context UriInfo uriInfo);
203
204     /**
205      * @deprecated do not use this method. It will be replaced by
206      *             {@link RestconfDataService#deleteData(String)}
207      */
208     @Deprecated
209     @DELETE
210     @Path("/config/{identifier:.+}")
211     public Response deleteConfigurationData(@Encoded @PathParam("identifier") String identifier);
212
213     @GET
214     @Path("/streams/stream/{identifier:.+}")
215     public NormalizedNodeContext subscribeToStream(@Encoded @PathParam("identifier") String identifier,
216             @Context UriInfo uriInfo);
217
218     /**
219      * @deprecated do not use this method. It will be replaced by
220      *             {@link RestconfDataService#readData(String, UriInfo)}
221      */
222     @Deprecated
223     @GET
224     @Path("/streams")
225     @Produces({ Draft02.MediaTypes.API + JSON, Draft02.MediaTypes.API + XML, MediaType.APPLICATION_JSON,
226             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
227     public NormalizedNodeContext getAvailableStreams(@Context UriInfo uriInfo);
228
229     /**
230      * @deprecated do not use this method. It will be replaced by
231      *             {@link RestconfDataService#patchData(String, PATCHContext, UriInfo)}
232      */
233     @Deprecated
234     @PATCH
235     @Path("/config/{identifier:.+}")
236     @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
237     @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
238     PATCHStatusContext patchConfigurationData(@Encoded @PathParam("identifier") String identifier, PATCHContext
239             context, @Context UriInfo uriInfo);
240
241     /**
242      * @deprecated do not use this method. It will be replaced by
243      *             {@link RestconfDataService#patchData(PATCHContext, UriInfo)}
244      */
245     @Deprecated
246     @PATCH
247     @Path("/config")
248     @Consumes({MediaTypes.PATCH + JSON, MediaTypes.PATCH + XML})
249     @Produces({MediaTypes.PATCH_STATUS + JSON, MediaTypes.PATCH_STATUS + XML})
250     PATCHStatusContext patchConfigurationData(PATCHContext context, @Context UriInfo uriInfo);
251 }