python3-core-api-client 0.2__tar.gz → 0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/PKG-INFO +1 -1
  2. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/pyproject.toml +1 -1
  3. python3_core_api_client-0.4/src/cyberfusion/CoreApiClient/_encoders.py +14 -0
  4. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/connector.py +3 -3
  5. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/models.py +12 -14
  6. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/python3_core_api_client.egg-info/PKG-INFO +1 -1
  7. python3_core_api_client-0.2/src/cyberfusion/CoreApiClient/_encoders.py +0 -7
  8. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/README.md +0 -0
  9. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/setup.cfg +0 -0
  10. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/__init__.py +0 -0
  11. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/exceptions.py +0 -0
  12. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/http.py +0 -0
  13. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/interfaces.py +0 -0
  14. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/__init__.py +0 -0
  15. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/basic_authentication_realms.py +0 -0
  16. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/borg_archives.py +0 -0
  17. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/borg_repositories.py +0 -0
  18. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/certificate_managers.py +0 -0
  19. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/certificates.py +0 -0
  20. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/clusters.py +0 -0
  21. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/cmses.py +0 -0
  22. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/crons.py +0 -0
  23. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/custom_config_snippets.py +0 -0
  24. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/custom_configs.py +0 -0
  25. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/customers.py +0 -0
  26. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/daemons.py +0 -0
  27. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/database_user_grants.py +0 -0
  28. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/database_users.py +0 -0
  29. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/databases.py +0 -0
  30. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/domain_routers.py +0 -0
  31. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/firewall_groups.py +0 -0
  32. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/firewall_rules.py +0 -0
  33. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/fpm_pools.py +0 -0
  34. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/ftp_users.py +0 -0
  35. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/haproxy_listens.py +0 -0
  36. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/haproxy_listens_to_nodes.py +0 -0
  37. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/health.py +0 -0
  38. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/hosts_entries.py +0 -0
  39. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/htpasswd_files.py +0 -0
  40. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/htpasswd_users.py +0 -0
  41. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/login.py +0 -0
  42. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/logs.py +0 -0
  43. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/mail_accounts.py +0 -0
  44. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/mail_aliases.py +0 -0
  45. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/mail_domains.py +0 -0
  46. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/mail_hostnames.py +0 -0
  47. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/malwares.py +0 -0
  48. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/mariadb_encryption_keys.py +0 -0
  49. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/node_add_ons.py +0 -0
  50. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/nodes.py +0 -0
  51. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/passenger_apps.py +0 -0
  52. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/redis_instances.py +0 -0
  53. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/root_ssh_keys.py +0 -0
  54. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/security_txt_policies.py +0 -0
  55. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/sites.py +0 -0
  56. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/ssh_keys.py +0 -0
  57. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/task_collections.py +0 -0
  58. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/tombstones.py +0 -0
  59. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/unix_users.py +0 -0
  60. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/url_redirects.py +0 -0
  61. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/cyberfusion/CoreApiClient/resources/virtual_hosts.py +0 -0
  62. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/python3_core_api_client.egg-info/SOURCES.txt +0 -0
  63. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/python3_core_api_client.egg-info/dependency_links.txt +0 -0
  64. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/python3_core_api_client.egg-info/requires.txt +0 -0
  65. {python3_core_api_client-0.2 → python3_core_api_client-0.4}/src/python3_core_api_client.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-core-api-client
3
- Version: 0.2
3
+ Version: 0.4
4
4
  Summary: Python client for Core API.
5
5
  Author-email: Cyberfusion <support@cyberfusion.io>
6
6
  Project-URL: Source, https://github.com/CyberfusionIO/python3-core-api-client
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python3-core-api-client"
7
- version = "0.2"
7
+ version = "0.4"
8
8
  description = "Python client for Core API."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -0,0 +1,14 @@
1
+ import datetime
2
+ from json import JSONEncoder
3
+ from ipaddress import IPv4Address, IPv6Address
4
+ from typing import Any
5
+
6
+
7
+ class CustomEncoder(JSONEncoder):
8
+ def default(self, o: Any) -> str:
9
+ if isinstance(o, datetime.date):
10
+ return o.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
11
+ elif isinstance(o, (IPv6Address, IPv4Address)):
12
+ return str(o)
13
+
14
+ return super().default(o)
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  from typing import Optional, Tuple
3
3
 
4
- from cyberfusion.CoreApiClient._encoders import DatetimeEncoder
4
+ from cyberfusion.CoreApiClient._encoders import CustomEncoder
5
5
  from cyberfusion.CoreApiClient.exceptions import CallException, AuthenticationException
6
6
 
7
7
  from requests.sessions import Session
@@ -108,13 +108,13 @@ class CoreApiClient:
108
108
  url = "".join([self.base_url, path])
109
109
 
110
110
  if data and content_type == "application/json":
111
- data = json.dumps(data, cls=DatetimeEncoder)
111
+ data = json.dumps(data, cls=CustomEncoder)
112
112
 
113
113
  if query_parameters:
114
114
  for key, value in query_parameters.items():
115
115
  if isinstance(value, datetime.datetime):
116
116
  query_parameters[key] = json.loads(
117
- json.dumps(value, cls=DatetimeEncoder)
117
+ json.dumps(value, cls=CustomEncoder)
118
118
  )
119
119
 
120
120
  requests_response = self.requests_session.request(
@@ -1110,7 +1110,7 @@ class HTTPRetryConditionEnum(StrEnum):
1110
1110
  EMPTY_RESPONSE = "Empty response"
1111
1111
  JUNK_RESPONSE = "Junk response"
1112
1112
  RESPONSE_TIMEOUT = "Response timeout"
1113
- FIELD_0_RTT_REJECTED = "0-RTT rejected"
1113
+ ZERO_RTT_REJECTED = "0-RTT rejected"
1114
1114
  HTTP_STATUS_401 = "HTTP status 401"
1115
1115
  HTTP_STATUS_403 = "HTTP status 403"
1116
1116
  HTTP_STATUS_404 = "HTTP status 404"
@@ -1856,11 +1856,11 @@ class TokenTypeEnum(StrEnum):
1856
1856
 
1857
1857
 
1858
1858
  class TombstoneDataCertificate(CoreApiModel):
1859
- data_type: Literal["certificate"] = Field(..., const=True, title="Data Type")
1859
+ data_type: Literal["certificate"] = Field(..., title="Data Type")
1860
1860
 
1861
1861
 
1862
1862
  class TombstoneDataCron(CoreApiModel):
1863
- data_type: Literal["cron"] = Field(..., const=True, title="Data Type")
1863
+ data_type: Literal["cron"] = Field(..., title="Data Type")
1864
1864
  name: constr(regex=r"^[a-z0-9-_]+$", min_length=1, max_length=64) = Field(
1865
1865
  ..., title="Name"
1866
1866
  )
@@ -1868,14 +1868,14 @@ class TombstoneDataCron(CoreApiModel):
1868
1868
 
1869
1869
 
1870
1870
  class TombstoneDataDaemon(CoreApiModel):
1871
- data_type: Literal["daemon"] = Field(..., const=True, title="Data Type")
1871
+ data_type: Literal["daemon"] = Field(..., title="Data Type")
1872
1872
  name: constr(regex=r"^[a-z0-9-_]+$", min_length=1, max_length=64) = Field(
1873
1873
  ..., title="Name"
1874
1874
  )
1875
1875
 
1876
1876
 
1877
1877
  class TombstoneDataFPMPool(CoreApiModel):
1878
- data_type: Literal["fpm_pool"] = Field(..., const=True, title="Data Type")
1878
+ data_type: Literal["fpm_pool"] = Field(..., title="Data Type")
1879
1879
  version: str = Field(..., title="Version")
1880
1880
  name: constr(regex=r"^[a-z0-9-_]+$", min_length=1, max_length=64) = Field(
1881
1881
  ..., title="Name"
@@ -1883,7 +1883,7 @@ class TombstoneDataFPMPool(CoreApiModel):
1883
1883
 
1884
1884
 
1885
1885
  class TombstoneDataMailAccount(CoreApiModel):
1886
- data_type: Literal["mail_account"] = Field(..., const=True, title="Data Type")
1886
+ data_type: Literal["mail_account"] = Field(..., title="Data Type")
1887
1887
  local_part: constr(regex=r"^[a-z0-9-.]+$", min_length=1, max_length=64) = Field(
1888
1888
  ...,
1889
1889
  description="May not be in use by mail alias in the same mail domain.",
@@ -1894,14 +1894,14 @@ class TombstoneDataMailAccount(CoreApiModel):
1894
1894
 
1895
1895
 
1896
1896
  class TombstoneDataPassengerApp(CoreApiModel):
1897
- data_type: Literal["passenger_app"] = Field(..., const=True, title="Data Type")
1897
+ data_type: Literal["passenger_app"] = Field(..., title="Data Type")
1898
1898
  name: constr(regex=r"^[a-z0-9-_]+$", min_length=1, max_length=64) = Field(
1899
1899
  ..., title="Name"
1900
1900
  )
1901
1901
 
1902
1902
 
1903
1903
  class TombstoneDataRedisInstance(CoreApiModel):
1904
- data_type: Literal["redis_instance"] = Field(..., const=True, title="Data Type")
1904
+ data_type: Literal["redis_instance"] = Field(..., title="Data Type")
1905
1905
  name: constr(regex=r"^[a-z0-9-_]+$", min_length=1, max_length=64) = Field(
1906
1906
  ..., title="Name"
1907
1907
  )
@@ -1909,22 +1909,20 @@ class TombstoneDataRedisInstance(CoreApiModel):
1909
1909
 
1910
1910
 
1911
1911
  class TombstoneDataUNIXUser(CoreApiModel):
1912
- data_type: Literal["unix_user"] = Field(..., const=True, title="Data Type")
1912
+ data_type: Literal["unix_user"] = Field(..., title="Data Type")
1913
1913
  home_directory: str = Field(..., title="Home Directory")
1914
1914
  delete_on_cluster: Optional[bool] = Field(False, title="Delete On Cluster")
1915
1915
 
1916
1916
 
1917
1917
  class TombstoneDataUNIXUserRabbitMQCredentials(CoreApiModel):
1918
- data_type: Literal["unix_user_rabbitmq_credentials"] = Field(
1919
- ..., const=True, title="Data Type"
1920
- )
1918
+ data_type: Literal["unix_user_rabbitmq_credentials"] = Field(..., title="Data Type")
1921
1919
  rabbitmq_virtual_host_name: constr(
1922
1920
  regex=r"^[a-z0-9-.]+$", min_length=1, max_length=32
1923
1921
  ) = Field(..., title="Rabbitmq Virtual Host Name")
1924
1922
 
1925
1923
 
1926
1924
  class TombstoneDataVirtualHost(CoreApiModel):
1927
- data_type: Literal["virtual_host"] = Field(..., const=True, title="Data Type")
1925
+ data_type: Literal["virtual_host"] = Field(..., title="Data Type")
1928
1926
  domain_root: str = Field(..., title="Domain Root")
1929
1927
  delete_on_cluster: Optional[bool] = Field(False, title="Delete On Cluster")
1930
1928
 
@@ -1934,7 +1932,7 @@ class TombstoneIncludes(CoreApiModel):
1934
1932
 
1935
1933
 
1936
1934
  class TombstoneDataDatabase(CoreApiModel):
1937
- data_type: Literal["database"] = Field(..., const=True, title="Data Type")
1935
+ data_type: Literal["database"] = Field(..., title="Data Type")
1938
1936
  name: constr(regex=r"^[a-z0-9-_]+$", min_length=1, max_length=63) = Field(
1939
1937
  ..., title="Name"
1940
1938
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-core-api-client
3
- Version: 0.2
3
+ Version: 0.4
4
4
  Summary: Python client for Core API.
5
5
  Author-email: Cyberfusion <support@cyberfusion.io>
6
6
  Project-URL: Source, https://github.com/CyberfusionIO/python3-core-api-client
@@ -1,7 +0,0 @@
1
- import datetime
2
- from json import JSONEncoder
3
-
4
-
5
- class DatetimeEncoder(JSONEncoder):
6
- def default(self, o: datetime.datetime) -> str:
7
- return o.strftime("%Y-%m-%dT%H:%M:%S.%fZ")