X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=README.md;h=0da4736dce91d6d995946527e78ca04205ccee43;hb=refs%2Fheads%2Fmaster;hp=d17a448e31c1e075a562d75570f0667f939a3196;hpb=8a665d85c9ea91f024e9a378779aad107550b832;p=aai%2Frest-client.git diff --git a/README.md b/README.md index d17a448..0da4736 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,19 @@ In order to make the _REST Client_ library available to your microservice, inclu org.openecomp.aai rest-client - 1.0.0-SNAPSHOT + 1.2.0-SNAPSHOT ## 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,12 +31,30 @@ 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 Once your service has a client instance, it can query the _Active & Available Inventory_ by specifying an HTTP endpoint, headers, and the expected response format: - MultivaluedMap headers = new MultivaluedMapImpl(); + MultivaluedMap headers = new MultivaluedHashMap<>(); headers.put("Accept", Arrays.asList(new String[]{"application/json"})); headers.put("X-FromAppId", Arrays.asList(new String[]{"APP-ID"})); headers.put("X-TransactionId", Arrays.asList(new String[]{UUID.randomUUID().toString()}));