Usage guide
All of the DCT APIs are available as commands in dct-toolkit. To find the list of all commands which are available, use the following command:
./dct-toolkit -h
This will print the list of all commands grouped by the appropriate entity names.
Examples
The list of available options for a particular command can be requested with the following command:
CODE./dct-toolkit <command_name> -h
There are currently many options for provisioning a VDB, some options are only valid for a particular DB type. For example, the
unique_name
option is only applicable to Oracle DBs. For better ease of use, dct-toolkit has subcommands created under the provisioning command, with options that are relevant to that particular subcommand. For example, these are the subcommands under theprovision_vdb_by_snapshot
command:CODEoracle sybase mssql appdata postgres
For provisioning an Oracle VDB, use the following command:
CODEdct-toolkit provision_vdb_by_snapshot oracle source_data_id=<dsourceId> --auto_select_repository unique_name=<uniqueName>
For provisioning a Sybase-ASE VDB, use the following command:
CODEdct-toolkit provision_vdb_by_snapshot sybase source_data_id=<dsourceId> --auto_select_repository --truncate_log_on_checkpoint
For getting the list of registered engines, use the following command:
CODEdct-toolkit get_registered_engines
The above command will only print important fields in the response.
For printing all of the fields in the response, use the following command:CODE-A/--all-columns
CODEdct-toolkit get_registered_engines -A
To list only the selected columns that are useful to the user, use the following command:
CODE--columns/-c
CODEdct-toolkit get_registered_engines --columns=id,name,cpu_core_count...
For advanced use cases, dct-toolkit also provides an option to specify a jsonpath expression to extract required objects from the JSON response. This can be requested with the following command:
CODE--jsonpath/-jp
CODEdct-toolkit get_registered_engines --jsonpath=<json path expression starting with $>
Note, these options are available for all of the commands available in dct-toolkit.
For commands that use a request body, dct-toolkit provides
-body
, which can be used to specify a JSON body (instead of using individual options).CODEdct-toolkit token_info --body=<JSON body to POST to DCT>
Help regarding the exact structure of JSON request and response body can be requested for all of the commands with the following command:
CODE-jh/--jsonhelp
CODEdct-toolkit token_info -jh
dct-toolkit provides an easy to use and understand format for specifying tags. For example, the following command adds two tags –
{key=purpose, value=testing}
and{key=key1, value=value1}
:CODEdct-toolkit create_environment_tags environmentId=<envId> tags purpose=testing key1=value1
Some of the DCT APIs trigger an asynchronous job and return a jobId in response. dct-toolkit, by default, will wait for the asynchronous job to be completed and will report the end state of the job.
There is an option to not wait for the completion of an asynchronous job. Use the following command with the
--no-wait
option:CODEdct-toolkit refresh_environment environmentId=<envId> --no-wait
If the user intends on specifying the API key via an environment variable, dct-toolkit provides a command to get the encrypted version of the API key.
CODE./dct-toolkit encrypt_api_key apiKey=<DCT api key> dctUrl=<DCT instance URL>
--json/-js
and --csv/-cs
option examples
For the
--json/-js
option, to print the DCT response as it is received from DCT instance users can use following command:CODE./dct-toolkit get_environments --json ./dct-toolkit get_environment_by_id environmentId=<environment Id> --json
To print the repositories object from environment object in JSON format users can use following command:
CODE./dct-toolkit get_environments --json --expand=repositories
For the
--csv/-cs
option, to print the DCT response in CSV format users can use the following command:CODE./dct-toolkit get_environments --csv
To print the repositories object from the environment object in CSV format users can use the following command:
CODE./dct-toolkit get_environments --csv --expand=repositories