Skip to content
Closed
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,384 changes: 1,384 additions & 0 deletions src/conductor/client/http/api/service_registry_resource_api.py

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions src/conductor/client/http/api/workflow_resource_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3051,4 +3051,135 @@ def update_workflow_and_task_state_with_http_info(self, body, request_id, workfl
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

def execute_workflow_with_return_strategy(self, body, name, version, **kwargs): # noqa: E501
"""Execute a workflow synchronously with reactive response # noqa: E501

This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.execute_workflow_with_return_strategy(body,name,version)
>>> result = thread.get()

:param async_req bool
:param StartWorkflowRequest body: (required)
:param str name: (required)
:param int version: (required)
:param str request_id:
:param str wait_until_task_ref:
:param int wait_for_seconds:
:param str consistency: DURABLE or EVENTUAL
:param str return_strategy: TARGET_WORKFLOW or WAIT_WORKFLOW
:return: WorkflowRun
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.execute_workflow_with_return_strategy_with_http_info(body, name, version, **kwargs) # noqa: E501
else:
(data) = self.execute_workflow_with_return_strategy_with_http_info(body, name, version, **kwargs) # noqa: E501
return data

def execute_workflow_with_return_strategy_with_http_info(self, body, name, version, **kwargs): # noqa: E501
"""Execute a workflow synchronously with reactive response # noqa: E501

This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.execute_workflow_with_return_strategy_with_http_info(body, name, version, async_req=True)
>>> result = thread.get()

:param async_req bool
:param StartWorkflowRequest body: (required)
:param str name: (required)
:param int version: (required)
:param str request_id:
:param str wait_until_task_ref:
:param int wait_for_seconds:
:param str consistency: DURABLE or EVENTUAL
:param str return_strategy: TARGET_WORKFLOW or WAIT_WORKFLOW
:return: WorkflowRun
If the method is called asynchronously,
returns the request thread.
"""

all_params = ['body', 'name', 'version', 'request_id', 'wait_until_task_ref', 'wait_for_seconds', 'consistency',
'return_strategy', 'async_req', '_return_http_data_only', '_preload_content',
'_request_timeout'] # noqa: E501

params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method execute_workflow" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `execute_workflow`") # noqa: E501
# verify the required parameter 'name' is set
if ('name' not in params or
params['name'] is None):
raise ValueError("Missing the required parameter `name` when calling `execute_workflow`") # noqa: E501
# verify the required parameter 'version' is set
if ('version' not in params or
params['version'] is None):
raise ValueError("Missing the required parameter `version` when calling `execute_workflow`") # noqa: E501

collection_formats = {}

path_params = {}
if 'name' in params:
path_params['name'] = params['name'] # noqa: E501
if 'version' in params:
path_params['version'] = params['version'] # noqa: E501

query_params = []
if 'request_id' in params:
query_params.append(('requestId', params['request_id'])) # noqa: E501
if 'wait_until_task_ref' in params:
query_params.append(('waitUntilTaskRef', params['wait_until_task_ref'])) # noqa: E501
if 'wait_for_seconds' in params:
query_params.append(('waitForSeconds', params['wait_for_seconds'])) # noqa: E501
if 'consistency' in params:
query_params.append(('consistency', params['consistency'])) # noqa: E501
if 'return_strategy' in params:
query_params.append(('returnStrategy', params['return_strategy'])) # noqa: E501

header_params = {}

form_params = []
local_var_files = {}

body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501

# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501

# Authentication setting
auth_settings = ['api_key'] # noqa: E501

return self.api_client.call_api(
'/workflow/execute/{name}/{version}', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SignalResponse', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
7 changes: 6 additions & 1 deletion src/conductor/client/http/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,9 @@
from conductor.client.http.models.workflow_task import CacheConfig
from conductor.client.http.models.schema_def import SchemaDef
from conductor.client.http.models.schema_def import SchemaType
from conductor.client.http.models.signal_response import SignalResponse, TaskStatus
from conductor.client.http.models.service_registry import ServiceRegistry, OrkesCircuitBreakerConfig, Config, ServiceType
from conductor.client.http.models.request_param import RequestParam, Schema
from conductor.client.http.models.proto_registry_entry import ProtoRegistryEntry
from conductor.client.http.models.service_method import ServiceMethod
from conductor.client.http.models.circuit_breaker_transition_response import CircuitBreakerTransitionResponse
from conductor.client.http.models.signal_response import SignalResponse, TaskStatus
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from dataclasses import dataclass
from typing import Optional
import six


@dataclass
class CircuitBreakerTransitionResponse:
"""Circuit breaker transition response model."""

swagger_types = {
'service': 'str',
'previous_state': 'str',
'current_state': 'str',
'transition_timestamp': 'int',
'message': 'str'
}

attribute_map = {
'service': 'service',
'previous_state': 'previousState',
'current_state': 'currentState',
'transition_timestamp': 'transitionTimestamp',
'message': 'message'
}

service: Optional[str] = None
previous_state: Optional[str] = None
current_state: Optional[str] = None
transition_timestamp: Optional[int] = None
message: Optional[str] = None

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result

def __str__(self):
return f"CircuitBreakerTransitionResponse(service='{self.service}', previous_state='{self.previous_state}', current_state='{self.current_state}', transition_timestamp={self.transition_timestamp}, message='{self.message}')"
49 changes: 49 additions & 0 deletions src/conductor/client/http/models/proto_registry_entry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from dataclasses import dataclass
from typing import Optional
import six


@dataclass
class ProtoRegistryEntry:
"""Protocol buffer registry entry for storing service definitions."""

swagger_types = {
'service_name': 'str',
'filename': 'str',
'data': 'bytes'
}

attribute_map = {
'service_name': 'serviceName',
'filename': 'filename',
'data': 'data'
}

service_name: str
filename: str
data: bytes

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result

def __str__(self):
return f"ProtoRegistryEntry(service_name='{self.service_name}', filename='{self.filename}', data_size={len(self.data)})"
98 changes: 98 additions & 0 deletions src/conductor/client/http/models/request_param.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
from dataclasses import dataclass
from typing import Optional, Any
import six


@dataclass
class Schema:
"""Schema definition for request parameters."""

swagger_types = {
'type': 'str',
'format': 'str',
'default_value': 'object'
}

attribute_map = {
'type': 'type',
'format': 'format',
'default_value': 'defaultValue'
}

type: Optional[str] = None
format: Optional[str] = None
default_value: Optional[Any] = None

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result

def __str__(self):
return f"Schema(type='{self.type}', format='{self.format}', default_value={self.default_value})"


@dataclass
class RequestParam:
"""Request parameter model for API endpoints."""

swagger_types = {
'name': 'str',
'type': 'str',
'required': 'bool',
'schema': 'Schema'
}

attribute_map = {
'name': 'name',
'type': 'type',
'required': 'required',
'schema': 'schema'
}

name: Optional[str] = None
type: Optional[str] = None # Query, Header, Path, etc.
required: bool = False
schema: Optional[Schema] = None

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result

def __str__(self):
return f"RequestParam(name='{self.name}', type='{self.type}', required={self.required})"
Loading