entropy-data 0.3.3__tar.gz → 0.3.5__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.
- entropy_data-0.3.5/CHANGELOG.md +70 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/PKG-INFO +1 -1
- {entropy_data-0.3.3 → entropy_data-0.3.5}/README.md +8 -5
- {entropy_data-0.3.3 → entropy_data-0.3.5}/pyproject.toml +1 -1
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/cli.py +4 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/client.py +9 -2
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/access.py +75 -0
- entropy_data-0.3.5/src/entropy_data/commands/assets.py +159 -0
- entropy_data-0.3.3/src/entropy_data/commands/teams.py → entropy_data-0.3.5/src/entropy_data/commands/connectors.py +23 -24
- entropy_data-0.3.5/src/entropy_data/commands/datacontracts.py +305 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/dataproducts.py +53 -0
- entropy_data-0.3.5/src/entropy_data/commands/git_credentials.py +456 -0
- entropy_data-0.3.5/src/entropy_data/commands/notification_channels.py +88 -0
- entropy_data-0.3.5/src/entropy_data/commands/organization.py +98 -0
- entropy_data-0.3.5/src/entropy_data/commands/semantics.py +308 -0
- entropy_data-0.3.5/src/entropy_data/commands/settings.py +111 -0
- entropy_data-0.3.5/src/entropy_data/commands/teams.py +116 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/config.py +19 -8
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/output.py +36 -2
- entropy_data-0.3.5/tests/commands/test_access_request.py +118 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_assets.py +61 -0
- entropy_data-0.3.5/tests/commands/test_connectors.py +73 -0
- entropy_data-0.3.5/tests/commands/test_datacontracts.py +191 -0
- entropy_data-0.3.5/tests/commands/test_dataproducts.py +78 -0
- entropy_data-0.3.5/tests/commands/test_git_credentials.py +239 -0
- entropy_data-0.3.5/tests/commands/test_notification_channels.py +75 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_organization.py +54 -0
- entropy_data-0.3.5/tests/commands/test_semantics.py +300 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_settings.py +69 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_teams.py +81 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/test_config.py +18 -0
- entropy_data-0.3.3/CHANGELOG.md +0 -52
- entropy_data-0.3.3/src/entropy_data/commands/assets.py +0 -80
- entropy_data-0.3.3/src/entropy_data/commands/datacontracts.py +0 -124
- entropy_data-0.3.3/src/entropy_data/commands/organization.py +0 -51
- entropy_data-0.3.3/src/entropy_data/commands/settings.py +0 -68
- {entropy_data-0.3.3 → entropy_data-0.3.5}/.editorconfig +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/.github/dependabot.yml +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/.github/pull_request_template.md +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/.github/workflows/ci.yaml +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/.github/workflows/release.yaml +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/.gitignore +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/.pre-commit-config.yaml +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/CLAUDE.md +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/Dockerfile +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/LICENSE +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/release +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/__init__.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/__main__.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/__init__.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/api_keys.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/certifications.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/connection.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/costs.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/definitions.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/events.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/example_data.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/gitconnections.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/import_export.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/lineage.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/search.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/sourcesystems.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/tags.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/test_results.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/commands/usage.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/src/entropy_data/util.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/__init__.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/__init__.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_api_keys.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_connection.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_costs.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_gitconnections.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_lineage.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_tags.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/commands/test_usage.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/conftest.py +0 -0
- {entropy_data-0.3.3 → entropy_data-0.3.5}/tests/test_client.py +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.3.5]
|
|
6
|
+
|
|
7
|
+
- Add `entropy-data semantics search <namespace> <query> [--kind <kind>] [--limit <n>]` for case-insensitive substring search across concept id, name, and description in a namespace. Implemented client-side over the existing `GET /api/semantics/experimental/namespaces/{ns}/concepts` endpoint.
|
|
8
|
+
- Add `entropy-data access request <data-product-id> <output-port-id> --purpose <text> --consumer-team|--consumer-user|--consumer-dataproduct <id> [--roles <comma-list>] [--id <agreement-id>]` to submit an access request for a provider output port. Wraps `PUT /api/access/{id}` and auto-generates a UUID when `--id` is omitted.
|
|
9
|
+
|
|
10
|
+
## [0.3.4]
|
|
11
|
+
|
|
12
|
+
- Add `entropy-data datacontracts yaml <id>` to fetch a data contract as ODCS YAML (writes to stdout or `--file`). Backed by `GET /api/datacontracts/{id}.yaml`.
|
|
13
|
+
- Add `entropy-data datacontracts generate <id> --type <kind>` for code generation (`sql-select`, `sql-ddl`, `dbt-models`, `dbt-sources`, `json-schema`, `pydantic`, `custom`). With `--out-dir`, each returned file is written to disk; without it, the JSON response is printed.
|
|
14
|
+
- Add `entropy-data dataproducts import-from-git` and `entropy-data datacontracts import-from-git` to import resources from a Git repository (flags or `--file body.json`).
|
|
15
|
+
- Add `entropy-data organization members list` and `entropy-data organization members get <email>` to inspect organization membership.
|
|
16
|
+
- Add `entropy-data settings get-scim-mapping` and `entropy-data settings put-scim-mapping` to manage the SCIM group mapping (YAML or JSON, mirrors the customization commands).
|
|
17
|
+
- Add `entropy-data connectors list|get|put|delete` to manage connector state.
|
|
18
|
+
- Add `entropy-data assets tags list|add|remove` to manage tag assignments on data assets.
|
|
19
|
+
- Add `entropy-data organization git-credentials list|get|create|update|delete` and `entropy-data teams git-credentials list|get|create|update|delete <team-id>` to manage organization- and team-level git credentials. Pass `--authentication-token -` to read the secret from stdin.
|
|
20
|
+
- Add `entropy-data teams notifications get|put|delete <team-id> <channel-id>` to manage a team's notification channels.
|
|
21
|
+
- Add EXPERIMENTAL `entropy-data semantics namespaces list|get|put|delete`, `entropy-data semantics concepts list|get|put|delete <namespace> [<external-id>]`, and `entropy-data semantics relationships list|get|put|delete <namespace> [<external-id>]` covering the `/api/semantics/experimental/...` endpoints. PUT commands enforce that any `namespace`/`id` in the body matches the path argument.
|
|
22
|
+
|
|
23
|
+
## [0.3.3]
|
|
24
|
+
|
|
25
|
+
- Add `entropy-data organization get` to fetch organization settings (vanity URL, host, full name, plan, SSO) for the API key in use. Backed by the new `GET /api/organization/settings` endpoint.
|
|
26
|
+
- Add `entropy-data connection get [name]` to inspect a stored connection. API key is masked by default; pass `--show-api-key` to print it in clear text. Use `-o json` for scripting.
|
|
27
|
+
- `entropy-data connection add` auto-fetches the organization vanity URL via `/api/organization/settings` and stores it on the connection. Best-effort: older servers or network errors fall back to no vanity URL.
|
|
28
|
+
- `connection list` surfaces the stored vanity URL.
|
|
29
|
+
|
|
30
|
+
## [0.3.2]
|
|
31
|
+
|
|
32
|
+
- Add `git-connection` subcommands to `dataproducts` and `datacontracts`
|
|
33
|
+
|
|
34
|
+
## [0.3.1]
|
|
35
|
+
|
|
36
|
+
- Support Python 3.11 (lowered minimum from 3.12)
|
|
37
|
+
|
|
38
|
+
## [0.3.0]
|
|
39
|
+
|
|
40
|
+
- Rename PyPI package from `entropy-data-cli` to `entropy-data`. Install with `pip install entropy-data` (or `uv tool install entropy-data`). The CLI command remains `entropy-data`.
|
|
41
|
+
|
|
42
|
+
## [0.2.3]
|
|
43
|
+
|
|
44
|
+
- Add `.env` file support for project-specific configuration via `python-dotenv`
|
|
45
|
+
- Document release process in README
|
|
46
|
+
|
|
47
|
+
## [0.2.2]
|
|
48
|
+
|
|
49
|
+
- Fix version reporting to read from package metadata instead of hardcoded value
|
|
50
|
+
|
|
51
|
+
## [0.2.1]
|
|
52
|
+
|
|
53
|
+
- Add Docker Hub publish to CI and release workflows
|
|
54
|
+
|
|
55
|
+
## [0.2.0]
|
|
56
|
+
|
|
57
|
+
- Fix negative page numbers leaking SQL queries from the server
|
|
58
|
+
- Fix mismatched resource ID in body vs CLI argument silently using body ID
|
|
59
|
+
- Fix HTML error responses (e.g., from Tomcat) displayed as raw markup
|
|
60
|
+
- Add max resource ID length validation (256 characters)
|
|
61
|
+
- Add 30s HTTP request timeout to prevent hanging on unreachable hosts
|
|
62
|
+
|
|
63
|
+
## [0.1.0]
|
|
64
|
+
|
|
65
|
+
- Initial release
|
|
66
|
+
- CRUD commands for data products, data contracts, access, teams, source systems, definitions, certifications, example data, test results
|
|
67
|
+
- Access workflow commands: approve, reject, cancel
|
|
68
|
+
- Event polling and search
|
|
69
|
+
- Connection management with `~/.entropy-data/config.toml`
|
|
70
|
+
- Table and JSON output formats
|
|
@@ -80,23 +80,26 @@ entropy-data search query "customer orders"
|
|
|
80
80
|
entropy-data [--version] [--connection NAME] [--output table|json] [--debug]
|
|
81
81
|
|
|
82
82
|
connection list | add | remove | set-default | test
|
|
83
|
-
dataproducts list | get | put | delete
|
|
84
|
-
datacontracts list | get | put | test | delete
|
|
83
|
+
dataproducts list | get | put | delete | import-from-git | gitconnection ...
|
|
84
|
+
datacontracts list | get | put | test | delete | yaml | generate | import-from-git | gitconnection ...
|
|
85
85
|
access list | get | put | delete | approve | reject | cancel
|
|
86
|
-
teams list | get | put | delete
|
|
86
|
+
teams list | get | put | delete | git-credentials ... | notifications ...
|
|
87
87
|
sourcesystems list | get | put | delete
|
|
88
88
|
definitions list | get | put | delete
|
|
89
89
|
certifications list | get | put | delete
|
|
90
90
|
example-data list | get | put | delete
|
|
91
91
|
test-results list | get | publish | delete
|
|
92
92
|
costs list | add | delete
|
|
93
|
-
assets list | get | put | delete
|
|
93
|
+
assets list | get | put | delete | tags ...
|
|
94
94
|
tags list | get | put | delete
|
|
95
95
|
api-keys create | delete
|
|
96
|
-
|
|
96
|
+
connectors list | get | put | delete
|
|
97
|
+
organization get | members ... | git-credentials ...
|
|
98
|
+
settings get-customization | put-customization | get-scim-mapping | put-scim-mapping
|
|
97
99
|
events poll
|
|
98
100
|
lineage list | submit | delete
|
|
99
101
|
search query
|
|
102
|
+
semantics namespaces ... | concepts ... | relationships ... (EXPERIMENTAL)
|
|
100
103
|
usage list | submit | delete
|
|
101
104
|
import zip
|
|
102
105
|
```
|
|
@@ -95,6 +95,7 @@ from entropy_data.commands.api_keys import api_keys_app # noqa: E402
|
|
|
95
95
|
from entropy_data.commands.assets import assets_app # noqa: E402
|
|
96
96
|
from entropy_data.commands.certifications import certifications_app # noqa: E402
|
|
97
97
|
from entropy_data.commands.connection import connection_app # noqa: E402
|
|
98
|
+
from entropy_data.commands.connectors import connectors_app # noqa: E402
|
|
98
99
|
from entropy_data.commands.costs import costs_app # noqa: E402
|
|
99
100
|
from entropy_data.commands.datacontracts import datacontracts_app # noqa: E402
|
|
100
101
|
from entropy_data.commands.dataproducts import dataproducts_app # noqa: E402
|
|
@@ -105,6 +106,7 @@ from entropy_data.commands.import_export import import_app # noqa: E402
|
|
|
105
106
|
from entropy_data.commands.lineage import lineage_app # noqa: E402
|
|
106
107
|
from entropy_data.commands.organization import organization_app # noqa: E402
|
|
107
108
|
from entropy_data.commands.search import search_app # noqa: E402
|
|
109
|
+
from entropy_data.commands.semantics import semantics_app # noqa: E402
|
|
108
110
|
from entropy_data.commands.settings import settings_app # noqa: E402
|
|
109
111
|
from entropy_data.commands.sourcesystems import sourcesystems_app # noqa: E402
|
|
110
112
|
from entropy_data.commands.tags import tags_app # noqa: E402
|
|
@@ -126,10 +128,12 @@ app.add_typer(costs_app, name="costs", help="Manage costs.")
|
|
|
126
128
|
app.add_typer(assets_app, name="assets", help="Manage data assets.")
|
|
127
129
|
app.add_typer(tags_app, name="tags", help="Manage tags.")
|
|
128
130
|
app.add_typer(api_keys_app, name="api-keys", help="Manage API keys.")
|
|
131
|
+
app.add_typer(connectors_app, name="connectors", help="Manage connectors.")
|
|
129
132
|
app.add_typer(organization_app, name="organization", help="Get organization details.")
|
|
130
133
|
app.add_typer(settings_app, name="settings", help="Manage organization settings.")
|
|
131
134
|
app.add_typer(events_app, name="events", help="Poll events.")
|
|
132
135
|
app.add_typer(lineage_app, name="lineage", help="Manage lineage (OpenLineage events).")
|
|
133
136
|
app.add_typer(search_app, name="search", help="Search across resources.")
|
|
137
|
+
app.add_typer(semantics_app, name="semantics", help="EXPERIMENTAL semantics API.")
|
|
134
138
|
app.add_typer(usage_app, name="usage", help="Manage usage (OpenTelemetry traces).")
|
|
135
139
|
app.add_typer(import_app, name="import", help="Import organization exports.")
|
|
@@ -122,13 +122,20 @@ class EntropyDataClient:
|
|
|
122
122
|
return response.headers.get(RESPONSE_HEADER_LOCATION_HTML)
|
|
123
123
|
|
|
124
124
|
def post_action_json(
|
|
125
|
-
self,
|
|
125
|
+
self,
|
|
126
|
+
path: str,
|
|
127
|
+
resource_id: str,
|
|
128
|
+
action: str,
|
|
129
|
+
params: dict | None = None,
|
|
130
|
+
body: dict | None = None,
|
|
131
|
+
timeout: int = REQUEST_TIMEOUT,
|
|
126
132
|
) -> dict:
|
|
127
|
-
"""POST /api/{path}/{id}/{action}
|
|
133
|
+
"""POST /api/{path}/{id}/{action}. Returns response JSON."""
|
|
128
134
|
_validate_resource_id(resource_id)
|
|
129
135
|
response = self.session.post(
|
|
130
136
|
f"{self.base_url}/api/{path}/{resource_id}/{action}",
|
|
131
137
|
params=params,
|
|
138
|
+
json=body if body is not None else None,
|
|
132
139
|
timeout=timeout,
|
|
133
140
|
)
|
|
134
141
|
_raise_for_status(response)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Access (data usage agreements) commands."""
|
|
2
2
|
|
|
3
|
+
import uuid
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
from typing import Annotated, Optional
|
|
5
6
|
|
|
@@ -126,3 +127,77 @@ def cancel_access(
|
|
|
126
127
|
print_link(location)
|
|
127
128
|
except Exception as e:
|
|
128
129
|
handle_error(e)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@access_app.command("request")
|
|
133
|
+
def request_access(
|
|
134
|
+
data_product_id: Annotated[str, typer.Argument(help="Provider data product ID.")],
|
|
135
|
+
output_port_id: Annotated[str, typer.Argument(help="Provider output port ID.")],
|
|
136
|
+
purpose: Annotated[str, typer.Option("--purpose", help="Business justification for the access.")] = ...,
|
|
137
|
+
consumer_team: Annotated[
|
|
138
|
+
Optional[str],
|
|
139
|
+
typer.Option("--consumer-team", help="Consumer team ID (request on behalf of a team)."),
|
|
140
|
+
] = None,
|
|
141
|
+
consumer_user: Annotated[
|
|
142
|
+
Optional[str],
|
|
143
|
+
typer.Option("--consumer-user", help="Consumer user ID (request on behalf of a user)."),
|
|
144
|
+
] = None,
|
|
145
|
+
consumer_dataproduct: Annotated[
|
|
146
|
+
Optional[str],
|
|
147
|
+
typer.Option("--consumer-dataproduct", help="Consumer data product ID (cross-product agreement)."),
|
|
148
|
+
] = None,
|
|
149
|
+
roles: Annotated[
|
|
150
|
+
Optional[str],
|
|
151
|
+
typer.Option("--roles", help="Comma-separated list of roles to request (e.g. analyst,data_engineer)."),
|
|
152
|
+
] = None,
|
|
153
|
+
id: Annotated[
|
|
154
|
+
Optional[str],
|
|
155
|
+
typer.Option("--id", help="Agreement ID. Auto-generated UUID if not provided."),
|
|
156
|
+
] = None,
|
|
157
|
+
) -> None:
|
|
158
|
+
"""Submit an access request for a provider data product output port.
|
|
159
|
+
|
|
160
|
+
Creates a new access agreement in 'requested' state via PUT /api/access/{id}. Exactly
|
|
161
|
+
one of --consumer-team / --consumer-user / --consumer-dataproduct must be specified.
|
|
162
|
+
"""
|
|
163
|
+
from entropy_data.cli import get_client, handle_error
|
|
164
|
+
from entropy_data.output import error_console
|
|
165
|
+
|
|
166
|
+
consumer_count = sum(c is not None for c in (consumer_team, consumer_user, consumer_dataproduct))
|
|
167
|
+
if consumer_count != 1:
|
|
168
|
+
error_console.print(
|
|
169
|
+
"[red]Error: provide exactly one of --consumer-team, --consumer-user, "
|
|
170
|
+
"or --consumer-dataproduct.[/red]"
|
|
171
|
+
)
|
|
172
|
+
raise SystemExit(2)
|
|
173
|
+
|
|
174
|
+
agreement_id = id or str(uuid.uuid4())
|
|
175
|
+
consumer: dict = {}
|
|
176
|
+
if consumer_team is not None:
|
|
177
|
+
consumer["teamId"] = consumer_team
|
|
178
|
+
if consumer_user is not None:
|
|
179
|
+
consumer["userId"] = consumer_user
|
|
180
|
+
if consumer_dataproduct is not None:
|
|
181
|
+
consumer["dataProductId"] = consumer_dataproduct
|
|
182
|
+
|
|
183
|
+
body: dict = {
|
|
184
|
+
"id": agreement_id,
|
|
185
|
+
"provider": {
|
|
186
|
+
"dataProductId": data_product_id,
|
|
187
|
+
"outputPortId": output_port_id,
|
|
188
|
+
},
|
|
189
|
+
"consumer": consumer,
|
|
190
|
+
"info": {
|
|
191
|
+
"purpose": purpose,
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
if roles:
|
|
195
|
+
body["roles"] = [r.strip() for r in roles.split(",") if r.strip()]
|
|
196
|
+
|
|
197
|
+
try:
|
|
198
|
+
client = get_client()
|
|
199
|
+
location = client.put_resource(RESOURCE_PATH, agreement_id, body)
|
|
200
|
+
print_success(f"Access request '{agreement_id}' submitted.")
|
|
201
|
+
print_link(location)
|
|
202
|
+
except Exception as e:
|
|
203
|
+
handle_error(e)
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"""Assets commands."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Annotated, Optional
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
|
|
9
|
+
from entropy_data.output import OutputFormat, console, print_link, print_resource, print_resource_list, print_success
|
|
10
|
+
from entropy_data.util import read_body
|
|
11
|
+
|
|
12
|
+
assets_app = typer.Typer(no_args_is_help=True)
|
|
13
|
+
tags_app = typer.Typer(no_args_is_help=True)
|
|
14
|
+
RESOURCE_PATH = "assets"
|
|
15
|
+
RESOURCE_TYPE = "assets"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@assets_app.command("list")
|
|
19
|
+
def list_assets(
|
|
20
|
+
page: Annotated[int, typer.Option("--page", "-p", help="Page number (0-indexed).")] = 0,
|
|
21
|
+
output: Annotated[Optional[OutputFormat], typer.Option("--output", "-o", help="Output format.")] = None,
|
|
22
|
+
) -> None:
|
|
23
|
+
"""List all data assets."""
|
|
24
|
+
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
25
|
+
|
|
26
|
+
fmt = output or get_output_format()
|
|
27
|
+
try:
|
|
28
|
+
client = get_client()
|
|
29
|
+
data, has_next = client.list_resources(RESOURCE_PATH, params={"p": page})
|
|
30
|
+
print_resource_list(data, RESOURCE_TYPE, fmt, has_next_page=has_next, page=page)
|
|
31
|
+
except Exception as e:
|
|
32
|
+
handle_error(e)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@assets_app.command("get")
|
|
36
|
+
def get_asset(
|
|
37
|
+
id: Annotated[str, typer.Argument(help="Asset ID.")],
|
|
38
|
+
output: Annotated[Optional[OutputFormat], typer.Option("--output", "-o", help="Output format.")] = None,
|
|
39
|
+
) -> None:
|
|
40
|
+
"""Get a data asset by ID."""
|
|
41
|
+
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
42
|
+
|
|
43
|
+
fmt = output or get_output_format()
|
|
44
|
+
try:
|
|
45
|
+
client = get_client()
|
|
46
|
+
data = client.get_resource(RESOURCE_PATH, id)
|
|
47
|
+
print_resource(data, RESOURCE_TYPE, fmt)
|
|
48
|
+
except Exception as e:
|
|
49
|
+
handle_error(e)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@assets_app.command("put")
|
|
53
|
+
def put_asset(
|
|
54
|
+
id: Annotated[str, typer.Argument(help="Asset ID.")],
|
|
55
|
+
file: Annotated[Path, typer.Option("--file", "-f", help="JSON or YAML file (use - for stdin).")] = ...,
|
|
56
|
+
) -> None:
|
|
57
|
+
"""Create or update a data asset."""
|
|
58
|
+
from entropy_data.cli import get_client, handle_error
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
body = read_body(file)
|
|
62
|
+
client = get_client()
|
|
63
|
+
location = client.put_resource(RESOURCE_PATH, id, body)
|
|
64
|
+
print_success(f"Asset '{id}' saved.")
|
|
65
|
+
print_link(location)
|
|
66
|
+
except Exception as e:
|
|
67
|
+
handle_error(e)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@assets_app.command("delete")
|
|
71
|
+
def delete_asset(
|
|
72
|
+
id: Annotated[str, typer.Argument(help="Asset ID.")],
|
|
73
|
+
) -> None:
|
|
74
|
+
"""Delete a data asset."""
|
|
75
|
+
from entropy_data.cli import get_client, handle_error
|
|
76
|
+
|
|
77
|
+
try:
|
|
78
|
+
client = get_client()
|
|
79
|
+
client.delete_resource(RESOURCE_PATH, id)
|
|
80
|
+
print_success(f"Asset '{id}' deleted.")
|
|
81
|
+
except Exception as e:
|
|
82
|
+
handle_error(e)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@tags_app.command("list")
|
|
86
|
+
def list_asset_tags(
|
|
87
|
+
asset_id: Annotated[str, typer.Argument(help="Asset ID.")],
|
|
88
|
+
output: Annotated[Optional[OutputFormat], typer.Option("--output", "-o", help="Output format.")] = None,
|
|
89
|
+
) -> None:
|
|
90
|
+
"""List tags assigned to an asset."""
|
|
91
|
+
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
92
|
+
from entropy_data.client import REQUEST_TIMEOUT, _raise_for_status, _validate_resource_id
|
|
93
|
+
|
|
94
|
+
fmt = output or get_output_format()
|
|
95
|
+
try:
|
|
96
|
+
client = get_client()
|
|
97
|
+
_validate_resource_id(asset_id)
|
|
98
|
+
response = client.session.get(
|
|
99
|
+
f"{client.base_url}/api/assets/{asset_id}/assigned-tags",
|
|
100
|
+
timeout=REQUEST_TIMEOUT,
|
|
101
|
+
)
|
|
102
|
+
_raise_for_status(response)
|
|
103
|
+
data = response.json()
|
|
104
|
+
if fmt == OutputFormat.json:
|
|
105
|
+
console.print_json(json.dumps(data))
|
|
106
|
+
else:
|
|
107
|
+
for tag in data:
|
|
108
|
+
console.print(tag)
|
|
109
|
+
except Exception as e:
|
|
110
|
+
handle_error(e)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@tags_app.command("add")
|
|
114
|
+
def add_asset_tag(
|
|
115
|
+
asset_id: Annotated[str, typer.Argument(help="Asset ID.")],
|
|
116
|
+
tag_id: Annotated[str, typer.Argument(help="Tag ID (may be hierarchical, e.g. governance/PII).")],
|
|
117
|
+
) -> None:
|
|
118
|
+
"""Assign a tag to an asset."""
|
|
119
|
+
from entropy_data.cli import get_client, handle_error
|
|
120
|
+
from entropy_data.client import REQUEST_TIMEOUT, _raise_for_status, _validate_resource_id
|
|
121
|
+
|
|
122
|
+
try:
|
|
123
|
+
client = get_client()
|
|
124
|
+
_validate_resource_id(asset_id)
|
|
125
|
+
# tag_id can contain "/" (e.g. governance/PII) so we don't run it through the
|
|
126
|
+
# path-traversal-rejecting validator; the server validates anyway.
|
|
127
|
+
response = client.session.put(
|
|
128
|
+
f"{client.base_url}/api/assets/{asset_id}/assigned-tags/{tag_id}",
|
|
129
|
+
timeout=REQUEST_TIMEOUT,
|
|
130
|
+
)
|
|
131
|
+
_raise_for_status(response)
|
|
132
|
+
print_success(f"Tag '{tag_id}' assigned to asset '{asset_id}'.")
|
|
133
|
+
except Exception as e:
|
|
134
|
+
handle_error(e)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@tags_app.command("remove")
|
|
138
|
+
def remove_asset_tag(
|
|
139
|
+
asset_id: Annotated[str, typer.Argument(help="Asset ID.")],
|
|
140
|
+
tag_id: Annotated[str, typer.Argument(help="Tag ID (may be hierarchical, e.g. governance/PII).")],
|
|
141
|
+
) -> None:
|
|
142
|
+
"""Unassign a tag from an asset."""
|
|
143
|
+
from entropy_data.cli import get_client, handle_error
|
|
144
|
+
from entropy_data.client import REQUEST_TIMEOUT, _raise_for_status, _validate_resource_id
|
|
145
|
+
|
|
146
|
+
try:
|
|
147
|
+
client = get_client()
|
|
148
|
+
_validate_resource_id(asset_id)
|
|
149
|
+
response = client.session.delete(
|
|
150
|
+
f"{client.base_url}/api/assets/{asset_id}/assigned-tags/{tag_id}",
|
|
151
|
+
timeout=REQUEST_TIMEOUT,
|
|
152
|
+
)
|
|
153
|
+
_raise_for_status(response)
|
|
154
|
+
print_success(f"Tag '{tag_id}' removed from asset '{asset_id}'.")
|
|
155
|
+
except Exception as e:
|
|
156
|
+
handle_error(e)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
assets_app.add_typer(tags_app, name="tags", help="Manage tag assignments on an asset.")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Connectors commands."""
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import Annotated, Optional
|
|
@@ -8,34 +8,33 @@ import typer
|
|
|
8
8
|
from entropy_data.output import OutputFormat, print_link, print_resource, print_resource_list, print_success
|
|
9
9
|
from entropy_data.util import read_body
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
RESOURCE_PATH = "
|
|
13
|
-
RESOURCE_TYPE = "
|
|
11
|
+
connectors_app = typer.Typer(no_args_is_help=True)
|
|
12
|
+
RESOURCE_PATH = "connectors"
|
|
13
|
+
RESOURCE_TYPE = "connectors"
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
@
|
|
17
|
-
def
|
|
18
|
-
page: Annotated[int, typer.Option("--page", "-p", help="Page number (0-indexed).")] = 0,
|
|
16
|
+
@connectors_app.command("list")
|
|
17
|
+
def list_connectors(
|
|
19
18
|
output: Annotated[Optional[OutputFormat], typer.Option("--output", "-o", help="Output format.")] = None,
|
|
20
19
|
) -> None:
|
|
21
|
-
"""List all
|
|
20
|
+
"""List all connectors."""
|
|
22
21
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
23
22
|
|
|
24
23
|
fmt = output or get_output_format()
|
|
25
24
|
try:
|
|
26
25
|
client = get_client()
|
|
27
|
-
data,
|
|
28
|
-
print_resource_list(data, RESOURCE_TYPE, fmt
|
|
26
|
+
data, _ = client.list_resources(RESOURCE_PATH)
|
|
27
|
+
print_resource_list(data, RESOURCE_TYPE, fmt)
|
|
29
28
|
except Exception as e:
|
|
30
29
|
handle_error(e)
|
|
31
30
|
|
|
32
31
|
|
|
33
|
-
@
|
|
34
|
-
def
|
|
35
|
-
id: Annotated[str, typer.Argument(help="
|
|
32
|
+
@connectors_app.command("get")
|
|
33
|
+
def get_connector(
|
|
34
|
+
id: Annotated[str, typer.Argument(help="Connector ID.")],
|
|
36
35
|
output: Annotated[Optional[OutputFormat], typer.Option("--output", "-o", help="Output format.")] = None,
|
|
37
36
|
) -> None:
|
|
38
|
-
"""Get a
|
|
37
|
+
"""Get a connector by ID."""
|
|
39
38
|
from entropy_data.cli import get_client, get_output_format, handle_error
|
|
40
39
|
|
|
41
40
|
fmt = output or get_output_format()
|
|
@@ -47,34 +46,34 @@ def get_team(
|
|
|
47
46
|
handle_error(e)
|
|
48
47
|
|
|
49
48
|
|
|
50
|
-
@
|
|
51
|
-
def
|
|
52
|
-
id: Annotated[str, typer.Argument(help="
|
|
49
|
+
@connectors_app.command("put")
|
|
50
|
+
def put_connector(
|
|
51
|
+
id: Annotated[str, typer.Argument(help="Connector ID.")],
|
|
53
52
|
file: Annotated[Path, typer.Option("--file", "-f", help="JSON or YAML file (use - for stdin).")] = ...,
|
|
54
53
|
) -> None:
|
|
55
|
-
"""Create or update a
|
|
54
|
+
"""Create or update a connector."""
|
|
56
55
|
from entropy_data.cli import get_client, handle_error
|
|
57
56
|
|
|
58
57
|
try:
|
|
59
58
|
body = read_body(file)
|
|
60
59
|
client = get_client()
|
|
61
60
|
location = client.put_resource(RESOURCE_PATH, id, body)
|
|
62
|
-
print_success(f"
|
|
61
|
+
print_success(f"Connector '{id}' saved.")
|
|
63
62
|
print_link(location)
|
|
64
63
|
except Exception as e:
|
|
65
64
|
handle_error(e)
|
|
66
65
|
|
|
67
66
|
|
|
68
|
-
@
|
|
69
|
-
def
|
|
70
|
-
id: Annotated[str, typer.Argument(help="
|
|
67
|
+
@connectors_app.command("delete")
|
|
68
|
+
def delete_connector(
|
|
69
|
+
id: Annotated[str, typer.Argument(help="Connector ID.")],
|
|
71
70
|
) -> None:
|
|
72
|
-
"""Delete a
|
|
71
|
+
"""Delete a connector."""
|
|
73
72
|
from entropy_data.cli import get_client, handle_error
|
|
74
73
|
|
|
75
74
|
try:
|
|
76
75
|
client = get_client()
|
|
77
76
|
client.delete_resource(RESOURCE_PATH, id)
|
|
78
|
-
print_success(f"
|
|
77
|
+
print_success(f"Connector '{id}' deleted.")
|
|
79
78
|
except Exception as e:
|
|
80
79
|
handle_error(e)
|