diff --git a/nuon/api/installs/get_workflows.py b/nuon/api/installs/get_workflows.py index 20fd4f4c..1f5a6836 100644 --- a/nuon/api/installs/get_workflows.py +++ b/nuon/api/installs/get_workflows.py @@ -22,6 +22,7 @@ def _get_kwargs( finished: bool | Unset = UNSET, created_at_gte: str | Unset = UNSET, created_at_lte: str | Unset = UNSET, + search: str | Unset = UNSET, ) -> dict[str, Any]: params: dict[str, Any] = {} @@ -42,6 +43,8 @@ def _get_kwargs( params["created_at_lte"] = created_at_lte + params["search"] = search + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} _kwargs: dict[str, Any] = { @@ -122,6 +125,7 @@ def sync_detailed( finished: bool | Unset = UNSET, created_at_gte: str | Unset = UNSET, created_at_lte: str | Unset = UNSET, + search: str | Unset = UNSET, ) -> Response[StderrErrResponse | list[AppWorkflow]]: """get workflows @@ -137,6 +141,7 @@ def sync_detailed( finished (bool | Unset): created_at_gte (str | Unset): created_at_lte (str | Unset): + search (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -156,6 +161,7 @@ def sync_detailed( finished=finished, created_at_gte=created_at_gte, created_at_lte=created_at_lte, + search=search, ) response = client.get_httpx_client().request( @@ -177,6 +183,7 @@ def sync( finished: bool | Unset = UNSET, created_at_gte: str | Unset = UNSET, created_at_lte: str | Unset = UNSET, + search: str | Unset = UNSET, ) -> StderrErrResponse | list[AppWorkflow] | None: """get workflows @@ -192,6 +199,7 @@ def sync( finished (bool | Unset): created_at_gte (str | Unset): created_at_lte (str | Unset): + search (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -212,6 +220,7 @@ def sync( finished=finished, created_at_gte=created_at_gte, created_at_lte=created_at_lte, + search=search, ).parsed @@ -227,6 +236,7 @@ async def asyncio_detailed( finished: bool | Unset = UNSET, created_at_gte: str | Unset = UNSET, created_at_lte: str | Unset = UNSET, + search: str | Unset = UNSET, ) -> Response[StderrErrResponse | list[AppWorkflow]]: """get workflows @@ -242,6 +252,7 @@ async def asyncio_detailed( finished (bool | Unset): created_at_gte (str | Unset): created_at_lte (str | Unset): + search (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -261,6 +272,7 @@ async def asyncio_detailed( finished=finished, created_at_gte=created_at_gte, created_at_lte=created_at_lte, + search=search, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -280,6 +292,7 @@ async def asyncio( finished: bool | Unset = UNSET, created_at_gte: str | Unset = UNSET, created_at_lte: str | Unset = UNSET, + search: str | Unset = UNSET, ) -> StderrErrResponse | list[AppWorkflow] | None: """get workflows @@ -295,6 +308,7 @@ async def asyncio( finished (bool | Unset): created_at_gte (str | Unset): created_at_lte (str | Unset): + search (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -316,5 +330,6 @@ async def asyncio( finished=finished, created_at_gte=created_at_gte, created_at_lte=created_at_lte, + search=search, ) ).parsed diff --git a/nuon/api/runbooks/__init__.py b/nuon/api/runbooks/__init__.py new file mode 100644 index 00000000..2d7c0b23 --- /dev/null +++ b/nuon/api/runbooks/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/nuon/api/runbooks/create_runbook.py b/nuon/api/runbooks/create_runbook.py new file mode 100644 index 00000000..0235f3cf --- /dev/null +++ b/nuon/api/runbooks/create_runbook.py @@ -0,0 +1,202 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_runbook import AppRunbook +from ...models.service_create_runbook_request import ServiceCreateRunbookRequest +from ...models.stderr_err_response import StderrErrResponse +from ...types import Response + + +def _get_kwargs( + app_id: str, + *, + body: ServiceCreateRunbookRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/apps/{app_id}/runbooks".format( + app_id=quote(str(app_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AppRunbook | StderrErrResponse | None: + if response.status_code == 201: + response_201 = AppRunbook.from_dict(response.json()) + + return response_201 + + if response.status_code == 400: + response_400 = StderrErrResponse.from_dict(response.json()) + + return response_400 + + if response.status_code == 401: + response_401 = StderrErrResponse.from_dict(response.json()) + + return response_401 + + if response.status_code == 403: + response_403 = StderrErrResponse.from_dict(response.json()) + + return response_403 + + if response.status_code == 404: + response_404 = StderrErrResponse.from_dict(response.json()) + + return response_404 + + if response.status_code == 500: + response_500 = StderrErrResponse.from_dict(response.json()) + + return response_500 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AppRunbook | StderrErrResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + app_id: str, + *, + client: AuthenticatedClient, + body: ServiceCreateRunbookRequest, +) -> Response[AppRunbook | StderrErrResponse]: + """create a runbook for an app + + Args: + app_id (str): + body (ServiceCreateRunbookRequest): + + 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[AppRunbook | StderrErrResponse] + """ + + kwargs = _get_kwargs( + app_id=app_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + app_id: str, + *, + client: AuthenticatedClient, + body: ServiceCreateRunbookRequest, +) -> AppRunbook | StderrErrResponse | None: + """create a runbook for an app + + Args: + app_id (str): + body (ServiceCreateRunbookRequest): + + 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: + AppRunbook | StderrErrResponse + """ + + return sync_detailed( + app_id=app_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + app_id: str, + *, + client: AuthenticatedClient, + body: ServiceCreateRunbookRequest, +) -> Response[AppRunbook | StderrErrResponse]: + """create a runbook for an app + + Args: + app_id (str): + body (ServiceCreateRunbookRequest): + + 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[AppRunbook | StderrErrResponse] + """ + + kwargs = _get_kwargs( + app_id=app_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + app_id: str, + *, + client: AuthenticatedClient, + body: ServiceCreateRunbookRequest, +) -> AppRunbook | StderrErrResponse | None: + """create a runbook for an app + + Args: + app_id (str): + body (ServiceCreateRunbookRequest): + + 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: + AppRunbook | StderrErrResponse + """ + + return ( + await asyncio_detailed( + app_id=app_id, + client=client, + body=body, + ) + ).parsed diff --git a/nuon/api/runbooks/create_runbook_config.py b/nuon/api/runbooks/create_runbook_config.py new file mode 100644 index 00000000..1637a0ba --- /dev/null +++ b/nuon/api/runbooks/create_runbook_config.py @@ -0,0 +1,186 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_runbook_config import AppRunbookConfig +from ...models.service_create_runbook_config_request import ServiceCreateRunbookConfigRequest +from ...types import Response + + +def _get_kwargs( + app_id: str, + runbook_id: str, + *, + body: ServiceCreateRunbookConfigRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/apps/{app_id}/runbooks/{runbook_id}/configs".format( + app_id=quote(str(app_id), safe=""), + runbook_id=quote(str(runbook_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AppRunbookConfig | None: + if response.status_code == 201: + response_201 = AppRunbookConfig.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AppRunbookConfig]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + body: ServiceCreateRunbookConfigRequest, +) -> Response[AppRunbookConfig]: + """create a runbook config + + Args: + app_id (str): + runbook_id (str): + body (ServiceCreateRunbookConfigRequest): + + 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[AppRunbookConfig] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + body: ServiceCreateRunbookConfigRequest, +) -> AppRunbookConfig | None: + """create a runbook config + + Args: + app_id (str): + runbook_id (str): + body (ServiceCreateRunbookConfigRequest): + + 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: + AppRunbookConfig + """ + + return sync_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + body: ServiceCreateRunbookConfigRequest, +) -> Response[AppRunbookConfig]: + """create a runbook config + + Args: + app_id (str): + runbook_id (str): + body (ServiceCreateRunbookConfigRequest): + + 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[AppRunbookConfig] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + body: ServiceCreateRunbookConfigRequest, +) -> AppRunbookConfig | None: + """create a runbook config + + Args: + app_id (str): + runbook_id (str): + body (ServiceCreateRunbookConfigRequest): + + 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: + AppRunbookConfig + """ + + return ( + await asyncio_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + body=body, + ) + ).parsed diff --git a/nuon/api/runbooks/create_runbook_run.py b/nuon/api/runbooks/create_runbook_run.py new file mode 100644 index 00000000..95696a20 --- /dev/null +++ b/nuon/api/runbooks/create_runbook_run.py @@ -0,0 +1,167 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_install_runbook_run import AppInstallRunbookRun +from ...types import Response + + +def _get_kwargs( + install_id: str, + runbook_id: str, +) -> dict[str, Any]: + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/installs/{install_id}/runbooks/{runbook_id}/runs".format( + install_id=quote(str(install_id), safe=""), + runbook_id=quote(str(runbook_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AppInstallRunbookRun | None: + if response.status_code == 201: + response_201 = AppInstallRunbookRun.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AppInstallRunbookRun]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + install_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> Response[AppInstallRunbookRun]: + """run a runbook on an install + + Args: + install_id (str): + runbook_id (str): + + 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[AppInstallRunbookRun] + """ + + kwargs = _get_kwargs( + install_id=install_id, + runbook_id=runbook_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + install_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> AppInstallRunbookRun | None: + """run a runbook on an install + + Args: + install_id (str): + runbook_id (str): + + 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: + AppInstallRunbookRun + """ + + return sync_detailed( + install_id=install_id, + runbook_id=runbook_id, + client=client, + ).parsed + + +async def asyncio_detailed( + install_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> Response[AppInstallRunbookRun]: + """run a runbook on an install + + Args: + install_id (str): + runbook_id (str): + + 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[AppInstallRunbookRun] + """ + + kwargs = _get_kwargs( + install_id=install_id, + runbook_id=runbook_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + install_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> AppInstallRunbookRun | None: + """run a runbook on an install + + Args: + install_id (str): + runbook_id (str): + + 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: + AppInstallRunbookRun + """ + + return ( + await asyncio_detailed( + install_id=install_id, + runbook_id=runbook_id, + client=client, + ) + ).parsed diff --git a/nuon/api/runbooks/delete_runbook.py b/nuon/api/runbooks/delete_runbook.py new file mode 100644 index 00000000..30f4d4d0 --- /dev/null +++ b/nuon/api/runbooks/delete_runbook.py @@ -0,0 +1,163 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import Response + + +def _get_kwargs( + app_id: str, + runbook_id: str, +) -> dict[str, Any]: + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/v1/apps/{app_id}/runbooks/{runbook_id}".format( + app_id=quote(str(app_id), safe=""), + runbook_id=quote(str(runbook_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> bool | None: + if response.status_code == 200: + response_200 = cast(bool, response.json()) + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[bool]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> Response[bool]: + """delete a runbook + + Args: + app_id (str): + runbook_id (str): + + 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[bool] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> bool | None: + """delete a runbook + + Args: + app_id (str): + runbook_id (str): + + 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: + bool + """ + + return sync_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + ).parsed + + +async def asyncio_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> Response[bool]: + """delete a runbook + + Args: + app_id (str): + runbook_id (str): + + 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[bool] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> bool | None: + """delete a runbook + + Args: + app_id (str): + runbook_id (str): + + 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: + bool + """ + + return ( + await asyncio_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + ) + ).parsed diff --git a/nuon/api/runbooks/get_install_runbook.py b/nuon/api/runbooks/get_install_runbook.py new file mode 100644 index 00000000..6654b810 --- /dev/null +++ b/nuon/api/runbooks/get_install_runbook.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_install_runbook import AppInstallRunbook +from ...types import Response + + +def _get_kwargs( + install_id: str, + runbook_id: str, +) -> dict[str, Any]: + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/installs/{install_id}/runbooks/{runbook_id}".format( + install_id=quote(str(install_id), safe=""), + runbook_id=quote(str(runbook_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AppInstallRunbook | None: + if response.status_code == 200: + response_200 = AppInstallRunbook.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AppInstallRunbook]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + install_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> Response[AppInstallRunbook]: + """get an install runbook + + Args: + install_id (str): + runbook_id (str): + + 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[AppInstallRunbook] + """ + + kwargs = _get_kwargs( + install_id=install_id, + runbook_id=runbook_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + install_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> AppInstallRunbook | None: + """get an install runbook + + Args: + install_id (str): + runbook_id (str): + + 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: + AppInstallRunbook + """ + + return sync_detailed( + install_id=install_id, + runbook_id=runbook_id, + client=client, + ).parsed + + +async def asyncio_detailed( + install_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> Response[AppInstallRunbook]: + """get an install runbook + + Args: + install_id (str): + runbook_id (str): + + 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[AppInstallRunbook] + """ + + kwargs = _get_kwargs( + install_id=install_id, + runbook_id=runbook_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + install_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> AppInstallRunbook | None: + """get an install runbook + + Args: + install_id (str): + runbook_id (str): + + 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: + AppInstallRunbook + """ + + return ( + await asyncio_detailed( + install_id=install_id, + runbook_id=runbook_id, + client=client, + ) + ).parsed diff --git a/nuon/api/runbooks/get_install_runbook_run.py b/nuon/api/runbooks/get_install_runbook_run.py new file mode 100644 index 00000000..bf69dca7 --- /dev/null +++ b/nuon/api/runbooks/get_install_runbook_run.py @@ -0,0 +1,167 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_install_runbook_run import AppInstallRunbookRun +from ...types import Response + + +def _get_kwargs( + install_id: str, + run_id: str, +) -> dict[str, Any]: + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/installs/{install_id}/runbook-runs/{run_id}".format( + install_id=quote(str(install_id), safe=""), + run_id=quote(str(run_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AppInstallRunbookRun | None: + if response.status_code == 200: + response_200 = AppInstallRunbookRun.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AppInstallRunbookRun]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + install_id: str, + run_id: str, + *, + client: AuthenticatedClient, +) -> Response[AppInstallRunbookRun]: + """get a runbook run + + Args: + install_id (str): + run_id (str): + + 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[AppInstallRunbookRun] + """ + + kwargs = _get_kwargs( + install_id=install_id, + run_id=run_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + install_id: str, + run_id: str, + *, + client: AuthenticatedClient, +) -> AppInstallRunbookRun | None: + """get a runbook run + + Args: + install_id (str): + run_id (str): + + 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: + AppInstallRunbookRun + """ + + return sync_detailed( + install_id=install_id, + run_id=run_id, + client=client, + ).parsed + + +async def asyncio_detailed( + install_id: str, + run_id: str, + *, + client: AuthenticatedClient, +) -> Response[AppInstallRunbookRun]: + """get a runbook run + + Args: + install_id (str): + run_id (str): + + 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[AppInstallRunbookRun] + """ + + kwargs = _get_kwargs( + install_id=install_id, + run_id=run_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + install_id: str, + run_id: str, + *, + client: AuthenticatedClient, +) -> AppInstallRunbookRun | None: + """get a runbook run + + Args: + install_id (str): + run_id (str): + + 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: + AppInstallRunbookRun + """ + + return ( + await asyncio_detailed( + install_id=install_id, + run_id=run_id, + client=client, + ) + ).parsed diff --git a/nuon/api/runbooks/get_install_runbook_runs.py b/nuon/api/runbooks/get_install_runbook_runs.py new file mode 100644 index 00000000..cd5c5f7f --- /dev/null +++ b/nuon/api/runbooks/get_install_runbook_runs.py @@ -0,0 +1,196 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_install_runbook_run import AppInstallRunbookRun +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + install_id: str, + *, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> dict[str, Any]: + + params: dict[str, Any] = {} + + params["offset"] = offset + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/installs/{install_id}/runbook-runs".format( + install_id=quote(str(install_id), safe=""), + ), + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> list[AppInstallRunbookRun] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = AppInstallRunbookRun.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[list[AppInstallRunbookRun]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + install_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> Response[list[AppInstallRunbookRun]]: + """get runbook runs for an install + + Args: + install_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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[list[AppInstallRunbookRun]] + """ + + kwargs = _get_kwargs( + install_id=install_id, + offset=offset, + limit=limit, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + install_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> list[AppInstallRunbookRun] | None: + """get runbook runs for an install + + Args: + install_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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: + list[AppInstallRunbookRun] + """ + + return sync_detailed( + install_id=install_id, + client=client, + offset=offset, + limit=limit, + ).parsed + + +async def asyncio_detailed( + install_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> Response[list[AppInstallRunbookRun]]: + """get runbook runs for an install + + Args: + install_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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[list[AppInstallRunbookRun]] + """ + + kwargs = _get_kwargs( + install_id=install_id, + offset=offset, + limit=limit, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + install_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> list[AppInstallRunbookRun] | None: + """get runbook runs for an install + + Args: + install_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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: + list[AppInstallRunbookRun] + """ + + return ( + await asyncio_detailed( + install_id=install_id, + client=client, + offset=offset, + limit=limit, + ) + ).parsed diff --git a/nuon/api/runbooks/get_install_runbooks.py b/nuon/api/runbooks/get_install_runbooks.py new file mode 100644 index 00000000..0db75997 --- /dev/null +++ b/nuon/api/runbooks/get_install_runbooks.py @@ -0,0 +1,196 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_install_runbook import AppInstallRunbook +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + install_id: str, + *, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> dict[str, Any]: + + params: dict[str, Any] = {} + + params["offset"] = offset + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/installs/{install_id}/runbooks".format( + install_id=quote(str(install_id), safe=""), + ), + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> list[AppInstallRunbook] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = AppInstallRunbook.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[list[AppInstallRunbook]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + install_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> Response[list[AppInstallRunbook]]: + """get runbooks for an install + + Args: + install_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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[list[AppInstallRunbook]] + """ + + kwargs = _get_kwargs( + install_id=install_id, + offset=offset, + limit=limit, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + install_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> list[AppInstallRunbook] | None: + """get runbooks for an install + + Args: + install_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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: + list[AppInstallRunbook] + """ + + return sync_detailed( + install_id=install_id, + client=client, + offset=offset, + limit=limit, + ).parsed + + +async def asyncio_detailed( + install_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> Response[list[AppInstallRunbook]]: + """get runbooks for an install + + Args: + install_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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[list[AppInstallRunbook]] + """ + + kwargs = _get_kwargs( + install_id=install_id, + offset=offset, + limit=limit, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + install_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> list[AppInstallRunbook] | None: + """get runbooks for an install + + Args: + install_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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: + list[AppInstallRunbook] + """ + + return ( + await asyncio_detailed( + install_id=install_id, + client=client, + offset=offset, + limit=limit, + ) + ).parsed diff --git a/nuon/api/runbooks/get_runbook.py b/nuon/api/runbooks/get_runbook.py new file mode 100644 index 00000000..ed2d198c --- /dev/null +++ b/nuon/api/runbooks/get_runbook.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_runbook import AppRunbook +from ...types import Response + + +def _get_kwargs( + app_id: str, + runbook_id: str, +) -> dict[str, Any]: + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/apps/{app_id}/runbooks/{runbook_id}".format( + app_id=quote(str(app_id), safe=""), + runbook_id=quote(str(runbook_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AppRunbook | None: + if response.status_code == 200: + response_200 = AppRunbook.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AppRunbook]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> Response[AppRunbook]: + """get a runbook + + Args: + app_id (str): + runbook_id (str): + + 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[AppRunbook] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> AppRunbook | None: + """get a runbook + + Args: + app_id (str): + runbook_id (str): + + 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: + AppRunbook + """ + + return sync_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + ).parsed + + +async def asyncio_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> Response[AppRunbook]: + """get a runbook + + Args: + app_id (str): + runbook_id (str): + + 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[AppRunbook] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, +) -> AppRunbook | None: + """get a runbook + + Args: + app_id (str): + runbook_id (str): + + 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: + AppRunbook + """ + + return ( + await asyncio_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + ) + ).parsed diff --git a/nuon/api/runbooks/get_runbook_configs.py b/nuon/api/runbooks/get_runbook_configs.py new file mode 100644 index 00000000..c9389992 --- /dev/null +++ b/nuon/api/runbooks/get_runbook_configs.py @@ -0,0 +1,208 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_runbook_config import AppRunbookConfig +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + app_id: str, + runbook_id: str, + *, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> dict[str, Any]: + + params: dict[str, Any] = {} + + params["offset"] = offset + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/apps/{app_id}/runbooks/{runbook_id}/configs".format( + app_id=quote(str(app_id), safe=""), + runbook_id=quote(str(runbook_id), safe=""), + ), + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[AppRunbookConfig] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = AppRunbookConfig.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[list[AppRunbookConfig]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> Response[list[AppRunbookConfig]]: + """get runbook configs + + Args: + app_id (str): + runbook_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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[list[AppRunbookConfig]] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + offset=offset, + limit=limit, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> list[AppRunbookConfig] | None: + """get runbook configs + + Args: + app_id (str): + runbook_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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: + list[AppRunbookConfig] + """ + + return sync_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + offset=offset, + limit=limit, + ).parsed + + +async def asyncio_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> Response[list[AppRunbookConfig]]: + """get runbook configs + + Args: + app_id (str): + runbook_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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[list[AppRunbookConfig]] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + offset=offset, + limit=limit, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> list[AppRunbookConfig] | None: + """get runbook configs + + Args: + app_id (str): + runbook_id (str): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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: + list[AppRunbookConfig] + """ + + return ( + await asyncio_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + offset=offset, + limit=limit, + ) + ).parsed diff --git a/nuon/api/runbooks/get_runbooks.py b/nuon/api/runbooks/get_runbooks.py new file mode 100644 index 00000000..e30b41a8 --- /dev/null +++ b/nuon/api/runbooks/get_runbooks.py @@ -0,0 +1,207 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_runbook import AppRunbook +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + app_id: str, + *, + q: str | Unset = UNSET, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> dict[str, Any]: + + params: dict[str, Any] = {} + + params["q"] = q + + params["offset"] = offset + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/apps/{app_id}/runbooks".format( + app_id=quote(str(app_id), safe=""), + ), + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[AppRunbook] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = AppRunbook.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[AppRunbook]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + app_id: str, + *, + client: AuthenticatedClient, + q: str | Unset = UNSET, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> Response[list[AppRunbook]]: + """get runbooks for an app + + Args: + app_id (str): + q (str | Unset): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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[list[AppRunbook]] + """ + + kwargs = _get_kwargs( + app_id=app_id, + q=q, + offset=offset, + limit=limit, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + app_id: str, + *, + client: AuthenticatedClient, + q: str | Unset = UNSET, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> list[AppRunbook] | None: + """get runbooks for an app + + Args: + app_id (str): + q (str | Unset): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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: + list[AppRunbook] + """ + + return sync_detailed( + app_id=app_id, + client=client, + q=q, + offset=offset, + limit=limit, + ).parsed + + +async def asyncio_detailed( + app_id: str, + *, + client: AuthenticatedClient, + q: str | Unset = UNSET, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> Response[list[AppRunbook]]: + """get runbooks for an app + + Args: + app_id (str): + q (str | Unset): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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[list[AppRunbook]] + """ + + kwargs = _get_kwargs( + app_id=app_id, + q=q, + offset=offset, + limit=limit, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + app_id: str, + *, + client: AuthenticatedClient, + q: str | Unset = UNSET, + offset: int | Unset = 0, + limit: int | Unset = 10, +) -> list[AppRunbook] | None: + """get runbooks for an app + + Args: + app_id (str): + q (str | Unset): + offset (int | Unset): Default: 0. + limit (int | Unset): Default: 10. + + 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: + list[AppRunbook] + """ + + return ( + await asyncio_detailed( + app_id=app_id, + client=client, + q=q, + offset=offset, + limit=limit, + ) + ).parsed diff --git a/nuon/api/runbooks/update_runbook.py b/nuon/api/runbooks/update_runbook.py new file mode 100644 index 00000000..ca455808 --- /dev/null +++ b/nuon/api/runbooks/update_runbook.py @@ -0,0 +1,216 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_runbook import AppRunbook +from ...models.service_update_runbook_request import ServiceUpdateRunbookRequest +from ...models.stderr_err_response import StderrErrResponse +from ...types import Response + + +def _get_kwargs( + app_id: str, + runbook_id: str, + *, + body: ServiceUpdateRunbookRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/v1/apps/{app_id}/runbooks/{runbook_id}".format( + app_id=quote(str(app_id), safe=""), + runbook_id=quote(str(runbook_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AppRunbook | StderrErrResponse | None: + if response.status_code == 200: + response_200 = AppRunbook.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = StderrErrResponse.from_dict(response.json()) + + return response_400 + + if response.status_code == 401: + response_401 = StderrErrResponse.from_dict(response.json()) + + return response_401 + + if response.status_code == 403: + response_403 = StderrErrResponse.from_dict(response.json()) + + return response_403 + + if response.status_code == 404: + response_404 = StderrErrResponse.from_dict(response.json()) + + return response_404 + + if response.status_code == 500: + response_500 = StderrErrResponse.from_dict(response.json()) + + return response_500 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AppRunbook | StderrErrResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + body: ServiceUpdateRunbookRequest, +) -> Response[AppRunbook | StderrErrResponse]: + """update a runbook + + Args: + app_id (str): + runbook_id (str): + body (ServiceUpdateRunbookRequest): + + 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[AppRunbook | StderrErrResponse] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + body: ServiceUpdateRunbookRequest, +) -> AppRunbook | StderrErrResponse | None: + """update a runbook + + Args: + app_id (str): + runbook_id (str): + body (ServiceUpdateRunbookRequest): + + 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: + AppRunbook | StderrErrResponse + """ + + return sync_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + body: ServiceUpdateRunbookRequest, +) -> Response[AppRunbook | StderrErrResponse]: + """update a runbook + + Args: + app_id (str): + runbook_id (str): + body (ServiceUpdateRunbookRequest): + + 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[AppRunbook | StderrErrResponse] + """ + + kwargs = _get_kwargs( + app_id=app_id, + runbook_id=runbook_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + app_id: str, + runbook_id: str, + *, + client: AuthenticatedClient, + body: ServiceUpdateRunbookRequest, +) -> AppRunbook | StderrErrResponse | None: + """update a runbook + + Args: + app_id (str): + runbook_id (str): + body (ServiceUpdateRunbookRequest): + + 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: + AppRunbook | StderrErrResponse + """ + + return ( + await asyncio_detailed( + app_id=app_id, + runbook_id=runbook_id, + client=client, + body=body, + ) + ).parsed diff --git a/nuon/models/__init__.py b/nuon/models/__init__.py index c75172cc..45073c28 100644 --- a/nuon/models/__init__.py +++ b/nuon/models/__init__.py @@ -112,6 +112,8 @@ from .app_install_role_selection_record import AppInstallRoleSelectionRecord from .app_install_role_usage import AppInstallRoleUsage from .app_install_roles import AppInstallRoles +from .app_install_runbook import AppInstallRunbook +from .app_install_runbook_run import AppInstallRunbookRun from .app_install_sandbox import AppInstallSandbox from .app_install_sandbox_run import AppInstallSandboxRun from .app_install_sandbox_run_outputs import AppInstallSandboxRunOutputs @@ -169,6 +171,10 @@ from .app_queue_signal import AppQueueSignal from .app_role import AppRole from .app_role_type import AppRoleType +from .app_runbook import AppRunbook +from .app_runbook_config import AppRunbookConfig +from .app_runbook_step_config import AppRunbookStepConfig +from .app_runbook_step_config_env_vars import AppRunbookStepConfigEnvVars from .app_runner import AppRunner from .app_runner_group import AppRunnerGroup from .app_runner_group_settings import AppRunnerGroupSettings @@ -510,6 +516,11 @@ from .service_create_pulumi_component_config_request_operation_roles import ( ServiceCreatePulumiComponentConfigRequestOperationRoles, ) +from .service_create_runbook_config_request import ServiceCreateRunbookConfigRequest +from .service_create_runbook_request import ServiceCreateRunbookRequest +from .service_create_runbook_request_labels import ServiceCreateRunbookRequestLabels +from .service_create_runbook_step_config_request import ServiceCreateRunbookStepConfigRequest +from .service_create_runbook_step_config_request_env_vars import ServiceCreateRunbookStepConfigRequestEnvVars from .service_create_runner_bootstrap_token_response import ServiceCreateRunnerBootstrapTokenResponse from .service_create_terraform_module_component_config_request import ServiceCreateTerraformModuleComponentConfigRequest from .service_create_terraform_module_component_config_request_env_vars import ( @@ -608,6 +619,8 @@ from .service_update_org_features_request import ServiceUpdateOrgFeaturesRequest from .service_update_org_features_request_features import ServiceUpdateOrgFeaturesRequestFeatures from .service_update_org_request import ServiceUpdateOrgRequest +from .service_update_runbook_request import ServiceUpdateRunbookRequest +from .service_update_runbook_request_labels import ServiceUpdateRunbookRequestLabels from .service_update_runner_settings_request import ServiceUpdateRunnerSettingsRequest from .service_update_runner_settings_request_aws_auth_method import ServiceUpdateRunnerSettingsRequestAwsAuthMethod from .service_update_runner_settings_request_job_group_parallelism import ( @@ -770,6 +783,8 @@ "AppInstallRoles", "AppInstallRoleSelectionRecord", "AppInstallRoleUsage", + "AppInstallRunbook", + "AppInstallRunbookRun", "AppInstallSandbox", "AppInstallSandboxRun", "AppInstallSandboxRunOutputs", @@ -827,6 +842,10 @@ "AppQueueSignal", "AppRole", "AppRoleType", + "AppRunbook", + "AppRunbookConfig", + "AppRunbookStepConfig", + "AppRunbookStepConfigEnvVars", "AppRunner", "AppRunnerGroup", "AppRunnerGroupSettings", @@ -1140,6 +1159,11 @@ "ServiceCreatePulumiComponentConfigRequestConfig", "ServiceCreatePulumiComponentConfigRequestEnvVars", "ServiceCreatePulumiComponentConfigRequestOperationRoles", + "ServiceCreateRunbookConfigRequest", + "ServiceCreateRunbookRequest", + "ServiceCreateRunbookRequestLabels", + "ServiceCreateRunbookStepConfigRequest", + "ServiceCreateRunbookStepConfigRequestEnvVars", "ServiceCreateRunnerBootstrapTokenResponse", "ServiceCreateTerraformModuleComponentConfigRequest", "ServiceCreateTerraformModuleComponentConfigRequestEnvVars", @@ -1232,6 +1256,8 @@ "ServiceUpdateOrgFeaturesRequest", "ServiceUpdateOrgFeaturesRequestFeatures", "ServiceUpdateOrgRequest", + "ServiceUpdateRunbookRequest", + "ServiceUpdateRunbookRequestLabels", "ServiceUpdateRunnerSettingsRequest", "ServiceUpdateRunnerSettingsRequestAwsAuthMethod", "ServiceUpdateRunnerSettingsRequestJobGroupParallelism", diff --git a/nuon/models/app_install_runbook.py b/nuon/models/app_install_runbook.py new file mode 100644 index 00000000..ffffa3ed --- /dev/null +++ b/nuon/models/app_install_runbook.py @@ -0,0 +1,160 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.app_install_runbook_run import AppInstallRunbookRun + from ..models.app_runbook import AppRunbook + + +T = TypeVar("T", bound="AppInstallRunbook") + + +@_attrs_define +class AppInstallRunbook: + """ + Attributes: + created_at (str | Unset): + created_by_id (str | Unset): + id (str | Unset): + install_id (str | Unset): + runbook (AppRunbook | Unset): + runbook_id (str | Unset): + runs (list[AppInstallRunbookRun] | Unset): + status (str | Unset): after query fields + updated_at (str | Unset): + """ + + created_at: str | Unset = UNSET + created_by_id: str | Unset = UNSET + id: str | Unset = UNSET + install_id: str | Unset = UNSET + runbook: AppRunbook | Unset = UNSET + runbook_id: str | Unset = UNSET + runs: list[AppInstallRunbookRun] | Unset = UNSET + status: str | Unset = UNSET + updated_at: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + created_at = self.created_at + + created_by_id = self.created_by_id + + id = self.id + + install_id = self.install_id + + runbook: dict[str, Any] | Unset = UNSET + if not isinstance(self.runbook, Unset): + runbook = self.runbook.to_dict() + + runbook_id = self.runbook_id + + runs: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.runs, Unset): + runs = [] + for runs_item_data in self.runs: + runs_item = runs_item_data.to_dict() + runs.append(runs_item) + + status = self.status + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if created_at is not UNSET: + field_dict["created_at"] = created_at + if created_by_id is not UNSET: + field_dict["created_by_id"] = created_by_id + if id is not UNSET: + field_dict["id"] = id + if install_id is not UNSET: + field_dict["install_id"] = install_id + if runbook is not UNSET: + field_dict["runbook"] = runbook + if runbook_id is not UNSET: + field_dict["runbook_id"] = runbook_id + if runs is not UNSET: + field_dict["runs"] = runs + if status is not UNSET: + field_dict["status"] = status + if updated_at is not UNSET: + field_dict["updated_at"] = updated_at + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.app_install_runbook_run import AppInstallRunbookRun + from ..models.app_runbook import AppRunbook + + d = dict(src_dict) + created_at = d.pop("created_at", UNSET) + + created_by_id = d.pop("created_by_id", UNSET) + + id = d.pop("id", UNSET) + + install_id = d.pop("install_id", UNSET) + + _runbook = d.pop("runbook", UNSET) + runbook: AppRunbook | Unset + if isinstance(_runbook, Unset): + runbook = UNSET + else: + runbook = AppRunbook.from_dict(_runbook) + + runbook_id = d.pop("runbook_id", UNSET) + + _runs = d.pop("runs", UNSET) + runs: list[AppInstallRunbookRun] | Unset = UNSET + if _runs is not UNSET: + runs = [] + for runs_item_data in _runs: + runs_item = AppInstallRunbookRun.from_dict(runs_item_data) + + runs.append(runs_item) + + status = d.pop("status", UNSET) + + updated_at = d.pop("updated_at", UNSET) + + app_install_runbook = cls( + created_at=created_at, + created_by_id=created_by_id, + id=id, + install_id=install_id, + runbook=runbook, + runbook_id=runbook_id, + runs=runs, + status=status, + updated_at=updated_at, + ) + + app_install_runbook.additional_properties = d + return app_install_runbook + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/app_install_runbook_run.py b/nuon/models/app_install_runbook_run.py new file mode 100644 index 00000000..e3fc84d2 --- /dev/null +++ b/nuon/models/app_install_runbook_run.py @@ -0,0 +1,254 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.app_account import AppAccount + from ..models.app_composite_status import AppCompositeStatus + from ..models.app_install_runbook import AppInstallRunbook + from ..models.app_runbook_config import AppRunbookConfig + from ..models.app_workflow import AppWorkflow + + +T = TypeVar("T", bound="AppInstallRunbookRun") + + +@_attrs_define +class AppInstallRunbookRun: + """ + Attributes: + created_at (str | Unset): + created_by (AppAccount | Unset): + created_by_id (str | Unset): + execution_time (int | Unset): after query + id (str | Unset): + install_id (str | Unset): + install_runbook (AppInstallRunbook | Unset): + install_runbook_id (str | Unset): + install_workflow (AppWorkflow | Unset): + install_workflow_id (str | Unset): + runbook_config (AppRunbookConfig | Unset): + runbook_config_id (str | Unset): + status (str | Unset): + status_description (str | Unset): + status_v2 (AppCompositeStatus | Unset): + triggered_by_id (str | Unset): + updated_at (str | Unset): + """ + + created_at: str | Unset = UNSET + created_by: AppAccount | Unset = UNSET + created_by_id: str | Unset = UNSET + execution_time: int | Unset = UNSET + id: str | Unset = UNSET + install_id: str | Unset = UNSET + install_runbook: AppInstallRunbook | Unset = UNSET + install_runbook_id: str | Unset = UNSET + install_workflow: AppWorkflow | Unset = UNSET + install_workflow_id: str | Unset = UNSET + runbook_config: AppRunbookConfig | Unset = UNSET + runbook_config_id: str | Unset = UNSET + status: str | Unset = UNSET + status_description: str | Unset = UNSET + status_v2: AppCompositeStatus | Unset = UNSET + triggered_by_id: str | Unset = UNSET + updated_at: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + created_at = self.created_at + + created_by: dict[str, Any] | Unset = UNSET + if not isinstance(self.created_by, Unset): + created_by = self.created_by.to_dict() + + created_by_id = self.created_by_id + + execution_time = self.execution_time + + id = self.id + + install_id = self.install_id + + install_runbook: dict[str, Any] | Unset = UNSET + if not isinstance(self.install_runbook, Unset): + install_runbook = self.install_runbook.to_dict() + + install_runbook_id = self.install_runbook_id + + install_workflow: dict[str, Any] | Unset = UNSET + if not isinstance(self.install_workflow, Unset): + install_workflow = self.install_workflow.to_dict() + + install_workflow_id = self.install_workflow_id + + runbook_config: dict[str, Any] | Unset = UNSET + if not isinstance(self.runbook_config, Unset): + runbook_config = self.runbook_config.to_dict() + + runbook_config_id = self.runbook_config_id + + status = self.status + + status_description = self.status_description + + status_v2: dict[str, Any] | Unset = UNSET + if not isinstance(self.status_v2, Unset): + status_v2 = self.status_v2.to_dict() + + triggered_by_id = self.triggered_by_id + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if created_at is not UNSET: + field_dict["created_at"] = created_at + if created_by is not UNSET: + field_dict["created_by"] = created_by + if created_by_id is not UNSET: + field_dict["created_by_id"] = created_by_id + if execution_time is not UNSET: + field_dict["execution_time"] = execution_time + if id is not UNSET: + field_dict["id"] = id + if install_id is not UNSET: + field_dict["install_id"] = install_id + if install_runbook is not UNSET: + field_dict["install_runbook"] = install_runbook + if install_runbook_id is not UNSET: + field_dict["install_runbook_id"] = install_runbook_id + if install_workflow is not UNSET: + field_dict["install_workflow"] = install_workflow + if install_workflow_id is not UNSET: + field_dict["install_workflow_id"] = install_workflow_id + if runbook_config is not UNSET: + field_dict["runbook_config"] = runbook_config + if runbook_config_id is not UNSET: + field_dict["runbook_config_id"] = runbook_config_id + if status is not UNSET: + field_dict["status"] = status + if status_description is not UNSET: + field_dict["status_description"] = status_description + if status_v2 is not UNSET: + field_dict["status_v2"] = status_v2 + if triggered_by_id is not UNSET: + field_dict["triggered_by_id"] = triggered_by_id + if updated_at is not UNSET: + field_dict["updated_at"] = updated_at + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.app_account import AppAccount + from ..models.app_composite_status import AppCompositeStatus + from ..models.app_install_runbook import AppInstallRunbook + from ..models.app_runbook_config import AppRunbookConfig + from ..models.app_workflow import AppWorkflow + + d = dict(src_dict) + created_at = d.pop("created_at", UNSET) + + _created_by = d.pop("created_by", UNSET) + created_by: AppAccount | Unset + if isinstance(_created_by, Unset): + created_by = UNSET + else: + created_by = AppAccount.from_dict(_created_by) + + created_by_id = d.pop("created_by_id", UNSET) + + execution_time = d.pop("execution_time", UNSET) + + id = d.pop("id", UNSET) + + install_id = d.pop("install_id", UNSET) + + _install_runbook = d.pop("install_runbook", UNSET) + install_runbook: AppInstallRunbook | Unset + if isinstance(_install_runbook, Unset): + install_runbook = UNSET + else: + install_runbook = AppInstallRunbook.from_dict(_install_runbook) + + install_runbook_id = d.pop("install_runbook_id", UNSET) + + _install_workflow = d.pop("install_workflow", UNSET) + install_workflow: AppWorkflow | Unset + if isinstance(_install_workflow, Unset): + install_workflow = UNSET + else: + install_workflow = AppWorkflow.from_dict(_install_workflow) + + install_workflow_id = d.pop("install_workflow_id", UNSET) + + _runbook_config = d.pop("runbook_config", UNSET) + runbook_config: AppRunbookConfig | Unset + if isinstance(_runbook_config, Unset): + runbook_config = UNSET + else: + runbook_config = AppRunbookConfig.from_dict(_runbook_config) + + runbook_config_id = d.pop("runbook_config_id", UNSET) + + status = d.pop("status", UNSET) + + status_description = d.pop("status_description", UNSET) + + _status_v2 = d.pop("status_v2", UNSET) + status_v2: AppCompositeStatus | Unset + if isinstance(_status_v2, Unset): + status_v2 = UNSET + else: + status_v2 = AppCompositeStatus.from_dict(_status_v2) + + triggered_by_id = d.pop("triggered_by_id", UNSET) + + updated_at = d.pop("updated_at", UNSET) + + app_install_runbook_run = cls( + created_at=created_at, + created_by=created_by, + created_by_id=created_by_id, + execution_time=execution_time, + id=id, + install_id=install_id, + install_runbook=install_runbook, + install_runbook_id=install_runbook_id, + install_workflow=install_workflow, + install_workflow_id=install_workflow_id, + runbook_config=runbook_config, + runbook_config_id=runbook_config_id, + status=status, + status_description=status_description, + status_v2=status_v2, + triggered_by_id=triggered_by_id, + updated_at=updated_at, + ) + + app_install_runbook_run.additional_properties = d + return app_install_runbook_run + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/app_runbook.py b/nuon/models/app_runbook.py new file mode 100644 index 00000000..47356859 --- /dev/null +++ b/nuon/models/app_runbook.py @@ -0,0 +1,205 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.app_composite_status import AppCompositeStatus + from ..models.app_runbook_config import AppRunbookConfig + from ..models.github_com_nuonco_nuon_pkg_labels_labels import GithubComNuoncoNuonPkgLabelsLabels + + +T = TypeVar("T", bound="AppRunbook") + + +@_attrs_define +class AppRunbook: + """ + Attributes: + app_id (str | Unset): + config_count (int | Unset): + configs (list[AppRunbookConfig] | Unset): + created_at (str | Unset): + created_by_id (str | Unset): + description (str | Unset): + id (str | Unset): + labels (GithubComNuoncoNuonPkgLabelsLabels | Unset): + name (str | Unset): + status (str | Unset): + status_description (str | Unset): + status_v2 (AppCompositeStatus | Unset): + updated_at (str | Unset): + """ + + app_id: str | Unset = UNSET + config_count: int | Unset = UNSET + configs: list[AppRunbookConfig] | Unset = UNSET + created_at: str | Unset = UNSET + created_by_id: str | Unset = UNSET + description: str | Unset = UNSET + id: str | Unset = UNSET + labels: GithubComNuoncoNuonPkgLabelsLabels | Unset = UNSET + name: str | Unset = UNSET + status: str | Unset = UNSET + status_description: str | Unset = UNSET + status_v2: AppCompositeStatus | Unset = UNSET + updated_at: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + app_id = self.app_id + + config_count = self.config_count + + configs: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.configs, Unset): + configs = [] + for configs_item_data in self.configs: + configs_item = configs_item_data.to_dict() + configs.append(configs_item) + + created_at = self.created_at + + created_by_id = self.created_by_id + + description = self.description + + id = self.id + + labels: dict[str, Any] | Unset = UNSET + if not isinstance(self.labels, Unset): + labels = self.labels.to_dict() + + name = self.name + + status = self.status + + status_description = self.status_description + + status_v2: dict[str, Any] | Unset = UNSET + if not isinstance(self.status_v2, Unset): + status_v2 = self.status_v2.to_dict() + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if app_id is not UNSET: + field_dict["app_id"] = app_id + if config_count is not UNSET: + field_dict["config_count"] = config_count + if configs is not UNSET: + field_dict["configs"] = configs + if created_at is not UNSET: + field_dict["created_at"] = created_at + if created_by_id is not UNSET: + field_dict["created_by_id"] = created_by_id + if description is not UNSET: + field_dict["description"] = description + if id is not UNSET: + field_dict["id"] = id + if labels is not UNSET: + field_dict["labels"] = labels + if name is not UNSET: + field_dict["name"] = name + if status is not UNSET: + field_dict["status"] = status + if status_description is not UNSET: + field_dict["status_description"] = status_description + if status_v2 is not UNSET: + field_dict["status_v2"] = status_v2 + if updated_at is not UNSET: + field_dict["updated_at"] = updated_at + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.app_composite_status import AppCompositeStatus + from ..models.app_runbook_config import AppRunbookConfig + from ..models.github_com_nuonco_nuon_pkg_labels_labels import GithubComNuoncoNuonPkgLabelsLabels + + d = dict(src_dict) + app_id = d.pop("app_id", UNSET) + + config_count = d.pop("config_count", UNSET) + + _configs = d.pop("configs", UNSET) + configs: list[AppRunbookConfig] | Unset = UNSET + if _configs is not UNSET: + configs = [] + for configs_item_data in _configs: + configs_item = AppRunbookConfig.from_dict(configs_item_data) + + configs.append(configs_item) + + created_at = d.pop("created_at", UNSET) + + created_by_id = d.pop("created_by_id", UNSET) + + description = d.pop("description", UNSET) + + id = d.pop("id", UNSET) + + _labels = d.pop("labels", UNSET) + labels: GithubComNuoncoNuonPkgLabelsLabels | Unset + if isinstance(_labels, Unset): + labels = UNSET + else: + labels = GithubComNuoncoNuonPkgLabelsLabels.from_dict(_labels) + + name = d.pop("name", UNSET) + + status = d.pop("status", UNSET) + + status_description = d.pop("status_description", UNSET) + + _status_v2 = d.pop("status_v2", UNSET) + status_v2: AppCompositeStatus | Unset + if isinstance(_status_v2, Unset): + status_v2 = UNSET + else: + status_v2 = AppCompositeStatus.from_dict(_status_v2) + + updated_at = d.pop("updated_at", UNSET) + + app_runbook = cls( + app_id=app_id, + config_count=config_count, + configs=configs, + created_at=created_at, + created_by_id=created_by_id, + description=description, + id=id, + labels=labels, + name=name, + status=status, + status_description=status_description, + status_v2=status_v2, + updated_at=updated_at, + ) + + app_runbook.additional_properties = d + return app_runbook + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/app_runbook_config.py b/nuon/models/app_runbook_config.py new file mode 100644 index 00000000..844cb78f --- /dev/null +++ b/nuon/models/app_runbook_config.py @@ -0,0 +1,151 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.app_runbook_step_config import AppRunbookStepConfig + + +T = TypeVar("T", bound="AppRunbookConfig") + + +@_attrs_define +class AppRunbookConfig: + """ + Attributes: + app_config_id (str | Unset): + app_id (str | Unset): + created_at (str | Unset): + created_by_id (str | Unset): + id (str | Unset): + readme (str | Unset): + runbook_id (str | Unset): + steps (list[AppRunbookStepConfig] | Unset): + updated_at (str | Unset): + """ + + app_config_id: str | Unset = UNSET + app_id: str | Unset = UNSET + created_at: str | Unset = UNSET + created_by_id: str | Unset = UNSET + id: str | Unset = UNSET + readme: str | Unset = UNSET + runbook_id: str | Unset = UNSET + steps: list[AppRunbookStepConfig] | Unset = UNSET + updated_at: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + app_config_id = self.app_config_id + + app_id = self.app_id + + created_at = self.created_at + + created_by_id = self.created_by_id + + id = self.id + + readme = self.readme + + runbook_id = self.runbook_id + + steps: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.steps, Unset): + steps = [] + for steps_item_data in self.steps: + steps_item = steps_item_data.to_dict() + steps.append(steps_item) + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if app_config_id is not UNSET: + field_dict["app_config_id"] = app_config_id + if app_id is not UNSET: + field_dict["app_id"] = app_id + if created_at is not UNSET: + field_dict["created_at"] = created_at + if created_by_id is not UNSET: + field_dict["created_by_id"] = created_by_id + if id is not UNSET: + field_dict["id"] = id + if readme is not UNSET: + field_dict["readme"] = readme + if runbook_id is not UNSET: + field_dict["runbook_id"] = runbook_id + if steps is not UNSET: + field_dict["steps"] = steps + if updated_at is not UNSET: + field_dict["updated_at"] = updated_at + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.app_runbook_step_config import AppRunbookStepConfig + + d = dict(src_dict) + app_config_id = d.pop("app_config_id", UNSET) + + app_id = d.pop("app_id", UNSET) + + created_at = d.pop("created_at", UNSET) + + created_by_id = d.pop("created_by_id", UNSET) + + id = d.pop("id", UNSET) + + readme = d.pop("readme", UNSET) + + runbook_id = d.pop("runbook_id", UNSET) + + _steps = d.pop("steps", UNSET) + steps: list[AppRunbookStepConfig] | Unset = UNSET + if _steps is not UNSET: + steps = [] + for steps_item_data in _steps: + steps_item = AppRunbookStepConfig.from_dict(steps_item_data) + + steps.append(steps_item) + + updated_at = d.pop("updated_at", UNSET) + + app_runbook_config = cls( + app_config_id=app_config_id, + app_id=app_id, + created_at=created_at, + created_by_id=created_by_id, + id=id, + readme=readme, + runbook_id=runbook_id, + steps=steps, + updated_at=updated_at, + ) + + app_runbook_config.additional_properties = d + return app_runbook_config + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/app_runbook_step_config.py b/nuon/models/app_runbook_step_config.py new file mode 100644 index 00000000..9aaa2fde --- /dev/null +++ b/nuon/models/app_runbook_step_config.py @@ -0,0 +1,209 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.app_runbook_step_config_env_vars import AppRunbookStepConfigEnvVars + + +T = TypeVar("T", bound="AppRunbookStepConfig") + + +@_attrs_define +class AppRunbookStepConfig: + """ + Attributes: + action_workflow_id (str | Unset): action reference field + command (str | Unset): inline action fields + component_name (str | Unset): deploy fields + created_at (str | Unset): + created_by_id (str | Unset): + deploy_dependencies (bool | Unset): + env_vars (AppRunbookStepConfigEnvVars | Unset): + id (str | Unset): + idx (int | Unset): + inline_contents (str | Unset): + name (str | Unset): + role (str | Unset): + runbook_config_id (str | Unset): + timeout (int | Unset): + type_ (str | Unset): + updated_at (str | Unset): + """ + + action_workflow_id: str | Unset = UNSET + command: str | Unset = UNSET + component_name: str | Unset = UNSET + created_at: str | Unset = UNSET + created_by_id: str | Unset = UNSET + deploy_dependencies: bool | Unset = UNSET + env_vars: AppRunbookStepConfigEnvVars | Unset = UNSET + id: str | Unset = UNSET + idx: int | Unset = UNSET + inline_contents: str | Unset = UNSET + name: str | Unset = UNSET + role: str | Unset = UNSET + runbook_config_id: str | Unset = UNSET + timeout: int | Unset = UNSET + type_: str | Unset = UNSET + updated_at: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + action_workflow_id = self.action_workflow_id + + command = self.command + + component_name = self.component_name + + created_at = self.created_at + + created_by_id = self.created_by_id + + deploy_dependencies = self.deploy_dependencies + + env_vars: dict[str, Any] | Unset = UNSET + if not isinstance(self.env_vars, Unset): + env_vars = self.env_vars.to_dict() + + id = self.id + + idx = self.idx + + inline_contents = self.inline_contents + + name = self.name + + role = self.role + + runbook_config_id = self.runbook_config_id + + timeout = self.timeout + + type_ = self.type_ + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if action_workflow_id is not UNSET: + field_dict["action_workflow_id"] = action_workflow_id + if command is not UNSET: + field_dict["command"] = command + if component_name is not UNSET: + field_dict["component_name"] = component_name + if created_at is not UNSET: + field_dict["created_at"] = created_at + if created_by_id is not UNSET: + field_dict["created_by_id"] = created_by_id + if deploy_dependencies is not UNSET: + field_dict["deploy_dependencies"] = deploy_dependencies + if env_vars is not UNSET: + field_dict["env_vars"] = env_vars + if id is not UNSET: + field_dict["id"] = id + if idx is not UNSET: + field_dict["idx"] = idx + if inline_contents is not UNSET: + field_dict["inline_contents"] = inline_contents + if name is not UNSET: + field_dict["name"] = name + if role is not UNSET: + field_dict["role"] = role + if runbook_config_id is not UNSET: + field_dict["runbook_config_id"] = runbook_config_id + if timeout is not UNSET: + field_dict["timeout"] = timeout + if type_ is not UNSET: + field_dict["type"] = type_ + if updated_at is not UNSET: + field_dict["updated_at"] = updated_at + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.app_runbook_step_config_env_vars import AppRunbookStepConfigEnvVars + + d = dict(src_dict) + action_workflow_id = d.pop("action_workflow_id", UNSET) + + command = d.pop("command", UNSET) + + component_name = d.pop("component_name", UNSET) + + created_at = d.pop("created_at", UNSET) + + created_by_id = d.pop("created_by_id", UNSET) + + deploy_dependencies = d.pop("deploy_dependencies", UNSET) + + _env_vars = d.pop("env_vars", UNSET) + env_vars: AppRunbookStepConfigEnvVars | Unset + if isinstance(_env_vars, Unset): + env_vars = UNSET + else: + env_vars = AppRunbookStepConfigEnvVars.from_dict(_env_vars) + + id = d.pop("id", UNSET) + + idx = d.pop("idx", UNSET) + + inline_contents = d.pop("inline_contents", UNSET) + + name = d.pop("name", UNSET) + + role = d.pop("role", UNSET) + + runbook_config_id = d.pop("runbook_config_id", UNSET) + + timeout = d.pop("timeout", UNSET) + + type_ = d.pop("type", UNSET) + + updated_at = d.pop("updated_at", UNSET) + + app_runbook_step_config = cls( + action_workflow_id=action_workflow_id, + command=command, + component_name=component_name, + created_at=created_at, + created_by_id=created_by_id, + deploy_dependencies=deploy_dependencies, + env_vars=env_vars, + id=id, + idx=idx, + inline_contents=inline_contents, + name=name, + role=role, + runbook_config_id=runbook_config_id, + timeout=timeout, + type_=type_, + updated_at=updated_at, + ) + + app_runbook_step_config.additional_properties = d + return app_runbook_step_config + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/app_runbook_step_config_env_vars.py b/nuon/models/app_runbook_step_config_env_vars.py new file mode 100644 index 00000000..5a0735a7 --- /dev/null +++ b/nuon/models/app_runbook_step_config_env_vars.py @@ -0,0 +1,47 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AppRunbookStepConfigEnvVars") + + +@_attrs_define +class AppRunbookStepConfigEnvVars: + """ """ + + additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + app_runbook_step_config_env_vars = cls() + + app_runbook_step_config_env_vars.additional_properties = d + return app_runbook_step_config_env_vars + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> str: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: str) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/app_workflow.py b/nuon/models/app_workflow.py index 473d2a2c..ca74445e 100644 --- a/nuon/models/app_workflow.py +++ b/nuon/models/app_workflow.py @@ -47,7 +47,11 @@ class AppWorkflow: install_sandbox_runs (list[AppInstallSandboxRun] | Unset): links (AppWorkflowLinks | Unset): metadata (AppWorkflowMetadata | Unset): - name (str | Unset): + name (str | Unset): Name is the human-readable workflow title shown in the UI (e.g. + "Deploying to install (rds_cluster_temporal)"). Populated by + BeforeSave via computeWorkflowName — callers that mutate Type, + Metadata, or FinishedAt must go through GORM (Save / struct-based + Updates) so the hook fires. owner_id (str | Unset): owner_name (str | Unset): OwnerName is a derived, non-persisted convenience field. It is populated by activities that need a human-readable owner label diff --git a/nuon/models/app_workflow_type.py b/nuon/models/app_workflow_type.py index a9287255..4e296b33 100644 --- a/nuon/models/app_workflow_type.py +++ b/nuon/models/app_workflow_type.py @@ -17,6 +17,7 @@ class AppWorkflowType(str, Enum): PROVISION = "provision" REPROVISION = "reprovision" REPROVISION_SANDBOX = "reprovision_sandbox" + RUNBOOK_RUN = "runbook_run" SYNC_SECRETS = "sync_secrets" TEARDOWN_COMPONENT = "teardown_component" TEARDOWN_COMPONENTS = "teardown_components" diff --git a/nuon/models/plantypes_kubernetes_manifest_deploy_plan.py b/nuon/models/plantypes_kubernetes_manifest_deploy_plan.py index 0970f882..cff4bd8f 100644 --- a/nuon/models/plantypes_kubernetes_manifest_deploy_plan.py +++ b/nuon/models/plantypes_kubernetes_manifest_deploy_plan.py @@ -14,6 +14,7 @@ GithubComNuoncoNuonPkgAzureCredentialsConfig, ) from ..models.github_com_nuonco_nuon_pkg_gcp_credentials_config import GithubComNuoncoNuonPkgGcpCredentialsConfig + from ..models.github_com_nuonco_nuon_pkg_types_state_state import GithubComNuoncoNuonPkgTypesStateState from ..models.kube_cluster_info import KubeClusterInfo from ..models.plantypes_oci_artifact_reference import PlantypesOCIArtifactReference @@ -34,6 +35,7 @@ class PlantypesKubernetesManifestDeployPlan: after pulling the OCI artifact during Initialize(). namespace (str | Unset): oci_artifact (PlantypesOCIArtifactReference | Unset): + state (GithubComNuoncoNuonPkgTypesStateState | Unset): """ aws_auth: GithubComNuoncoNuonPkgAwsCredentialsConfig | Unset = UNSET @@ -43,6 +45,7 @@ class PlantypesKubernetesManifestDeployPlan: manifest: str | Unset = UNSET namespace: str | Unset = UNSET oci_artifact: PlantypesOCIArtifactReference | Unset = UNSET + state: GithubComNuoncoNuonPkgTypesStateState | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -70,6 +73,10 @@ def to_dict(self) -> dict[str, Any]: if not isinstance(self.oci_artifact, Unset): oci_artifact = self.oci_artifact.to_dict() + state: dict[str, Any] | Unset = UNSET + if not isinstance(self.state, Unset): + state = self.state.to_dict() + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update({}) @@ -87,6 +94,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["namespace"] = namespace if oci_artifact is not UNSET: field_dict["oci_artifact"] = oci_artifact + if state is not UNSET: + field_dict["state"] = state return field_dict @@ -101,6 +110,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.github_com_nuonco_nuon_pkg_gcp_credentials_config import ( GithubComNuoncoNuonPkgGcpCredentialsConfig, ) + from ..models.github_com_nuonco_nuon_pkg_types_state_state import GithubComNuoncoNuonPkgTypesStateState from ..models.kube_cluster_info import KubeClusterInfo from ..models.plantypes_oci_artifact_reference import PlantypesOCIArtifactReference @@ -144,6 +154,13 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: else: oci_artifact = PlantypesOCIArtifactReference.from_dict(_oci_artifact) + _state = d.pop("state", UNSET) + state: GithubComNuoncoNuonPkgTypesStateState | Unset + if isinstance(_state, Unset): + state = UNSET + else: + state = GithubComNuoncoNuonPkgTypesStateState.from_dict(_state) + plantypes_kubernetes_manifest_deploy_plan = cls( aws_auth=aws_auth, azure_auth=azure_auth, @@ -152,6 +169,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: manifest=manifest, namespace=namespace, oci_artifact=oci_artifact, + state=state, ) plantypes_kubernetes_manifest_deploy_plan.additional_properties = d diff --git a/nuon/models/plantypes_sandbox_run_plan.py b/nuon/models/plantypes_sandbox_run_plan.py index 6cc84c41..4e4deeec 100644 --- a/nuon/models/plantypes_sandbox_run_plan.py +++ b/nuon/models/plantypes_sandbox_run_plan.py @@ -44,6 +44,7 @@ class PlantypesSandboxRunPlan: git_source (PlantypesGitSource | Unset): hooks (PlantypesTerraformDeployHooks | Unset): install_id (str | Unset): + kyverno_policies_dir (str | Unset): local_archive (PlantypesTerraformLocalArchive | Unset): policies (PlantypesSandboxRunPlanPolicies | Unset): sandbox_mode (PlantypesSandboxMode | Unset): @@ -64,6 +65,7 @@ class PlantypesSandboxRunPlan: git_source: PlantypesGitSource | Unset = UNSET hooks: PlantypesTerraformDeployHooks | Unset = UNSET install_id: str | Unset = UNSET + kyverno_policies_dir: str | Unset = UNSET local_archive: PlantypesTerraformLocalArchive | Unset = UNSET policies: PlantypesSandboxRunPlanPolicies | Unset = UNSET sandbox_mode: PlantypesSandboxMode | Unset = UNSET @@ -110,6 +112,8 @@ def to_dict(self) -> dict[str, Any]: install_id = self.install_id + kyverno_policies_dir = self.kyverno_policies_dir + local_archive: dict[str, Any] | Unset = UNSET if not isinstance(self.local_archive, Unset): local_archive = self.local_archive.to_dict() @@ -163,6 +167,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["hooks"] = hooks if install_id is not UNSET: field_dict["install_id"] = install_id + if kyverno_policies_dir is not UNSET: + field_dict["kyverno_policies_dir"] = kyverno_policies_dir if local_archive is not UNSET: field_dict["local_archive"] = local_archive if policies is not UNSET: @@ -254,6 +260,8 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: install_id = d.pop("install_id", UNSET) + kyverno_policies_dir = d.pop("kyverno_policies_dir", UNSET) + _local_archive = d.pop("local_archive", UNSET) local_archive: PlantypesTerraformLocalArchive | Unset if isinstance(_local_archive, Unset): @@ -310,6 +318,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: git_source=git_source, hooks=hooks, install_id=install_id, + kyverno_policies_dir=kyverno_policies_dir, local_archive=local_archive, policies=policies, sandbox_mode=sandbox_mode, diff --git a/nuon/models/service_create_runbook_config_request.py b/nuon/models/service_create_runbook_config_request.py new file mode 100644 index 00000000..1263d334 --- /dev/null +++ b/nuon/models/service_create_runbook_config_request.py @@ -0,0 +1,95 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.service_create_runbook_step_config_request import ServiceCreateRunbookStepConfigRequest + + +T = TypeVar("T", bound="ServiceCreateRunbookConfigRequest") + + +@_attrs_define +class ServiceCreateRunbookConfigRequest: + """ + Attributes: + steps (list[ServiceCreateRunbookStepConfigRequest]): + app_config_id (str | Unset): + readme (str | Unset): + """ + + steps: list[ServiceCreateRunbookStepConfigRequest] + app_config_id: str | Unset = UNSET + readme: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + steps = [] + for steps_item_data in self.steps: + steps_item = steps_item_data.to_dict() + steps.append(steps_item) + + app_config_id = self.app_config_id + + readme = self.readme + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "steps": steps, + } + ) + if app_config_id is not UNSET: + field_dict["app_config_id"] = app_config_id + if readme is not UNSET: + field_dict["readme"] = readme + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.service_create_runbook_step_config_request import ServiceCreateRunbookStepConfigRequest + + d = dict(src_dict) + steps = [] + _steps = d.pop("steps") + for steps_item_data in _steps: + steps_item = ServiceCreateRunbookStepConfigRequest.from_dict(steps_item_data) + + steps.append(steps_item) + + app_config_id = d.pop("app_config_id", UNSET) + + readme = d.pop("readme", UNSET) + + service_create_runbook_config_request = cls( + steps=steps, + app_config_id=app_config_id, + readme=readme, + ) + + service_create_runbook_config_request.additional_properties = d + return service_create_runbook_config_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/service_create_runbook_request.py b/nuon/models/service_create_runbook_request.py new file mode 100644 index 00000000..c9997e59 --- /dev/null +++ b/nuon/models/service_create_runbook_request.py @@ -0,0 +1,94 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.service_create_runbook_request_labels import ServiceCreateRunbookRequestLabels + + +T = TypeVar("T", bound="ServiceCreateRunbookRequest") + + +@_attrs_define +class ServiceCreateRunbookRequest: + """ + Attributes: + name (str): + description (str | Unset): + labels (ServiceCreateRunbookRequestLabels | Unset): + """ + + name: str + description: str | Unset = UNSET + labels: ServiceCreateRunbookRequestLabels | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + description = self.description + + labels: dict[str, Any] | Unset = UNSET + if not isinstance(self.labels, Unset): + labels = self.labels.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + } + ) + if description is not UNSET: + field_dict["description"] = description + if labels is not UNSET: + field_dict["labels"] = labels + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.service_create_runbook_request_labels import ServiceCreateRunbookRequestLabels + + d = dict(src_dict) + name = d.pop("name") + + description = d.pop("description", UNSET) + + _labels = d.pop("labels", UNSET) + labels: ServiceCreateRunbookRequestLabels | Unset + if isinstance(_labels, Unset): + labels = UNSET + else: + labels = ServiceCreateRunbookRequestLabels.from_dict(_labels) + + service_create_runbook_request = cls( + name=name, + description=description, + labels=labels, + ) + + service_create_runbook_request.additional_properties = d + return service_create_runbook_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/service_create_runbook_request_labels.py b/nuon/models/service_create_runbook_request_labels.py new file mode 100644 index 00000000..2cac4a03 --- /dev/null +++ b/nuon/models/service_create_runbook_request_labels.py @@ -0,0 +1,47 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ServiceCreateRunbookRequestLabels") + + +@_attrs_define +class ServiceCreateRunbookRequestLabels: + """ """ + + additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + service_create_runbook_request_labels = cls() + + service_create_runbook_request_labels.additional_properties = d + return service_create_runbook_request_labels + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> str: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: str) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/service_create_runbook_step_config_request.py b/nuon/models/service_create_runbook_step_config_request.py new file mode 100644 index 00000000..078c3a9d --- /dev/null +++ b/nuon/models/service_create_runbook_step_config_request.py @@ -0,0 +1,169 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.service_create_runbook_step_config_request_env_vars import ( + ServiceCreateRunbookStepConfigRequestEnvVars, + ) + + +T = TypeVar("T", bound="ServiceCreateRunbookStepConfigRequest") + + +@_attrs_define +class ServiceCreateRunbookStepConfigRequest: + """ + Attributes: + name (str): + type_ (str): + action_name (str | Unset): + command (str | Unset): + component_name (str | Unset): + deploy_dependencies (bool | Unset): + env_vars (ServiceCreateRunbookStepConfigRequestEnvVars | Unset): + idx (int | Unset): + inline_contents (str | Unset): + role (str | Unset): + timeout (int | Unset): + """ + + name: str + type_: str + action_name: str | Unset = UNSET + command: str | Unset = UNSET + component_name: str | Unset = UNSET + deploy_dependencies: bool | Unset = UNSET + env_vars: ServiceCreateRunbookStepConfigRequestEnvVars | Unset = UNSET + idx: int | Unset = UNSET + inline_contents: str | Unset = UNSET + role: str | Unset = UNSET + timeout: int | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + type_ = self.type_ + + action_name = self.action_name + + command = self.command + + component_name = self.component_name + + deploy_dependencies = self.deploy_dependencies + + env_vars: dict[str, Any] | Unset = UNSET + if not isinstance(self.env_vars, Unset): + env_vars = self.env_vars.to_dict() + + idx = self.idx + + inline_contents = self.inline_contents + + role = self.role + + timeout = self.timeout + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "type": type_, + } + ) + if action_name is not UNSET: + field_dict["action_name"] = action_name + if command is not UNSET: + field_dict["command"] = command + if component_name is not UNSET: + field_dict["component_name"] = component_name + if deploy_dependencies is not UNSET: + field_dict["deploy_dependencies"] = deploy_dependencies + if env_vars is not UNSET: + field_dict["env_vars"] = env_vars + if idx is not UNSET: + field_dict["idx"] = idx + if inline_contents is not UNSET: + field_dict["inline_contents"] = inline_contents + if role is not UNSET: + field_dict["role"] = role + if timeout is not UNSET: + field_dict["timeout"] = timeout + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.service_create_runbook_step_config_request_env_vars import ( + ServiceCreateRunbookStepConfigRequestEnvVars, + ) + + d = dict(src_dict) + name = d.pop("name") + + type_ = d.pop("type") + + action_name = d.pop("action_name", UNSET) + + command = d.pop("command", UNSET) + + component_name = d.pop("component_name", UNSET) + + deploy_dependencies = d.pop("deploy_dependencies", UNSET) + + _env_vars = d.pop("env_vars", UNSET) + env_vars: ServiceCreateRunbookStepConfigRequestEnvVars | Unset + if isinstance(_env_vars, Unset): + env_vars = UNSET + else: + env_vars = ServiceCreateRunbookStepConfigRequestEnvVars.from_dict(_env_vars) + + idx = d.pop("idx", UNSET) + + inline_contents = d.pop("inline_contents", UNSET) + + role = d.pop("role", UNSET) + + timeout = d.pop("timeout", UNSET) + + service_create_runbook_step_config_request = cls( + name=name, + type_=type_, + action_name=action_name, + command=command, + component_name=component_name, + deploy_dependencies=deploy_dependencies, + env_vars=env_vars, + idx=idx, + inline_contents=inline_contents, + role=role, + timeout=timeout, + ) + + service_create_runbook_step_config_request.additional_properties = d + return service_create_runbook_step_config_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/service_create_runbook_step_config_request_env_vars.py b/nuon/models/service_create_runbook_step_config_request_env_vars.py new file mode 100644 index 00000000..2db6aee1 --- /dev/null +++ b/nuon/models/service_create_runbook_step_config_request_env_vars.py @@ -0,0 +1,47 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ServiceCreateRunbookStepConfigRequestEnvVars") + + +@_attrs_define +class ServiceCreateRunbookStepConfigRequestEnvVars: + """ """ + + additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + service_create_runbook_step_config_request_env_vars = cls() + + service_create_runbook_step_config_request_env_vars.additional_properties = d + return service_create_runbook_step_config_request_env_vars + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> str: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: str) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/service_update_runbook_request.py b/nuon/models/service_update_runbook_request.py new file mode 100644 index 00000000..c1413c41 --- /dev/null +++ b/nuon/models/service_update_runbook_request.py @@ -0,0 +1,92 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.service_update_runbook_request_labels import ServiceUpdateRunbookRequestLabels + + +T = TypeVar("T", bound="ServiceUpdateRunbookRequest") + + +@_attrs_define +class ServiceUpdateRunbookRequest: + """ + Attributes: + description (str | Unset): + labels (ServiceUpdateRunbookRequestLabels | Unset): + name (str | Unset): + """ + + description: str | Unset = UNSET + labels: ServiceUpdateRunbookRequestLabels | Unset = UNSET + name: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + description = self.description + + labels: dict[str, Any] | Unset = UNSET + if not isinstance(self.labels, Unset): + labels = self.labels.to_dict() + + name = self.name + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if description is not UNSET: + field_dict["description"] = description + if labels is not UNSET: + field_dict["labels"] = labels + if name is not UNSET: + field_dict["name"] = name + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.service_update_runbook_request_labels import ServiceUpdateRunbookRequestLabels + + d = dict(src_dict) + description = d.pop("description", UNSET) + + _labels = d.pop("labels", UNSET) + labels: ServiceUpdateRunbookRequestLabels | Unset + if isinstance(_labels, Unset): + labels = UNSET + else: + labels = ServiceUpdateRunbookRequestLabels.from_dict(_labels) + + name = d.pop("name", UNSET) + + service_update_runbook_request = cls( + description=description, + labels=labels, + name=name, + ) + + service_update_runbook_request.additional_properties = d + return service_update_runbook_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/nuon/models/service_update_runbook_request_labels.py b/nuon/models/service_update_runbook_request_labels.py new file mode 100644 index 00000000..06acbaa4 --- /dev/null +++ b/nuon/models/service_update_runbook_request_labels.py @@ -0,0 +1,47 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ServiceUpdateRunbookRequestLabels") + + +@_attrs_define +class ServiceUpdateRunbookRequestLabels: + """ """ + + additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + service_update_runbook_request_labels = cls() + + service_update_runbook_request_labels.additional_properties = d + return service_update_runbook_request_labels + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> str: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: str) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/pyproject.toml b/pyproject.toml index 60de2556..d7819cc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nuon" -version = "0.19.973" +version = "0.19.974" description = "A client library for accessing Nuon" authors = [] requires-python = ">=3.10" diff --git a/version.txt b/version.txt index 64ba4cd2..6df9433f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.19.973 +0.19.974