Files
team/server/cmd/mmctl/docs/mmctl_job_list.rst
eb0e00db97 Add job create, show, and cancel commands to mmctl (#37280)
* Add create, show, and cancel subcommands to mmctl job

The `mmctl job` command previously only supported `list` and `update`.
This adds three subcommands backed by existing client methods:

- `job create [type] [--data k=v]` triggers a new job (CreateJob)
- `job show [job]` displays a single job (GetJob)
- `job cancel [job]` requests cancellation via the dedicated cancel
  endpoint (CancelJob), which uses the create-job permission and emits
  its own audit event, unlike `update [job] cancel_requested`

Also fixes the leftover "import jobs" wording in the `list` flag help
and regenerates the mmctl docs.

* Exercise --data flag parsing in mmctl job create test

The create-job test passed the Data map as the flag's default value, so
GetStringToString returned the default without ever exercising pflag's
stringToString parser. Declare the flag empty and Set the value
explicitly so the test validates the real parse path.

* Don't gate mmctl job create on model.AllJobTypes

model.AllJobTypes (which IsValidJobType checks against) is a curated
subset that omits creatable job types such as access_control_sync, so
validating the type client-side wrongly rejected jobs the server can
schedule. Drop the client-side check and let the server validate the
type per its create-job permissions; it returns a clear error for
anything unschedulable. Tab-completion still suggests AllJobTypes as an
advisory hint.

* Remove explanatory AllJobTypes comments from mmctl job

* Add e2e tests for mmctl job create, show, and cancel

Cover the no-permission, not-found, and success paths for the new
generic job subcommands against a running server, mirroring the existing
export job e2e tests.

---------

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-06 19:07:08 +02:00

61 lines
1.7 KiB
ReStructuredText

.. _mmctl_job_list:
mmctl job list
--------------
List the latest jobs
Synopsis
~~~~~~~~
List the latest jobs
::
mmctl job list [flags]
Examples
~~~~~~~~
::
job list
job list --ids jobID1,jobID2
job list --type ldap_sync --status success
job list --type ldap_sync --status success --page 0 --per-page 10
Options
~~~~~~~
::
--all Fetch all jobs. --page flag will be ignored if provided
-h, --help help for list
--ids strings Comma-separated list of job IDs to which the operation will be applied. All other flags are ignored
--page int Page number to fetch for the list of jobs
--per-page int Number of jobs to be fetched (default 5)
--status string Filter by job status
--type string Filter by job type
Options inherited from parent commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
--config string path to the configuration file (default "$XDG_CONFIG_HOME/mmctl/config")
--disable-pager disables paged output
--insecure-sha1-intermediate allows to use insecure TLS protocols, such as SHA-1
--insecure-tls-version allows to use TLS versions 1.0 and 1.1
--json the output format will be in json format
--local allows communicating with the server through a unix socket
--quiet prevent mmctl to generate output for the commands
--strict will only run commands if the mmctl version matches the server one
--suppress-warnings disables printing warning messages
SEE ALSO
~~~~~~~~
* `mmctl job <mmctl_job.rst>`_ - Management of jobs