beea6b8d9320ff514b1a2ccfdb66dc85172fd10c
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / restconf / impl / 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.restconf.impl;
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
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
19
20 import static org.opendaylight.controller.sal.restconf.impl.MediaTypes.*;
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>/datastore</b> - {@link #readAllData()}
29  *         <ul>
30  *            <li>/(top-level-data-nodes) (config=true or false)
31  *         </ul>
32  *         <li>/modules
33  *          <ul><li>/module
34  *              <li>/name
35  *              <li>/revision
36  *              <li>/namespace
37  *              <li>/feature
38  *             <li>/deviation
39  *          </ul>
40  *          <li>/operations
41  *          <ul>
42  *             <li>/(custom protocol operations)
43  *          </ul>
44  *         <li>/version (field)
45  *     </ul>
46  */
47 @Path("restconf")
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("/datastore")
58     @Produces({API+JSON,API+XML})
59     public Object readAllData();
60     
61     @GET
62     @Path("/datastore/{identifier}")
63     @Produces({API+XML})
64     public Object readData(@PathParam("identifier") String identifier);
65     
66     @PUT
67     @Path("/datastore/{identifier}")
68     @Produces({API+XML})
69     public Object createConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
70     
71     @POST
72     @Path("/datastore/{identifier}")
73     @Produces({API+XML})
74     public Object updateConfigurationData(@PathParam("identifier") String identifier, CompositeNode payload);
75     
76     
77     
78     @GET
79     @Path("/modules")
80     @Produces(API+XML)
81     public Object getModules();
82     
83     @POST
84     @Path("/operations/{identifier}")
85     @Produces(API+XML)
86     public RpcResult<CompositeNode> invokeRpc(@PathParam("identifier") String identifier, CompositeNode payload);
87 }