1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# Overview
[![alt text](https://bestpractices.coreinfrastructure.org/projects/1737/badge)](https://bestpractices.coreinfrastructure.org/projects/1737)
This component contains a number of general Apache Camel components which are intended for use by the data-router.
# Maven Dependency
To make use of the Camel components included in this repository, include the following artifact in your dependencies list:
<dependency>
<groupId>org.openecomp</groupId>
<artifactId>router-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
# How to Build:
> mvn clean install
## Rest Client Component
The REST client component provides a simple endpoint for sending HTTP requests to a REST endpoint.
### URI Format
ecomp-rest:op[?options]
Where,
op = One of GET, PUT, POST, or DELETE
### URI Options
The following option parameters must be passed in to the component for HTTPS communications:
| Parameter | Description |
| --------- | ----------- |
| ecomp-client-cert | Fully qualified path to the client certificate to use for HTTPS communications. |
| ecomp-keystore | Fully qualified path to the keystore file to use for HTTP communications. |
| ecomp-keystore-password | Obfuscated password for the keystore. |
### IN Message
#### Ecomp-Rest Header Parameters
| Header Name | Description |
| ----------- | ----------- |
| ecomp-url | The fully qualified URL for the HTTP request to be send. This is mandatory. |
#### HTTP Header Parameters
The following parameters, if they are present in the Exchange In Message Headers, will be included as header values
in the HTTP request generated by the component:
| HTTP Header Name |
| ---------------- |
| X-FromAppId |
| X-TransactionId |
| resourceVersion |
| ETag |
| If-Match |
| If-None-Match |
| Accept |
#### Message Body
For HTTP operations that require a content body, the body of the IN message will be used.
### OUT Message
#### Headers
The following header values are populated on the OUT message:
| ecomp-response-code | The response code produced by the HTTP request. |
| ecomp-response-message | The response message produced by the HTTP request. |
#### Message Body
For HTTP operations that produce a content body, the body of the OUT message will be populated with this result.
### Example
The following route file illustrates a simple example which takes console input and invokes the rest client, using the input from the
console as the content body for the REST request.
<route xmlns="http://camel.apache.org/schema/spring" trace="true">
<!-- Take some input from the console. -->
<from uri="stream:in?promptMessage=Enter Something: " />
<!-- Set the URL that we want to send our REST request to. -->
<setHeader headerName="ecomp-url">
<constant>https://localhost:9509/services/search-data-service/v1/search/indexes/gdf/documents/88</constant>
</setHeader>
<!-- Set values for some HTTP headers that we want to populate for our reqeust. -->
<setHeader headerName="X-FromAppId">
<constant>DataLayer</constant>
</setHeader>
<setHeader headerName="X-TransactionId">
<constant>gdf1</constant>
</setHeader>
<!-- Invoke the REST client, using our console input as the content body of our request. -->
<!-- Note that we provide the paths to the client certificate and keystore, as well as -->
<!-- the obfuscated password for the keystore. -->
<to uri="ecomp-rest:put?ecompClientCert=c:/dev/dl_microservice/target/swm/package/nix/dist_files/opt/app/ajsc-aai-data-layer-microservice/bundleconfig/etc/auth/aai-client-cert.p12&ecompKeystore=c:/dev/dl_microservice/target/swm/package/nix/dist_files/opt/app/ajsc-aai-data-layer-microservice/bundleconfig/etc/auth/tomcat_keystore&ecompKeystorePassword=70c87528c88dcd9f9c2558d30e817868"/>
<to uri="stream:out" />
</route>
|