diff options
author | dave.adams (da490c) <dave.adams@amdocs.com> | 2017-05-24 17:08:10 -0400 |
---|---|---|
committer | dave.adams (da490c) <dave.adams@amdocs.com> | 2017-05-24 17:53:38 -0400 |
commit | f709acf2e6fc372ed36e0d2612a0b25ff1d582de (patch) | |
tree | 7fe2d851dec0baf8b0018c6bc692bca99fbb22f4 /README.md | |
parent | 80fa392258c5ea6f88e99441630b7c303237b1d1 (diff) |
Update rest-client with additional operations
Change-Id: Ia19c5156d40c816dc1ee77cece92c43f40791c59
Signed-off-by: dave.adams (da490c) <dave.adams@amdocs.com>
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -11,16 +11,19 @@ In order to make the _REST Client_ library available to your microservice, inclu <dependency> <groupId>org.openecomp.aai</groupId> <artifactId>rest-client</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> </dependency> ## Code Examples ### Creating and Configuring a Client Instance -In order to start talking to a service, you need to create a client instance and configure it. The _RestClient_ uses a fluent interface which allows it to be both instantiated and configured as in the following example: +In order to start talking to a service, you need to create a client instance and configure it. The _RestClient_ uses a fluent interface which allows it to be both instantiated and configured as in the following examples: + +i) A client using an SSL Client Certificate: // Create an instance of the Rest Client and configure it. RestClient myClient = new RestClient() + .authenticationMode(RestAuthenticationMode.SSL_CERT) .validateServerHostname(false) .validateServerCertChain(true) .clientCertFile("certificate_filename") @@ -28,6 +31,24 @@ In order to start talking to a service, you need to create a client instance and .connectTimeoutMs(1000) .readTimeoutMs(1000) +ii) A client using SSL Basic-Auth: + + // Create an instance of the Rest Client and configure it. + RestClient myClient = new RestClient() + .authenticationMode(RestAuthenticationMode.SSL_BASIC) + .basicAuthUsername("username") + .basicAuthPassword("password") + .connectTimeoutMs(1000) + .readTimeoutMs(1000) + +iii) A client using non-authentication HTTP: + + // Create an instance of the Rest Client and configure it. + RestClient myClient = new RestClient() + .authenticationMode(RestAuthenticationMode.HTTP_NOAUTH) + .connectTimeoutMs(1000) + .readTimeoutMs(1000) + Note, that all of the above configuration parameters are optional and will be set to default values if they are not specified. ### Querying The A&AI |