PYTHON-WATCHERCLIENT(1)

๐Ÿ“ฆ
version 4.11.0 ยท 4 versions
, in nixpkgs unstable

๐Ÿ’– NAME ๐Ÿ’–

So this is the manual page for python-watcherclient(1) โ€” and yes she's serving python-watcherclient 4.11.0, no cap โœจ

This is literally a client for the OpenStack Watcher API. You get two whole flavors, bestie:

  • a Python API (the watcherclient modules, iykyk)
  • a command-line script (installed as literally just watcher)

And the way that each one implements the entire OpenStack Watcher API? Obsessed. ๐Ÿ’…


๐ŸŒธ COMMAND-LINE TOOL REFERENCE ๐ŸŒธ

Okay so to actually use the CLI you HAVE to provide your OpenStack username, password, tenant, and auth endpoint. Use the matching config options (--os-username, --os-password, --os-tenant-id, and --os-auth-url) or just set them in environment variables, your call ๐Ÿซถ

export OS_USERNAME=user
export OS_PASSWORD=pass
export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b
export OS_AUTH_URL=http://auth.example.com:5000/v3/

Now the important bit ๐Ÿ‘€ โ€” the command line tool will attempt to reauthenticate using the credentials you gave it for every single request. Every one. Fr fr. You can override that behavior by manually supplying an auth token using --os-watcher-url and --os-auth-token. Or you can set these environment variables instead:

export OS_WATCHER_URL=http://watcher.example.org:9322/
export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155

Once your authentication parameters are configured, just run watcher help to see a complete listing of the available commands. Iconic. ๐ŸŒŸ


๐ŸŽ€ watcher Command-Line Interface (CLI) ๐ŸŽ€

โœจ SYNOPSIS โœจ

watcher [options] <command> [command-options]

watcher help

watcher help <command>

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

The watcher command-line interface (CLI) interacts with the OpenStack infra-optim Service (Watcher). Main character energy, honestly.

In order to use the CLI, you must provide your OpenStack username, password, project (historically called tenant), and auth endpoint. You can use the configuration options --os-username, --os-password, --os-tenant-id (or --os-tenant-name), and --os-auth-url, or set the corresponding environment variables:

$ export OS_USERNAME=user
$ export OS_PASSWORD=password
$ export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b   # or OS_TENANT_NAME
$ export OS_TENANT_NAME=project                          # or OS_TENANT_ID
$ export OS_AUTH_URL=http://auth.example.com:5000/v3/

The command-line tool will attempt to reauthenticate using the provided credentials for every request. You can override this behavior by manually supplying an auth token using --watcher-url and --os-auth-token, or by setting the corresponding environment variables:

$ export WATCHER_URL=http://watcher.example.org:9322/
$ export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155

Since Keystone can return multiple regions in the Service Catalog, you can specify the one you want with --os-region-name or set the following environment variable. (It defaults to the first in the list returned โ€” that's the vibe check it does automatically ๐Ÿฆ‹)

$ export OS_REGION_NAME=region
Watcher CLI supports bash completion ๐Ÿ˜ญ๐Ÿ’– The command-line tool can automatically fill partially typed commands. To use this feature, source the below file (available at https://opendev.org/openstack/python-watcherclient/src/branch/master/tools/watcher.bash_completion) to your terminal and then bash completion should work:
$ . watcher.bash_completion

To avoid doing this every time, add this to your .bashrc or copy the watcher.bash_completion file to the default bash completion scripts directory on your linux distribution. Set it and forget it, periodt.

๐ŸŒˆ OPTIONS ๐ŸŒˆ

To get a list of available (sub)commands and options, run:

$ watcher help

To get usage and options of a command, run:

$ watcher help <command>

โญ EXAMPLES โญ

Get information about the audit-create command:

$ watcher help audit create

Get a list of available goal:

$ watcher goal list

Get a list of audits:

$ watcher audit list

๐Ÿงš openstack Command-Line Interface (CLI) with Watcher plugin ๐Ÿงš

โœจ SYNOPSIS โœจ

openstack [options] optimize <command> [command-options]

openstack help optimize

openstack help optimize <command>

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

The openstack command-line interface (CLI) can interact with the OpenStack infra-optim Service (Watcher) by using our additional plugin โ€” and guess what, it's included right there in the python-watcherclient package. Convenience queen ๐Ÿ‘‘

In order to use the CLI, you must provide your OpenStack username, password, project (historically called tenant), and auth endpoint. You can use the configuration options --os-username, --os-password, --os-tenant-id (or --os-tenant-name), and --os-auth-url, or set the corresponding environment variables:

$ export OS_USERNAME=user
$ export OS_PASSWORD=password
$ export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b   # or OS_TENANT_NAME
$ export OS_TENANT_NAME=project                          # or OS_TENANT_ID
$ export OS_AUTH_URL=http://auth.example.com:5000/v3/

The command-line tool will attempt to reauthenticate using the provided credentials for every request. You can override this behavior by manually supplying an auth token using --watcher-url and --os-auth-token, or by setting the corresponding environment variables:

export WATCHER_URL=http://watcher.example.org:9322/
export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155

Since Keystone can return multiple regions in the Service Catalog, you can specify the one you want with --os-region-name or set the following environment variable. (It defaults to the first in the list returned, no cap ๐ŸŒธ)

$ export OS_REGION_NAME=region

๐ŸŒˆ OPTIONS ๐ŸŒˆ

To get a list of available (sub)commands and options, run:

$ openstack help optimize

To get usage and options of a command, run:

$ openstack help optimize <command>

โญ EXAMPLES โญ

Get information about the audit-create command:

$ openstack help optimize audit create

Get a list of available goal:

$ openstack optimize goal list

Get a list of audits:

$ openstack optimize audit list

๐Ÿ‘‘ Infrastructure Optimization service (watcher) command-line client ๐Ÿ‘‘

The watcher client is the command-line interface (CLI) for the Infrastructure Optimization service (watcher) API and its extensions. She does it all ๐Ÿ’…

This chapter documents watcherclient version 4.9.0.

For help on a specific watcher command, enter:

$ watcher help COMMAND

๐Ÿฆ‹ watcher usage ๐Ÿฆ‹

usage: watcher [--version] [-v | -q] [--log-file LOG_FILE] [-h] [--debug]
               [--no-auth] [--os-identity-api-version <identity-api-version>]
               [--os-auth-url <auth-url>] [--os-region-name <region-name>]
               [--os-username <auth-user-name>] [--os-user-id <auth-user-id>]
               [--os-password <auth-password>]
               [--os-user-domain-id <auth-user-domain-id>]
               [--os-user-domain-name <auth-user-domain-name>]
               [--os-tenant-name <auth-tenant-name>]
               [--os-tenant-id <tenant-id>]
               [--os-project-id <auth-project-id>]
               [--os-project-name <auth-project-name>]
               [--os-project-domain-id <auth-project-domain-id>]
               [--os-project-domain-name <auth-project-domain-name>]
               [--os-auth-token <auth-token>]
               [--os-watcher-api-version <os-watcher-api-version>]
               [--os-endpoint-type OS_ENDPOINT_TYPE]
               [--os-endpoint-override <endpoint-override>] [--insecure]
               [--os-cacert <ca-certificate>] [--os-cert <certificate>]
               [--os-key <key>] [--timeout <seconds>]

๐Ÿ’– watcher optional arguments ๐Ÿ’–

  • --version โ€” show program's version number and exit
  • -v, --verbose โ€” Increase verbosity of output. Can be repeated.
  • -q, --quiet โ€” Suppress output except warnings and errors.
  • --log-file LOG_FILE โ€” Specify a file to log output. Disabled by default.
  • -h, --help โ€” Show help message and exit.
  • --debug โ€” Show tracebacks on errors.
  • --no-auth, -N โ€” Do not use authentication.
  • --os-identity-api-version <identity-api-version> โ€” Specify Identity API version to use. Defaults to env[OS_IDENTITY_API_VERSION] or 3.
  • --os-auth-url <auth-url>, -A <auth-url> โ€” Defaults to env[OS_AUTH_URL].
  • --os-region-name <region-name>, -R <region-name> โ€” Defaults to env[OS_REGION_NAME].
  • --os-username <auth-user-name>, -U <auth-user-name> โ€” Defaults to env[OS_USERNAME].
  • --os-user-id <auth-user-id> โ€” Defaults to env[OS_USER_ID].
  • --os-password <auth-password>, -P <auth-password> โ€” Defaults to env[OS_PASSWORD].
  • --os-user-domain-id <auth-user-domain-id> โ€” Defaults to env[OS_USER_DOMAIN_ID].
  • --os-user-domain-name <auth-user-domain-name> โ€” Defaults to env[OS_USER_DOMAIN_NAME].
  • --os-tenant-name <auth-tenant-name>, -T <auth-tenant-name> โ€” Defaults to env[OS_TENANT_NAME].
  • --os-tenant-id <tenant-id>, -I <tenant-id> โ€” Defaults to env[OS_TENANT_ID].
  • --os-project-id <auth-project-id> โ€” Another way to specify tenant ID. This option is mutually exclusive with --os-tenant-id. Defaults to env[OS_PROJECT_ID].
  • --os-project-name <auth-project-name> โ€” Another way to specify tenant name. This option is mutually exclusive with --os-tenant-name. Defaults to env[OS_PROJECT_NAME].
  • --os-project-domain-id <auth-project-domain-id> โ€” Defaults to env[OS_PROJECT_DOMAIN_ID].
  • --os-project-domain-name <auth-project-domain-name> โ€” Defaults to env[OS_PROJECT_DOMAIN_NAME].
  • --os-auth-token <auth-token> โ€” Defaults to env[OS_AUTH_TOKEN].
  • --os-watcher-api-version <os-watcher-api-version> โ€” Defaults to env[OS_INFRA_OPTIM_API_VERSION].
  • --os-endpoint-type OS_ENDPOINT_TYPE โ€” Defaults to env[OS_ENDPOINT_TYPE] or "publicURL"
  • --os-endpoint-override <endpoint-override> โ€” Use this API endpoint instead of the Service Catalog.

๐Ÿ“ watcher action list ๐Ÿ“

usage: watcher action list [-h] [-f {csv,html,json,table,value,yaml}]
                           [-c COLUMN] [--max-width <integer>] [--fit-width]
                           [--print-empty] [--noindent]
                           [--quote {all,minimal,none,nonnumeric}]
                           [--action-plan <action-plan>] [--audit <audit>]
                           [--detail] [--limit <limit>] [--sort-key <field>]
                           [--sort-dir <direction>] [--marker <marker>]

List information on retrieved actions. She's giving catalog, she's giving index ๐Ÿ˜Œ

Optional arguments:

  • -h, --help โ€” show this help message and exit
  • --action-plan <action-plan> โ€” UUID of the action plan used for filtering.
  • --audit <audit> โ€” UUID of the audit used for filtering.
  • --detail โ€” Show detailed information about actions.
  • --limit <limit> โ€” the max number of actions you get back per request, and 0 means no limit at all. Default is the maximum number that the Watcher API Service uses. ๐Ÿ’…
  • --sort-key <field> โ€” the Action field that gets used for sorting. pick your fave โœจ
  • --sort-dir <direction> โ€” sort direction: "asc" (the default) or "desc".
  • --marker <marker> โ€” UUID of the last action on the previous page; it displays the list of actions after "marker". pagination slay ๐ŸŽ€

๐Ÿฆ‹ watcher action show

usage: watcher action show [-h] [-f {html,json,shell,table,value,yaml}]
                           [-c COLUMN] [--max-width <integer>] [--fit-width]
                           [--print-empty] [--noindent] [--prefix PREFIX]
                           <action>

Show detailed info about a given action. the full tea โ˜•

Positional arguments:

  • <action> โ€” the UUID of the action.

Optional arguments:

  • -h, --help โ€” shows this help message and exits, classic.

๐ŸŒธ watcher action update

usage: watcher action update [-h] [-f {html,json,shell,table,value,yaml}]
                             [-c COLUMN] [--max-width <integer>] [--fit-width]
                             [--print-empty] [--noindent] [--prefix PREFIX]
                             [--state <state>] [--reason <reason>] <action>

Update action command. glow-up time ๐Ÿ’–

Positional arguments:

  • <action> โ€” the UUID of the action.

Optional arguments:

  • -h, --help โ€” shows this help message and exits.
  • --state <state> โ€” the new state for the action (e.g., SKIPPED).
  • --reason <reason> โ€” the reason for the action state change. give 'em a reason bestie ๐Ÿซถ

๐ŸŽ€ watcher actionplan cancel

usage: watcher actionplan cancel [-h] [-f {html,json,shell,table,value,yaml}]
                                 [-c COLUMN] [--max-width <integer>]
                                 [--fit-width] [--print-empty] [--noindent]
                                 [--prefix PREFIX]
                                 <action-plan>

Cancel action plan command. not me hitting cancel ๐Ÿซฃ

Positional arguments:

  • <action-plan> โ€” the UUID of the action_plan.

Optional arguments:

  • -h, --help โ€” shows this help message and exits.

๐Ÿงš watcher actionplan create

usage: watcher actionplan create [-h] [-f {html,json,shell,table,value,yaml}]
                                 [-c COLUMN] [--max-width <integer>]
                                 [--fit-width] [--print-empty] [--noindent]
                                 [--prefix PREFIX] -a <audit_template>
                                 [-t <audit_type>]

Create new audit. (yes, that's what it says โ€” this is the actionplan create command and the description literally reads "Create new audit." fr fr, keeping it exactly as written โœจ)

Optional arguments:

  • -h, --help โ€” shows this help message and exits.
  • -a <audit_template>, --audit-template <audit_template> โ€” the audit template used for this audit (name or uuid).
  • -t <audit_type>, --audit_type <audit_type> โ€” the audit type. It must be ONESHOT or CONTINUOUS. Default is ONESHOT. no in-between, pick a lane ๐Ÿ’…

๐Ÿ’œ watcher actionplan delete

usage: watcher actionplan delete [-h] <action-plan> [<action-plan> ...]

Delete action plan command. yeet ๐Ÿ‘‹

Positional arguments:

  • <action-plan> โ€” the UUID of the action plan. (you can pass more than one, it's <action-plan> [<action-plan> ...])

Optional arguments:

  • -h, --help โ€” shows this help message and exits.

๐ŸŒˆ watcher actionplan list

usage: watcher actionplan list [-h] [-f {csv,html,json,table,value,yaml}]
                               [-c COLUMN] [--max-width <integer>]
                               [--fit-width] [--print-empty] [--noindent]
                               [--quote {all,minimal,none,nonnumeric}]
                               [--audit <audit>] [--detail] [--limit <limit>]
                               [--marker <actionplan>] [--sort-key <field>]
                               [--sort-dir <direction>]

List information on retrieved action plans. the full lineup ๐Ÿ‘‘

Optional arguments:

  • -h, --help โ€” shows this help message and exits.
  • --audit <audit> โ€” the UUID of an audit, used for filtering.
  • --detail โ€” show detailed information about the action plans. extra detail, extra flavor ๐ŸŒธ
  • --limit <limit> โ€” the max number of action plans to return per request, 0 for no limit. Default is the maximum number used by the Watcher API Service.
  • --marker <actionplan> โ€” the last actionplan UUID of the previous page; it displays the list of actionplans after "marker".
  • --sort-key <field> โ€” the Action Plan field that will be used for sorting.
  • --sort-dir <direction> โ€” sort direction: "asc" (the default) or "desc".

โญ watcher actionplan show

usage: watcher actionplan show [-h] [-f {html,json,shell,table,value,yaml}]
                               [-c COLUMN] [--max-width <integer>]
                               [--fit-width] [--print-empty] [--noindent]
                               [--prefix PREFIX]
                               <action-plan>

Show detailed information about a given action plan. the whole story ๐ŸŽ€

Positional arguments:

  • <action-plan> โ€” the UUID of the action plan.

Optional arguments:

  • -h, --help โ€” shows this help message and exits.

๐Ÿš€ watcher actionplan start

usage: watcher actionplan start [-h] [-f {html,json,shell,table,value,yaml}]
                                [-c COLUMN] [--max-width <integer>]
                                [--fit-width] [--print-empty] [--noindent]
                                [--prefix PREFIX]
                                <action-plan>

Start action plan command. let's gooo ๐Ÿ”ฅ

Positional arguments:

  • <action-plan> โ€” the UUID of the action_plan.

Optional arguments:

  • -h, --help โ€” shows this help message and exits.

๐Ÿฆ‹ watcher actionplan update

usage: watcher actionplan update [-h] [-f {html,json,shell,table,value,yaml}]
                                 [-c COLUMN] [--max-width <integer>]
                                 [--fit-width] [--print-empty] [--noindent]
                                 [--prefix PREFIX]
                                 <action-plan> <op> <path=value>
                                 [<path=value> ...]

Update action plan command. little tweak, big impact ๐Ÿ’…

Positional arguments:

  • <action-plan> โ€” the UUID of the action_plan.
  • <op> โ€” the operation: 'add', 'replace', or 'remove'. that's the whole menu bestie.
  • <path=value> โ€” the attribute to add, replace, or remove. Can be specified multiple times. For 'remove', only <path> is necessary.

Optional arguments:

  • -h, --help โ€” shows this help message and exits.

๐ŸŒŸ watcher audit create

usage: watcher audit create [-h] [-f {html,json,shell,table,value,yaml}]
                            [-c COLUMN] [--max-width <integer>] [--fit-width]
                            [--print-empty] [--noindent] [--prefix PREFIX]
                            [-t <audit_type>] [-p <name=value>]
                            [-i <interval>] [-g <goal>] [-s <strategy>]
                            [-a <audit_template>] [--auto-trigger]

Create new audit. fresh audit, fresh vibes โœจ

Optional arguments:

  • -h, --help โ€” shows this help message and exits.
  • -t <audit_type>, --audit_type <audit_type> โ€” the audit type. It must be ONESHOT or CONTINUOUS. Default is ONESHOT.
  • -p <name=value>, --parameter <name=value> โ€” record strategy parameter/value metadata. Can be specified multiple times. stack 'em up ๐ŸŽ€
  • -i <interval>, --interval <interval> โ€” the audit interval (in seconds or cron format). A cron interval can be used like: "*/5 * * * *". Only used if the audit is CONTINUOUS.
  • -g <goal>, --goal <goal> โ€” the goal UUID or name associated to this audit.
  • -s <strategy>, --strategy <strategy> โ€” the strategy UUID or name associated to this audit.
  • -a <audit_template>, --audit-template <audit_template> โ€” the audit template used for this audit (name or uuid).
  • --auto-trigger โ€” trigger the action plan automatically once the audit is succeeded. hands-free, iconic ๐Ÿซถ

๐Ÿ’€ watcher audit delete

usage: watcher audit delete [-h] <audit> [<audit> ...]

Delete audit command. gone, reduced to atoms ๐Ÿ’€

Positional arguments:

  • <audit> โ€” the UUID or name of the audit. multiple allowed, see the [<audit> ...].

Optional arguments:

  • -h, --help โ€” shows this help message and exits.

๐Ÿ“ watcher audit list

usage: watcher audit list [-h] [-f {csv,html,json,table,value,yaml}]
                          [-c COLUMN] [--max-width <integer>] [--fit-width]
                          [--print-empty] [--noindent]
                          [--quote {all,minimal,none,nonnumeric}] [--detail]
                          [--goal <goal>] [--strategy <strategy>]
                          [--limit <limit>] [--sort-key <field>]
                          [--sort-dir <direction>]

List information on retrieved audits. the audit recap, served fresh ๐Ÿ“

Optional arguments:

  • -h, --help โ€” shows this help message and exits.
  • --detail โ€” show detailed information about the audits.
  • --goal <goal> โ€” the UUID or name of the goal used for filtering.
  • --strategy <strategy> โ€” the UUID or name of the strategy used for filtering.
  • --limit <limit> โ€” the max number of audits to return per request, 0 for no limit. Default is the maximum number used by the Watcher API Service.
  • --sort-key <field> โ€” the Audit field that will be used for sorting.
  • --sort-dir <direction> โ€” sort direction: "asc" (the default) or "desc".

๐Ÿงš watcher audit show

usage: watcher audit show [-h] [-f {html,json,shell,table,value,yaml}]
                          [-c COLUMN] [--max-width <integer>] [--fit-width]
                          [--print-empty] [--noindent] [--prefix PREFIX]
                          <audit>

Show detailed information about a given audit. all the deets ๐Ÿ”

Positional arguments:

  • <audit> โ€” the UUID or name of the audit.

Optional arguments:

  • -h, --help โ€” shows this help message and exits.

๐Ÿ’– watcher audit update

usage: watcher audit update [-h] [-f {html,json,shell,table,value,yaml}]
                            [-c COLUMN] [--max-width <integer>] [--fit-width]
                            [--print-empty] [--noindent] [--prefix PREFIX]
                            <audit> <op> <path=value> [<path=value> ...]

Update audit command. edit era ๐Ÿ’–

Positional arguments:

  • <audit> โ€” the UUID or name of the audit.
  • <op> โ€” the operation: 'add', 'replace', or 'remove'.
  • <path=value> โ€” the attribute to add, replace, or remove. Can be specified multiple times. For 'remove', only <path> is necessary.

Optional arguments:

  • -h, --help โ€” shows this help message and exits.

watcher audittemplate create

usage: watcher audittemplate create [-h]
                                    [-f {html,json,shell,table,value,yaml}]
                                    [-c COLUMN] [--max-width <integer>]
                                    [--fit-width] [--print-empty] [--noindent]
                                    [--prefix PREFIX] [-s <strategy>]
                                    [-d <description>] [--scope <path>]
                                    <name> <goal>

okay so this one literally creates a new audit template โœจ bestie you're making a whole new template, it's giving main character energy.

Positional arguments:

  • <name> โ€” the name you're giving this audit template ๐Ÿ’–
  • <goal> โ€” the goal, either as a UUID or a name, that's associated to this audit template ๐ŸŽฏ

Optional arguments:

  • -h, --help โ€” shows this help message and dips out, classic โœŒ๏ธ
  • -s <strategy>, --strategy <strategy> โ€” the strategy (UUID or name, your pick ๐Ÿซถ) that's associated to this audit template
  • -d <description>, --description <description> โ€” the description of the audit template, like a lil vibe blurb ๐Ÿ’…
  • --scope <path> โ€” the part of the cluster where the audit is gonna happen. you can hand it over as either a yaml or a json file, no cap ๐ŸŒธ

YAML example:

---
- host_aggregates:
  - id: 1
  - id: 2
  - id: 3
- availability_zones:
  - name: AZ1
  - name: AZ2
- exclude:
  - instances:
    - uuid: UUID1
    - uuid: UUID2
  - compute_nodes:
    - name: compute1

JSON example:

[
    {'host_aggregates': [
        {'id': 1},
        {'id': 2},
        {'id': 3}]},
    {'availability_zones': [
        {'name': 'AZ1'},
        {'name': 'AZ2'}]},
    {'exclude': [
        {'instances': [
            {'uuid': 'UUID1'},
            {'uuid': 'UUID2'}]},
        {'compute_nodes': [
            {'name': 'compute1'}]}]}
]

watcher audittemplate delete

usage: watcher audittemplate delete [-h]
                                    <audit-template> [<audit-template> ...]

the delete audit template command ๐Ÿ—‘๏ธ say bye to the template, it had a good run, iconic while it lasted ๐Ÿ˜ญ

Positional arguments:

  • <audit-template> โ€” UUID or name of the audit template ๐Ÿ‘‘

Optional arguments:

  • -h, --help โ€” show this help message and exit

watcher audittemplate list

usage: watcher audittemplate list [-h] [-f {csv,html,json,table,value,yaml}]
                                  [-c COLUMN] [--max-width <integer>]
                                  [--fit-width] [--print-empty] [--noindent]
                                  [--quote {all,minimal,none,nonnumeric}]
                                  [--detail] [--goal <goal>]
                                  [--strategy <strategy>] [--limit <limit>]
                                  [--sort-key <field>]
                                  [--sort-dir <direction>][--marker <marker>]

lists all the info on the audit templates you pulled up ๐Ÿ“‹โœจ very "let me see the receipts" of it all.

Optional arguments:

  • -h, --help โ€” show this help message and exit
  • --detail โ€” shows the detailed info about the audit templates, the full tea โ˜•
  • --goal <goal> โ€” UUID or name of the goal, used for filtering ๐Ÿ”
  • --strategy <strategy> โ€” UUID or name of the strategy, used for filtering ๐Ÿ”
  • --limit <limit> โ€” max number of audit templates returned per request; 0 means no limit. default is whatever max the Watcher API Service uses, so like, it's their call ๐Ÿ’…
  • --sort-key <field> โ€” the audit template field that gets used for sorting
  • --sort-dir <direction> โ€” sort direction: "asc" (the default) or "desc" โฌ†๏ธโฌ‡๏ธ
  • --marker <marker> โ€” the UUID of the last audittemplate on the previous page; shows you the list of audittemplates after "marker", so you can keep scrolling pookie ๐Ÿฆ‹

watcher audittemplate show

usage: watcher audittemplate show [-h] [-f {html,json,shell,table,value,yaml}]
                                  [-c COLUMN] [--max-width <integer>]
                                  [--fit-width] [--print-empty] [--noindent]
                                  [--prefix PREFIX]
                                  <audit-template>

shows the detailed info about one specific audit template ๐Ÿ”Ž the way this one is so specific, we love a focused queen.

Positional arguments:

  • <audit-template> โ€” UUID or name of the audit template ๐Ÿ‘‘

Optional arguments:

  • -h, --help โ€” show this help message and exit

watcher audittemplate update

usage: watcher audittemplate update [-h]
                                    [-f {html,json,shell,table,value,yaml}]
                                    [-c COLUMN] [--max-width <integer>]
                                    [--fit-width] [--print-empty] [--noindent]
                                    [--prefix PREFIX]
                                    <audit-template> <op> <path=value>
                                    [<path=value> ...]

the update audit template command ๐Ÿ’… glow-up time, we're editing things.

Positional arguments:

  • <audit-template> โ€” UUID or name of the audit_template.
  • <op> โ€” the operation: 'add', 'replace', or 'remove'. pick your fighter ๐ŸฅŠ
  • <path=value> โ€” the attribute to add, replace, or remove. you can drop this multiple times, go off โœจ and for 'remove', only the <path> is necessary, no value needed ๐ŸŽ€

Optional arguments:

  • -h, --help โ€” show this help message and exit

watcher goal list

usage: watcher goal list [-h] [-f {csv,html,json,table,value,yaml}]
                         [-c COLUMN] [--max-width <integer>] [--fit-width]
                         [--print-empty] [--noindent]
                         [--quote {all,minimal,none,nonnumeric}] [--detail]
                         [--limit <limit>] [--sort-key <field>]
                         [--sort-dir <direction>][--marker <marker>]

lists info on the goals you retrieved ๐ŸŽฏ manifesting your goals, literally.

Optional arguments:

  • -h, --help โ€” show this help message and exit
  • --detail โ€” shows detailed info about each goal, every single one ๐Ÿ’–
  • --limit <limit> โ€” max number of goals returned per request, 0 for no limit. default is the maximum number used by the Watcher API Service ๐Ÿงš
  • --sort-key <field> โ€” the goal field that gets used for sorting
  • --sort-dir <direction> โ€” sort direction: "asc" (the default) or "desc"
  • --marker <marker> โ€” UUID of the last goal on the previous page; shows the list of goals after "marker" ๐Ÿฆ‹

watcher goal show

usage: watcher goal show [-h] [-f {html,json,shell,table,value,yaml}]
                         [-c COLUMN] [--max-width <integer>] [--fit-width]
                         [--print-empty] [--noindent] [--prefix PREFIX]
                         <goal>

shows the detailed info about one given goal ๐Ÿ” slay, one goal at a time.

Positional arguments:

  • <goal> โ€” UUID or name of the goal ๐Ÿ‘‘

Optional arguments:

  • -h, --help โ€” show this help message and exit

watcher scoringengine list

usage: watcher scoringengine list [-h] [-f {csv,html,json,table,value,yaml}]
                                  [-c COLUMN] [--max-width <integer>]
                                  [--fit-width] [--print-empty] [--noindent]
                                  [--quote {all,minimal,none,nonnumeric}]
                                  [--detail] [--limit <limit>]
                                  [--sort-key <field>]
                                  [--sort-dir <direction>][--marker <marker>]

lists info on the scoring engines you retrieved โš™๏ธโœจ the ranking girlies.

Optional arguments:

  • -h, --help โ€” show this help message and exit
  • --detail โ€” shows detailed info about the scoring engines ๐Ÿ”Ž
  • --limit <limit> โ€” max number of actions returned per request, 0 for no limit. default is the maximum number used by the Watcher API Service ๐Ÿ’… (yes bestie, it says actions here โ€” copying it exactly, not my business ๐Ÿ™ˆ)
  • --sort-key <field> โ€” the action field that gets used for sorting
  • --sort-dir <direction> โ€” sort direction: "asc" (the default) or "desc"
  • --marker <marker> โ€” UUID of the last scoringengine on the previous page; shows the list of scoringengines after "marker" ๐Ÿฆ‹

watcher scoringengine show

usage: watcher scoringengine show [-h] [-f {html,json,shell,table,value,yaml}]
                                  [-c COLUMN] [--max-width <integer>]
                                  [--fit-width] [--print-empty] [--noindent]
                                  [--prefix PREFIX]
                                  <scoring_engine>

shows the detailed info about one given scoring engine ๐Ÿ”Ž one engine, fully seen.

Positional arguments:

  • <scoring_engine> โ€” name of the scoring engine ๐Ÿ‘‘

Optional arguments:

  • -h, --help โ€” show this help message and exit

watcher service list

usage: watcher service list [-h] [-f {csv,html,json,table,value,yaml}]
                            [-c COLUMN] [--max-width <integer>] [--fit-width]
                            [--print-empty] [--noindent]
                            [--quote {all,minimal,none,nonnumeric}] [--detail]
                            [--limit <limit>] [--sort-key <field>]
                            [--sort-dir <direction>]

lists info on the services you retrieved ๐Ÿ› ๏ธโœจ the "who's on shift" of it all.

Optional arguments:

  • -h, --help โ€” show this help message and exit
  • --detail โ€” shows detailed info about each service ๐Ÿ’–
  • --limit <limit> โ€” max number of services returned per request, 0 for no limit. default is the maximum number used by the Watcher API Service ๐ŸŒธ
  • --sort-key <field> โ€” the goal field that gets used for sorting (yep, the manpage says goal field here โ€” leaving it exactly as written, iykyk ๐Ÿ™ˆ)
  • --sort-dir <direction> โ€” sort direction: "asc" (the default) or "desc"

watcher service show

usage: watcher service show [-h] [-f {html,json,shell,table,value,yaml}]
                            [-c COLUMN] [--max-width <integer>] [--fit-width]
                            [--print-empty] [--noindent] [--prefix PREFIX]
                            <service>

shows the detailed info about one given service ๐Ÿ”Ž

Positional arguments:

  • <service> โ€” ID or name of the service ๐Ÿ‘‘

Optional arguments:

  • -h, --help โ€” show this help message and exit

watcher datamodel list

usage: watcher datamodel list [-h] [-f {csv,json,table,value,yaml}]
                              [-c COLUMN] [--max-width <integer>]
                              [--fit-width] [--print-empty] [--noindent]
                              [--quote {all,minimal,none,nonnumeric}]
                              [--sort-column SORT_COLUMN] [--type <type>]
                              [--audit <audit>] [--detail]

lists info on the retrieved data model ๐Ÿ—‚๏ธโœจ the blueprint of the whole situation.

Optional arguments:

  • -h, --help โ€” show this help message and exit
  • --type <type> โ€” the type of Datamodel you wanna list. supported values: compute. future support values: storage, baremetal. default type is compute ๐Ÿ’…
  • --audit <audit> โ€” the audit, bestie ๐Ÿ”
  • --detail โ€” shows detailed info ๐ŸŽ€
  • --audit <audit> โ€” UUID of the audit โ€” itโ€™s used to filter the data model by the scope in that audit. iykyk ๐Ÿซถ
  • --detail โ€” Show detailed information about the data model. okay slay โœจ

๐ŸŒธ watcher strategy list ๐ŸŒธ

usage: watcher strategy list [-h] [-f {csv,html,json,table,value,yaml}]
                             [-c COLUMN] [--max-width <integer>] [--fit-width]
                             [--print-empty] [--noindent]
                             [--quote {all,minimal,none,nonnumeric}]
                             [--goal <goal>] [--detail] [--limit <limit>]
                             [--sort-key <field>] [--sort-dir <direction>]
                             [--marker <marker>]

List information on retrieved strategies. literally strategy info, bestie ๐Ÿ’…

Optional arguments ๐ŸŽ€

  • -h, --help โ€” show this help message and exit
  • --goal <goal> โ€” UUID or name of the goal
  • --detail โ€” Show detailed information about each strategy.
  • --limit <limit> โ€” Maximum number of strategies to return per request, 0 for no limit. Default is the maximum number used by the Watcher API Service.
  • --sort-key <field> โ€” Goal field that will be used for sorting.
  • --sort-dir <direction> โ€” Sort direction: "asc" (the default) or "desc".
  • --marker <marker> โ€” UUID of the last strategy in the previous page; displays list of strategies after "marker".

๐ŸŒˆ watcher strategy show ๐ŸŒˆ

usage: watcher strategy show [-h] [-f {html,json,shell,table,value,yaml}]
                             [-c COLUMN] [--max-width <integer>] [--fit-width]
                             [--print-empty] [--noindent] [--prefix PREFIX]
                             <strategy>

Show detailed information about a given strategy. itโ€™s giving โ€œtell me everythingโ€ energy ๐Ÿ‘‘

Positional arguments ๐Ÿฆ‹

  • <strategy> โ€” UUID or name of the strategy

Optional arguments ๐ŸŒธ

  • -h, --help โ€” show this help message and exit

๐Ÿ’œ watcher strategy state ๐Ÿ’œ

usage: watcher strategy state [-h] [-f {csv,html,json,table,value,yaml}]
                              [-c COLUMN] [--max-width <integer>]
                              [--fit-width] [--print-empty] [--noindent]
                              [--quote {all,minimal,none,nonnumeric}]
                              [--sort-column SORT_COLUMN]
                              <strategy>

Retrieve information about strategy requirements. requirements check, no cap โœ…

Positional arguments ๐Ÿ“

  • <strategy> โ€” Name of the strategy

Optional arguments โœจ

  • -h, --help โ€” show this help message and exit

๐Ÿ PYTHON LIBRARY REFERENCE ๐Ÿ

Okay so if you wanna use the python api directly, first you gotta obtain an auth token and identify which endpoint you wish to speak to. Once youโ€™ve done that, you can use the API like so. auth token first, bestie โ€” main character prep ๐Ÿ’…

๐Ÿฆ‹ watcherclient

watcherclient package

Subpackages

watcherclient.common package

Subpackages

watcherclient.common.apiclient package

Submodules

watcherclient.common.apiclient.base module

Base utilities to build API operation managers and objects on top of. foundation energy, honestly ๐Ÿงš

class watcherclient.common.apiclient.base.BaseManager(client)

Bases: HookableMixin

Basic manager type providing common operations.

Managers interact with a particular type of API (servers, flavors, images, etc.) and provide CRUD operations for them.

  • resource_class = None

class watcherclient.common.apiclient.base.CrudManager(client)

Bases: BaseManager

Base manager class for manipulating entities.

Children of this class are expected to define a collection_key and key.

  • collection_key: Usually a plural noun by convention (e.g. entities); used to refer collections in both URL's (e.g. /v3/entities) and JSON objects containing a list of member resources (e.g. {'entities': [{}, {}, {}]}).
  • key: Usually a singular noun by convention (e.g. entity); used to refer to an individual member of the collection.
  • build_url(base_url=None, **kwargs) โ€” Builds a resource URL for the given kwargs.

Given an example collection where collection_key = 'entities' and key = 'entity', the following URL's could be generated.

By default, the URL will represent a collection of entities, e.g.:

/entities

If kwargs contains an entity_id, then the URL will represent a specific member, e.g.:

/entities/{entity_id}
  • Parameters: base_url -- if provided, the generated URL will be appended to it
  • collection_key = None
  • create(**kwargs)
  • delete(**kwargs)
  • find(base_url=None, **kwargs) โ€” Find a single item with attributes matching **kwargs.
    • Parameters: base_url -- if provided, the generated URL will be appended to it
  • get(**kwargs)
  • head(**kwargs)
  • key = None
  • list(base_url=None, **kwargs) โ€” List the collection.
    • Parameters: base_url -- if provided, the generated URL will be appended to it
  • put(base_url=None, **kwargs) โ€” Update an element.
    • Parameters: base_url -- if provided, the generated URL will be appended to it
  • update(**kwargs)

class watcherclient.common.apiclient.base.Extension(name, module)

Bases: HookableMixin

Extension descriptor.

  • SUPPORTED_HOOKS = ('__pre_parse_args__', '__post_parse_args__')
  • manager_class = None

class watcherclient.common.apiclient.base.HookableMixin

Bases: object

Mixin so classes can register and run hooks.

  • classmethod add_hook(hook_type, hook_func) โ€” Add a new hook of specified type.
    • Parameters:
      • cls -- class that registers hooks
      • hook_type -- hook type, e.g., '__pre_parse_args__'
      • hook_func -- hook function
  • classmethod run_hooks(hook_type, *args, **kwargs) โ€” Run all hooks of specified type.
    • Parameters:
      • cls -- class that registers hooks
      • hook_type -- hook type, e.g., '__pre_parse_args__'
      • args -- args to be passed to every hook function
      • kwargs -- kwargs to be passed to every hook function

class watcherclient.common.apiclient.base.ManagerWithFind(client)

Bases: BaseManager

Manager with additional find()/findall() methods.

  • find(**kwargs) โ€” Find a single item with attributes matching **kwargs.

This isn't very efficient: it loads the entire list then filters on the Python side.

  • findall(**kwargs) โ€” Find all items with attributes matching **kwargs.

This isn't very efficient: it loads the entire list then filters on the Python side.

  • abstractmethod list()

class watcherclient.common.apiclient.base.Resource(manager, info, loaded=False)

Bases: object

Base class for OpenStack resources (tenant, user, etc.).

This is pretty much just a bag for attributes.

  • HUMAN_ID = False
  • NAME_ATTR = 'name'
  • get() โ€” Support for lazy loading details.

Some clients, such as watcherclient have the option to lazy load the details, details which can be loaded with this function.

  • property human_id โ€” Human-readable ID which can be used for bash completion.
  • is_loaded()
  • set_loaded(val)
  • to_dict()

watcherclient.common.apiclient.base.getid(obj)

Return id if argument is a Resource.

Abstracts the common pattern of allowing both an object or an object's ID (UUID) as a parameter when dealing with relationships. very โ€œeither works, bestieโ€ of it ๐Ÿซถ

watcherclient.common.apiclient.exceptions module

Exception definitions. the drama section, but make it useful ๐Ÿ’€

  • exception watcherclient.common.apiclient.exceptions.AmbiguousEndpoints(endpoints=None) โ€” Bases: EndpointException. Found more than one matching endpoint in Service Catalog.
  • exception watcherclient.common.apiclient.exceptions.AuthPluginOptionsMissing(opt_names) โ€” Bases: AuthorizationFailure. Auth plugin misses some options.
  • exception watcherclient.common.apiclient.exceptions.AuthSystemNotFound(auth_system) โ€” Bases: AuthorizationFailure. User has specified an AuthSystem that is not installed.
  • exception watcherclient.common.apiclient.exceptions.AuthorizationFailure โ€” Bases: ClientException. Cannot authorize API client.
  • exception watcherclient.common.apiclient.exceptions.BadGateway(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None) โ€” Bases: HttpServerError. HTTP 502 - Bad Gateway.

The server was acting as a gateway or proxy and received an invalid response from the upstream server.

  • http_status = 502
  • message = 'Bad Gateway'
  • exception watcherclient.common.apiclient.exceptions.BadRequest(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None) โ€” Bases: HTTPClientError. HTTP 400 - Bad Request.

The request cannot be fulfilled due to bad syntax.

  • http_status = 400
  • message = 'Bad Request'
  • exception watcherclient.common.apiclient.exceptions.ClientException โ€” Bases: Exception. The base exception class for all exceptions this library raises.
  • exception watcherclient.common.apiclient.exceptions.CommandError โ€” Bases: ClientException. Error in CLI tool.
  • exception watcherclient.common.apiclient.exceptions.Conflict(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None) โ€” Bases: HTTPClientError. HTTP 409 - Conflict.

Indicates that the request could not be processed because of conflict in the request, such as an edit conflict.

  • http_status = 409
  • message = 'Conflict'
  • exception watcherclient.common.apiclient.exceptions.ConnectionError โ€” Bases: ClientException. Cannot connect to API service.

ConnectionRefused

Bases: ConnectionError

Connection refused while trying to connect to API service. Basically the API ghosted you at the socket level โ€” nobody's home on that port, bestie. ๐Ÿ˜ญ


EndpointException

Bases: ClientException

Something is rotten in Service Catalog.</purl> Yeah. The vibes are off in the Service Catalog. Rotting, even. ๐Ÿ’€


EndpointNotFound

Bases: EndpointException

Could not find requested endpoint in Service Catalog. You asked for an endpoint, the catalog said "who?" โ€” it's giving lost in the void. ๐Ÿซ 


ExpectationFailed

ExpectationFailed(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 417 - Expectation Failed. The server literally cannot meet the requirements of the Expect request-header field. Sorry babe, expectations were set and they were not met. โœจ

  • http_status = 417
  • message = 'Expectation Failed'

Forbidden

Forbidden(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 403 - Forbidden. The request was a valid request, but the server is refusing to respond to it. It's not you, it'sโ€ฆ actually no, it's the server. You're not on the list. ๐Ÿšซ

  • http_status = 403
  • message = 'Forbidden'

GatewayTimeout

GatewayTimeout(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HttpServerError

HTTP 504 - Gateway Timeout. The server was acting as a gateway or proxy and did not receive a timely response from the upstream server. Lowkey the middleman left you on read. ๐Ÿ˜ค

  • http_status = 504
  • message = 'Gateway Timeout'

Gone

Gone(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 410 - Gone. Indicates that the resource requested is no longer available and will not be available again. She's not coming back. Grieve and move on. ๐Ÿฅ€

  • http_status = 410
  • message = 'Gone'

HTTPClientError

HTTPClientError(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HttpError

Client-side HTTP error. Exception for cases in which the client seems to have erred. It's a you problem, not a server problem. ๐Ÿ™ˆ

  • message = 'HTTP Client Error'

HTTPRedirection

HTTPRedirection(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HttpError

HTTP Redirection. Not here, go over there. The classic "ask my friend" of HTTP. โœจ

  • message = 'HTTP Redirection'

HttpError

HttpError(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: ClientException

The base exception class for all HTTP exceptions. The mother of all HTTP drama โ€” everything else in this family descends from her. ๐Ÿ‘‘

  • http_status = 0
  • message = 'HTTP Error'

HttpNotImplemented

HttpNotImplemented(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HttpServerError

HTTP 501 - Not Implemented. The server either does not recognize the request method, or it lacks the ability to fulfill the request. Skill issue, on the server's side. ๐Ÿ’…

  • http_status = 501
  • message = 'Not Implemented'

HttpServerError

HttpServerError(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HttpError

Server-side HTTP error. Exception for cases in which the server is aware that it has erred or is incapable of performing the request. At least she's self-aware. ๐Ÿ˜ญ

  • message = 'HTTP Server Error'

HttpVersionNotSupported

HttpVersionNotSupported(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HttpServerError

HTTP 505 - HttpVersion Not Supported. The server does not support the HTTP protocol version used in the request. You're speaking a whole different era of HTTP and it's not picking up what you're putting down. ๐Ÿฆ‹

  • http_status = 505
  • message = 'HTTP Version Not Supported'

InternalServerError

InternalServerError(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HttpServerError

HTTP 500 - Internal Server Error. A generic error message, given when no more specific message is suitable. The "it's complicated" of status codes. ๐Ÿ’€

  • http_status = 500
  • message = 'Internal Server Error'

LengthRequired

LengthRequired(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 411 - Length Required. The request did not specify the length of its content, which is required by the requested resource. Bestie. How big is it. Tell the server how big it is. ๐Ÿ“

  • http_status = 411
  • message = 'Length Required'

MethodNotAllowed

MethodNotAllowed(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 405 - Method Not Allowed. A request was made of a resource using a request method not supported by that resource. Wrong technique, right intention. ๐Ÿ™ƒ

  • http_status = 405
  • message = 'Method Not Allowed'

MultipleChoices

MultipleChoices(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPRedirection

HTTP 300 - Multiple Choices. Indicates multiple options for the resource that the client may follow. The server is making you pick the restaurant and it's giving you zero help. ๐Ÿฝ๏ธ

  • http_status = 300
  • message = 'Multiple Choices'

NoUniqueMatch

Bases: ClientException

Multiple entities found instead of one. You wanted one bestie and the universe handed you a whole crowd. The search said "iconic" and returned three of them. ๐Ÿ˜ตโ€๐Ÿ’ซ


NotAcceptable

NotAcceptable(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 406 - Not Acceptable. The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request. Miss girl over here is picky. ๐ŸŽ€

  • http_status = 406
  • message = 'Not Acceptable'

NotFound

NotFound(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 404 - Not Found. The requested resource could not be found but may be available again in the future. So there's hope. Barely. โœจ

  • http_status = 404
  • message = 'Not Found'

PaymentRequired

PaymentRequired(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 402 - Payment Required. Reserved for future use. Sitting there, lurking, waiting for its era. ๐Ÿค‘

  • http_status = 402
  • message = 'Payment Required'

PreconditionFailed

PreconditionFailed(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 412 - Precondition Failed. The server does not meet one of the preconditions that the requester put on the request. You said "only ifโ€ฆ" and the only-if did not hold. ๐Ÿ’”

  • http_status = 412
  • message = 'Precondition Failed'

ProxyAuthenticationRequired

ProxyAuthenticationRequired(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 407 - Proxy Authentication Required. The client must first authenticate itself with the proxy. Talk to the middleman before you talk to anyone else, babe. ๐Ÿ”

  • http_status = 407
  • message = 'Proxy Authentication Required'

RequestEntityTooLarge

RequestEntityTooLarge(*args, **kwargs)

Bases: HTTPClientError

HTTP 413 - Request Entity Too Large. The request is larger than the server is willing or able to process. Her eyes were bigger than her server. ๐Ÿ˜ณ

  • http_status = 413
  • message = 'Request Entity Too Large'

RequestTimeout

RequestTimeout(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 408 - Request Timeout. The server timed out waiting for the request. The waiting was mutual and yet the server closed the chat first. โŒ›

  • http_status = 408
  • message = 'Request Timeout'

RequestUriTooLong

RequestUriTooLong(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 414 - Request-URI Too Long. The URI provided was too long for the server to process. You sent a whole essay in the URL sweetie. ๐Ÿ“œ

  • http_status = 414
  • message = 'Request-URI Too Long'

RequestedRangeNotSatisfiable

RequestedRangeNotSatisfiable(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 416 - Requested Range Not Satisfiable. The client has asked for a portion of the file, but the server cannot supply that portion. Wrong slice, wrong cake. ๐Ÿฐ

  • http_status = 416
  • message = 'Requested Range Not Satisfiable'

ServiceUnavailable

ServiceUnavailable(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HttpServerError

HTTP 503 - Service Unavailable. The server is currently unavailable. She's on a break, out of office, do not perceive her. ๐ŸŒธ

  • http_status = 503
  • message = 'Service Unavailable'

Unauthorized

Unauthorized(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 401 - Unauthorized. Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided. The classic "who even are you?" energy. ๐Ÿชช

  • http_status = 401
  • message = 'Unauthorized'

...and the exceptions just keep coming, bestie, so let's keep it rolling ๐Ÿ’…

exception watcherclient.common.apiclient.exceptions.UnprocessableEntity(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 422 โ€” Unprocessable Entity ๐ŸŒธ

So like, the request was well-formed, it looked fine, but the server couldn't actually follow it because of semantic errors. Not a syntax vibe check fail โ€” a meaning vibe check fail.

http_status = 422

message = 'Unprocessable Entity'

exception watcherclient.common.apiclient.exceptions.UnsupportedMediaType(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError

HTTP 415 โ€” Unsupported Media Type ๐Ÿซ 

The request entity has a media type which the server or resource does not support. It's giving "you brought the wrong snack to the party."

http_status = 415

message = 'Unsupported Media Type'

exception watcherclient.common.apiclient.exceptions.UnsupportedVersion

Bases: ClientException

User is trying to use an unsupported version of the API. Iconic of them, but no ๐Ÿ’€

exception watcherclient.common.apiclient.exceptions.ValidationError

Bases: ClientException

Error in validation on API client side. Caught it before it even left the house, lowkey responsible of us.

watcherclient.common.apiclient.exceptions.from_response(response, method, url)

Returns an instance of HttpError or subclass based on response. Basically it reads the room and hands you back the right exception ๐Ÿ’–

Parameters

  • response โ€” instance of requests.Response class
  • method โ€” HTTP method used for request
  • url โ€” URL used for request

Module contents

Okay, now we're in the actual module contents, and this is where the plumbing lives. Slay, plumbing ๐ŸŽ€

Submodules

watcherclient.common.api_versioning module

class watcherclient.common.api_versioning.APIVersion(version_str=None)

Bases: object

This class represents an API Version Request โœจ

It provides convenience methods for manipulation and comparison of version numbers that we need to do to implement microversions. Microversions are literally the main character here, no cap.

get_string()

Version string representation.

Converts object to string representation which if used to create an APIVersion object results in the same version.

is_latest()

is_null()

matches(min_version, max_version)

Matches the version object.

Returns whether the version object represents a version greater than or equal to the minimum version and less than or equal to the maximum version.

Parameters

  • min_version โ€” Minimum acceptable version.
  • max_version โ€” Maximum acceptable version.

Returns

boolean

If min_version is null then there is no minimum limit. If max_version is null then there is no maximum limit. If self is null then raise ValueError. Drama, but make it documented ๐Ÿฆ‹

watcherclient.common.api_versioning.action_update_supported(requested_version)

Check if we should support action update functionality.

Version 1.5 of the API added support for updating action state. History lesson, periodt.

watcherclient.common.api_versioning.allow_audit_template_default_parameters(requested_version)

Check if we should support default_parameters on audit templates.

Version 1.7 of the API added default_parameters to AuditTemplate. She's new here but she's already iconic.

watcherclient.common.api_versioning.allow_start_end_audit_time(requested_version)

Check if we should support optional start/end attributes for Audit.

Version 1.1 of the API added support for start and end time of continuous audits.

watcherclient.common.api_versioning.check_major_version(api_version)

Checks major part of APIVersion obj is supported.

Raises watcherclient.exceptions.UnsupportedVersion <#watcherclient.exceptions.UnsupportedVersion> โ€” if major part is not supported ๐Ÿ˜ญ

watcherclient.common.api_versioning.get_api_version(version_string)

Returns checked APIVersion object.

watcherclient.common.api_versioning.get_available_major_versions()

watcherclient.common.api_versioning.launch_audit_forced(requested_version)

Check if we should support force option for Audit.

Version 1.2 of the API added support for force option.

watcherclient.common.base module

Base utilities to build API operation managers and objects on top of. The foundations, the roots, the blueprint ๐Ÿ’…

class watcherclient.common.base.Manager(api)

Bases: object

Provides CRUD operations with a particular API.

resource_class = None

class watcherclient.common.base.Resource(manager, info, loaded=False)

Bases: Resource <#watcherclient.common.apiclient.base.Resource>

Represents a particular instance of an object (tenant, user, etc).

This is pretty much just a bag for attributes. We love an honest data structure.

to_dict()

watcherclient.common.base.getid(obj)

Wrapper to get object's ID.

Abstracts the common pattern of allowing both an object or an object's ID (UUID) as a parameter when dealing with relationships. Very "accept me as I am" of it ๐Ÿซถ

watcherclient.common.command module

class watcherclient.common.command.Command(app: _app.App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Command

log = <Logger watcherclient.common.command.Command (WARNING)>

run(parsed_args)

Invoked by the application when the command is run.

Developers implementing commands should override take_action().

Developers creating new command base classes (such as Lister and ShowOne) should override this method to wrap take_action().

Return the value returned by take_action() or 0.

class watcherclient.common.command.CommandMeta(name, bases, cls_dict)

Bases: ABCMeta

class watcherclient.common.command.Lister(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Command, Lister

log = <Logger watcherclient.common.command.Lister (WARNING)>

class watcherclient.common.command.ShowOne(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Command, ShowOne

get_parser(prog_name, formatter_class=None)

Return an argparse.ArgumentParser.

log = <Logger watcherclient.common.command.ShowOne (WARNING)>

watcherclient.common.httpclient module

class watcherclient.common.httpclient.HTTPClient(endpoint, **kwargs)

Bases: VersionNegotiationMixin

json_request(method, url, **kwargs)

log_curl_request(method, url, kwargs)

static log_http_response(resp, body=None)

raw_request(method, url, **kwargs)

class watcherclient.common.httpclient.SessionClient(os_infra_optim_api_version, api_version_select_state, max_retries, retry_interval, endpoint, **kwargs)

Bases: VersionNegotiationMixin, LegacyJsonAdapter

HTTP client based on Keystone client session. Keystone said "I got you" and honestly? She did ๐Ÿ’œ

json_request(method, url, **kwargs)

raw_request(method, url, **kwargs)

class watcherclient.common.httpclient.VerifiedHTTPSConnection(host, port, key_file=None, cert_file=None, ca_file=None, timeout=None, insecure=False)

Bases: HTTPSConnection

httplib-compatible connection using client-side SSL authentication

:see <http://code.activestate.com/recipes/> 577548-https-httplib-client-connection-with-certificate-v/ โ€” yes the recipe link is staying, it's part of the lore ๐Ÿ“

connect()

Connect to a host on a given (SSL) port.

If ca_file is pointing somewhere, use it to check Server Certificate. Responsible queen behaviour.

static get_system_ca_file()

Return path to system default CA file.

class watcherclient.common.httpclient.VersionNegotiationMixin

Bases: object

negotiate_version(conn, resp)

Negotiate the server version ๐Ÿ•Š๏ธ

Assumption: Called after receiving a 406 error when doing a request.

param conn: A connection object param resp: The response object from http request

watcherclient.common.httpclient.get_server(endpoint)

Extract and return the server & port that we're connecting to.

watcherclient.common.httpclient.with_retries(func)

Wrapper for _http_request adding support for retries. Try again, bestie, but like, formally ๐Ÿ’ซ

watcherclient.common.utils module

class watcherclient.common.utils.HelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)

Bases: HelpFormatter

start_section(heading)

watcherclient.common.utils.args_array_to_dict(kwargs, key_to_convert)

watcherclient.common.utils.args_array_to_patch(op, attributes, exclude_fields=[])

watcherclient.common.utils.common_filters(limit=None, sort_key=None, sort_dir=None, marker=None)

Generate common filters for any list request.

Parameters

  • limit โ€” maximum number of entities to return.
  • sort_key โ€” field to use for sorting.
  • sort_dir โ€” direction of sorting: 'asc' or 'desc'.
  • marker โ€” The last actionplan UUID of the previous page.

Returns

list of string filters.

watcherclient.common.utils.common_params_for_list(args, fields, field_labels)

Generate 'params' dict that is common for every 'list' command.

Parameters

  • args โ€” arguments from command line.
  • fields โ€” possible fields for sorting.
  • field_labels โ€” possible field labels for sorting.

Returns

a dict with params to pass to the client method.

watcherclient.common.utils.define_command(subparsers, command, callback, cmd_mapper)

Define a command in the subparsers collection.

Parameters

  • subparsers โ€” subparsers collection where the command will go
  • command โ€” command name
  • callback โ€” function that will be used to process the command

watcherclient.common.utils.define_commands_from_module(subparsers, command_module, cmd_mapper)

Add do_ methods in a module and add as commands into a subparsers. Very "if you built it, it ships" โœจ

watcherclient.common.utils.import_versioned_module(version, submodule=None)

watcherclient.common.utils.is_uuid_like(val)

Returns validation of a value as a UUID.

For our purposes, a UUID is a canonical form string: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa โ€” yes, it's literally just a's, that's the canonical form, don't come for me ๐ŸŒˆ

watcherclient.common.utils.serialize_file_to_dict(filename)

watcherclient.common.utils.split_and_deserialize(string, exclude_fields=[])

Split and try to JSON deserialize a string.


okay we are deep in the utils weeds and there is still more to come, so hydrate and stay tuned ๐Ÿ’–

Gets a string with the KEY=VALUE format, split it (using = as the separator) and try to JSON deserialize the VALUE.

Returns โ€” a tuple of (key, value). Cute, right? โœจ


๐ŸŽ€ Module contents (the osc one)

watcherclient.osc package

Submodules

watcherclient.osc.plugin module

watcherclient.osc.plugin.build_option_parser(parser) โ€” the hook where you add your global options. That's literally its whole job bestie ๐Ÿ’…

watcherclient.osc.plugin.check_api_version(check_version) โ€” validates the version the user handed over. It returns:

  • True if the version is OK ๐Ÿ‘‘
  • False if the version hasn't been checked and the previous plugin check should be performed
  • ...or it throws an exception if the version is no good ๐Ÿ˜ญ (yep, it will absolutely throw)

watcherclient.osc.plugin.make_client(instance) โ€” hands you back an infra-optim service client. Slay.


๐Ÿฆ‹ Module contents (the v1 one)

watcherclient.v1 package

Submodules

watcherclient.v1.action module

class watcherclient.v1.action.Action(manager, info, loaded=False)

  • Bases: Resource (#watcherclient.common.base.Resource)

class watcherclient.v1.action.ActionManager(api)

  • Bases: Manager (#watcherclient.common.base.Manager)

Methods:

  • get(action_id) โ€” get one.
  • list(action_plan=None, audit=None, limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” Retrieve a list of action. Parameters, bestie:
    • action_plan โ€” UUID of the action plan
    • audit โ€” UUID of the audit
    • limit โ€” okay this one has layers. It's the maximum number of results to return per request, if:
      1. limit > 0, the maximum number of actions to return.
      2. limit == 0, return the entire list of actions.
      3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
    • sort_key โ€” Optional, field used for sorting.
    • sort_dir โ€” Optional, direction of sorting, either 'asc' (the default) or 'desc'.
    • detail โ€” Optional, boolean whether to return detailed information about actions.
    • marker โ€” Optional, UUID of the last action in the previous page.

Returns โ€” a list of actions. ๐Ÿซถ

  • resource_class โ€” alias of Action
  • update(action_id, patch) โ€” update it.

watcherclient.v1.action_plan module

class watcherclient.v1.action_plan.ActionPlan(manager, info, loaded=False)

  • Bases: Resource (#watcherclient.common.base.Resource)

class watcherclient.v1.action_plan.ActionPlanManager(api)

  • Bases: Manager (#watcherclient.common.base.Manager)

Methods:

  • cancel(action_plan_id) โ€” cancel it โœจ
  • delete(action_plan_id) โ€” delete it ๐Ÿ’€
  • get(action_plan_id) โ€” get it
  • list(audit=None, limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” Retrieve a list of action plan. Parameters:
    • audit โ€” Name of the audit
    • limit โ€” maximum number of results to return per request, if:
      1. limit > 0, the maximum number of action plans to return.
      2. limit == 0, return the entire list of action plans.
      3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
    • sort_key โ€” Optional, field used for sorting.
    • sort_dir โ€” Optional, direction of sorting, either 'asc' (the default) or 'desc'.
    • detail โ€” Optional, boolean whether to return detailed information about action plans.
    • marker โ€” The last actionplan UUID of the previous page; displays list of actionplans after "marker".

Returns โ€” a list of action plans.

  • resource_class โ€” alias of ActionPlan
  • start(action_plan_id) โ€” start it ๐Ÿ”ฅ
  • update(action_plan_id, patch) โ€” update it

watcherclient.v1.action_plan_shell module

class watcherclient.v1.action_plan_shell.CancelActionPlan(app: App, app_args: Namespace | None, cmd_name: str | None = None)

  • Bases: ShowOne (#watcherclient.common.command.ShowOne)
  • Cancel action plan command.
  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.action_plan_shell.CancelActionPlan (WARNING)>
  • take_action(parsed_args) โ€” Run command. Return a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.action_plan_shell.DeleteActionPlan(app: _app.App, app_args: Namespace | None, cmd_name: str | None = None)

  • Bases: Command (#watcherclient.common.command.Command)
  • Delete action plan command.
  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.action_plan_shell.DeleteActionPlan (WARNING)>
  • take_action(parsed_args) โ€” Override to do something useful. The returned value will be returned by the program.

class watcherclient.v1.action_plan_shell.ListActionPlan(app: App, app_args: Namespace | None, cmd_name: str | None = None)

  • Bases: Lister (#watcherclient.common.command.Lister)
  • List information on retrieved action plans.
  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.action_plan_shell.ListActionPlan (WARNING)>
  • take_action(parsed_args) โ€” Run command. Return a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.action_plan_shell.ShowActionPlan(app: App, app_args: Namespace | None, cmd_name: str | None = None)

  • Bases: ShowOne (#watcherclient.common.command.ShowOne)
  • Show detailed information about a given action plan.
  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.action_plan_shell.ShowActionPlan (WARNING)>
  • take_action(parsed_args) โ€” Run command. Return a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.action_plan_shell.StartActionPlan(app: App, app_args: Namespace | None, cmd_name: str | None = None)

  • Bases: ShowOne (#watcherclient.common.command.ShowOne)
  • Start action plan command.
  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.action_plan_shell.StartActionPlan (WARNING)>
  • take_action(parsed_args) โ€” Run command. Return a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.action_plan_shell.UpdateActionPlan(app: App, app_args: Namespace | None, cmd_name: str | None = None)

  • Bases: ShowOne (#watcherclient.common.command.ShowOne)
  • Update action plan command.
  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.action_plan_shell.UpdateActionPlan (WARNING)>
  • take_action(parsed_args) โ€” Run command. Return a tuple containing the column names and an iterable containing the data to be listed.

watcherclient.v1.action_plan_shell.drop_unsupported_field(app_args, fields, field_labels) ๐ŸŒธ

watcherclient.v1.action_plan_shell.format_global_efficacy(global_efficacy) โœจ

watcherclient.v1.action_shell module

class watcherclient.v1.action_shell.ListAction(app: App, app_args: Namespace | None, cmd_name: str | None = None)

  • Bases: Lister (#watcherclient.common.command.Lister)
  • List information on retrieved actions.
  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.action_shell.ListAction (WARNING)>
  • take_action(parsed_args) โ€” Run command. Return a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.action_shell.ShowAction(app: App, app_args: Namespace | None, cmd_name: str | None = None)

  • Bases: ShowOne (#watcherclient.common.command.ShowOne)
  • Show detailed information about a given action.
  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.action_shell.ShowAction (WARNING)>
  • take_action(parsed_args) โ€” Run command. Return a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.action_shell.UpdateAction(app: App, app_args: Namespace | None, cmd_name: str | None = None)

  • Bases: ShowOne (#watcherclient.common.command.ShowOne)
  • Update action command.
  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.action_shell.UpdateAction (WARNING)>
  • take_action(parsed_args) โ€” Run command. Return a tuple containing the column names and an iterable containing the data to be listed.

watcherclient.v1.action_shell.drop_unsupported_field(app_args, fields, field_labels) ๐Ÿ’œ

watcherclient.v1.audit module

class watcherclient.v1.audit.Audit(manager, info, loaded=False)

  • Bases: Resource (#watcherclient.common.base.Resource)

class watcherclient.v1.audit.AuditManager(api)

  • Bases: Manager (#watcherclient.common.base.Manager)

Methods:

  • create(**kwargs) โ€” make a new one
  • delete(audit) โ€” yeet it ๐Ÿ’€
  • get(audit) โ€” grab it
  • list(audit_template=None, limit=None, sort_key=None, sort_dir=None, detail=False, goal=None, strategy=None, marker=None) โ€” Retrieve a list of audit. Parameters:
    • audit_template โ€” Name of the audit template
    • limit โ€” the maximum number of results to return per request, if:
      1. limit > 0, the maximum number of audits to return.

...and the rest of that limit bullet goes like:

  1. limit == 0 โ†’ you get the entire list of audits, no cap, the whole buffet ๐Ÿ“
  2. limit param is NOT specified (None) โ†’ the number of items returned respects the maximum imposed by the Watcher API (peep Watcher's api.max_limit option, iykyk ๐Ÿ‘€)
  • sort_key โ€” optional, the field used for sorting โœจ
  • sort_dir โ€” optional, direction of sorting, either 'asc' (that's the default, bestie) or 'desc'
  • detail โ€” optional boolean, controls whether you get detailed information about audits
  • marker โ€” optional, the UUID of the last audit in the previous page ๐ŸŽ€

Returns โ€” a list of audits. slay.

resource_class โ€” alias of Audit ๐Ÿ’…

update(audit, patch) โ€” the manager's update hook. zero prose in the docs for this one, just the signature, and honestly that's all we're getting ๐Ÿ™ˆ


watcherclient.v1.audit_shell module

class watcherclient.v1.audit_shell.CreateAudit(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne

Create new audit. that's the whole job bestie ๐Ÿ’–

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_shell.CreateAudit (WARNING)>
  • take_action(parsed_args) โ€” Run command. Returns a tuple containing the column names and an iterable containing the data to be listed ๐ŸŒธ

class watcherclient.v1.audit_shell.DeleteAudit(app: _app.App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Command

Delete audit command. bye bye audit ๐Ÿ‘‹

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_shell.DeleteAudit (WARNING)>
  • take_action(parsed_args) โ€” Override to do something useful. The returned value will be returned by the program.

class watcherclient.v1.audit_shell.ListAudit(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Lister

List information on retrieved audits. give me the whole roster ๐Ÿ“‹

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_shell.ListAudit (WARNING)>
  • take_action(parsed_args) โ€” Run command. Returns a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.audit_shell.ShowAudit(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne

Show detailed information about a given audit. the full lore on one audit ๐Ÿ”

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_shell.ShowAudit (WARNING)>
  • take_action(parsed_args) โ€” Run command. Returns a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.audit_shell.UpdateAudit(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne

Update audit command. glow-up time โœจ

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_shell.UpdateAudit (WARNING)>
  • take_action(parsed_args) โ€” Run command. Returns a tuple containing the column names and an iterable containing the data to be listed.

drop_unsupported_field(app_args, fields, field_labels)

module-level helper, and the docs give us literally nothing else about it โ€” the signature IS the documentation bestie ๐Ÿซถ


watcherclient.v1.audit_template module

class watcherclient.v1.audit_template.AuditTemplate(manager, info, loaded=False)

Bases: Resource

(no extra prose in the docs, it just exists and we love it for that ๐ŸŽ€)

class watcherclient.v1.audit_template.AuditTemplateManager(api)

Bases: Manager

  • create(**kwargs) โ€” the create hook, signature only, no prose ๐Ÿ™ˆ
  • delete(audit_template_id) โ€” the delete hook, takes the audit template id
  • get(audit_template_id) โ€” the get hook, takes the audit template id
  • list(name=None, goal=None, strategy=None, limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” Retrieve a list of audit template.

Parameters

  • name โ€” Name of the audit template
  • limit โ€” The maximum number of results to return per request, if:
    1. limit > 0 โ†’ the maximum number of audit templates to return.
    2. limit == 0 โ†’ return the entire list of audit_templates.
    3. limit param is NOT specified (None) โ†’ the number of items returned respects the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
  • sort_key โ€” Optional, field used for sorting.
  • sort_dir โ€” Optional, direction of sorting, either 'asc' (the default) or 'desc'.
  • detail โ€” Optional, boolean whether to return detailed information about audit_templates.
  • marker โ€” Optional, UUID of the last audit template of the previous page.

Returns โ€” A list of audit templates. ๐Ÿ’–

  • resource_class โ€” alias of AuditTemplate โญ
  • update(audit_template_id, patch) โ€” update hook, takes the audit template id and the patch

watcherclient.v1.audit_template_shell module

class watcherclient.v1.audit_template_shell.CreateAuditTemplate(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne

Create new audit template. fresh template just dropped ๐Ÿ”ฅ

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_template_shell.CreateAuditTemplate (WARNING)>
  • take_action(parsed_args) โ€” Run command. Returns a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.audit_template_shell.DeleteAuditTemplate(app: _app.App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Command

Delete audit template command. yeet the template ๐Ÿ’€

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_template_shell.DeleteAuditTemplate (WARNING)>
  • take_action(parsed_args) โ€” Override to do something useful. The returned value will be returned by the program.

class watcherclient.v1.audit_template_shell.ListAuditTemplate(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Lister

List information on retrieved audit templates. lineup time ๐ŸŽ€

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_template_shell.ListAuditTemplate (WARNING)>
  • take_action(parsed_args) โ€” Run command. Returns a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.audit_template_shell.ShowAuditTemplate(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne

Show detailed information about a given audit template. all the deets ๐Ÿ”

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_template_shell.ShowAuditTemplate (WARNING)>
  • take_action(parsed_args) โ€” Run command. Returns a tuple containing the column names and an iterable containing the data to be listed.

class watcherclient.v1.audit_template_shell.UpdateAuditTemplate(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne

Update audit template command. edit that template, make it iconic โœจ

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.audit_template_shell.UpdateAuditTemplate (WARNING)>
  • take_action(parsed_args) โ€” Run command. Returns a tuple containing the column names and an iterable containing the data to be listed.

watcherclient.v1.client module

class watcherclient.v1.client.Client(endpoint=None, *args, **kwargs)

Bases: object

Client for the Watcher v1 API. the main character of this module, fr fr ๐Ÿ‘‘

Parameters

  • endpoint (string) โ€” A user-supplied endpoint URL for the watcher service.
  • token (function) โ€” Provides token for authentication. ๐Ÿ”‘
  • timeout (integer) โ€” Allows customization of the timeout for client http requests. (optional)

watcherclient.v1.data_model module

class watcherclient.v1.data_model.DataModel(manager, info, loaded=False)

Bases: Resource

(again, no extra prose โ€” it's a Resource and that's the vibe ๐Ÿฆ‹)

class watcherclient.v1.data_model.DataModelManager(api)

Bases: Manager

  • list(data_model_type='compute', audit=None) โ€” Retrieve a list of data model. ๐Ÿ“Š

Parameters

  • data_model_type โ€” The type of data model user wants to list. Supported values: compute. Future support values: storage, baremetal. The default value is compute.
  • audit โ€” The UUID of the audit, used to filter data model by the scope in audit.

Returns โ€” A list of data model. ๐Ÿ’–

  • resource_class โ€” alias of DataModel โญ

watcherclient.v1.data_model_shell module

class watcherclient.v1.data_model_shell.ListDataModel(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Lister

List information on retrieved data model. ๐Ÿ‘‘

  • get_parser(prog_name) โ€” Return an argparse.ArgumentParser.
  • get_tuple(dic, fields) โ€” helper that hands you back a tuple, signature's all we got ๐Ÿคท
  • log = <Logger watcherclient.v1.data_model_shell.ListDataModel (WARNING)>
  • take_action(parsed_args) โ€” Run command.

Return a tuple containing the column names and an iterable containing the data to be listed. โœจ (yeah that's the tail end of the take_action from up there โ˜๏ธ we're still going bestie don't scroll away)

๐ŸŽฏ watcherclient.v1.goal module

๐ŸŒŸ class watcherclient.v1.goal.Goal(manager, info, loaded=False)

Bases: Resource ๐Ÿ’œ

That's it, that's the whole class description. A Goal resource. No notes, no drama, she simply exists.

๐Ÿ‘‘ class watcherclient.v1.goal.GoalManager(api)

Bases: Manager ๐Ÿซถ

  • get(goal) โ€” grab a single goal. No extra description given, she's a woman of few words.
  • list(limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” ok so this one pulls back a whole list of goal, and the parameters are:
    • limit โ€” the maximum number of results to return per request, if:
      1. limit > 0, the maximum number of audits to return.
      2. limit == 0, return the entire list of audits.
      3. limit param is NOT specified (None), the number of items returned respects the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
๐Ÿซ  yes it literally says audits in the goal docs. we do not make the rules, we just report them faithfully, bestie.
  • sort_key โ€” optional, the field used for sorting.
  • sort_dir โ€” optional, direction of sorting, either 'asc' (the default) or 'desc'.
  • detail โ€” optional, boolean for whether to return detailed information about audits.
  • marker โ€” optional, the UUID of the last goal in the previous page.

Returns โ€” a list of goals. โœจ

  • resource_class โ€” alias of Goal.

๐Ÿฆ‹ watcherclient.v1.goal_shell module

๐Ÿ’… class watcherclient.v1.goal_shell.ListGoal(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Lister ๐ŸŒธ

Lists the info on your retrieved goals. That's her whole job and she's iconic at it.

  • get_parser(prog_name) โ€” returns an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.goal_shell.ListGoal (WARNING)>
  • take_action(parsed_args) โ€” runs the command, and returns a tuple containing the column names plus an iterable holding the data to be listed.

โญ class watcherclient.v1.goal_shell.ShowGoal(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne ๐ŸŽ€

Shows detailed information about a given goal. Detail mode: activated.

  • get_parser(prog_name) โ€” returns an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.goal_shell.ShowGoal (WARNING)>
  • take_action(parsed_args) โ€” runs the command, and returns a tuple containing the column names plus an iterable holding the data to be listed.

๐ŸŒˆ watcherclient.v1.resource_fields module

No cap, there is literally nothing documented under this one. Empty. Void. A little ghost module ๐Ÿ‘ป โ€” she's listed in the docs and that's her entire contribution.

๐Ÿ”ฅ watcherclient.v1.scoring_engine module

๐Ÿงš class watcherclient.v1.scoring_engine.ScoringEngine(manager, info, loaded=False)

Bases: Resource ๐Ÿ’–

The ScoringEngine resource itself. Short and sweet.

๐Ÿ“ class watcherclient.v1.scoring_engine.ScoringEngineManager(api)

Bases: Manager ๐Ÿ’ซ

  • get(scoring_engine_name) โ€” fetch one scoring engine by name. That's the whole note, she's lowkey.
  • list(limit=None, sort_key=None, sort_dir=None, detail=False) โ€” retrieves a list of scoring engines:
    • limit โ€” the maximum number of results to return per request, if:
      1. limit > 0, the maximum number of scoring engines to return.
      2. limit == 0, return the entire list of scoring engines.
      3. limit param is NOT specified (None), the number of items returned respects the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
    • sort_key โ€” optional, the field used for sorting.
    • sort_dir โ€” optional, direction of sorting, either 'asc' (the default) or 'desc'.
    • detail โ€” optional, boolean for whether to return detailed information about scoring engines.

Returns โ€” a list of scoring engines. ๐Ÿ”ฅ

๐Ÿ‘€ notice there's no marker here. different method, different vibes. we don't add what isn't there.
  • resource_class โ€” alias of ScoringEngine.

๐ŸŽ€ watcherclient.v1.scoring_engine_shell module

๐Ÿฆ„ class watcherclient.v1.scoring_engine_shell.ListScoringEngine(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Lister ๐ŸŒธ

Lists the info on your retrieved scoring engines.

  • get_parser(prog_name) โ€” returns an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.scoring_engine_shell.ListScoringEngine (WARNING)>
  • take_action(parsed_args) โ€” runs the command, and returns a tuple containing the column names plus an iterable holding the data to be listed.

๐ŸŒŸ class watcherclient.v1.scoring_engine_shell.ShowScoringEngine(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne ๐Ÿ’œ

Shows detailed information about a given scoring engine.

  • get_parser(prog_name) โ€” returns an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.scoring_engine_shell.ShowScoringEngine (WARNING)>
  • take_action(parsed_args) โ€” runs the command, and returns a tuple containing the column names plus an iterable holding the data to be listed.

๐ŸŒธ watcherclient.v1.service module

๐Ÿซถ class watcherclient.v1.service.Service(manager, info, loaded=False)

Bases: Resource โœจ

The Service resource. Main character energy, minimal documentation.

๐Ÿ‘‘ class watcherclient.v1.service.ServiceManager(api)

Bases: Manager ๐Ÿ’ซ

  • get(service) โ€” get one service. That's the note. Move along, nothing else to see ๐Ÿซก
  • list(limit=None, sort_key=None, sort_dir=None, detail=False) โ€” retrieves a list of services:
    • limit โ€” the maximum number of results to return per request, if:
      1. limit > 0, the maximum number of services to return.
      2. limit == 0, return the entire list of services.
      3. limit param is NOT specified (None), the number of items returned respects the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
    • sort_key โ€” optional, the field used for sorting.
    • sort_dir โ€” optional, direction of sorting, either 'asc' (the default) or 'desc'.
    • detail โ€” optional, boolean for whether to return detailed information about services.

Returns โ€” a list of services. โญ

(again: no marker param. we stay faithful. ๐Ÿ’…)
  • resource_class โ€” alias of Service.

๐Ÿฆ‹ watcherclient.v1.service_shell module

๐ŸŒˆ class watcherclient.v1.service_shell.ListService(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Lister ๐ŸŽ€

Lists the info on your retrieved services.

  • get_parser(prog_name) โ€” returns an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.service_shell.ListService (WARNING)>
  • take_action(parsed_args) โ€” runs the command, and returns a tuple containing the column names plus an iterable holding the data to be listed.

๐Ÿ’– class watcherclient.v1.service_shell.ShowService(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne ๐ŸŒธ

Shows detailed information about a given service.

  • get_parser(prog_name) โ€” returns an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.service_shell.ShowService (WARNING)>
  • take_action(parsed_args) โ€” runs the command, and returns a tuple containing the column names plus an iterable holding the data to be listed.

๐Ÿงš watcherclient.v1.strategy module

๐Ÿ’œ class watcherclient.v1.strategy.Strategy(manager, info, loaded=False)

Bases: Resource ๐Ÿ’ซ

The Strategy resource. Slay, no further notes.

๐Ÿ”ฅ class watcherclient.v1.strategy.StrategyManager(api)

Bases: Manager โญ

  • get(strategy) โ€” grab one strategy. That's the entire documentation and honestly? respect.
  • list(goal=None, limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” retrieves a list of strategy. Ok so this one's got an extra filter bestie, watch:
    • goal โ€” the UUID of the goal to filter by. ๐ŸŽฏ
    • limit โ€” the maximum number of results to return per request, if:
      1. limit > 0, the maximum number of audits to return.
      2. limit == 0, return the entire list of audits.
      3. limit param is NOT specified (None), the number of items returned respects the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
๐Ÿซ  yep, "audits" again. copying the docs faithfully, not fixing them, that's the assignment.
  • sort_key โ€” optional, the field used for sorting.
  • sort_dir โ€” optional, direction of sorting, either 'asc' (the default) or 'desc'.
  • detail โ€” optional, boolean for whether to return detailed information about audits.
  • marker โ€” optional, the UUID of the last strategy in the previous page.

Returns โ€” a list of audits. ๐Ÿ˜ญ (yes, audits. the docs said what they said.)

  • resource_class โ€” alias of Strategy.
  • state(strategy) โ€” also exists. No description attached, she's mysterious like that ๐Ÿ™ˆ

๐ŸŽ€ watcherclient.v1.strategy_shell module

๐Ÿฆ„ class watcherclient.v1.strategy_shell.ListStrategy(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Lister ๐ŸŒธ

Lists the info on your retrieved strategies.

  • get_parser(prog_name) โ€” returns an argparse.ArgumentParser.
  • log = <Logger watcherclient.v1.strategy_shell.ListStrategy (WARNING)>
  • take_action(parsed_args) โ€” runs the command, and returns a tuple containing the column names plus an iterable holding the data to be listed.

๐Ÿ‘‘ class watcherclient.v1.strategy_shell.ShowStrategy(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: ShowOne ๐Ÿ’–

Shows detailed information about a given strategy.

  • get_parser(prog_name) โ€” returns an argparse.ArgumentParser.

Still in ShowStrategy, bestie โ€” just these last two bits before we bounce:

  • log โ€” exact line: log = <Logger watcherclient.v1.strategy_shell.ShowStrategy (WARNING)>
  • take_action(parsed_args) โ€” Runs the command. Returns a tuple containing the column names and an iterable containing the data to be listed.

โœจ class watcherclient.v1.strategy_shell.StateStrategy(app: App, app_args: Namespace | None, cmd_name: str | None = None)

Bases: Lister (watcherclient.common.command.Lister)

Grabs information about strategy requirements. Slay.

  • get_parser(prog_name) โ€” Returns an argparse.ArgumentParser.
  • log โ€” exact line: log = <Logger watcherclient.v1.strategy_shell.StateStrategy (WARNING)>
  • take_action(parsed_args) โ€” Runs the command. Returns a tuple containing the column names and an iterable containing the data to be listed.

๐Ÿงฉ Module contents

Bestie, we're in manager city now. Every param, default, and alias is about to show up โ€” keep your eyes on the backticks. ๐Ÿ‘€

๐Ÿฆ‹ class watcherclient.v1.Action(manager, info, loaded=False)

Bases: Resource (watcherclient.common.base.Resource)

No extra methods here, just the base class doing its thing. Periodt.

๐Ÿ’… class watcherclient.v1.ActionManager(api)

Bases: Manager (watcherclient.common.base.Manager)

  • get(action_id)
  • list(action_plan=None, audit=None, limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” Retrieve a list of action.

Parameters

  • action_plan โ€” UUID of the action plan.
  • audit โ€” UUID of the audit.
  • limit โ€” The maximum number of results to return per request, if:
    1. limit > 0, the maximum number of actions to return.
    2. limit == 0, return the entire list of actions.
    3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
  • sort_key โ€” Optional, field used for sorting.
  • sort_dir โ€” Optional, direction of sorting, either 'asc' (the default) or 'desc'.
  • detail โ€” Optional, boolean whether to return detailed information about actions.
  • marker โ€” Optional, UUID of the last action in the previous page.

Returns: A list of actions.

  • resource_class โ€” alias of Action (watcherclient.v1.action.Action).
  • update(action_id, patch)

๐ŸŽ€ class watcherclient.v1.ActionPlan(manager, info, loaded=False)

Bases: Resource (watcherclient.common.base.Resource)

๐Ÿ”ฅ class watcherclient.v1.ActionPlanManager(api)

Bases: Manager (watcherclient.common.base.Manager)

  • cancel(action_plan_id)
  • delete(action_plan_id)
  • get(action_plan_id)
  • list(audit=None, limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” Retrieve a list of action plan.

Parameters

  • audit โ€” Name of the audit.
  • limit โ€” The maximum number of results to return per request, if:
    1. limit > 0, the maximum number of action plans to return.
    2. limit == 0, return the entire list of action plans.
    3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
  • sort_key โ€” Optional, field used for sorting.
  • sort_dir โ€” Optional, direction of sorting, either 'asc' (the default) or 'desc'.
  • detail โ€” Optional, boolean whether to return detailed information about action plans.
  • marker โ€” The last actionplan UUID of the previous page; displays list of actionplans after "marker".

Returns: A list of action plans.

  • resource_class โ€” alias of ActionPlan (watcherclient.v1.action_plan.ActionPlan).
  • start(action_plan_id)
  • update(action_plan_id, patch)

๐ŸŒธ class watcherclient.v1.Audit(manager, info, loaded=False)

Bases: Resource (watcherclient.common.base.Resource)

๐Ÿ’œ class watcherclient.v1.AuditManager(api)

Bases: Manager (watcherclient.common.base.Manager)

  • create(**kwargs)
  • delete(audit)
  • get(audit)
  • list(audit_template=None, limit=None, sort_key=None, sort_dir=None, detail=False, goal=None, strategy=None, marker=None) โ€” Retrieve a list of audit.

Parameters

  • audit_template โ€” Name of the audit template.
  • limit โ€” The maximum number of results to return per request, if:
    1. limit > 0, the maximum number of audits to return.
    2. limit == 0, return the entire list of audits.
    3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
  • sort_key โ€” Optional, field used for sorting.
  • sort_dir โ€” Optional, direction of sorting, either 'asc' (the default) or 'desc'.
  • detail โ€” Optional, boolean whether to return detailed information about audits.
  • marker โ€” Optional, UUID of the last audit in the previous page.

Returns: A list of audits.

  • resource_class โ€” alias of Audit (watcherclient.v1.audit.Audit).
  • update(audit, patch)

โœจ class watcherclient.v1.AuditTemplate(manager, info, loaded=False)

Bases: Resource (watcherclient.common.base.Resource)

๐ŸŒˆ class watcherclient.v1.AuditTemplateManager(api)

Bases: Manager (watcherclient.common.base.Manager)

  • create(**kwargs)
  • delete(audit_template_id)
  • get(audit_template_id)
  • list(name=None, goal=None, strategy=None, limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” Retrieve a list of audit template.

Parameters

  • name โ€” Name of the audit template.
  • limit โ€” The maximum number of results to return per request, if:
    1. limit > 0, the maximum number of audit templates to return.
    2. limit == 0, return the entire list of audit_templates.
    3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
  • sort_key โ€” Optional, field used for sorting.
  • sort_dir โ€” Optional, direction of sorting, either 'asc' (the default) or 'desc'.
  • detail โ€” Optional, boolean whether to return detailed information about audit_templates.
  • marker โ€” Optional, UUID of the last audit template of the previous page.

Returns: A list of audit templates.

  • resource_class โ€” alias of AuditTemplate (watcherclient.v1.audit_template.AuditTemplate).
  • update(audit_template_id, patch)

๐Ÿซถ class watcherclient.v1.DataModel(manager, info, loaded=False)

Bases: Resource (watcherclient.common.base.Resource)

๐Ÿงš class watcherclient.v1.DataModelManager(api)

Bases: Manager (watcherclient.common.base.Manager)

  • list(data_model_type='compute', audit=None) โ€” Retrieve a list of data model.

Parameters

  • data_model_type โ€” The type of data model user wants to list. Supported values: compute. Future support values: storage, baremetal. The default value is compute.
  • audit โ€” The UUID of the audit, used to filter data model by the scope in audit.

Returns: A list of data model.

  • resource_class โ€” alias of DataModel (watcherclient.v1.data_model.DataModel).

๐Ÿ“ class watcherclient.v1.Goal(manager, info, loaded=False)

Bases: Resource (watcherclient.common.base.Resource)

๐Ÿ‘‘ class watcherclient.v1.GoalManager(api)

Bases: Manager (watcherclient.common.base.Manager)

  • get(goal)
  • list(limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” Retrieve a list of goal.

Parameters

  • limit โ€” The maximum number of results to return per request, if:
    1. limit > 0, the maximum number of audits to return.
    2. limit == 0, return the entire list of audits.
    3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
  • sort_key โ€” Optional, field used for sorting.
  • sort_dir โ€” Optional, direction of sorting, either 'asc' (the default) or 'desc'.
  • detail โ€” Optional, boolean whether to return detailed information about audits.
  • marker โ€” Optional, UUID of the last goal in the previous page.

Returns: A list of goals.

  • resource_class โ€” alias of Goal (watcherclient.v1.goal.Goal).

โญ class watcherclient.v1.ScoringEngine(manager, info, loaded=False)

Bases: Resource (watcherclient.common.base.Resource)

๐Ÿ’– class watcherclient.v1.ScoringEngineManager(api)

Bases: Manager (watcherclient.common.base.Manager)

  • get(scoring_engine_name)
  • list(limit=None, sort_key=None, sort_dir=None, detail=False) โ€” Retrieve a list of scoring engines.

Parameters

  • limit โ€” The maximum number of results to return per request, if:
  1. limit > 0 โ†’ the max number of scoring engines to come back at you ๐Ÿ’…
    1. limit == 0 โ†’ give me the WHOLE list of scoring engines, no cap ๐Ÿซถ
    2. limit param is NOT specified (None) โ†’ the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option) ๐Ÿ‘‘
  • sort_key โ€” optional, the field you wanna sort by โœจ
  • sort_dir โ€” optional, direction of sorting, either 'asc' (the default, bestie) or 'desc' ๐ŸŒธ
  • detail โ€” optional, boolean for whether you want the detailed info about scoring engines ๐Ÿ”

Returns โ€” a list of scoring engines ๐Ÿ’–

resource_class โ€” alias of ScoringEngine (that's watcherclient.v1.scoring_engine.ScoringEngine for the full address, iykyk) ๐ŸŽ€


class watcherclient.v1.Service(manager, info, loaded=False)

Bases: Resource (watcherclient.common.base.Resource).

That's the Service resource, periodt ๐Ÿฆ‹

class watcherclient.v1.ServiceManager(api)

Bases: Manager (watcherclient.common.base.Manager).

  • get(service) โ€” that's the getter, no extra notes attached ๐Ÿ™ˆ
  • list(limit=None, sort_key=None, sort_dir=None, detail=False) โ€” retrieve a list of services ๐Ÿ˜Œ

Parameters

  • limit โ€” the maximum number of results to return per request, if:
    1. limit > 0 โ†’ the maximum number of services to return.
    2. limit == 0 โ†’ return the entire list of services.
    3. limit param is NOT specified (None) โ†’ the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
  • sort_key โ€” optional, field used for sorting โœจ
  • sort_dir โ€” optional, direction of sorting, either 'asc' (the default) or 'desc' ๐ŸŒˆ
  • detail โ€” optional, boolean whether to return detailed information about services ๐Ÿ‘€

Returns โ€” a list of services ๐Ÿ’–

resource_class โ€” alias of Service (watcherclient.v1.service.Service) ๐ŸŽ€


class watcherclient.v1.Strategy(manager, info, loaded=False)

Bases: Resource (watcherclient.common.base.Resource).

The Strategy resource itself ๐ŸŒธ

class watcherclient.v1.StrategyManager(api)

Bases: Manager (watcherclient.common.base.Manager).

  • get(strategy) โ€” the getter for strategies, slay ๐Ÿ’…
  • list(goal=None, limit=None, sort_key=None, sort_dir=None, detail=False, marker=None) โ€” retrieve a list of strategy ๐Ÿ”ฅ

Parameters

  • goal โ€” the UUID of the goal to filter by ๐ŸŽฏ
  • limit โ€” the maximum number of results to return per request, if:
    1. limit > 0 โ†’ the maximum number of audits to return.
    2. limit == 0 โ†’ return the entire list of audits.
    3. limit param is NOT specified (None) โ†’ the number of items returned respect the maximum imposed by the Watcher API (see Watcher's api.max_limit option).
yes bestie, the original really does say "audits" in the strategy section โ€” I'm not fixing it, I'm just reporting it as-is ๐Ÿ˜ญ๐Ÿ’€
  • sort_key โ€” optional, field used for sorting โœจ
  • sort_dir โ€” optional, direction of sorting, either 'asc' (the default) or 'desc' ๐Ÿฆ‹
  • detail โ€” optional, boolean whether to return detailed information about audits (again, as written ๐Ÿ‘‘)
  • marker โ€” optional, UUID of the last strategy in the previous page ๐Ÿ“‘

Returns โ€” a list of audits. (verbatim from the source, no cap ๐Ÿซถ)

resource_class โ€” alias of Strategy (watcherclient.v1.strategy.Strategy) ๐ŸŽ€

  • state(strategy) โ€” yep, it's there, that's the whole note ๐Ÿงš

๐ŸŒŸ Submodules ๐ŸŒŸ

watcherclient.client module

watcherclient.client.Client(version, *args, **kwargs)

Initialize client object based on given version โœจ

HOW-TO: the simplest way to create a client instance is initialization with your credentials:

>>> from watcherclient import client
>>> watcher = client.Client(VERSION, USERNAME, PASSWORD,
...                      PROJECT_ID, AUTH_URL)

Here VERSION can be a string or watcherclient.api_versions.APIVersion obj. If you prefer string value, you can use 1 or 1.X (where X is a microversion) ๐ŸŒธ

Alternatively, you can create a client instance using the keystoneauth session API. See "The watcherclient Python API" page at python-watcherclient's doc ๐Ÿ“š


watcherclient.client.get_client(...) โ€” get an authenticated client, based on the credentials ๐Ÿ‘‘

Full signature, exactly as written (yes it's a whole paragraph of params, we stay faithful):

watcherclient.client.get_client(api_version, os_auth_token=None,
watcher_url=None, os_username=None, os_password=None, os_auth_url=None,
os_project_id=None, os_project_name=None, os_tenant_id=None,
os_tenant_name=None, os_region_name=None, os_user_domain_id=None,
os_user_domain_name=None, os_project_domain_id=None,
os_project_domain_name=None, os_service_type=None,
os_endpoint_type=None, insecure=None, timeout=None, os_cacert=None,
ca_file=None, os_cert=None, cert_file=None, os_key=None, key_file=None,
os_infra_optim_api_version=None, max_retries=None, retry_interval=None,
session=None, os_endpoint_override=None, **ignored_kwargs)

Parameters ๐Ÿ’–

  • api_version โ€” the API version to use. Valid value: '1'.
  • os_auth_token โ€” pre-existing token to re-use ๐Ÿ”‘
  • watcher_url โ€” watcher API endpoint ๐ŸŒ
  • os_username โ€” name of a user ๐Ÿ™‹
  • os_password โ€” user's password ๐Ÿคซ
  • os_auth_url โ€” endpoint to authenticate against ๐Ÿšช
  • os_project_id โ€” ID of a project ๐Ÿ“
  • os_project_name โ€” name of a project ๐Ÿท๏ธ
  • os_tenant_id โ€” ID of a tenant (deprecated in favour of os_project_id) โš ๏ธ
  • os_tenant_name โ€” name of a tenant (deprecated in favour of os_project_name) โš ๏ธ
  • os_region_name โ€” name of a keystone region ๐Ÿ—บ๏ธ
  • os_user_domain_id โ€” ID of a domain the user belongs to ๐Ÿ 
  • os_user_domain_name โ€” name of a domain the user belongs to ๐Ÿก
  • os_project_domain_id โ€” ID of a domain the project belongs to ๐Ÿข
  • os_project_domain_name โ€” name of a domain the project belongs to ๐Ÿฌ
  • os_service_type โ€” the type of service to lookup the endpoint for ๐Ÿ”Ž
  • os_endpoint_type โ€” the type (exposure) of the endpoint ๐Ÿšฆ
  • insecure โ€” allow insecure SSL (no cert verification) ๐Ÿ˜ฌ
  • timeout โ€” allows customization of the timeout for client HTTP requests โฑ๏ธ
  • os_cacert โ€” path to cacert file ๐Ÿ“œ
  • ca_file โ€” path to cacert file, deprecated in favour of os_cacert โš ๏ธ
  • os_cert โ€” path to cert file ๐Ÿ“„
  • cert_file โ€” path to cert file, deprecated in favour of os_cert โš ๏ธ
  • os_key โ€” path to key file ๐Ÿ—๏ธ
  • key_file โ€” path to key file, deprecated in favour of os_key โš ๏ธ
  • os_infra_optim_api_version โ€” watcher API version to use ๐ŸŽ€
  • max_retries โ€” maximum number of retries in case of conflict error ๐Ÿ”
  • retry_interval โ€” amount of time (in seconds) between retries in case of conflict error โณ
  • session โ€” Keystone session to use ๐Ÿค
  • os_endpoint_override โ€” watcher API endpoint ๐ŸŒ
  • ignored_kwargs โ€” all the other params that are passed. Left for backwards compatibility. They are ignored ๐Ÿ’€

watcherclient.exceptions module

watcherclient.exceptions.AmbigiousAuthSystem โ€” alias of AmbiguousAuthSystem. (yes, the typo is real and it's iconic, we keep it exactly ๐Ÿซถ)

exception watcherclient.exceptions.AmbiguousAuthSystem

Bases: ClientException (watcherclient.common.apiclient.exceptions.ClientException).

Could not obtain token and endpoint using provided credentials. ๐Ÿ˜ญ

exception watcherclient.exceptions.CommandError

Bases: ClientException (watcherclient.common.apiclient.exceptions.ClientException).

Error in CLI tool.

An alias of watcherclient.common.apiclient.CommandError ๐Ÿ’…

exception watcherclient.exceptions.InternalServerError(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HttpServerError (watcherclient.common.apiclient.exceptions.HttpServerError).

HTTP 500 โ€” Internal Server Error. ๐Ÿšจ

A generic error message, given when no more specific message is suitable. An alias of watcherclient.common.apiclient.InternalServerError.

  • http_status = 500
  • message = 'Internal Server Error'

exception watcherclient.exceptions.InvalidAttribute

Bases: ClientException (watcherclient.common.apiclient.exceptions.ClientException). ๐Ÿ™ˆ

exception watcherclient.exceptions.Unauthorized(message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None)

Bases: HTTPClientError (watcherclient.common.apiclient.exceptions.HTTPClientError).

HTTP 401 โ€” Unauthorized. ๐Ÿ”’

Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided. An alias of watcherclient.common.apiclient.Unauthorized.

  • http_status = 401
  • message = 'Unauthorized'

exception watcherclient.exceptions.UnsupportedVersion

Bases: Exception.

Unsupported API Version.

Indicates that the user is trying to use an unsupported version of the API ๐Ÿšซ

exception watcherclient.exceptions.ValidationError

Bases: ClientException (watcherclient.common.apiclient.exceptions.ClientException).

Error in validation on API client side.

A generic error message, given when no more specific message is suitable. An alias of watcherclient.common.apiclient.ValidationError โœ…

watcherclient.exceptions.from_response(response, message=None, traceback=None, method=None, url=None)

Return an HttpError instance based on response from httplib/requests ๐ŸŒ€


watcherclient.shell module

Command-line interface to the Watcher API. ๐Ÿ’ปโœจ

class watcherclient.shell.WatcherShell(**kwargs)

Bases: App.

Watcher command line interface ๐Ÿ‘‘

okay picking right back up in the watcherclient.shell roster, bestie, no context needed ๐Ÿ’…

  • build_option_parser(description, version, argparse_kwargs=None) โ€” sets up the global arguments for the whole app. This one is inherited from the framework, so she's not doing anything new, just showing up and slaying the same way as always โœจ
  • configure_logging() โ€” configures logging for the app. that's it. that's the whole job ๐ŸŽ€
  • create_client(args) โ€” the original gives us literally no blurb here, just the signature. iconic minimalism, honestly ๐Ÿซถ (the name is the whole vibe: she makes you a client from your args)
  • prepare_to_run_command(cmd) โ€” gets everything ready to actually run the command. She checks that the minimal parameters are there, and she creates the client interface. Inherited from the framework, so you already know the drill ๐Ÿ˜Œ
  • run(argv) โ€” basically the main program for the application, no cap.
    • Parameters
      • argv (list of str) โ€” your input arguments and options ๐Ÿ’–

watcherclient.shell.main(argv=None)


๐Ÿฆ‹ watcherclient.version module ๐Ÿฆ‹

Module contents โ€” that's literally all the original says here, so that's all we're passing along, mwah ๐Ÿ’‹


๐Ÿ’œ watcherclient Python API ๐Ÿ’œ

okay so this is the fun part. The watcherclient Python API is how you get at watcher, the OpenStack TODEFINE Service. (yes, "TODEFINE" is really in there, we don't make the rules ๐Ÿ˜ญ)

so like, to mess with audits, you interact with an watcherclient.v1.audit object (docs live at api/watcherclient.v1.audit.html#watcherclient.v1.audit.Audit). And you get access to those audits through attributes of the watcherclient.v1.client.Client object (docs at api/watcherclient.v1.client.html#watcherclient.v1.client.Client). cute, right? one object holds the keys to another ๐Ÿ”‘

โœจ Usage โœจ

Get a Client object

First things first, bestie: make a watcherclient.v1.client.Client instance (docs: api/watcherclient.v1.client.html#watcherclient.v1.client.Client) by passing your credentials to watcherclient.client.get_client() (docs: api/watcherclient.client.html#watcherclient.client.get_client). By default, the Watcher system is configured so that only administrators (users with the 'admin' role) have access. so likeโ€ฆ get the role first, queen ๐Ÿ‘‘

There are two different sets of credentials you can roll with:

  • watcher endpoint and auth token
  • Identity Service (keystone) credentials

Using watcher endpoint and auth token

An auth token plus the watcher endpoint is enough to authenticate:

To create the client, you can use the API like so (copying this EXACTLY, character for character, because we do not touch the code ๐Ÿซถ):

>>> from watcherclient import client
>>>
>>> kwargs = {'os_auth_token': '3bcc3d3a03f44e3d8377f9247b0ad155'
>>>           'watcher_url': 'http://watcher.example.org:9322/'}
>>> watcher = client.get_client(1, **kwargs)

Using Identity Service (keystone) credentials

These Identity Service credentials work for auth:

  • os_username: name of user
  • os_password: user's password
  • os_auth_url: Identity Service endpoint for authorization
  • os_tenant_{name|id}: name or ID of tenant

And to create a client, you can use the API like so:

>>> from watcherclient import client
>>>
>>> kwargs = {'os_username': 'name',
>>>           'os_password': 'password',
>>>           'os_auth_url': 'http://keystone.example.org:5000/',
>>>           'os_tenant_name': 'tenant'}
>>> watcher = client.get_client(1, **kwargs)

Perform watcher operations

Once you've got a watcher Client (docs: api/watcherclient.v1.client.html#watcherclient.v1.client.Client), you can get into all sorts of tasks, like:

>>> watcher.action.list()  # list of actions
>>> watcher.action_plan.list()  # list of action_plan
>>> watcher.audit.get(audit_uuid_or_name)  # information about a particular audit

And whenever the Client (docs: api/watcherclient.v1.client.html#watcherclient.v1.client.Client) needs to throw an exception, she'll usually raise an instance listed over in watcherclient.exceptions (docs: api/watcherclient.exceptions.html). no surprises, she tells you where the receipts are ๐Ÿงพ

Refer to the modules themselves for more details โ€” that's the official word and we're respecting it ๐Ÿ’…

watcherclient Modules

(yep, that's the whole section heading โ€” no modules spelled out here, she's just a signpost ๐Ÿชง)


๐ŸŒธ INSTALLATION ๐ŸŒธ

if you've got virtualenvwrapper installed (docs: https://virtualenvwrapper.readthedocs.org/en/latest/install.html), here's the whole glow-up routine:

$ mkvirtualenv python-watcherclient
$ git clone https://opendev.org/openstack/python-watcherclient
$ cd python-watcherclient && python setup.py install
$ pip install -r ./requirements.txt

that's the entire ritual. go off ๐Ÿ‘‘


๐Ÿ”ฅ CONTRIBUTING TO PYTHON-WATCHERCLIENT ๐Ÿ”ฅ

if you're interested in contributing to the python-watcherclient project, the following will help get you started. welcome to the group chat, we're so happy you're here ๐Ÿซถ

๐ŸŽ€ Developer Certificate of Origin ๐ŸŽ€

In order to contribute to the python-watcherclient project, you need to adhere to the Developer Certificate of Origin (docs: https://developercertificate.org/). OpenStack utilizes the Developer Certificate of Origin (DCO) as a lightweight means to confirm that you are entitled to contribute the code you submit. This ensures that you are providing your contributions under the project's license and that you have the right to do so. it's giving โœจpaperwork that protects everyoneโœจ and honestly it's not even that deep, just sign it ๐Ÿ’–

See also:

๐ŸŒˆ LaunchPad Project ๐ŸŒˆ

Most of the tools used for OpenStack depend on a launchpad.net ID for authentication. After signing up for a launchpad account, join the "openstack" team to have access to the mailing list and receive notifications of important events. so like, make the account, join the team, get the notifications. no cap, that's how you stay in the loop ๐Ÿ“ฌ

See also:

โญ Project Hosting Details โญ

๐Ÿ› Bug tracker

https://launchpad.net/python-watcherclient

๐Ÿ“ฎ Mailing list (prefix subjects with [watcher] for faster responses)

http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-discuss

๐Ÿงš Code Hosting

https://opendev.org/openstack/python-watcherclient

๐Ÿ‘‘ Code Review

https://review.opendev.org/#/q/status:open+project:openstack/python-watcherclient,n,z


โœ๏ธ Author โœ๏ธ

Author name not set โ€” she's mysterious like that ๐Ÿ™ˆ


OpenStack Foundation


that's a wrap on the whole page, bestie ๐ŸŽ‰ this gem is from the PYTHON-WATCHERCLIENT(1) manual, source/version 4.11.0, dated the truly iconic Jan 02, 1980 โ€” yes, that date is really in the footer and we're obsessed with it. drink some water, go read the modules, and slay your deployments ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from