validio-cli 0.6.4__tar.gz → 0.6.6__tar.gz
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.
- {validio_cli-0.6.4 → validio_cli-0.6.6}/PKG-INFO +1 -1
- {validio_cli-0.6.4 → validio_cli-0.6.6}/pyproject.toml +1 -1
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/code.py +13 -1
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/config.py +47 -16
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/sources.py +3 -3
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/main.py +2 -25
- {validio_cli-0.6.4 → validio_cli-0.6.6}/LICENSE +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/README_PUBLIC.md +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/__init__.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/channels.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/credentials.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/destinations.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/incidents.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/metrics.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/notification_rules.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/recommendations.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/resources.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/segmentations.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/segments.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/users.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/validators.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/bin/entities/windows.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/components.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/metadata.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/namespace.py +0 -0
- {validio_cli-0.6.4 → validio_cli-0.6.6}/validio_cli/schema.py +0 -0
|
@@ -3,7 +3,7 @@ name = "validio-cli"
|
|
|
3
3
|
# This version does not represent the released version or any tag. For each
|
|
4
4
|
# release we automatically bump this before building and publishing so this
|
|
5
5
|
# should be kept at 0.0.1dev1
|
|
6
|
-
version = "0.6.
|
|
6
|
+
version = "0.6.6"
|
|
7
7
|
description = "CLI tool to interact with the Validio platform"
|
|
8
8
|
authors = ["Validio <support@validio.io>"]
|
|
9
9
|
license = "Apache-2.0"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os
|
|
1
2
|
import pathlib
|
|
2
3
|
import re
|
|
3
4
|
import sys
|
|
@@ -57,6 +58,11 @@ diff_option = typer.Option(
|
|
|
57
58
|
help="Show only the changed lines (added, removed, or modified)",
|
|
58
59
|
)
|
|
59
60
|
|
|
61
|
+
color_option = typer.Option(
|
|
62
|
+
not os.environ.get("NO_COLOR", False),
|
|
63
|
+
help="Enable colored output",
|
|
64
|
+
)
|
|
65
|
+
|
|
60
66
|
destroy_option = typer.Option(
|
|
61
67
|
False, help="Deletes all resources associated with the project"
|
|
62
68
|
)
|
|
@@ -113,6 +119,7 @@ async def plan(
|
|
|
113
119
|
diff_output: DiffOutput = diff_option,
|
|
114
120
|
destroy: bool = destroy_option,
|
|
115
121
|
show_secrets: bool = show_secrets_option,
|
|
122
|
+
color: bool = color_option,
|
|
116
123
|
):
|
|
117
124
|
dir_path = directory_or_default(directory)
|
|
118
125
|
client, _ = await get_client_and_config(config_dir)
|
|
@@ -129,6 +136,7 @@ async def plan(
|
|
|
129
136
|
schema_reinference=schema_reinference,
|
|
130
137
|
destroy=destroy,
|
|
131
138
|
no_capture=no_capture,
|
|
139
|
+
color=color,
|
|
132
140
|
show_schema=show_schema,
|
|
133
141
|
diff_output=diff_output,
|
|
134
142
|
show_secrets=show_secrets,
|
|
@@ -149,6 +157,7 @@ async def apply(
|
|
|
149
157
|
diff_output: DiffOutput = diff_option,
|
|
150
158
|
destroy: bool = destroy_option,
|
|
151
159
|
show_secrets: bool = show_secrets_option,
|
|
160
|
+
color: bool = color_option,
|
|
152
161
|
):
|
|
153
162
|
dir_path = directory_or_default(directory)
|
|
154
163
|
client, _ = await get_client_and_config(config_dir)
|
|
@@ -165,6 +174,7 @@ async def apply(
|
|
|
165
174
|
schema_reinference=schema_reinference,
|
|
166
175
|
destroy=destroy,
|
|
167
176
|
no_capture=no_capture,
|
|
177
|
+
color=color,
|
|
168
178
|
show_schema=show_schema,
|
|
169
179
|
diff_output=diff_output,
|
|
170
180
|
show_secrets=show_secrets,
|
|
@@ -258,6 +268,7 @@ async def _import(
|
|
|
258
268
|
directory=dir_path,
|
|
259
269
|
schema_reinference=create_source_schema_reinference([], False),
|
|
260
270
|
destroy=False,
|
|
271
|
+
color=False,
|
|
261
272
|
no_capture=no_capture,
|
|
262
273
|
show_schema=False,
|
|
263
274
|
show_secrets=False,
|
|
@@ -289,6 +300,7 @@ async def _plan(
|
|
|
289
300
|
schema_reinference: SourceSchemaReinference,
|
|
290
301
|
destroy: bool,
|
|
291
302
|
no_capture: bool,
|
|
303
|
+
color: bool,
|
|
292
304
|
show_schema: bool = False,
|
|
293
305
|
diff_output: DiffOutput = DiffOutput.FULL,
|
|
294
306
|
show_secrets: bool = False,
|
|
@@ -313,7 +325,7 @@ async def _plan(
|
|
|
313
325
|
diff=diff,
|
|
314
326
|
show_schema=show_schema,
|
|
315
327
|
show_secrets=show_secrets,
|
|
316
|
-
escape=sys.stdout.isatty(),
|
|
328
|
+
escape=sys.stdout.isatty() and color,
|
|
317
329
|
diff_output=diff_output,
|
|
318
330
|
)
|
|
319
331
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
from collections.abc import Iterable
|
|
3
2
|
from pathlib import Path
|
|
4
|
-
from typing import Any
|
|
5
3
|
|
|
6
4
|
import httpx
|
|
7
5
|
import typer
|
|
@@ -18,10 +16,20 @@ from validio_sdk.config import (
|
|
|
18
16
|
from validio_sdk.validio_client import UnauthorizedError, ValidioAPIClient
|
|
19
17
|
|
|
20
18
|
import validio_cli
|
|
19
|
+
from validio_cli import (
|
|
20
|
+
AsyncTyper,
|
|
21
|
+
ConfigDir,
|
|
22
|
+
OutputFormat,
|
|
23
|
+
OutputFormatOption,
|
|
24
|
+
output_json,
|
|
25
|
+
)
|
|
21
26
|
|
|
27
|
+
app = AsyncTyper(help="Configuration for Validio")
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
|
|
30
|
+
@app.command(help="Create or edit current credentials")
|
|
31
|
+
def edit(config_dir: str = ConfigDir):
|
|
32
|
+
config_path = Path(config_dir) if config_dir is not None else None
|
|
25
33
|
|
|
26
34
|
cfg = Config(config_path)
|
|
27
35
|
create_type = "updated" if cfg.config_path.is_file() else "created"
|
|
@@ -51,15 +59,30 @@ def create_or_update(default_config_path: str | None = None):
|
|
|
51
59
|
print(f"\n🎉 Configuration {create_type} successfully!")
|
|
52
60
|
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
@app.command(help="Set default namespace to target")
|
|
63
|
+
def ns(
|
|
64
|
+
config_dir: str = ConfigDir,
|
|
65
|
+
namespace: str = typer.Argument(
|
|
66
|
+
"default",
|
|
67
|
+
help="Set default namespace to target from CLI",
|
|
68
|
+
),
|
|
69
|
+
):
|
|
70
|
+
set_default_namespace(namespace or "default", config_dir)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@app.command(help="List current configuration")
|
|
74
|
+
def get(
|
|
75
|
+
config_dir: str = ConfigDir,
|
|
76
|
+
output_format: OutputFormat = OutputFormatOption,
|
|
77
|
+
):
|
|
78
|
+
config_path = Path(config_dir) if config_dir is not None else None
|
|
56
79
|
|
|
57
80
|
cfg = Config(config_path)
|
|
58
81
|
try:
|
|
59
82
|
validio_config = cfg.read()
|
|
60
83
|
except ConfigNotFoundError:
|
|
61
84
|
if confirm("🚫 No configuration found - do you want to create one?"):
|
|
62
|
-
return
|
|
85
|
+
return edit(config_dir)
|
|
63
86
|
|
|
64
87
|
raise typer.Exit(code=1)
|
|
65
88
|
except ConfigInvalidError:
|
|
@@ -68,7 +91,7 @@ def show(default_config_path: str | None = None):
|
|
|
68
91
|
" create a new one?"
|
|
69
92
|
):
|
|
70
93
|
cfg.remove()
|
|
71
|
-
return
|
|
94
|
+
return edit(config_dir)
|
|
72
95
|
|
|
73
96
|
raise typer.Exit(code=1)
|
|
74
97
|
|
|
@@ -78,15 +101,23 @@ def show(default_config_path: str | None = None):
|
|
|
78
101
|
|
|
79
102
|
return value
|
|
80
103
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
104
|
+
settings = {
|
|
105
|
+
"config_path": cfg.config_path,
|
|
106
|
+
"default_namespace": validio_config.default_namespace,
|
|
107
|
+
"endpoint": validio_config.endpoint,
|
|
108
|
+
"access_key": validio_config.access_key,
|
|
109
|
+
"access_secret": validio_config.access_secret,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if output_format == OutputFormat.JSON:
|
|
113
|
+
return output_json(settings)
|
|
114
|
+
|
|
115
|
+
table = [["KEY", "VALUE"]]
|
|
116
|
+
|
|
117
|
+
for k, v in settings.items():
|
|
118
|
+
table.append([k.capitalize().replace("_", " "), _highlight_if_missing(v)])
|
|
88
119
|
|
|
89
|
-
print(tabulate(table))
|
|
120
|
+
print(tabulate(table, tablefmt="plain"))
|
|
90
121
|
|
|
91
122
|
return None
|
|
92
123
|
|
|
@@ -121,7 +121,7 @@ async def start(
|
|
|
121
121
|
if output_format == OutputFormat.JSON:
|
|
122
122
|
return output_json(result)
|
|
123
123
|
|
|
124
|
-
return print(result.state
|
|
124
|
+
return print(result.state)
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
@app.async_command(help="Stop source")
|
|
@@ -144,7 +144,7 @@ async def stop(
|
|
|
144
144
|
if output_format == OutputFormat.JSON:
|
|
145
145
|
return output_json(result)
|
|
146
146
|
|
|
147
|
-
return print(result.state
|
|
147
|
+
return print(result.state)
|
|
148
148
|
|
|
149
149
|
|
|
150
150
|
@app.async_command(help="Backfill source")
|
|
@@ -167,7 +167,7 @@ async def backfill(
|
|
|
167
167
|
if output_format == OutputFormat.JSON:
|
|
168
168
|
return output_json(result)
|
|
169
169
|
|
|
170
|
-
return print(result.state
|
|
170
|
+
return print(result.state)
|
|
171
171
|
|
|
172
172
|
|
|
173
173
|
@infer_schema_app.callback(invoke_without_command=True)
|
|
@@ -8,10 +8,10 @@ from tabulate import tabulate
|
|
|
8
8
|
from validio_sdk.validio_client import UnauthorizedError
|
|
9
9
|
|
|
10
10
|
import validio_cli.metadata
|
|
11
|
-
from validio_cli import ConfigDir
|
|
12
11
|
from validio_cli.bin.entities import (
|
|
13
12
|
channels,
|
|
14
13
|
code,
|
|
14
|
+
config,
|
|
15
15
|
credentials,
|
|
16
16
|
destinations,
|
|
17
17
|
incidents,
|
|
@@ -26,7 +26,6 @@ from validio_cli.bin.entities import (
|
|
|
26
26
|
validators,
|
|
27
27
|
windows,
|
|
28
28
|
)
|
|
29
|
-
from validio_cli.bin.entities import config as cfg
|
|
30
29
|
|
|
31
30
|
app = typer.Typer(
|
|
32
31
|
help="Validio CLI tool", no_args_is_help=True, pretty_exceptions_enable=False
|
|
@@ -34,6 +33,7 @@ app = typer.Typer(
|
|
|
34
33
|
|
|
35
34
|
app.add_typer(channels.app, no_args_is_help=True, name="channels")
|
|
36
35
|
app.add_typer(code.app, no_args_is_help=True, name="code")
|
|
36
|
+
app.add_typer(config.app, no_args_is_help=True, name="config")
|
|
37
37
|
app.add_typer(credentials.app, no_args_is_help=True, name="credentials")
|
|
38
38
|
app.add_typer(destinations.app, no_args_is_help=True, name="destinations")
|
|
39
39
|
app.add_typer(incidents.app, no_args_is_help=True, name="incidents")
|
|
@@ -49,29 +49,6 @@ app.add_typer(validators.app, no_args_is_help=True, name="validators")
|
|
|
49
49
|
app.add_typer(windows.app, no_args_is_help=True, name="windows")
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
@app.command()
|
|
53
|
-
def config(
|
|
54
|
-
config_dir: str = ConfigDir,
|
|
55
|
-
show: bool = typer.Option(
|
|
56
|
-
False,
|
|
57
|
-
help="Show current configuration",
|
|
58
|
-
),
|
|
59
|
-
default_namespace: str = typer.Option(
|
|
60
|
-
None,
|
|
61
|
-
help="Set default namespace to target from CLI",
|
|
62
|
-
),
|
|
63
|
-
):
|
|
64
|
-
"""
|
|
65
|
-
Initialize the CLI tool to set endpoint, credentials and more.
|
|
66
|
-
"""
|
|
67
|
-
if show:
|
|
68
|
-
cfg.show(config_dir)
|
|
69
|
-
elif default_namespace:
|
|
70
|
-
cfg.set_default_namespace(default_namespace, config_dir)
|
|
71
|
-
else:
|
|
72
|
-
cfg.create_or_update(config_dir)
|
|
73
|
-
|
|
74
|
-
|
|
75
52
|
@app.command(help="Show current version")
|
|
76
53
|
def version():
|
|
77
54
|
print(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|