Skip to content

Programmatic Access

Programmatic access to Manila

While the Manila client provides human readable access to Manila, using the Manila client Python modules will allow to integrate programmatic access to Manila in Python programs. A third way of interaction, for instance in order to get JSON formatted data, is sending direct requests to the Manila APIs with curl.

For this, you need to get the endpoint url from the catalog. One should note that there are different regions now. We assume that you are working in the 'cern' region here:

``console $ MANILA_URL=openstack catalog show manilav2 -f json -c endpoints |jq -r '.endpoints[] |select(.region=="cern")|select(.interface=="public").url'`

For PDC, please change openstack.cern.ch in the command above to openstackpdc.cern.ch. Next, you need a fresh user token:

``console $ USER_TOKEN=openstack token issue | grep "| id" | awk '{print $4}'`

With this the following curl command will return a JSON formatted list of the shares in the project:

```console $ curl -i -X GET \ -H "X-Auth-Token: $USER_TOKEN" \ $MANILA_URL/shares/detail

which can be processed, for instance with 'jq':

```console $ curl -s -X GET \ -H "X-Auth-Token: $USER_TOKEN" \ $MANILA_URL/shares/detail|jq '.shares[].name'

The Manila API reference for a complete list of calls is available from OpenStack Manila API.