-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
…ames.
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
CyPerf Application API | ||
CyPerf REST API | ||
The version of the OpenAPI document: 1.0.0 | ||
Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
Do not edit the class manually. | ||
""" # noqa: E501 | ||
|
||
|
||
from __future__ import annotations | ||
import pprint | ||
import re # noqa: F401 | ||
import json | ||
|
||
from pydantic import BaseModel, ConfigDict, Field, StrictStr | ||
from typing import Any, ClassVar, Dict, List, Optional | ||
from cyperf.models.capture_settings import CaptureSettings | ||
from typing import Optional, Set | ||
from typing_extensions import Self | ||
|
||
class AgentAssignmentByPort(BaseModel): | ||
""" | ||
Details of an agent assignment by port | ||
""" # noqa: E501 | ||
capture_settings: Optional[CaptureSettings] = Field(default=None, description="The capture settings of the port that is assigned.", alias="captureSettings") | ||
id: StrictStr | ||
port_id: Optional[StrictStr] = Field(default=None, description="The id of the port that is assigned.", alias="portId") | ||
__properties: ClassVar[List[str]] = ["captureSettings", "id", "portId"] | ||
|
||
model_config = ConfigDict( | ||
populate_by_name=True, | ||
validate_assignment=True, | ||
protected_namespaces=(), | ||
) | ||
|
||
|
||
def to_str(self) -> str: | ||
"""Returns the string representation of the model using alias""" | ||
return pprint.pformat(self.model_dump(by_alias=True)) | ||
|
||
def to_json(self) -> str: | ||
"""Returns the JSON representation of the model using alias""" | ||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead | ||
return json.dumps(self.to_dict()) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of AgentAssignmentByPort from a JSON string""" | ||
return cls.from_dict(json.loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias. | ||
This has the following differences from calling pydantic's | ||
`self.model_dump(by_alias=True)`: | ||
* `None` is only added to the output dict for nullable fields that | ||
were set at model initialization. Other fields with value `None` | ||
are ignored. | ||
""" | ||
excluded_fields: Set[str] = set([ | ||
]) | ||
|
||
_dict = self.model_dump( | ||
by_alias=True, | ||
exclude=excluded_fields, | ||
exclude_none=True, | ||
) | ||
# override the default output from pydantic by calling `to_dict()` of capture_settings | ||
if self.capture_settings: | ||
_dict['captureSettings'] = self.capture_settings.to_dict() | ||
return _dict | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of AgentAssignmentByPort from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
_obj = cls.model_validate({ | ||
"captureSettings": CaptureSettings.from_dict(obj["captureSettings"]) if obj.get("captureSettings") is not None else None, | ||
"id": obj.get("id"), | ||
"portId": obj.get("portId") | ||
}) | ||
return _obj | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
CyPerf Application API | ||
CyPerf REST API | ||
The version of the OpenAPI document: 1.0.0 | ||
Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
Do not edit the class manually. | ||
""" # noqa: E501 | ||
|
||
|
||
from __future__ import annotations | ||
import pprint | ||
import re # noqa: F401 | ||
import json | ||
|
||
from pydantic import BaseModel, ConfigDict, Field, StrictStr | ||
from typing import Any, ClassVar, Dict, List, Optional | ||
from cyperf.models.exchange_payload import ExchangePayload | ||
from cyperf.models.generic_file import GenericFile | ||
from typing import Optional, Set | ||
from typing_extensions import Self | ||
|
||
class AppExchange(BaseModel): | ||
""" | ||
AppExchange | ||
""" # noqa: E501 | ||
c2s_payload: Optional[GenericFile] = Field(default=None, alias="c2sPayload") | ||
id: Optional[StrictStr] = None | ||
payload: Optional[ExchangePayload] = None | ||
s2c_payload: Optional[GenericFile] = Field(default=None, alias="s2cPayload") | ||
__properties: ClassVar[List[str]] = ["c2sPayload", "id", "payload", "s2cPayload"] | ||
|
||
model_config = ConfigDict( | ||
populate_by_name=True, | ||
validate_assignment=True, | ||
protected_namespaces=(), | ||
) | ||
|
||
|
||
def to_str(self) -> str: | ||
"""Returns the string representation of the model using alias""" | ||
return pprint.pformat(self.model_dump(by_alias=True)) | ||
|
||
def to_json(self) -> str: | ||
"""Returns the JSON representation of the model using alias""" | ||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead | ||
return json.dumps(self.to_dict()) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of AppExchange from a JSON string""" | ||
return cls.from_dict(json.loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias. | ||
This has the following differences from calling pydantic's | ||
`self.model_dump(by_alias=True)`: | ||
* `None` is only added to the output dict for nullable fields that | ||
were set at model initialization. Other fields with value `None` | ||
are ignored. | ||
* OpenAPI `readOnly` fields are excluded. | ||
""" | ||
excluded_fields: Set[str] = set([ | ||
"id", | ||
]) | ||
|
||
_dict = self.model_dump( | ||
by_alias=True, | ||
exclude=excluded_fields, | ||
exclude_none=True, | ||
) | ||
# override the default output from pydantic by calling `to_dict()` of c2s_payload | ||
if self.c2s_payload: | ||
_dict['c2sPayload'] = self.c2s_payload.to_dict() | ||
# override the default output from pydantic by calling `to_dict()` of payload | ||
if self.payload: | ||
_dict['payload'] = self.payload.to_dict() | ||
# override the default output from pydantic by calling `to_dict()` of s2c_payload | ||
if self.s2c_payload: | ||
_dict['s2cPayload'] = self.s2c_payload.to_dict() | ||
return _dict | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of AppExchange from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
_obj = cls.model_validate({ | ||
"c2sPayload": GenericFile.from_dict(obj["c2sPayload"]) if obj.get("c2sPayload") is not None else None, | ||
"id": obj.get("id"), | ||
"payload": ExchangePayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None, | ||
"s2cPayload": GenericFile.from_dict(obj["s2cPayload"]) if obj.get("s2cPayload") is not None else None | ||
}) | ||
return _obj | ||
|
||
|