Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,14 @@ jobs:
name: Test wheel
with:
arch: ${{ matrix.platform.arch == 'arm' && 'armv6' || matrix.platform.arch }}
distro: ${{ matrix.platform.arch == 'arm' && 'bullseye' || 'ubuntu22.04' }}
distro: ${{ matrix.platform.arch == 'arm' && 'bookworm' || 'ubuntu22.04' }}
githubToken: ${{ github.token }}
# Use sparse registry to avoid 32-bit file size limits (!)
env: |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip python3-venv python3-dev cargo libffi-dev
pip3 install -U pip
# Create and use a virtual environment to avoid the externally-managed-environment error
run: |
python3 -m venv /tmp/venv
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ pytest.ini

# from nix builds
/result

# wheel build artifacts
*.data/
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = "0.3.46"
description = "Tower CLI and runtime environment for Tower."
authors = [{ name = "Tower Computing Inc.", email = "brad@tower.dev" }]
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.10"
license = { file = "LICENSE" }
keywords = [
"automation",
Expand All @@ -25,7 +25,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down Expand Up @@ -96,7 +95,7 @@ dev = [
{ include-group = "test" },
"black==24.10.0",
"mypy==1.13.0",
"openapi-python-client==0.24.3",
"openapi-python-client==0.28.1",
"pre-commit==4.0.1",
"pyiceberg[sql-sqlite]==0.9.1",
]
39 changes: 20 additions & 19 deletions src/tower/tower_api_client/api/default/acknowledge_alert.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from http import HTTPStatus
from typing import Any, Optional, Union
from typing import Any
from urllib.parse import quote

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.acknowledge_alert_response import AcknowledgeAlertResponse
from ...models.error_model import ErrorModel
from ...types import Response


Expand All @@ -15,29 +16,29 @@ def _get_kwargs(
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/alerts/{alert_seq}/acknowledge".format(
alert_seq=alert_seq,
alert_seq=quote(str(alert_seq), safe=""),
),
}

return _kwargs


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[AcknowledgeAlertResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> AcknowledgeAlertResponse | ErrorModel:
if response.status_code == 200:
response_200 = AcknowledgeAlertResponse.from_dict(response.json())

return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None

response_default = ErrorModel.from_dict(response.json())

return response_default


def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[AcknowledgeAlertResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[AcknowledgeAlertResponse | ErrorModel]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -50,7 +51,7 @@ def sync_detailed(
alert_seq: int,
*,
client: AuthenticatedClient,
) -> Response[AcknowledgeAlertResponse]:
) -> Response[AcknowledgeAlertResponse | ErrorModel]:
"""Acknowledge alert

Mark an alert as acknowledged
Expand All @@ -63,7 +64,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[AcknowledgeAlertResponse]
Response[AcknowledgeAlertResponse | ErrorModel]
"""

kwargs = _get_kwargs(
Expand All @@ -81,7 +82,7 @@ def sync(
alert_seq: int,
*,
client: AuthenticatedClient,
) -> Optional[AcknowledgeAlertResponse]:
) -> AcknowledgeAlertResponse | ErrorModel | None:
"""Acknowledge alert

Mark an alert as acknowledged
Expand All @@ -94,7 +95,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
AcknowledgeAlertResponse
AcknowledgeAlertResponse | ErrorModel
"""

return sync_detailed(
Expand All @@ -107,7 +108,7 @@ async def asyncio_detailed(
alert_seq: int,
*,
client: AuthenticatedClient,
) -> Response[AcknowledgeAlertResponse]:
) -> Response[AcknowledgeAlertResponse | ErrorModel]:
"""Acknowledge alert

Mark an alert as acknowledged
Expand All @@ -120,7 +121,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[AcknowledgeAlertResponse]
Response[AcknowledgeAlertResponse | ErrorModel]
"""

kwargs = _get_kwargs(
Expand All @@ -136,7 +137,7 @@ async def asyncio(
alert_seq: int,
*,
client: AuthenticatedClient,
) -> Optional[AcknowledgeAlertResponse]:
) -> AcknowledgeAlertResponse | ErrorModel | None:
"""Acknowledge alert

Mark an alert as acknowledged
Expand All @@ -149,7 +150,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
AcknowledgeAlertResponse
AcknowledgeAlertResponse | ErrorModel
"""

return (
Expand Down
36 changes: 18 additions & 18 deletions src/tower/tower_api_client/api/default/acknowledge_all_alerts.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from http import HTTPStatus
from typing import Any, Optional, Union
from typing import Any

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.acknowledge_all_alerts_response import AcknowledgeAllAlertsResponse
from ...models.error_model import ErrorModel
from ...types import Response


Expand All @@ -19,21 +19,21 @@ def _get_kwargs() -> dict[str, Any]:


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[AcknowledgeAllAlertsResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> AcknowledgeAllAlertsResponse | ErrorModel:
if response.status_code == 200:
response_200 = AcknowledgeAllAlertsResponse.from_dict(response.json())

return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None

response_default = ErrorModel.from_dict(response.json())

return response_default


def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[AcknowledgeAllAlertsResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[AcknowledgeAllAlertsResponse | ErrorModel]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -45,7 +45,7 @@ def _build_response(
def sync_detailed(
*,
client: AuthenticatedClient,
) -> Response[AcknowledgeAllAlertsResponse]:
) -> Response[AcknowledgeAllAlertsResponse | ErrorModel]:
"""Acknowledge all alerts

Mark all unacknowledged alerts as acknowledged for the current user in the current account
Expand All @@ -55,7 +55,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[AcknowledgeAllAlertsResponse]
Response[AcknowledgeAllAlertsResponse | ErrorModel]
"""

kwargs = _get_kwargs()
Expand All @@ -70,7 +70,7 @@ def sync_detailed(
def sync(
*,
client: AuthenticatedClient,
) -> Optional[AcknowledgeAllAlertsResponse]:
) -> AcknowledgeAllAlertsResponse | ErrorModel | None:
"""Acknowledge all alerts

Mark all unacknowledged alerts as acknowledged for the current user in the current account
Expand All @@ -80,7 +80,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
AcknowledgeAllAlertsResponse
AcknowledgeAllAlertsResponse | ErrorModel
"""

return sync_detailed(
Expand All @@ -91,7 +91,7 @@ def sync(
async def asyncio_detailed(
*,
client: AuthenticatedClient,
) -> Response[AcknowledgeAllAlertsResponse]:
) -> Response[AcknowledgeAllAlertsResponse | ErrorModel]:
"""Acknowledge all alerts

Mark all unacknowledged alerts as acknowledged for the current user in the current account
Expand All @@ -101,7 +101,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[AcknowledgeAllAlertsResponse]
Response[AcknowledgeAllAlertsResponse | ErrorModel]
"""

kwargs = _get_kwargs()
Expand All @@ -114,7 +114,7 @@ async def asyncio_detailed(
async def asyncio(
*,
client: AuthenticatedClient,
) -> Optional[AcknowledgeAllAlertsResponse]:
) -> AcknowledgeAllAlertsResponse | ErrorModel | None:
"""Acknowledge all alerts

Mark all unacknowledged alerts as acknowledged for the current user in the current account
Expand All @@ -124,7 +124,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
AcknowledgeAllAlertsResponse
AcknowledgeAllAlertsResponse | ErrorModel
"""

return (
Expand Down
Loading
Loading