Skip to content

Commit

Permalink
Regenerated from the update openapi spec with better human readable n…
Browse files Browse the repository at this point in the history
…ames.
  • Loading branch information
pmajumdarKS committed Aug 29, 2024
1 parent 764a4cd commit f1fb60a
Show file tree
Hide file tree
Showing 353 changed files with 36,442 additions and 15,928 deletions.
369 changes: 192 additions & 177 deletions .openapi-generator/FILES

Large diffs are not rendered by default.

708 changes: 365 additions & 343 deletions README.md

Large diffs are not rendered by default.

1,480 changes: 1,117 additions & 363 deletions cyperf-openapi.yaml

Large diffs are not rendered by default.

123 changes: 64 additions & 59 deletions cyperf/__init__.py

Large diffs are not rendered by default.

2,569 changes: 1,840 additions & 729 deletions cyperf/api/agents_api.py

Large diffs are not rendered by default.

12,259 changes: 6,928 additions & 5,331 deletions cyperf/api/application_resources_api.py

Large diffs are not rendered by default.

408 changes: 204 additions & 204 deletions cyperf/api/brokers_api.py

Large diffs are not rendered by default.

1,340 changes: 670 additions & 670 deletions cyperf/api/configurations_api.py

Large diffs are not rendered by default.

198 changes: 99 additions & 99 deletions cyperf/api/data_migration_api.py

Large diffs are not rendered by default.

356 changes: 178 additions & 178 deletions cyperf/api/license_servers_api.py

Large diffs are not rendered by default.

892 changes: 429 additions & 463 deletions cyperf/api/notifications_api.py

Large diffs are not rendered by default.

333 changes: 166 additions & 167 deletions cyperf/api/reports_api.py

Large diffs are not rendered by default.

3,383 changes: 1,871 additions & 1,512 deletions cyperf/api/sessions_api.py

Large diffs are not rendered by default.

748 changes: 374 additions & 374 deletions cyperf/api/statistics_api.py

Large diffs are not rendered by default.

344 changes: 172 additions & 172 deletions cyperf/api/test_operations_api.py

Large diffs are not rendered by default.

1,497 changes: 730 additions & 767 deletions cyperf/api/test_results_api.py

Large diffs are not rendered by default.

2,302 changes: 1,743 additions & 559 deletions cyperf/api/utils_api.py

Large diffs are not rendered by default.

123 changes: 64 additions & 59 deletions cyperf/models/__init__.py

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions cyperf/models/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ class Action(BaseModel):
Action
""" # noqa: E501
dst_host: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The destination host of the action.", alias="DstHost")
exchanges: List[Exchange] = Field(alias="Exchanges")
exchanges: Optional[List[Exchange]] = Field(default=None, alias="Exchanges")
index: Optional[StrictInt] = Field(default=None, description="The index of the action.", alias="Index")
is_banner: Optional[StrictBool] = Field(default=None, description="Indicates if this is a required action, can only be add once and also must be the first", alias="IsBanner")
is_deprecated: Optional[StrictBool] = Field(default=None, description="A value that indicates if the action is deprecated.", alias="IsDeprecated")
is_hostname: Optional[StrictInt] = Field(default=None, alias="IsHostname")
is_strike: StrictBool = Field(description="A value that indicates if the action is a strike.", alias="IsStrike")
is_strike: Optional[StrictBool] = Field(default=None, description="A value that indicates if the action is a strike.", alias="IsStrike")
name: Optional[StrictStr] = Field(default=None, description="The name of the action.", alias="Name")
params: Optional[List[Params]] = Field(default=None, alias="Params")
port: Optional[StrictInt] = Field(default=None, description="The port of the destination host.", alias="Port")
protocol_id: StrictStr = Field(alias="ProtocolID")
protocol_id: Optional[StrictStr] = Field(default=None, alias="ProtocolID")
requires_uniqueness: Optional[StrictBool] = Field(default=None, description="If true, for applications with the same protocol id, application/attack must have been uniquely identified in previous commands.", alias="RequiresUniqueness")
id: StrictStr
id: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["DstHost", "Exchanges", "Index", "IsBanner", "IsDeprecated", "IsHostname", "IsStrike", "Name", "Params", "Port", "ProtocolID", "RequiresUniqueness", "id"]

@field_validator('dst_host')
Expand Down
8 changes: 4 additions & 4 deletions cyperf/models/action_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ class ActionBase(BaseModel):
ActionBase
""" # noqa: E501
dst_host: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The destination host of the action.", alias="DstHost")
exchanges: List[Exchange] = Field(alias="Exchanges")
exchanges: Optional[List[Exchange]] = Field(default=None, alias="Exchanges")
index: Optional[StrictInt] = Field(default=None, description="The index of the action.", alias="Index")
is_banner: Optional[StrictBool] = Field(default=None, description="Indicates if this is a required action, can only be add once and also must be the first", alias="IsBanner")
is_deprecated: Optional[StrictBool] = Field(default=None, description="A value that indicates if the action is deprecated.", alias="IsDeprecated")
is_hostname: Optional[StrictInt] = Field(default=None, alias="IsHostname")
is_strike: StrictBool = Field(description="A value that indicates if the action is a strike.", alias="IsStrike")
is_strike: Optional[StrictBool] = Field(default=None, description="A value that indicates if the action is a strike.", alias="IsStrike")
name: Optional[StrictStr] = Field(default=None, description="The name of the action.", alias="Name")
params: Optional[List[Params]] = Field(default=None, alias="Params")
port: Optional[StrictInt] = Field(default=None, description="The port of the destination host.", alias="Port")
protocol_id: StrictStr = Field(alias="ProtocolID")
protocol_id: Optional[StrictStr] = Field(default=None, alias="ProtocolID")
requires_uniqueness: Optional[StrictBool] = Field(default=None, description="If true, for applications with the same protocol id, application/attack must have been uniquely identified in previous commands.", alias="RequiresUniqueness")
id: StrictStr
id: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["DstHost", "Exchanges", "Index", "IsBanner", "IsDeprecated", "IsHostname", "IsStrike", "Name", "Params", "Port", "ProtocolID", "RequiresUniqueness", "id"]

@field_validator('dst_host')
Expand Down
95 changes: 95 additions & 0 deletions cyperf/models/agent_assignment_by_port.py
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


2 changes: 1 addition & 1 deletion cyperf/models/agent_assignment_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AgentAssignmentDetails(BaseModel):
agent_id: StrictStr = Field(description="The id of the agent that is assigned.", alias="agentId")
capture_settings: Optional[CaptureSettings] = Field(default=None, description="The capture settings of the agent that is assigned.", alias="captureSettings")
id: StrictStr
interfaces: List[StrictStr] = Field(description="The names of the assigned test interfaces for the agent.")
interfaces: Optional[List[StrictStr]] = Field(default=None, description="The names of the assigned test interfaces for the agent.")
__properties: ClassVar[List[str]] = ["agentId", "captureSettings", "id", "interfaces"]

model_config = ConfigDict(
Expand Down
16 changes: 13 additions & 3 deletions cyperf/models/agent_assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import json

from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List
from typing import Any, ClassVar, Dict, List, Optional
from cyperf.models.agent_assignment_by_port import AgentAssignmentByPort
from cyperf.models.agent_assignment_details import AgentAssignmentDetails
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -27,9 +28,10 @@ class AgentAssignments(BaseModel):
"""
The agents assigned to the current test configuration
""" # noqa: E501
by_id: List[AgentAssignmentDetails] = Field(description="The agents statically assigned to the current test configuration.", alias="ByID")
by_id: Optional[List[AgentAssignmentDetails]] = Field(default=None, description="The agents statically assigned to the current test configuration.", alias="ByID")
by_port: Optional[List[AgentAssignmentByPort]] = Field(default=None, description="The ports assigned to the current test configuration.", alias="ByPort")
by_tag: List[StrictStr] = Field(description="The tags according to which the agents are dynamically assigned.", alias="ByTag")
__properties: ClassVar[List[str]] = ["ByID", "ByTag"]
__properties: ClassVar[List[str]] = ["ByID", "ByPort", "ByTag"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -77,6 +79,13 @@ def to_dict(self) -> Dict[str, Any]:
if _item_by_id:
_items.append(_item_by_id.to_dict())
_dict['ByID'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in by_port (list)
_items = []
if self.by_port:
for _item_by_port in self.by_port:
if _item_by_port:
_items.append(_item_by_port.to_dict())
_dict['ByPort'] = _items
return _dict

@classmethod
Expand All @@ -90,6 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:

_obj = cls.model_validate({
"ByID": [AgentAssignmentDetails.from_dict(_item) for _item in obj["ByID"]] if obj.get("ByID") is not None else None,
"ByPort": [AgentAssignmentByPort.from_dict(_item) for _item in obj["ByPort"]] if obj.get("ByPort") is not None else None,
"ByTag": obj.get("ByTag")
})
return _obj
Expand Down
4 changes: 2 additions & 2 deletions cyperf/models/api_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class APILink(BaseModel):
""" # noqa: E501
content_type: Optional[StrictStr] = Field(default=None, alias="contentType")
href: StrictStr
id: StrictStr
id: Optional[StrictStr] = None
method: Optional[StrictStr] = None
name: StrictStr
name: Optional[StrictStr] = None
references_count: Optional[StrictInt] = Field(default=None, alias="referencesCount")
rel: StrictStr
type: StrictStr
Expand Down
106 changes: 106 additions & 0 deletions cyperf/models/app_exchange.py
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


Loading

0 comments on commit f1fb60a

Please sign in to comment.