stackit-certificates 1.2.0__tar.gz → 1.3.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 (24) hide show
  1. stackit_certificates-1.3.0/.gitignore +267 -0
  2. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/PKG-INFO +10 -11
  3. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/pyproject.toml +49 -37
  4. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/__init__.py +10 -0
  5. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/api/default_api.py +254 -0
  6. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/api_client.py +22 -9
  7. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/exceptions.py +1 -1
  8. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/models/__init__.py +3 -1
  9. stackit_certificates-1.3.0/src/stackit/certificates/models/certificates_quota.py +86 -0
  10. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/models/create_certificate_payload.py +2 -3
  11. stackit_certificates-1.3.0/src/stackit/certificates/models/get_quota_response.py +125 -0
  12. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/models/list_certificates_response.py +3 -3
  13. stackit_certificates-1.3.0/src/stackit/certificates/models/quotas.py +92 -0
  14. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/models/status.py +3 -3
  15. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/rest.py +19 -3
  16. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/LICENSE.md +0 -0
  17. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/NOTICE.txt +0 -0
  18. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/README.md +0 -0
  19. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/api/__init__.py +0 -0
  20. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/api_response.py +0 -0
  21. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/configuration.py +0 -0
  22. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/models/get_certificate_response.py +0 -0
  23. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/models/google_protobuf_any.py +0 -0
  24. {stackit_certificates-1.2.0 → stackit_certificates-1.3.0}/src/stackit/certificates/py.typed +0 -0
@@ -0,0 +1,267 @@
1
+ ### VisualStudioCode template
2
+ .vscode/*
3
+ !.vscode/settings.json
4
+ !.vscode/tasks.json
5
+ !.vscode/launch.json
6
+ !.vscode/extensions.json
7
+ !.vscode/*.code-snippets
8
+
9
+ # Local History for Visual Studio Code
10
+ .history/
11
+
12
+ # Built Visual Studio Code Extensions
13
+ *.vsix
14
+
15
+ ### JetBrains template
16
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
17
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
18
+
19
+ # User-specific stuff
20
+ .idea/**/workspace.xml
21
+ .idea/**/tasks.xml
22
+ .idea/**/usage.statistics.xml
23
+ .idea/**/dictionaries
24
+ .idea/**/shelf
25
+
26
+ # AWS User-specific
27
+ .idea/**/aws.xml
28
+
29
+ # Generated files
30
+ .idea/**/contentModel.xml
31
+
32
+ # Sensitive or high-churn files
33
+ .idea/**/dataSources/
34
+ .idea/**/dataSources.ids
35
+ .idea/**/dataSources.local.xml
36
+ .idea/**/sqlDataSources.xml
37
+ .idea/**/dynamic.xml
38
+ .idea/**/uiDesigner.xml
39
+ .idea/**/dbnavigator.xml
40
+
41
+ # Gradle
42
+ .idea/**/gradle.xml
43
+ .idea/**/libraries
44
+
45
+ # Gradle and Maven with auto-import
46
+ # When using Gradle or Maven with auto-import, you should exclude module files,
47
+ # since they will be recreated, and may cause churn. Uncomment if using
48
+ # auto-import.
49
+ # .idea/artifacts
50
+ # .idea/compiler.xml
51
+ # .idea/jarRepositories.xml
52
+ # .idea/modules.xml
53
+ # .idea/*.iml
54
+ # .idea/modules
55
+ # *.iml
56
+ # *.ipr
57
+
58
+ # CMake
59
+ cmake-build-*/
60
+
61
+ # Mongo Explorer plugin
62
+ .idea/**/mongoSettings.xml
63
+
64
+ # File-based project format
65
+ *.iws
66
+
67
+ # IntelliJ
68
+ out/
69
+
70
+ # mpeltonen/sbt-idea plugin
71
+ .idea_modules/
72
+
73
+ # JIRA plugin
74
+ atlassian-ide-plugin.xml
75
+
76
+ # Cursive Clojure plugin
77
+ .idea/replstate.xml
78
+
79
+ # SonarLint plugin
80
+ .idea/sonarlint/
81
+
82
+ # Crashlytics plugin (for Android Studio and IntelliJ)
83
+ com_crashlytics_export_strings.xml
84
+ crashlytics.properties
85
+ crashlytics-build.properties
86
+ fabric.properties
87
+
88
+ # Editor-based Rest Client
89
+ .idea/httpRequests
90
+
91
+ # Android studio 3.1+ serialized cache file
92
+ .idea/caches/build_file_checksums.ser
93
+
94
+ ### VirtualEnv template
95
+ # Virtualenv
96
+ # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
97
+ .Python
98
+ [Bb]in
99
+ [Ii]nclude
100
+ [Ll]ib
101
+ [Ll]ib64
102
+ [Ll]ocal
103
+ [Ss]cripts
104
+ pyvenv.cfg
105
+ .venv
106
+ pip-selfcheck.json
107
+
108
+ ### Python template
109
+ # Byte-compiled / optimized / DLL files
110
+ __pycache__/
111
+ *.py[cod]
112
+ *$py.class
113
+
114
+ # C extensions
115
+ *.so
116
+
117
+ # Distribution / packaging
118
+ build/
119
+ develop-eggs/
120
+ dist/
121
+ downloads/
122
+ eggs/
123
+ .eggs/
124
+ lib/
125
+ lib64/
126
+ parts/
127
+ sdist/
128
+ var/
129
+ wheels/
130
+ share/python-wheels/
131
+ *.egg-info/
132
+ .installed.cfg
133
+ *.egg
134
+ MANIFEST
135
+
136
+ # PyInstaller
137
+ # Usually these files are written by a python script from a template
138
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
139
+ *.manifest
140
+ *.spec
141
+
142
+ # Installer logs
143
+ pip-log.txt
144
+ pip-delete-this-directory.txt
145
+
146
+ # Unit test / coverage reports
147
+ htmlcov/
148
+ .tox/
149
+ .nox/
150
+ .coverage
151
+ .coverage.*
152
+ .cache
153
+ nosetests.xml
154
+ coverage.xml
155
+ *.cover
156
+ *.py,cover
157
+ .hypothesis/
158
+ .pytest_cache/
159
+ cover/
160
+
161
+ # Translations
162
+ *.mo
163
+ *.pot
164
+
165
+ # Django stuff:
166
+ *.log
167
+ local_settings.py
168
+ db.sqlite3
169
+ db.sqlite3-journal
170
+
171
+ # Flask stuff:
172
+ instance/
173
+ .webassets-cache
174
+
175
+ # Scrapy stuff:
176
+ .scrapy
177
+
178
+ # Sphinx documentation
179
+ docs/_build/
180
+
181
+ # PyBuilder
182
+ .pybuilder/
183
+ target/
184
+
185
+ # Jupyter Notebook
186
+ .ipynb_checkpoints
187
+
188
+ # IPython
189
+ profile_default/
190
+ ipython_config.py
191
+
192
+ # pyenv
193
+ # For a library or package, you might want to ignore these files since the code is
194
+ # intended to run in multiple environments; otherwise, check them in:
195
+ # .python-version
196
+
197
+ # pipenv
198
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
199
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
200
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
201
+ # install all needed dependencies.
202
+ #Pipfile.lock
203
+
204
+ # poetry
205
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
206
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
207
+ # commonly ignored for libraries.
208
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
209
+ #poetry.lock
210
+
211
+ # pdm
212
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
213
+ #pdm.lock
214
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
215
+ # in version control.
216
+ # https://pdm.fming.dev/#use-with-ide
217
+ .pdm.toml
218
+
219
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
220
+ __pypackages__/
221
+
222
+ # Celery stuff
223
+ celerybeat-schedule
224
+ celerybeat.pid
225
+
226
+ # SageMath parsed files
227
+ *.sage.py
228
+
229
+ # Environments
230
+ .env
231
+ env/
232
+ venv/
233
+ ENV/
234
+ env.bak/
235
+ venv.bak/
236
+
237
+ # Spyder project settings
238
+ .spyderproject
239
+ .spyproject
240
+
241
+ # Rope project settings
242
+ .ropeproject
243
+
244
+ # mkdocs documentation
245
+ /site
246
+
247
+ # mypy
248
+ .mypy_cache/
249
+ .dmypy.json
250
+ dmypy.json
251
+
252
+ # Pyre type checker
253
+ .pyre/
254
+
255
+ # pytype static type analyzer
256
+ .pytype/
257
+
258
+ # Cython debug symbols
259
+ cython_debug/
260
+
261
+ # PyCharm
262
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
263
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
264
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
265
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
266
+ .idea/
267
+
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackit-certificates
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Load Balancer Certificates API
5
+ Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
6
+ Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
7
+ Author-email: STACKIT Developer Tools <developer-tools@stackit.cloud>
5
8
  License-File: LICENSE.md
6
9
  License-File: NOTICE.txt
7
- Author: STACKIT Developer Tools
8
- Author-email: developer-tools@stackit.cloud
9
- Requires-Python: >=3.9,<4.0
10
10
  Classifier: License :: OSI Approved :: Apache Software License
11
11
  Classifier: Operating System :: OS Independent
12
12
  Classifier: Programming Language :: Python :: 3
@@ -16,12 +16,11 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Programming Language :: Python :: 3.14
19
- Requires-Dist: pydantic (>=2.9.2)
20
- Requires-Dist: python-dateutil (>=2.9.0.post0)
21
- Requires-Dist: requests (>=2.32.3)
22
- Requires-Dist: stackit-core (>=0.0.1a)
23
- Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
24
- Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
19
+ Requires-Python: <4.0,>=3.9
20
+ Requires-Dist: pydantic>=2.9.2
21
+ Requires-Dist: python-dateutil>=2.9.0.post0
22
+ Requires-Dist: requests>=2.32.3
23
+ Requires-Dist: stackit-core>=0.0.1a
25
24
  Description-Content-Type: text/markdown
26
25
 
27
26
  # stackit.certificates
@@ -45,4 +44,4 @@ import stackit.certificates
45
44
 
46
45
  ## Getting Started
47
46
 
48
- [Examples](https://github.com/stackitcloud/stackit-sdk-python/tree/main/examples) for the usage of the package can be found in the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
47
+ [Examples](https://github.com/stackitcloud/stackit-sdk-python/tree/main/examples) for the usage of the package can be found in the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
@@ -1,55 +1,67 @@
1
1
  [project]
2
2
  name = "stackit-certificates"
3
-
4
- [tool.poetry]
5
- name = "stackit-certificates"
6
- version = "v1.2.0"
7
- authors = [
8
- "STACKIT Developer Tools <developer-tools@stackit.cloud>",
9
- ]
3
+ version = "v1.3.0"
10
4
  description = "Load Balancer Certificates API"
5
+ authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
6
+ requires-python = ">=3.9,<4.0"
11
7
  readme = "README.md"
12
- #license = "NoLicense"
13
8
  classifiers = [
14
9
  "Programming Language :: Python :: 3",
15
10
  "License :: OSI Approved :: Apache Software License",
16
11
  "Operating System :: OS Independent",
12
+ "Programming Language :: Python :: 3.9",
13
+ "Programming Language :: Python :: 3.10",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
17
18
  ]
18
- packages = [
19
- { include = "stackit", from="src" }
19
+ dependencies = [
20
+ "stackit-core>=0.0.1a",
21
+ "requests>=2.32.3",
22
+ "pydantic>=2.9.2",
23
+ "python-dateutil>=2.9.0.post0",
20
24
  ]
21
25
 
22
- [tool.poetry.dependencies]
23
- python = ">=3.9,<4.0"
24
- stackit-core = ">=0.0.1a"
25
- requests = ">=2.32.3"
26
- pydantic = ">=2.9.2"
27
- python-dateutil = ">=2.9.0.post0"
28
-
29
- [tool.poetry.group.dev.dependencies]
30
- black = ">=24.8.0"
31
- pytest = ">=8.3.3"
32
- flake8 = [
33
- { version= ">=5.0.3", python="<3.12"},
34
- { version= ">=6.0.1", python=">=3.12"}
35
- ]
36
- flake8-black = ">=0.3.6"
37
- flake8-pyproject = ">=1.2.3"
38
- autoimport = ">=1.6.1"
39
- flake8-eol = ">=0.0.8"
40
- flake8-eradicate = ">=1.5.0"
41
- flake8-bandit = ">=4.1.1"
42
- flake8-bugbear = ">=23.1.14"
43
- flake8-quotes = ">=3.4.0"
44
- isort = ">=5.13.2"
45
-
46
26
  [project.urls]
47
27
  Homepage = "https://github.com/stackitcloud/stackit-sdk-python"
48
28
  Issues = "https://github.com/stackitcloud/stackit-sdk-python/issues"
49
29
 
30
+ [dependency-groups]
31
+ dev = [
32
+ "black>=24.8.0",
33
+ "pytest>=8.3.3",
34
+ "flake8>=5.0.3 ; python_full_version < '3.12'",
35
+ "flake8>=6.0.1 ; python_full_version >= '3.12'",
36
+ "flake8-black>=0.3.6",
37
+ "flake8-pyproject>=1.2.3",
38
+ "autoimport>=1.6.1",
39
+ "flake8-eol>=0.0.8",
40
+ "flake8-eradicate>=1.5.0",
41
+ "flake8-bandit>=4.1.1",
42
+ "flake8-bugbear>=23.1.14",
43
+ "flake8-quotes>=3.4.0",
44
+ "isort>=5.13.2",
45
+ ]
46
+
47
+ [tool.uv]
48
+ default-groups = "all"
49
+
50
+ [tool.uv.sources]
51
+ stackit-core = { path = "../../core" }
52
+
53
+ [tool.hatch.build.targets.sdist]
54
+ include = ["src/stackit"]
55
+
56
+ [tool.hatch.build.targets.wheel]
57
+ include = ["src/stackit"]
58
+
59
+ [tool.hatch.build.targets.wheel.sources]
60
+ "src/stackit" = "stackit"
61
+
50
62
  [build-system]
51
- requires = ["setuptools", "poetry-core"]
52
- build-backend = "poetry.core.masonry.api"
63
+ requires = ["hatchling"]
64
+ build-backend = "hatchling.build"
53
65
 
54
66
  [tool.pytest.ini_options]
55
67
  pythonpath = [
@@ -105,4 +117,4 @@ per-file-ignores = """
105
117
  # E501: long descriptions/string values might lead to lines that are too long
106
118
  # B028: stacklevel for deprecation warning is irrelevant
107
119
  ./src/stackit/*/api/default_api.py: F841,B028,E501
108
- """
120
+ """
@@ -28,10 +28,13 @@ __all__ = [
28
28
  "ApiKeyError",
29
29
  "ApiAttributeError",
30
30
  "ApiException",
31
+ "CertificatesQuota",
31
32
  "CreateCertificatePayload",
32
33
  "GetCertificateResponse",
34
+ "GetQuotaResponse",
33
35
  "GoogleProtobufAny",
34
36
  "ListCertificatesResponse",
37
+ "Quotas",
35
38
  "Status",
36
39
  ]
37
40
 
@@ -50,16 +53,23 @@ from stackit.certificates.exceptions import ApiValueError as ApiValueError
50
53
  from stackit.certificates.exceptions import OpenApiException as OpenApiException
51
54
 
52
55
  # import models into sdk package
56
+ from stackit.certificates.models.certificates_quota import (
57
+ CertificatesQuota as CertificatesQuota,
58
+ )
53
59
  from stackit.certificates.models.create_certificate_payload import (
54
60
  CreateCertificatePayload as CreateCertificatePayload,
55
61
  )
56
62
  from stackit.certificates.models.get_certificate_response import (
57
63
  GetCertificateResponse as GetCertificateResponse,
58
64
  )
65
+ from stackit.certificates.models.get_quota_response import (
66
+ GetQuotaResponse as GetQuotaResponse,
67
+ )
59
68
  from stackit.certificates.models.google_protobuf_any import (
60
69
  GoogleProtobufAny as GoogleProtobufAny,
61
70
  )
62
71
  from stackit.certificates.models.list_certificates_response import (
63
72
  ListCertificatesResponse as ListCertificatesResponse,
64
73
  )
74
+ from stackit.certificates.models.quotas import Quotas as Quotas
65
75
  from stackit.certificates.models.status import Status as Status
@@ -23,6 +23,7 @@ from stackit.certificates.models.create_certificate_payload import (
23
23
  CreateCertificatePayload,
24
24
  )
25
25
  from stackit.certificates.models.get_certificate_response import GetCertificateResponse
26
+ from stackit.certificates.models.get_quota_response import GetQuotaResponse
26
27
  from stackit.certificates.models.list_certificates_response import (
27
28
  ListCertificatesResponse,
28
29
  )
@@ -857,6 +858,259 @@ class DefaultApi:
857
858
  _request_auth=_request_auth,
858
859
  )
859
860
 
861
+ @validate_call
862
+ def get_quota(
863
+ self,
864
+ project_id: StrictStr,
865
+ region: StrictStr,
866
+ _request_timeout: Union[
867
+ None,
868
+ Annotated[StrictFloat, Field(gt=0)],
869
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
870
+ ] = None,
871
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
872
+ _content_type: Optional[StrictStr] = None,
873
+ _headers: Optional[Dict[StrictStr, Any]] = None,
874
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
875
+ ) -> GetQuotaResponse:
876
+ """Get the quota for TLS certificates in a project.
877
+
878
+ Retrieves the configured TLS certificate quota for the project. Limit can be changed via service request.
879
+
880
+ :param project_id: (required)
881
+ :type project_id: str
882
+ :param region: (required)
883
+ :type region: str
884
+ :param _request_timeout: timeout setting for this request. If one
885
+ number provided, it will be total request
886
+ timeout. It can also be a pair (tuple) of
887
+ (connection, read) timeouts.
888
+ :type _request_timeout: int, tuple(int, int), optional
889
+ :param _request_auth: set to override the auth_settings for an a single
890
+ request; this effectively ignores the
891
+ authentication in the spec for a single request.
892
+ :type _request_auth: dict, optional
893
+ :param _content_type: force content-type for the request.
894
+ :type _content_type: str, Optional
895
+ :param _headers: set to override the headers for a single
896
+ request; this effectively ignores the headers
897
+ in the spec for a single request.
898
+ :type _headers: dict, optional
899
+ :param _host_index: set to override the host_index for a single
900
+ request; this effectively ignores the host_index
901
+ in the spec for a single request.
902
+ :type _host_index: int, optional
903
+ :return: Returns the result object.
904
+ """ # noqa: E501
905
+
906
+ _param = self._get_quota_serialize(
907
+ project_id=project_id,
908
+ region=region,
909
+ _request_auth=_request_auth,
910
+ _content_type=_content_type,
911
+ _headers=_headers,
912
+ _host_index=_host_index,
913
+ )
914
+
915
+ _response_types_map: Dict[str, Optional[str]] = {
916
+ "200": "GetQuotaResponse",
917
+ "400": None,
918
+ "401": "str",
919
+ "403": None,
920
+ "500": None,
921
+ }
922
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
923
+ response_data.read()
924
+ return self.api_client.response_deserialize(
925
+ response_data=response_data,
926
+ response_types_map=_response_types_map,
927
+ ).data
928
+
929
+ @validate_call
930
+ def get_quota_with_http_info(
931
+ self,
932
+ project_id: StrictStr,
933
+ region: StrictStr,
934
+ _request_timeout: Union[
935
+ None,
936
+ Annotated[StrictFloat, Field(gt=0)],
937
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
938
+ ] = None,
939
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
940
+ _content_type: Optional[StrictStr] = None,
941
+ _headers: Optional[Dict[StrictStr, Any]] = None,
942
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
943
+ ) -> ApiResponse[GetQuotaResponse]:
944
+ """Get the quota for TLS certificates in a project.
945
+
946
+ Retrieves the configured TLS certificate quota for the project. Limit can be changed via service request.
947
+
948
+ :param project_id: (required)
949
+ :type project_id: str
950
+ :param region: (required)
951
+ :type region: str
952
+ :param _request_timeout: timeout setting for this request. If one
953
+ number provided, it will be total request
954
+ timeout. It can also be a pair (tuple) of
955
+ (connection, read) timeouts.
956
+ :type _request_timeout: int, tuple(int, int), optional
957
+ :param _request_auth: set to override the auth_settings for an a single
958
+ request; this effectively ignores the
959
+ authentication in the spec for a single request.
960
+ :type _request_auth: dict, optional
961
+ :param _content_type: force content-type for the request.
962
+ :type _content_type: str, Optional
963
+ :param _headers: set to override the headers for a single
964
+ request; this effectively ignores the headers
965
+ in the spec for a single request.
966
+ :type _headers: dict, optional
967
+ :param _host_index: set to override the host_index for a single
968
+ request; this effectively ignores the host_index
969
+ in the spec for a single request.
970
+ :type _host_index: int, optional
971
+ :return: Returns the result object.
972
+ """ # noqa: E501
973
+
974
+ _param = self._get_quota_serialize(
975
+ project_id=project_id,
976
+ region=region,
977
+ _request_auth=_request_auth,
978
+ _content_type=_content_type,
979
+ _headers=_headers,
980
+ _host_index=_host_index,
981
+ )
982
+
983
+ _response_types_map: Dict[str, Optional[str]] = {
984
+ "200": "GetQuotaResponse",
985
+ "400": None,
986
+ "401": "str",
987
+ "403": None,
988
+ "500": None,
989
+ }
990
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
991
+ response_data.read()
992
+ return self.api_client.response_deserialize(
993
+ response_data=response_data,
994
+ response_types_map=_response_types_map,
995
+ )
996
+
997
+ @validate_call
998
+ def get_quota_without_preload_content(
999
+ self,
1000
+ project_id: StrictStr,
1001
+ region: StrictStr,
1002
+ _request_timeout: Union[
1003
+ None,
1004
+ Annotated[StrictFloat, Field(gt=0)],
1005
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1006
+ ] = None,
1007
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1008
+ _content_type: Optional[StrictStr] = None,
1009
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1010
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1011
+ ) -> RESTResponseType:
1012
+ """Get the quota for TLS certificates in a project.
1013
+
1014
+ Retrieves the configured TLS certificate quota for the project. Limit can be changed via service request.
1015
+
1016
+ :param project_id: (required)
1017
+ :type project_id: str
1018
+ :param region: (required)
1019
+ :type region: str
1020
+ :param _request_timeout: timeout setting for this request. If one
1021
+ number provided, it will be total request
1022
+ timeout. It can also be a pair (tuple) of
1023
+ (connection, read) timeouts.
1024
+ :type _request_timeout: int, tuple(int, int), optional
1025
+ :param _request_auth: set to override the auth_settings for an a single
1026
+ request; this effectively ignores the
1027
+ authentication in the spec for a single request.
1028
+ :type _request_auth: dict, optional
1029
+ :param _content_type: force content-type for the request.
1030
+ :type _content_type: str, Optional
1031
+ :param _headers: set to override the headers for a single
1032
+ request; this effectively ignores the headers
1033
+ in the spec for a single request.
1034
+ :type _headers: dict, optional
1035
+ :param _host_index: set to override the host_index for a single
1036
+ request; this effectively ignores the host_index
1037
+ in the spec for a single request.
1038
+ :type _host_index: int, optional
1039
+ :return: Returns the result object.
1040
+ """ # noqa: E501
1041
+
1042
+ _param = self._get_quota_serialize(
1043
+ project_id=project_id,
1044
+ region=region,
1045
+ _request_auth=_request_auth,
1046
+ _content_type=_content_type,
1047
+ _headers=_headers,
1048
+ _host_index=_host_index,
1049
+ )
1050
+
1051
+ _response_types_map: Dict[str, Optional[str]] = {
1052
+ "200": "GetQuotaResponse",
1053
+ "400": None,
1054
+ "401": "str",
1055
+ "403": None,
1056
+ "500": None,
1057
+ }
1058
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1059
+ return response_data.response
1060
+
1061
+ def _get_quota_serialize(
1062
+ self,
1063
+ project_id,
1064
+ region,
1065
+ _request_auth,
1066
+ _content_type,
1067
+ _headers,
1068
+ _host_index,
1069
+ ) -> RequestSerialized:
1070
+
1071
+ _host = None
1072
+
1073
+ _collection_formats: Dict[str, str] = {}
1074
+
1075
+ _path_params: Dict[str, str] = {}
1076
+ _query_params: List[Tuple[str, str]] = []
1077
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1078
+ _form_params: List[Tuple[str, str]] = []
1079
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
1080
+ _body_params: Optional[bytes] = None
1081
+
1082
+ # process the path parameters
1083
+ if project_id is not None:
1084
+ _path_params["projectId"] = project_id
1085
+ if region is not None:
1086
+ _path_params["region"] = region
1087
+ # process the query parameters
1088
+ # process the header parameters
1089
+ # process the form parameters
1090
+ # process the body parameter
1091
+
1092
+ # set the HTTP header `Accept`
1093
+ if "Accept" not in _header_params:
1094
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "text/plain"])
1095
+
1096
+ # authentication setting
1097
+ _auth_settings: List[str] = []
1098
+
1099
+ return self.api_client.param_serialize(
1100
+ method="GET",
1101
+ resource_path="/v2/projects/{projectId}/regions/{region}/quotas",
1102
+ path_params=_path_params,
1103
+ query_params=_query_params,
1104
+ header_params=_header_params,
1105
+ body=_body_params,
1106
+ post_params=_form_params,
1107
+ files=_files,
1108
+ auth_settings=_auth_settings,
1109
+ collection_formats=_collection_formats,
1110
+ _host=_host,
1111
+ _request_auth=_request_auth,
1112
+ )
1113
+
860
1114
  @validate_call
861
1115
  def list_certificates(
862
1116
  self,
@@ -12,11 +12,13 @@
12
12
  """ # noqa: E501
13
13
 
14
14
  import datetime
15
+ import decimal
15
16
  import json
16
17
  import mimetypes
17
18
  import os
18
19
  import re
19
20
  import tempfile
21
+ import uuid
20
22
  from enum import Enum
21
23
  from typing import Dict, List, Optional, Tuple, Union
22
24
  from urllib.parse import quote
@@ -63,8 +65,10 @@ class ApiClient:
63
65
  "bool": bool,
64
66
  "date": datetime.date,
65
67
  "datetime": datetime.datetime,
68
+ "decimal": decimal.Decimal,
66
69
  "object": object,
67
70
  }
71
+ _pool = None
68
72
 
69
73
  def __init__(self, configuration, header_name=None, header_value=None, cookie=None) -> None:
70
74
  self.config: Configuration = configuration
@@ -267,7 +271,7 @@ class ApiClient:
267
271
  return_data = self.__deserialize_file(response_data)
268
272
  elif response_type is not None:
269
273
  match = None
270
- content_type = response_data.getheader("content-type")
274
+ content_type = response_data.headers.get("content-type")
271
275
  if content_type is not None:
272
276
  match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
273
277
  encoding = match.group(1) if match else "utf-8"
@@ -284,7 +288,7 @@ class ApiClient:
284
288
  return ApiResponse(
285
289
  status_code=response_data.status,
286
290
  data=return_data,
287
- headers=response_data.getheaders(),
291
+ headers=response_data.headers,
288
292
  raw_data=response_data.data,
289
293
  )
290
294
 
@@ -296,6 +300,7 @@ class ApiClient:
296
300
  If obj is str, int, long, float, bool, return directly.
297
301
  If obj is datetime.datetime, datetime.date
298
302
  convert to string in iso8601 format.
303
+ If obj is decimal.Decimal return string representation.
299
304
  If obj is list, sanitize each element in the list.
300
305
  If obj is dict, return the dict.
301
306
  If obj is OpenAPI model, return the properties dict.
@@ -311,12 +316,16 @@ class ApiClient:
311
316
  return obj.get_secret_value()
312
317
  elif isinstance(obj, self.PRIMITIVE_TYPES):
313
318
  return obj
319
+ elif isinstance(obj, uuid.UUID):
320
+ return str(obj)
314
321
  elif isinstance(obj, list):
315
322
  return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj]
316
323
  elif isinstance(obj, tuple):
317
324
  return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj)
318
325
  elif isinstance(obj, (datetime.datetime, datetime.date)):
319
326
  return obj.isoformat()
327
+ elif isinstance(obj, decimal.Decimal):
328
+ return str(obj)
320
329
 
321
330
  elif isinstance(obj, dict):
322
331
  obj_dict = obj
@@ -326,7 +335,7 @@ class ApiClient:
326
335
  # and attributes which value is not None.
327
336
  # Convert attribute name to json key in
328
337
  # model definition for request.
329
- if hasattr(obj, "to_dict") and callable(obj.to_dict):
338
+ if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
330
339
  obj_dict = obj.to_dict()
331
340
  else:
332
341
  obj_dict = obj.__dict__
@@ -354,7 +363,7 @@ class ApiClient:
354
363
  data = json.loads(response_text)
355
364
  except ValueError:
356
365
  data = response_text
357
- elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
366
+ elif re.match(r"^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
358
367
  if response_text == "":
359
368
  data = ""
360
369
  else:
@@ -400,12 +409,14 @@ class ApiClient:
400
409
 
401
410
  if klass in self.PRIMITIVE_TYPES:
402
411
  return self.__deserialize_primitive(data, klass)
403
- elif klass == object:
412
+ elif klass is object:
404
413
  return self.__deserialize_object(data)
405
- elif klass == datetime.date:
414
+ elif klass is datetime.date:
406
415
  return self.__deserialize_date(data)
407
- elif klass == datetime.datetime:
416
+ elif klass is datetime.datetime:
408
417
  return self.__deserialize_datetime(data)
418
+ elif klass is decimal.Decimal:
419
+ return decimal.Decimal(data)
409
420
  elif issubclass(klass, Enum):
410
421
  return self.__deserialize_enum(data, klass)
411
422
  else:
@@ -553,12 +564,14 @@ class ApiClient:
553
564
  os.close(fd)
554
565
  os.remove(path)
555
566
 
556
- content_disposition = response.getheader("Content-Disposition")
567
+ content_disposition = response.headers.get("Content-Disposition")
557
568
  if content_disposition:
558
569
  m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition)
559
570
  if m is None:
560
571
  raise ValueError("Unexpected 'content-disposition' header value")
561
- filename = m.group(1)
572
+ filename = os.path.basename(m.group(1)) # Strip any directory traversal
573
+ if filename in ("", ".", ".."): # fall back to tmp filename
574
+ filename = os.path.basename(path)
562
575
  path = os.path.join(os.path.dirname(path), filename)
563
576
 
564
577
  with open(path, "wb") as f:
@@ -129,7 +129,7 @@ class ApiException(OpenApiException):
129
129
  self.body = http_resp.data.decode("utf-8")
130
130
  except Exception: # noqa: S110
131
131
  pass
132
- self.headers = http_resp.getheaders()
132
+ self.headers = http_resp.headers
133
133
 
134
134
  @classmethod
135
135
  def from_response(
@@ -12,14 +12,16 @@
12
12
  Do not edit the class manually.
13
13
  """ # noqa: E501
14
14
 
15
-
16
15
  # import models into model package
16
+ from stackit.certificates.models.certificates_quota import CertificatesQuota
17
17
  from stackit.certificates.models.create_certificate_payload import (
18
18
  CreateCertificatePayload,
19
19
  )
20
20
  from stackit.certificates.models.get_certificate_response import GetCertificateResponse
21
+ from stackit.certificates.models.get_quota_response import GetQuotaResponse
21
22
  from stackit.certificates.models.google_protobuf_any import GoogleProtobufAny
22
23
  from stackit.certificates.models.list_certificates_response import (
23
24
  ListCertificatesResponse,
24
25
  )
26
+ from stackit.certificates.models.quotas import Quotas
25
27
  from stackit.certificates.models.status import Status
@@ -0,0 +1,86 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Application Load Balancer Certificates API
5
+
6
+ This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server.
7
+
8
+ The version of the OpenAPI document: 2.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing_extensions import Annotated, Self
22
+
23
+
24
+ class CertificatesQuota(BaseModel):
25
+ """
26
+ Certificates quotas holds the limits and usage for certificates resources
27
+ """ # noqa: E501
28
+
29
+ limit: Optional[Annotated[int, Field(le=1000000, strict=True, ge=-1)]] = Field(
30
+ default=None, description="The maximum number of TLS certificates in this project."
31
+ )
32
+ usage: Optional[Annotated[int, Field(le=1000000, strict=True, ge=-1)]] = Field(
33
+ default=None, description="The number of certificates that are currently existing in this project."
34
+ )
35
+ __properties: ClassVar[List[str]] = ["limit", "usage"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of CertificatesQuota from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of CertificatesQuota from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({"limit": obj.get("limit"), "usage": obj.get("usage")})
86
+ return _obj
@@ -17,6 +17,7 @@ import json
17
17
  import pprint
18
18
  import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
+ from uuid import UUID
20
21
 
21
22
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
23
  from typing_extensions import Annotated, Self
@@ -31,9 +32,7 @@ class CreateCertificatePayload(BaseModel):
31
32
  private_key: Optional[StrictStr] = Field(
32
33
  default=None, description="The PEM encoded private key part", alias="privateKey"
33
34
  )
34
- project_id: Optional[Annotated[str, Field(strict=True)]] = Field(
35
- default=None, description="Project identifier", alias="projectId"
36
- )
35
+ project_id: Optional[UUID] = Field(default=None, description="Project identifier", alias="projectId")
37
36
  public_key: Optional[StrictStr] = Field(
38
37
  default=None, description="The PEM encoded public key part", alias="publicKey"
39
38
  )
@@ -0,0 +1,125 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Application Load Balancer Certificates API
5
+
6
+ This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server.
7
+
8
+ The version of the OpenAPI document: 2.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+ from uuid import UUID
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, field_validator
23
+ from typing_extensions import Annotated, Self
24
+
25
+ from stackit.certificates.models.quotas import Quotas
26
+
27
+
28
+ class GetQuotaResponse(BaseModel):
29
+ """
30
+ GetQuotaResponse
31
+ """ # noqa: E501
32
+
33
+ project_id: Optional[UUID] = Field(default=None, description="Project identifier", alias="projectId")
34
+ quotas: Optional[Quotas] = None
35
+ region: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Region")
36
+ __properties: ClassVar[List[str]] = ["projectId", "quotas", "region"]
37
+
38
+ @field_validator("project_id")
39
+ def project_id_validate_regular_expression(cls, value):
40
+ """Validates the regular expression"""
41
+ if value is None:
42
+ return value
43
+
44
+ if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$", value):
45
+ raise ValueError(
46
+ r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/"
47
+ )
48
+ return value
49
+
50
+ @field_validator("region")
51
+ def region_validate_regular_expression(cls, value):
52
+ """Validates the regular expression"""
53
+ if value is None:
54
+ return value
55
+
56
+ if not re.match(r"^[a-z]{2,4}[0-9]{2}$", value):
57
+ raise ValueError(r"must validate the regular expression /^[a-z]{2,4}[0-9]{2}$/")
58
+ return value
59
+
60
+ model_config = ConfigDict(
61
+ populate_by_name=True,
62
+ validate_assignment=True,
63
+ protected_namespaces=(),
64
+ )
65
+
66
+ def to_str(self) -> str:
67
+ """Returns the string representation of the model using alias"""
68
+ return pprint.pformat(self.model_dump(by_alias=True))
69
+
70
+ def to_json(self) -> str:
71
+ """Returns the JSON representation of the model using alias"""
72
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
73
+ return json.dumps(self.to_dict())
74
+
75
+ @classmethod
76
+ def from_json(cls, json_str: str) -> Optional[Self]:
77
+ """Create an instance of GetQuotaResponse from a JSON string"""
78
+ return cls.from_dict(json.loads(json_str))
79
+
80
+ def to_dict(self) -> Dict[str, Any]:
81
+ """Return the dictionary representation of the model using alias.
82
+
83
+ This has the following differences from calling pydantic's
84
+ `self.model_dump(by_alias=True)`:
85
+
86
+ * `None` is only added to the output dict for nullable fields that
87
+ were set at model initialization. Other fields with value `None`
88
+ are ignored.
89
+ * OpenAPI `readOnly` fields are excluded.
90
+ * OpenAPI `readOnly` fields are excluded.
91
+ """
92
+ excluded_fields: Set[str] = set(
93
+ [
94
+ "project_id",
95
+ "region",
96
+ ]
97
+ )
98
+
99
+ _dict = self.model_dump(
100
+ by_alias=True,
101
+ exclude=excluded_fields,
102
+ exclude_none=True,
103
+ )
104
+ # override the default output from pydantic by calling `to_dict()` of quotas
105
+ if self.quotas:
106
+ _dict["quotas"] = self.quotas.to_dict()
107
+ return _dict
108
+
109
+ @classmethod
110
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
111
+ """Create an instance of GetQuotaResponse from a dict"""
112
+ if obj is None:
113
+ return None
114
+
115
+ if not isinstance(obj, dict):
116
+ return cls.model_validate(obj)
117
+
118
+ _obj = cls.model_validate(
119
+ {
120
+ "projectId": obj.get("projectId"),
121
+ "quotas": Quotas.from_dict(obj["quotas"]) if obj.get("quotas") is not None else None,
122
+ "region": obj.get("region"),
123
+ }
124
+ )
125
+ return _obj
@@ -87,9 +87,9 @@ class ListCertificatesResponse(BaseModel):
87
87
  # override the default output from pydantic by calling `to_dict()` of each item in items (list)
88
88
  _items = []
89
89
  if self.items:
90
- for _item in self.items:
91
- if _item:
92
- _items.append(_item.to_dict())
90
+ for _item_items in self.items:
91
+ if _item_items:
92
+ _items.append(_item_items.to_dict())
93
93
  _dict["items"] = _items
94
94
  return _dict
95
95
 
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Application Load Balancer Certificates API
5
+
6
+ This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server.
7
+
8
+ The version of the OpenAPI document: 2.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing_extensions import Self
22
+
23
+ from stackit.certificates.models.certificates_quota import CertificatesQuota
24
+
25
+
26
+ class Quotas(BaseModel):
27
+ """
28
+ Quotas holds the specific quota elements for different resources
29
+ """ # noqa: E501
30
+
31
+ certificates: Optional[CertificatesQuota] = None
32
+ __properties: ClassVar[List[str]] = ["certificates"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of Quotas from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ # override the default output from pydantic by calling `to_dict()` of certificates
72
+ if self.certificates:
73
+ _dict["certificates"] = self.certificates.to_dict()
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of Quotas from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate(
86
+ {
87
+ "certificates": (
88
+ CertificatesQuota.from_dict(obj["certificates"]) if obj.get("certificates") is not None else None
89
+ )
90
+ }
91
+ )
92
+ return _obj
@@ -82,9 +82,9 @@ class Status(BaseModel):
82
82
  # override the default output from pydantic by calling `to_dict()` of each item in details (list)
83
83
  _items = []
84
84
  if self.details:
85
- for _item in self.details:
86
- if _item:
87
- _items.append(_item.to_dict())
85
+ for _item_details in self.details:
86
+ if _item_details:
87
+ _items.append(_item_details.to_dict())
88
88
  _dict["details"] = _items
89
89
  return _dict
90
90
 
@@ -38,12 +38,17 @@ class RESTResponse(io.IOBase):
38
38
  self.data = self.response.content
39
39
  return self.data
40
40
 
41
+ @property
42
+ def headers(self):
43
+ """Returns a dictionary of response headers."""
44
+ return self.response.headers
45
+
41
46
  def getheaders(self):
42
- """Returns a dictionary of the response headers."""
47
+ """Returns a dictionary of the response headers; use ``headers`` instead."""
43
48
  return self.response.headers
44
49
 
45
50
  def getheader(self, name, default=None):
46
- """Returns a given response header."""
51
+ """Returns a given response header; use ``headers.get()`` instead."""
47
52
  return self.response.headers.get(name, default)
48
53
 
49
54
 
@@ -93,6 +98,7 @@ class RESTClientObject:
93
98
  url,
94
99
  data=request_body,
95
100
  headers=headers,
101
+ timeout=_request_timeout,
96
102
  )
97
103
  elif content_type == "application/x-www-form-urlencoded":
98
104
  r = self.session.request(
@@ -100,6 +106,7 @@ class RESTClientObject:
100
106
  url,
101
107
  params=post_params,
102
108
  headers=headers,
109
+ timeout=_request_timeout,
103
110
  )
104
111
  elif content_type == "multipart/form-data":
105
112
  # must del headers['Content-Type'], or the correct
@@ -113,6 +120,7 @@ class RESTClientObject:
113
120
  url,
114
121
  files=post_params,
115
122
  headers=headers,
123
+ timeout=_request_timeout,
116
124
  )
117
125
  # Pass a `string` parameter directly in the body to support
118
126
  # other content types than JSON when `body` argument is
@@ -123,10 +131,17 @@ class RESTClientObject:
123
131
  url,
124
132
  data=body,
125
133
  headers=headers,
134
+ timeout=_request_timeout,
126
135
  )
127
136
  elif headers["Content-Type"].startswith("text/") and isinstance(body, bool):
128
137
  request_body = "true" if body else "false"
129
- r = self.session.request(method, url, data=request_body, headers=headers)
138
+ r = self.session.request(
139
+ method,
140
+ url,
141
+ data=request_body,
142
+ headers=headers,
143
+ timeout=_request_timeout,
144
+ )
130
145
  else:
131
146
  # Cannot generate the request from given parameters
132
147
  msg = """Cannot prepare a request message for provided
@@ -140,6 +155,7 @@ class RESTClientObject:
140
155
  url,
141
156
  params={},
142
157
  headers=headers,
158
+ timeout=_request_timeout,
143
159
  )
144
160
  except requests.exceptions.SSLError as e:
145
161
  msg = "\n".join([type(e).__name__, str(e)])