aepp 0.5.1__py3-none-any.whl → 0.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aepp/__init__.py +24 -24
- aepp/__version__.py +1 -1
- aepp/classmanager.py +59 -29
- aepp/cli/__main__.py +106 -103
- aepp/datatypemanager.py +60 -27
- aepp/deletion.py +22 -22
- aepp/fieldgroupmanager.py +100 -65
- aepp/schemamanager.py +140 -78
- aepp/synchronizer.py +79 -59
- {aepp-0.5.1.dist-info → aepp-0.5.2.dist-info}/METADATA +2 -1
- {aepp-0.5.1.dist-info → aepp-0.5.2.dist-info}/RECORD +15 -15
- {aepp-0.5.1.dist-info → aepp-0.5.2.dist-info}/WHEEL +0 -0
- {aepp-0.5.1.dist-info → aepp-0.5.2.dist-info}/entry_points.txt +0 -0
- {aepp-0.5.1.dist-info → aepp-0.5.2.dist-info}/licenses/LICENSE +0 -0
- {aepp-0.5.1.dist-info → aepp-0.5.2.dist-info}/top_level.txt +0 -0
aepp/cli/__main__.py
CHANGED
|
@@ -13,12 +13,16 @@ from io import FileIO
|
|
|
13
13
|
import pandas as pd
|
|
14
14
|
from datetime import datetime
|
|
15
15
|
import urllib.parse
|
|
16
|
+
from typing import Any, Concatenate, ParamSpec, ParamSpecKwargs
|
|
17
|
+
from collections.abc import Callable
|
|
18
|
+
|
|
19
|
+
P = ParamSpec("P")
|
|
16
20
|
|
|
17
21
|
# --- 1. The Decorator (The Gatekeeper) ---
|
|
18
|
-
def login_required(f):
|
|
22
|
+
def login_required(f:Callable[Concatenate["ServiceShell", P], None]) -> Callable[Concatenate["ServiceShell", P], None]:
|
|
19
23
|
"""Decorator to block commands if not logged in."""
|
|
20
24
|
@wraps(f)
|
|
21
|
-
def wrapper(self, *args, **kwargs):
|
|
25
|
+
def wrapper(self:"ServiceShell", *args:P.args, **kwargs:P.kwargs) -> None:
|
|
22
26
|
if not hasattr(self, 'config') or self.config is None:
|
|
23
27
|
print("(!) Access Denied: You must setup config first.")
|
|
24
28
|
return
|
|
@@ -29,41 +33,44 @@ console = Console()
|
|
|
29
33
|
|
|
30
34
|
# --- 2. The Interactive Shell ---
|
|
31
35
|
class ServiceShell(cmd.Cmd):
|
|
32
|
-
def __init__(self, **kwargs):
|
|
36
|
+
def __init__(self, **kwargs:ParamSpecKwargs) -> None:
|
|
33
37
|
super().__init__()
|
|
34
38
|
self.config = None
|
|
35
39
|
self.connectInstance = True
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
if kwargs.get("config_file") is not None:
|
|
41
|
+
config_path = Path(kwargs.get("config_file"))
|
|
42
|
+
if not config_path.is_absolute():
|
|
43
|
+
config_path = Path.cwd() / config_path
|
|
44
|
+
if kwargs.get("config_file") is not None:
|
|
40
45
|
dict_config = json.load(FileIO(config_path))
|
|
41
|
-
|
|
46
|
+
if kwargs.get("sandbox") is None:
|
|
47
|
+
self.sandbox = str(dict_config.get("sandbox-name","prod"))
|
|
48
|
+
else:
|
|
49
|
+
self.sandbox = str(kwargs.get("sandbox","prod"))
|
|
42
50
|
self.secret = dict_config.get("secret",kwargs.get("secret"))
|
|
43
51
|
self.org_id = dict_config.get("org_id",kwargs.get("org_id"))
|
|
44
52
|
self.client_id = dict_config.get("client_id",kwargs.get("client_id"))
|
|
45
53
|
self.scopes = dict_config.get("scopes",kwargs.get("scopes"))
|
|
46
54
|
else:
|
|
47
|
-
self.sandbox = kwargs.get("sandbox","prod")
|
|
48
|
-
self.secret = kwargs.get("secret")
|
|
49
|
-
self.org_id = kwargs.get("org_id")
|
|
50
|
-
self.client_id = kwargs.get("client_id")
|
|
51
|
-
self.scopes = kwargs.get("scopes")
|
|
52
|
-
self.connectInstance = True
|
|
55
|
+
self.sandbox:str|None = kwargs.get("sandbox","prod")
|
|
56
|
+
self.secret:str|None = kwargs.get("secret")
|
|
57
|
+
self.org_id:str|None = kwargs.get("org_id")
|
|
58
|
+
self.client_id:str|None = kwargs.get("client_id")
|
|
59
|
+
self.scopes:str|None = kwargs.get("scopes")
|
|
53
60
|
if self.sandbox is not None and self.secret is not None and self.org_id is not None and self.client_id is not None and self.scopes is not None:
|
|
54
61
|
print("Configuring connection...")
|
|
55
62
|
self.config = aepp.configure(
|
|
56
|
-
connectInstance=self.connectInstance,
|
|
57
63
|
sandbox=self.sandbox,
|
|
58
64
|
secret=self.secret,
|
|
59
65
|
org_id=self.org_id,
|
|
60
66
|
client_id=self.client_id,
|
|
61
|
-
scopes=self.scopes
|
|
67
|
+
scopes=self.scopes,
|
|
68
|
+
connectInstance=self.connectInstance
|
|
62
69
|
)
|
|
63
70
|
self.prompt = f"{self.config.sandbox}> "
|
|
64
71
|
console.print(Panel(f"Connected to [bold green]{self.sandbox}[/bold green]", style="blue"))
|
|
65
72
|
|
|
66
|
-
def do_createConfigFile(self, arg):
|
|
73
|
+
def do_createConfigFile(self, arg:Any) -> None:
|
|
67
74
|
"""Create a configuration file for future use"""
|
|
68
75
|
parser = argparse.ArgumentParser(prog='createConfigFile', add_help=True)
|
|
69
76
|
parser.add_argument("-f", "--file_name", help="file name for your config file", default="aepp_config.json")
|
|
@@ -74,9 +81,8 @@ class ServiceShell(cmd.Cmd):
|
|
|
74
81
|
console.print(f"Configuration file created at {Path.cwd() / Path(filename_json)}", style="green")
|
|
75
82
|
return
|
|
76
83
|
|
|
77
|
-
|
|
78
84
|
# # --- Commands ---
|
|
79
|
-
def do_config(self, arg):
|
|
85
|
+
def do_config(self, arg:Any) -> None:
|
|
80
86
|
"""connect to an AEP instance"""
|
|
81
87
|
parser = argparse.ArgumentParser(prog='config', add_help=True)
|
|
82
88
|
parser.add_argument("-sx", "--sandbox", help="Auto-login sandbox")
|
|
@@ -86,21 +92,21 @@ class ServiceShell(cmd.Cmd):
|
|
|
86
92
|
parser.add_argument("-cid", "--client_id", help="Auto-login client ID")
|
|
87
93
|
parser.add_argument("-cf", "--config_file", help="Path to config file", default=None)
|
|
88
94
|
args = parser.parse_args(shlex.split(arg))
|
|
89
|
-
if args.config_file:
|
|
95
|
+
if args.config_file is not None:
|
|
90
96
|
mypath = Path.cwd()
|
|
91
97
|
dict_config = json.load(FileIO(mypath / Path(args.config_file)))
|
|
92
|
-
self.sandbox = args.sandbox if args.sandbox else dict_config.get("sandbox-name",args.sandbox)
|
|
93
|
-
self.secret = dict_config.get("secret",args.secret)
|
|
94
|
-
self.org_id = dict_config.get("org_id",args.org_id)
|
|
95
|
-
self.client_id = dict_config.get("client_id",args.client_id)
|
|
96
|
-
self.scopes = dict_config.get("scopes",args.scopes)
|
|
98
|
+
self.sandbox:str|None = args.sandbox if args.sandbox else dict_config.get("sandbox-name",args.sandbox)
|
|
99
|
+
self.secret:str|None = dict_config.get("secret",args.secret)
|
|
100
|
+
self.org_id:str|None = dict_config.get("org_id",args.org_id)
|
|
101
|
+
self.client_id:str|None = dict_config.get("client_id",args.client_id)
|
|
102
|
+
self.scopes:str|None = dict_config.get("scopes",args.scopes)
|
|
97
103
|
self.connectInstance = True
|
|
98
104
|
else:
|
|
99
|
-
if args.sandbox: self.sandbox = args.sandbox
|
|
100
|
-
if args.secret: self.secret = args.secret
|
|
101
|
-
if args.org_id: self.org_id = args.org_id
|
|
102
|
-
if args.scopes: self.scopes = args.scopes
|
|
103
|
-
if args.client_id: self.client_id = args.client_id
|
|
105
|
+
if args.sandbox: self.sandbox = str(args.sandbox)
|
|
106
|
+
if args.secret: self.secret = str(args.secret)
|
|
107
|
+
if args.org_id: self.org_id = str(args.org_id)
|
|
108
|
+
if args.scopes: self.scopes = str(args.scopes)
|
|
109
|
+
if args.client_id: self.client_id = str(args.client_id)
|
|
104
110
|
console.print("Configuring connection...", style="blue")
|
|
105
111
|
self.config = aepp.configure(
|
|
106
112
|
connectInstance=self.connectInstance,
|
|
@@ -114,15 +120,15 @@ class ServiceShell(cmd.Cmd):
|
|
|
114
120
|
self.prompt = f"{self.config.sandbox}> "
|
|
115
121
|
return
|
|
116
122
|
|
|
117
|
-
def do_change_sandbox(self, args):
|
|
123
|
+
def do_change_sandbox(self, args:Any) -> None:
|
|
118
124
|
"""Change the current sandbox after configuration"""
|
|
119
125
|
parser = argparse.ArgumentParser(prog='change sandbox', add_help=True)
|
|
120
126
|
parser.add_argument("sandbox", help="sandbox name to switch to")
|
|
121
127
|
args = parser.parse_args(shlex.split(args))
|
|
122
|
-
self.sandbox = args.sandbox if args.sandbox else console.print(Panel("(!) Please provide a sandbox name using -sx or --sandbox", style="red"))
|
|
128
|
+
self.sandbox = str(args.sandbox) if args.sandbox else console.print(Panel("(!) Please provide a sandbox name using -sx or --sandbox", style="red"))
|
|
123
129
|
if self.config is not None:
|
|
124
130
|
if args.sandbox:
|
|
125
|
-
self.config.setSandbox(args.sandbox)
|
|
131
|
+
self.config.setSandbox(str(args.sandbox))
|
|
126
132
|
self.prompt = f"{self.config.sandbox}> "
|
|
127
133
|
console.print(Panel(f"Sandbox changed to: [bold green]{self.config.sandbox}[/bold green]", style="blue"))
|
|
128
134
|
else:
|
|
@@ -130,7 +136,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
130
136
|
|
|
131
137
|
|
|
132
138
|
@login_required
|
|
133
|
-
def do_get_schemas(self, args):
|
|
139
|
+
def do_get_schemas(self, args:Any) -> None:
|
|
134
140
|
"""List all schemas in the current sandbox"""
|
|
135
141
|
parser = argparse.ArgumentParser(prog='get_schemas', add_help=True)
|
|
136
142
|
parser.add_argument("-sv", "--save",help="Save schemas to CSV file")
|
|
@@ -162,7 +168,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
162
168
|
return
|
|
163
169
|
|
|
164
170
|
@login_required
|
|
165
|
-
def do_get_ups_schemas(self, args):
|
|
171
|
+
def do_get_ups_schemas(self, args) -> None:
|
|
166
172
|
"""List all schemas enabled for Profile in the current sandbox"""
|
|
167
173
|
parser = argparse.ArgumentParser(prog='get_schemas_enabled', add_help=True)
|
|
168
174
|
parser.add_argument("-sv", "--save",help="Save enabled schemas to CSV file")
|
|
@@ -200,8 +206,9 @@ class ServiceShell(cmd.Cmd):
|
|
|
200
206
|
console.print(f"(!) Error: {str(e)}", style="red")
|
|
201
207
|
except SystemExit:
|
|
202
208
|
return
|
|
209
|
+
|
|
203
210
|
@login_required
|
|
204
|
-
def do_get_ups_fieldgroups(self, args):
|
|
211
|
+
def do_get_ups_fieldgroups(self, args:Any) -> None:
|
|
205
212
|
"""List all field groups enabled for Profile in the current sandbox"""
|
|
206
213
|
parser = argparse.ArgumentParser(prog='get_fieldgroups_enabled', add_help=True)
|
|
207
214
|
parser.add_argument("-sv", "--save",help="Save enabled field groups to CSV file")
|
|
@@ -241,7 +248,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
241
248
|
return
|
|
242
249
|
|
|
243
250
|
@login_required
|
|
244
|
-
def do_get_profile_schemas(self,args):
|
|
251
|
+
def do_get_profile_schemas(self,args:Any) -> None:
|
|
245
252
|
"""Get the current profile schema"""
|
|
246
253
|
parser = argparse.ArgumentParser(prog='get_schemas_enabled', add_help=True)
|
|
247
254
|
try:
|
|
@@ -268,7 +275,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
268
275
|
return
|
|
269
276
|
|
|
270
277
|
@login_required
|
|
271
|
-
def do_get_union_profile_json(self,args):
|
|
278
|
+
def do_get_union_profile_json(self,args:Any) -> None:
|
|
272
279
|
"""Get the current Profile union schema"""
|
|
273
280
|
parser = argparse.ArgumentParser(prog='get_union_profile', add_help=True)
|
|
274
281
|
try:
|
|
@@ -284,7 +291,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
284
291
|
return
|
|
285
292
|
|
|
286
293
|
@login_required
|
|
287
|
-
def do_get_union_profile_csv(self,args):
|
|
294
|
+
def do_get_union_profile_csv(self,args:Any) -> None:
|
|
288
295
|
"""Get the current Profile union schema"""
|
|
289
296
|
parser = argparse.ArgumentParser(prog='get_union_profile', add_help=True)
|
|
290
297
|
parser.add_argument("-f","--full",default=False,help="Get full schema information with all details",type=bool)
|
|
@@ -300,7 +307,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
300
307
|
return
|
|
301
308
|
|
|
302
309
|
@login_required
|
|
303
|
-
def do_get_union_event_json(self,args):
|
|
310
|
+
def do_get_union_event_json(self,args:Any) -> None:
|
|
304
311
|
"""Get the current Experience Event union schema"""
|
|
305
312
|
parser = argparse.ArgumentParser(prog='get_union_event', add_help=True)
|
|
306
313
|
try:
|
|
@@ -316,7 +323,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
316
323
|
return
|
|
317
324
|
|
|
318
325
|
@login_required
|
|
319
|
-
def do_get_union_event_csv(self,args):
|
|
326
|
+
def do_get_union_event_csv(self,args:Any) -> None:
|
|
320
327
|
"""Get the current Experience Event union schema"""
|
|
321
328
|
parser = argparse.ArgumentParser(prog='get_union_event', add_help=True)
|
|
322
329
|
parser.add_argument("-f","--full",default=False,help="Get full schema information with all details",type=bool)
|
|
@@ -332,7 +339,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
332
339
|
return
|
|
333
340
|
|
|
334
341
|
@login_required
|
|
335
|
-
def do_get_event_schemas(self,args):
|
|
342
|
+
def do_get_event_schemas(self,args:Any) -> None:
|
|
336
343
|
"""Get the current Experience Event schemas"""
|
|
337
344
|
parser = argparse.ArgumentParser(prog='get_event_schemas', add_help=True)
|
|
338
345
|
parser.add_argument("-sv", "--save",help="Save event schemas to CSV file")
|
|
@@ -364,7 +371,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
364
371
|
return
|
|
365
372
|
|
|
366
373
|
@login_required
|
|
367
|
-
def do_get_union_event_json(self,args):
|
|
374
|
+
def do_get_union_event_json(self,args:Any) -> None:
|
|
368
375
|
"""Get the current Experience Event union schema"""
|
|
369
376
|
parser = argparse.ArgumentParser(prog='get_union_event', add_help=True)
|
|
370
377
|
try:
|
|
@@ -381,7 +388,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
381
388
|
|
|
382
389
|
|
|
383
390
|
@login_required
|
|
384
|
-
def do_get_schema_xdm(self, arg):
|
|
391
|
+
def do_get_schema_xdm(self, arg:Any) -> None:
|
|
385
392
|
"""Get schema JSON by name or ID"""
|
|
386
393
|
parser = argparse.ArgumentParser(prog='get_schema_xdm', add_help=True)
|
|
387
394
|
parser.add_argument("schema", help="Schema title, $id or alt:Id to retrieve")
|
|
@@ -414,7 +421,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
414
421
|
return
|
|
415
422
|
|
|
416
423
|
@login_required
|
|
417
|
-
def do_get_schema_csv(self, arg):
|
|
424
|
+
def do_get_schema_csv(self, arg:Any) -> None:
|
|
418
425
|
"""Get schema CSV by name or ID"""
|
|
419
426
|
parser = argparse.ArgumentParser(prog='get_schema_csv', add_help=True)
|
|
420
427
|
parser.add_argument("schema", help="Schema $id or alt:Id to retrieve")
|
|
@@ -444,7 +451,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
444
451
|
return
|
|
445
452
|
|
|
446
453
|
@login_required
|
|
447
|
-
def do_get_schema_json(self, args):
|
|
454
|
+
def do_get_schema_json(self, args:Any) -> None:
|
|
448
455
|
"""Get schema JSON by name or ID"""
|
|
449
456
|
parser = argparse.ArgumentParser(prog='get_schema_json', add_help=True)
|
|
450
457
|
parser.add_argument("schema", help="Schema $id or alt:Id to retrieve")
|
|
@@ -473,7 +480,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
473
480
|
return
|
|
474
481
|
|
|
475
482
|
@login_required
|
|
476
|
-
def do_get_fieldgroups(self, args):
|
|
483
|
+
def do_get_fieldgroups(self, args:Any) -> None:
|
|
477
484
|
"""List all field groups in the current sandbox"""
|
|
478
485
|
parser = argparse.ArgumentParser(prog='get_fieldgroups', add_help=True)
|
|
479
486
|
parser.add_argument("-sv", "--save",help="Save field groups to CSV file")
|
|
@@ -503,7 +510,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
503
510
|
return
|
|
504
511
|
|
|
505
512
|
@login_required
|
|
506
|
-
def do_get_fieldgroup_json(self, args):
|
|
513
|
+
def do_get_fieldgroup_json(self, args:Any) -> None:
|
|
507
514
|
"""Get field group JSON by name or ID"""
|
|
508
515
|
parser = argparse.ArgumentParser(prog='get_fieldgroup_json', add_help=True)
|
|
509
516
|
parser.add_argument("fieldgroup", help="Field Group name, $id or alt:Id to retrieve")
|
|
@@ -532,7 +539,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
532
539
|
return
|
|
533
540
|
|
|
534
541
|
@login_required
|
|
535
|
-
def do_get_fieldgroup_csv(self, args):
|
|
542
|
+
def do_get_fieldgroup_csv(self, args:Any) -> None:
|
|
536
543
|
"""Get field group CSV by name or ID"""
|
|
537
544
|
parser = argparse.ArgumentParser(prog='get_fieldgroup_csv', add_help=True)
|
|
538
545
|
parser.add_argument("fieldgroup", help="Field Group name, $id or alt:Id to retrieve")
|
|
@@ -560,7 +567,8 @@ class ServiceShell(cmd.Cmd):
|
|
|
560
567
|
except SystemExit:
|
|
561
568
|
return
|
|
562
569
|
|
|
563
|
-
|
|
570
|
+
@login_required
|
|
571
|
+
def do_get_datatypes(self, args:Any) -> None:
|
|
564
572
|
"""List all data types in the current sandbox"""
|
|
565
573
|
parser = argparse.ArgumentParser(prog='get_datatypes', add_help=True)
|
|
566
574
|
try:
|
|
@@ -585,7 +593,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
585
593
|
return
|
|
586
594
|
|
|
587
595
|
@login_required
|
|
588
|
-
def do_get_datatype_csv(self, args):
|
|
596
|
+
def do_get_datatype_csv(self, args:Any) -> None:
|
|
589
597
|
"""Get data type CSV by name or ID"""
|
|
590
598
|
parser = argparse.ArgumentParser(prog='get_datatype_csv', add_help=True)
|
|
591
599
|
parser.add_argument("datatype", help="Data Type name, $id or alt:Id to retrieve")
|
|
@@ -614,7 +622,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
614
622
|
return
|
|
615
623
|
|
|
616
624
|
@login_required
|
|
617
|
-
def do_get_datatype_json(self, args):
|
|
625
|
+
def do_get_datatype_json(self, args:Any) -> None:
|
|
618
626
|
"""Get data type JSON by name or ID"""
|
|
619
627
|
parser = argparse.ArgumentParser(prog='get_datatype_json', add_help=True)
|
|
620
628
|
parser.add_argument("datatype", help="Data Type name, $id or alt:Id to retrieve")
|
|
@@ -644,7 +652,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
644
652
|
return
|
|
645
653
|
|
|
646
654
|
@login_required
|
|
647
|
-
def do_enable_schema_for_ups(self, args):
|
|
655
|
+
def do_enable_schema_for_ups(self, args:Any) -> None:
|
|
648
656
|
"""Enable a schema for Profile"""
|
|
649
657
|
parser = argparse.ArgumentParser(prog='enable_schema_for_ups', add_help=True)
|
|
650
658
|
parser.add_argument("schema_id", help="Schema ID to enable for Profile")
|
|
@@ -659,7 +667,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
659
667
|
return
|
|
660
668
|
|
|
661
669
|
@login_required
|
|
662
|
-
def do_upload_fieldgroup_definition_csv(self,args):
|
|
670
|
+
def do_upload_fieldgroup_definition_csv(self,args:Any) -> None:
|
|
663
671
|
"""Upload a field group definition from a CSV file"""
|
|
664
672
|
parser = argparse.ArgumentParser(prog='upload_fieldgroup_definition_csv', add_help=True)
|
|
665
673
|
parser.add_argument("csv_path", help="Path to the field group CSV file")
|
|
@@ -683,7 +691,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
683
691
|
return
|
|
684
692
|
|
|
685
693
|
@login_required
|
|
686
|
-
def do_upload_fieldgroup_definition_xdm(self,args):
|
|
694
|
+
def do_upload_fieldgroup_definition_xdm(self,args:Any) -> None:
|
|
687
695
|
"""Upload a field group definition from a JSON XDM file"""
|
|
688
696
|
parser = argparse.ArgumentParser(prog='upload_fieldgroup_definition_xdm', add_help=True)
|
|
689
697
|
parser.add_argument("xdm_path", help="Path to the field group JSON XDM file")
|
|
@@ -708,7 +716,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
708
716
|
return
|
|
709
717
|
|
|
710
718
|
@login_required
|
|
711
|
-
def do_get_datasets(self, args):
|
|
719
|
+
def do_get_datasets(self, args:Any) -> None:
|
|
712
720
|
"""List all datasets in the current sandbox"""
|
|
713
721
|
parser = argparse.ArgumentParser(prog='get_datasets', add_help=True)
|
|
714
722
|
try:
|
|
@@ -739,7 +747,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
739
747
|
return
|
|
740
748
|
|
|
741
749
|
@login_required
|
|
742
|
-
def do_get_datasets_infos(self, args):
|
|
750
|
+
def do_get_datasets_infos(self, args:Any) -> None:
|
|
743
751
|
"""List all datasets in the current sandbox"""
|
|
744
752
|
parser = argparse.ArgumentParser(prog='get_datasets_infos', add_help=True)
|
|
745
753
|
try:
|
|
@@ -771,7 +779,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
771
779
|
return
|
|
772
780
|
|
|
773
781
|
@login_required
|
|
774
|
-
def do_createDataset(self, args):
|
|
782
|
+
def do_createDataset(self, args:Any) -> None:
|
|
775
783
|
"""Create a new dataset in the current sandbox"""
|
|
776
784
|
parser = argparse.ArgumentParser(prog='createDataset', add_help=True)
|
|
777
785
|
parser.add_argument("dataset_name", help="Name of the dataset to create")
|
|
@@ -787,7 +795,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
787
795
|
return
|
|
788
796
|
|
|
789
797
|
@login_required
|
|
790
|
-
def do_enable_dataset_for_ups(self, args):
|
|
798
|
+
def do_enable_dataset_for_ups(self, args:Any) -> None:
|
|
791
799
|
"""Enable a dataset for Profile"""
|
|
792
800
|
parser = argparse.ArgumentParser(prog='enable_dataset_for_ups', add_help=True)
|
|
793
801
|
parser.add_argument("dataset", help="Dataset ID or Dataset Name to enable for Profile")
|
|
@@ -805,8 +813,8 @@ class ServiceShell(cmd.Cmd):
|
|
|
805
813
|
except SystemExit:
|
|
806
814
|
return
|
|
807
815
|
|
|
808
|
-
@login_required
|
|
809
|
-
def do_get_identities(self, args):
|
|
816
|
+
@login_required
|
|
817
|
+
def do_get_identities(self, args:Any) -> None:
|
|
810
818
|
"""List all identities in the current sandbox"""
|
|
811
819
|
parser = argparse.ArgumentParser(prog='get_identities', add_help=True)
|
|
812
820
|
parser.add_argument("-r","--region", help="Region to get identities from: 'ndl2' (default), 'va7', 'aus5', 'can2', 'ind2'", default='ndl2')
|
|
@@ -837,7 +845,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
837
845
|
return
|
|
838
846
|
|
|
839
847
|
@login_required
|
|
840
|
-
def do_get_flows(self, args):
|
|
848
|
+
def do_get_flows(self, args:Any) -> None:
|
|
841
849
|
"""List flows in the current sandbox based on parameters provided. By default, list all sources and destinations."""
|
|
842
850
|
parser = argparse.ArgumentParser(prog='get_flows', add_help=True)
|
|
843
851
|
parser.add_argument("-i","--internal_flows",help="Get internal flows", default=False,type=bool)
|
|
@@ -1000,7 +1008,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
1000
1008
|
return
|
|
1001
1009
|
|
|
1002
1010
|
@login_required
|
|
1003
|
-
def do_get_flow_errors(self,args):
|
|
1011
|
+
def do_get_flow_errors(self,args:Any) -> None:
|
|
1004
1012
|
"""Get errors for a specific flow, saving it in a JSON file for specific timeframe, default last 24 hours."""
|
|
1005
1013
|
parser = argparse.ArgumentParser(prog='get_flow_errors', add_help=True)
|
|
1006
1014
|
parser.add_argument("flow_id", help="Flow ID to get errors for")
|
|
@@ -1024,7 +1032,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
1024
1032
|
return
|
|
1025
1033
|
|
|
1026
1034
|
@login_required
|
|
1027
|
-
def do_create_dataset_http_source(self,args):
|
|
1035
|
+
def do_create_dataset_http_source(self,args:Any) -> None:
|
|
1028
1036
|
"""Create an HTTP Source connection for a specific dataset, XDM compatible data only."""
|
|
1029
1037
|
parser = argparse.ArgumentParser(prog='do_create_dataset_http_source', add_help=True)
|
|
1030
1038
|
parser.add_argument("dataset", help="Name or ID of the Dataset Source connection to create")
|
|
@@ -1050,7 +1058,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
1050
1058
|
return
|
|
1051
1059
|
|
|
1052
1060
|
@login_required
|
|
1053
|
-
def do_get_DLZ_credential(self,args):
|
|
1061
|
+
def do_get_DLZ_credential(self,args:Any) -> None:
|
|
1054
1062
|
"""Get Data Lake Zone credential for the current sandbox"""
|
|
1055
1063
|
parser = argparse.ArgumentParser(prog='get_DLZ_credential', add_help=True)
|
|
1056
1064
|
parser.add_argument("type",nargs='?',help="Type of credential to retrieve: 'user_drop_zone' or 'dlz_destination'",default="user_drop_zone")
|
|
@@ -1066,7 +1074,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
1066
1074
|
return
|
|
1067
1075
|
|
|
1068
1076
|
@login_required
|
|
1069
|
-
def do_get_queries(self, args):
|
|
1077
|
+
def do_get_queries(self, args:Any)-> None:
|
|
1070
1078
|
"""List top 1000 queries in the current sandbox for the last 24 hours by default, optionally filtered by dataset ID"""
|
|
1071
1079
|
parser = argparse.ArgumentParser(prog='get_queries', add_help=True)
|
|
1072
1080
|
parser.add_argument("-ds","--dataset", help="Dataset ID to filter queries", default=None)
|
|
@@ -1128,7 +1136,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
1128
1136
|
return
|
|
1129
1137
|
|
|
1130
1138
|
@login_required
|
|
1131
|
-
def do_query(self,args):
|
|
1139
|
+
def do_query(self,args:Any) -> None:
|
|
1132
1140
|
"""Execute a SQL query against the current sandbox"""
|
|
1133
1141
|
parser = argparse.ArgumentParser(prog='query', add_help=True)
|
|
1134
1142
|
parser.add_argument("sql_query", help="SQL query to execute",type=str)
|
|
@@ -1148,15 +1156,15 @@ class ServiceShell(cmd.Cmd):
|
|
|
1148
1156
|
|
|
1149
1157
|
|
|
1150
1158
|
@login_required
|
|
1151
|
-
def
|
|
1152
|
-
"""
|
|
1153
|
-
console.print("Extracting
|
|
1154
|
-
parser = argparse.ArgumentParser(prog='
|
|
1155
|
-
parser.add_argument('-lf','--localfolder', help='Local folder to extract
|
|
1156
|
-
parser.add_argument('-rg','--region', help='Region to extract
|
|
1159
|
+
def do_extractArtifacts(self,args:Any) -> None:
|
|
1160
|
+
"""extractArtifacts localfolder"""
|
|
1161
|
+
console.print("Extracting artifacts...", style="blue")
|
|
1162
|
+
parser = argparse.ArgumentParser(prog='extractArtifacts', description='Extract artifacts from AEP')
|
|
1163
|
+
parser.add_argument('-lf','--localfolder', help='Local folder to extract artifacts to', default='./extractions')
|
|
1164
|
+
parser.add_argument('-rg','--region', help='Region to extract artifacts from: "ndl2" (default), "va7", "aus5", "can2", "ind2"',default='ndl2')
|
|
1157
1165
|
try:
|
|
1158
1166
|
args = parser.parse_args(shlex.split(args))
|
|
1159
|
-
aepp.
|
|
1167
|
+
aepp.extractSandboxArtifacts(
|
|
1160
1168
|
sandbox=self.config,
|
|
1161
1169
|
localFolder=args.localfolder,
|
|
1162
1170
|
region=args.region
|
|
@@ -1166,20 +1174,20 @@ class ServiceShell(cmd.Cmd):
|
|
|
1166
1174
|
return
|
|
1167
1175
|
|
|
1168
1176
|
@login_required
|
|
1169
|
-
def
|
|
1170
|
-
"""
|
|
1171
|
-
console.print("Extracting
|
|
1172
|
-
parser = argparse.ArgumentParser(prog='
|
|
1173
|
-
parser.add_argument('
|
|
1174
|
-
parser.add_argument('-at','--
|
|
1175
|
-
parser.add_argument('-lf','--localfolder', help='Local folder to extract
|
|
1176
|
-
parser.add_argument('-rg','--region', help='Region to extract
|
|
1177
|
+
def do_extractArtifact(self,args:Any) -> None:
|
|
1178
|
+
"""extractArtifacts localfolder"""
|
|
1179
|
+
console.print("Extracting artifact...", style="blue")
|
|
1180
|
+
parser = argparse.ArgumentParser(prog='extractArtifact', description='Extract artifacts from AEP')
|
|
1181
|
+
parser.add_argument('artifact', help='artifact to extract (name or id): "schema","fieldgroup","datatype","descriptor","dataset","identity","mergepolicy","audience"')
|
|
1182
|
+
parser.add_argument('-at','--artifactType', help='artifact type ')
|
|
1183
|
+
parser.add_argument('-lf','--localfolder', help='Local folder to extract artifacts to',default='extractions')
|
|
1184
|
+
parser.add_argument('-rg','--region', help='Region to extract artifacts from: "ndl2" (default), "va7", "aus5", "can2", "ind2"',default='ndl2')
|
|
1177
1185
|
|
|
1178
1186
|
try:
|
|
1179
1187
|
args = parser.parse_args(shlex.split(args))
|
|
1180
|
-
aepp.
|
|
1181
|
-
|
|
1182
|
-
|
|
1188
|
+
aepp.extractSandboxArtifact(
|
|
1189
|
+
artifact=args.artifact,
|
|
1190
|
+
artifactType=args.artifactType,
|
|
1183
1191
|
sandbox=self.config,
|
|
1184
1192
|
localFolder=args.localfolder
|
|
1185
1193
|
)
|
|
@@ -1188,23 +1196,19 @@ class ServiceShell(cmd.Cmd):
|
|
|
1188
1196
|
return
|
|
1189
1197
|
|
|
1190
1198
|
@login_required
|
|
1191
|
-
def do_sync(self,args):
|
|
1192
|
-
"""
|
|
1193
|
-
console.print("Syncing
|
|
1194
|
-
parser = argparse.ArgumentParser(prog='
|
|
1195
|
-
parser.add_argument('
|
|
1196
|
-
parser.add_argument('-at','--
|
|
1197
|
-
parser.add_argument('-t','--targets', help='target sandboxes')
|
|
1198
|
-
parser.add_argument('-lf','--localfolder', help='Local folder to extract
|
|
1199
|
+
def do_sync(self,args:Any) -> None:
|
|
1200
|
+
"""extractArtifacts localfolder"""
|
|
1201
|
+
console.print("Syncing artifact...", style="blue")
|
|
1202
|
+
parser = argparse.ArgumentParser(prog='extractArtifact', description='Extract artifacts from AEP')
|
|
1203
|
+
parser.add_argument('artifact', help='artifact to extract (name or id): "schema","fieldgroup","datatype","descriptor","dataset","identity","mergepolicy","audience"')
|
|
1204
|
+
parser.add_argument('-at','--artifactType', help='artifact type ',type=str)
|
|
1205
|
+
parser.add_argument('-t','--targets', help='target sandboxes',nargs='+',type=str)
|
|
1206
|
+
parser.add_argument('-lf','--localfolder', help='Local folder to extract artifacts to',default='extractions',nargs='+',type=str)
|
|
1199
1207
|
parser.add_argument('-b','--baseSandbox', help='Base sandbox for synchronization')
|
|
1200
|
-
parser.add_argument('-rg','--region', help='Region to extract
|
|
1208
|
+
parser.add_argument('-rg','--region', help='Region to extract artifacts from: "ndl2" (default), "va7", "aus5", "can2", "ind2"',default='ndl2')
|
|
1201
1209
|
parser.add_argument('-v','--verbose', help='Enable verbose output',default=True)
|
|
1202
1210
|
try:
|
|
1203
1211
|
args = parser.parse_args(shlex.split(args))
|
|
1204
|
-
if ',' in args.targets:
|
|
1205
|
-
args.targets = args.targets.split(',')
|
|
1206
|
-
else:
|
|
1207
|
-
args.targets = [args.targets]
|
|
1208
1212
|
console.print("Initializing Synchronizor...", style="blue")
|
|
1209
1213
|
if args.baseSandbox:
|
|
1210
1214
|
synchronizor = synchronizer.Synchronizer(
|
|
@@ -1222,21 +1226,20 @@ class ServiceShell(cmd.Cmd):
|
|
|
1222
1226
|
)
|
|
1223
1227
|
console.print("Starting Sync...", style="blue")
|
|
1224
1228
|
synchronizor.syncComponent(
|
|
1225
|
-
component=args.
|
|
1226
|
-
componentType=args.
|
|
1229
|
+
component=args.artifact,
|
|
1230
|
+
componentType=args.artifactType,
|
|
1227
1231
|
verbose=args.verbose
|
|
1228
1232
|
)
|
|
1229
1233
|
console.print("Sync completed!", style="green")
|
|
1230
1234
|
except SystemExit:
|
|
1231
1235
|
return
|
|
1232
1236
|
|
|
1233
|
-
|
|
1234
|
-
def do_exit(self, args):
|
|
1237
|
+
def do_exit(self, args:Any) -> None:
|
|
1235
1238
|
"""Exit the application"""
|
|
1236
1239
|
console.print(Panel("Exiting...", style="blue"))
|
|
1237
1240
|
return True # Stops the loop
|
|
1238
1241
|
|
|
1239
|
-
def do_EOF(self, args):
|
|
1242
|
+
def do_EOF(self, args:Any) -> None:
|
|
1240
1243
|
"""Handle Ctrl+D"""
|
|
1241
1244
|
console.print(Panel("Exiting...", style="blue"))
|
|
1242
1245
|
return True
|