stackit-loadbalancer 0.0.1a1__py3-none-any.whl

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 (46) hide show
  1. stackit/loadbalancer/__init__.py +94 -0
  2. stackit/loadbalancer/api/__init__.py +4 -0
  3. stackit/loadbalancer/api/default_api.py +4224 -0
  4. stackit/loadbalancer/api_client.py +626 -0
  5. stackit/loadbalancer/api_response.py +23 -0
  6. stackit/loadbalancer/configuration.py +111 -0
  7. stackit/loadbalancer/exceptions.py +198 -0
  8. stackit/loadbalancer/models/__init__.py +75 -0
  9. stackit/loadbalancer/models/active_health_check.py +142 -0
  10. stackit/loadbalancer/models/create_credentials_payload.py +104 -0
  11. stackit/loadbalancer/models/create_credentials_response.py +92 -0
  12. stackit/loadbalancer/models/create_load_balancer_payload.py +231 -0
  13. stackit/loadbalancer/models/credentials_response.py +106 -0
  14. stackit/loadbalancer/models/get_credentials_response.py +92 -0
  15. stackit/loadbalancer/models/get_quota_response.py +106 -0
  16. stackit/loadbalancer/models/get_service_status_response.py +103 -0
  17. stackit/loadbalancer/models/google_protobuf_any.py +97 -0
  18. stackit/loadbalancer/models/list_credentials_response.py +98 -0
  19. stackit/loadbalancer/models/list_load_balancers_response.py +115 -0
  20. stackit/loadbalancer/models/list_plans_response.py +98 -0
  21. stackit/loadbalancer/models/listener.py +162 -0
  22. stackit/loadbalancer/models/load_balancer.py +231 -0
  23. stackit/loadbalancer/models/load_balancer_error.py +113 -0
  24. stackit/loadbalancer/models/load_balancer_options.py +116 -0
  25. stackit/loadbalancer/models/loadbalancer_option_access_control.py +85 -0
  26. stackit/loadbalancer/models/loadbalancer_option_logs.py +90 -0
  27. stackit/loadbalancer/models/loadbalancer_option_metrics.py +90 -0
  28. stackit/loadbalancer/models/loadbalancer_option_observability.py +100 -0
  29. stackit/loadbalancer/models/network.py +112 -0
  30. stackit/loadbalancer/models/options_tcp.py +96 -0
  31. stackit/loadbalancer/models/options_udp.py +96 -0
  32. stackit/loadbalancer/models/plan_details.py +97 -0
  33. stackit/loadbalancer/models/server_name_indicator.py +81 -0
  34. stackit/loadbalancer/models/session_persistence.py +85 -0
  35. stackit/loadbalancer/models/status.py +111 -0
  36. stackit/loadbalancer/models/target.py +97 -0
  37. stackit/loadbalancer/models/target_pool.py +137 -0
  38. stackit/loadbalancer/models/update_credentials_payload.py +104 -0
  39. stackit/loadbalancer/models/update_credentials_response.py +92 -0
  40. stackit/loadbalancer/models/update_load_balancer_payload.py +231 -0
  41. stackit/loadbalancer/models/update_target_pool_payload.py +137 -0
  42. stackit/loadbalancer/py.typed +0 -0
  43. stackit/loadbalancer/rest.py +148 -0
  44. stackit_loadbalancer-0.0.1a1.dist-info/METADATA +46 -0
  45. stackit_loadbalancer-0.0.1a1.dist-info/RECORD +46 -0
  46. stackit_loadbalancer-0.0.1a1.dist-info/WHEEL +4 -0
@@ -0,0 +1,85 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
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, StrictBool
21
+ from typing_extensions import Self
22
+
23
+
24
+ class SessionPersistence(BaseModel):
25
+ """
26
+ SessionPersistence
27
+ """
28
+
29
+ use_source_ip_address: Optional[StrictBool] = Field(
30
+ default=None,
31
+ description="If enabled then all connections from one source IP address are redirected to the same target. This setting changes the load balancing algorithm to Maglev.",
32
+ alias="useSourceIpAddress",
33
+ )
34
+ __properties: ClassVar[List[str]] = ["useSourceIpAddress"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of SessionPersistence from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of SessionPersistence from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({"useSourceIpAddress": obj.get("useSourceIpAddress")})
85
+ return _obj
@@ -0,0 +1,111 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
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, StrictInt, StrictStr
21
+ from typing_extensions import Self
22
+
23
+ from stackit.loadbalancer.models.google_protobuf_any import GoogleProtobufAny
24
+
25
+
26
+ class Status(BaseModel):
27
+ """
28
+ The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
29
+ """
30
+
31
+ code: Optional[StrictInt] = Field(
32
+ default=None,
33
+ description="The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].",
34
+ )
35
+ details: Optional[List[GoogleProtobufAny]] = Field(
36
+ default=None,
37
+ description="A list of messages that carry the error details. There is a common set of message types for APIs to use.",
38
+ )
39
+ message: Optional[StrictStr] = Field(
40
+ default=None,
41
+ description="A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.",
42
+ )
43
+ __properties: ClassVar[List[str]] = ["code", "details", "message"]
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+ def to_str(self) -> str:
52
+ """Returns the string representation of the model using alias"""
53
+ return pprint.pformat(self.model_dump(by_alias=True))
54
+
55
+ def to_json(self) -> str:
56
+ """Returns the JSON representation of the model using alias"""
57
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58
+ return json.dumps(self.to_dict())
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
62
+ """Create an instance of Status from a JSON string"""
63
+ return cls.from_dict(json.loads(json_str))
64
+
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ """
75
+ excluded_fields: Set[str] = set([])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ # override the default output from pydantic by calling `to_dict()` of each item in details (list)
83
+ _items = []
84
+ if self.details:
85
+ for _item in self.details:
86
+ if _item:
87
+ _items.append(_item.to_dict())
88
+ _dict["details"] = _items
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of Status from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj)
99
+
100
+ _obj = cls.model_validate(
101
+ {
102
+ "code": obj.get("code"),
103
+ "details": (
104
+ [GoogleProtobufAny.from_dict(_item) for _item in obj["details"]]
105
+ if obj.get("details") is not None
106
+ else None
107
+ ),
108
+ "message": obj.get("message"),
109
+ }
110
+ )
111
+ return _obj
@@ -0,0 +1,97 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+
25
+ class Target(BaseModel):
26
+ """
27
+ Target
28
+ """
29
+
30
+ display_name: Optional[Annotated[str, Field(strict=True)]] = Field(
31
+ default=None, description="Target name", alias="displayName"
32
+ )
33
+ ip: Optional[StrictStr] = Field(default=None, description="Target IP. Must by unique within a target pool.")
34
+ __properties: ClassVar[List[str]] = ["displayName", "ip"]
35
+
36
+ @field_validator("display_name")
37
+ def display_name_validate_regular_expression(cls, value):
38
+ """Validates the regular expression"""
39
+ if value is None:
40
+ return value
41
+
42
+ if not re.match(r"^[0-9a-zA-Z](?:(?:[0-9a-zA-Z]|-){0,61}[0-9a-zA-Z])?$", value):
43
+ raise ValueError(
44
+ r"must validate the regular expression /^[0-9a-zA-Z](?:(?:[0-9a-zA-Z]|-){0,61}[0-9a-zA-Z])?$/"
45
+ )
46
+ return value
47
+
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of Target from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of Target from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({"displayName": obj.get("displayName"), "ip": obj.get("ip")})
97
+ return _obj
@@ -0,0 +1,137 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+ from stackit.loadbalancer.models.active_health_check import ActiveHealthCheck
25
+ from stackit.loadbalancer.models.session_persistence import SessionPersistence
26
+ from stackit.loadbalancer.models.target import Target
27
+
28
+
29
+ class TargetPool(BaseModel):
30
+ """
31
+ TargetPool
32
+ """
33
+
34
+ active_health_check: Optional[ActiveHealthCheck] = Field(default=None, alias="activeHealthCheck")
35
+ name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Target pool name")
36
+ session_persistence: Optional[SessionPersistence] = Field(default=None, alias="sessionPersistence")
37
+ target_port: Optional[Annotated[int, Field(le=65535, strict=True, ge=1)]] = Field(
38
+ default=None,
39
+ description="The number identifying the port where each target listens for traffic.",
40
+ alias="targetPort",
41
+ )
42
+ targets: Optional[List[Target]] = Field(
43
+ default=None, description="List of all targets which will be used in the pool. Limited to 250."
44
+ )
45
+ __properties: ClassVar[List[str]] = ["activeHealthCheck", "name", "sessionPersistence", "targetPort", "targets"]
46
+
47
+ @field_validator("name")
48
+ def name_validate_regular_expression(cls, value):
49
+ """Validates the regular expression"""
50
+ if value is None:
51
+ return value
52
+
53
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,18}[0-9a-z])?$", value):
54
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,18}[0-9a-z])?$/")
55
+ return value
56
+
57
+ model_config = ConfigDict(
58
+ populate_by_name=True,
59
+ validate_assignment=True,
60
+ protected_namespaces=(),
61
+ )
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
+ return json.dumps(self.to_dict())
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of TargetPool from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ """
87
+ excluded_fields: Set[str] = set([])
88
+
89
+ _dict = self.model_dump(
90
+ by_alias=True,
91
+ exclude=excluded_fields,
92
+ exclude_none=True,
93
+ )
94
+ # override the default output from pydantic by calling `to_dict()` of active_health_check
95
+ if self.active_health_check:
96
+ _dict["activeHealthCheck"] = self.active_health_check.to_dict()
97
+ # override the default output from pydantic by calling `to_dict()` of session_persistence
98
+ if self.session_persistence:
99
+ _dict["sessionPersistence"] = self.session_persistence.to_dict()
100
+ # override the default output from pydantic by calling `to_dict()` of each item in targets (list)
101
+ _items = []
102
+ if self.targets:
103
+ for _item in self.targets:
104
+ if _item:
105
+ _items.append(_item.to_dict())
106
+ _dict["targets"] = _items
107
+ return _dict
108
+
109
+ @classmethod
110
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
111
+ """Create an instance of TargetPool 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
+ "activeHealthCheck": (
121
+ ActiveHealthCheck.from_dict(obj["activeHealthCheck"])
122
+ if obj.get("activeHealthCheck") is not None
123
+ else None
124
+ ),
125
+ "name": obj.get("name"),
126
+ "sessionPersistence": (
127
+ SessionPersistence.from_dict(obj["sessionPersistence"])
128
+ if obj.get("sessionPersistence") is not None
129
+ else None
130
+ ),
131
+ "targetPort": obj.get("targetPort"),
132
+ "targets": (
133
+ [Target.from_dict(_item) for _item in obj["targets"]] if obj.get("targets") is not None else None
134
+ ),
135
+ }
136
+ )
137
+ return _obj
@@ -0,0 +1,104 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ import re
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+
25
+ class UpdateCredentialsPayload(BaseModel):
26
+ """
27
+ UpdateCredentialsPayload
28
+ """
29
+
30
+ display_name: Optional[Annotated[str, Field(strict=True)]] = Field(
31
+ default=None, description="Credential name", alias="displayName"
32
+ )
33
+ password: Optional[StrictStr] = Field(
34
+ default=None,
35
+ description="A valid password used for an existing ARGUS instance, which is used during basic auth.",
36
+ )
37
+ username: Optional[StrictStr] = Field(
38
+ default=None,
39
+ description="A valid username used for an existing ARGUS instance, which is used during basic auth.",
40
+ )
41
+ __properties: ClassVar[List[str]] = ["displayName", "password", "username"]
42
+
43
+ @field_validator("display_name")
44
+ def display_name_validate_regular_expression(cls, value):
45
+ """Validates the regular expression"""
46
+ if value is None:
47
+ return value
48
+
49
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,251}[0-9a-z])?$", value):
50
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,251}[0-9a-z])?$/")
51
+ return value
52
+
53
+ model_config = ConfigDict(
54
+ populate_by_name=True,
55
+ validate_assignment=True,
56
+ protected_namespaces=(),
57
+ )
58
+
59
+ def to_str(self) -> str:
60
+ """Returns the string representation of the model using alias"""
61
+ return pprint.pformat(self.model_dump(by_alias=True))
62
+
63
+ def to_json(self) -> str:
64
+ """Returns the JSON representation of the model using alias"""
65
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
+ return json.dumps(self.to_dict())
67
+
68
+ @classmethod
69
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
+ """Create an instance of UpdateCredentialsPayload from a JSON string"""
71
+ return cls.from_dict(json.loads(json_str))
72
+
73
+ def to_dict(self) -> Dict[str, Any]:
74
+ """Return the dictionary representation of the model using alias.
75
+
76
+ This has the following differences from calling pydantic's
77
+ `self.model_dump(by_alias=True)`:
78
+
79
+ * `None` is only added to the output dict for nullable fields that
80
+ were set at model initialization. Other fields with value `None`
81
+ are ignored.
82
+ """
83
+ excluded_fields: Set[str] = set([])
84
+
85
+ _dict = self.model_dump(
86
+ by_alias=True,
87
+ exclude=excluded_fields,
88
+ exclude_none=True,
89
+ )
90
+ return _dict
91
+
92
+ @classmethod
93
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
94
+ """Create an instance of UpdateCredentialsPayload from a dict"""
95
+ if obj is None:
96
+ return None
97
+
98
+ if not isinstance(obj, dict):
99
+ return cls.model_validate(obj)
100
+
101
+ _obj = cls.model_validate(
102
+ {"displayName": obj.get("displayName"), "password": obj.get("password"), "username": obj.get("username")}
103
+ )
104
+ return _obj
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Load Balancer API
5
+
6
+ This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.
7
+
8
+ The version of the OpenAPI document: 1.7.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
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.loadbalancer.models.credentials_response import CredentialsResponse
24
+
25
+
26
+ class UpdateCredentialsResponse(BaseModel):
27
+ """
28
+ UpdateCredentialsResponse
29
+ """
30
+
31
+ credential: Optional[CredentialsResponse] = None
32
+ __properties: ClassVar[List[str]] = ["credential"]
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 UpdateCredentialsResponse 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 credential
72
+ if self.credential:
73
+ _dict["credential"] = self.credential.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 UpdateCredentialsResponse 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
+ "credential": (
88
+ CredentialsResponse.from_dict(obj["credential"]) if obj.get("credential") is not None else None
89
+ )
90
+ }
91
+ )
92
+ return _obj