Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

- Replace `entropy-data organization custom-team-roles ...` and the interim `organization team-roles-mode` command with `entropy-data settings team-roles get|put`. The configuration is now a single aggregate payload — `{mode: default}` or `{mode: custom-team-roles, team-roles: [...]}` — wrapping the new `GET`/`PUT /api/settings/team-roles`. `put` replaces the whole catalog when mode is `custom-team-roles`; an empty catalog or dropping a role still assigned to a member is rejected with 409.

## [0.3.14]

- `integrations` commands now address an integration by its `externalId` only; the internal UUID is no longer accepted. The API is now externalId-native — every path keys on `externalId` (`GET /api/integrations/{externalId}`, `.../runs`, `.../run`, `.../cancel`) and responses no longer return the internal `ingestionId`. Run and trigger output reference their integration via `integrationExternalId`. Display `name` is still accepted and resolved client-side.
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ entropy-data datacontracts list --output json
# Create or update a team from a YAML file
entropy-data teams put marketing --file team.yaml

# Show the team roles configuration, or switch to a custom role catalog
entropy-data settings team-roles get
entropy-data settings team-roles put --file team-roles.yaml

# Approve an access agreement
entropy-data access approve 640864de-83d4-4619-afba-ccea8037ed3a

Expand Down Expand Up @@ -98,8 +102,8 @@ entropy-data [--version] [--connection NAME] [--output table|json|yaml] [--debug
api-keys create | delete
connectors list | get | put | delete
integrations list | get | runs | runs-get | runs-latest | run | cancel
organization get | members ... | git-credentials ... | custom-team-roles ...
settings get-customization | put-customization | get-scim-mapping | put-scim-mapping
organization get | members ... | git-credentials ...
settings get-customization | put-customization | get-scim-mapping | put-scim-mapping | team-roles ...
events poll
lineage list | submit | delete
search query
Expand Down
161 changes: 0 additions & 161 deletions src/entropy_data/commands/custom_team_roles.py

This file was deleted.

7 changes: 0 additions & 7 deletions src/entropy_data/commands/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,10 @@ def get_member(
organization_app.add_typer(members_app, name="members", help="Manage organization members.")


from entropy_data.commands.custom_team_roles import custom_team_roles_app # noqa: E402
from entropy_data.commands.git_credentials import make_git_credentials_app # noqa: E402

organization_app.add_typer(
make_git_credentials_app("organization"),
name="git-credentials",
help="Manage organization-level git credentials.",
)

organization_app.add_typer(
custom_team_roles_app,
name="custom-team-roles",
help="Manage organization-level custom team roles.",
)
76 changes: 75 additions & 1 deletion src/entropy_data/commands/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
from typing import Annotated, Optional

import typer
from rich.table import Table

from entropy_data.output import OutputFormat, console, print_success
from entropy_data.output import OutputFormat, console, print_data, print_success
from entropy_data.util import read_body

settings_app = typer.Typer(no_args_is_help=True)
team_roles_app = typer.Typer(no_args_is_help=True)


@settings_app.command("get-customization")
Expand Down Expand Up @@ -109,3 +112,74 @@ def _put_yaml_or_json(client, path: str, file: Path) -> None:
timeout=REQUEST_TIMEOUT,
)
_raise_for_status(response)


@team_roles_app.command("get")
def get_team_roles(
output: Annotated[Optional[OutputFormat], typer.Option("--output", "-o", help="Output format.")] = None,
) -> None:
"""Show the team roles configuration (default roles or the custom catalog)."""
from entropy_data.cli import get_client, get_output_format, handle_error
from entropy_data.client import REQUEST_TIMEOUT, _raise_for_status

fmt = output or get_output_format()
try:
client = get_client()
response = client.session.get(f"{client.base_url}/api/settings/team-roles", timeout=REQUEST_TIMEOUT)
_raise_for_status(response)
data = response.json()
if fmt != OutputFormat.table:
print_data(data, fmt)
return

console.print(f"mode: [cyan]{data.get('mode', '')}[/cyan]")
roles = data.get("team-roles") or []
if roles:
table = Table()
table.add_column("name", style="cyan")
table.add_column("rank")
table.add_column("permissions")
for role in roles:
table.add_row(
str(role.get("name", "")),
str(role.get("rank", "")),
", ".join(role.get("permissions", []) or []),
)
console.print(table)
except Exception as e:
handle_error(e)


@team_roles_app.command("put")
def put_team_roles(
file: Annotated[Path, typer.Option("--file", "-f", help="JSON or YAML file with the body (use - for stdin).")] = ...,
) -> None:
"""Set the team roles configuration.

The body is the aggregate payload, e.g. `{"mode": "default"}` or
`{"mode": "custom-team-roles", "team-roles": [ ... ]}`. With `custom-team-roles`
the listed roles replace the whole catalog; an empty list is rejected with 409.
"""
from entropy_data.cli import get_client, handle_error
from entropy_data.client import REQUEST_TIMEOUT, _raise_for_status

try:
body = read_body(file)
client = get_client()
response = client.session.put(
f"{client.base_url}/api/settings/team-roles",
json=body,
timeout=REQUEST_TIMEOUT,
)
_raise_for_status(response)
mode = response.json().get("mode", "")
print_success(f"Team roles configuration saved (mode: {mode}).")
except Exception as e:
handle_error(e)


settings_app.add_typer(
team_roles_app,
name="team-roles",
help="Get or set the organization's team roles configuration.",
)
Loading
Loading