Enabling policy registry service swagger

Learn how to enable the policy registry service swagger.

Procedure

  1. Swagger can be enabled for the policy registry service by adding the following lines to the NOI custom resource (CR) YAML file under the spec section, as in the following example.
    spec:
      helmValuesNOI:
        ibm-hdm-analytics-dev.policyregistryservice.swagger.enabled: true
    
    Note:
    You can edit the NOI CR YAML file from one of the following two ways.
    • Edit from the command line with the oc edit noi or oc edit noihybrid command, depending on whether your deployment is full cloud or hybrid.
    • Edit the deployment from Red Hat® OpenShift® with the Operator Lifecycle Manager (OLM) console: Operators > Installed Operators > IBM Cloud Pak for AIOps Event Manager. Click the NOI or NOIHybrid tab and select your deployment. Then, click the YAML tab to edit and save the YAML file. Your changes are auto-deployed.
  2. Delete the noi-operator pod to have it recreated.
    Get the noi-operator pod name.
    oc get pod | grep operator
    Delete the noi-operator pod with the oc delete command.
    oc delete pod <noi-operator pod name>
  3. After the policy registry pod restarts, it updates the deployments and adds the following value for the policy registry service.
    - name: ENABLE_SWAGGER_UI
          value: "1"
    
    You can verify the setting by running the following command.
    oc edit deployment <policyregistryservice pod name>
  4. To access the policy registry swagger, you can find the route by running the following command. Run the command on the Openshift CLI when logged into the namespace where IBM® Netcool® Operations Insight® on Red Hat OpenShift is installed.
    FULL_ROUTE=$(oc get route | grep policyregistry.ibm-netcool-prod.aiops.io) && echo $FULL_ROUTE | awk '{ print "https://"$2$3"/docs/v1alpha/system/#/"}'
    This command outputs a URL similar to the following example:
    https://netcool-evtmanager.apps.sub.mydomain.com/policyregistry.ibm-netcool-prod.aiops.io/docs/v1alpha/system/#/
  5. The swagger UI is accessible in the following format for the policy registry service.
    Version 1 cloud native analytics policies
    https://<host>/api/policies/docs/policies/system/v1/
    Version 2 cloud native analytics policies
    https://<host>/api/policies/docs/policies/system/v2/
    Where <host> is the hostname for the policy registry service, which can be found by running the following command.
    oc get route | grep policies
    Similarly, for user policies, construct the swagger UI with the following format: https://<host>/api/policies/docs/policies/user/v1 or https://<host>/api/policies/docs/policies/user/v2
    Note: Authorization for the API can be obtained from the NOI systemauth-secret in the NOI namespace. For more information, see Configure aggregation settings.