From bffc3412c0652005e2ffdf39a95d151f2564beb8 Mon Sep 17 00:00:00 2001 From: Justin Brooks Date: Tue, 12 Nov 2024 22:59:30 -0500 Subject: [PATCH] add more properties to environmets --- README.md | 16 +-- ctrlplane/__init__.py | 2 +- ctrlplane/api/default/create_environment.py | 25 +++-- .../api/default/create_release_channel.py | 101 +++++++++++++----- ctrlplane/models/__init__.py | 12 +++ ctrlplane/models/create_environment_body.py | 71 +++++++++++- ..._environment_body_release_channels_item.py | 66 ++++++++++++ .../create_environment_body_target_filter.py | 43 ++++++++ ...te_environment_response_200_environment.py | 18 ++++ .../models/create_environment_response_409.py | 67 ++++++++++++ .../models/create_release_channel_body.py | 49 +++++---- .../create_release_channel_response_200.py | 50 ++++++--- ...ase_channel_response_200_release_filter.py | 43 ++++++++ .../create_release_channel_response_409.py | 66 ++++++++++++ .../create_release_channel_response_500.py | 58 ++++++++++ pyproject.toml | 4 +- 16 files changed, 605 insertions(+), 86 deletions(-) create mode 100644 ctrlplane/models/create_environment_body_release_channels_item.py create mode 100644 ctrlplane/models/create_environment_body_target_filter.py create mode 100644 ctrlplane/models/create_environment_response_409.py create mode 100644 ctrlplane/models/create_release_channel_response_200_release_filter.py create mode 100644 ctrlplane/models/create_release_channel_response_409.py create mode 100644 ctrlplane/models/create_release_channel_response_500.py diff --git a/README.md b/README.md index 486de1e..8b26034 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ client = Client(base_url="https://api.example.com") If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead: ```python -from ctrlplane_api_client import AuthenticatedClient +from ctrlplane import AuthenticatedClient client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken") ``` @@ -23,9 +23,9 @@ client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSec Now call your endpoint and use your models: ```python -from ctrlplane_api_client.models import MyDataModel -from ctrlplane_api_client.api.my_tag import get_my_data_model -from ctrlplane_api_client.types import Response +from ctrlplane.models import MyDataModel +from ctrlplane.api.my_tag import get_my_data_model +from ctrlplane.types import Response with client as client: my_data: MyDataModel = get_my_data_model.sync(client=client) @@ -36,9 +36,9 @@ with client as client: Or do the same thing with an async version: ```python -from ctrlplane_api_client.models import MyDataModel -from ctrlplane_api_client.api.my_tag import get_my_data_model -from ctrlplane_api_client.types import Response +from ctrlplane.models import MyDataModel +from ctrlplane.api.my_tag import get_my_data_model +from ctrlplane.types import Response async with client as client: my_data: MyDataModel = await get_my_data_model.asyncio(client=client) @@ -76,7 +76,7 @@ Things to know: 1. All path/query params, and bodies become method arguments. 1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above) -1. Any endpoint which did not have a tag will be in `ctrlplane_api_client.api.default` +1. Any endpoint which did not have a tag will be in `ctrlplane.api.default` ## Advanced customizations diff --git a/ctrlplane/__init__.py b/ctrlplane/__init__.py index da1b390..1e74e11 100644 --- a/ctrlplane/__init__.py +++ b/ctrlplane/__init__.py @@ -3,7 +3,7 @@ from .client import AuthenticatedClient, Client -__version__ = "0.1.0" +__version__ = "0.1.1" __all__ = ( diff --git a/ctrlplane/api/default/create_environment.py b/ctrlplane/api/default/create_environment.py index 9593b92..b4f909d 100644 --- a/ctrlplane/api/default/create_environment.py +++ b/ctrlplane/api/default/create_environment.py @@ -7,6 +7,7 @@ from ...client import AuthenticatedClient, Client from ...models.create_environment_body import CreateEnvironmentBody from ...models.create_environment_response_200 import CreateEnvironmentResponse200 +from ...models.create_environment_response_409 import CreateEnvironmentResponse409 from ...models.create_environment_response_500 import CreateEnvironmentResponse500 from ...types import Response @@ -33,11 +34,15 @@ def _get_kwargs( def _parse_response( *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]: +) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]: if response.status_code == 200: response_200 = CreateEnvironmentResponse200.from_dict(response.json()) return response_200 + if response.status_code == 409: + response_409 = CreateEnvironmentResponse409.from_dict(response.json()) + + return response_409 if response.status_code == 500: response_500 = CreateEnvironmentResponse500.from_dict(response.json()) @@ -50,7 +55,7 @@ def _parse_response( def _build_response( *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]: +) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +68,7 @@ def sync_detailed( *, client: Union[AuthenticatedClient, Client], body: CreateEnvironmentBody, -) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]: +) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]: """Create an environment Args: @@ -74,7 +79,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]] + Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]] """ kwargs = _get_kwargs( @@ -92,7 +97,7 @@ def sync( *, client: Union[AuthenticatedClient, Client], body: CreateEnvironmentBody, -) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]: +) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]: """Create an environment Args: @@ -103,7 +108,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500] + Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500] """ return sync_detailed( @@ -116,7 +121,7 @@ async def asyncio_detailed( *, client: Union[AuthenticatedClient, Client], body: CreateEnvironmentBody, -) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]: +) -> Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]: """Create an environment Args: @@ -127,7 +132,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]] + Response[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]] """ kwargs = _get_kwargs( @@ -143,7 +148,7 @@ async def asyncio( *, client: Union[AuthenticatedClient, Client], body: CreateEnvironmentBody, -) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500]]: +) -> Optional[Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500]]: """Create an environment Args: @@ -154,7 +159,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[CreateEnvironmentResponse200, CreateEnvironmentResponse500] + Union[CreateEnvironmentResponse200, CreateEnvironmentResponse409, CreateEnvironmentResponse500] """ return ( diff --git a/ctrlplane/api/default/create_release_channel.py b/ctrlplane/api/default/create_release_channel.py index c2a8483..4f759bf 100644 --- a/ctrlplane/api/default/create_release_channel.py +++ b/ctrlplane/api/default/create_release_channel.py @@ -9,11 +9,12 @@ from ...models.create_release_channel_response_200 import CreateReleaseChannelResponse200 from ...models.create_release_channel_response_401 import CreateReleaseChannelResponse401 from ...models.create_release_channel_response_403 import CreateReleaseChannelResponse403 +from ...models.create_release_channel_response_409 import CreateReleaseChannelResponse409 +from ...models.create_release_channel_response_500 import CreateReleaseChannelResponse500 from ...types import Response def _get_kwargs( - deployment_id: str, *, body: CreateReleaseChannelBody, ) -> Dict[str, Any]: @@ -21,7 +22,7 @@ def _get_kwargs( _kwargs: Dict[str, Any] = { "method": "post", - "url": f"/v1/deployments/{deployment_id}/release-channels", + "url": "/v1/release-channels", } _body = body.to_dict() @@ -35,7 +36,15 @@ def _get_kwargs( def _parse_response( *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]: +) -> Optional[ + Union[ + CreateReleaseChannelResponse200, + CreateReleaseChannelResponse401, + CreateReleaseChannelResponse403, + CreateReleaseChannelResponse409, + CreateReleaseChannelResponse500, + ] +]: if response.status_code == 200: response_200 = CreateReleaseChannelResponse200.from_dict(response.json()) @@ -48,6 +57,14 @@ def _parse_response( response_403 = CreateReleaseChannelResponse403.from_dict(response.json()) return response_403 + if response.status_code == 409: + response_409 = CreateReleaseChannelResponse409.from_dict(response.json()) + + return response_409 + if response.status_code == 500: + response_500 = CreateReleaseChannelResponse500.from_dict(response.json()) + + return response_500 if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -56,7 +73,15 @@ def _parse_response( def _build_response( *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]: +) -> Response[ + Union[ + CreateReleaseChannelResponse200, + CreateReleaseChannelResponse401, + CreateReleaseChannelResponse403, + CreateReleaseChannelResponse409, + CreateReleaseChannelResponse500, + ] +]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,15 +91,21 @@ def _build_response( def sync_detailed( - deployment_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, body: CreateReleaseChannelBody, -) -> Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]: +) -> Response[ + Union[ + CreateReleaseChannelResponse200, + CreateReleaseChannelResponse401, + CreateReleaseChannelResponse403, + CreateReleaseChannelResponse409, + CreateReleaseChannelResponse500, + ] +]: """Create a release channel Args: - deployment_id (str): body (CreateReleaseChannelBody): Raises: @@ -82,11 +113,10 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]] + Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403, CreateReleaseChannelResponse409, CreateReleaseChannelResponse500]] """ kwargs = _get_kwargs( - deployment_id=deployment_id, body=body, ) @@ -98,15 +128,21 @@ def sync_detailed( def sync( - deployment_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, body: CreateReleaseChannelBody, -) -> Optional[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]: +) -> Optional[ + Union[ + CreateReleaseChannelResponse200, + CreateReleaseChannelResponse401, + CreateReleaseChannelResponse403, + CreateReleaseChannelResponse409, + CreateReleaseChannelResponse500, + ] +]: """Create a release channel Args: - deployment_id (str): body (CreateReleaseChannelBody): Raises: @@ -114,26 +150,31 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403] + Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403, CreateReleaseChannelResponse409, CreateReleaseChannelResponse500] """ return sync_detailed( - deployment_id=deployment_id, client=client, body=body, ).parsed async def asyncio_detailed( - deployment_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, body: CreateReleaseChannelBody, -) -> Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]: +) -> Response[ + Union[ + CreateReleaseChannelResponse200, + CreateReleaseChannelResponse401, + CreateReleaseChannelResponse403, + CreateReleaseChannelResponse409, + CreateReleaseChannelResponse500, + ] +]: """Create a release channel Args: - deployment_id (str): body (CreateReleaseChannelBody): Raises: @@ -141,11 +182,10 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]] + Response[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403, CreateReleaseChannelResponse409, CreateReleaseChannelResponse500]] """ kwargs = _get_kwargs( - deployment_id=deployment_id, body=body, ) @@ -155,15 +195,21 @@ async def asyncio_detailed( async def asyncio( - deployment_id: str, *, - client: Union[AuthenticatedClient, Client], + client: AuthenticatedClient, body: CreateReleaseChannelBody, -) -> Optional[Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403]]: +) -> Optional[ + Union[ + CreateReleaseChannelResponse200, + CreateReleaseChannelResponse401, + CreateReleaseChannelResponse403, + CreateReleaseChannelResponse409, + CreateReleaseChannelResponse500, + ] +]: """Create a release channel Args: - deployment_id (str): body (CreateReleaseChannelBody): Raises: @@ -171,12 +217,11 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403] + Union[CreateReleaseChannelResponse200, CreateReleaseChannelResponse401, CreateReleaseChannelResponse403, CreateReleaseChannelResponse409, CreateReleaseChannelResponse500] """ return ( await asyncio_detailed( - deployment_id=deployment_id, client=client, body=body, ) diff --git a/ctrlplane/models/__init__.py b/ctrlplane/models/__init__.py index fcb2a8e..4b7d1b1 100644 --- a/ctrlplane/models/__init__.py +++ b/ctrlplane/models/__init__.py @@ -7,19 +7,25 @@ from .acknowledge_job_response_200 import AcknowledgeJobResponse200 from .acknowledge_job_response_401 import AcknowledgeJobResponse401 from .create_environment_body import CreateEnvironmentBody +from .create_environment_body_release_channels_item import CreateEnvironmentBodyReleaseChannelsItem +from .create_environment_body_target_filter import CreateEnvironmentBodyTargetFilter from .create_environment_response_200 import CreateEnvironmentResponse200 from .create_environment_response_200_environment import CreateEnvironmentResponse200Environment from .create_environment_response_200_environment_target_filter import ( CreateEnvironmentResponse200EnvironmentTargetFilter, ) +from .create_environment_response_409 import CreateEnvironmentResponse409 from .create_environment_response_500 import CreateEnvironmentResponse500 from .create_release_body import CreateReleaseBody from .create_release_body_metadata import CreateReleaseBodyMetadata from .create_release_channel_body import CreateReleaseChannelBody from .create_release_channel_body_release_filter import CreateReleaseChannelBodyReleaseFilter from .create_release_channel_response_200 import CreateReleaseChannelResponse200 +from .create_release_channel_response_200_release_filter import CreateReleaseChannelResponse200ReleaseFilter from .create_release_channel_response_401 import CreateReleaseChannelResponse401 from .create_release_channel_response_403 import CreateReleaseChannelResponse403 +from .create_release_channel_response_409 import CreateReleaseChannelResponse409 +from .create_release_channel_response_500 import CreateReleaseChannelResponse500 from .create_release_response_200 import CreateReleaseResponse200 from .create_release_response_200_metadata import CreateReleaseResponse200Metadata from .delete_target_by_identifier_response_200 import DeleteTargetByIdentifierResponse200 @@ -94,17 +100,23 @@ "AcknowledgeJobResponse200", "AcknowledgeJobResponse401", "CreateEnvironmentBody", + "CreateEnvironmentBodyReleaseChannelsItem", + "CreateEnvironmentBodyTargetFilter", "CreateEnvironmentResponse200", "CreateEnvironmentResponse200Environment", "CreateEnvironmentResponse200EnvironmentTargetFilter", + "CreateEnvironmentResponse409", "CreateEnvironmentResponse500", "CreateReleaseBody", "CreateReleaseBodyMetadata", "CreateReleaseChannelBody", "CreateReleaseChannelBodyReleaseFilter", "CreateReleaseChannelResponse200", + "CreateReleaseChannelResponse200ReleaseFilter", "CreateReleaseChannelResponse401", "CreateReleaseChannelResponse403", + "CreateReleaseChannelResponse409", + "CreateReleaseChannelResponse500", "CreateReleaseResponse200", "CreateReleaseResponse200Metadata", "DeleteTargetByIdentifierResponse200", diff --git a/ctrlplane/models/create_environment_body.py b/ctrlplane/models/create_environment_body.py index 335190e..967790a 100644 --- a/ctrlplane/models/create_environment_body.py +++ b/ctrlplane/models/create_environment_body.py @@ -1,5 +1,5 @@ import datetime -from typing import Any, Dict, List, Type, TypeVar, Union +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -7,6 +7,11 @@ from ..types import UNSET, Unset +if TYPE_CHECKING: + from ..models.create_environment_body_release_channels_item import CreateEnvironmentBodyReleaseChannelsItem + from ..models.create_environment_body_target_filter import CreateEnvironmentBodyTargetFilter + + T = TypeVar("T", bound="CreateEnvironmentBody") @@ -15,16 +20,43 @@ class CreateEnvironmentBody: """ Attributes: system_id (str): + name (str): + description (Union[Unset, str]): + target_filter (Union[Unset, CreateEnvironmentBodyTargetFilter]): + policy_id (Union[Unset, str]): + release_channels (Union[Unset, List['CreateEnvironmentBodyReleaseChannelsItem']]): expires_at (Union[Unset, datetime.datetime]): """ system_id: str + name: str + description: Union[Unset, str] = UNSET + target_filter: Union[Unset, "CreateEnvironmentBodyTargetFilter"] = UNSET + policy_id: Union[Unset, str] = UNSET + release_channels: Union[Unset, List["CreateEnvironmentBodyReleaseChannelsItem"]] = UNSET expires_at: Union[Unset, datetime.datetime] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: system_id = self.system_id + name = self.name + + description = self.description + + target_filter: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.target_filter, Unset): + target_filter = self.target_filter.to_dict() + + policy_id = self.policy_id + + release_channels: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.release_channels, Unset): + release_channels = [] + for release_channels_item_data in self.release_channels: + release_channels_item = release_channels_item_data.to_dict() + release_channels.append(release_channels_item) + expires_at: Union[Unset, str] = UNSET if not isinstance(self.expires_at, Unset): expires_at = self.expires_at.isoformat() @@ -34,8 +66,17 @@ def to_dict(self) -> Dict[str, Any]: field_dict.update( { "systemId": system_id, + "name": name, } ) + if description is not UNSET: + field_dict["description"] = description + if target_filter is not UNSET: + field_dict["targetFilter"] = target_filter + if policy_id is not UNSET: + field_dict["policyId"] = policy_id + if release_channels is not UNSET: + field_dict["releaseChannels"] = release_channels if expires_at is not UNSET: field_dict["expiresAt"] = expires_at @@ -43,9 +84,32 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.create_environment_body_release_channels_item import CreateEnvironmentBodyReleaseChannelsItem + from ..models.create_environment_body_target_filter import CreateEnvironmentBodyTargetFilter + d = src_dict.copy() system_id = d.pop("systemId") + name = d.pop("name") + + description = d.pop("description", UNSET) + + _target_filter = d.pop("targetFilter", UNSET) + target_filter: Union[Unset, CreateEnvironmentBodyTargetFilter] + if isinstance(_target_filter, Unset): + target_filter = UNSET + else: + target_filter = CreateEnvironmentBodyTargetFilter.from_dict(_target_filter) + + policy_id = d.pop("policyId", UNSET) + + release_channels = [] + _release_channels = d.pop("releaseChannels", UNSET) + for release_channels_item_data in _release_channels or []: + release_channels_item = CreateEnvironmentBodyReleaseChannelsItem.from_dict(release_channels_item_data) + + release_channels.append(release_channels_item) + _expires_at = d.pop("expiresAt", UNSET) expires_at: Union[Unset, datetime.datetime] if isinstance(_expires_at, Unset): @@ -55,6 +119,11 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: create_environment_body = cls( system_id=system_id, + name=name, + description=description, + target_filter=target_filter, + policy_id=policy_id, + release_channels=release_channels, expires_at=expires_at, ) diff --git a/ctrlplane/models/create_environment_body_release_channels_item.py b/ctrlplane/models/create_environment_body_release_channels_item.py new file mode 100644 index 0000000..0631718 --- /dev/null +++ b/ctrlplane/models/create_environment_body_release_channels_item.py @@ -0,0 +1,66 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateEnvironmentBodyReleaseChannelsItem") + + +@_attrs_define +class CreateEnvironmentBodyReleaseChannelsItem: + """ + Attributes: + channel_id (str): + deployment_id (str): + """ + + channel_id: str + deployment_id: str + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + channel_id = self.channel_id + + deployment_id = self.deployment_id + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "channelId": channel_id, + "deploymentId": deployment_id, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + channel_id = d.pop("channelId") + + deployment_id = d.pop("deploymentId") + + create_environment_body_release_channels_item = cls( + channel_id=channel_id, + deployment_id=deployment_id, + ) + + create_environment_body_release_channels_item.additional_properties = d + return create_environment_body_release_channels_item + + @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/ctrlplane/models/create_environment_body_target_filter.py b/ctrlplane/models/create_environment_body_target_filter.py new file mode 100644 index 0000000..8e93387 --- /dev/null +++ b/ctrlplane/models/create_environment_body_target_filter.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateEnvironmentBodyTargetFilter") + + +@_attrs_define +class CreateEnvironmentBodyTargetFilter: + """ """ + + additional_properties: Dict[str, Any] = _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: Dict[str, Any]) -> T: + d = src_dict.copy() + create_environment_body_target_filter = cls() + + create_environment_body_target_filter.additional_properties = d + return create_environment_body_target_filter + + @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/ctrlplane/models/create_environment_response_200_environment.py b/ctrlplane/models/create_environment_response_200_environment.py index 7126161..ff794b1 100644 --- a/ctrlplane/models/create_environment_response_200_environment.py +++ b/ctrlplane/models/create_environment_response_200_environment.py @@ -21,11 +21,15 @@ class CreateEnvironmentResponse200Environment: """ Attributes: system_id (str): + name (Union[Unset, str]): + description (Union[Unset, str]): expires_at (Union[None, Unset, datetime.datetime]): target_filter (Union[Unset, CreateEnvironmentResponse200EnvironmentTargetFilter]): """ system_id: str + name: Union[Unset, str] = UNSET + description: Union[Unset, str] = UNSET expires_at: Union[None, Unset, datetime.datetime] = UNSET target_filter: Union[Unset, "CreateEnvironmentResponse200EnvironmentTargetFilter"] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) @@ -33,6 +37,10 @@ class CreateEnvironmentResponse200Environment: def to_dict(self) -> Dict[str, Any]: system_id = self.system_id + name = self.name + + description = self.description + expires_at: Union[None, Unset, str] if isinstance(self.expires_at, Unset): expires_at = UNSET @@ -52,6 +60,10 @@ def to_dict(self) -> Dict[str, Any]: "systemId": system_id, } ) + if name is not UNSET: + field_dict["name"] = name + if description is not UNSET: + field_dict["description"] = description if expires_at is not UNSET: field_dict["expiresAt"] = expires_at if target_filter is not UNSET: @@ -68,6 +80,10 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() system_id = d.pop("systemId") + name = d.pop("name", UNSET) + + description = d.pop("description", UNSET) + def _parse_expires_at(data: object) -> Union[None, Unset, datetime.datetime]: if data is None: return data @@ -94,6 +110,8 @@ def _parse_expires_at(data: object) -> Union[None, Unset, datetime.datetime]: create_environment_response_200_environment = cls( system_id=system_id, + name=name, + description=description, expires_at=expires_at, target_filter=target_filter, ) diff --git a/ctrlplane/models/create_environment_response_409.py b/ctrlplane/models/create_environment_response_409.py new file mode 100644 index 0000000..a1d2663 --- /dev/null +++ b/ctrlplane/models/create_environment_response_409.py @@ -0,0 +1,67 @@ +from typing import Any, Dict, List, Type, TypeVar, Union + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CreateEnvironmentResponse409") + + +@_attrs_define +class CreateEnvironmentResponse409: + """ + Attributes: + error (Union[Unset, str]): + id (Union[Unset, str]): + """ + + error: Union[Unset, str] = UNSET + id: Union[Unset, str] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + error = self.error + + id = self.id + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if error is not UNSET: + field_dict["error"] = error + if id is not UNSET: + field_dict["id"] = id + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + error = d.pop("error", UNSET) + + id = d.pop("id", UNSET) + + create_environment_response_409 = cls( + error=error, + id=id, + ) + + create_environment_response_409.additional_properties = d + return create_environment_response_409 + + @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/ctrlplane/models/create_release_channel_body.py b/ctrlplane/models/create_release_channel_body.py index 3a6ca17..a7d9930 100644 --- a/ctrlplane/models/create_release_channel_body.py +++ b/ctrlplane/models/create_release_channel_body.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,36 +16,42 @@ class CreateReleaseChannelBody: """ Attributes: + deployment_id (str): name (str): - description (Union[Unset, str]): - release_filter (Union[Unset, CreateReleaseChannelBodyReleaseFilter]): + release_filter (CreateReleaseChannelBodyReleaseFilter): + description (Union[None, Unset, str]): """ + deployment_id: str name: str - description: Union[Unset, str] = UNSET - release_filter: Union[Unset, "CreateReleaseChannelBodyReleaseFilter"] = UNSET + release_filter: "CreateReleaseChannelBodyReleaseFilter" + description: Union[None, Unset, str] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: + deployment_id = self.deployment_id + name = self.name - description = self.description + release_filter = self.release_filter.to_dict() - release_filter: Union[Unset, Dict[str, Any]] = UNSET - if not isinstance(self.release_filter, Unset): - release_filter = self.release_filter.to_dict() + description: Union[None, Unset, str] + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { + "deploymentId": deployment_id, "name": name, + "releaseFilter": release_filter, } ) if description is not UNSET: field_dict["description"] = description - if release_filter is not UNSET: - field_dict["releaseFilter"] = release_filter return field_dict @@ -54,21 +60,26 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: from ..models.create_release_channel_body_release_filter import CreateReleaseChannelBodyReleaseFilter d = src_dict.copy() + deployment_id = d.pop("deploymentId") + name = d.pop("name") - description = d.pop("description", UNSET) + release_filter = CreateReleaseChannelBodyReleaseFilter.from_dict(d.pop("releaseFilter")) - _release_filter = d.pop("releaseFilter", UNSET) - release_filter: Union[Unset, CreateReleaseChannelBodyReleaseFilter] - if isinstance(_release_filter, Unset): - release_filter = UNSET - else: - release_filter = CreateReleaseChannelBodyReleaseFilter.from_dict(_release_filter) + def _parse_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + description = _parse_description(d.pop("description", UNSET)) create_release_channel_body = cls( + deployment_id=deployment_id, name=name, - description=description, release_filter=release_filter, + description=description, ) create_release_channel_body.additional_properties = d diff --git a/ctrlplane/models/create_release_channel_response_200.py b/ctrlplane/models/create_release_channel_response_200.py index 56054c8..79cb2b2 100644 --- a/ctrlplane/models/create_release_channel_response_200.py +++ b/ctrlplane/models/create_release_channel_response_200.py @@ -1,5 +1,5 @@ import datetime -from typing import Any, Dict, List, Type, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -7,6 +7,10 @@ from ..types import UNSET, Unset +if TYPE_CHECKING: + from ..models.create_release_channel_response_200_release_filter import CreateReleaseChannelResponse200ReleaseFilter + + T = TypeVar("T", bound="CreateReleaseChannelResponse200") @@ -15,31 +19,29 @@ class CreateReleaseChannelResponse200: """ Attributes: id (str): - name (str): deployment_id (str): + name (str): created_at (datetime.datetime): - updated_at (datetime.datetime): description (Union[None, Unset, str]): + release_filter (Union[Unset, CreateReleaseChannelResponse200ReleaseFilter]): """ id: str - name: str deployment_id: str + name: str created_at: datetime.datetime - updated_at: datetime.datetime description: Union[None, Unset, str] = UNSET + release_filter: Union[Unset, "CreateReleaseChannelResponse200ReleaseFilter"] = UNSET additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: id = self.id - name = self.name - deployment_id = self.deployment_id - created_at = self.created_at.isoformat() + name = self.name - updated_at = self.updated_at.isoformat() + created_at = self.created_at.isoformat() description: Union[None, Unset, str] if isinstance(self.description, Unset): @@ -47,34 +49,41 @@ def to_dict(self) -> Dict[str, Any]: else: description = self.description + release_filter: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.release_filter, Unset): + release_filter = self.release_filter.to_dict() + field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "id": id, - "name": name, "deploymentId": deployment_id, + "name": name, "createdAt": created_at, - "updatedAt": updated_at, } ) if description is not UNSET: field_dict["description"] = description + if release_filter is not UNSET: + field_dict["releaseFilter"] = release_filter return field_dict @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.create_release_channel_response_200_release_filter import ( + CreateReleaseChannelResponse200ReleaseFilter, + ) + d = src_dict.copy() id = d.pop("id") - name = d.pop("name") - deployment_id = d.pop("deploymentId") - created_at = isoparse(d.pop("createdAt")) + name = d.pop("name") - updated_at = isoparse(d.pop("updatedAt")) + created_at = isoparse(d.pop("createdAt")) def _parse_description(data: object) -> Union[None, Unset, str]: if data is None: @@ -85,13 +94,20 @@ def _parse_description(data: object) -> Union[None, Unset, str]: description = _parse_description(d.pop("description", UNSET)) + _release_filter = d.pop("releaseFilter", UNSET) + release_filter: Union[Unset, CreateReleaseChannelResponse200ReleaseFilter] + if isinstance(_release_filter, Unset): + release_filter = UNSET + else: + release_filter = CreateReleaseChannelResponse200ReleaseFilter.from_dict(_release_filter) + create_release_channel_response_200 = cls( id=id, - name=name, deployment_id=deployment_id, + name=name, created_at=created_at, - updated_at=updated_at, description=description, + release_filter=release_filter, ) create_release_channel_response_200.additional_properties = d diff --git a/ctrlplane/models/create_release_channel_response_200_release_filter.py b/ctrlplane/models/create_release_channel_response_200_release_filter.py new file mode 100644 index 0000000..23ba7ba --- /dev/null +++ b/ctrlplane/models/create_release_channel_response_200_release_filter.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateReleaseChannelResponse200ReleaseFilter") + + +@_attrs_define +class CreateReleaseChannelResponse200ReleaseFilter: + """ """ + + additional_properties: Dict[str, Any] = _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: Dict[str, Any]) -> T: + d = src_dict.copy() + create_release_channel_response_200_release_filter = cls() + + create_release_channel_response_200_release_filter.additional_properties = d + return create_release_channel_response_200_release_filter + + @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/ctrlplane/models/create_release_channel_response_409.py b/ctrlplane/models/create_release_channel_response_409.py new file mode 100644 index 0000000..05a0f32 --- /dev/null +++ b/ctrlplane/models/create_release_channel_response_409.py @@ -0,0 +1,66 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateReleaseChannelResponse409") + + +@_attrs_define +class CreateReleaseChannelResponse409: + """ + Attributes: + error (str): + id (str): + """ + + error: str + id: str + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + error = self.error + + id = self.id + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "error": error, + "id": id, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + error = d.pop("error") + + id = d.pop("id") + + create_release_channel_response_409 = cls( + error=error, + id=id, + ) + + create_release_channel_response_409.additional_properties = d + return create_release_channel_response_409 + + @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/ctrlplane/models/create_release_channel_response_500.py b/ctrlplane/models/create_release_channel_response_500.py new file mode 100644 index 0000000..298e2e8 --- /dev/null +++ b/ctrlplane/models/create_release_channel_response_500.py @@ -0,0 +1,58 @@ +from typing import Any, Dict, List, Type, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateReleaseChannelResponse500") + + +@_attrs_define +class CreateReleaseChannelResponse500: + """ + Attributes: + error (str): + """ + + error: str + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + error = self.error + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "error": error, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + error = d.pop("error") + + create_release_channel_response_500 = cls( + error=error, + ) + + create_release_channel_response_500.additional_properties = d + return create_release_channel_response_500 + + @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 aa736e8..06cf454 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,9 +36,9 @@ description = "A client library for accessing Ctrlplane API" authors = [] readme = "README.md" packages = [ - {include = "ctrlplane_api_client"}, + {include = "ctrlplane"}, ] -include = ["CHANGELOG.md", "ctrlplane_api_client/py.typed"] +include = ["CHANGELOG.md", "ctrlplane/py.typed"] [tool.hatch.build.targets.sdist] include = [