Skip to content

Commit 4a21791

Browse files
author
Benoit Moussaud
authored
Merge pull request #1 from smouhssine/smouhssine-patch-1
Smouhssine patch 1
2 parents 4fcdadb + 2ab6c9c commit 4a21791

File tree

8 files changed

+183
-0
lines changed

8 files changed

+183
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ The tasks are:
3737
* Refresh
3838
* Rewind
3939
* Snapshot
40+
* Start
41+
* Stop
42+
* Delete
43+
* Disable
44+
* Enable
4045

4146
## References
4247

@@ -46,5 +51,6 @@ The tasks are:
4651

4752
# TODO
4853
* Move to the python SDK
54+
* Add job action output on every task script
4955

5056

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2018 XEBIALABS + MSA (Mouhssine SAIDI COE DELPHIX)
3+
#
4+
# 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:
5+
#
6+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
#
8+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
#
10+
if __name__ == '__main__':
11+
import sys
12+
13+
# sys.path.append('/Users/bmoussaud/Workspace/xebialabs-community/xlr-delphix-plugin/src/main/resources')
14+
sys.path.append('/u02/app/xebialabs/xlr-delphix-plugin/src/main/resources')
15+
# server = {'url': 'http://ba5b5824.ngrok.io', 'username': 'delphix_admin', 'password': 'landshark'}
16+
server = {'url': 'http://192.168.247.132', 'username': 'delphix_admin', 'password': 'landshark'}
17+
vdb = 'tst'
18+
19+
from delphix.DelphixClient import DelphixClient
20+
21+
client = DelphixClient(server)
22+
output = client.delete(vdb)
23+
job = output['job']
24+
action = output['action']

src/main/resources/delphix/DelphixClient.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,47 @@ def _snapshot(self, vdb):
160160
else:
161161
raise self._response_error(r)
162162

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)
163204
def _response_ok(self, r):
164205
return r.status_code == 200 and r.json()['type'] == 'OKResult'
165206

@@ -186,3 +227,17 @@ def rewind(self, vdb):
186227
result = self._rewind(vdb)
187228
self._logout()
188229
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
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2018 XEBIALABS + MSA (Mouhssine SAIDI COE DELPHIX)
3+
#
4+
# 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:
5+
#
6+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
#
8+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
#
10+
if __name__ == '__main__':
11+
import sys
12+
13+
# sys.path.append('/Users/bmoussaud/Workspace/xebialabs-community/xlr-delphix-plugin/src/main/resources')
14+
sys.path.append('/u02/app/xebialabs/xlr-delphix-plugin/src/main/resources')
15+
# server = {'url': 'http://ba5b5824.ngrok.io', 'username': 'delphix_admin', 'password': 'landshark'}
16+
server = {'url': 'http://192.168.247.132', 'username': 'delphix_admin', 'password': 'landshark'}
17+
vdb = 'XEBIA'
18+
19+
from delphix.DelphixClient import DelphixClient
20+
21+
client = DelphixClient(server)
22+
output = client.disable(vdb)
23+
job = output['job']
24+
action = output['action']
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2018 XEBIALABS + MSA (Mouhssine SAIDI COE DELPHIX)
3+
#
4+
# 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:
5+
#
6+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
#
8+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
#
10+
if __name__ == '__main__':
11+
import sys
12+
13+
# sys.path.append('/Users/bmoussaud/Workspace/xebialabs-community/xlr-delphix-plugin/src/main/resources')
14+
sys.path.append('/u02/app/xebialabs/xlr-delphix-plugin/src/main/resources')
15+
# server = {'url': 'http://ba5b5824.ngrok.io', 'username': 'delphix_admin', 'password': 'landshark'}
16+
server = {'url': 'http://192.168.247.132', 'username': 'delphix_admin', 'password': 'landshark'}
17+
vdb = 'XEBIA'
18+
19+
from delphix.DelphixClient import DelphixClient
20+
21+
client = DelphixClient(server)
22+
output = client.enable(vdb)
23+
job = output['job']
24+
action = output['action']
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2018 XEBIALABS + MSA (Mouhssine SAIDI COE DELPHIX)
3+
#
4+
# 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:
5+
#
6+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
#
8+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
#
10+
if __name__ == '__main__':
11+
import sys
12+
13+
# sys.path.append('/Users/bmoussaud/Workspace/xebialabs-community/xlr-delphix-plugin/src/main/resources')
14+
sys.path.append('/u02/app/xebialabs/xlr-delphix-plugin/src/main/resources')
15+
# server = {'url': 'http://ba5b5824.ngrok.io', 'username': 'delphix_admin', 'password': 'landshark'}
16+
server = {'url': 'http://192.168.247.132', 'username': 'delphix_admin', 'password': 'landshark'}
17+
vdb = 'XEBIA'
18+
19+
from delphix.DelphixClient import DelphixClient
20+
21+
client = DelphixClient(server)
22+
output = client.start(vdb)
23+
job = output['job']
24+
action = output['action']

src/main/resources/delphix/Stop.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Copyright 2018 XEBIALABS + MSA (Mouhssine SAIDI COE DELPHIX)
3+
#
4+
# 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:
5+
#
6+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
#
8+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
#
10+
11+
if __name__ == '__main__':
12+
import sys
13+
14+
# sys.path.append('/Users/bmoussaud/Workspace/xebialabs-community/xlr-delphix-plugin/src/main/resources')
15+
sys.path.append('/u02/app/xebialabs/xlr-delphix-plugin/src/main/resources')
16+
# server = {'url': 'http://ba5b5824.ngrok.io', 'username': 'delphix_admin', 'password': 'landshark'}
17+
server = {'url': 'http://192.168.247.132', 'username': 'delphix_admin', 'password': 'landshark'}
18+
vdb = 'XEBIA'
19+
20+
from delphix.DelphixClient import DelphixClient
21+
22+
23+
client = DelphixClient(server)
24+
output = client.stop(vdb)
25+
job = output['job']
26+
action = output['action']

test

Whitespace-only changes.

0 commit comments

Comments
 (0)