Skip to content

Commit

Permalink
Merge pull request #32 from rushtehrani/chore/updates
Browse files Browse the repository at this point in the history
chore: Update API and fix nb magic
  • Loading branch information
rushtehrani authored Mar 2, 2021
2 parents a8e8bba + 155d949 commit 64a2acb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
8 changes: 5 additions & 3 deletions docs/WorkspaceServiceApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **resume_workspace**
> object resume_workspace(namespace, uid)
> object resume_workspace(namespace, uid, body)


Expand Down Expand Up @@ -676,9 +676,10 @@ with onepanel.core.api.ApiClient(configuration) as api_client:
api_instance = onepanel.core.api.WorkspaceServiceApi(api_client)
namespace = 'namespace_example' # str |
uid = 'uid_example' # str |
body = onepanel.core.api.UpdateWorkspaceBody() # UpdateWorkspaceBody |

try:
api_response = api_instance.resume_workspace(namespace, uid)
api_response = api_instance.resume_workspace(namespace, uid, body)
pprint(api_response)
except ApiException as e:
print("Exception when calling WorkspaceServiceApi->resume_workspace: %s\n" % e)
Expand All @@ -690,6 +691,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**namespace** | **str**| |
**uid** | **str**| |
**body** | [**UpdateWorkspaceBody**](UpdateWorkspaceBody.md)| |

### Return type

Expand All @@ -701,7 +703,7 @@ Name | Type | Description | Notes

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json, application/octet-stream

### HTTP response details
Expand Down
25 changes: 19 additions & 6 deletions onepanel/core/api/api/workspace_service_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,17 +1029,18 @@ def pause_workspace_with_http_info(self, namespace, uid, **kwargs): # noqa: E50
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)

def resume_workspace(self, namespace, uid, **kwargs): # noqa: E501
def resume_workspace(self, namespace, uid, body, **kwargs): # noqa: E501
"""resume_workspace # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.resume_workspace(namespace, uid, async_req=True)
>>> thread = api.resume_workspace(namespace, uid, body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str namespace: (required)
:param str uid: (required)
:param UpdateWorkspaceBody body: (required)
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
Expand All @@ -1052,19 +1053,20 @@ def resume_workspace(self, namespace, uid, **kwargs): # noqa: E501
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
return self.resume_workspace_with_http_info(namespace, uid, **kwargs) # noqa: E501
return self.resume_workspace_with_http_info(namespace, uid, body, **kwargs) # noqa: E501

def resume_workspace_with_http_info(self, namespace, uid, **kwargs): # noqa: E501
def resume_workspace_with_http_info(self, namespace, uid, body, **kwargs): # noqa: E501
"""resume_workspace # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.resume_workspace_with_http_info(namespace, uid, async_req=True)
>>> thread = api.resume_workspace_with_http_info(namespace, uid, body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str namespace: (required)
:param str uid: (required)
:param UpdateWorkspaceBody body: (required)
:param _return_http_data_only: response data without head status code
and headers
:param _preload_content: if False, the urllib3.HTTPResponse object will
Expand All @@ -1083,7 +1085,8 @@ def resume_workspace_with_http_info(self, namespace, uid, **kwargs): # noqa: E5

all_params = [
'namespace',
'uid'
'uid',
'body'
]
all_params.extend(
[
Expand All @@ -1110,6 +1113,10 @@ def resume_workspace_with_http_info(self, namespace, uid, **kwargs): # noqa: E5
if self.api_client.client_side_validation and ('uid' not in local_var_params or # noqa: E501
local_var_params['uid'] is None): # noqa: E501
raise ApiValueError("Missing the required parameter `uid` when calling `resume_workspace`") # noqa: E501
# verify the required parameter 'body' is set
if self.api_client.client_side_validation and ('body' not in local_var_params or # noqa: E501
local_var_params['body'] is None): # noqa: E501
raise ApiValueError("Missing the required parameter `body` when calling `resume_workspace`") # noqa: E501

collection_formats = {}

Expand All @@ -1127,10 +1134,16 @@ def resume_workspace_with_http_info(self, namespace, uid, **kwargs): # noqa: E5
local_var_files = {}

body_params = None
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/octet-stream']) # 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 = ['Bearer'] # noqa: E501

Expand Down
6 changes: 3 additions & 3 deletions onepanel/nbextensions/magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class IPythonMagics(Magics):

@line_magic
def nni_ui(self, line):
domain = os.getenv('ONEPANEL_DOMAIN', 'localhost')
domain = os.getenv('ONEPANEL_DOMAIN', '127.0.0.1')

if domain == 'localhost':
src = '//{domain}:8080'.format(domain=domain, port=port)
if domain == '127.0.0.1':
src = '//{domain}:8080'.format(domain=domain)
else:
src = '//{uid}--{namespace}.{domain}/nni'.format(
uid=os.getenv('ONEPANEL_RESOURCE_UID'),
Expand Down

0 comments on commit 64a2acb

Please sign in to comment.