# patroni.scripts.barman.cli module

Perform operations on Barman through `pg-backup-api`.

The actual operations are implemented by separate modules. This module only builds the CLI that makes an interface with the actual commands.

Note

See :class:ExitCode` for possible exit codes of this main script.

class patroni.scripts.barman.cli.ExitCode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

  Possible exit codes of this script.

  Variables:

    - NO_COMMAND – if no sub-command of `patroni_barman` application has been selected by the user.

    - API_NOT_OK – `pg-backup-api` status is not `OK`.

  API_NOT_OK = -2
  NO_COMMAND = -1

patroni.scripts.barman.cli.main() → None

  Entry point of `patroni_barman` application.

  Implements the parser for the application and for its sub-commands.

  The script exit code may be one of:

  - `ExitCode.NO_COMMAND`: if no sub-command was specified in the

      `patroni_barman` call;

  - `ExitCode.API_NOT_OK`: if `pg-backup-api` is not correctly up and

      running;

  - Value returned by `run_barman_config_switch()`,

      if running `patroni_barman config-switch`;

  - Value returned by `run_barman_recover()`,

      if running `patroni_barman recover`.

  The called sub-command is expected to exit execution once finished using its own set of exit codes.