Merge changes I6ff6c55c,I92b7e285
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / 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.controller.sal.rest.api;
9
10 import javax.ws.rs.GET;
11 import javax.ws.rs.POST;
12 import javax.ws.rs.PUT;
13 import javax.ws.rs.Path;
14 import javax.ws.rs.PathParam;
15 import javax.ws.rs.Produces;
16 import javax.ws.rs.core.MediaType;
17 import javax.ws.rs.core.Response;
18
19 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
20 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
21
22 /**
23  *   The URI hierarchy for the RESTCONF resources consists of an entry
24  *   point container, 3 top-level resources, and 1 field.  Refer to
25  *  Section 5 for details on each URI.
26  *    <ul>
27  *    <li><b>/restconf</b> - {@link #getRoot()}
28  *     <ul><li><b>/config</b> 
29  *         <li><b>/operational</b> - {@link #readAllData()} - Added in Draft02
30  *         <li><b>/datastore</b> - {@link #readAllData()}
31  *         <ul>
32  *            <li>/(top-level-data-nodes) (config=true or false)
33  *         </ul>
34  *         <li>/modules
35  *          <ul><li>/module
36  *              <li>/name
37  *              <li>/revision
38  *              <li>/namespace
39  *              <li>/feature
40  *             <li>/deviation
41  *          </ul>
42  *          <li>/operations
43  *          <ul>
44  *             <li>/(custom protocol operations)
45  *          </ul>
46  *         <li>/version (field)
47  *     </ul>
48  */
49 @Path("/")
50 public interface RestconfService extends RestconfServiceLegacy {
51
52     public static final String XML = "+xml";
53     public static final String JSON = "+json";
54
55     @GET
56     public Object getRoot();
57
58     @GET
59     @Path("/modules")
60     @Produces({Draft01.MediaTypes.API+JSON,Draft01.MediaTypes.API+XML,
61                Draft02.MediaTypes.API+JSON,Draft02.MediaTypes.API+XML})
62     public StructuredData getModules();
63
64     @POST
65     @Path("/operations/{identifier}")
66     @Produces({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML,
67                Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
68                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
69     public StructuredData invokeRpc(@PathParam("identifier") String identifier, CompositeNode payload);
70     
71     @GET
72     @Path("/config/{identifier:.+}")
73     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
74                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
75     public StructuredData readConfigurationData(@PathParam("identifier") String identifier);
76     
77     @POST
78     @Path("/config/{identifier:.+}")
79     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
80                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
81     public Response createConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
82
83     @PUT
84     @Path("/config/{identifier:.+}")
85     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
86                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
87     public Response updateConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
88
89     @GET
90     @Path("/operational/{identifier:.+}")
91     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
92                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
93     public StructuredData readOperationalData(@PathParam("identifier") String identifier);
94
95     @POST
96     @Path("/operational/{identifier:.+}")
97     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
98                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
99     public Response createOperationalData(@PathParam("identifier") String identifier, CompositeNode payload);
100
101     @PUT
102     @Path("/operational/{identifier:.+}")
103     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
104                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
105     public Response updateOperationalData(@PathParam("identifier") String identifier, CompositeNode payload);
106
107 }