diff --git a/mpt_api_client/resources/accounts/accounts.py b/mpt_api_client/resources/accounts/accounts.py index 4c97ff0..cb78ca4 100644 --- a/mpt_api_client/resources/accounts/accounts.py +++ b/mpt_api_client/resources/accounts/accounts.py @@ -1,6 +1,10 @@ from mpt_api_client.http import AsyncHTTPClient, HTTPClient from mpt_api_client.resources.accounts.account import AccountsService, AsyncAccountsService from mpt_api_client.resources.accounts.api_tokens import ApiTokensService, AsyncApiTokensService +from mpt_api_client.resources.accounts.cloud_tenants import ( + AsyncCloudTenantsService, + CloudTenantsService, +) from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService from mpt_api_client.resources.accounts.modules import AsyncModulesService, ModulesService from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService @@ -52,6 +56,11 @@ def modules(self) -> ModulesService: """Modules service.""" return ModulesService(http_client=self.http_client) + @property + def cloud_tenants(self) -> CloudTenantsService: + """Cloud Tenants service.""" + return CloudTenantsService(http_client=self.http_client) + class AsyncAccounts: """Async Accounts MPT API Module.""" @@ -93,3 +102,8 @@ def api_tokens(self) -> AsyncApiTokensService: def modules(self) -> AsyncModulesService: """Modules service.""" return AsyncModulesService(http_client=self.http_client) + + @property + def cloud_tenants(self) -> AsyncCloudTenantsService: + """Cloud Tenants service.""" + return AsyncCloudTenantsService(http_client=self.http_client) diff --git a/mpt_api_client/resources/accounts/cloud_tenants.py b/mpt_api_client/resources/accounts/cloud_tenants.py new file mode 100644 index 0000000..6fe48a5 --- /dev/null +++ b/mpt_api_client/resources/accounts/cloud_tenants.py @@ -0,0 +1,42 @@ +from mpt_api_client.http import AsyncService, Service +from mpt_api_client.http.mixins import ( + AsyncCreateMixin, + AsyncDeleteMixin, + AsyncUpdateMixin, + CreateMixin, + DeleteMixin, + UpdateMixin, +) +from mpt_api_client.models import Model + + +class CloudTenant(Model): + """Cloud Tenant Model.""" + + +class CloudTenantsServiceConfig: + """Cloud Tenants Service Configuration.""" + + _endpoint = "/public/v1/accounts/cloud-tenants" + _model_class = CloudTenant + _collection_key = "data" + + +class CloudTenantsService( + CreateMixin[CloudTenant], + DeleteMixin, + UpdateMixin[CloudTenant], + Service[CloudTenant], + CloudTenantsServiceConfig, +): + """Cloud Tenants Service.""" + + +class AsyncCloudTenantsService( + AsyncCreateMixin[CloudTenant], + AsyncDeleteMixin, + AsyncUpdateMixin[CloudTenant], + AsyncService[CloudTenant], + CloudTenantsServiceConfig, +): + """Async Cloud Tenants Service.""" diff --git a/tests/resources/accounts/test_accounts.py b/tests/resources/accounts/test_accounts.py index d673878..68544ab 100644 --- a/tests/resources/accounts/test_accounts.py +++ b/tests/resources/accounts/test_accounts.py @@ -6,6 +6,10 @@ ApiTokensService, AsyncApiTokensService, ) +from mpt_api_client.resources.accounts.cloud_tenants import ( + AsyncCloudTenantsService, + CloudTenantsService, +) from mpt_api_client.resources.accounts.licensees import AsyncLicenseesService, LicenseesService from mpt_api_client.resources.accounts.modules import AsyncModulesService, ModulesService from mpt_api_client.resources.accounts.sellers import AsyncSellersService, SellersService @@ -36,6 +40,7 @@ def async_accounts(async_http_client): ("user_groups", UserGroupsService), ("api_tokens", ApiTokensService), ("modules", ModulesService), + ("cloud_tenants", CloudTenantsService), ], ) def test_accounts_properties(accounts, property_name, expected_service_class): @@ -56,6 +61,7 @@ def test_accounts_properties(accounts, property_name, expected_service_class): ("user_groups", AsyncUserGroupsService), ("api_tokens", AsyncApiTokensService), ("modules", AsyncModulesService), + ("cloud_tenants", AsyncCloudTenantsService), ], ) def test_async_accounts_properties(async_accounts, property_name, expected_service_class): diff --git a/tests/resources/accounts/test_cloud_tenants.py b/tests/resources/accounts/test_cloud_tenants.py new file mode 100644 index 0000000..a984717 --- /dev/null +++ b/tests/resources/accounts/test_cloud_tenants.py @@ -0,0 +1,32 @@ +import pytest + +from mpt_api_client.resources.accounts.cloud_tenants import ( + AsyncCloudTenantsService, + CloudTenantsService, +) + + +@pytest.fixture +def cloud_tenants_service(http_client): + return CloudTenantsService(http_client=http_client) + + +@pytest.fixture +def async_cloud_tenants_service(async_http_client): + return AsyncCloudTenantsService(http_client=async_http_client) + + +@pytest.mark.parametrize( + "method", + ["get", "create", "update", "delete"], +) +def test_cloud_tenants_mixins_present(cloud_tenants_service, method): + assert hasattr(cloud_tenants_service, method) + + +@pytest.mark.parametrize( + "method", + ["get", "create", "update", "delete"], +) +def test_async_cloud_tenants_mixins_present(async_cloud_tenants_service, method): + assert hasattr(async_cloud_tenants_service, method)