Bug 7231 - Upgrade ietf-restconf draft17 to draft18
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / restconf / restful / services / api / RestconfInvokeOperationsService.java
1 /*
2  * Copyright (c) 2016 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.restconf.restful.services.api;
9
10 import javax.ws.rs.Consumes;
11 import javax.ws.rs.Encoded;
12 import javax.ws.rs.POST;
13 import javax.ws.rs.Path;
14 import javax.ws.rs.PathParam;
15 import javax.ws.rs.Produces;
16 import javax.ws.rs.core.Context;
17 import javax.ws.rs.core.MediaType;
18 import javax.ws.rs.core.UriInfo;
19 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
20 import org.opendaylight.restconf.Draft18;
21 import org.opendaylight.restconf.utils.RestconfConstants;
22
23 /**
24  * An operation resource represents a protocol operation defined with the YANG
25  * "rpc" statement. It is invoked using a POST method on the operation resource.
26  *
27  */
28 public interface RestconfInvokeOperationsService {
29
30     /**
31      * Invoke RPC operation
32      *
33      * @param identifier
34      *            - module name and rpc identifier string for the desired
35      *            operation
36      * @param payload
37      *            - {@link NormalizedNodeContext} - the body of the operation
38      * @param uriInfo
39      *            - URI info
40      * @return {@link NormalizedNodeContext}
41      */
42     @POST
43     @Path("/operations/{identifier:.+}")
44     @Produces({ Draft18.MediaTypes.DATA + RestconfConstants.JSON, Draft18.MediaTypes.DATA, MediaType.APPLICATION_JSON,
45             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
46     @Consumes({ Draft18.MediaTypes.DATA + RestconfConstants.JSON, Draft18.MediaTypes.DATA, MediaType.APPLICATION_JSON,
47             MediaType.APPLICATION_XML, MediaType.TEXT_XML })
48     NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier,
49             NormalizedNodeContext payload, @Context UriInfo uriInfo);
50 }