-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathwebapp.py
More file actions
67 lines (57 loc) · 2.07 KB
/
webapp.py
File metadata and controls
67 lines (57 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import sys
if sys.version_info >= (3,0):
import urllib.parse
dku_quote_fn = urllib.parse.quote
else:
import urllib
dku_quote_fn = urllib.quote
class DSSWebApp(object):
"""
A handle to manage a webapp
"""
def __init__(self, client, project_key, webapp_id, definition):
"""Do not call directly, use :meth:`dataikuapi.dss.project.DSSProject.get_webapps`"""
self.client = client
self.project_key = project_key
self.webapp_id = webapp_id
self.definition = definition
"""
Update an existing webapp
:returns: a webapp state excerpt
:rtype: :class:`dataikuapi.dss.webapp.DSSWebAppSaveResponse`
"""
def update(self):
response = self.client._perform_json("PUT", "/projects/%s/webapps/%s" % (self.project_key, self.webapp_id), body=self.definition)
return DSSWebAppSaveResponse(self.client, self.project_key, self.webapp_id, response)
"""
Stop a webapp
"""
def stop_backend(self):
self.client._perform_empty("PUT", "/projects/%s/webapps/%s/stop-backend" % (self.project_key, self.webapp_id))
return
"""
Restart a webapp
"""
def restart_backend(self):
self.client._perform_empty("PUT", "/projects/%s/webapps/%s/restart-backend" % (self.project_key, self.webapp_id))
return
class DSSWebAppSaveResponse(object):
"""
Response for the update method on a WebApp
"""
def __init__(self, client, project_key, webapp_id, definition):
"""Do not call directly, use :meth:`dataikuapi.dss.webapp.DSSWebApp.update`"""
self.client = client
self.project_key = project_key
self.webapp_id = webapp_id
self.definition = definition
class DSSWebAppHead(object):
"""
A handle to manage a WebApp head
"""
def __init__(self, client, project_key, webapp_id, definition):
"""Do not call directly, use :meth:`dataikuapi.dss.project.DSSProject.get_webapps`"""
self.client = client
self.project_key = project_key
self.webapp_id = webapp_id
self.definition = definition