Files
NLnetLabs-krill/doc/development/02_cli.md
T
e662c1553b Change to a hybrid event sourcing model for CAs and Repository. (#426)
This allows us to keep the full history of semantically important events, while not spamming the history and avoiding excessive use of disk space. See issues #370 and #423.

This is a substantial change. Highlights follow:
* Added a developer documentation section
* No longer using events for manifest/crl generation (#370)
* No longer using events for publication deltas (#423)
* Removed pre 0.6.0 migration code - people will have to upgrade to at least 0.6.0 first
* Added migration code for 0.6.0-0.8.1 to this
* Migrate repository by doing a keyroll. (#370)
* Remove archiving code for commands (no longer applicable)

Minor other fixes:
* Use a swap file when writing (avoid corrupt json if disk is full) (#370)
* Make removing publisher content idempotent for publishers already removed.

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
Co-authored-by: Jasper den Hertog <jasper@plainspace.com>
2021-03-17 12:08:36 +01:00

2.0 KiB

Krill Command Line Client Setup

There are two CLI binaries included in Krill: krillc is intended to manage Certification Authorities, and krillpubc is used to manage a Publication Server.

Essentially the CLIs are a small convenient way to access the Krill API and represent responses to the user. They parse command line arguments and/or files supplied by the user (where applicable), and query or post (JSON) to the appropriate API end-point. Responses can be displayed as JSON, or plain text.

From a development point of view it's important to know that the argument parsing by the CLIs is tested manually. This can lead to issues as there is no strong typing enforced by the clapper library that we use. So: CHECK whenever there are changes.

What is tested properly is the underlying code used by the CLIs to submit data and process server responses. Our test code bypasses the command line parsing, but it uses the same underlying code in the higher level tests such as tests/functional.rs in order to interact with a running Krill instance.

The code can be found under src/cli. An overview of the most important elements follows:

Element Code Path Responsibility
KrillClient src/cli/client.rs The client code for Krill CA operations.
KrillPubdClient src/cli/client.rs The client code for Krill Publication Server operations.
Command src/cli/options.rs Enum for the intended CA command.
PublishersCommand src/cli/options.rs Enum for the intended Publication Server command.
ApiResponse src/cli/report.rs Structure to represent API responses.