3. PDC Client

PDC Client is a shell CLI that make it easier to access data from PDC servers.

3.1. Installation

You can obtain the client from the same repository where PDC server is.

3.2. Configuration

The client can read server connection details from a configuration file. The configuration file should be located in /etc/pdc/client_config.json or in ~/.config/pdc/client_config.json. If both files are present, the system one is loaded first and the user configuration is applied on top of it (to add other options or overwrite existing ones).

The configuration file should contain a JSON object, which maps server name to JSON object with details. The name is an arbitrary string used at client run time to identify which server you want to connect to.

The details of a single server must contain at least one key: host which specifies the URL to the API root (e.g. http:://localhost:8000/rest_api/v1/ for local instance).

Other possible keys are:

If specified, this token will be used for authentication. The client will not try to obtain any token from the server.
If set to true, server certificate will not be validated.
When set to true, the client will not use any authentication at all, not requesting a token nor sending any token with the requests. This is only useful for working with servers which don’t require authentication.

3.2.1. Example system configuration

This config defines connection to development server running on localhost and a production server.

    "local": {
        "host": "http://localhost:8000/rest_api/v1/",
        "develop": true,
        "insecure": false
    "prod": {
        "host": "https://pdc.example.com/rest_api/v1/",

3.3. Usage

The client package contains two separate clients. Both contain extensive built-in help. Just run the executable with -h or --help argument.

3.3.1. pdc_client

This is a very simple client. Essentially this is just a little more convenient than using curl manually. Each invocation of this client obtains a token and then performs a single request.

This client is not meant for direct usage, but just as a helper for integrating with PDC from languages where it might be easier than performing the network requests manually.

3.3.2. pdc

This is much more user friendly user interface. A single invocation can perform multiple requests depending on what subcommand you used.

3.4. Python API

When writing a client code interfacing with PDC server, you might find PDCClient handy. It provides access to the configuration defined above and automates obtaining authorization token.

To use this module, you will need to install its dependencies. These include

When working with paginated responses, there is a utility function to simplify that. From client code it is iterating single object. Behind the scenes it will download the first page, once all results from that page are exhausted, it will get another page until everything is processed.

3.5. Known Issues

3.5.1. Kerberos

Under enterprise network, Reverse DNS mismatches may cause problems authenticating with Kerberos.

If you can successfully run kinit but not authenticate yourself to PDC servers, check /etc/krb5.conf and make sure that rdns is set to false in libdefaults section.

    rdns = false

3.6. For Developers

3.6.1. Instalation details

  1. yum repository

    If you have installed PDC Server by some yum repository, PDC Client is in the same repository that you used.

    So to install PDC Client, just need to

    $ sudo yum install pdc-client -y
  2. build from source

    If you have got the code and setup your development environment (see Setup development environment), then you could build from source and install the client and it’s dependency package python-pdc

    $ git checkout `{release-tag}`
    $ make rpm
    $ sudo yum install dist/noarch/python-pdc*.noarch.rpm dist/noarch/pdc-client*.noarch.rpm

3.6.2. General

The PDC Client (package name: pdc_client) is mainly build up with Python argparse module and PDC’s Python module pdc_client.

It is powered by BeanBag, a simple module that lets you access REST APIs in an easy way.