As an Admin, you can enable the Db2 REST interface for an existing Data
Virtualization
deployment on Cloud Pak for Data.
Before you begin
Required role: To enable the Db2 REST interface, you must have the Data
Virtualization Admin role.
Note:
Db2 REST API endpoints are defined as
stored procedures in Db2. By default, if your
API endpoint queries data from tables, the query impersonates the API endpoint definer. As a
result, the Data
Virtualization authorizations and IBM
Knowledge Catalog data protection rules that apply to the definer
of the API endpoint, rather than to the caller of the API, are enforced when the API is called. To
use the permissions of the caller of the API, set the isDefiner parameter to
false when you define the Db2 REST service.
Procedure
To enable the Db2 REST interface in Data
Virtualization, follow these steps.
- Run the following command to enable REST support for the Data
Virtualization instance:
oc edit db2ucluster db2u-dv
Set the rest value to enabled: true. The edited file
looks similar to the following example.
addOns:
rest:
enabled: true
- Run the following command to view the REST service and deployment information.
oc get formations.db2u.databases.ibm.com db2u-dv -o go-template='{{range .status.components}}{{printf "%s,%s,%s\n" .kind .name .status.state}}{{end}}' | column -s, -t
The results look similar to the following example:
service c-db2u-dv-db2u-rest-svc Creating
Deployment c-db2u-dv-rest Creating
- Run the following command to view the REST pod as part of your deployment.
oc get pods |grep db2
The following example highlights the REST pod.
c-db2u-dv-db2u-0 1/1 Running 0 39m
c-db2u-dv-etcd-0 1/1 Running 0 39m
c-db2u-dv-instdb-df7hh 0/1 Completed 0 40m
c-db2u-dv-ldap-64bc6d58dc-ms29x 1/1 Running 0 40m
c-db2u-dv-rest-66f7fcb7d4-98fbh 1/1 Running 0 86s
c-db2u-dv-restore-morph-bkfpr 0/1 Completed 0 39m
c-db2u-dv-tools-57bc7d4ddf-wz8fr 1/1 Running 0 40m
db2u-operator-5999cd944b-dwgrr 1/1 Running 0 17m
Note the REST pod name, which is used to run documented REST commands.