cortexapps-cli 1.19.2__py3-none-any.whl → 1.20.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cortexapps_cli/cli.py CHANGED
@@ -40,6 +40,7 @@ import cortexapps_cli.commands.scim as scim
40
40
  import cortexapps_cli.commands.scorecards as scorecards
41
41
  import cortexapps_cli.commands.secrets as secrets
42
42
  import cortexapps_cli.commands.teams as teams
43
+ import cortexapps_cli.commands.users as users
43
44
  import cortexapps_cli.commands.workflows as workflows
44
45
 
45
46
  app = typer.Typer(
@@ -77,6 +78,7 @@ app.add_typer(scim.app, name="scim")
77
78
  app.add_typer(scorecards.app, name="scorecards")
78
79
  app.add_typer(secrets.app, name="secrets")
79
80
  app.add_typer(teams.app, name="teams")
81
+ app.add_typer(users.app, name="users")
80
82
  app.add_typer(workflows.app, name="workflows")
81
83
 
82
84
  # global options
@@ -0,0 +1,5 @@
1
+ import typer
2
+ import cortexapps_cli.commands.users_commands.roles as roles
3
+
4
+ app = typer.Typer(help="Users commands", no_args_is_help=True)
5
+ app.add_typer(roles.app, name="roles")
@@ -0,0 +1,49 @@
1
+ from typing import List, Optional
2
+ import typer
3
+ from cortexapps_cli.command_options import ListCommandOptions
4
+ from cortexapps_cli.utils import print_output_with_context
5
+
6
+ app = typer.Typer(help="Roles commands", no_args_is_help=True)
7
+
8
+ @app.command()
9
+ def list(
10
+ ctx: typer.Context,
11
+ email: Optional[List[str]] = typer.Option(None, "--email", "-e", help="Filter by email address; can be specified multiple times", show_default=False),
12
+ page: ListCommandOptions.page = None,
13
+ page_size: ListCommandOptions.page_size = 250,
14
+ table_output: ListCommandOptions.table_output = False,
15
+ csv_output: ListCommandOptions.csv_output = False,
16
+ columns: ListCommandOptions.columns = [],
17
+ no_headers: ListCommandOptions.no_headers = False,
18
+ filters: ListCommandOptions.filters = [],
19
+ sort: ListCommandOptions.sort = [],
20
+ ):
21
+ """
22
+ List user role assignments. The API key used to make the request must have the View Roles permission.
23
+ """
24
+
25
+ client = ctx.obj["client"]
26
+
27
+ params = {
28
+ "page": page,
29
+ "pageSize": page_size,
30
+ }
31
+
32
+ if email:
33
+ params["email"] = ",".join(email)
34
+
35
+ if (table_output or csv_output) and not ctx.params.get('columns'):
36
+ ctx.params['columns'] = [
37
+ "Email=email",
38
+ "Name=name",
39
+ "Roles=roles",
40
+ ]
41
+
42
+ # remove any params that are None
43
+ params = {k: v for k, v in params.items() if v is not None}
44
+
45
+ if page is None:
46
+ r = client.fetch("api/v1/users/roles", params=params)
47
+ else:
48
+ r = client.get("api/v1/users/roles", params=params)
49
+ print_output_with_context(ctx, r)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cortexapps-cli
3
- Version: 1.19.2
3
+ Version: 1.20.0
4
4
  Summary: Command Line Interface for cortexapps
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -1,5 +1,5 @@
1
1
  cortexapps_cli/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
- cortexapps_cli/cli.py,sha256=kTSlhJeUHWTHbFCjgKeBXXpX27MgclPRjCPkqSuDb78,6440
2
+ cortexapps_cli/cli.py,sha256=Nie5dDinaecM_duyTQFHC4JbYJ2LMJ3Q1JqLBtMH94Y,6525
3
3
  cortexapps_cli/command_options.py,sha256=9xVu61fVKOQFs3wTw0RV-uJbT1Z4-Z3D7YngpS0mEhY,1714
4
4
  cortexapps_cli/commands/api_keys.py,sha256=f5LfrfuYJowH3BsHXR28hSmysSRoEcPU9PWAlDMfryI,5245
5
5
  cortexapps_cli/commands/audit_logs.py,sha256=u0fa5I4GFZrcn8kUa0zwZPMkrmrUsgzh6NGVr8i7MEU,4194
@@ -83,12 +83,14 @@ cortexapps_cli/commands/scorecards.py,sha256=v1uDDgqNPo8mdJ_16jcTuDiVQ4DCq7mw_5H
83
83
  cortexapps_cli/commands/scorecards_commands/exemptions.py,sha256=BsS2ucv4PLUwfIF4YjonEcL-rGaUaO4BnKTFwTt1ObI,3609
84
84
  cortexapps_cli/commands/secrets.py,sha256=N2bXcTcBzLtle4ou-h48n21i9Qv9U5FQ_yWZOm2TSPE,3178
85
85
  cortexapps_cli/commands/teams.py,sha256=ia-RzXbf5_v1FtBaRW-8f8pGtgo5n2KVUW7LtvflxjY,7264
86
+ cortexapps_cli/commands/users.py,sha256=IPi71sbgRQRSPEI3xEJOgsPLr_zKEQTfzc2x5PYm6GE,177
87
+ cortexapps_cli/commands/users_commands/roles.py,sha256=aVwPMwpGUjsIetkm8aBLzyd96YkS8IO-oVXls0W9dLk,1610
86
88
  cortexapps_cli/commands/workflows.py,sha256=SWjIVuqvz1ZFpxOSUU3ZTQYS8dS8O-zQyNt5X4WDtB4,7381
87
89
  cortexapps_cli/cortex_client.py,sha256=sHBKMlKw5nRf7MRvJfnHJDQprWsQIgFKHv7m938velw,12769
88
90
  cortexapps_cli/models/team.py,sha256=DZ_MmXLLhi4AoT3sng-JEUOWSafFQH_FqY0xODusdtg,6460
89
91
  cortexapps_cli/utils.py,sha256=zJilDiFhL-cYdp5LA251rED7vdc0EIEivCZpCqQRvmI,6992
90
- cortexapps_cli-1.19.2.dist-info/METADATA,sha256=Wq0JUQDSpCb7B0pHWuWz6_QJCv841LEkihyAlVicFRo,17800
91
- cortexapps_cli-1.19.2.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
92
- cortexapps_cli-1.19.2.dist-info/entry_points.txt,sha256=YffF7CawiDnK0vE7Fg9mAItnXoSjLvVkW3IdHhumz84,49
93
- cortexapps_cli-1.19.2.dist-info/licenses/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
94
- cortexapps_cli-1.19.2.dist-info/RECORD,,
92
+ cortexapps_cli-1.20.0.dist-info/METADATA,sha256=odNgJP_h-jAz2ZSyRu103jX_UkLmXkRzVaEsY8qEG8Q,17800
93
+ cortexapps_cli-1.20.0.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
94
+ cortexapps_cli-1.20.0.dist-info/entry_points.txt,sha256=YffF7CawiDnK0vE7Fg9mAItnXoSjLvVkW3IdHhumz84,49
95
+ cortexapps_cli-1.20.0.dist-info/licenses/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
96
+ cortexapps_cli-1.20.0.dist-info/RECORD,,