0d5cde11c34157fa672bcc1aae627785c0cc7f53
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / 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.nb.rfc8040.rests.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.restconf.common.context.NormalizedNodeContext;
20 import org.opendaylight.restconf.nb.rfc8040.MediaTypes;
21
22 /**
23  * An operation resource represents a protocol operation defined with the YANG {@code rpc} statement. It is invoked
24  * using a POST method on the operation resource.
25  */
26 public interface RestconfInvokeOperationsService {
27     /**
28      * Invoke RPC operation.
29      *
30      * @param identifier module name and rpc identifier string for the desired operation
31      * @param payload {@link NormalizedNodeContext} - the body of the operation
32      * @param uriInfo URI info
33      * @return {@link NormalizedNodeContext}
34      */
35     @POST
36     @Path("/operations/{identifier:.+}")
37     @Produces({
38         MediaTypes.APPLICATION_YANG_DATA_JSON,
39         MediaTypes.APPLICATION_YANG_DATA_XML,
40         MediaType.APPLICATION_JSON,
41         MediaType.APPLICATION_XML,
42         MediaType.TEXT_XML
43     })
44     @Consumes({
45         MediaTypes.APPLICATION_YANG_DATA_JSON,
46         MediaTypes.APPLICATION_YANG_DATA_XML,
47         MediaType.APPLICATION_JSON,
48         MediaType.APPLICATION_XML,
49         MediaType.TEXT_XML
50     })
51     NormalizedNodeContext invokeRpc(@Encoded @PathParam("identifier") String identifier,
52             NormalizedNodeContext payload, @Context UriInfo uriInfo);
53 }