Merge "Added tests for yang.model.util"
[yangtools.git] / restconf / restconf-jaxrs-api / src / main / java / org / opendaylight / yangtools / RestRestconfService.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.yangtools;
9
10 import javax.ws.rs.Consumes;
11 import javax.ws.rs.DELETE;
12 import javax.ws.rs.GET;
13 import javax.ws.rs.POST;
14 import javax.ws.rs.PUT;
15 import javax.ws.rs.Path;
16 import javax.ws.rs.PathParam;
17 import javax.ws.rs.Produces;
18 import javax.ws.rs.QueryParam;
19 import javax.ws.rs.core.MediaType;
20 import javax.ws.rs.core.Response;
21 import org.opendaylight.yangtools.draft.Draft01;
22 import org.opendaylight.yangtools.draft.Draft02;
23 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
24
25 @Path("restconf")
26 public interface RestRestconfService {
27
28     public static final String IDENTIFIER = "identifier";
29     public static final String INPUT = "input";
30     public static final String XML = "+xml";
31     public static final String JSON = "+json";
32
33     @GET
34     public Object getRoot();
35
36     @GET
37     @Path("/modules")
38     @Produces({Draft01.MediaTypes.API+JSON,Draft01.MediaTypes.API+XML,
39             Draft02.MediaTypes.API+JSON,Draft02.MediaTypes.API+XML})
40     public String getModules();
41
42     @POST
43     @Path("/operations/{identifier}")
44     @Produces({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML,
45             Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
46             MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
47     @Consumes({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML,
48             Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
49             MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
50     public String invokeRpc(@PathParam(IDENTIFIER) String identifier, @QueryParam(INPUT) CompositeNode payload);
51
52     @POST
53     @Path("/operations/{identifier}")
54     @Produces({Draft01.MediaTypes.DATA+JSON,Draft01.MediaTypes.DATA+XML,
55             Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
56             MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
57     public String invokeRpc(@PathParam(IDENTIFIER) String identifier);
58
59     @GET
60     @Path("/config/{identifier:.+}")
61     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
62             MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
63     public String readConfigurationData(@PathParam(IDENTIFIER) String identifier);
64
65     @GET
66     @Path("/operational/{identifier:.+}")
67     @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
68             MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
69     public String readOperationalData(@PathParam(IDENTIFIER) String identifier);
70
71     @PUT
72     @Path("/config/{identifier:.+}")
73     @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
74             MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
75     public Response updateConfigurationData(@PathParam(IDENTIFIER) String identifier,@QueryParam(INPUT) CompositeNode payload);
76
77     @POST
78     @Path("/config/{identifier:.+}")
79     @Consumes({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, @QueryParam(INPUT) CompositeNode payload);
82
83     @POST
84     @Path("/config")
85     @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
86             MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
87     public Response createConfigurationData( @QueryParam(INPUT) CompositeNode payload);
88
89     @DELETE
90     @Path("/config/{identifier:.+}")
91     public Response deleteConfigurationData(@PathParam(IDENTIFIER) String identifier);
92
93
94 }