stackit-registry 0.1.0__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 (33) hide show
  1. stackit/registry/__init__.py +111 -0
  2. stackit/registry/api/__init__.py +4 -0
  3. stackit/registry/api/default_api.py +1767 -0
  4. stackit/registry/api_client.py +650 -0
  5. stackit/registry/api_response.py +22 -0
  6. stackit/registry/configuration.py +163 -0
  7. stackit/registry/exceptions.py +218 -0
  8. stackit/registry/models/__init__.py +38 -0
  9. stackit/registry/models/artifactory.py +131 -0
  10. stackit/registry/models/artifactory_list.py +105 -0
  11. stackit/registry/models/bad_request_error_response.py +84 -0
  12. stackit/registry/models/conflict_error_response.py +84 -0
  13. stackit/registry/models/create_artifactory_payload.py +110 -0
  14. stackit/registry/models/create_proxy_request.py +102 -0
  15. stackit/registry/models/credentials.py +84 -0
  16. stackit/registry/models/forbidden_error_response.py +110 -0
  17. stackit/registry/models/generic_error_response.py +84 -0
  18. stackit/registry/models/internal_server_error_response.py +84 -0
  19. stackit/registry/models/not_found_error_response.py +84 -0
  20. stackit/registry/models/patch_artifactory_payload.py +90 -0
  21. stackit/registry/models/proxy.py +102 -0
  22. stackit/registry/models/redacted_credentials.py +83 -0
  23. stackit/registry/models/replication_adapter.py +100 -0
  24. stackit/registry/models/replication_adapter_list.py +105 -0
  25. stackit/registry/models/unauthorized_error_response.py +110 -0
  26. stackit/registry/models/update_proxy_request.py +98 -0
  27. stackit/registry/py.typed +0 -0
  28. stackit/registry/rest.py +164 -0
  29. stackit_registry-0.1.0.dist-info/METADATA +47 -0
  30. stackit_registry-0.1.0.dist-info/RECORD +33 -0
  31. stackit_registry-0.1.0.dist-info/WHEEL +4 -0
  32. stackit_registry-0.1.0.dist-info/licenses/LICENSE.md +201 -0
  33. stackit_registry-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
@@ -0,0 +1,84 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Container Registry API
5
+
6
+ STACKIT Container Registry management API.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: devex_development@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+
26
+ class InternalServerErrorResponse(BaseModel):
27
+ """
28
+ Internal server error.
29
+ """ # noqa: E501
30
+
31
+ details: Optional[StrictStr] = None
32
+ error: Optional[StrictStr] = None
33
+ __properties: ClassVar[List[str]] = ["details", "error"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of InternalServerErrorResponse from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of InternalServerErrorResponse from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({"details": obj.get("details"), "error": obj.get("error")})
84
+ return _obj
@@ -0,0 +1,84 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Container Registry API
5
+
6
+ STACKIT Container Registry management API.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: devex_development@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+
26
+ class NotFoundErrorResponse(BaseModel):
27
+ """
28
+ 404 Error Response.
29
+ """ # noqa: E501
30
+
31
+ error: Optional[StrictStr] = None
32
+ message: StrictStr
33
+ __properties: ClassVar[List[str]] = ["error", "message"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of NotFoundErrorResponse from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of NotFoundErrorResponse from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({"error": obj.get("error"), "message": obj.get("message")})
84
+ return _obj
@@ -0,0 +1,90 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Container Registry API
5
+
6
+ STACKIT Container Registry management API.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: devex_development@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+ from stackit.registry.models.update_proxy_request import UpdateProxyRequest
26
+
27
+
28
+ class PatchArtifactoryPayload(BaseModel):
29
+ """
30
+ Patch artifactory request
31
+ """ # noqa: E501
32
+
33
+ proxy: Optional[UpdateProxyRequest] = None
34
+ __properties: ClassVar[List[str]] = ["proxy"]
35
+
36
+ model_config = ConfigDict(
37
+ validate_by_name=True,
38
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of PatchArtifactoryPayload 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
+ # override the default output from pydantic by calling `to_dict()` of proxy
74
+ if self.proxy:
75
+ _dict["proxy"] = self.proxy.to_dict()
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of PatchArtifactoryPayload from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate(
88
+ {"proxy": UpdateProxyRequest.from_dict(obj["proxy"]) if obj.get("proxy") is not None else None}
89
+ )
90
+ return _obj
@@ -0,0 +1,102 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Container Registry API
5
+
6
+ STACKIT Container Registry management API.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: devex_development@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+ from stackit.registry.models.redacted_credentials import RedactedCredentials
26
+
27
+
28
+ class Proxy(BaseModel):
29
+ """
30
+ Replication settings for a proxy-cache artifactory
31
+ """ # noqa: E501
32
+
33
+ credentials: Optional[RedactedCredentials] = None
34
+ description: Optional[StrictStr] = Field(default=None, description="Description of the registry.")
35
+ registry_type: StrictStr = Field(
36
+ description="Which replication adapter to use for this registry. Discover the list of supported replication adapters, and therefore supported registry types, by calling GET /v1/projects/{projectId}/regions/{regionId}/replication/adapters "
37
+ )
38
+ url: StrictStr = Field(description="Upstream registry url to proxy")
39
+ __properties: ClassVar[List[str]] = ["credentials", "description", "registry_type", "url"]
40
+
41
+ model_config = ConfigDict(
42
+ validate_by_name=True,
43
+ validate_by_alias=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ return json.dumps(to_jsonable_python(self.to_dict()))
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of Proxy from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of credentials
79
+ if self.credentials:
80
+ _dict["credentials"] = self.credentials.to_dict()
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of Proxy from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate(
93
+ {
94
+ "credentials": (
95
+ RedactedCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
96
+ ),
97
+ "description": obj.get("description"),
98
+ "registry_type": obj.get("registry_type"),
99
+ "url": obj.get("url"),
100
+ }
101
+ )
102
+ return _obj
@@ -0,0 +1,83 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Container Registry API
5
+
6
+ STACKIT Container Registry management API.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: devex_development@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+
26
+ class RedactedCredentials(BaseModel):
27
+ """
28
+ Credentials for upstream registry, redacted
29
+ """ # noqa: E501
30
+
31
+ access_key: StrictStr
32
+ __properties: ClassVar[List[str]] = ["access_key"]
33
+
34
+ model_config = ConfigDict(
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of RedactedCredentials 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
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of RedactedCredentials from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({"access_key": obj.get("access_key")})
83
+ return _obj
@@ -0,0 +1,100 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Container Registry API
5
+
6
+ STACKIT Container Registry management API.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: devex_development@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+
26
+ class ReplicationAdapter(BaseModel):
27
+ """
28
+ ReplicationAdapter
29
+ """ # noqa: E501
30
+
31
+ credential_type: StrictStr = Field(
32
+ description="User-hint for what type of credentials are expected for replication adapter type. Values are one of `basic` for username/password, `oauth` for token based access, and `secret` for json-secret file. "
33
+ )
34
+ display_name: StrictStr = Field(description="Human-friendly name of the provider the adapter relates to.")
35
+ registry_type: StrictStr = Field(description="Identifies the replication adapter")
36
+ __properties: ClassVar[List[str]] = ["credential_type", "display_name", "registry_type"]
37
+
38
+ @field_validator("credential_type")
39
+ def credential_type_validate_enum(cls, value):
40
+ """Validates the enum"""
41
+ if value not in set(["basic", "oauth", "secret"]):
42
+ raise ValueError("must be one of enum values ('basic', 'oauth', 'secret')")
43
+ return value
44
+
45
+ model_config = ConfigDict(
46
+ validate_by_name=True,
47
+ validate_by_alias=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
62
+ """Create an instance of ReplicationAdapter 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
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of ReplicationAdapter from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate(
94
+ {
95
+ "credential_type": obj.get("credential_type"),
96
+ "display_name": obj.get("display_name"),
97
+ "registry_type": obj.get("registry_type"),
98
+ }
99
+ )
100
+ return _obj
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Container Registry API
5
+
6
+ STACKIT Container Registry management API.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: devex_development@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+ from stackit.registry.models.replication_adapter import ReplicationAdapter
26
+
27
+
28
+ class ReplicationAdapterList(BaseModel):
29
+ """
30
+ A list of replication adapters
31
+ """ # noqa: E501
32
+
33
+ next_page_token: Optional[StrictStr] = Field(
34
+ default=None,
35
+ description="A token to retrieve the next page of results. Pass this value as `page_token` in the subsequent request. If empty, there are no more pages.",
36
+ )
37
+ replication_adapters: List[ReplicationAdapter]
38
+ __properties: ClassVar[List[str]] = ["next_page_token", "replication_adapters"]
39
+
40
+ model_config = ConfigDict(
41
+ validate_by_name=True,
42
+ validate_by_alias=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ return json.dumps(to_jsonable_python(self.to_dict()))
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of ReplicationAdapterList from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # override the default output from pydantic by calling `to_dict()` of each item in replication_adapters (list)
78
+ _items = []
79
+ if self.replication_adapters:
80
+ for _item_replication_adapters in self.replication_adapters:
81
+ if _item_replication_adapters:
82
+ _items.append(_item_replication_adapters.to_dict())
83
+ _dict["replication_adapters"] = _items
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of ReplicationAdapterList from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate(
96
+ {
97
+ "next_page_token": obj.get("next_page_token"),
98
+ "replication_adapters": (
99
+ [ReplicationAdapter.from_dict(_item) for _item in obj["replication_adapters"]]
100
+ if obj.get("replication_adapters") is not None
101
+ else None
102
+ ),
103
+ }
104
+ )
105
+ return _obj