GrdAPI and GdrConnection classes
The GRDApi auto generated python APIs are located in the file \myNewApp\app\guardapi\GRDApi.py.
The GrdConnection class holds an active connection to a Guardium machine.
The GrdApi class holds all the available Guardium® operations the SDK enables a user to perform.
Before you can use the GrdAPI functions, establish a connection to the Guardium system with the commands:
grd_connection = GrdConnection(GMachineIP, GMachinePort, username, password, client_secret, client_id)
grd_api = GRDApi(grd_connection)
If you create a GrdConnection instance with no arguments, all the required information is requested in the command line the first time the app is run on its environment.
Now you can use the GRDApi functions by accessing the grd_api object. For example, if you want to invoke the create_online_report() API function and create a 'Guardium Logins' report, you enter:
result = grd_api.create_online_report('Guardium logins', reportParameter=report_parameters)
Here is an example of running a report, output as JSON:
sql_errors = grd_api.create_online_report('SQL Errors', 'NOW -10 HOUR', 'NOW +3 HOUR')
For a working example, see the REST API sample application.
Advanced users only
The command regenerate_grd_api_lib rebuilds the GrdAPI class, overwriting the existing library. Use this command when you write an app in one Guardium version, and want to use it in another version. For example: regenerate_grd_api_lib-w workspace