Skip to content

Commit 34aa79b

Browse files
committed
update CLI docs
1 parent 98ed21b commit 34aa79b

31 files changed

Lines changed: 1036 additions & 308 deletions

CONTRIBUTING.md

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
# Contributing
2-
A brief contributing guide for the Incydr python SDK.
3-
4-
Examples of all the steps documented here can be found in the existing clients.
5-
6-
## Adding a client
7-
8-
9-
- Create a `_client_name/` folder within the `incydr` package.
10-
- Create a `client.py` and `models.py` module within this folder.
11-
- Create pydantic models from the OpenAPI specs for the desired client.
12-
- The [datamodel-code-generator project](https://pydantic-docs.helpmanual.io/datamodel_code_generator/) can be used to generate these models.
13-
- Organize the appropriate models into your `/_client_name/models.py` module, adjusting descriptions and type checking as necessary.
14-
- Any enums that will be needed by end-users should go into the `incydr/enums/models.py` module.
15-
- Create a class for your client (`class ClientName`) with a version property (ex: `v1`)
16-
- Create a versioned class for your client (`class ClientNameV1`) accessible through the previously defined version property.
17-
- Create methods for wrapping the desired API calls within the versioned client class.
18-
- Tests for the client should be added into the tests package within `/tests/test_client_name.py`.
19-
- Run tests with `hatch run test:cov`
20-
- Run the style linter with `hatch run style:check`
21-
- Serve docs locally with `hatch run docs:serve`
22-
23-
## Documenting a client
24-
25-
- Add the appropriate docstrings to the models and methods for your client.
26-
- Import response models and add them to the `__all__` definition in the `/incydr/models.py` module.
27-
- Adds those models to the `/docs/models.md` file with the appropriate header(s).
28-
- Add a `client_name.md` to the `docs/` directory and add the following to generate documentation from the method docstrings (replace the ClientName with your client's class name):
29-
30-
```markdown
31-
::: incydr._devices.client.ClientNameV1
32-
:docstring:
33-
:members:
2+
3+
## Install hatch
4+
5+
```bash
6+
pip install hatch
7+
```
8+
9+
#### Run style checks
10+
11+
```bash
12+
hatch run style:check
13+
```
14+
15+
```bash
16+
hatch run style:check-no-diff
3417
```
3518

36-
- Add your `client_name.md` file to the `nav` section of the `mkdocs.yml` config file.
19+
#### Run tests with coverage
20+
21+
```bash
22+
hatch run test:cov
23+
```
24+
25+
```bash
26+
hatch run test:no-cov
27+
```
28+
29+
#### Serve docs locally
30+
31+
```bash
32+
hatch run docs:serve
33+
```

README.md

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# incydr
1+
# Incydr
22

33
[![PyPI - Version](https://img.shields.io/pypi/v/incydr.svg)](https://pypi.org/project/incydr)
44
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/incydr.svg)](https://pypi.org/project/incydr)
@@ -21,44 +21,24 @@ Documentation during the beta can be found at https://code42.github.io/incydr_py
2121

2222
## Installation
2323

24-
```console
25-
pip install incydr
26-
```
27-
28-
# Contributing
29-
30-
## Install hatch
31-
32-
```console
33-
pip install hatch
34-
```
35-
36-
#### Run style checks
24+
Install the Incydr SDK with the following command:
3725

3826
```console
39-
hatch run style:check
27+
pip install incydr
4028
```
4129

42-
#### Run tests with coverage
30+
Use either of the following to install Incydr CLI extension alongside the SDK:
4331

44-
```console
45-
hatch run test:cov
32+
```bash
33+
$ pip install 'incydr[cli]'
4634
```
4735

48-
#### Serve docs locally
49-
50-
```console
51-
hatch run docs:serve
36+
```bash
37+
$ pip install 'incydr[all]'.
5238
```
5339

40+
For more details see the [SDK Documentation](docs/sdk/index.md) and the [CLI Documentation](docs/cli/getting_started.md).
41+
.
5442
## License
5543

5644
`incydr` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
57-
58-
-----
59-
## Getting Started
60-
61-
```python
62-
from incydr import Client
63-
client = Client(url="api-gateway-url.code42.com", api_client_id="key-42", api_client_secret="c42")
64-
```

docs/cli/alert_rules.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,5 @@
22

33
::: mkdocs-click
44
:module: incydr.cli.cmds.alert_rules
5-
:command: list_
6-
7-
::: mkdocs-click
8-
:module: incydr.cli.cmds.alert_rules
9-
:command: show
10-
11-
::: mkdocs-click
12-
:module: incydr.cli.cmds.alert_rules
13-
:command: enable
14-
15-
::: mkdocs-click
16-
:module: incydr.cli.cmds.alert_rules
17-
:command: disable
18-
19-
::: mkdocs-click
20-
:module: incydr.cli.cmds.alert_rules
21-
:command: remove_all_users
22-
23-
24-
::: mkdocs-click
25-
:module: incydr.cli.cmds.alert_rules
26-
:command: list_users
5+
:command: alert_rules
6+
:list_subcommands:

docs/cli/alerts.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,5 @@
22

33
::: mkdocs-click
44
:module: incydr.cli.cmds.alerts
5-
:command: search
6-
7-
::: mkdocs-click
8-
:module: incydr.cli.cmds.alerts
9-
:command: show
10-
11-
::: mkdocs-click
12-
:module: incydr.cli.cmds.alerts
13-
:command: add_note
14-
15-
::: mkdocs-click
16-
:module: incydr.cli.cmds.alerts
17-
:command: update_state
18-
19-
::: mkdocs-click
20-
:module: incydr.cli.cmds.alerts
21-
:command: bulk_update_state
5+
:command: alerts
6+
:list_subcommands:

docs/cli/audit_log.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22

33
::: mkdocs-click
44
:module: incydr.cli.cmds.audit_log
5-
:command: search
6-
7-
::: mkdocs-click
8-
:module: incydr.cli.cmds.audit_log
9-
:command: download
5+
:command: audit_log
6+
:list_subcommands:

docs/cli/bulk.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Bulk Commands
2+
3+
---
4+
5+
Bulk functionality is available for many CLI commands. Bulk commands will all contain the `bulk-` prefix in the subcommand.
6+
7+
All bulk methods take a single argument FILE as input in either CSV or [JSON Lines](https://jsonlines.org) format.
8+
9+
File format defaults to CSV. To specify a [JSON Lines](https://jsonlines.org) file, pass the `--format json-lines` option with a bulk command.
10+
Use `--help` with a bulk command to view the necessary columns/keys for the input file.
11+
12+
CSV files accept common aliases for fields and will perform additional lookups for usernames to simplify passing data between commands. For example, a command that
13+
requires a `user` column will also accept a column labeled as `userId`, `user_id`, or `username`.
14+
15+
The following example command will update multiple cases:
16+
17+
```bash
18+
incydr cases bulk-update bulk_update_cases.csv
19+
```
20+
21+
Add the `--format` option to pass a [JSON Lines](https://jsonlines.org) formatted file
22+
23+
```bash
24+
incydr cases bulk-update bulk_update_cases.jsonl --format json-lines
25+
```
26+
27+
If there are parsing errors, error messages will be output to the console and more details will be available in the logs
28+
once the command has completed and the entire file has attempted to be parsed.
29+
30+
For more information on logging, see [Logging](logging.md).

docs/cli/cases.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,5 @@
22

33
::: mkdocs-click
44
:module: incydr.cli.cmds.cases
5-
:command: show
6-
7-
::: mkdocs-click
8-
:module: incydr.cli.cmds.cases
9-
:command: list_
10-
11-
::: mkdocs-click
12-
:module: incydr.cli.cmds.cases
13-
:command: create
14-
15-
::: mkdocs-click
16-
:module: incydr.cli.cmds.cases
17-
:command: delete
18-
19-
::: mkdocs-click
20-
:module: incydr.cli.cmds.cases
21-
:command: update
22-
23-
::: mkdocs-click
24-
:module: incydr.cli.cmds.cases
25-
:command: bulk_update
26-
27-
::: mkdocs-click
28-
:module: incydr.cli.cmds.cases
29-
:command: download
30-
31-
::: mkdocs-click
32-
:module: incydr.cli.cmds.cases
33-
:command: file_events
5+
:command: cases
346
:list_subcommands:

docs/cli/departments.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
::: mkdocs-click
44
:module: incydr.cli.cmds.departments
5-
:command: list_
5+
:command: departments
6+
:list_subcommands:

docs/cli/devices.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22

33
::: mkdocs-click
44
:module: incydr.cli.cmds.devices
5-
:command: list_
6-
7-
::: mkdocs-click
8-
:module: incydr.cli.cmds.devices
9-
:command: show
5+
:command: devices
6+
:list_subcommands:

docs/cli/directory_groups.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
::: mkdocs-click
44
:module: incydr.cli.cmds.directory_groups
5-
:command: list_
5+
:command: directory_groups
6+
:list_subcommands:

0 commit comments

Comments
 (0)