TLS sdc-be-init: truststore & keystore handling
[sdc.git] / catalog-be / src / main / resources / scripts / sdcBePy / tosca / imports / runNormativeElement.py
1 #!/usr/bin/env python3
2
3 import sys
4
5 from sdcBePy.common.normative.toscaElements import process_and_create_normative_element
6 from sdcBePy.tosca.main import get_args, usage
7 from sdcBePy.tosca.models.normativeElementsList import get_capability, get_data, get_relationship, \
8     get_interface_lifecycle, get_categories, get_group, get_policy, get_annotation
9
10
11 def run(candidate):
12     scheme, be_host, be_port, header, admin_user, _, debug, tls_cert, tls_key, tls_key_pw, ca_cert = get_args()
13     try:
14         process_and_create_normative_element(candidate,
15                                              scheme, be_host, be_port, header, admin_user, tls_cert, tls_key, tls_key_pw, ca_cert,
16                                              debug=debug,
17                                              exit_on_success=True)
18     except AttributeError:
19         usage()
20         sys.exit(3)
21
22
23 def run_import_data():
24     data_candidate = get_data()
25     run(data_candidate)
26
27
28 def run_import_capabilities():
29     capability_candidate = get_capability()
30     run(capability_candidate)
31
32
33 def run_import_relationship():
34     relationship_candidate = get_relationship()
35     run(relationship_candidate)
36
37
38 def run_import_interface_lifecycle():
39     interface_lifecycle_candidate = get_interface_lifecycle()
40     run(interface_lifecycle_candidate)
41
42
43 def run_import_categories():
44     categories_candidate = get_categories()
45     run(categories_candidate)
46
47
48 def run_import_group():
49     group_candidate = get_group()
50     run(group_candidate)
51
52
53 def run_import_policy():
54     policy_candidate = get_policy()
55     run(policy_candidate)
56
57
58 def run_import_annotation():
59     annotation_candidate = get_annotation()
60     run(annotation_candidate)
61
62
63 if __name__ == '__main__':
64     run_import_data()
65     # run_import_capabilities()
66     # run_import_relationship()
67     # run_import_interface_lifecycle()
68     # run_import_categories()
69     # run_import_group()
70     # run_import_policy()
71     # run_import_annotation()