Skip to content
Closed
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
Empty file.
127 changes: 127 additions & 0 deletions fishjam/_openapi_client/api/default/drain_node.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union, cast

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.error import Error
from ...types import Response


def _get_kwargs() -> Dict[str, Any]:
return {
"method": "post",
"url": "/admin/shutdown/drain",
}


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Any, Error]]:
if response.status_code == HTTPStatus.OK:
response_200 = cast(Any, None)
return response_200
if response.status_code == HTTPStatus.UNAUTHORIZED:
response_401 = Error.from_dict(response.json())

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


def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Any, Error]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
*,
client: AuthenticatedClient,
) -> Response[Union[Any, Error]]:
"""Marks node as draining, making it the last in the load balancing order.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Any, Error]]
"""

kwargs = _get_kwargs()

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
*,
client: AuthenticatedClient,
) -> Optional[Union[Any, Error]]:
"""Marks node as draining, making it the last in the load balancing order.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Union[Any, Error]
"""

return sync_detailed(
client=client,
).parsed


async def asyncio_detailed(
*,
client: AuthenticatedClient,
) -> Response[Union[Any, Error]]:
"""Marks node as draining, making it the last in the load balancing order.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Any, Error]]
"""

kwargs = _get_kwargs()

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
*,
client: AuthenticatedClient,
) -> Optional[Union[Any, Error]]:
"""Marks node as draining, making it the last in the load balancing order.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Union[Any, Error]
"""

return (
await asyncio_detailed(
client=client,
)
).parsed
129 changes: 129 additions & 0 deletions fishjam/_openapi_client/api/default/shutdown_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.error import Error
from ...models.shutdown_status_response import ShutdownStatusResponse
from ...types import Response


def _get_kwargs() -> Dict[str, Any]:
return {
"method": "get",
"url": "/admin/shutdown/status",
}


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Error, ShutdownStatusResponse]]:
if response.status_code == HTTPStatus.OK:
response_200 = ShutdownStatusResponse.from_dict(response.json())

return response_200
if response.status_code == HTTPStatus.UNAUTHORIZED:
response_401 = Error.from_dict(response.json())

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


def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Error, ShutdownStatusResponse]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
*,
client: AuthenticatedClient,
) -> Response[Union[Error, ShutdownStatusResponse]]:
"""Returns status information for the shutdown process of Fishjam.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Error, ShutdownStatusResponse]]
"""

kwargs = _get_kwargs()

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
*,
client: AuthenticatedClient,
) -> Optional[Union[Error, ShutdownStatusResponse]]:
"""Returns status information for the shutdown process of Fishjam.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Union[Error, ShutdownStatusResponse]
"""

return sync_detailed(
client=client,
).parsed


async def asyncio_detailed(
*,
client: AuthenticatedClient,
) -> Response[Union[Error, ShutdownStatusResponse]]:
"""Returns status information for the shutdown process of Fishjam.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Error, ShutdownStatusResponse]]
"""

kwargs = _get_kwargs()

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
*,
client: AuthenticatedClient,
) -> Optional[Union[Error, ShutdownStatusResponse]]:
"""Returns status information for the shutdown process of Fishjam.

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Union[Error, ShutdownStatusResponse]
"""

return (
await asyncio_detailed(
client=client,
)
).parsed
Empty file.
129 changes: 129 additions & 0 deletions fishjam/_openapi_client/api/health/healthcheck.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.error import Error
from ...models.healthcheck_response import HealthcheckResponse
from ...types import Response


def _get_kwargs() -> Dict[str, Any]:
return {
"method": "get",
"url": "/admin/health",
}


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[Union[Error, HealthcheckResponse]]:
if response.status_code == HTTPStatus.OK:
response_200 = HealthcheckResponse.from_dict(response.json())

return response_200
if response.status_code == HTTPStatus.UNAUTHORIZED:
response_401 = Error.from_dict(response.json())

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


def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[Union[Error, HealthcheckResponse]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
*,
client: AuthenticatedClient,
) -> Response[Union[Error, HealthcheckResponse]]:
"""Describes the health of Fishjam

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Error, HealthcheckResponse]]
"""

kwargs = _get_kwargs()

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
*,
client: AuthenticatedClient,
) -> Optional[Union[Error, HealthcheckResponse]]:
"""Describes the health of Fishjam

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Union[Error, HealthcheckResponse]
"""

return sync_detailed(
client=client,
).parsed


async def asyncio_detailed(
*,
client: AuthenticatedClient,
) -> Response[Union[Error, HealthcheckResponse]]:
"""Describes the health of Fishjam

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Union[Error, HealthcheckResponse]]
"""

kwargs = _get_kwargs()

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
*,
client: AuthenticatedClient,
) -> Optional[Union[Error, HealthcheckResponse]]:
"""Describes the health of Fishjam

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Union[Error, HealthcheckResponse]
"""

return (
await asyncio_detailed(
client=client,
)
).parsed
Empty file.
Loading
Loading