stackit-certificates 1.2.1__tar.gz → 1.3.1__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.2.1 → stackit_certificates-1.3.1}/PKG-INFO +1 -1
  2. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/pyproject.toml +1 -1
  3. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/__init__.py +10 -0
  4. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/api/default_api.py +257 -0
  5. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/models/__init__.py +3 -0
  6. stackit_certificates-1.3.1/src/stackit/certificates/models/certificates_quota.py +86 -0
  7. stackit_certificates-1.3.1/src/stackit/certificates/models/get_quota_response.py +125 -0
  8. stackit_certificates-1.3.1/src/stackit/certificates/models/quotas.py +92 -0
  9. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/.gitignore +0 -0
  10. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/LICENSE.md +0 -0
  11. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/NOTICE.txt +0 -0
  12. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/README.md +0 -0
  13. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/api/__init__.py +0 -0
  14. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/api_client.py +0 -0
  15. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/api_response.py +0 -0
  16. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/configuration.py +0 -0
  17. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/exceptions.py +0 -0
  18. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/models/create_certificate_payload.py +0 -0
  19. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/models/get_certificate_response.py +0 -0
  20. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/models/google_protobuf_any.py +0 -0
  21. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/models/list_certificates_response.py +0 -0
  22. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/models/status.py +0 -0
  23. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/py.typed +0 -0
  24. {stackit_certificates-1.2.1 → stackit_certificates-1.3.1}/src/stackit/certificates/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackit-certificates
3
- Version: 1.2.1
3
+ Version: 1.3.1
4
4
  Summary: Load Balancer Certificates API
5
5
  Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
6
6
  Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stackit-certificates"
3
- version = "v1.2.1"
3
+ version = "v1.3.1"
4
4
  description = "Load Balancer Certificates API"
5
5
  authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
6
6
  requires-python = ">=3.9,<4.0"
@@ -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
  )
@@ -105,6 +106,7 @@ class DefaultApi:
105
106
  "400": None,
106
107
  "401": "Status",
107
108
  "403": None,
109
+ "429": None,
108
110
  "500": None,
109
111
  }
110
112
  response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
@@ -177,6 +179,7 @@ class DefaultApi:
177
179
  "400": None,
178
180
  "401": "Status",
179
181
  "403": None,
182
+ "429": None,
180
183
  "500": None,
181
184
  }
182
185
  response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
@@ -249,6 +252,7 @@ class DefaultApi:
249
252
  "400": None,
250
253
  "401": "Status",
251
254
  "403": None,
255
+ "429": None,
252
256
  "500": None,
253
257
  }
254
258
  response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
@@ -857,6 +861,259 @@ class DefaultApi:
857
861
  _request_auth=_request_auth,
858
862
  )
859
863
 
864
+ @validate_call
865
+ def get_quota(
866
+ self,
867
+ project_id: StrictStr,
868
+ region: StrictStr,
869
+ _request_timeout: Union[
870
+ None,
871
+ Annotated[StrictFloat, Field(gt=0)],
872
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
873
+ ] = None,
874
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
875
+ _content_type: Optional[StrictStr] = None,
876
+ _headers: Optional[Dict[StrictStr, Any]] = None,
877
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
878
+ ) -> GetQuotaResponse:
879
+ """Get the quota for TLS certificates in a project.
880
+
881
+ Retrieves the configured TLS certificate quota for the project. Limit can be changed via service request.
882
+
883
+ :param project_id: (required)
884
+ :type project_id: str
885
+ :param region: (required)
886
+ :type region: str
887
+ :param _request_timeout: timeout setting for this request. If one
888
+ number provided, it will be total request
889
+ timeout. It can also be a pair (tuple) of
890
+ (connection, read) timeouts.
891
+ :type _request_timeout: int, tuple(int, int), optional
892
+ :param _request_auth: set to override the auth_settings for an a single
893
+ request; this effectively ignores the
894
+ authentication in the spec for a single request.
895
+ :type _request_auth: dict, optional
896
+ :param _content_type: force content-type for the request.
897
+ :type _content_type: str, Optional
898
+ :param _headers: set to override the headers for a single
899
+ request; this effectively ignores the headers
900
+ in the spec for a single request.
901
+ :type _headers: dict, optional
902
+ :param _host_index: set to override the host_index for a single
903
+ request; this effectively ignores the host_index
904
+ in the spec for a single request.
905
+ :type _host_index: int, optional
906
+ :return: Returns the result object.
907
+ """ # noqa: E501
908
+
909
+ _param = self._get_quota_serialize(
910
+ project_id=project_id,
911
+ region=region,
912
+ _request_auth=_request_auth,
913
+ _content_type=_content_type,
914
+ _headers=_headers,
915
+ _host_index=_host_index,
916
+ )
917
+
918
+ _response_types_map: Dict[str, Optional[str]] = {
919
+ "200": "GetQuotaResponse",
920
+ "400": None,
921
+ "401": "str",
922
+ "403": None,
923
+ "500": None,
924
+ }
925
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
926
+ response_data.read()
927
+ return self.api_client.response_deserialize(
928
+ response_data=response_data,
929
+ response_types_map=_response_types_map,
930
+ ).data
931
+
932
+ @validate_call
933
+ def get_quota_with_http_info(
934
+ self,
935
+ project_id: StrictStr,
936
+ region: StrictStr,
937
+ _request_timeout: Union[
938
+ None,
939
+ Annotated[StrictFloat, Field(gt=0)],
940
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
941
+ ] = None,
942
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
943
+ _content_type: Optional[StrictStr] = None,
944
+ _headers: Optional[Dict[StrictStr, Any]] = None,
945
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
946
+ ) -> ApiResponse[GetQuotaResponse]:
947
+ """Get the quota for TLS certificates in a project.
948
+
949
+ Retrieves the configured TLS certificate quota for the project. Limit can be changed via service request.
950
+
951
+ :param project_id: (required)
952
+ :type project_id: str
953
+ :param region: (required)
954
+ :type region: str
955
+ :param _request_timeout: timeout setting for this request. If one
956
+ number provided, it will be total request
957
+ timeout. It can also be a pair (tuple) of
958
+ (connection, read) timeouts.
959
+ :type _request_timeout: int, tuple(int, int), optional
960
+ :param _request_auth: set to override the auth_settings for an a single
961
+ request; this effectively ignores the
962
+ authentication in the spec for a single request.
963
+ :type _request_auth: dict, optional
964
+ :param _content_type: force content-type for the request.
965
+ :type _content_type: str, Optional
966
+ :param _headers: set to override the headers for a single
967
+ request; this effectively ignores the headers
968
+ in the spec for a single request.
969
+ :type _headers: dict, optional
970
+ :param _host_index: set to override the host_index for a single
971
+ request; this effectively ignores the host_index
972
+ in the spec for a single request.
973
+ :type _host_index: int, optional
974
+ :return: Returns the result object.
975
+ """ # noqa: E501
976
+
977
+ _param = self._get_quota_serialize(
978
+ project_id=project_id,
979
+ region=region,
980
+ _request_auth=_request_auth,
981
+ _content_type=_content_type,
982
+ _headers=_headers,
983
+ _host_index=_host_index,
984
+ )
985
+
986
+ _response_types_map: Dict[str, Optional[str]] = {
987
+ "200": "GetQuotaResponse",
988
+ "400": None,
989
+ "401": "str",
990
+ "403": None,
991
+ "500": None,
992
+ }
993
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
994
+ response_data.read()
995
+ return self.api_client.response_deserialize(
996
+ response_data=response_data,
997
+ response_types_map=_response_types_map,
998
+ )
999
+
1000
+ @validate_call
1001
+ def get_quota_without_preload_content(
1002
+ self,
1003
+ project_id: StrictStr,
1004
+ region: StrictStr,
1005
+ _request_timeout: Union[
1006
+ None,
1007
+ Annotated[StrictFloat, Field(gt=0)],
1008
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1009
+ ] = None,
1010
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1011
+ _content_type: Optional[StrictStr] = None,
1012
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1013
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1014
+ ) -> RESTResponseType:
1015
+ """Get the quota for TLS certificates in a project.
1016
+
1017
+ Retrieves the configured TLS certificate quota for the project. Limit can be changed via service request.
1018
+
1019
+ :param project_id: (required)
1020
+ :type project_id: str
1021
+ :param region: (required)
1022
+ :type region: str
1023
+ :param _request_timeout: timeout setting for this request. If one
1024
+ number provided, it will be total request
1025
+ timeout. It can also be a pair (tuple) of
1026
+ (connection, read) timeouts.
1027
+ :type _request_timeout: int, tuple(int, int), optional
1028
+ :param _request_auth: set to override the auth_settings for an a single
1029
+ request; this effectively ignores the
1030
+ authentication in the spec for a single request.
1031
+ :type _request_auth: dict, optional
1032
+ :param _content_type: force content-type for the request.
1033
+ :type _content_type: str, Optional
1034
+ :param _headers: set to override the headers for a single
1035
+ request; this effectively ignores the headers
1036
+ in the spec for a single request.
1037
+ :type _headers: dict, optional
1038
+ :param _host_index: set to override the host_index for a single
1039
+ request; this effectively ignores the host_index
1040
+ in the spec for a single request.
1041
+ :type _host_index: int, optional
1042
+ :return: Returns the result object.
1043
+ """ # noqa: E501
1044
+
1045
+ _param = self._get_quota_serialize(
1046
+ project_id=project_id,
1047
+ region=region,
1048
+ _request_auth=_request_auth,
1049
+ _content_type=_content_type,
1050
+ _headers=_headers,
1051
+ _host_index=_host_index,
1052
+ )
1053
+
1054
+ _response_types_map: Dict[str, Optional[str]] = {
1055
+ "200": "GetQuotaResponse",
1056
+ "400": None,
1057
+ "401": "str",
1058
+ "403": None,
1059
+ "500": None,
1060
+ }
1061
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1062
+ return response_data.response
1063
+
1064
+ def _get_quota_serialize(
1065
+ self,
1066
+ project_id,
1067
+ region,
1068
+ _request_auth,
1069
+ _content_type,
1070
+ _headers,
1071
+ _host_index,
1072
+ ) -> RequestSerialized:
1073
+
1074
+ _host = None
1075
+
1076
+ _collection_formats: Dict[str, str] = {}
1077
+
1078
+ _path_params: Dict[str, str] = {}
1079
+ _query_params: List[Tuple[str, str]] = []
1080
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1081
+ _form_params: List[Tuple[str, str]] = []
1082
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
1083
+ _body_params: Optional[bytes] = None
1084
+
1085
+ # process the path parameters
1086
+ if project_id is not None:
1087
+ _path_params["projectId"] = project_id
1088
+ if region is not None:
1089
+ _path_params["region"] = region
1090
+ # process the query parameters
1091
+ # process the header parameters
1092
+ # process the form parameters
1093
+ # process the body parameter
1094
+
1095
+ # set the HTTP header `Accept`
1096
+ if "Accept" not in _header_params:
1097
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "text/plain"])
1098
+
1099
+ # authentication setting
1100
+ _auth_settings: List[str] = []
1101
+
1102
+ return self.api_client.param_serialize(
1103
+ method="GET",
1104
+ resource_path="/v2/projects/{projectId}/regions/{region}/quotas",
1105
+ path_params=_path_params,
1106
+ query_params=_query_params,
1107
+ header_params=_header_params,
1108
+ body=_body_params,
1109
+ post_params=_form_params,
1110
+ files=_files,
1111
+ auth_settings=_auth_settings,
1112
+ collection_formats=_collection_formats,
1113
+ _host=_host,
1114
+ _request_auth=_request_auth,
1115
+ )
1116
+
860
1117
  @validate_call
861
1118
  def list_certificates(
862
1119
  self,
@@ -13,12 +13,15 @@
13
13
  """ # noqa: E501
14
14
 
15
15
  # import models into model package
16
+ from stackit.certificates.models.certificates_quota import CertificatesQuota
16
17
  from stackit.certificates.models.create_certificate_payload import (
17
18
  CreateCertificatePayload,
18
19
  )
19
20
  from stackit.certificates.models.get_certificate_response import GetCertificateResponse
21
+ from stackit.certificates.models.get_quota_response import GetQuotaResponse
20
22
  from stackit.certificates.models.google_protobuf_any import GoogleProtobufAny
21
23
  from stackit.certificates.models.list_certificates_response import (
22
24
  ListCertificatesResponse,
23
25
  )
26
+ from stackit.certificates.models.quotas import Quotas
24
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
@@ -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
@@ -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