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
  •  
  •  
  •  
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.44rc1"
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",
]
Binary file added src/tower-0.3.44rc1.data/scripts/tower
Binary file not shown.
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
39 changes: 19 additions & 20 deletions src/tower/tower_api_client/api/default/activate_schedules.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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.batch_schedule_params import BatchScheduleParams
from ...models.batch_schedule_response import BatchScheduleResponse
from ...models.error_model import ErrorModel
from ...types import Response


Expand All @@ -21,31 +21,30 @@ def _get_kwargs(
"url": "/schedules/activate",
}

_body = body.to_dict()
_kwargs["json"] = body.to_dict()

_kwargs["json"] = _body
headers["Content-Type"] = "application/json"

_kwargs["headers"] = headers
return _kwargs


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[BatchScheduleResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> BatchScheduleResponse | ErrorModel:
if response.status_code == 200:
response_200 = BatchScheduleResponse.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[BatchScheduleResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[BatchScheduleResponse | ErrorModel]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -58,7 +57,7 @@ def sync_detailed(
*,
client: AuthenticatedClient,
body: BatchScheduleParams,
) -> Response[BatchScheduleResponse]:
) -> Response[BatchScheduleResponse | ErrorModel]:
"""Activate multiple schedules

Activate multiple schedules to enable their execution.
Expand All @@ -71,7 +70,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

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

kwargs = _get_kwargs(
Expand All @@ -89,7 +88,7 @@ def sync(
*,
client: AuthenticatedClient,
body: BatchScheduleParams,
) -> Optional[BatchScheduleResponse]:
) -> BatchScheduleResponse | ErrorModel | None:
"""Activate multiple schedules

Activate multiple schedules to enable their execution.
Expand All @@ -102,7 +101,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
BatchScheduleResponse
BatchScheduleResponse | ErrorModel
"""

return sync_detailed(
Expand All @@ -115,7 +114,7 @@ async def asyncio_detailed(
*,
client: AuthenticatedClient,
body: BatchScheduleParams,
) -> Response[BatchScheduleResponse]:
) -> Response[BatchScheduleResponse | ErrorModel]:
"""Activate multiple schedules

Activate multiple schedules to enable their execution.
Expand All @@ -128,7 +127,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

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

kwargs = _get_kwargs(
Expand All @@ -144,7 +143,7 @@ async def asyncio(
*,
client: AuthenticatedClient,
body: BatchScheduleParams,
) -> Optional[BatchScheduleResponse]:
) -> BatchScheduleResponse | ErrorModel | None:
"""Activate multiple schedules

Activate multiple schedules to enable their execution.
Expand All @@ -157,7 +156,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
BatchScheduleResponse
BatchScheduleResponse | ErrorModel
"""

return (
Expand Down
Loading
Loading