org.apache.synapse.mediators.opa

## Class OPAClient

- java.lang.Object
- - org.apache.synapse.mediators.opa.OPAClient

-     public class OPAClient
      extends java.lang.Object

  This class represents the client used to request and retrieve OPA response for a given policy from the OPA server

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OPAClient(java.lang.String url, java.util.Map<java.lang.String,java.lang.String> additionalParameters)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.http.impl.client.CloseableHttpClient` | `createHttpClient(java.lang.String url)` Return a CloseableHttpClient instance
    `java.lang.String` | `publish(java.lang.String opaServerUrl, java.lang.String payload, java.lang.String credentials)` Method to publish the OPA payload to the OPA server

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OPAClient

          public OPAClient(java.lang.String url,
                           java.util.Map<java.lang.String,java.lang.String> additionalParameters)
                    throws OPASecurityException

      Throws:
        `OPASecurityException`

  - ### Method Detail

    - #### publish

          public java.lang.String publish(java.lang.String opaServerUrl,
                                          java.lang.String payload,
                                          java.lang.String credentials)
                                   throws OPASecurityException

      Method to publish the OPA payload to the OPA server
      Parameters:
        `opaServerUrl` - The url of the opa server
        `payload` - The payload of the request
        `credentials` - Access key of the opa validation request
      Returns:
        opa response String
      Throws:
        `OPASecurityException`

    - #### createHttpClient

          public org.apache.http.impl.client.CloseableHttpClient createHttpClient(java.lang.String url)
                                                                           throws OPASecurityException

      Return a CloseableHttpClient instance
      Parameters:
        `url` - Service endpoint.It can be http/https
      Returns:
        CloseableHttpClient
      Throws:
        `OPASecurityException`

Copyright © 2005-2022 Apache Software Foundation. All Rights Reserved.