diff --git a/nuon/api/installs/generate_terraform_installer_config.py b/nuon/api/installs/generate_terraform_installer_config.py new file mode 100644 index 00000000..038e71c0 --- /dev/null +++ b/nuon/api/installs/generate_terraform_installer_config.py @@ -0,0 +1,177 @@ +from http import HTTPStatus +from io import BytesIO +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.stderr_err_response import StderrErrResponse +from ...types import File, Response + + +def _get_kwargs( + install_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/v1/installs/{install_id}/generate-terraform-installer-config", + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> File | StderrErrResponse | None: + if response.status_code == 200: + response_200 = File(payload=BytesIO(response.content)) + + return response_200 + + if response.status_code == 400: + response_400 = StderrErrResponse.from_dict(response.content) + + return response_400 + + if response.status_code == 401: + response_401 = StderrErrResponse.from_dict(response.content) + + return response_401 + + if response.status_code == 403: + response_403 = StderrErrResponse.from_dict(response.content) + + return response_403 + + if response.status_code == 404: + response_404 = StderrErrResponse.from_dict(response.content) + + return response_404 + + if response.status_code == 500: + response_500 = StderrErrResponse.from_dict(response.content) + + 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[File | 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( + install_id: str, + *, + client: AuthenticatedClient, +) -> Response[File | StderrErrResponse]: + """generate a Terraform installer config + + Args: + install_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[File | StderrErrResponse] + """ + + kwargs = _get_kwargs( + install_id=install_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + install_id: str, + *, + client: AuthenticatedClient, +) -> File | StderrErrResponse | None: + """generate a Terraform installer config + + Args: + install_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: + File | StderrErrResponse + """ + + return sync_detailed( + install_id=install_id, + client=client, + ).parsed + + +async def asyncio_detailed( + install_id: str, + *, + client: AuthenticatedClient, +) -> Response[File | StderrErrResponse]: + """generate a Terraform installer config + + Args: + install_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[File | StderrErrResponse] + """ + + kwargs = _get_kwargs( + install_id=install_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + install_id: str, + *, + client: AuthenticatedClient, +) -> File | StderrErrResponse | None: + """generate a Terraform installer config + + Args: + install_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: + File | StderrErrResponse + """ + + return ( + await asyncio_detailed( + install_id=install_id, + client=client, + ) + ).parsed diff --git a/nuon/models/__init__.py b/nuon/models/__init__.py index d9c002f4..ff2b2385 100644 --- a/nuon/models/__init__.py +++ b/nuon/models/__init__.py @@ -65,6 +65,7 @@ from .app_helm_config import AppHelmConfig from .app_helm_config_values import AppHelmConfigValues from .app_helm_release import AppHelmRelease +from .app_helm_repo_config import AppHelmRepoConfig from .app_install import AppInstall from .app_install_action_workflow import AppInstallActionWorkflow from .app_install_action_workflow_run import AppInstallActionWorkflowRun @@ -192,6 +193,7 @@ from .app_workflow_step_response_type import AppWorkflowStepResponseType from .app_workflow_type import AppWorkflowType from .config_app_policy_type import ConfigAppPolicyType +from .config_helm_repo_config import ConfigHelmRepoConfig from .configs_oci_registry_auth import ConfigsOCIRegistryAuth from .configs_oci_registry_repository import ConfigsOCIRegistryRepository from .configs_oci_registry_type import ConfigsOCIRegistryType @@ -376,6 +378,7 @@ from .service_force_shutdown_request import ServiceForceShutdownRequest from .service_forget_install_request import ServiceForgetInstallRequest from .service_graceful_shutdown_request import ServiceGracefulShutdownRequest +from .service_helm_repo_config_request import ServiceHelmRepoConfigRequest from .service_install_phone_home_request import ServiceInstallPhoneHomeRequest from .service_latest_runner_heart_beats import ServiceLatestRunnerHeartBeats from .service_mng_shut_down_request import ServiceMngShutDownRequest @@ -507,6 +510,7 @@ "AppHelmConfig", "AppHelmConfigValues", "AppHelmRelease", + "AppHelmRepoConfig", "AppInstall", "AppInstallActionWorkflow", "AppInstallActionWorkflowRun", @@ -632,6 +636,7 @@ "AppWorkflowStepResponseType", "AppWorkflowType", "ConfigAppPolicyType", + "ConfigHelmRepoConfig", "ConfigsOCIRegistryAuth", "ConfigsOCIRegistryRepository", "ConfigsOCIRegistryType", @@ -792,6 +797,7 @@ "ServiceForceShutdownRequest", "ServiceForgetInstallRequest", "ServiceGracefulShutdownRequest", + "ServiceHelmRepoConfigRequest", "ServiceInstallPhoneHomeRequest", "ServiceLatestRunnerHeartBeats", "ServiceMngShutDownRequest", diff --git a/nuon/models/app_helm_config.py b/nuon/models/app_helm_config.py index 16b30aae..8b9cfebb 100644 --- a/nuon/models/app_helm_config.py +++ b/nuon/models/app_helm_config.py @@ -10,6 +10,7 @@ if TYPE_CHECKING: from ..models.app_helm_config_values import AppHelmConfigValues + from ..models.app_helm_repo_config import AppHelmRepoConfig T = TypeVar("T", bound="AppHelmConfig") @@ -20,6 +21,7 @@ class AppHelmConfig: """ Attributes: chart_name (str | Unset): + helm_repo_config (AppHelmRepoConfig | Unset): namespace (str | Unset): storage_driver (str | Unset): take_ownership (bool | Unset): Newer fields that we don't need to store as columns in the database @@ -28,6 +30,7 @@ class AppHelmConfig: """ chart_name: str | Unset = UNSET + helm_repo_config: AppHelmRepoConfig | Unset = UNSET namespace: str | Unset = UNSET storage_driver: str | Unset = UNSET take_ownership: bool | Unset = UNSET @@ -38,6 +41,10 @@ class AppHelmConfig: def to_dict(self) -> dict[str, Any]: chart_name = self.chart_name + helm_repo_config: dict[str, Any] | Unset = UNSET + if not isinstance(self.helm_repo_config, Unset): + helm_repo_config = self.helm_repo_config.to_dict() + namespace = self.namespace storage_driver = self.storage_driver @@ -57,6 +64,8 @@ def to_dict(self) -> dict[str, Any]: field_dict.update({}) if chart_name is not UNSET: field_dict["chart_name"] = chart_name + if helm_repo_config is not UNSET: + field_dict["helm_repo_config"] = helm_repo_config if namespace is not UNSET: field_dict["namespace"] = namespace if storage_driver is not UNSET: @@ -73,10 +82,18 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.app_helm_config_values import AppHelmConfigValues + from ..models.app_helm_repo_config import AppHelmRepoConfig d = dict(src_dict) chart_name = d.pop("chart_name", UNSET) + _helm_repo_config = d.pop("helm_repo_config", UNSET) + helm_repo_config: AppHelmRepoConfig | Unset + if isinstance(_helm_repo_config, Unset): + helm_repo_config = UNSET + else: + helm_repo_config = AppHelmRepoConfig.from_dict(_helm_repo_config) + namespace = d.pop("namespace", UNSET) storage_driver = d.pop("storage_driver", UNSET) @@ -94,6 +111,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: app_helm_config = cls( chart_name=chart_name, + helm_repo_config=helm_repo_config, namespace=namespace, storage_driver=storage_driver, take_ownership=take_ownership, diff --git a/nuon/models/app_helm_repo_config.py b/nuon/models/app_helm_repo_config.py new file mode 100644 index 00000000..8f2cd389 --- /dev/null +++ b/nuon/models/app_helm_repo_config.py @@ -0,0 +1,79 @@ +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 + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AppHelmRepoConfig") + + +@_attrs_define +class AppHelmRepoConfig: + """ + Attributes: + chart (str | Unset): + repo_url (str | Unset): + version (str | Unset): + """ + + chart: str | Unset = UNSET + repo_url: str | Unset = UNSET + version: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + chart = self.chart + + repo_url = self.repo_url + + version = self.version + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if chart is not UNSET: + field_dict["chart"] = chart + if repo_url is not UNSET: + field_dict["repo_url"] = repo_url + if version is not UNSET: + field_dict["version"] = version + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + chart = d.pop("chart", UNSET) + + repo_url = d.pop("repo_url", UNSET) + + version = d.pop("version", UNSET) + + app_helm_repo_config = cls( + chart=chart, + repo_url=repo_url, + version=version, + ) + + app_helm_repo_config.additional_properties = d + return app_helm_repo_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/config_helm_repo_config.py b/nuon/models/config_helm_repo_config.py new file mode 100644 index 00000000..95b28245 --- /dev/null +++ b/nuon/models/config_helm_repo_config.py @@ -0,0 +1,79 @@ +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 + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ConfigHelmRepoConfig") + + +@_attrs_define +class ConfigHelmRepoConfig: + """ + Attributes: + chart (str | Unset): + repo_url (str | Unset): + version (str | Unset): + """ + + chart: str | Unset = UNSET + repo_url: str | Unset = UNSET + version: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + chart = self.chart + + repo_url = self.repo_url + + version = self.version + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if chart is not UNSET: + field_dict["chart"] = chart + if repo_url is not UNSET: + field_dict["repoURL"] = repo_url + if version is not UNSET: + field_dict["version"] = version + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + chart = d.pop("chart", UNSET) + + repo_url = d.pop("repoURL", UNSET) + + version = d.pop("version", UNSET) + + config_helm_repo_config = cls( + chart=chart, + repo_url=repo_url, + version=version, + ) + + config_helm_repo_config.additional_properties = d + return config_helm_repo_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/plantypes_helm_build_plan.py b/nuon/models/plantypes_helm_build_plan.py index 3bd8e2ca..326f1eb4 100644 --- a/nuon/models/plantypes_helm_build_plan.py +++ b/nuon/models/plantypes_helm_build_plan.py @@ -9,6 +9,7 @@ from ..types import UNSET, Unset if TYPE_CHECKING: + from ..models.config_helm_repo_config import ConfigHelmRepoConfig from ..models.plantypes_helm_build_plan_labels import PlantypesHelmBuildPlanLabels @@ -19,13 +20,19 @@ class PlantypesHelmBuildPlan: """ Attributes: + helm_repo_config (ConfigHelmRepoConfig | Unset): labels (PlantypesHelmBuildPlanLabels | Unset): """ + helm_repo_config: ConfigHelmRepoConfig | Unset = UNSET labels: PlantypesHelmBuildPlanLabels | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + helm_repo_config: dict[str, Any] | Unset = UNSET + if not isinstance(self.helm_repo_config, Unset): + helm_repo_config = self.helm_repo_config.to_dict() + labels: dict[str, Any] | Unset = UNSET if not isinstance(self.labels, Unset): labels = self.labels.to_dict() @@ -33,6 +40,8 @@ def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update({}) + if helm_repo_config is not UNSET: + field_dict["helmRepoConfig"] = helm_repo_config if labels is not UNSET: field_dict["labels"] = labels @@ -40,9 +49,17 @@ def to_dict(self) -> dict[str, Any]: @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.config_helm_repo_config import ConfigHelmRepoConfig from ..models.plantypes_helm_build_plan_labels import PlantypesHelmBuildPlanLabels d = dict(src_dict) + _helm_repo_config = d.pop("helmRepoConfig", UNSET) + helm_repo_config: ConfigHelmRepoConfig | Unset + if isinstance(_helm_repo_config, Unset): + helm_repo_config = UNSET + else: + helm_repo_config = ConfigHelmRepoConfig.from_dict(_helm_repo_config) + _labels = d.pop("labels", UNSET) labels: PlantypesHelmBuildPlanLabels | Unset if isinstance(_labels, Unset): @@ -51,6 +68,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: labels = PlantypesHelmBuildPlanLabels.from_dict(_labels) plantypes_helm_build_plan = cls( + helm_repo_config=helm_repo_config, labels=labels, ) diff --git a/nuon/models/service_create_helm_component_config_request.py b/nuon/models/service_create_helm_component_config_request.py index 6174c389..bf89479b 100644 --- a/nuon/models/service_create_helm_component_config_request.py +++ b/nuon/models/service_create_helm_component_config_request.py @@ -13,6 +13,7 @@ from ..models.service_create_helm_component_config_request_values import ( ServiceCreateHelmComponentConfigRequestValues, ) + from ..models.service_helm_repo_config_request import ServiceHelmRepoConfigRequest from ..models.service_public_git_vcs_config_request import ServicePublicGitVCSConfigRequest @@ -30,6 +31,7 @@ class ServiceCreateHelmComponentConfigRequest: connected_github_vcs_config (ServiceConnectedGithubVCSConfigRequest | Unset): dependencies (list[str] | Unset): drift_schedule (str | Unset): + helm_repo_config (ServiceHelmRepoConfigRequest | Unset): namespace (str | Unset): public_git_vcs_config (ServicePublicGitVCSConfigRequest | Unset): references (list[str] | Unset): @@ -45,6 +47,7 @@ class ServiceCreateHelmComponentConfigRequest: connected_github_vcs_config: ServiceConnectedGithubVCSConfigRequest | Unset = UNSET dependencies: list[str] | Unset = UNSET drift_schedule: str | Unset = UNSET + helm_repo_config: ServiceHelmRepoConfigRequest | Unset = UNSET namespace: str | Unset = UNSET public_git_vcs_config: ServicePublicGitVCSConfigRequest | Unset = UNSET references: list[str] | Unset = UNSET @@ -72,6 +75,10 @@ def to_dict(self) -> dict[str, Any]: drift_schedule = self.drift_schedule + helm_repo_config: dict[str, Any] | Unset = UNSET + if not isinstance(self.helm_repo_config, Unset): + helm_repo_config = self.helm_repo_config.to_dict() + namespace = self.namespace public_git_vcs_config: dict[str, Any] | Unset = UNSET @@ -108,6 +115,8 @@ def to_dict(self) -> dict[str, Any]: field_dict["dependencies"] = dependencies if drift_schedule is not UNSET: field_dict["drift_schedule"] = drift_schedule + if helm_repo_config is not UNSET: + field_dict["helm_repo_config"] = helm_repo_config if namespace is not UNSET: field_dict["namespace"] = namespace if public_git_vcs_config is not UNSET: @@ -129,6 +138,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.service_create_helm_component_config_request_values import ( ServiceCreateHelmComponentConfigRequestValues, ) + from ..models.service_helm_repo_config_request import ServiceHelmRepoConfigRequest from ..models.service_public_git_vcs_config_request import ServicePublicGitVCSConfigRequest d = dict(src_dict) @@ -151,6 +161,13 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: drift_schedule = d.pop("drift_schedule", UNSET) + _helm_repo_config = d.pop("helm_repo_config", UNSET) + helm_repo_config: ServiceHelmRepoConfigRequest | Unset + if isinstance(_helm_repo_config, Unset): + helm_repo_config = UNSET + else: + helm_repo_config = ServiceHelmRepoConfigRequest.from_dict(_helm_repo_config) + namespace = d.pop("namespace", UNSET) _public_git_vcs_config = d.pop("public_git_vcs_config", UNSET) @@ -176,6 +193,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: connected_github_vcs_config=connected_github_vcs_config, dependencies=dependencies, drift_schedule=drift_schedule, + helm_repo_config=helm_repo_config, namespace=namespace, public_git_vcs_config=public_git_vcs_config, references=references, diff --git a/nuon/models/service_helm_repo_config_request.py b/nuon/models/service_helm_repo_config_request.py new file mode 100644 index 00000000..c139e9fa --- /dev/null +++ b/nuon/models/service_helm_repo_config_request.py @@ -0,0 +1,80 @@ +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 + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ServiceHelmRepoConfigRequest") + + +@_attrs_define +class ServiceHelmRepoConfigRequest: + """ + Attributes: + chart (str): + repo_url (str): + version (str | Unset): + """ + + chart: str + repo_url: str + version: str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + chart = self.chart + + repo_url = self.repo_url + + version = self.version + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "chart": chart, + "repo_url": repo_url, + } + ) + if version is not UNSET: + field_dict["version"] = version + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + chart = d.pop("chart") + + repo_url = d.pop("repo_url") + + version = d.pop("version", UNSET) + + service_helm_repo_config_request = cls( + chart=chart, + repo_url=repo_url, + version=version, + ) + + service_helm_repo_config_request.additional_properties = d + return service_helm_repo_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/pyproject.toml b/pyproject.toml index e7110465..3b909d56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nuon" -version = "0.19.689" +version = "0.19.690" description = "A client library for accessing Nuon" authors = [] requires-python = ">=3.10" diff --git a/version.txt b/version.txt index d878778a..82e49a04 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.19.689 +0.19.690