Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ style = "numpy"
check-arg-order = false
require-return-section-when-returning-nothing = false
quiet = true
exclude = "build|response"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious what build refers to here, but makes sense we want to exclude response dataclasses 😋

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 that's a good question.
I guess I just tried following CI without giving it much thought 😢
https://github.com/zowe/zowe-client-python-sdk/blob/main/.github/workflows/sdk-build.yml#L37

I'll look into it 😋

60 changes: 54 additions & 6 deletions src/workflows/zowe/workflows_for_zowe_sdk/response/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class CreateWorkflowResponse:
"""
Workflow definition, returned by z/OSMF on a "create workflow" request.

See more at: [Create a workflow: Response from a create workflow request](https://www.ibm.com/docs/en/zos/3.1.0?topic=services-create-workflow#POSTMethodCreateAWorkflow__CreateWorkflowResponse)

Parameters
Expand Down Expand Up @@ -45,15 +46,18 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
class GetWorkflowPropertiesResponse:
"""
Workflow definition, returned by z/OSMF on "get workflow properties" request.

See more at: [Get the properties of a workflow: JSON object that is returned to a get workflow properties request](https://www.ibm.com/docs/en/zos/3.1.0?topic=services-get-properties-workflow#GETMethodRetrieveInformationAboutWF__ResponseBodyGetProperties)

Parameters
Expand Down Expand Up @@ -187,15 +191,18 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key.replace("-", "_")]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key.replace("-", "_")] = value

@dataclass
class WorkflowAutomationStatusResponse:
"""
An automation-info object that contains details about the most recent start automation request for the workflow.

The content of this property depends on the following factors:
- If no automation was performed for the workflow, this property is null.
- If automation processing is still in progress, this property indicates the step that is being processed.
Expand Down Expand Up @@ -244,9 +251,11 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
Expand Down Expand Up @@ -466,9 +475,11 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key.replace("-", "_")]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key.replace("-", "_")] = value

@dataclass
Expand Down Expand Up @@ -499,15 +510,18 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
class WorkflowJobStatusResponse:
"""
TODO: this class is very similar to the JobResponse class from zos_jobs_for_zowe_sdk.

It is better to consider their merging.

Contains details about the job.
Expand Down Expand Up @@ -551,11 +565,13 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
if key == "class":
key = "job_class"
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
if key == "class":
key = "job_class"
self.__dict__[key] = value
Expand Down Expand Up @@ -602,18 +618,22 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
if key == "class":
key = "job_class"
return self.__dict__[key.replace("-", "_")]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
if key == "class":
key = "job_class"
self.__dict__[key.replace("-", "_")] = value

@dataclass
class WorkflowVariableReferenceResponse:
"""
Variable-reference object returned by z/OSMF.

For more information:
- [Get Workflow Properties request: Format of the variable-reference object](https://www.ibm.com/docs/en/zos/3.1.0?topic=services-get-properties-workflow#GETMethodRetrieveInformationAboutWF__ResponseBodyGetPropertiesVarRef)

Expand All @@ -633,9 +653,11 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
Expand Down Expand Up @@ -671,15 +693,18 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
class ListWorkflowsResponse:
"""
Workflow definition, returned by z/OSMF on "list workflows" request.

See more at: [List workflows request: Format of the workflow-info object](https://www.ibm.com/docs/en/zos/3.1.0?topic=services-list-workflows-system-sysplex#GETMethodListWorkflows__ResponseBodyListWorkflows)

Parameters
Expand Down Expand Up @@ -722,15 +747,18 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
class GetWorkflowDefinitionResponse:
"""
Workflow definition, returned by z/OSMF on "list workflows" request.

See more at: [Retrieve a workflow definition: JSON object that is returned to a retrieve a workflow definition request](https://www.ibm.com/docs/en/zos/3.1.0?topic=services-retrieve-workflow-definition#GETMethodRetrieveWorkflowDefinition__ResponseBodyGetTemplate)

Parameters
Expand All @@ -750,7 +778,7 @@ class GetWorkflowDefinitionResponse:
isCallable: Optional[Literal["system", "sysplex"]]
Indicates the callable scope for the workflow.
containsParallelSteps: Optional[bool]
For a workflow with automated steps, this property indicates whether the automated steps can be run in parallel (concurrently).
For a workflow with automated steps, this property indicates whether the automated steps can be run in parallel (concurrently).
scope: Optional[Literal["system", "sysplex", "none"]]
Indicates the singleton scope for the workflow.
jobsOutputDirectory: Optional[str]
Expand All @@ -764,7 +792,7 @@ class GetWorkflowDefinitionResponse:
productVersion: Optional[str]
Version and release of the product or component that is configured through the workflow.
globalVariableGroup: Optional[str]
Global variable group for the workflow.
Global variable group for the workflow.
isInstanceVariableWithoutPrefix: Optional[bool]
Indicates whether the simplified format is used for references to instance variables.
steps: Optional[list['WorkflowDefinitionStepResponse']]
Expand Down Expand Up @@ -801,9 +829,11 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
Expand Down Expand Up @@ -966,9 +996,11 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key.replace("-", "_")]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key.replace("-", "_")] = value

@dataclass
Expand All @@ -994,9 +1026,11 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
Expand All @@ -1020,9 +1054,11 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
Expand Down Expand Up @@ -1052,9 +1088,11 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
Expand Down Expand Up @@ -1088,13 +1126,13 @@ class WorkflowDefinitionVariableResponse:
maxLength: Optional[int]
Maximum length of the variable value.
maxValue: Optional[str]
Maximum value of the variable.
Maximum value of the variable.
minLength: Optional[int]
Minimum length of the variable value.
minValue: Optional[str]
Minimum value of the variable.
Minimum value of the variable.
promptAtCreate: Optional[bool]
Indicates whether the user is prompted to specify a value for the variable during the create workflow process.
Indicates whether the user is prompted to specify a value for the variable during the create workflow process.
regularExpression: Optional[str]
Provides a standard regular expression that constrains the variable value, as an alternative to the available validation types.
requiredAtCreate: Optional[bool]
Expand Down Expand Up @@ -1135,15 +1173,18 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
class ListArchivedWorkflowsResponse:
"""
Workflow definition, returned by z/OSMF on "list archived workflows" request.

See more at: [List archived workflows request: Format of the workflow-info object](https://www.ibm.com/docs/en/zos/3.1.0?topic=services-list-archived-workflows-system#GETMethodListArchivedWorkflows__ResponseBodyListWorkflows)

Parameters
Expand All @@ -1165,15 +1206,18 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
class GetArchivedWorkflowPropertiesResponse:
"""
Workflow definition, returned by z/OSMF on "get archived workflow properties" request.

See more at: [Get the properties of an archived workflow: JSON object that is returned to a get archived workflow properties request](https://www.ibm.com/docs/en/zos/3.1.0?topic=services-get-properties-archived-workflow#GETMethodRetrieveInformationArchived__ResponseBodyGetArchivedProperties)

Parameters
Expand Down Expand Up @@ -1209,7 +1253,7 @@ class GetArchivedWorkflowPropertiesResponse:
isCallable: Optional[bool]
Indicates whether a workflow is eligible to be called by another workflow.
containsParallelSteps: Optional[bool]
For a workflow with automated steps, this property indicates whether the automated steps can be run in parallel (concurrently).
For a workflow with automated steps, this property indicates whether the automated steps can be run in parallel (concurrently).
scope: Optional[Literal["system", "sysplex", "none"]]
Indicates the singleton scope for the workflow.
statusName: Optional[Literal["in-progress", "complete", "automation-in-progress", "cancelled"]]
Expand Down Expand Up @@ -1276,9 +1320,11 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key] = value

@dataclass
Expand Down Expand Up @@ -1480,7 +1526,9 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key.replace("-", "_")]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key.replace("-", "_")] = value
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

@dataclass
class IssueCommandResponse:
"""Issue command response dataclass."""

cmd_response_key: Optional[str] = None
cmd_response_url: Optional[str] = None
cmd_response_uri: Optional[str] = None
Expand All @@ -27,14 +29,18 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> str:
"""Get item by key."""
return str(self.__dict__[key.replace("-", "_")])

def __setitem__(self, key: str, value: str) -> None:
"""Set item by key."""
self.__dict__[key.replace("-", "_")] = value


@dataclass
class ConsoleResponse:
"""Console response dataclass."""

cmd_response: Optional[str] = None
sol_key_detected: Optional[bool] = None

Expand All @@ -44,7 +50,9 @@ def __init__(self, response: dict[str, Any]) -> None:
super().__setattr__(key, value)

def __getitem__(self, key: str) -> Any:
"""Get item by key."""
return self.__dict__[key.replace("-", "_")]

def __setitem__(self, key: str, value: Any) -> None:
"""Set item by key."""
self.__dict__[key.replace("-", "_")] = value
Loading
Loading