320c99880219b810f50f6f101b57c217eec8a039
[policy/apex-pdp.git] /
1 //
2 // ============LICENSE_START=======================================================
3 //  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 // ================================================================================
5 // This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
6 // Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
7 // 
8 // SPDX-License-Identifier: CC-BY-4.0
9 // ============LICENSE_END=========================================================
10 //
11 // @author Sven van der Meer (sven.van.der.meer@ericsson.com)
12 //
13
14 == REST Requestor IO
15
16 APEX can act as REST requestor on the input as well as on the output interface.
17 The media type is `application/json`, so this plugin does only work with the JSON Event protocol.
18
19 === REST Requestor Input
20
21 APEX will connect to a given URL to request an input.
22
23 [source%nowrap,json]
24 ----
25 "carrierTechnologyParameters": {
26   "carrierTechnology": "RESTREQUESTOR", <1>
27   "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters",
28   "parameters": {
29     "url": "http://localhost:54321/some/path/to/rest/resource", <2>
30     "httpMethod": "POST", <3>
31     "restRequestTimeout": 2000 <4>
32   }
33 },
34 ----
35
36 <1> set REST requestor as carrier technology
37 <2> the URL of the HTTP server for events
38 <3> use HTTP PUT (remove this line to use HTTP POST)
39 <4> request timeout in milliseconds
40
41 Further settings are required on the consumer to define the event that is requested, for example:
42
43 [source%nowrap,json]
44 ----
45 "eventName": "GuardResponseEvent", <1>
46 "eventNameFilter": "GuardResponseEvent", <2>
47 "requestorMode": true, <3>
48 "requestorPeer": "GuardRequestorProducer", <4>
49 "requestorTimeout": 500 <5>
50 ----
51
52 <1> the event name
53 <2> a filter on the event
54 <3> the mode of the requestor
55 <4> a peer for the requestor
56 <5> a general request timeout
57
58
59 === REST Requestor Output
60
61 APEX will connect to a given URL to send events, but not receive any events.
62
63 [source%nowrap,json]
64 ----
65 "carrierTechnologyParameters": {
66   "carrierTechnology": "RESTREQUESTOR", <1>
67   "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters"
68 },
69 ----
70
71 <1> set REST requestor as carrier technology
72
73 Further settings are required on the consumer to define the event that is requested, for example:
74
75 [source%nowrap,json]
76 ----
77 "eventNameFilter": "GuardRequestEvent", <1>
78 "requestorMode": true, <2>
79 "requestorPeer": "GuardRequestorConsumer", <3>
80 "requestorTimeout": 500 <4>
81 ----
82
83 <1> a filter on the event
84 <2> the mode of the requestor
85 <3> a peer for the requestor
86 <4> a general request timeout