Refactoring the sdc-BE-init python scripts
[sdc.git] / catalog-be / src / main / resources / scripts / sdcBePy / tosca / models / normativeElementsList.py
1 from sdcBePy.tosca.models.normativeElementCandidate import NormativeElementCandidate
2
3
4 def get_normative_element_candidate_list(base_file_location):
5     return [
6         get_data(base_file_location),
7         get_capability(base_file_location),
8         get_relationship(base_file_location),
9         get_interface_lifecycle(base_file_location),
10         get_categories(base_file_location)
11     ]
12
13
14 def get_normative_element_with_metadata_list(base_file_location):
15     return [
16         get_group(base_file_location),
17         get_policy(base_file_location)
18     ]
19
20
21 def get_data(base_file_location="/"):
22     return NormativeElementCandidate(base_file_location + "data-types/",
23                                      "/sdc2/rest/v1/catalog/uploadType/datatypes",
24                                      "dataTypes",
25                                      "dataTypesZip")
26
27
28 def get_capability(base_file_location="/"):
29     return NormativeElementCandidate(base_file_location + "capability-types/",
30                                      "/sdc2/rest/v1/catalog/uploadType/capability",
31                                      "capabilityTypes",
32                                      "capabilityTypeZip")
33
34
35 def get_relationship(base_file_location="/"):
36     return NormativeElementCandidate(base_file_location + "relationship-types/",
37                                      "/sdc2/rest/v1/catalog/uploadType/relationship",
38                                      "relationshipTypes",
39                                      "relationshipTypeZip")
40
41
42 def get_interface_lifecycle(base_file_location="../../../import/tosca/"):
43     return NormativeElementCandidate(base_file_location + "interface-lifecycle-types/",
44                                      "/sdc2/rest/v1/catalog/uploadType/interfaceLifecycle",
45                                      "interfaceLifecycleTypes",
46                                      "interfaceLifecycleTypeZip")
47
48
49 def get_categories(base_file_location="/"):
50     return NormativeElementCandidate(base_file_location + "categories/",
51                                      "/sdc2/rest/v1/catalog/uploadType/categories",
52                                      "categoryTypes",
53                                      "categoriesZip")
54
55
56 def get_group(base_file_location="/"):
57     return NormativeElementCandidate(base_file_location + "group-types/",
58                                      "/sdc2/rest/v1/catalog/uploadType/grouptypes",
59                                      "groupTypes",
60                                      "groupTypesZip",
61                                      with_metadata=True)
62
63
64 def get_policy(base_file_location="/"):
65     return NormativeElementCandidate(base_file_location + "policy-types/",
66                                      "/sdc2/rest/v1/catalog/uploadType/policytypes",
67                                      "policyTypes",
68                                      "policyTypesZip",
69                                      with_metadata=True)
70
71
72 def get_annotation(base_file_location="/"):
73     return NormativeElementCandidate(base_file_location + "annotation-types",
74                                      "/sdc2/rest/v1/catalog/uploadType/annotationtypes",
75                                      "annotationTypesZip",
76                                      "annotationTypes")