CLI reference

Note

Maintainers: Charles Graham, Eric Novotny

See also

cwms-cli

Usage

cwms-cli [OPTIONS] COMMAND [ARGS]...

Options

-V, --version

Show the cwms-cli version and exit.

--log-file <log_file>

Write logs to a file. If set, disables color completely.

--no-color

Disable colored output in the terminal.

--log-level <log_level>
Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

-q, --quiet

Suppress routine output; warnings and errors still print.

blob

Manage CWMS Blobs (upload, download, delete, update, list)

Usage

cwms-cli blob [OPTIONS] COMMAND [ARGS]...

Example Usage:

  • Store a PDF/image as a CWMS blob with optional description

  • Download a blob by id to your local filesystem

  • Update a blob’s name/description/mime-type

  • Bulk list blobs for an office

delete

Delete a blob by ID

Usage

cwms-cli blob delete [OPTIONS]

Options

--blob-id <blob_id>

Required Blob ID to delete.

--dry-run

Show request; do not send.

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

download

Download a blob by ID

Usage

cwms-cli blob download [OPTIONS]

Options

--blob-id <blob_id>

Required Blob ID to download.

--dest <dest>

Destination file path. Defaults to blob-id.

--anonymous

Do not send credentials for this read request, even if they are configured.

--dry-run

Show request; do not send.

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

list

List blobs with optional filters and sorting

Usage

cwms-cli blob list [OPTIONS]

Options

--blob-id-like <blob_id_like>

LIKE filter for blob ID (e.g., *PNG).

--columns <columns>

Columns to show (repeat or comma-separate).

--sort-by <sort_by>

Columns to sort by (repeat or comma-separate).

--desc, --asc

Sort descending instead of ascending.

Default:

False

--limit <limit>

Max rows to show.

--page-size <page_size>

Max rows to request from the blob endpoint. Defaults to –limit if set, otherwise no pagination (all results in one page).

--to-csv <to_csv>

If set, write results to this CSV file.

--anonymous

Do not send credentials for this read request, even if they are configured.

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

update

Update/patch a blob by ID

Usage

cwms-cli blob update [OPTIONS]

Options

--blob-id <blob_id>

Required Blob ID to update.

--dry-run

Show request; do not send.

--description <description>

New description JSON or text.

--media-type <media_type>

New media type (guessed from file if omitted).

--input-file <input_file>

Optional file content to upload with update.

--overwrite, --no-overwrite

If true, replace existing blob.

Default:

False

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

upload

Upload a single file or a directory of files as CWMS blob(s).

Usage

cwms-cli blob upload [OPTIONS]

Options

--input-file <input_file>

Path to a single file to upload.

--input-dir <input_dir>

Directory containing multiple files to upload.

--file-regex <file_regex>

Regex used to match files in –input-dir (matched against relative path).

Default:

'.*'

--recursive, --no-recursive

Recurse into subdirectories when using –input-dir.

Default:

False

--blob-id <blob_id>

Blob ID to create for single-file upload.

--blob-id-prefix <blob_id_prefix>

Prefix added to generated blob IDs for directory uploads.

Default:

''

--description <description>

Optional description JSON or text.

--media-type <media_type>

Override media type (guessed from file if omitted).

--overwrite, --no-overwrite

If true, replace existing blob.

Default:

False

--dry-run

Show request; do not send.

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

clob

Manage CWMS Clobs (upload, download, delete, update, list)

Usage

cwms-cli clob [OPTIONS] COMMAND [ARGS]...

Example Usage:

  • Download a clob by id to your local filesystem

  • Update a clob’s name/description/mime-type

  • Bulk list clobs for an office

delete

Delete a clob by ID

Usage

cwms-cli clob delete [OPTIONS]

Options

--clob-id <clob_id>

Required Clob ID to delete.

--dry-run

Show request; do not send.

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

download

Download a clob by ID

Usage

cwms-cli clob download [OPTIONS]

Options

--clob-id <clob_id>

Required Clob ID to download.

--dest <dest>

Destination file path. Defaults to clob-id.

--anonymous

Do not send credentials for this read request, even if they are configured.

--dry-run

Show request; do not send.

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

list

List clobs with optional filters and sorting

Usage

cwms-cli clob list [OPTIONS]

Options

--clob-id-like <clob_id_like>

LIKE filter for clob ID (e.g., *PNG).

--columns <columns>

Columns to show (repeat or comma-separate).

--sort-by <sort_by>

Columns to sort by (repeat or comma-separate).

--desc, --asc

Sort descending instead of ascending.

Default:

False

--limit <limit>

Max rows to show.

--page-size <page_size>

Max rows to request from the clob endpoint. Defaults to –limit when set.

--to-csv <to_csv>

If set, write results to this CSV file.

--anonymous

Do not send credentials for this read request, even if they are configured.

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

update

Update/patch a clob by ID

Usage

cwms-cli clob update [OPTIONS]

Options

--clob-id <clob_id>

Required Clob ID to update.

--dry-run

Show request; do not send.

--description <description>

New description JSON or text.

--input-file <input_file>

Optional file content to upload with update.

--ignore-nulls, --no-ignore-nulls

If true, null and empty fields in the provided clob will be ignored and the existing value of those fields left in place.

Default:

True

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

upload

Upload a file as a clob

Usage

cwms-cli clob upload [OPTIONS]

Options

--input-file <input_file>

Required Path to the file to upload.

--clob-id <clob_id>

Required Clob ID to create.

--description <description>

Optional description JSON or text.

--overwrite, --no-overwrite

If true, replace existing clob.

Default:

False

--dry-run

Show request; do not send.

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

csv2cwms

Store CSV TimeSeries data to CWMS using a config file

Usage

cwms-cli csv2cwms [OPTIONS]

Options

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

--input-keys <input_keys>

Input keys. Defaults to all keys/files with –input-keys=all. These are the keys under “input_files” in a given config file. This option lets you run a single file from a config that contains multiple files. Example: –input-keys=file1

Default:

'all'

-lb, --lookback <lookback>

Lookback period in HOURS

Default:

120

-v, --verbose

Verbose logging

-c, --config <config_path>

Required Path to JSON config file

--log <log>

Path to the log file.

Default:

Sentinel.UNSET

--dry-run

Log only (no HTTP calls)

--begin <begin>

YYYY-MM-DDTHH:MM (local to –tz)

-tz, --timezone <tz>
Default:

'GMT'

--ignore-ssl-errors

Ignore TLS errors (testing only)

--version

Show the version and exit.

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

load

Load data from one CWMS Data API instance to another.

Usage

cwms-cli load [OPTIONS] COMMAND [ARGS]...
location

Copy location data from a source CDA to a target CDA.

Usage

cwms-cli load location [OPTIONS] COMMAND [ARGS]...
ids-all

Copy locations from a source CDA catalog to a target CDA, or to/from a CSV file via –source-csv / –target-csv. The –like and –location-kind-like filters use CDA regex semantics. Regex guide: https://cwms-cli.readthedocs.io/en/latest/cli/cda_regex.html

Usage

cwms-cli load location ids-all [OPTIONS]

Options

-v, --verbose

Increase verbosity (repeat for more detail).

--dry-run, --no-dry-run

Show what would be written without storing to target.

Default:

False

--target-api-key <target_api_key>

Target API key used when no saved cwms-cli login token is available.

--target-cda <target_cda>

Target CWMS Data API root. Default: http://localhost:8081/cwms-data/

--source-office <source_office>

Source office ID (e.g. SWT, SWL). Required when reading from a CDA.

--source-cda <source_cda>

Source CWMS Data API root. Default: https://cwms-data.usace.army.mil/cwms-data/

--source-csv <source_csv>

Read locations from this CSV file instead of fetching from a source CDA. Mutually exclusive with –source-cda.

--target-csv <target_csv>

Write fetched locations to this CSV file instead of POSTing to a target CDA. Mutually exclusive with –target-cda.

--like <like>

Regular expression passed directly to the source CDA catalog. Examples: ‘^Black Butte$’ for an exact match, ‘^Black Butte.*’ for a prefix match.

--location-kind-like <location_kind_like>

Filter by LOCATION_KIND using CDA regex semantics; may be passed multiple times.

Default is to pull all Location kinds.

Common kinds: SITE, EMBANKMENT, OVERFLOW, TURBINE, STREAM, PROJECT, STREAMGAGE, BASIN, OUTLET, LOCK, GATE.

Examples:

–location-kind-like PROJECT –location-kind-like STREAM –location-kind-like ‘(SITE|STREAM)’

Environment variables

CDA_API_KEY

Provide a default for --target-api-key

CDA_TARGET_URL

Provide a default for --target-cda

CDA_SOURCE_OFFICE

Provide a default for --source-office

CDA_SOURCE_URL

Provide a default for --source-cda

ids-bygroup

Copy locations from a CWMS Location Group (source CDA) to a target CDA, or export the resolved members to a CSV file via –target-csv.

Usage

cwms-cli load location ids-bygroup [OPTIONS]

Options

-v, --verbose

Increase verbosity (repeat for more detail).

--dry-run, --no-dry-run

Show what would be written without storing to target.

Default:

False

--target-api-key <target_api_key>

Target API key used when no saved cwms-cli login token is available.

--target-cda <target_cda>

Target CWMS Data API root. Default: http://localhost:8081/cwms-data/

--source-office <source_office>

Source office ID (e.g. SWT, SWL). Required when reading from a CDA.

--source-cda <source_cda>

Source CWMS Data API root. Default: https://cwms-data.usace.army.mil/cwms-data/

--target-csv <target_csv>

Write fetched locations to this CSV file instead of POSTing to a target CDA. Mutually exclusive with –target-cda.

--group-id <group_id>

Required Location Group ID (e.g., ‘Ark Basin’).

--category-id <category_id>

Required Location Category ID (e.g., ‘Basin’).

--group-office-id <group_office_id>

Owning office of the Location Group (defaults to –source-office).

--category-office-id <category_office_id>

Owning office of the Category (defaults to –source-office).

--filter-office, --no-filter-office

If set, only copy members whose ‘office-id’ equals –source-office.

Default:

True

Environment variables

CDA_API_KEY

Provide a default for --target-api-key

CDA_TARGET_URL

Provide a default for --target-cda

CDA_SOURCE_OFFICE

Provide a default for --source-office

CDA_SOURCE_URL

Provide a default for --source-cda

timeseries

Copy timeseries IDs from a source CDA to a target CDA.

Usage

cwms-cli load timeseries [OPTIONS] COMMAND [ARGS]...
data

Copy timeseries data (by timeseries ID or timeseries group) into a target CDA from a source CDA.

Usage

cwms-cli load timeseries data [OPTIONS]

Options

-v, --verbose

Increase verbosity (repeat for more detail).

--dry-run, --no-dry-run

Show what would be written without storing to target.

Default:

False

--target-api-key <target_api_key>

Target API key used when no saved cwms-cli login token is available.

--target-cda <target_cda>

Target CWMS Data API root. Default: http://localhost:8081/cwms-data/

--source-office <source_office>

Source office ID (e.g. SWT, SWL). Required when reading from a CDA.

--source-cda <source_cda>

Source CWMS Data API root. Default: https://cwms-data.usace.army.mil/cwms-data/

--ts-id <ts_id>

Timeseries ID to copy, or a comma-delimited list of IDs.

--ts-group <ts_group>

ID of the timeseries group to copy (e.g. ‘GroupID.*’).

--ts-group-category-id <ts_group_category_id>

Optional category filter when matching timeseries groups.

--ts-group-category-office-id <ts_group_category_office_id>

Optional category office filter when matching timeseries groups.

--begin <begin>

Start date for timeseries data (e.g. ‘2022-01-01T00:00:00-06:00’).

--end <end>

End date for timeseries data (e.g. ‘2022-01-31T00:00:00-0600’).

Environment variables

CDA_API_KEY

Provide a default for --target-api-key

CDA_TARGET_URL

Provide a default for --target-cda

CDA_SOURCE_OFFICE

Provide a default for --source-office

CDA_SOURCE_URL

Provide a default for --source-cda

ids-all

Copy ALL timeseries IDs for locations in a target CDA from a source CDA. Regex guide for –timeseries-id-regex: https://cwms-cli.readthedocs.io/en/latest/cli/cda_regex.html

Usage

cwms-cli load timeseries ids-all [OPTIONS]

Options

-v, --verbose

Increase verbosity (repeat for more detail).

--dry-run, --no-dry-run

Show what would be written without storing to target.

Default:

False

--target-api-key <target_api_key>

Target API key used when no saved cwms-cli login token is available.

--target-cda <target_cda>

Target CWMS Data API root. Default: http://localhost:8081/cwms-data/

--source-office <source_office>

Source office ID (e.g. SWT, SWL). Required when reading from a CDA.

--source-cda <source_cda>

Source CWMS Data API root. Default: https://cwms-data.usace.army.mil/cwms-data/

--timeseries-id-regex <timeseries_id_regex>

Regex filter for timeseries ID (e.g. ‘^LocID.*’).

Environment variables

CDA_API_KEY

Provide a default for --target-api-key

CDA_TARGET_URL

Provide a default for --target-cda

CDA_SOURCE_OFFICE

Provide a default for --source-office

CDA_SOURCE_URL

Provide a default for --source-cda

login

Authenticate with CWBI OIDC using PKCE and save tokens for reuse.

Usage

cwms-cli login [OPTIONS]

Options

--provider <provider>

Identity provider hint to send to Keycloak.

Default:

'federation-eams'

Options:

federation-eams | login.gov

--client-id <client_id>

OIDC client ID.

Default:

'cwms'

-a, --api-root <api_root>

CDA API root used to discover the OpenID Connect configuration.

Default:

'https://cwms-data.usace.army.mil/cwms-data'

--scope <scope>

OIDC scopes to request.

Default:

'openid profile'

--redirect-host <redirect_host>

Local host for the login callback listener.

Default:

'localhost'

--redirect-port <redirect_port>

Local port for the login callback listener.

Default:

5555

--token-file <token_file>

Path to save the login session JSON. Defaults to a provider-specific file under ~/.config/cwms-cli/auth/.

--refresh

Refresh an existing saved session instead of opening a new browser login.

--no-browser

Print the authorization URL instead of trying to open a browser automatically.

--timeout <timeout>

Seconds to wait for the local login callback.

Default:

30

--ca-bundle <ca_bundle>

CA bundle to use for TLS verification.

Environment variables

CDA_API_ROOT

Provide a default for -a

shef

Manage SHEF file imports (crit files, .in configuration files)

Usage

cwms-cli shef [OPTIONS] COMMAND [ARGS]...
import_crit

Import SHEF crit file into timeseries group for SHEF file processing

Usage

cwms-cli shef import_crit [OPTIONS]

Options

-f, --filename <filename>

Required filename of SHEF crit file to be processed

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

--dry-run

Show request; do not send.

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

import_infile

Import SHEF .in file into timeseries group for SHEF file processing

Usage

cwms-cli shef import_infile [OPTIONS]

Options

-f, --filename <filename>

Required filename of SHEF .in file to be processed

-g, --group-name <group_name>

Required CWMS timeseries group name

--category <category>

Timeseries category ID

Default:

'SHEF Export'

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

--dry-run

Parse the .in file and print the JSON payload without posting to the API.

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

update

Update cwms-cli with pip, optionally targeting a specific version.

Usage

cwms-cli update [OPTIONS]

Options

--target-version <VERSION>

Install a specific cwms-cli version instead of the latest release.

--pre

Include pre-release versions during update.

-y, --yes

Skip confirmation prompt and run update immediately.

users

Manage CWMS users and user-management roles

Usage

cwms-cli users [OPTIONS] COMMAND [ARGS]...
roles

Manage CWMS users and user-management roles

Usage

cwms-cli users roles [OPTIONS] COMMAND [ARGS]...
add

Add one or more roles to an existing user

Usage

cwms-cli users roles add [OPTIONS]

Options

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

-u, --user-name <user_name>

Required Existing user name.

--roles <roles>

enter admin, readonly, readwrite, or individual role name(s) to add. Repeat the option or pass a comma/pipe-separated list.

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

delete

Remove one or more roles from an existing user

Usage

cwms-cli users roles delete [OPTIONS]

Options

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-o, --office <office>

Required Office to grab data for

--log-level <log_level>

Set logging verbosity (overrides default INFO).

Options:

DEBUG | INFO | WARNING | ERROR | CRITICAL

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

-u, --user-name <user_name>

Required Existing user name.

--roles <roles>

enter ‘all’ to delete all roles, or admin, readonly, readwrite, or individual role name(s) to delete. Repeat the option or pass a comma/pipe-separated list.

Environment variables

CDA_API_KEY

Provide a default for -k

CDA_API_ROOT

Provide a default for -a

OFFICE

Provide a default for -o

LOG_LEVEL

Provide a default for --log-level

list-all

List assignable CWMS user-management roles

Usage

cwms-cli users roles list-all [OPTIONS]

Options

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

Environment variables

CDA_API_ROOT

Provide a default for -a

CDA_API_KEY

Provide a default for -k

list-user

List roles for a specific user and office

Usage

cwms-cli users roles list-user [OPTIONS]

Options

-u, --user-name <user_name>

Required Existing user name.

-o, --office <office>

Office to grab data for

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

Environment variables

OFFICE

Provide a default for -o

CDA_API_ROOT

Provide a default for -a

CDA_API_KEY

Provide a default for -k

user-ids

List all available user IDs for an office or lookup using like filter

Usage

cwms-cli users user-ids [OPTIONS]

Options

-o, --office <office>

Office to grab data for

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

-ul, --username-like <username_like>

Enter any part of a user name to filter user id listing. Case-insensitive.

Environment variables

OFFICE

Provide a default for -o

CDA_API_ROOT

Provide a default for -a

CDA_API_KEY

Provide a default for -k

usgs

USGS utilities

Usage

cwms-cli usgs [OPTIONS] COMMAND [ARGS]...
measurements

Store USGS measurements into CWMS database

Usage

cwms-cli usgs measurements [OPTIONS]

Options

-d, --days-back-modified <days_back_modified>

Days back from current time measurements have been modified in USGS database. Can be integer value

-c, --days-back-collected <days_back_collected>

Days back from current time measurements have been collected. Can be integer value

-o, --office <office>

Required Office to grab data for

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

-b, --backfill <backfill>

Backfill POR data, use list of USGS IDs (e.g. 05057200, 05051300) or the word ‘group’ to attempt to backfill all sites in the OFFICE id’s Data Acquisition->USGS Measurements group

Environment variables

OFFICE

Provide a default for -o

CDA_API_ROOT

Provide a default for -a

CDA_API_KEY

Provide a default for -k

ratings

Get USGS ratings and store into CWMS database

Usage

cwms-cli usgs ratings [OPTIONS]

Options

-o, --office <office>

Required Office to grab data for

-d, --days-back <days_back>

Days back from current time to get data. Can be decimal and integer values

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

-rs, --rating-subset <rating_subset>

subset of rating spec ids to grab latest rating for (e.g. “rating_spec_id1, rating_spec_id2”).

Environment variables

OFFICE

Provide a default for -o

CDA_API_ROOT

Provide a default for -a

CDA_API_KEY

Provide a default for -k

ratings-ini-file-import

Store rating ini file information into database to be used with getusgs_ratings

Usage

cwms-cli usgs ratings-ini-file-import [OPTIONS]

Options

-f, --filename <filename>

Required filename of ratings ini file to be processed

--dry-run

Preview changes without updating the database

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

Environment variables

CDA_API_ROOT

Provide a default for -a

CDA_API_KEY

Provide a default for -k

timeseries

Get USGS timeseries values and store into CWMS database

Usage

cwms-cli usgs timeseries [OPTIONS]

Options

-o, --office <office>

Required Office to grab data for

-d, --days-back <days_back>

Days back from current time to get data. Can be decimal and integer values

-a, --api-root <api_root>

Required Api Root for CDA. Can be user defined or placed in a env variable CDA_API_ROOT

-k, --api-key <api_key>

API key for CDA. Optional when a saved cwms-cli login token is available. Can also be provided by CDA_API_KEY.

-kl, --api-key-loc <api_key_loc>

File storing an API key. Optional when a saved cwms-cli login token is available.

-b, --backfill <backfill>

Backfill timeseries ids, use list of timeseries ids (e.g. “ts_id1, ts_id2”) to attempt to backfill a subset of timeseries with USGS data

Environment variables

OFFICE

Provide a default for -o

CDA_API_ROOT

Provide a default for -a

CDA_API_KEY

Provide a default for -k