PYTHON-WATCHERCLIENT(1)
๐ 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
watcherclientmodules, 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 toenv[OS_IDENTITY_API_VERSION]or3.--os-auth-url <auth-url>,-A <auth-url>โ Defaults toenv[OS_AUTH_URL].--os-region-name <region-name>,-R <region-name>โ Defaults toenv[OS_REGION_NAME].--os-username <auth-user-name>,-U <auth-user-name>โ Defaults toenv[OS_USERNAME].--os-user-id <auth-user-id>โ Defaults toenv[OS_USER_ID].--os-password <auth-password>,-P <auth-password>โ Defaults toenv[OS_PASSWORD].--os-user-domain-id <auth-user-domain-id>โ Defaults toenv[OS_USER_DOMAIN_ID].--os-user-domain-name <auth-user-domain-name>โ Defaults toenv[OS_USER_DOMAIN_NAME].--os-tenant-name <auth-tenant-name>,-T <auth-tenant-name>โ Defaults toenv[OS_TENANT_NAME].--os-tenant-id <tenant-id>,-I <tenant-id>โ Defaults toenv[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 toenv[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 toenv[OS_PROJECT_NAME].--os-project-domain-id <auth-project-domain-id>โ Defaults toenv[OS_PROJECT_DOMAIN_ID].--os-project-domain-name <auth-project-domain-name>โ Defaults toenv[OS_PROJECT_DOMAIN_NAME].--os-auth-token <auth-token>โ Defaults toenv[OS_AUTH_TOKEN].--os-watcher-api-version <os-watcher-api-version>โ Defaults toenv[OS_INFRA_OPTIM_API_VERSION].--os-endpoint-type OS_ENDPOINT_TYPEโ Defaults toenv[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, and0means 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 beONESHOTorCONTINUOUS. Default isONESHOT. 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,0for 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 beONESHOTorCONTINUOUS. Default isONESHOT.-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 isCONTINUOUS.-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,0for 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 ayamlor ajsonfile, 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;0means 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,0for 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,0for 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,0for 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 iscompute๐--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,0for 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 givenkwargs.
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 = Nonecreate(**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
- Parameters:
get(**kwargs)head(**kwargs)key = Nonelist(base_url=None, **kwargs)โ List the collection.- Parameters:
base_url-- if provided, the generated URL will be appended to it
- Parameters:
put(base_url=None, **kwargs)โ Update an element.- Parameters:
base_url-- if provided, the generated URL will be appended to it
- Parameters:
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 hookshook_type-- hook type, e.g.,'__pre_parse_args__'hook_func-- hook function
- Parameters:
classmethod run_hooks(hook_type, *args, **kwargs)โ Run all hooks of specified type.- Parameters:
cls-- class that registers hookshook_type-- hook type, e.g.,'__pre_parse_args__'args-- args to be passed to every hook functionkwargs-- kwargs to be passed to every hook function
- Parameters:
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 = FalseNAME_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 = 502message = '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 = 400message = '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 = 409message = '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=417message='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=403message='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=504message='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=410message='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=0message='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=501message='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=505message='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=500message='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=411message='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=405message='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=300message='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=406message='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=404message='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=402message='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=412message='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=407message='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=413message='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=408message='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=414message='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=416message='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=503message='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=401message='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.Responseclass - 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:
Trueif the version is OK ๐Falseif 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 planauditโ UUID of the auditlimitโ okay this one has layers. It's the maximum number of results to return per request, if:limit > 0, the maximum number of actions to return.limit == 0, return the entire list of actions.- limit param is NOT specified (
None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 ofActionupdate(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 itlist(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 auditlimitโ maximum number of results to return per request, if:limit > 0, the maximum number of action plans to return.limit == 0, return the entire list of action plans.- limit param is NOT specified (
None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 ofActionPlanstart(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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 onedelete(audit)โ yeet it ๐get(audit)โ grab itlist(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 templatelimitโ the maximum number of results to return per request, if:limit > 0, the maximum number of audits to return.
...and the rest of that limit bullet goes like:
limit == 0โ you get the entire list of audits, no cap, the whole buffet ๐limitparam is NOT specified (None) โ the number of items returned respects the maximum imposed by the Watcher API (peep Watcher'sapi.max_limitoption, 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 auditsmarkerโ 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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 idget(audit_template_id)โ the get hook, takes the audit template idlist(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 templatelimitโ The maximum number of results to return per request, if:limit > 0โ the maximum number of audit templates to return.limit == 0โ return the entire list ofaudit_templates.limitparam is NOT specified (None) โ the number of items returned respects the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 aboutaudit_templates.markerโ Optional, UUID of the last audit template of the previous page.
Returns โ A list of audit templates. ๐
resource_classโ alias ofAuditTemplateโญ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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 anargparse.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 iscompute.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 ofDataModelโญ
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 anargparse.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:limit > 0, the maximum number of audits to return.limit == 0, return the entire list of audits.limitparam is NOT specified (None), the number of items returned respects the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
๐ซ 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 ofGoal.
๐ฆ 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 anargparse.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 anargparse.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:limit > 0, the maximum number of scoring engines to return.limit == 0, return the entire list of scoring engines.limitparam is NOT specified (None), the number of items returned respects the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 ofScoringEngine.
๐ 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 anargparse.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 anargparse.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:limit > 0, the maximum number of services to return.limit == 0, return the entire list of services.limitparam is NOT specified (None), the number of items returned respects the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 ofService.
๐ฆ 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 anargparse.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 anargparse.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:limit > 0, the maximum number of audits to return.limit == 0, return the entire list of audits.limitparam is NOT specified (None), the number of items returned respects the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
๐ซ 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 ofStrategy.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 anargparse.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 anargparse.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 anargparse.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:limit > 0, the maximum number of actions to return.limit == 0, return the entire list of actions.limitparam is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 ofAction(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:limit > 0, the maximum number of action plans to return.limit == 0, return the entire list of action plans.limitparam is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 ofActionPlan(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:limit > 0, the maximum number of audits to return.limit == 0, return the entire list of audits.limitparam is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 ofAudit(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:limit > 0, the maximum number of audit templates to return.limit == 0, return the entire list ofaudit_templates.limitparam is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 aboutaudit_templates.markerโ Optional, UUID of the last audit template of the previous page.
Returns: A list of audit templates.
resource_classโ alias ofAuditTemplate(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 iscompute.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 ofDataModel(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:limit > 0, the maximum number of audits to return.limit == 0, return the entire list of audits.limitparam is NOT specified (None), the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 ofGoal(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:
limit > 0โ the max number of scoring engines to come back at you ๐limit == 0โ give me the WHOLE list of scoring engines, no cap ๐ซถlimitparam is NOT specified (None) โ the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption) ๐
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:limit > 0โ the maximum number of services to return.limit == 0โ return the entire list of services.limitparam is NOT specified (None) โ the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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:limit > 0โ the maximum number of audits to return.limit == 0โ return the entire list of audits.limitparam is NOT specified (None) โ the number of items returned respect the maximum imposed by the Watcher API (see Watcher'sapi.max_limitoption).
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 ofos_project_id) โ ๏ธos_tenant_nameโ name of a tenant (deprecated in favour ofos_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 ofos_cacertโ ๏ธos_certโ path to cert file ๐cert_fileโ path to cert file, deprecated in favour ofos_certโ ๏ธos_keyโ path to key file ๐๏ธkey_fileโ path to key file, deprecated in favour ofos_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 = 500message = '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 = 401message = '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 yourargs)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(listofstr) โ your input arguments and options ๐
- Parameters
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:
os_auth_token: authentication token (from Identity Service)watcher_url: watcher API endpoint, eghttp://watcher.example.org:9322/v1
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 useros_password: user's passwordos_auth_url: Identity Service endpoint for authorizationos_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 ๐
๐ Copyright ๐
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
- nixpkgs unstable: python3.13-python-watcherclient 4.11.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms