Merge "Removed unused code from md-sal."
[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.Consumes;
11 import javax.ws.rs.DELETE;
12 import javax.ws.rs.DefaultValue;
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.MediaType;
20 import javax.ws.rs.core.Response;
21
22 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
23 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
24
25 /**
26  *   The URI hierarchy for the RESTCONF resources consists of an entry
27  *   point container, 4 top-level resources, and 1 field.
28  *   <ul>
29  *    <li><b>/restconf</b> - {@link #getRoot()}
30  *     <ul>
31  *      <li><b>/config</b> - {@link #readConfigurationData(String)} 
32  *                              {@link #updateConfigurationData(String, CompositeNode)}
33  *                              {@link #createConfigurationData(CompositeNode)}
34  *                              {@link #createConfigurationData(String, CompositeNode)}
35  *                              {@link #deleteConfigurationData(String)}
36  *      <li><b>/operational</b> - {@link #readOperationalData(String)} 
37  *      <li>/modules - {@link #getModules()}
38  *       <ul>
39  *        <li>/module
40  *       </ul>
41  *      <li><b>/operations</b> - {@link #invokeRpc(String, CompositeNode)}
42  *                               {@link #invokeRpc(String, CompositeNode)}
43  *      <li>/version (field)
44  *     </ul>
45  *   </ul>
46  */
47 @Path("/")
48 public interface RestconfService {
49
50     public static final String XML = "+xml";
51     public static final String JSON = "+json";
52
53     @GET
54     public Object getRoot();
55
56     @GET
57     @Path("/modules")
58     @Produces({Draft02.MediaTypes.API+JSON,Draft02.MediaTypes.API+XML})
59     public StructuredData getModules();
60
61     @POST
62     @Path("/operations/{identifier}")
63     @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
64                Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
65                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
66     @Consumes({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+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     @POST
72     @Path("/operations/{identifier}")
73     @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
74                Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
75                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
76     public StructuredData invokeRpc(@PathParam("identifier") String identifier, @DefaultValue("") String noPayload);
77     
78     @GET
79     @Path("/config/{identifier:.+}")
80     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
81                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
82     public StructuredData readConfigurationData(@PathParam("identifier") String identifier);
83
84     @GET
85     @Path("/operational/{identifier:.+}")
86     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
87                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
88     public StructuredData readOperationalData(@PathParam("identifier") String identifier);
89
90     @PUT
91     @Path("/config/{identifier:.+}")
92     @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
93                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
94     public Response updateConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
95
96     @POST
97     @Path("/config/{identifier:.+}")
98     @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
99                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
100     public Response createConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
101
102     @POST
103     @Path("/config")
104     @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML, 
105                MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
106     public Response createConfigurationData(CompositeNode payload);
107
108     @DELETE
109     @Path("/config/{identifier:.+}")
110     public Response deleteConfigurationData(@PathParam("identifier") String identifier);
111
112 }