Skip to content

Commit 2ab6c9c

Browse files
committed
Updated Delphixclient.py
1 parent 401b3f3 commit 2ab6c9c

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

src/main/resources/delphix/DelphixClient.py

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#
2-
#
32
# Copyright 2018 XEBIALABS
43
#
54
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -161,6 +160,47 @@ def _snapshot(self, vdb):
161160
else:
162161
raise self._response_error(r)
163162

163+
def _stop(self, vdb):
164+
parameters = self._get_params(vdb=vdb)
165+
print("- stop ")
166+
headers = {'Content-type': 'application/json'}
167+
# data = {
168+
# "type": "OracleSyncParameters"
169+
# }
170+
171+
r = requests.post(
172+
'{0}/resources/json/delphix/database/{1}/stop'.format(self.server['url'], parameters['ref']),
173+
headers=headers,
174+
cookies=self.cookies,
175+
# data=json.dumps(data))
176+
177+
if self._response_ok(r):
178+
print("- Job {0}".format(r.json()['job']))
179+
print("- Action {0}".format(r.json()['action']))
180+
return {'job': r.json()['job'], 'action': r.json()['action']}
181+
else:
182+
raise self._response_error(r)
183+
184+
def _start(self, vdb):
185+
parameters = self._get_params(vdb=vdb)
186+
print("- snapshot ")
187+
headers = {'Content-type': 'application/json'}
188+
# data = {
189+
# "type": "OracleSyncParameters"
190+
# }
191+
192+
r = requests.post(
193+
'{0}/resources/json/delphix/database/{1}/start'.format(self.server['url'], parameters['ref']),
194+
headers=headers,
195+
cookies=self.cookies)
196+
# data=json.dumps(data))
197+
198+
if self._response_ok(r):
199+
print("- Job {0}".format(r.json()['job']))
200+
print("- Action {0}".format(r.json()['action']))
201+
return {'job': r.json()['job'], 'action': r.json()['action']}
202+
else:
203+
raise self._response_error(r)
164204
def _response_ok(self, r):
165205
return r.status_code == 200 and r.json()['type'] == 'OKResult'
166206

@@ -187,3 +227,17 @@ def rewind(self, vdb):
187227
result = self._rewind(vdb)
188228
self._logout()
189229
return result
230+
231+
def stop(self, vdb):
232+
self._login()
233+
print("- Stop {0} with Delphix".format(vdb))
234+
result = self._stop(vdb)
235+
self._logout()
236+
return result
237+
238+
def start(self, vdb):
239+
self._login()
240+
print("- start {0} with Delphix".format(vdb))
241+
result = self._start(vdb)
242+
self._logout()
243+
return result

0 commit comments

Comments
 (0)