nace-cli 0.6.0__tar.gz → 0.9.0__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.
- {nace_cli-0.6.0 → nace_cli-0.9.0}/PKG-INFO +2 -2
- {nace_cli-0.6.0 → nace_cli-0.9.0}/pyproject.toml +2 -2
- {nace_cli-0.6.0 → nace_cli-0.9.0}/pyproject.toml.orig +2 -2
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/__init__.py +1 -1
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_cli.py +3 -1
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_decide.py +2 -1
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_inputs.py +2 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_output.py +1 -1
- nace_cli-0.9.0/src/nace_cli/_route.py +31 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_storage.py +80 -22
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_workspaces.py +4 -1
- {nace_cli-0.6.0 → nace_cli-0.9.0}/LICENSE +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/README.md +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_browser.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_docops.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_domains.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_entrypoint.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_jobs.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_login.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_metadata.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_navigate.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_schemas.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_search.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_skill.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/_upload.py +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/py.typed +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/skills/drex-search/SKILL.md +0 -0
- {nace_cli-0.6.0 → nace_cli-0.9.0}/src/nace_cli/skills/drex-workspace/SKILL.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nace-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Nace CLI: calibrated decisions and document jobs from the shell
|
|
5
5
|
Keywords: drex,nace,cli,document-intelligence
|
|
6
6
|
Author: Nace AI
|
|
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
18
|
Classifier: Typing :: Typed
|
|
19
|
-
Requires-Dist: nace-sdk>=0.
|
|
19
|
+
Requires-Dist: nace-sdk>=0.11.1,<1
|
|
20
20
|
Requires-Dist: truststore>=0.10.4,<1
|
|
21
21
|
Requires-Python: >=3.11
|
|
22
22
|
Project-URL: Homepage, https://console.nace.ai
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nace-cli"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.9.0"
|
|
4
4
|
description = "Nace CLI: calibrated decisions and document jobs from the shell"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -24,7 +24,7 @@ classifiers = [
|
|
|
24
24
|
"Typing :: Typed",
|
|
25
25
|
]
|
|
26
26
|
dependencies = [
|
|
27
|
-
"nace-sdk>=0.
|
|
27
|
+
"nace-sdk>=0.11.1,<1",
|
|
28
28
|
"truststore>=0.10.4,<1",
|
|
29
29
|
]
|
|
30
30
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nace-cli"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.9.0"
|
|
4
4
|
description = "Nace CLI: calibrated decisions and document jobs from the shell"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Nace AI", email = "engineering@nace.ai" }
|
|
@@ -27,7 +27,7 @@ classifiers = [
|
|
|
27
27
|
"Typing :: Typed",
|
|
28
28
|
]
|
|
29
29
|
dependencies = [
|
|
30
|
-
"nace-sdk>=0.
|
|
30
|
+
"nace-sdk>=0.11.1,<1",
|
|
31
31
|
"truststore>=0.10.4,<1",
|
|
32
32
|
]
|
|
33
33
|
|
|
@@ -26,6 +26,7 @@ from nace_cli import (
|
|
|
26
26
|
_login,
|
|
27
27
|
_metadata,
|
|
28
28
|
_navigate,
|
|
29
|
+
_route,
|
|
29
30
|
_schemas,
|
|
30
31
|
_search,
|
|
31
32
|
_skill,
|
|
@@ -147,7 +148,7 @@ _WORKSPACE_HINTS = {
|
|
|
147
148
|
"`nace storage list` lists your account's connections. A deployment without customer storage answers this to every call."
|
|
148
149
|
),
|
|
149
150
|
"storage_connection_not_ready": "Validate the connection first: `nace storage validate --id ID --wait`.",
|
|
150
|
-
"storage_credentials_refused": "Check the
|
|
151
|
+
"storage_credentials_refused": "Check the credentials for your storage provider, then run `nace storage credentials` again.",
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
|
|
@@ -209,6 +210,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
209
210
|
sub = parser.add_subparsers(dest="command")
|
|
210
211
|
_login.add_parsers(sub)
|
|
211
212
|
_decide.add_parsers(sub, common)
|
|
213
|
+
_route.add_parsers(sub, common)
|
|
212
214
|
_upload.add_parsers(sub, common)
|
|
213
215
|
_docops.add_parsers(sub, common)
|
|
214
216
|
_jobs.add_parsers(sub, common)
|
|
@@ -16,6 +16,7 @@ from nace_sdk import (
|
|
|
16
16
|
NaceClient,
|
|
17
17
|
Noul,
|
|
18
18
|
NoulAnswer,
|
|
19
|
+
RouteResponse,
|
|
19
20
|
Score,
|
|
20
21
|
ScoreAnswer,
|
|
21
22
|
SystemOneResponse,
|
|
@@ -195,7 +196,7 @@ def run_decide(client: NaceClient, args: argparse.Namespace) -> int:
|
|
|
195
196
|
return 0
|
|
196
197
|
|
|
197
198
|
|
|
198
|
-
def response_json(response: SystemOneResponse | ListModelsResponse | BalanceResponse) -> str:
|
|
199
|
+
def response_json(response: SystemOneResponse | ListModelsResponse | BalanceResponse | RouteResponse) -> str:
|
|
199
200
|
"""The body as Drex sent it, ``request_id`` included: the model keeps the id out of its fields."""
|
|
200
201
|
body = response.raw_http_response.json()
|
|
201
202
|
request_id = response.raw_http_response.headers.get("x-request-id")
|
|
@@ -189,7 +189,7 @@ def ingestion_failed(done: DocumentJob) -> int:
|
|
|
189
189
|
failed = count(result.get("files_failed"))
|
|
190
190
|
if done.status != "succeeded" or not failed:
|
|
191
191
|
return 0
|
|
192
|
-
total = failed + count(result.get("files_ingested")) + count(result.get("files_skipped"))
|
|
192
|
+
total = failed + count(result.get("files_ingested")) + count(result.get("files_skipped")) + count(result.get("files_superseded"))
|
|
193
193
|
print(f"error: {failed} of {total} files failed to ingest", file=sys.stderr)
|
|
194
194
|
return 1
|
|
195
195
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""``nace route`` selects a model; it never runs the selected language model."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
|
|
5
|
+
from nace_sdk import NaceClient
|
|
6
|
+
|
|
7
|
+
from nace_cli._decide import response_json
|
|
8
|
+
from nace_cli._inputs import read_json
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def add_parsers(sub: argparse._SubParsersAction, common: argparse.ArgumentParser) -> None:
|
|
12
|
+
parser = sub.add_parser("route", parents=[common], help="Select a candidate model for a conversation.")
|
|
13
|
+
parser.add_argument("--messages", required=True, metavar="JSON", help="Conversation messages: JSON, @FILE, or - for stdin.")
|
|
14
|
+
parser.add_argument("--candidates", required=True, metavar="JSON", help="Candidate IDs or profiles: JSON, @FILE, or - for stdin.")
|
|
15
|
+
parser.add_argument(
|
|
16
|
+
"--priority",
|
|
17
|
+
choices=("quality", "balanced", "cheapest"),
|
|
18
|
+
default="balanced",
|
|
19
|
+
help="Model selection priority: quality, balanced, or cheapest (default balanced).",
|
|
20
|
+
)
|
|
21
|
+
parser.set_defaults(run=run_route, family="client")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def run_route(client: NaceClient, args: argparse.Namespace) -> int:
|
|
25
|
+
response = client.route(
|
|
26
|
+
read_json(args.messages, what="--messages"),
|
|
27
|
+
read_json(args.candidates, what="--candidates"),
|
|
28
|
+
selection_priority=args.priority,
|
|
29
|
+
)
|
|
30
|
+
print(response_json(response) if args.json else response.selected)
|
|
31
|
+
return 0
|
|
@@ -25,6 +25,8 @@ from nace_sdk import (
|
|
|
25
25
|
AzureSetupOptions,
|
|
26
26
|
DocumentJob,
|
|
27
27
|
NaceClient,
|
|
28
|
+
S3AccessKeyCredential,
|
|
29
|
+
S3CompatibleDestination,
|
|
28
30
|
S3Destination,
|
|
29
31
|
S3SetupOptions,
|
|
30
32
|
StorageConnection,
|
|
@@ -37,12 +39,21 @@ from nace_cli._output import CommandFailed, job_json, job_line
|
|
|
37
39
|
from nace_cli._schemas import _add_page_args
|
|
38
40
|
from nace_cli._workspaces import _emit_listing
|
|
39
41
|
|
|
40
|
-
#: The
|
|
41
|
-
PROVIDERS = ("s3", "azure_blob")
|
|
42
|
+
#: The kinds of destination, for ``nace storage create --provider``.
|
|
43
|
+
PROVIDERS = ("s3", "azure_blob", "s3_compatible")
|
|
42
44
|
#: Where the Azure client secret comes from when ``--client-secret-file`` isn't given.
|
|
43
45
|
AZURE_SECRET_ENV = "AZURE_CLIENT_SECRET"
|
|
44
46
|
#: Each provider's ``nace storage create`` flags, by argparse dest and flag.
|
|
45
|
-
DESTINATION_FLAGS = {
|
|
47
|
+
DESTINATION_FLAGS = {
|
|
48
|
+
"s3": {"bucket": "--bucket", "region": "--region"},
|
|
49
|
+
"azure_blob": {"account": "--account", "container": "--container"},
|
|
50
|
+
"s3_compatible": {"bucket": "--bucket", "region": "--region", "endpoint": "--endpoint"},
|
|
51
|
+
}
|
|
52
|
+
S3_KEY_FILES = {
|
|
53
|
+
"access_key_id": "AWS_ACCESS_KEY_ID",
|
|
54
|
+
"secret_access_key": "AWS_SECRET_ACCESS_KEY",
|
|
55
|
+
"session_token": "AWS_SESSION_TOKEN",
|
|
56
|
+
}
|
|
46
57
|
#: Each provider's ``nace storage setup`` flags, by setup option and flag.
|
|
47
58
|
SETUP_FLAGS = {
|
|
48
59
|
"s3": {"access_method": "--access-method", "aws_account_id": "--aws-account-id", "role_name": "--role-name", "kms_key_arn": "--kms-key-arn"},
|
|
@@ -70,7 +81,7 @@ def _add_id(parser: argparse.ArgumentParser) -> None:
|
|
|
70
81
|
|
|
71
82
|
|
|
72
83
|
def add_parsers(sub: argparse._SubParsersAction, common: argparse.ArgumentParser) -> None:
|
|
73
|
-
storage = sub.add_parser("storage", help="Connect your own S3
|
|
84
|
+
storage = sub.add_parser("storage", help="Connect your own S3, S3-compatible, or Azure Blob storage for new workspaces.")
|
|
74
85
|
names = "{list,get,create,setup,credentials,validate,revoke,delete}"
|
|
75
86
|
actions = storage.add_subparsers(dest="storage_action", metavar=names, required=True)
|
|
76
87
|
|
|
@@ -84,9 +95,13 @@ def add_parsers(sub: argparse._SubParsersAction, common: argparse.ArgumentParser
|
|
|
84
95
|
|
|
85
96
|
create = actions.add_parser("create", parents=[common], help="Create a draft connection to a bucket or container you own.")
|
|
86
97
|
create.add_argument("--name", required=True, metavar="NAME", help="The name people see, 1 to 200 characters.")
|
|
87
|
-
create.add_argument("--provider", required=True, choices=PROVIDERS, help="
|
|
88
|
-
create.add_argument("--bucket", default=None, metavar="BUCKET", help="s3: your bucket.")
|
|
89
|
-
create.add_argument(
|
|
98
|
+
create.add_argument("--provider", required=True, choices=PROVIDERS, help="Amazon S3, Azure Blob, or S3-compatible storage.")
|
|
99
|
+
create.add_argument("--bucket", default=None, metavar="BUCKET", help="s3 or s3_compatible: your bucket.")
|
|
100
|
+
create.add_argument(
|
|
101
|
+
"--region", default=None, metavar="REGION", help="s3 or s3_compatible: the signing region, such as us-east-1 for AWS or auto for R2."
|
|
102
|
+
)
|
|
103
|
+
create.add_argument("--endpoint", metavar="URL", help="s3_compatible: public HTTPS endpoint without the bucket name.")
|
|
104
|
+
create.add_argument("--addressing-style", choices=("path", "virtual"), help="s3_compatible: addressing style. Default: path.")
|
|
90
105
|
create.add_argument("--account", default=None, metavar="ACCOUNT", help="azure_blob: the storage account name.")
|
|
91
106
|
create.add_argument("--container", default=None, metavar="CONTAINER", help="azure_blob: your container.")
|
|
92
107
|
create.add_argument("--prefix", default=None, metavar="PREFIX", help="A base prefix inside it; each workspace gets its own folder beneath.")
|
|
@@ -106,7 +121,7 @@ def add_parsers(sub: argparse._SubParsersAction, common: argparse.ArgumentParser
|
|
|
106
121
|
setup.add_argument("--client-id", default=None, metavar="ID", help="azure_blob: the application (client) id to give access to.")
|
|
107
122
|
setup.set_defaults(run=run_setup, family="client")
|
|
108
123
|
|
|
109
|
-
credentials = actions.add_parser("credentials", parents=[common], help="Save
|
|
124
|
+
credentials = actions.add_parser("credentials", parents=[common], help="Save an IAM role, Azure service principal, or S3-compatible access keys.")
|
|
110
125
|
_add_id(credentials)
|
|
111
126
|
credentials.add_argument(
|
|
112
127
|
"--role-arn", default=None, metavar="ARN", help="s3: your IAM role that trusts Nace's roles with the connection's external id."
|
|
@@ -119,6 +134,16 @@ def add_parsers(sub: argparse._SubParsersAction, common: argparse.ArgumentParser
|
|
|
119
134
|
metavar="FILE",
|
|
120
135
|
help=f"azure_blob: a file holding the application's secret, or - for stdin (hidden at a terminal). Default: ${AZURE_SECRET_ENV}.",
|
|
121
136
|
)
|
|
137
|
+
credentials.add_argument(
|
|
138
|
+
"--s3-access-key", action="store_true", help="Save S3-compatible access keys. Use credential files or the AWS environment variables as a set."
|
|
139
|
+
)
|
|
140
|
+
for field in S3_KEY_FILES:
|
|
141
|
+
label = field.replace("_", " ")
|
|
142
|
+
credentials.add_argument(
|
|
143
|
+
f"--{field.replace('_', '-')}-file",
|
|
144
|
+
metavar="FILE",
|
|
145
|
+
help=f"s3_compatible: a file holding the {label}, or - for stdin.",
|
|
146
|
+
)
|
|
122
147
|
credentials.set_defaults(run=run_credentials, family="client")
|
|
123
148
|
|
|
124
149
|
validate = actions.add_parser("validate", parents=[common], help="Check that Nace can write, read and delete in the destination.")
|
|
@@ -148,8 +173,9 @@ def add_parsers(sub: argparse._SubParsersAction, common: argparse.ArgumentParser
|
|
|
148
173
|
|
|
149
174
|
def _where(item: StorageConnection) -> str:
|
|
150
175
|
destination = item.destination
|
|
151
|
-
|
|
152
|
-
|
|
176
|
+
place = (
|
|
177
|
+
f"azure://{destination.account}/{destination.container}" if isinstance(destination, AzureBlobDestination) else f"s3://{destination.bucket}"
|
|
178
|
+
)
|
|
153
179
|
return f"{place}/{destination.prefix}" if destination.prefix else place
|
|
154
180
|
|
|
155
181
|
|
|
@@ -227,19 +253,23 @@ def run_get(client: NaceClient, args: argparse.Namespace) -> int:
|
|
|
227
253
|
return 0
|
|
228
254
|
|
|
229
255
|
|
|
230
|
-
def _destination(args: argparse.Namespace) -> S3Destination | AzureBlobDestination:
|
|
256
|
+
def _destination(args: argparse.Namespace) -> S3Destination | AzureBlobDestination | S3CompatibleDestination:
|
|
231
257
|
"""The destination the flags name: each of the provider's own flags, and none of the other's."""
|
|
232
258
|
wanted = DESTINATION_FLAGS[args.provider]
|
|
233
|
-
|
|
259
|
+
flags = {dest: flag for values in DESTINATION_FLAGS.values() for dest, flag in values.items()}
|
|
260
|
+
flags["addressing_style"] = "--addressing-style"
|
|
261
|
+
allowed = {*wanted, "addressing_style"} if args.provider == "s3_compatible" else wanted
|
|
234
262
|
missing = [flag for dest, flag in wanted.items() if not (getattr(args, dest) or "").strip()]
|
|
235
263
|
if missing:
|
|
236
264
|
raise ValueError(f"--provider {args.provider} needs {' and '.join(missing)}")
|
|
237
|
-
stray = [flag for dest, flag in
|
|
265
|
+
stray = [flag for dest, flag in flags.items() if dest not in allowed and getattr(args, dest) is not None]
|
|
238
266
|
if stray:
|
|
239
267
|
raise ValueError(f"{' and '.join(stray)} {'is' if len(stray) == 1 else 'are'} not for --provider {args.provider}")
|
|
240
268
|
fields: dict[str, Any] = {dest: getattr(args, dest).strip() for dest in wanted}
|
|
241
269
|
if args.prefix is not None:
|
|
242
270
|
fields["prefix"] = args.prefix.strip().strip("/")
|
|
271
|
+
if args.provider == "s3_compatible":
|
|
272
|
+
return S3CompatibleDestination(**fields, addressing_style=args.addressing_style or "path")
|
|
243
273
|
return S3Destination(**fields) if args.provider == "s3" else AzureBlobDestination(**fields)
|
|
244
274
|
|
|
245
275
|
|
|
@@ -248,7 +278,10 @@ def run_create(client: NaceClient, args: argparse.Namespace) -> int:
|
|
|
248
278
|
if not name or len(name) > 200:
|
|
249
279
|
raise ValueError("--name must be 1 to 200 characters, not blank")
|
|
250
280
|
item = client.storage_connections.create(name=name, destination=_destination(args))
|
|
251
|
-
|
|
281
|
+
if isinstance(item.destination, S3CompatibleDestination):
|
|
282
|
+
print(f"next: nace storage credentials --id {item.id} --s3-access-key", file=sys.stderr)
|
|
283
|
+
else:
|
|
284
|
+
print(f"next: nace storage setup --id {item.id}", file=sys.stderr)
|
|
252
285
|
return _emit_connection(item, args)
|
|
253
286
|
|
|
254
287
|
|
|
@@ -287,24 +320,49 @@ def _azure_secret(args: argparse.Namespace) -> str:
|
|
|
287
320
|
return secret
|
|
288
321
|
|
|
289
322
|
|
|
323
|
+
def _s3_keys(files: dict[str, str | None]) -> S3AccessKeyCredential:
|
|
324
|
+
if list(files.values()).count("-") > 1:
|
|
325
|
+
raise ValueError("only one S3 credential field can use stdin")
|
|
326
|
+
from_files = any(source is not None for source in files.values())
|
|
327
|
+
if from_files and (files["access_key_id"] is None or files["secret_access_key"] is None):
|
|
328
|
+
raise ValueError("file credentials require both --access-key-id-file and --secret-access-key-file")
|
|
329
|
+
values = {}
|
|
330
|
+
for field, env in S3_KEY_FILES.items():
|
|
331
|
+
source = files[field]
|
|
332
|
+
label = field.replace("_", " ")
|
|
333
|
+
if source is not None:
|
|
334
|
+
value = read_secret(source if source == "-" else f"@{source}", prompt=f"S3 {label}: ")
|
|
335
|
+
else:
|
|
336
|
+
value = "" if from_files else os.environ.get(env, "")
|
|
337
|
+
if value.strip():
|
|
338
|
+
values[field] = value
|
|
339
|
+
elif source is not None or field != "session_token":
|
|
340
|
+
where = f"--{field.replace('_', '-')}-file" if from_files else f"${env}"
|
|
341
|
+
raise ValueError(f"the S3 {label} from {where} is empty")
|
|
342
|
+
return S3AccessKeyCredential.model_validate(values)
|
|
343
|
+
|
|
344
|
+
|
|
290
345
|
def run_credentials(client: NaceClient, args: argparse.Namespace) -> int:
|
|
291
346
|
azure = {"--tenant-id": args.tenant_id, "--client-id": args.client_id, "--client-secret-file": args.client_secret_file}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
347
|
+
files = {field: getattr(args, f"{field}_file") for field in S3_KEY_FILES}
|
|
348
|
+
aws_role = args.role_arn is not None
|
|
349
|
+
azure_principal = any(value is not None for value in azure.values())
|
|
350
|
+
s3_key = args.s3_access_key or any(value is not None for value in files.values())
|
|
351
|
+
if sum((aws_role, azure_principal, s3_key)) != 1:
|
|
352
|
+
raise ValueError("pass one credential kind: --role-arn, --tenant-id with --client-id, or --s3-access-key")
|
|
353
|
+
if aws_role:
|
|
296
354
|
if not args.role_arn.strip():
|
|
297
355
|
raise ValueError("--role-arn must not be blank")
|
|
298
|
-
credential: AwsRoleCredential | AzureServicePrincipalCredential = AwsRoleCredential(role_arn=args.role_arn.strip())
|
|
299
|
-
elif
|
|
356
|
+
credential: AwsRoleCredential | AzureServicePrincipalCredential | S3AccessKeyCredential = AwsRoleCredential(role_arn=args.role_arn.strip())
|
|
357
|
+
elif s3_key:
|
|
358
|
+
credential = _s3_keys(files)
|
|
359
|
+
else:
|
|
300
360
|
missing = [flag for flag in ("--tenant-id", "--client-id") if not (azure[flag] or "").strip()]
|
|
301
361
|
if missing:
|
|
302
362
|
raise ValueError(f"an Azure service principal needs {' and '.join(missing)}")
|
|
303
363
|
credential = AzureServicePrincipalCredential.model_validate(
|
|
304
364
|
{"tenant_id": args.tenant_id.strip(), "client_id": args.client_id.strip(), "client_secret": _azure_secret(args)}
|
|
305
365
|
)
|
|
306
|
-
else:
|
|
307
|
-
raise ValueError("pass --role-arn for an S3 connection, or --tenant-id and --client-id for an Azure one")
|
|
308
366
|
item = client.storage_connections.set_credentials(_connection_id(args), credential)
|
|
309
367
|
print(f"saved; next: nace storage validate --id {item.id} --wait", file=sys.stderr)
|
|
310
368
|
return _emit_connection(item, args)
|
|
@@ -498,12 +498,15 @@ def summarize_ingestion(done: DocumentJob) -> int:
|
|
|
498
498
|
"""The ndi CLI's summary of an ingestion on stdout; each failed file on stderr too.
|
|
499
499
|
|
|
500
500
|
``ingested N | skipped N | failed N | U units`` (with ``| empty N`` after ``skipped`` when some
|
|
501
|
-
file had no rows
|
|
501
|
+
file had no rows, and ``| superseded N`` when a later ingestion took over a file), then one
|
|
502
|
+
`` <status> <path>[ <error>]`` line per file, its status as given.
|
|
502
503
|
"""
|
|
503
504
|
result = _result(done)
|
|
504
505
|
parts = [f"ingested {count(result.get('files_ingested'))}", f"skipped {count(result.get('files_skipped'))}"]
|
|
505
506
|
if empty := count(result.get("files_empty")):
|
|
506
507
|
parts.append(f"empty {empty}")
|
|
508
|
+
if superseded := count(result.get("files_superseded")):
|
|
509
|
+
parts.append(f"superseded {superseded}")
|
|
507
510
|
parts += [f"failed {count(result.get('files_failed'))}", f"{count(result.get('units_total'))} units"]
|
|
508
511
|
print(" | ".join(parts))
|
|
509
512
|
for outcome in result.get("outcomes") or []:
|
|
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
|