Skip to content

Commit

Permalink
Add standard transformer Simulate to SDK (#463)
Browse files Browse the repository at this point in the history
<!--  Thanks for sending a pull request!  Here are some tips for you:

1. Run unit tests and ensure that they are passing
2. If your change introduces any API changes, make sure to update the
e2e tests
3. Make sure documentation is updated for your PR!

-->

**What this PR does / why we need it**:
<!-- Explain here the context and why you're making the change. What is
the problem you're trying to solve. --->

- This PR adds Standard Transformer simulator to SDK 


**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

Fixes #

**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required. Enter your extended release note in
the block below.
If the PR requires additional action from users switching to the new
release, include the string "action required".

For more information about release notes, see kubernetes' guide here:
http://git.k8s.io/community/contributors/guide/release-notes.md
-->

```release-note

```

**Checklist**

- [ ] Added unit test, integration, and/or e2e tests
- [ ] Tested locally
- [ ] Updated documentation
- [ ] Update Swagger spec if the PR introduce API changes
- [ ] Regenerated Golang and Python client if the PR introduce API
changes
  • Loading branch information
tkpd-hafizhan authored Oct 3, 2023
1 parent 072325c commit 595b38a
Show file tree
Hide file tree
Showing 11 changed files with 1,165 additions and 554 deletions.
60 changes: 35 additions & 25 deletions python/sdk/client/api/standard_transformer_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ def standard_transformer_simulate_post(self, **kwargs): # noqa: E501
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.standard_transformer_simulate_post_with_http_info(**kwargs) # noqa: E501
kwargs["_return_http_data_only"] = True
if kwargs.get("async_req"):
return self.standard_transformer_simulate_post_with_http_info(
**kwargs
) # noqa: E501
else:
(data) = self.standard_transformer_simulate_post_with_http_info(**kwargs) # noqa: E501
(data) = self.standard_transformer_simulate_post_with_http_info(
**kwargs
) # noqa: E501
return data

def standard_transformer_simulate_post_with_http_info(self, **kwargs): # noqa: E501
Expand All @@ -68,21 +72,21 @@ def standard_transformer_simulate_post_with_http_info(self, **kwargs): # noqa:
returns the request thread.
"""

all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params = ["body"] # noqa: E501
all_params.append("async_req")
all_params.append("_return_http_data_only")
all_params.append("_preload_content")
all_params.append("_request_timeout")

params = locals()
for key, val in six.iteritems(params['kwargs']):
for key, val in six.iteritems(params["kwargs"]):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method standard_transformer_simulate_post" % key
)
params[key] = val
del params['kwargs']
del params["kwargs"]

collection_formats = {}

Expand All @@ -96,31 +100,37 @@ def standard_transformer_simulate_post_with_http_info(self, **kwargs): # noqa:
local_var_files = {}

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

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

# Authentication setting
auth_settings = ['Bearer'] # noqa: E501
auth_settings = ["Bearer"] # noqa: E501

return self.api_client.call_api(
'/standard_transformer/simulate', 'POST',
"/standard_transformer/simulate",
"POST",
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='StandardTransformerSimulationResponse', # noqa: E501
response_type="StandardTransformerSimulationResponse", # 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)
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,
)
51 changes: 31 additions & 20 deletions python/sdk/client/models/standard_transformer_simulation_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@

import six


class StandardTransformerSimulationRequest(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""

"""
Attributes:
swagger_types (dict): The key is attribute name
Expand All @@ -28,22 +30,29 @@ class StandardTransformerSimulationRequest(object):
and the value is json key in definition.
"""
swagger_types = {
'payload': 'FreeFormObject',
'headers': 'FreeFormObject',
'config': 'FreeFormObject',
'model_prediction_config': 'ModelPredictionConfig',
'protocol': 'Protocol'
"payload": "FreeFormObject",
"headers": "FreeFormObject",
"config": "FreeFormObject",
"model_prediction_config": "ModelPredictionConfig",
"protocol": "Protocol",
}

attribute_map = {
'payload': 'payload',
'headers': 'headers',
'config': 'config',
'model_prediction_config': 'model_prediction_config',
'protocol': 'protocol'
"payload": "payload",
"headers": "headers",
"config": "config",
"model_prediction_config": "model_prediction_config",
"protocol": "protocol",
}

def __init__(self, payload=None, headers=None, config=None, model_prediction_config=None, protocol=None): # noqa: E501
def __init__(
self,
payload=None,
headers=None,
config=None,
model_prediction_config=None,
protocol=None,
): # noqa: E501
"""StandardTransformerSimulationRequest - a model defined in Swagger""" # noqa: E501
self._payload = None
self._headers = None
Expand Down Expand Up @@ -174,18 +183,20 @@ def to_dict(self):
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
))
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()
))
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
if issubclass(StandardTransformerSimulationRequest, dict):
Expand Down
Loading

0 comments on commit 595b38a

Please sign in to comment.