The GeoSpock CLI

The management of the GeoSpock database is done using the GeoSpock CLI, a command line tool that enables you to:

  • create and manage GeoSpock database user accounts; see Managing users for more information
  • manage the data in your GeoSpock database; see Using datasets for more information
  • manage access to your datasets; see Managing group access for more information

Installing the GeoSpock CLI from pip

Make sure you have pip installed and then run the following commands:

$ python -m pip install geospock-cli

Getting started with the GeoSpock CLI

To start using the GeoSpock CLI, you need to configure some settings for your database deployment and login.

To authenticate using your Identity Provider (IdP) account, you will need to provide a username and password when executing commands. The options available are: - Using the geospock login command; refer to Using the login command - Providing login and request information with each GeoSpock CLI command; refer to Providing login and request details with each command - Setting environment variables with account information; refer to Use credentials in environment variables

Using the login command

The necessary CLI login command is provided as an output string from the datalake_core Terraspock endpoint. This can be obtained at any time after a successful terraform apply by running the following commands:

$ terraform workspace select <terraform-workspace>
$ terraform output cli_init_command

This returns the login command that you should run, for example:

geospock login --user <user> --password <password> --request-address

This command saves a copy of your username and password in your computer's Keychain/Credential Manager so you do not have to provide these each time you run a command. To delete these credentials from the configuration file, use geospock logout.

How to login for multiple deployments using profiles

If you have multiple GeoSpock database deployments, you can add the --profile <profileID> argument when using the login command to set up a configuration for a specific deployment. You can then use the profile ID with the GeoSpock CLI commands to specify which deployment you want to run those commands on. For example:

geospock group-list --profile development

If the --profile argument is not provided, this is equivalent to using --profile default.

Remove the credentials for a particular profile by using geospock logout --profile <profileID>

Providing login and request information with each command

Each GeoSpock CLI command can have the optional --user and --password arguments provided. The request address should also be provided if using this method of authenticating. For example:

geospock dataset-list --user <user> --password <password> --request-address

Use credentials in environment variables

If both the GEOSPOCK_USER and GEOSPOCK_PASSWORD environment variables are set, the GeoSpock CLI will use these (unless the --user and --password arguments are provided, as these will override the environment variables). The request address can also be added to the environment variable GEOSPOCK_REQUEST_ADDRESS, or it can also be provided as an argument. For example:

geospock dataset-list --request-address

Running the GeoSpock CLI

You can activate the GeoSpock CLI at the command line as follows:

geospock COMMAND ... [--profile <profileID>]

To show a list of commands use the following command

geospock help [--profile {profileID}]

To get further information on the input types of each command, use the following:

geospock help COMMAND [--profile <profileID>]

CLI commands

The GeoSpock CLI has the following commands:

Datasets Group and user management General
  • dataset-create
  • dataset-list
  • dataset-permission-list
  • dataset-status
  • dataset-operations
  • dataset-data-source-description
  • data-source-description
  • dataset-add-data
  • dataset-permission-grant
  • dataset-permission-revoke
  • dataset-delete
  • group-create
  • group-list
  • group-permission-list
  • group-permission-grant
  • group-permission-revoke
  • group-add-user
  • group-remove-user
  • group-all-remove-user
  • group-delete
  • login
  • profile-list
  • help