-
Notifications
You must be signed in to change notification settings - Fork 1
/
migrate.py
38 lines (28 loc) · 1.14 KB
/
migrate.py
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
from etleap.api import EtleapApi, EtleapApiException
# US API credentials
us_etleap_access_key = '...'
us_etleap_secret_key = '...'
# EU API credentials
eu_etleap_access_key = '...'
eu_etleap_secret_key = '...'
# Maps a connection from the US to the EU environment
connection_map = {
'c0Bz8SOK': 'BTIfFpQw',
'JSS8ABBJ': 'rOpIIrZl'
}
# Only migrated pipelines for sources in this list
sources_to_migrate = ['c0Bz8SOK']
us_client = EtleapApi(us_etleap_access_key, us_etleap_secret_key)
pipelines = us_client.get_pipelines()
from_source = [ p for p in pipelines if p.source['connectionId'] in sources_to_migrate ]
for p in from_source:
if (p.destination['connectionId'] in connection_map.keys()):
p.destination['connectionId'] = connection_map[p.destination['connectionId']]
if (p.source['connectionId'] in connection_map.keys()):
p.source['connectionId'] = connection_map[p.source['connectionId']]
eu_client = EtleapApi(eu_etleap_access_key, eu_etleap_secret_key, "https://app.eu.etleap.com/api/v2/")
try:
for p in from_source:
eu_client.create_pipeline(p)
except EtleapApiException as e:
print(e.error_text)