python3-core-api-client 1.1.1__tar.gz → 2.0__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 (112) hide show
  1. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/PKG-INFO +44 -11
  2. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/README.md +43 -10
  3. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/pyproject.toml +1 -1
  4. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/cyberfusion/CoreApiClient/connector.py +1 -0
  5. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/http.py +50 -0
  6. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/cyberfusion/CoreApiClient/models.py +14 -12
  7. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/basic_authentication_realms.py +94 -0
  8. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/borg_archives.py +143 -0
  9. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/borg_repositories.py +133 -0
  10. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/certificate_managers.py +107 -0
  11. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/certificates.py +64 -0
  12. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/clusters.py +254 -0
  13. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/cmses.py +293 -0
  14. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/crons.py +79 -0
  15. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/custom_config_snippets.py +96 -0
  16. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/custom_configs.py +82 -0
  17. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/customers.py +96 -0
  18. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/daemons.py +100 -0
  19. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/database_user_grants.py +84 -0
  20. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/database_users.py +82 -0
  21. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/databases.py +142 -0
  22. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/domain_routers.py +43 -0
  23. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/firewall_groups.py +82 -0
  24. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/firewall_rules.py +67 -0
  25. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/fpm_pools.py +113 -0
  26. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/ftp_users.py +94 -0
  27. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/haproxy_listens.py +67 -0
  28. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/haproxy_listens_to_nodes.py +76 -0
  29. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/health.py +15 -0
  30. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/hosts_entries.py +63 -0
  31. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/htpasswd_files.py +67 -0
  32. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/htpasswd_users.py +82 -0
  33. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/login.py +29 -0
  34. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/logs.py +97 -0
  35. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/mail_accounts.py +106 -0
  36. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/mail_aliases.py +79 -0
  37. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/mail_domains.py +79 -0
  38. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/mail_hostnames.py +82 -0
  39. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/malwares.py +52 -0
  40. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/mariadb_encryption_keys.py +62 -0
  41. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/node_add_ons.py +73 -0
  42. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/nodes.py +111 -0
  43. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/passenger_apps.py +100 -0
  44. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/redis_instances.py +85 -0
  45. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/root_ssh_keys.py +77 -0
  46. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/security_txt_policies.py +93 -0
  47. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/sites.py +29 -0
  48. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/ssh_keys.py +77 -0
  49. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/task_collections.py +38 -0
  50. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/tombstones.py +29 -0
  51. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/unix_users.py +121 -0
  52. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/url_redirects.py +79 -0
  53. python3_core_api_client-2.0/src/cyberfusion/CoreApiClient/resources/virtual_hosts.py +120 -0
  54. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/python3_core_api_client.egg-info/PKG-INFO +44 -11
  55. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/http.py +0 -21
  56. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/basic_authentication_realms.py +0 -85
  57. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/borg_archives.py +0 -144
  58. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/borg_repositories.py +0 -134
  59. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/certificate_managers.py +0 -99
  60. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/certificates.py +0 -63
  61. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/clusters.py +0 -248
  62. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/cmses.py +0 -292
  63. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/crons.py +0 -79
  64. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/custom_config_snippets.py +0 -88
  65. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/custom_configs.py +0 -82
  66. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/customers.py +0 -97
  67. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/daemons.py +0 -101
  68. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/database_user_grants.py +0 -79
  69. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/database_users.py +0 -82
  70. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/databases.py +0 -143
  71. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/domain_routers.py +0 -43
  72. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/firewall_groups.py +0 -82
  73. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/firewall_rules.py +0 -67
  74. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/fpm_pools.py +0 -113
  75. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/ftp_users.py +0 -92
  76. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/haproxy_listens.py +0 -67
  77. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/haproxy_listens_to_nodes.py +0 -70
  78. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/health.py +0 -14
  79. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/hosts_entries.py +0 -63
  80. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/htpasswd_files.py +0 -67
  81. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/htpasswd_users.py +0 -82
  82. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/login.py +0 -28
  83. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/logs.py +0 -96
  84. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/mail_accounts.py +0 -105
  85. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/mail_aliases.py +0 -79
  86. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/mail_domains.py +0 -79
  87. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/mail_hostnames.py +0 -82
  88. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/malwares.py +0 -53
  89. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/mariadb_encryption_keys.py +0 -56
  90. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/node_add_ons.py +0 -74
  91. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/nodes.py +0 -112
  92. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/passenger_apps.py +0 -100
  93. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/redis_instances.py +0 -85
  94. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/root_ssh_keys.py +0 -77
  95. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/security_txt_policies.py +0 -85
  96. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/sites.py +0 -29
  97. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/ssh_keys.py +0 -77
  98. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/task_collections.py +0 -38
  99. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/tombstones.py +0 -29
  100. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/unix_users.py +0 -122
  101. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/url_redirects.py +0 -79
  102. python3_core_api_client-1.1.1/src/cyberfusion/CoreApiClient/resources/virtual_hosts.py +0 -120
  103. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/setup.cfg +0 -0
  104. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/cyberfusion/CoreApiClient/__init__.py +0 -0
  105. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/cyberfusion/CoreApiClient/_encoders.py +0 -0
  106. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/cyberfusion/CoreApiClient/exceptions.py +0 -0
  107. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/cyberfusion/CoreApiClient/interfaces.py +0 -0
  108. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/cyberfusion/CoreApiClient/resources/__init__.py +0 -0
  109. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/python3_core_api_client.egg-info/SOURCES.txt +0 -0
  110. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/python3_core_api_client.egg-info/dependency_links.txt +0 -0
  111. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/src/python3_core_api_client.egg-info/requires.txt +0 -0
  112. {python3_core_api_client-1.1.1 → python3_core_api_client-2.0}/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: 1.1.1
3
+ Version: 2.0
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
@@ -9,7 +9,7 @@ Requires-Dist: certifi==2022.9.24
9
9
  Requires-Dist: requests==2.28.1
10
10
  Requires-Dist: pydantic[dotenv,email]==1.10.4
11
11
 
12
- # python3-core-api-client
12
+ # python3-core-api-client
13
13
 
14
14
  Python client for Core API.
15
15
 
@@ -69,7 +69,9 @@ connector = CoreApiConnector(
69
69
  api_key='api_key'
70
70
  )
71
71
 
72
- virtual_hosts = connector.virtual_hosts.list_virtual_hosts()
72
+ response = connector.virtual_hosts.list_virtual_hosts()
73
+
74
+ virtual_hosts = response.dto
73
75
  ```
74
76
 
75
77
  ## Authentication
@@ -168,7 +170,7 @@ for error in errors:
168
170
 
169
171
  ### Get model from response
170
172
 
171
- Calling an endpoint returns the resource model.
173
+ Calling an endpoint returns a response model (`DtoResponse`) containing the resource model (in the `dto` variable).
172
174
 
173
175
  Code example:
174
176
 
@@ -181,7 +183,7 @@ connector = CoreApiConnector(
181
183
  username='username', password='password'
182
184
  )
183
185
 
184
- mail_domain_resource = connector.mail_domains.create_mail_domain(
186
+ response = connector.mail_domains.create_mail_domain(
185
187
  MailDomainCreateRequest(
186
188
  domain='cyberfusion.io',
187
189
  unix_user_id=1,
@@ -189,9 +191,46 @@ mail_domain_resource = connector.mail_domains.create_mail_domain(
189
191
  catch_all_forward_email_addresses=[],
190
192
  )
191
193
  )
194
+
195
+ mail_domain_resource = response.dto
192
196
  # mail_domain_resource is a model representing the API resource
193
197
  ```
194
198
 
199
+ ### Get other information from response
200
+
201
+ The response model also contains the response status code, body (in both string and JSON format), headers and a failed boolean.
202
+
203
+ Need even more? Access the raw response object in `requests_response`.
204
+
205
+ Code example:
206
+
207
+ ```python
208
+ import requests_cache
209
+
210
+ from cyberfusion.CoreApiClient.connector import CoreApiConnector
211
+
212
+ from cyberfusion.CoreApiClient.models import MailAliasCreateRequest
213
+
214
+ connector = CoreApiConnector(
215
+ username='username', password='password', requests_session=requests_cache.CachedSession()
216
+ )
217
+
218
+ response = connector.mail_aliases.create_mail_alias(
219
+ MailAliasCreateRequest(
220
+ local_part='&^@$#^&@$#^&',
221
+ mail_domain_id=1,
222
+ )
223
+ )
224
+
225
+ if response.failed:
226
+ print("HTTP request failed with status code: ", response.status_code)
227
+
228
+ if response.requests_response.from_cache:
229
+ print("Cached response body: ", response.body)
230
+
231
+ json_body = response.json
232
+ ```
233
+
195
234
  ### Throw exception on failure
196
235
 
197
236
  If a request returns an unexpected HTTP status code, `cyberfusion.CoreApiClient.exceptions.CallException` is thrown.
@@ -236,12 +275,6 @@ from cyberfusion.CoreApiClient.connector import CoreApiConnector
236
275
  connector = CoreApiConnector(...)
237
276
 
238
277
  response = connector.send(method='GET', path='/foobar', data={}, query_parameters={})
239
-
240
- response.status_code
241
- response.json
242
- response.body
243
- response.headers
244
- response.failed
245
278
  ```
246
279
 
247
280
  To raise `cyberfusion.CoreApiClient.exceptions.CallException` in case of an unexpected HTTP status code, use `send_or_fail` instead of `send`. It takes the same parameters.
@@ -1,4 +1,4 @@
1
- # python3-core-api-client
1
+ # python3-core-api-client
2
2
 
3
3
  Python client for Core API.
4
4
 
@@ -58,7 +58,9 @@ connector = CoreApiConnector(
58
58
  api_key='api_key'
59
59
  )
60
60
 
61
- virtual_hosts = connector.virtual_hosts.list_virtual_hosts()
61
+ response = connector.virtual_hosts.list_virtual_hosts()
62
+
63
+ virtual_hosts = response.dto
62
64
  ```
63
65
 
64
66
  ## Authentication
@@ -157,7 +159,7 @@ for error in errors:
157
159
 
158
160
  ### Get model from response
159
161
 
160
- Calling an endpoint returns the resource model.
162
+ Calling an endpoint returns a response model (`DtoResponse`) containing the resource model (in the `dto` variable).
161
163
 
162
164
  Code example:
163
165
 
@@ -170,7 +172,7 @@ connector = CoreApiConnector(
170
172
  username='username', password='password'
171
173
  )
172
174
 
173
- mail_domain_resource = connector.mail_domains.create_mail_domain(
175
+ response = connector.mail_domains.create_mail_domain(
174
176
  MailDomainCreateRequest(
175
177
  domain='cyberfusion.io',
176
178
  unix_user_id=1,
@@ -178,9 +180,46 @@ mail_domain_resource = connector.mail_domains.create_mail_domain(
178
180
  catch_all_forward_email_addresses=[],
179
181
  )
180
182
  )
183
+
184
+ mail_domain_resource = response.dto
181
185
  # mail_domain_resource is a model representing the API resource
182
186
  ```
183
187
 
188
+ ### Get other information from response
189
+
190
+ The response model also contains the response status code, body (in both string and JSON format), headers and a failed boolean.
191
+
192
+ Need even more? Access the raw response object in `requests_response`.
193
+
194
+ Code example:
195
+
196
+ ```python
197
+ import requests_cache
198
+
199
+ from cyberfusion.CoreApiClient.connector import CoreApiConnector
200
+
201
+ from cyberfusion.CoreApiClient.models import MailAliasCreateRequest
202
+
203
+ connector = CoreApiConnector(
204
+ username='username', password='password', requests_session=requests_cache.CachedSession()
205
+ )
206
+
207
+ response = connector.mail_aliases.create_mail_alias(
208
+ MailAliasCreateRequest(
209
+ local_part='&^@$#^&@$#^&',
210
+ mail_domain_id=1,
211
+ )
212
+ )
213
+
214
+ if response.failed:
215
+ print("HTTP request failed with status code: ", response.status_code)
216
+
217
+ if response.requests_response.from_cache:
218
+ print("Cached response body: ", response.body)
219
+
220
+ json_body = response.json
221
+ ```
222
+
184
223
  ### Throw exception on failure
185
224
 
186
225
  If a request returns an unexpected HTTP status code, `cyberfusion.CoreApiClient.exceptions.CallException` is thrown.
@@ -225,12 +264,6 @@ from cyberfusion.CoreApiClient.connector import CoreApiConnector
225
264
  connector = CoreApiConnector(...)
226
265
 
227
266
  response = connector.send(method='GET', path='/foobar', data={}, query_parameters={})
228
-
229
- response.status_code
230
- response.json
231
- response.body
232
- response.headers
233
- response.failed
234
267
  ```
235
268
 
236
269
  To raise `cyberfusion.CoreApiClient.exceptions.CallException` in case of an unexpected HTTP status code, use `send_or_fail` instead of `send`. It takes the same parameters.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python3-core-api-client"
7
- version = "1.1.1"
7
+ version = "2.0"
8
8
  description = "Python client for Core API."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -131,6 +131,7 @@ class CoreApiClient:
131
131
  status_code=requests_response.status_code,
132
132
  body=requests_response.text,
133
133
  headers=requests_response.headers,
134
+ requests_response=requests_response,
134
135
  )
135
136
 
136
137
  return local_response
@@ -0,0 +1,50 @@
1
+ import json
2
+ from dataclasses import dataclass
3
+ from http import HTTPStatus
4
+ from typing import Any, TypeVar, Generic
5
+
6
+ from requests.structures import CaseInsensitiveDict
7
+
8
+ from cyberfusion.CoreApiClient.models import CoreApiModel
9
+
10
+ from requests.models import Response as RequestsResponse
11
+
12
+
13
+ ModelType = TypeVar("ModelType", bound=CoreApiModel)
14
+ DtoType = TypeVar("DtoType", CoreApiModel, list[CoreApiModel])
15
+
16
+
17
+ @dataclass
18
+ class Response:
19
+ status_code: int
20
+ body: str
21
+ headers: CaseInsensitiveDict
22
+ requests_response: RequestsResponse
23
+
24
+ @property
25
+ def failed(self) -> bool:
26
+ return self.status_code >= HTTPStatus.BAD_REQUEST
27
+
28
+ @property
29
+ def json(self) -> Any:
30
+ return json.loads(self.body)
31
+
32
+
33
+ @dataclass
34
+ class DtoResponse(Generic[DtoType], Response):
35
+ dto: DtoType
36
+
37
+ @classmethod
38
+ def from_response(cls, response: Response, model: type[ModelType]) -> "DtoResponse":
39
+ if isinstance(response.json, list):
40
+ dto = [model.parse_obj(object_) for object_ in response.json]
41
+ else:
42
+ dto = model.parse_obj(response.json)
43
+
44
+ return cls(
45
+ status_code=response.status_code,
46
+ body=response.body,
47
+ headers=response.headers,
48
+ requests_response=response.requests_response,
49
+ dto=dto,
50
+ )
@@ -1581,6 +1581,7 @@ class ObjectModelNameEnum(StrEnum):
1581
1581
  SITE_TO_CUSTOMER = "SiteToCustomer"
1582
1582
  SERVICE_ACCOUNT = "ServiceAccount"
1583
1583
  SERVICE_ACCOUNT_SERVER = "ServiceAccountServer"
1584
+ CUSTOM_CONFIG = "CustomConfig"
1584
1585
 
1585
1586
 
1586
1587
  class PHPExtensionEnum(StrEnum):
@@ -4030,10 +4031,6 @@ class NodeUpdateDeprecatedRequest(CoreApiModel):
4030
4031
  description="When health-checking the primary group (key), check health of additional groups (value). Node must have specified primary group and additional groups. The following primary groups are supported: Apache, nginx, Fast Redirect. The following additional groups are supported: MariaDB, PostgreSQL.\n\nCommon use case: when web server uses local database server, when checking web server health, check database server health.",
4031
4032
  title="Load Balancer Health Checks Groups Pairs",
4032
4033
  )
4033
- groups_properties: NodeGroupsProperties = Field(
4034
- ...,
4035
- description="Group-specific properties. Must be set to null for groups that the node does not have. Must be set to the correct value if the node has groups Redis, MariaDB, RabbitMQ.",
4036
- )
4037
4034
 
4038
4035
 
4039
4036
  class NodeUpdateRequest(CoreApiModel):
@@ -4052,10 +4049,6 @@ class NodeUpdateRequest(CoreApiModel):
4052
4049
  description="When health-checking the primary group (key), check health of additional groups (value). Node must have specified primary group and additional groups. The following primary groups are supported: Apache, nginx, Fast Redirect. The following additional groups are supported: MariaDB, PostgreSQL.\n\nCommon use case: when web server uses local database server, when checking web server health, check database server health.",
4053
4050
  title="Load Balancer Health Checks Groups Pairs",
4054
4051
  )
4055
- groups_properties: Optional[NodeGroupsProperties] = Field(
4056
- None,
4057
- description="Group-specific properties. Must be set to null for groups that the node does not have. Must be set to the correct value if the node has groups Redis, MariaDB, RabbitMQ.",
4058
- )
4059
4052
 
4060
4053
 
4061
4054
  class PassengerAppCreateNodeJSRequest(CoreApiModel):
@@ -4967,10 +4960,6 @@ class NodeCreateRequest(CoreApiModel):
4967
4960
  description="When health-checking the primary group (key), check health of additional groups (value). Node must have specified primary group and additional groups. The following primary groups are supported: Apache, nginx, Fast Redirect. The following additional groups are supported: MariaDB, PostgreSQL.\n\nCommon use case: when web server uses local database server, when checking web server health, check database server health.",
4968
4961
  title="Load Balancer Health Checks Groups Pairs",
4969
4962
  )
4970
- groups_properties: NodeGroupsProperties = Field(
4971
- ...,
4972
- description="Group-specific properties. Must be set to null for groups that the node does not have. Must be set to the correct value if the node has groups Redis, MariaDB, RabbitMQ.",
4973
- )
4974
4963
 
4975
4964
 
4976
4965
  class NodeCronDependency(CoreApiModel):
@@ -5437,6 +5426,10 @@ class TombstoneDataMailHostnameIncludes(BaseModel):
5437
5426
  pass
5438
5427
 
5439
5428
 
5429
+ class TombstoneDataCustomConfigIncludes(BaseModel):
5430
+ pass
5431
+
5432
+
5440
5433
  class TombstoneDataDatabaseUser(BaseModel):
5441
5434
  data_type: Literal["database_user"] = Field(..., title="Data Type")
5442
5435
  name: constr(regex=r"^[a-z0-9-_]+$", min_length=1, max_length=63) = Field(
@@ -5633,6 +5626,14 @@ class TombstoneDataVirtualHost(CoreApiModel):
5633
5626
  includes: TombstoneDataVirtualHostIncludes
5634
5627
 
5635
5628
 
5629
+ class TombstoneDataCustomConfig(CoreApiModel):
5630
+ data_type: Literal["custom_config"] = Field(..., title="Data Type")
5631
+ name: constr(regex=r"^[a-z0-9-_]+$", min_length=1, max_length=128) = Field(
5632
+ ..., title="Name"
5633
+ )
5634
+ includes: TombstoneDataCustomConfigIncludes
5635
+
5636
+
5636
5637
  class TombstoneIncludes(CoreApiModel):
5637
5638
  cluster: ClusterResource
5638
5639
 
@@ -5661,6 +5662,7 @@ class TombstoneResource(CoreApiModel):
5661
5662
  TombstoneDataSSHKey,
5662
5663
  TombstoneDataMailDomain,
5663
5664
  TombstoneDataMailHostname,
5665
+ TombstoneDataCustomConfig,
5664
5666
  ] = Field(..., discriminator="data_type", title="Data")
5665
5667
  object_id: int = Field(..., title="Object Id")
5666
5668
  object_model_name: ObjectModelNameEnum
@@ -0,0 +1,94 @@
1
+ from cyberfusion.CoreApiClient import models
2
+ from typing import Optional, List
3
+
4
+ from cyberfusion.CoreApiClient.http import DtoResponse
5
+ from cyberfusion.CoreApiClient.interfaces import Resource
6
+
7
+
8
+ class BasicAuthenticationRealms(Resource):
9
+ def create_basic_authentication_realm(
10
+ self,
11
+ request: models.BasicAuthenticationRealmCreateRequest,
12
+ ) -> DtoResponse[models.BasicAuthenticationRealmResource]:
13
+ local_response = self.api_connector.send_or_fail(
14
+ "POST",
15
+ "/api/v1/basic-authentication-realms",
16
+ data=request.dict(exclude_unset=True),
17
+ query_parameters={},
18
+ )
19
+
20
+ return DtoResponse.from_response(
21
+ local_response, models.BasicAuthenticationRealmResource
22
+ )
23
+
24
+ def list_basic_authentication_realms(
25
+ self,
26
+ *,
27
+ skip: Optional[int] = None,
28
+ limit: Optional[int] = None,
29
+ filter_: Optional[List[str]] = None,
30
+ sort: Optional[List[str]] = None,
31
+ ) -> DtoResponse[list[models.BasicAuthenticationRealmResource]]:
32
+ local_response = self.api_connector.send_or_fail(
33
+ "GET",
34
+ "/api/v1/basic-authentication-realms",
35
+ data=None,
36
+ query_parameters={
37
+ "skip": skip,
38
+ "limit": limit,
39
+ "filter": filter_,
40
+ "sort": sort,
41
+ },
42
+ )
43
+
44
+ return DtoResponse.from_response(
45
+ local_response, models.BasicAuthenticationRealmResource
46
+ )
47
+
48
+ def read_basic_authentication_realm(
49
+ self,
50
+ *,
51
+ id_: int,
52
+ ) -> DtoResponse[models.BasicAuthenticationRealmResource]:
53
+ local_response = self.api_connector.send_or_fail(
54
+ "GET",
55
+ f"/api/v1/basic-authentication-realms/{id_}",
56
+ data=None,
57
+ query_parameters={},
58
+ )
59
+
60
+ return DtoResponse.from_response(
61
+ local_response,
62
+ models.BasicAuthenticationRealmResource,
63
+ )
64
+
65
+ def update_basic_authentication_realm(
66
+ self,
67
+ request: models.BasicAuthenticationRealmUpdateRequest,
68
+ *,
69
+ id_: int,
70
+ ) -> DtoResponse[models.BasicAuthenticationRealmResource]:
71
+ local_response = self.api_connector.send_or_fail(
72
+ "PATCH",
73
+ f"/api/v1/basic-authentication-realms/{id_}",
74
+ data=request.dict(exclude_unset=True),
75
+ query_parameters={},
76
+ )
77
+
78
+ return DtoResponse.from_response(
79
+ local_response, models.BasicAuthenticationRealmResource
80
+ )
81
+
82
+ def delete_basic_authentication_realm(
83
+ self,
84
+ *,
85
+ id_: int,
86
+ ) -> DtoResponse[models.DetailMessage]:
87
+ local_response = self.api_connector.send_or_fail(
88
+ "DELETE",
89
+ f"/api/v1/basic-authentication-realms/{id_}",
90
+ data=None,
91
+ query_parameters={},
92
+ )
93
+
94
+ return DtoResponse.from_response(local_response, models.DetailMessage)
@@ -0,0 +1,143 @@
1
+ from cyberfusion.CoreApiClient import models
2
+ from typing import Optional, List
3
+
4
+ from cyberfusion.CoreApiClient.http import DtoResponse
5
+ from cyberfusion.CoreApiClient.interfaces import Resource
6
+
7
+
8
+ class BorgArchives(Resource):
9
+ def create_borg_archive_for_database(
10
+ self,
11
+ request: models.BorgArchiveCreateDatabaseRequest,
12
+ *,
13
+ callback_url: Optional[str] = None,
14
+ ) -> DtoResponse[models.TaskCollectionResource]:
15
+ local_response = self.api_connector.send_or_fail(
16
+ "POST",
17
+ "/api/v1/borg-archives/database",
18
+ data=request.dict(exclude_unset=True),
19
+ query_parameters={
20
+ "callback_url": callback_url,
21
+ },
22
+ )
23
+
24
+ return DtoResponse.from_response(local_response, models.TaskCollectionResource)
25
+
26
+ def create_borg_archive_for_unix_user(
27
+ self,
28
+ request: models.BorgArchiveCreateUNIXUserRequest,
29
+ *,
30
+ callback_url: Optional[str] = None,
31
+ ) -> DtoResponse[models.TaskCollectionResource]:
32
+ local_response = self.api_connector.send_or_fail(
33
+ "POST",
34
+ "/api/v1/borg-archives/unix-user",
35
+ data=request.dict(exclude_unset=True),
36
+ query_parameters={
37
+ "callback_url": callback_url,
38
+ },
39
+ )
40
+
41
+ return DtoResponse.from_response(local_response, models.TaskCollectionResource)
42
+
43
+ def list_borg_archives(
44
+ self,
45
+ *,
46
+ skip: Optional[int] = None,
47
+ limit: Optional[int] = None,
48
+ filter_: Optional[List[str]] = None,
49
+ sort: Optional[List[str]] = None,
50
+ ) -> DtoResponse[list[models.BorgArchiveResource]]:
51
+ local_response = self.api_connector.send_or_fail(
52
+ "GET",
53
+ "/api/v1/borg-archives",
54
+ data=None,
55
+ query_parameters={
56
+ "skip": skip,
57
+ "limit": limit,
58
+ "filter": filter_,
59
+ "sort": sort,
60
+ },
61
+ )
62
+
63
+ return DtoResponse.from_response(local_response, models.BorgArchiveResource)
64
+
65
+ def read_borg_archive(
66
+ self,
67
+ *,
68
+ id_: int,
69
+ ) -> DtoResponse[models.BorgArchiveResource]:
70
+ local_response = self.api_connector.send_or_fail(
71
+ "GET", f"/api/v1/borg-archives/{id_}", data=None, query_parameters={}
72
+ )
73
+
74
+ return DtoResponse.from_response(local_response, models.BorgArchiveResource)
75
+
76
+ def get_borg_archive_metadata(
77
+ self,
78
+ *,
79
+ id_: int,
80
+ ) -> DtoResponse[models.BorgArchiveMetadata]:
81
+ local_response = self.api_connector.send_or_fail(
82
+ "GET",
83
+ f"/api/v1/borg-archives/{id_}/metadata",
84
+ data=None,
85
+ query_parameters={},
86
+ )
87
+
88
+ return DtoResponse.from_response(local_response, models.BorgArchiveMetadata)
89
+
90
+ def restore_borg_archive(
91
+ self,
92
+ *,
93
+ id_: int,
94
+ callback_url: Optional[str] = None,
95
+ path: Optional[str] = None,
96
+ ) -> DtoResponse[models.TaskCollectionResource]:
97
+ local_response = self.api_connector.send_or_fail(
98
+ "POST",
99
+ f"/api/v1/borg-archives/{id_}/restore",
100
+ data=None,
101
+ query_parameters={
102
+ "callback_url": callback_url,
103
+ "path": path,
104
+ },
105
+ )
106
+
107
+ return DtoResponse.from_response(local_response, models.TaskCollectionResource)
108
+
109
+ def list_borg_archive_contents(
110
+ self,
111
+ *,
112
+ id_: int,
113
+ path: Optional[str] = None,
114
+ ) -> DtoResponse[list[models.BorgArchiveContent]]:
115
+ local_response = self.api_connector.send_or_fail(
116
+ "GET",
117
+ f"/api/v1/borg-archives/{id_}/contents",
118
+ data=None,
119
+ query_parameters={
120
+ "path": path,
121
+ },
122
+ )
123
+
124
+ return DtoResponse.from_response(local_response, models.BorgArchiveContent)
125
+
126
+ def download_borg_archive(
127
+ self,
128
+ *,
129
+ id_: int,
130
+ callback_url: Optional[str] = None,
131
+ path: Optional[str] = None,
132
+ ) -> DtoResponse[models.TaskCollectionResource]:
133
+ local_response = self.api_connector.send_or_fail(
134
+ "POST",
135
+ f"/api/v1/borg-archives/{id_}/download",
136
+ data=None,
137
+ query_parameters={
138
+ "callback_url": callback_url,
139
+ "path": path,
140
+ },
141
+ )
142
+
143
+ return DtoResponse.from_response(local_response, models.TaskCollectionResource)