Coverage for src / main / python / okta_api_script / cli.py: 92%
12 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-17 22:29 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-17 22:29 +0000
1#!/usr/bin/env python3
2"""Command line interface for okta-opa-script."""
4import os
6import click
8from okta_api_script.main import execute_api_cycle
11@click.command()
12@click.option(
13 "--org",
14 default=lambda: os.getenv("OKTA_ORG"),
15 help="Okta organization name (defaults to OKTA_ORG environment variable)",
16)
17@click.option(
18 "--team",
19 default=lambda: os.getenv("OKTA_TEAM"),
20 help="Okta team name (defaults to OKTA_TEAM environment variable)",
21)
22@click.option(
23 "--project",
24 default=lambda: os.getenv("OKTA_TARGET_PROJECT"),
25 help="Okta target project (defaults to OKTA_TARGET_PROJECT environment variable)",
26)
27@click.option(
28 "--key",
29 default=lambda: os.getenv("KEY_ID"),
30 help="Okta key ID (defaults to KEY_ID environment variable)",
31)
32@click.option(
33 "--secret",
34 default=lambda: os.getenv("KEY_SECRET"),
35 help="Okta key secret (defaults to KEY_SECRET environment variable)",
36)
37@click.option(
38 "--json",
39 default=False,
40 help="Output JSON instead of just the server enrollment token (defaults to False)",
41)
42def cli(
43 org: str | None,
44 team: str | None,
45 project: str | None,
46 key: str | None,
47 secret: str | None,
48 json: bool = False,
49) -> None:
50 """Okta API script command line interface."""
51 execute_api_cycle(org, team, project, key, secret, json)