method-security-sdk 0.35.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 (46) hide show
  1. method_sdk/__init__.py +0 -0
  2. method_sdk/configuration.py +654 -0
  3. method_sdk/errors.py +55 -0
  4. method_sdk/exceptions.py +220 -0
  5. method_sdk/inventory/__init__.py +94 -0
  6. method_sdk/inventory/api/__init__.py +5 -0
  7. method_sdk/inventory/api/inventory_api.py +1508 -0
  8. method_sdk/inventory/api_client.py +833 -0
  9. method_sdk/inventory/api_response.py +21 -0
  10. method_sdk/inventory/configuration.py +654 -0
  11. method_sdk/inventory/exceptions.py +1 -0
  12. method_sdk/inventory/models/__init__.py +39 -0
  13. method_sdk/inventory/models/access_denied_response_content.py +90 -0
  14. method_sdk/inventory/models/create_environment400_error_response_content.py +151 -0
  15. method_sdk/inventory/models/create_environment_request_content.py +88 -0
  16. method_sdk/inventory/models/create_environment_response_content.py +92 -0
  17. method_sdk/inventory/models/delete_environment400_error_response_content.py +151 -0
  18. method_sdk/inventory/models/delete_environment_response_content.py +92 -0
  19. method_sdk/inventory/models/environment.py +101 -0
  20. method_sdk/inventory/models/environment_not_found_response_content.py +90 -0
  21. method_sdk/inventory/models/environment_state.py +38 -0
  22. method_sdk/inventory/models/get_environment400_error_response_content.py +151 -0
  23. method_sdk/inventory/models/get_environment_response_content.py +92 -0
  24. method_sdk/inventory/models/internal_server_response_content.py +90 -0
  25. method_sdk/inventory/models/invalid_parameter.py +90 -0
  26. method_sdk/inventory/models/list_environments400_error_response_content.py +151 -0
  27. method_sdk/inventory/models/list_environments_response_content.py +97 -0
  28. method_sdk/inventory/models/malformed_request.py +90 -0
  29. method_sdk/inventory/models/missing_parameter.py +90 -0
  30. method_sdk/inventory/models/service_unavailable_response_content.py +90 -0
  31. method_sdk/inventory/models/throttling_response_content.py +90 -0
  32. method_sdk/inventory/models/unauthenticated_response_content.py +90 -0
  33. method_sdk/inventory/models/update_environment400_error_response_content.py +151 -0
  34. method_sdk/inventory/models/update_environment_request_content.py +88 -0
  35. method_sdk/inventory/models/update_environment_response_content.py +92 -0
  36. method_sdk/inventory/paginators.py +12 -0
  37. method_sdk/inventory/py.typed +0 -0
  38. method_sdk/inventory/rest.py +334 -0
  39. method_sdk/method_auth.py +116 -0
  40. method_sdk/method_error.py +36 -0
  41. method_sdk/pagination.py +20 -0
  42. method_sdk/py.typed +0 -0
  43. method_security_sdk-0.35.0.dist-info/METADATA +23 -0
  44. method_security_sdk-0.35.0.dist-info/RECORD +46 -0
  45. method_security_sdk-0.35.0.dist-info/WHEEL +5 -0
  46. method_security_sdk-0.35.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,90 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ InventoryService
5
+
6
+ Attack surface, assets, and environments
7
+
8
+ The version of the OpenAPI document: 3
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+ from pydantic_core import to_jsonable_python
25
+
26
+ class InvalidParameter(BaseModel):
27
+ """
28
+ A parameter fails a constraint of the model, e.g. its length, range or pattern.
29
+ """ # noqa: E501
30
+ message: StrictStr
31
+ error_code: Optional[StrictStr] = Field(default=None, description="The error's shape name, e.g. `Throttling`.", alias="errorCode")
32
+ __properties: ClassVar[List[str]] = ["message", "errorCode"]
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
+
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 InvalidParameter 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
+
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 InvalidParameter 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({
85
+ "message": obj.get("message"),
86
+ "errorCode": obj.get("errorCode")
87
+ })
88
+ return _obj
89
+
90
+
@@ -0,0 +1,151 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ InventoryService
5
+
6
+ Attack surface, assets, and environments
7
+
8
+ The version of the OpenAPI document: 3
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ import pprint
18
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
19
+ from typing import Any, List, Optional
20
+ from method_sdk.inventory.models.invalid_parameter import InvalidParameter
21
+ from method_sdk.inventory.models.malformed_request import MalformedRequest
22
+ from method_sdk.inventory.models.missing_parameter import MissingParameter
23
+ from pydantic import StrictStr, Field
24
+ from typing import Union, List, Set, Optional, Dict
25
+ from typing_extensions import Literal, Self
26
+
27
+ LISTENVIRONMENTS400ERRORRESPONSECONTENT_ONE_OF_SCHEMAS = ["InvalidParameter", "MalformedRequest", "MissingParameter"]
28
+
29
+ class ListEnvironments400ErrorResponseContent(BaseModel):
30
+ """
31
+ ListEnvironments400ErrorResponseContent
32
+ """
33
+ # data type: InvalidParameter
34
+ oneof_schema_1_validator: Optional[InvalidParameter] = None
35
+ # data type: MalformedRequest
36
+ oneof_schema_2_validator: Optional[MalformedRequest] = None
37
+ # data type: MissingParameter
38
+ oneof_schema_3_validator: Optional[MissingParameter] = None
39
+ actual_instance: Optional[Union[InvalidParameter, MalformedRequest, MissingParameter]] = None
40
+ one_of_schemas: Set[str] = { "InvalidParameter", "MalformedRequest", "MissingParameter" }
41
+
42
+ model_config = ConfigDict(
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def __init__(self, *args, **kwargs) -> None:
49
+ if args:
50
+ if len(args) > 1:
51
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
52
+ if kwargs:
53
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
54
+ super().__init__(actual_instance=args[0])
55
+ else:
56
+ super().__init__(**kwargs)
57
+
58
+ @field_validator('actual_instance')
59
+ def actual_instance_must_validate_oneof(cls, v):
60
+ instance = ListEnvironments400ErrorResponseContent.model_construct()
61
+ error_messages = []
62
+ match = 0
63
+ # validate data type: InvalidParameter
64
+ if not isinstance(v, InvalidParameter):
65
+ error_messages.append(f"Error! Input type `{type(v)}` is not `InvalidParameter`")
66
+ else:
67
+ match += 1
68
+ # validate data type: MalformedRequest
69
+ if not isinstance(v, MalformedRequest):
70
+ error_messages.append(f"Error! Input type `{type(v)}` is not `MalformedRequest`")
71
+ else:
72
+ match += 1
73
+ # validate data type: MissingParameter
74
+ if not isinstance(v, MissingParameter):
75
+ error_messages.append(f"Error! Input type `{type(v)}` is not `MissingParameter`")
76
+ else:
77
+ match += 1
78
+ if match > 1:
79
+ # more than 1 match
80
+ raise ValueError("Multiple matches found when setting `actual_instance` in ListEnvironments400ErrorResponseContent with oneOf schemas: InvalidParameter, MalformedRequest, MissingParameter. Details: " + ", ".join(error_messages))
81
+ elif match == 0:
82
+ # no match
83
+ raise ValueError("No match found when setting `actual_instance` in ListEnvironments400ErrorResponseContent with oneOf schemas: InvalidParameter, MalformedRequest, MissingParameter. Details: " + ", ".join(error_messages))
84
+ else:
85
+ return v
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
89
+ return cls.from_json(json.dumps(obj))
90
+
91
+ @classmethod
92
+ def from_json(cls, json_str: str) -> Self:
93
+ """Returns the object represented by the json string"""
94
+ instance = cls.model_construct()
95
+ error_messages = []
96
+ match = 0
97
+
98
+ # deserialize data into InvalidParameter
99
+ try:
100
+ instance.actual_instance = InvalidParameter.from_json(json_str)
101
+ match += 1
102
+ except (ValidationError, ValueError) as e:
103
+ error_messages.append(str(e))
104
+ # deserialize data into MalformedRequest
105
+ try:
106
+ instance.actual_instance = MalformedRequest.from_json(json_str)
107
+ match += 1
108
+ except (ValidationError, ValueError) as e:
109
+ error_messages.append(str(e))
110
+ # deserialize data into MissingParameter
111
+ try:
112
+ instance.actual_instance = MissingParameter.from_json(json_str)
113
+ match += 1
114
+ except (ValidationError, ValueError) as e:
115
+ error_messages.append(str(e))
116
+
117
+ if match > 1:
118
+ # more than 1 match
119
+ raise ValueError("Multiple matches found when deserializing the JSON string into ListEnvironments400ErrorResponseContent with oneOf schemas: InvalidParameter, MalformedRequest, MissingParameter. Details: " + ", ".join(error_messages))
120
+ elif match == 0:
121
+ # no match
122
+ raise ValueError("No match found when deserializing the JSON string into ListEnvironments400ErrorResponseContent with oneOf schemas: InvalidParameter, MalformedRequest, MissingParameter. Details: " + ", ".join(error_messages))
123
+ else:
124
+ return instance
125
+
126
+ def to_json(self) -> str:
127
+ """Returns the JSON representation of the actual instance"""
128
+ if self.actual_instance is None:
129
+ return "null"
130
+
131
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
132
+ return self.actual_instance.to_json()
133
+ else:
134
+ return json.dumps(self.actual_instance)
135
+
136
+ def to_dict(self) -> Optional[Union[Dict[str, Any], InvalidParameter, MalformedRequest, MissingParameter]]:
137
+ """Returns the dict representation of the actual instance"""
138
+ if self.actual_instance is None:
139
+ return None
140
+
141
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
142
+ return self.actual_instance.to_dict()
143
+ else:
144
+ # primitive type
145
+ return self.actual_instance
146
+
147
+ def to_str(self) -> str:
148
+ """Returns the string representation of the actual instance"""
149
+ return pprint.pformat(self.model_dump())
150
+
151
+
@@ -0,0 +1,97 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ InventoryService
5
+
6
+ Attack surface, assets, and environments
7
+
8
+ The version of the OpenAPI document: 3
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from method_sdk.inventory.models.environment import Environment
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class ListEnvironmentsResponseContent(BaseModel):
28
+ """
29
+ ListEnvironmentsResponseContent
30
+ """ # noqa: E501
31
+ environments: List[Environment]
32
+ next_token: Optional[StrictStr] = Field(default=None, description="Present when there are more environments to list.", alias="nextToken")
33
+ __properties: ClassVar[List[str]] = ["environments", "nextToken"]
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
+
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 ListEnvironmentsResponseContent 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
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of each item in environments (list)
75
+ _items = []
76
+ if self.environments:
77
+ for _item_environments in self.environments:
78
+ _items.append(_item_environments.to_dict() if _item_environments is not None else None)
79
+ _dict['environments'] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of ListEnvironmentsResponseContent from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate({
92
+ "environments": [Environment.from_dict(_item) for _item in obj["environments"]] if obj.get("environments") is not None else None,
93
+ "nextToken": obj.get("nextToken")
94
+ })
95
+ return _obj
96
+
97
+
@@ -0,0 +1,90 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ InventoryService
5
+
6
+ Attack surface, assets, and environments
7
+
8
+ The version of the OpenAPI document: 3
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+ from pydantic_core import to_jsonable_python
25
+
26
+ class MalformedRequest(BaseModel):
27
+ """
28
+ The request can't be parsed, e.g. invalid JSON or a value of the wrong type.
29
+ """ # noqa: E501
30
+ message: StrictStr
31
+ error_code: Optional[StrictStr] = Field(default=None, description="The error's shape name, e.g. `Throttling`.", alias="errorCode")
32
+ __properties: ClassVar[List[str]] = ["message", "errorCode"]
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
+
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 MalformedRequest 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
+
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 MalformedRequest 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({
85
+ "message": obj.get("message"),
86
+ "errorCode": obj.get("errorCode")
87
+ })
88
+ return _obj
89
+
90
+
@@ -0,0 +1,90 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ InventoryService
5
+
6
+ Attack surface, assets, and environments
7
+
8
+ The version of the OpenAPI document: 3
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+ from pydantic_core import to_jsonable_python
25
+
26
+ class MissingParameter(BaseModel):
27
+ """
28
+ A required parameter is missing.
29
+ """ # noqa: E501
30
+ message: StrictStr
31
+ error_code: Optional[StrictStr] = Field(default=None, description="The error's shape name, e.g. `Throttling`.", alias="errorCode")
32
+ __properties: ClassVar[List[str]] = ["message", "errorCode"]
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
+
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 MissingParameter 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
+
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 MissingParameter 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({
85
+ "message": obj.get("message"),
86
+ "errorCode": obj.get("errorCode")
87
+ })
88
+ return _obj
89
+
90
+
@@ -0,0 +1,90 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ InventoryService
5
+
6
+ Attack surface, assets, and environments
7
+
8
+ The version of the OpenAPI document: 3
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+ from pydantic_core import to_jsonable_python
25
+
26
+ class ServiceUnavailableResponseContent(BaseModel):
27
+ """
28
+ A dependency of the gateway is unavailable, or the gateway is overloaded.
29
+ """ # noqa: E501
30
+ message: StrictStr
31
+ error_code: Optional[StrictStr] = Field(default=None, description="The error's shape name, e.g. `Throttling`.", alias="errorCode")
32
+ __properties: ClassVar[List[str]] = ["message", "errorCode"]
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
+
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 ServiceUnavailableResponseContent 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
+
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 ServiceUnavailableResponseContent 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({
85
+ "message": obj.get("message"),
86
+ "errorCode": obj.get("errorCode")
87
+ })
88
+ return _obj
89
+
90
+
@@ -0,0 +1,90 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ InventoryService
5
+
6
+ Attack surface, assets, and environments
7
+
8
+ The version of the OpenAPI document: 3
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+ from pydantic_core import to_jsonable_python
25
+
26
+ class ThrottlingResponseContent(BaseModel):
27
+ """
28
+ The caller exceeded its rate limit for this operation.
29
+ """ # noqa: E501
30
+ message: StrictStr
31
+ error_code: Optional[StrictStr] = Field(default=None, description="The error's shape name, e.g. `Throttling`.", alias="errorCode")
32
+ __properties: ClassVar[List[str]] = ["message", "errorCode"]
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
+
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 ThrottlingResponseContent 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
+
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 ThrottlingResponseContent 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({
85
+ "message": obj.get("message"),
86
+ "errorCode": obj.get("errorCode")
87
+ })
88
+ return _obj
89
+
90
+