mas-cli 9.5.0__py3-none-any.whl → 10.0.0__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.

Potentially problematic release.


This version of mas-cli might be problematic. Click here for more details.

Files changed (95) hide show
  1. mas/cli/__init__.py +1 -1
  2. mas/cli/cli.py +82 -65
  3. mas/cli/displayMixins.py +110 -0
  4. mas/cli/gencfg.py +65 -0
  5. mas/cli/install/__init__.py +9 -0
  6. mas/cli/install/argParser.py +792 -0
  7. mas/cli/install/settings/__init__.py +21 -0
  8. mas/cli/install/settings/additionalConfigs.py +150 -0
  9. mas/cli/install/settings/db2Settings.py +173 -0
  10. mas/cli/install/settings/kafkaSettings.py +103 -0
  11. mas/cli/install/settings/manageSettings.py +218 -0
  12. mas/cli/install/settings/turbonomicSettings.py +25 -0
  13. mas/cli/install/summarizer.py +328 -0
  14. mas/cli/templates/ibm-mas-tekton.yaml +10813 -0
  15. mas/cli/templates/jdbccfg.yml.j2 +52 -0
  16. mas/cli/templates/pod-templates/best-effort/ibm-data-dictionary-assetdatadictionary.yml +26 -0
  17. mas/cli/templates/pod-templates/best-effort/ibm-mas-bascfg.yml +56 -0
  18. mas/cli/templates/pod-templates/best-effort/ibm-mas-coreidp.yml +21 -0
  19. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-actions.yml +28 -0
  20. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-auth.yml +32 -0
  21. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-datapower.yml +12 -0
  22. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-devops.yml +14 -0
  23. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-dm.yml +22 -0
  24. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-dsc.yml +40 -0
  25. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-edgeconfig.yml +10 -0
  26. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-fpl.yml +24 -0
  27. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-guardian.yml +20 -0
  28. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-iot.yml +10 -0
  29. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-mbgx.yml +18 -0
  30. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-mfgx.yml +14 -0
  31. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-monitor.yml +18 -0
  32. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-orgmgmt.yml +48 -0
  33. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-provision.yml +28 -0
  34. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-registry.yml +26 -0
  35. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-state.yml +40 -0
  36. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-webui.yml +22 -0
  37. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-healthextaccelerator.yml +13 -0
  38. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-healthextworkspace.yml +10 -0
  39. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-imagestitching.yml +10 -0
  40. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-manageaccelerators.yml +10 -0
  41. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-manageapp.yml +46 -0
  42. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-manageworkspace.yml +48 -0
  43. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-slackproxy.yml +10 -0
  44. mas/cli/templates/pod-templates/best-effort/ibm-mas-pushnotificationcfg.yml +13 -0
  45. mas/cli/templates/pod-templates/best-effort/ibm-mas-scimcfg.yml +14 -0
  46. mas/cli/templates/pod-templates/best-effort/ibm-mas-slscfg.yml +10 -0
  47. mas/cli/templates/pod-templates/best-effort/ibm-mas-smtpcfg.yml +10 -0
  48. mas/cli/templates/pod-templates/best-effort/ibm-mas-suite.yml +136 -0
  49. mas/cli/templates/pod-templates/best-effort/ibm-mas-visualinspection.yml +34 -0
  50. mas/cli/templates/pod-templates/best-effort/ibm-sls-licenseservice.yml +10 -0
  51. mas/cli/templates/pod-templates/guaranteed/ibm-data-dictionary-assetdatadictionary.yml +56 -0
  52. mas/cli/templates/pod-templates/guaranteed/ibm-mas-bascfg.yml +140 -0
  53. mas/cli/templates/pod-templates/guaranteed/ibm-mas-coreidp.yml +45 -0
  54. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-actions.yml +70 -0
  55. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-auth.yml +80 -0
  56. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-datapower.yml +24 -0
  57. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-devops.yml +26 -0
  58. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-dm.yml +52 -0
  59. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-dsc.yml +106 -0
  60. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-edgeconfig.yml +16 -0
  61. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-fpl.yml +62 -0
  62. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-guardian.yml +44 -0
  63. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-iot.yml +16 -0
  64. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-mbgx.yml +42 -0
  65. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-mfgx.yml +32 -0
  66. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-monitor.yml +42 -0
  67. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-orgmgmt.yml +126 -0
  68. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-provision.yml +70 -0
  69. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-registry.yml +62 -0
  70. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-state.yml +106 -0
  71. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-webui.yml +52 -0
  72. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-healthextaccelerator.yml +28 -0
  73. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-healthextworkspace.yml +18 -0
  74. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-imagestitching.yml +16 -0
  75. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-manageaccelerators.yml +16 -0
  76. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-manageapp.yml +106 -0
  77. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-manageworkspace.yml +126 -0
  78. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-slackproxy.yml +16 -0
  79. mas/cli/templates/pod-templates/guaranteed/ibm-mas-pushnotificationcfg.yml +25 -0
  80. mas/cli/templates/pod-templates/guaranteed/ibm-mas-scimcfg.yml +26 -0
  81. mas/cli/templates/pod-templates/guaranteed/ibm-mas-slscfg.yml +16 -0
  82. mas/cli/templates/pod-templates/guaranteed/ibm-mas-smtpcfg.yml +16 -0
  83. mas/cli/templates/pod-templates/guaranteed/ibm-mas-suite.yml +340 -0
  84. mas/cli/templates/pod-templates/guaranteed/ibm-mas-visualinspection.yml +76 -0
  85. mas/cli/templates/pod-templates/guaranteed/ibm-sls-licenseservice.yml +16 -0
  86. mas/cli/templates/pod-templates/saas-essentials/ibm-mas-visualinspection.yml +46 -0
  87. mas/cli/validators.py +126 -0
  88. mas_cli-10.0.0.data/scripts/mas-install +978 -0
  89. {mas_cli-9.5.0.data → mas_cli-10.0.0.data}/scripts/mas-uninstall +11 -8
  90. {mas_cli-9.5.0.data → mas_cli-10.0.0.data}/scripts/mas-upgrade +6 -4
  91. {mas_cli-9.5.0.dist-info → mas_cli-10.0.0.dist-info}/METADATA +2 -1
  92. mas_cli-10.0.0.dist-info/RECORD +94 -0
  93. mas_cli-9.5.0.dist-info/RECORD +0 -8
  94. {mas_cli-9.5.0.dist-info → mas_cli-10.0.0.dist-info}/WHEEL +0 -0
  95. {mas_cli-9.5.0.dist-info → mas_cli-10.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,16 @@
1
+ # podTemplates
2
+ # =============================================================================
3
+ # This list defines the resources for pod containers/initContainers that get
4
+ # assigned a QoS class of Guaranteed. More can be found here:
5
+ # https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod
6
+ podTemplates:
7
+ - name: sendmailapi
8
+ containers:
9
+ - name: sendmailapi
10
+ resources:
11
+ requests:
12
+ cpu: 0.4
13
+ memory: 1Gi
14
+ limits:
15
+ cpu: 0.4
16
+ memory: 1Gi
@@ -0,0 +1,340 @@
1
+ # podTemplates
2
+ # =============================================================================
3
+ # This list defines the resources for pod containers/initContainers that get
4
+ # assigned a QoS class of Guaranteed. More can be found here:
5
+ # https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod
6
+ podTemplates:
7
+ - name: entitymgr-suite
8
+ containers:
9
+ - name: manager
10
+ resources:
11
+ requests:
12
+ cpu: 1.5
13
+ memory: 512Mi
14
+ limits:
15
+ cpu: 1.5
16
+ memory: 512Mi
17
+ - name: entitymgr-addons
18
+ containers:
19
+ - name: manager
20
+ resources:
21
+ requests:
22
+ cpu: 0.5
23
+ memory: 384Mi
24
+ limits:
25
+ cpu: 0.5
26
+ memory: 384Mi
27
+ - name: entitymgr-bascfg
28
+ containers:
29
+ - name: manager
30
+ resources:
31
+ requests:
32
+ cpu: 0.2
33
+ memory: 512Mi
34
+ limits:
35
+ cpu: 0.2
36
+ memory: 512Mi
37
+ - name: entitymgr-coreidp
38
+ containers:
39
+ - name: manager
40
+ resources:
41
+ requests:
42
+ cpu: 0.5
43
+ memory: 512Mi
44
+ limits:
45
+ cpu: 0.5
46
+ memory: 512Mi
47
+ - name: entitymgr-idpcfg
48
+ containers:
49
+ - name: manager
50
+ resources:
51
+ requests:
52
+ cpu: 0.2
53
+ memory: 512Mi
54
+ limits:
55
+ cpu: 0.2
56
+ memory: 512Mi
57
+ - name: entitymgr-jdbccfg
58
+ containers:
59
+ - name: manager
60
+ resources:
61
+ requests:
62
+ cpu: 0.5
63
+ memory: 384Mi
64
+ limits:
65
+ cpu: 0.5
66
+ memory: 384Mi
67
+ - name: entitymgr-kafkacfg
68
+ containers:
69
+ - name: manager
70
+ resources:
71
+ requests:
72
+ cpu: 0.4
73
+ memory: 256Mi
74
+ limits:
75
+ cpu: 0.4
76
+ memory: 256Mi
77
+ - name: entitymgr-mongocfg
78
+ containers:
79
+ - name: manager
80
+ resources:
81
+ requests:
82
+ cpu: 0.2
83
+ memory: 512Mi
84
+ limits:
85
+ cpu: 0.2
86
+ memory: 512Mi
87
+ - name: entitymgr-objectstorage
88
+ containers:
89
+ - name: manager
90
+ resources:
91
+ requests:
92
+ cpu: 0.4
93
+ memory: 256Mi
94
+ limits:
95
+ cpu: 0.4
96
+ memory: 256Mi
97
+ - name: entitymgr-pushnotificationcfg
98
+ containers:
99
+ - name: manager
100
+ resources:
101
+ requests:
102
+ cpu: 0.2
103
+ memory: 512Mi
104
+ limits:
105
+ cpu: 0.2
106
+ memory: 512Mi
107
+ - name: entitymgr-scimcfg
108
+ containers:
109
+ - name: manager
110
+ resources:
111
+ requests:
112
+ cpu: 0.2
113
+ memory: 512Mi
114
+ limits:
115
+ cpu: 0.2
116
+ memory: 512Mi
117
+ - name: entitymgr-slscfg
118
+ containers:
119
+ - name: manager
120
+ resources:
121
+ requests:
122
+ cpu: 0.5
123
+ memory: 512Mi
124
+ limits:
125
+ cpu: 0.5
126
+ memory: 512Mi
127
+ - name: entitymgr-smtpcfg
128
+ containers:
129
+ - name: manager
130
+ resources:
131
+ requests:
132
+ cpu: 0.2
133
+ memory: 512Mi
134
+ limits:
135
+ cpu: 0.2
136
+ memory: 512Mi
137
+ - name: entitymgr-watsonstudiocfg
138
+ containers:
139
+ - name: manager
140
+ resources:
141
+ requests:
142
+ cpu: 0.4
143
+ memory: 256Mi
144
+ limits:
145
+ cpu: 0.4
146
+ memory: 256Mi
147
+ - name: entitymgr-ws
148
+ containers:
149
+ - name: manager
150
+ resources:
151
+ requests:
152
+ cpu: 0.2
153
+ memory: 512Mi
154
+ limits:
155
+ cpu: 0.2
156
+ memory: 512Mi
157
+ - name: coreapi
158
+ containers:
159
+ - name: coreapi
160
+ resources:
161
+ requests:
162
+ cpu: 1
163
+ memory: 2Gi
164
+ limits:
165
+ cpu: 1
166
+ memory: 2Gi
167
+ - name: internalapi
168
+ containers:
169
+ - name: internalapi
170
+ resources:
171
+ requests:
172
+ cpu: 1.2
173
+ memory: 2Gi
174
+ limits:
175
+ cpu: 1.2
176
+ memory: 2Gi
177
+ - name: mobileapi
178
+ containers:
179
+ - name: mobileapi
180
+ resources:
181
+ requests:
182
+ cpu: 0.8
183
+ memory: 2Gi
184
+ limits:
185
+ cpu: 0.8
186
+ memory: 2Gi
187
+ initContainers:
188
+ - name: mobileapi-init
189
+ resources:
190
+ requests:
191
+ cpu: 0.4
192
+ memory: 256Mi
193
+ limits:
194
+ cpu: 0.4
195
+ memory: 256Mi
196
+ - name: catalogapi
197
+ containers:
198
+ - name: catalogapi
199
+ resources:
200
+ requests:
201
+ cpu: 0.4
202
+ memory: 1Gi
203
+ limits:
204
+ cpu: 0.4
205
+ memory: 1Gi
206
+ initContainers:
207
+ - name: catalogapi-init
208
+ resources:
209
+ requests:
210
+ cpu: 0.4
211
+ memory: 256Mi
212
+ limits:
213
+ cpu: 0.4
214
+ memory: 256Mi
215
+ - name: catalogmgr
216
+ containers:
217
+ - name: catalogmgr
218
+ resources:
219
+ requests:
220
+ cpu: 0.4
221
+ memory: 1Gi
222
+ limits:
223
+ cpu: 0.4
224
+ memory: 1Gi
225
+ initContainers:
226
+ - name: catalogmgr-init
227
+ resources:
228
+ requests:
229
+ cpu: 0.4
230
+ memory: 256Mi
231
+ limits:
232
+ cpu: 0.4
233
+ memory: 256Mi
234
+ - name: groupsync-coordinator
235
+ containers:
236
+ - name: groupsync-coordinator
237
+ resources:
238
+ requests:
239
+ cpu: 0.25
240
+ memory: 256Mi
241
+ limits:
242
+ cpu: 0.25
243
+ memory: 256Mi
244
+ initContainers:
245
+ - name: groupsync-coordinator-init
246
+ resources:
247
+ requests:
248
+ cpu: 0.4
249
+ memory: 256Mi
250
+ limits:
251
+ cpu: 0.4
252
+ memory: 256Mi
253
+ - name: usersync-coordinator
254
+ containers:
255
+ - name: usersync-coordinator
256
+ resources:
257
+ requests:
258
+ cpu: 0.25
259
+ memory: 256Mi
260
+ limits:
261
+ cpu: 0.25
262
+ memory: 256Mi
263
+ initContainers:
264
+ - name: usersync-coordinator-init
265
+ resources:
266
+ requests:
267
+ cpu: 0.4
268
+ memory: 256Mi
269
+ limits:
270
+ cpu: 0.4
271
+ memory: 256Mi
272
+ - name: workspace-coordinator
273
+ containers:
274
+ - name: workspace-coordinator
275
+ resources:
276
+ requests:
277
+ cpu: 0.25
278
+ memory: 256Mi
279
+ limits:
280
+ cpu: 0.25
281
+ memory: 256Mi
282
+ initContainers:
283
+ - name: workspace-coordinator-init
284
+ resources:
285
+ requests:
286
+ cpu: 0.4
287
+ memory: 256Mi
288
+ limits:
289
+ cpu: 0.4
290
+ memory: 256Mi
291
+ - name: monagent-mas
292
+ containers:
293
+ - name: monagent-mas
294
+ resources:
295
+ requests:
296
+ cpu: 0.5
297
+ memory: 512Mi
298
+ limits:
299
+ cpu: 0.5
300
+ memory: 512Mi
301
+ - name: admin-dashboard
302
+ containers:
303
+ - name: admin-dashboard
304
+ resources:
305
+ requests:
306
+ cpu: 0.8
307
+ memory: 512Mi
308
+ limits:
309
+ cpu: 0.8
310
+ memory: 512Mi
311
+ - name: homepage
312
+ containers:
313
+ - name: homepage
314
+ resources:
315
+ requests:
316
+ cpu: 0.8
317
+ memory: 512Mi
318
+ limits:
319
+ cpu: 0.8
320
+ memory: 512Mi
321
+ - name: navigator
322
+ containers:
323
+ - name: navigator
324
+ resources:
325
+ requests:
326
+ cpu: 0.8
327
+ memory: 512Mi
328
+ limits:
329
+ cpu: 0.8
330
+ memory: 512Mi
331
+ - name: ltpakeygenerator
332
+ containers:
333
+ - name: liberty
334
+ resources:
335
+ requests:
336
+ cpu: 0.2
337
+ memory: 512Mi
338
+ limits:
339
+ cpu: 0.2
340
+ memory: 512Mi
@@ -0,0 +1,76 @@
1
+ # supportedPodKeys
2
+ # =============================================================================
3
+ # This list defines the resources for pod containers/initContainers that get
4
+ # assigned a QoS class of Guaranteed. More can be found here:
5
+ # https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod
6
+ podTemplates:
7
+ - name: vision-service
8
+ containers:
9
+ - name: vision-service
10
+ resources:
11
+ requests:
12
+ cpu: "20"
13
+ memory: "25Gi"
14
+ limits:
15
+ cpu: "20"
16
+ memory: "25Gi"
17
+ - name: vision-ui
18
+ containers:
19
+ - name: vision-ui
20
+ resources:
21
+ requests:
22
+ cpu: "1"
23
+ memory: "1024Mi"
24
+ limits:
25
+ cpu: "1"
26
+ memory: "1024Mi"
27
+ - name: vision-video-microservice
28
+ containers:
29
+ - name: vision-video-microservice
30
+ resources:
31
+ requests:
32
+ cpu: "20"
33
+ memory: "12Gi"
34
+ limits:
35
+ cpu: "20"
36
+ memory: "12Gi"
37
+ - name: vision-dataset-summarization
38
+ containers:
39
+ - name: vision-dataset-summarization
40
+ resources:
41
+ requests:
42
+ cpu: "1"
43
+ memory: "1Gi"
44
+ limits:
45
+ cpu: "1"
46
+ memory: "1Gi"
47
+ - name: vision-edgeman
48
+ containers:
49
+ - name: vision-edgeman
50
+ resources:
51
+ requests:
52
+ cpu: "1"
53
+ memory: "1Gi"
54
+ limits:
55
+ cpu: "1"
56
+ memory: "1Gi"
57
+ - name: vision-dataset-feature
58
+ containers:
59
+ - name: vision-dataset-feature
60
+ resources:
61
+ requests:
62
+ cpu: "2"
63
+ memory: "10Gi"
64
+ limits:
65
+ cpu: "2"
66
+ memory: "10Gi"
67
+ - name: vision-model-conversion
68
+ containers:
69
+ - name: vision-model-conversion
70
+ resources:
71
+ requests:
72
+ cpu: "2"
73
+ memory: "6Gi"
74
+ limits:
75
+ cpu: "2"
76
+ memory: "6Gi"
@@ -0,0 +1,16 @@
1
+ # supportedPodKeys
2
+ # =============================================================================
3
+ # This list defines the resources for pod containers/initContainers that get
4
+ # assigned a QoS class of Guaranteed. More can be found here:
5
+ # https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod
6
+ podTemplates:
7
+ - name: api-licensing
8
+ containers:
9
+ - name: api-licensing
10
+ resources:
11
+ requests:
12
+ cpu: 0.8
13
+ memory: 2Gi
14
+ limits:
15
+ cpu: 0.8
16
+ memory: 2Gi
@@ -0,0 +1,46 @@
1
+ # supportedPodKeys
2
+ # =============================================================================
3
+ # This list defines the resources for pod containers/initContainers that get
4
+ # assigned a QoS class of Guaranteed. More can be found here:
5
+ # https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod
6
+ podTemplates:
7
+ - name: vision-service
8
+ containers:
9
+ - name: vision-service
10
+ resources:
11
+ requests:
12
+ cpu: "200m"
13
+ memory: 2Gi
14
+ limits:
15
+ cpu: "5"
16
+ memory: 10Gi
17
+ - name: vision-edgeman
18
+ containers:
19
+ - name: vision-edgeman
20
+ resources:
21
+ requests:
22
+ cpu: "200m"
23
+ memory: 128Mi
24
+ limits:
25
+ cpu: "0.5"
26
+ memory: 256Mi
27
+ - name: vision-video-microservice
28
+ containers:
29
+ - name: vision-video-microservice
30
+ resources:
31
+ requests:
32
+ cpu: "0.1"
33
+ memory: 512Mi
34
+ limits:
35
+ cpu: "2"
36
+ memory: 2Gi
37
+ - name: vision-dataset-summarization
38
+ containers:
39
+ - name: vision-dataset-summarization
40
+ resources:
41
+ requests:
42
+ cpu: "0.1"
43
+ memory: 128Mi
44
+ limits:
45
+ cpu: "1"
46
+ memory: 1Gi
mas/cli/validators.py ADDED
@@ -0,0 +1,126 @@
1
+ # *****************************************************************************
2
+ # Copyright (c) 2024 IBM Corporation and other Contributors.
3
+ #
4
+ # All rights reserved. This program and the accompanying materials
5
+ # are made available under the terms of the Eclipse Public License v1.0
6
+ # which accompanies this distribution, and is available at
7
+ # http://www.eclipse.org/legal/epl-v10.html
8
+ #
9
+ # *****************************************************************************
10
+
11
+ from re import match
12
+ from os import path
13
+
14
+ # Use of the openshift client rather than the kubernetes client allows us access to "apply"
15
+ from openshift import dynamic
16
+ from kubernetes import config
17
+ from kubernetes.client import api_client
18
+
19
+ from prompt_toolkit.validation import Validator, ValidationError
20
+
21
+ from mas.devops.ocp import getStorageClass
22
+ from mas.devops.mas import verifyMasInstance
23
+
24
+ import logging
25
+
26
+ logger = logging.getLogger(__name__)
27
+
28
+
29
+ class InstanceIDFormatValidator(Validator):
30
+ def validate(self, document):
31
+ """
32
+ Validate that a MAS instance ID exists on the target cluster
33
+ """
34
+ instanceId = document.text
35
+
36
+ if not match(r"^[a-z][a-z0-9-]{1,10}[a-z0-9]$", instanceId):
37
+ raise ValidationError(message='MAS instance ID does not meet the requirements', cursor_position=len(instanceId))
38
+
39
+
40
+ class WorkspaceIDFormatValidator(Validator):
41
+ def validate(self, document):
42
+ """
43
+ Validate that a MAS instance ID exists on the target cluster
44
+ """
45
+ instanceId = document.text
46
+
47
+ if not match(r"^[a-z][a-z0-9]{2,11}$", instanceId):
48
+ raise ValidationError(message='Workspace ID does not meet the requirements', cursor_position=len(instanceId))
49
+
50
+
51
+ class WorkspaceNameFormatValidator(Validator):
52
+ def validate(self, document):
53
+ """
54
+ Validate that a MAS instance ID exists on the target cluster
55
+ """
56
+ instanceId = document.text
57
+
58
+ if not match(r"^.{3,300}$", instanceId):
59
+ raise ValidationError(message='Workspace name does not meet the requirements', cursor_position=len(instanceId))
60
+
61
+
62
+ class InstanceIDValidator(Validator):
63
+ def validate(self, document):
64
+ """
65
+ Validate that a MAS instance ID exists on the target cluster
66
+ """
67
+ instanceId = document.text
68
+
69
+ dynClient = dynamic.DynamicClient(
70
+ api_client.ApiClient(configuration=config.load_kube_config())
71
+ )
72
+ if not verifyMasInstance(dynClient, instanceId):
73
+ raise ValidationError(message='Not a valid MAS instance ID on this cluster', cursor_position=len(instanceId))
74
+
75
+
76
+ class StorageClassValidator(Validator):
77
+ def validate(self, document):
78
+ """
79
+ Validate that a StorageClass exists on the target cluster
80
+ """
81
+ name = document.text
82
+
83
+ dynClient = dynamic.DynamicClient(
84
+ api_client.ApiClient(configuration=config.load_kube_config())
85
+ )
86
+ if getStorageClass(dynClient, name) is None:
87
+ raise ValidationError(message='Specified storage class is not available on this cluster', cursor_position=len(name))
88
+
89
+
90
+ class YesNoValidator(Validator):
91
+ def validate(self, document):
92
+ """
93
+ Validate that a response is understandable as a yes/no response
94
+ """
95
+ response = document.text
96
+ if response.lower() not in ["y", "n", "yes", "no"]:
97
+ raise ValidationError(message='Enter a valid response: y(es), n(o)', cursor_position=len(response))
98
+
99
+
100
+ class FileExistsValidator(Validator):
101
+ def validate(self, document):
102
+ """
103
+ Validate that a file exists on the local system
104
+ """
105
+ response = document.text
106
+ if not path.isfile(response):
107
+ raise ValidationError(message=f"{response} does not exist, or is not a file", cursor_position=len(response))
108
+
109
+ class DirectoryExistsValidator(Validator):
110
+ def validate(self, document):
111
+ """
112
+ Validate that a file exists on the local system
113
+ """
114
+ response = document.text
115
+ if not path.isdir(response):
116
+ raise ValidationError(message=f"{response} does not exist, or is not a directory", cursor_position=len(response))
117
+
118
+
119
+ class OptimizerInstallPlanValidator(Validator):
120
+ def validate(self, document):
121
+ """
122
+ Validate that a response is a valid install plan for Optimizer
123
+ """
124
+ response = document.text
125
+ if response not in ["full", "limited"]:
126
+ raise ValidationError(message='Enter a valid response: full, limited', cursor_position=len(response))