@axway/axway-central-cli 4.5.0 → 4.6.0-rc.0
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.
- package/.security-profile-branches.json +18 -0
- package/package.json +1 -1
- package/dist/cli.js +0 -71
- package/dist/commands/apply/index.js +0 -112
- package/dist/commands/completion/index.js +0 -100
- package/dist/commands/config/common/index.js +0 -28
- package/dist/commands/config/index.js +0 -20
- package/dist/commands/config/list.js +0 -24
- package/dist/commands/config/set.js +0 -102
- package/dist/commands/config/unset.js +0 -48
- package/dist/commands/create/agentResource.js +0 -108
- package/dist/commands/create/environment.js +0 -62
- package/dist/commands/create/index.js +0 -109
- package/dist/commands/create/serviceAccount.js +0 -15
- package/dist/commands/delete/index.js +0 -196
- package/dist/commands/edit/environment.js +0 -101
- package/dist/commands/edit/index.js +0 -28
- package/dist/commands/get/index.js +0 -272
- package/dist/commands/install/agents.js +0 -290
- package/dist/commands/install/apigeexAgents.js +0 -223
- package/dist/commands/install/apigeexSaasAgents.js +0 -300
- package/dist/commands/install/awsAgents.js +0 -525
- package/dist/commands/install/awsSaasAgents.js +0 -508
- package/dist/commands/install/azureAgents.js +0 -242
- package/dist/commands/install/azureSaasAgents.js +0 -519
- package/dist/commands/install/backstageAgents.js +0 -167
- package/dist/commands/install/edgeAgents.js +0 -409
- package/dist/commands/install/gitHubSaasAgents.js +0 -294
- package/dist/commands/install/gitLabAgents.js +0 -178
- package/dist/commands/install/graylogAgent.js +0 -147
- package/dist/commands/install/helpers/creators.js +0 -359
- package/dist/commands/install/helpers/deleters.js +0 -36
- package/dist/commands/install/helpers/getters.js +0 -95
- package/dist/commands/install/helpers/index.js +0 -267
- package/dist/commands/install/helpers/inputs.js +0 -593
- package/dist/commands/install/helpers/regex.js +0 -67
- package/dist/commands/install/helpers/templates/apigeexTemplates.js +0 -109
- package/dist/commands/install/helpers/templates/awsTemplates.js +0 -129
- package/dist/commands/install/helpers/templates/azureTemplates.js +0 -125
- package/dist/commands/install/helpers/templates/backstageTemplates.js +0 -95
- package/dist/commands/install/helpers/templates/edgeTemplates.js +0 -360
- package/dist/commands/install/helpers/templates/gitLabTemplates.js +0 -66
- package/dist/commands/install/helpers/templates/graylogTemplates.js +0 -75
- package/dist/commands/install/helpers/templates/ibmAPIConnectTemplates.js +0 -116
- package/dist/commands/install/helpers/templates/istioTemplates.js +0 -214
- package/dist/commands/install/helpers/templates/kafkaTemplates.js +0 -194
- package/dist/commands/install/helpers/templates/sapApiPortalTemplates.js +0 -114
- package/dist/commands/install/helpers/templates/softwareAGWebMethodsTemplates.js +0 -93
- package/dist/commands/install/helpers/templates/traceableTemplates.js +0 -135
- package/dist/commands/install/helpers/templates/wso2Templates.js +0 -85
- package/dist/commands/install/helpers/util.js +0 -26
- package/dist/commands/install/ibmAPIConnectAgents.js +0 -213
- package/dist/commands/install/index.js +0 -36
- package/dist/commands/install/istioAgents.js +0 -346
- package/dist/commands/install/kafkaAgents.js +0 -303
- package/dist/commands/install/platform.js +0 -175
- package/dist/commands/install/sapApiPortalAgents.js +0 -198
- package/dist/commands/install/softwareAGWebMethodsAgents.js +0 -161
- package/dist/commands/install/swaggerHubSaasAgents.js +0 -272
- package/dist/commands/install/traceableAgents.js +0 -257
- package/dist/commands/install/traceableSaasAgents.js +0 -275
- package/dist/commands/install/wso2Agents.js +0 -163
- package/dist/commands/productize/helpers/productizationHelper.js +0 -408
- package/dist/commands/productize/index.js +0 -99
- package/dist/common/ApiServerClient.js +0 -1109
- package/dist/common/CacheController.js +0 -146
- package/dist/common/CliConfigManager.js +0 -76
- package/dist/common/CompositeError.js +0 -95
- package/dist/common/CoreConfigController.js +0 -174
- package/dist/common/DefinitionsManager.js +0 -298
- package/dist/common/Kubectl.js +0 -68
- package/dist/common/PlatformClient.js +0 -128
- package/dist/common/Renderer.js +0 -409
- package/dist/common/TmpFile.js +0 -96
- package/dist/common/bashCommands.js +0 -97
- package/dist/common/basicPrompts.js +0 -160
- package/dist/common/dataService.js +0 -312
- package/dist/common/errorHandler.js +0 -46
- package/dist/common/modules.d.js +0 -1
- package/dist/common/resultsRenderers.js +0 -164
- package/dist/common/types.js +0 -746
- package/dist/common/utils.js +0 -476
- package/dist/main.js +0 -8
|
@@ -1,593 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.serviceAccountNameAlreadyExists = exports.selectServiceAccount = exports.selectAWSRegion = exports.secretAlreadyExists = exports.namespaceAlreadyExists = exports.k8sClusterMessages = exports.idpTestables = exports.idpMessages = exports.getCentralEnvironments = exports.envMessages = exports.enterServiceAccountName = exports.enterPublicKeyPath = exports.enterPrivateKeyPath = exports.enterNamespaceName = exports.enterAWSRegion = exports.createNamespace = exports.createGatewayAgentCredsSecret = exports.createAmplifyAgentKeysSecret = exports.askServiceAccountName = exports.askReferencedEnvironments = exports.askPublicKeyPath = exports.askPublicAndPrivateKeysPath = exports.askPrivateKeyPath = exports.askNamespace = exports.askKeyValuePairLoop = exports.askK8sClusterName = exports.askForSecretName = exports.askForIDPConfiguration = exports.askForIDPAuthConfiguration = exports.askEnvironmentName = exports.askDosaClientId = exports.askBundleType = exports.askArrayLoop = exports.askAgentName = exports.askAWSRegion = exports.agentMessages = exports.addIdentityProvider = void 0;
|
|
7
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
-
var _inquirer = _interopRequireDefault(require("inquirer"));
|
|
10
|
-
var _basicPrompts = require("../../../common/basicPrompts");
|
|
11
|
-
var _Kubectl = require("../../../common/Kubectl");
|
|
12
|
-
var _PlatformClient = require("../../../common/PlatformClient");
|
|
13
|
-
var _types = require("../../../common/types");
|
|
14
|
-
var _getters = require("./getters");
|
|
15
|
-
var _regex = require("./regex");
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
const {
|
|
18
|
-
log
|
|
19
|
-
} = (0, _snooplogg.default)('central: install: agents: saas');
|
|
20
|
-
const cliNowString = `cli-${Date.now()}`;
|
|
21
|
-
const envMessages = exports.envMessages = {
|
|
22
|
-
createNewEnvironment: 'Create a new environment',
|
|
23
|
-
enterEnvironmentName: 'Enter a new environment name',
|
|
24
|
-
isProduction: 'Is the environment used for production purpose?',
|
|
25
|
-
selectEnvironment: 'Select an environment',
|
|
26
|
-
selectReferencedEnvironment: 'Select a referenced environment',
|
|
27
|
-
selectMoreWithExistingRefEnv: "Selected environment already contains references, do you want to select more",
|
|
28
|
-
selectMoreRefEnv: "Do you want to select more referenced environment",
|
|
29
|
-
getEnvironmentsError: 'Get environments error.',
|
|
30
|
-
environmentAlreadyExists: 'Environment already exists. Please enter a new name.',
|
|
31
|
-
selectTeam: 'Select a team'
|
|
32
|
-
};
|
|
33
|
-
const k8sClusterMessages = exports.k8sClusterMessages = {
|
|
34
|
-
enterK8sClusterName: 'Enter a unique k8s cluster name'
|
|
35
|
-
};
|
|
36
|
-
const agentMessages = exports.agentMessages = {
|
|
37
|
-
enterDiscoveryAgentName: 'Enter a new discovery agent name',
|
|
38
|
-
enterTraceabilityAgentName: 'Enter a new traceability agent name',
|
|
39
|
-
enterComplianceAgentName: 'Enter a new compliance agent name',
|
|
40
|
-
getAgentsError: 'Error getting agents.',
|
|
41
|
-
agentAlreadyExists: 'Agent already exists. Please enter a new name.',
|
|
42
|
-
selectAgentType: 'Select the type of agent(s) you want to install'
|
|
43
|
-
};
|
|
44
|
-
const idpMessages = exports.idpMessages = {
|
|
45
|
-
addIDP: 'Choose if you want to add an IDP Configuration. Multiple Identity providers can be configured',
|
|
46
|
-
enterTitle: 'Enter the title of the IDP config',
|
|
47
|
-
selectType: 'Select the type of the IDP',
|
|
48
|
-
enterMetadataURL: 'Enter the metadata URL',
|
|
49
|
-
provideReqHeadersRegistration: 'Add request headers used for registration calls as key-value pairs. Stops when empty key is provided',
|
|
50
|
-
provideQueryParamsRegistration: 'Add query parameters used for registration calls as key-value pairs. Stops when empty key is provided',
|
|
51
|
-
provideClientProperties: "Enter additional client properties used for registration calls as key-value pairs. Stops when empty key is provided",
|
|
52
|
-
enterClientTimeout: "Enter client timeout (in seconds) for dynamic registration calls. Defaults to 60s. Minimum 30s",
|
|
53
|
-
selectAuthType: "Select the auth type",
|
|
54
|
-
enterToken: "Enter the access token",
|
|
55
|
-
selectClientSecretAuthMethod: "Select the auth method for ClientSecret based auth",
|
|
56
|
-
enterClientID: "Enter the clientID",
|
|
57
|
-
enterClientSecret: "Enter the clientSecret",
|
|
58
|
-
enterClientScopes: "Enter the list of scope names",
|
|
59
|
-
provideReqHeadersForTokenFetch: "Enter the request headers used for the token fetch call as key-value pairs. Stops when empty input is provided",
|
|
60
|
-
provideQueryParamsForTokenFetch: "Enter the query parameters used for the token fetch call as key-value pairs. Stops when empty input is provided"
|
|
61
|
-
};
|
|
62
|
-
const namespaceAlreadyExists = exports.namespaceAlreadyExists = 'Namespace already exists. Please enter a new name.';
|
|
63
|
-
const secretAlreadyExists = exports.secretAlreadyExists = 'Secret already exists. Please enter a new name.';
|
|
64
|
-
const enterNamespaceName = exports.enterNamespaceName = 'Enter a new namespace name';
|
|
65
|
-
const selectServiceAccount = exports.selectServiceAccount = 'Select a service account';
|
|
66
|
-
const enterServiceAccountName = exports.enterServiceAccountName = 'Enter a new service account name';
|
|
67
|
-
const enterPublicKeyPath = exports.enterPublicKeyPath = 'Enter the file path to the public key';
|
|
68
|
-
const enterPrivateKeyPath = exports.enterPrivateKeyPath = 'Enter the file path to the private key';
|
|
69
|
-
const serviceAccountNameAlreadyExists = exports.serviceAccountNameAlreadyExists = 'Service account already exists. Please enter a new name.';
|
|
70
|
-
const selectAWSRegion = exports.selectAWSRegion = 'Select an AWS Region';
|
|
71
|
-
const enterAWSRegion = exports.enterAWSRegion = 'Enter an AWS Region';
|
|
72
|
-
const askAWSRegion = async (region = '') => {
|
|
73
|
-
let regions = Object.values(_types.AWSRegions).map(str => ({
|
|
74
|
-
name: str,
|
|
75
|
-
value: str
|
|
76
|
-
}));
|
|
77
|
-
let answer = await (0, _basicPrompts.askList)({
|
|
78
|
-
msg: selectAWSRegion,
|
|
79
|
-
default: region,
|
|
80
|
-
choices: [{
|
|
81
|
-
name: 'Enter an AWS Region not on the list',
|
|
82
|
-
value: 'CREATE_NEW'
|
|
83
|
-
}, ...regions]
|
|
84
|
-
});
|
|
85
|
-
if (answer === 'CREATE_NEW') {
|
|
86
|
-
return await (0, _basicPrompts.askInput)({
|
|
87
|
-
msg: enterAWSRegion
|
|
88
|
-
});
|
|
89
|
-
} else {
|
|
90
|
-
return answer;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
exports.askAWSRegion = askAWSRegion;
|
|
94
|
-
const askServiceAccountName = async serviceAccountNames => {
|
|
95
|
-
console.warn(_chalk.default.yellow(`WARNING: Creating a new service account will overwrite any existing "private_key.pem" and "public_key.pem" files in this directory`));
|
|
96
|
-
const name = await (0, _basicPrompts.askInput)({
|
|
97
|
-
msg: enterServiceAccountName,
|
|
98
|
-
defaultValue: cliNowString,
|
|
99
|
-
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateInputIsNew)(serviceAccountNames, serviceAccountNameAlreadyExists), (0, _basicPrompts.validateRegex)(_regex.dosaRegex, _regex.invalidDosaName))
|
|
100
|
-
});
|
|
101
|
-
return name;
|
|
102
|
-
};
|
|
103
|
-
exports.askServiceAccountName = askServiceAccountName;
|
|
104
|
-
const askDosaClientId = async (client, showWarning = true) => {
|
|
105
|
-
// Fetch all existing service accounts.
|
|
106
|
-
const serviceAccounts = await client.getServiceAccounts(_PlatformClient.PlatformServiceAccountRole.ApiCentralAdmin);
|
|
107
|
-
const serviceAccountNames = serviceAccounts.map(nextAccount => nextAccount.name);
|
|
108
|
-
|
|
109
|
-
// Ask user to select an existing service account or create a new one.
|
|
110
|
-
const selectedName = await (0, _basicPrompts.askList)({
|
|
111
|
-
msg: selectServiceAccount,
|
|
112
|
-
choices: [{
|
|
113
|
-
name: 'Create a new service account',
|
|
114
|
-
value: 'CREATE_NEW'
|
|
115
|
-
}, new _inquirer.default.Separator(), ...serviceAccountNames, new _inquirer.default.Separator()]
|
|
116
|
-
});
|
|
117
|
-
if (selectedName === 'CREATE_NEW') {
|
|
118
|
-
// We're going to create a new service account. Ask for a unique name. (We'll create it later.)
|
|
119
|
-
const name = await askServiceAccountName(serviceAccountNames);
|
|
120
|
-
return {
|
|
121
|
-
clientId: null,
|
|
122
|
-
name,
|
|
123
|
-
isNew: true
|
|
124
|
-
};
|
|
125
|
-
} else {
|
|
126
|
-
// We're using an existing service account. Notify user to make its keys available to the agents.
|
|
127
|
-
if (showWarning) {
|
|
128
|
-
console.log(_chalk.default.yellow('Please make sure your "private_key.pem" and "public_key.pem" files for the selected service account are in this installation folder.'));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Fetch selected service account's client ID and return info about it.
|
|
132
|
-
const selectedAccount = serviceAccounts.find(nextAccount => nextAccount.name === selectedName);
|
|
133
|
-
return {
|
|
134
|
-
clientId: selectedAccount === null || selectedAccount === void 0 ? void 0 : selectedAccount.client_id,
|
|
135
|
-
name: selectedName,
|
|
136
|
-
isNew: false
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
exports.askDosaClientId = askDosaClientId;
|
|
141
|
-
const askNamespace = async (msg, defaultValue) => {
|
|
142
|
-
const namespaces = await _Kubectl.kubectl.get('ns');
|
|
143
|
-
if (namespaces.error) throw Error(namespaces.error);
|
|
144
|
-
let answer = await (0, _basicPrompts.askList)({
|
|
145
|
-
msg,
|
|
146
|
-
choices: [{
|
|
147
|
-
name: 'Create a new namespace',
|
|
148
|
-
value: 'CREATE_NEW'
|
|
149
|
-
}, new _inquirer.default.Separator(), ...namespaces.data, new _inquirer.default.Separator()]
|
|
150
|
-
});
|
|
151
|
-
if (answer === 'CREATE_NEW') {
|
|
152
|
-
const name = await (0, _basicPrompts.askInput)({
|
|
153
|
-
msg: enterNamespaceName,
|
|
154
|
-
defaultValue,
|
|
155
|
-
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateInputIsNew)(namespaces.data, namespaceAlreadyExists), (0, _basicPrompts.validateRegex)(_regex.namespaceRegex, _regex.invalidNamespace))
|
|
156
|
-
});
|
|
157
|
-
return {
|
|
158
|
-
name,
|
|
159
|
-
isNew: true
|
|
160
|
-
};
|
|
161
|
-
} else {
|
|
162
|
-
return {
|
|
163
|
-
name: answer,
|
|
164
|
-
isNew: false
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
exports.askNamespace = askNamespace;
|
|
169
|
-
const askForSecretName = async (msg, defaultValue, options) => {
|
|
170
|
-
return await (0, _basicPrompts.askInput)({
|
|
171
|
-
msg,
|
|
172
|
-
defaultValue,
|
|
173
|
-
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateInputIsNew)(options, secretAlreadyExists), (0, _basicPrompts.validateRegex)(_regex.resourceRegex, (0, _regex.invalidResourceMsg)('Secret')))
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
exports.askForSecretName = askForSecretName;
|
|
177
|
-
const askBundleType = async choices => await (0, _basicPrompts.askList)({
|
|
178
|
-
msg: agentMessages.selectAgentType,
|
|
179
|
-
choices: choices
|
|
180
|
-
});
|
|
181
|
-
exports.askBundleType = askBundleType;
|
|
182
|
-
const askEnvironmentName = async (client, defsManager, isAxwayManaged = null, gatewayType) => {
|
|
183
|
-
let envs;
|
|
184
|
-
if (isAxwayManaged == null) {
|
|
185
|
-
// do not filter any environments
|
|
186
|
-
const {
|
|
187
|
-
data: allEnvs
|
|
188
|
-
} = await (0, _getters.getListByResource)({
|
|
189
|
-
client,
|
|
190
|
-
defsManager,
|
|
191
|
-
resourceType: 'Environment',
|
|
192
|
-
resourceShortName: 'env'
|
|
193
|
-
});
|
|
194
|
-
if (!allEnvs) throw Error(envMessages.getEnvironmentsError);
|
|
195
|
-
envs = allEnvs;
|
|
196
|
-
} else {
|
|
197
|
-
// Get only the axway managed environments
|
|
198
|
-
const {
|
|
199
|
-
data: axwayManagedEnvs
|
|
200
|
-
} = await (0, _getters.getListByResource)({
|
|
201
|
-
client,
|
|
202
|
-
defsManager,
|
|
203
|
-
resourceType: 'Environment',
|
|
204
|
-
resourceShortName: 'env',
|
|
205
|
-
query: 'spec.axwayManaged==true'
|
|
206
|
-
});
|
|
207
|
-
if (!axwayManagedEnvs) throw Error(envMessages.getEnvironmentsError);
|
|
208
|
-
envs = axwayManagedEnvs;
|
|
209
|
-
if (!isAxwayManaged) {
|
|
210
|
-
const {
|
|
211
|
-
data: allEnvs
|
|
212
|
-
} = await (0, _getters.getListByResource)({
|
|
213
|
-
client,
|
|
214
|
-
defsManager,
|
|
215
|
-
resourceType: 'Environment',
|
|
216
|
-
resourceShortName: 'env'
|
|
217
|
-
});
|
|
218
|
-
if (!allEnvs) throw Error(envMessages.getEnvironmentsError);
|
|
219
|
-
|
|
220
|
-
// Remove any axway managed envs from the array when isAxwayManaged is false
|
|
221
|
-
envs = allEnvs.filter(env => {
|
|
222
|
-
return !envs.find(axwayManagedEnv => env.name == axwayManagedEnv.name);
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
let answer = await (0, _basicPrompts.askList)({
|
|
227
|
-
msg: envMessages.selectEnvironment,
|
|
228
|
-
choices: [{
|
|
229
|
-
name: envMessages.createNewEnvironment,
|
|
230
|
-
value: 'CREATE_NEW'
|
|
231
|
-
}, new _inquirer.default.Separator(), ...envs.map(e => e.name).sort((name1, name2) => name1.localeCompare(name2)), new _inquirer.default.Separator()]
|
|
232
|
-
});
|
|
233
|
-
if (answer === 'CREATE_NEW') {
|
|
234
|
-
const name = await (0, _basicPrompts.askInput)({
|
|
235
|
-
msg: envMessages.enterEnvironmentName,
|
|
236
|
-
defaultValue: cliNowString,
|
|
237
|
-
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateInputIsNew)(envs.map(env => env.name), envMessages.environmentAlreadyExists), (0, _basicPrompts.validateRegex)(_regex.resourceRegex, (0, _regex.invalidResourceMsg)('Environment')))
|
|
238
|
-
});
|
|
239
|
-
return {
|
|
240
|
-
name,
|
|
241
|
-
isNew: true
|
|
242
|
-
};
|
|
243
|
-
} else {
|
|
244
|
-
var _selectedEnv$referenc, _selectedEnv$referenc2, _selectedEnv$referenc3, _selectedEnv$referenc4;
|
|
245
|
-
// Check if user is installing Traceable agent and there's only 1 existing environment - exit gracefully
|
|
246
|
-
if (gatewayType === 'Traceable' && envs.length === 1) {
|
|
247
|
-
console.log(_chalk.default.yellow('Warning: The Traceable agent requires at least one Engage environment before installing.'));
|
|
248
|
-
console.log(_chalk.default.gray('Installation cancelled. You can create more environments using: axway engage create environment'));
|
|
249
|
-
process.exit(0);
|
|
250
|
-
}
|
|
251
|
-
const selectedEnv = envs.find(env => env.name == answer);
|
|
252
|
-
return {
|
|
253
|
-
name: answer,
|
|
254
|
-
isNew: false,
|
|
255
|
-
referencedEnvironments: selectedEnv !== null && selectedEnv !== void 0 && (_selectedEnv$referenc = selectedEnv.references) !== null && _selectedEnv$referenc !== void 0 && _selectedEnv$referenc.managedEnvironments ? selectedEnv === null || selectedEnv === void 0 ? void 0 : (_selectedEnv$referenc2 = selectedEnv.references) === null || _selectedEnv$referenc2 === void 0 ? void 0 : _selectedEnv$referenc2.managedEnvironments : [],
|
|
256
|
-
referencedIdentityProviders: selectedEnv !== null && selectedEnv !== void 0 && (_selectedEnv$referenc3 = selectedEnv.references) !== null && _selectedEnv$referenc3 !== void 0 && _selectedEnv$referenc3.identityProviders ? selectedEnv === null || selectedEnv === void 0 ? void 0 : (_selectedEnv$referenc4 = selectedEnv.references) === null || _selectedEnv$referenc4 === void 0 ? void 0 : _selectedEnv$referenc4.identityProviders : []
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
exports.askEnvironmentName = askEnvironmentName;
|
|
261
|
-
const getCentralEnvironments = async (client, defsManager) => {
|
|
262
|
-
let envs;
|
|
263
|
-
const {
|
|
264
|
-
data: allEnvs
|
|
265
|
-
} = await (0, _getters.getListByResource)({
|
|
266
|
-
client,
|
|
267
|
-
defsManager,
|
|
268
|
-
resourceType: 'Environment',
|
|
269
|
-
resourceShortName: 'env'
|
|
270
|
-
});
|
|
271
|
-
if (!allEnvs) throw Error(envMessages.getEnvironmentsError);
|
|
272
|
-
envs = allEnvs;
|
|
273
|
-
return envs;
|
|
274
|
-
};
|
|
275
|
-
exports.getCentralEnvironments = getCentralEnvironments;
|
|
276
|
-
const askReferencedEnvironments = async (client, defsManager, envInfo) => {
|
|
277
|
-
var _envInfo$referencedEn;
|
|
278
|
-
if (((_envInfo$referencedEn = envInfo.referencedEnvironments) === null || _envInfo$referencedEn === void 0 ? void 0 : _envInfo$referencedEn.length) > 0) {
|
|
279
|
-
const choice = (await (0, _basicPrompts.askList)({
|
|
280
|
-
msg: envMessages.selectMoreWithExistingRefEnv,
|
|
281
|
-
default: _types.YesNo.No,
|
|
282
|
-
choices: _types.YesNoChoices
|
|
283
|
-
})) === _types.YesNo.Yes;
|
|
284
|
-
if (!choice) {
|
|
285
|
-
return envInfo.referencedEnvironments;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// filter all environments not referencing other environment
|
|
290
|
-
const {
|
|
291
|
-
data: allEnvs
|
|
292
|
-
} = await (0, _getters.getListByResource)({
|
|
293
|
-
client,
|
|
294
|
-
defsManager,
|
|
295
|
-
resourceType: 'Environment',
|
|
296
|
-
resourceShortName: 'env',
|
|
297
|
-
query: "metadata.references.kind!=Environment"
|
|
298
|
-
});
|
|
299
|
-
if (!allEnvs) throw Error(envMessages.getEnvironmentsError);
|
|
300
|
-
let askReferencedEnvironments = true;
|
|
301
|
-
const selectedRefEnv = envInfo.referencedEnvironments ? [...envInfo.referencedEnvironments] : [];
|
|
302
|
-
const envFilter = name => {
|
|
303
|
-
return !(selectedRefEnv !== null && selectedRefEnv !== void 0 && selectedRefEnv.includes(name)) && name != envInfo.name;
|
|
304
|
-
};
|
|
305
|
-
while (askReferencedEnvironments) {
|
|
306
|
-
let selectedEnv = await (0, _basicPrompts.askList)({
|
|
307
|
-
msg: envMessages.selectReferencedEnvironment,
|
|
308
|
-
choices: [...allEnvs.filter(e => envFilter(e.name)).map(e => e.name).sort((n, m) => n.localeCompare(m))]
|
|
309
|
-
});
|
|
310
|
-
selectedRefEnv.push(selectedEnv);
|
|
311
|
-
askReferencedEnvironments = (await (0, _basicPrompts.askList)({
|
|
312
|
-
msg: envMessages.selectMoreRefEnv,
|
|
313
|
-
default: _types.YesNo.No,
|
|
314
|
-
choices: _types.YesNoChoices
|
|
315
|
-
})) === _types.YesNo.Yes;
|
|
316
|
-
}
|
|
317
|
-
return selectedRefEnv;
|
|
318
|
-
};
|
|
319
|
-
exports.askReferencedEnvironments = askReferencedEnvironments;
|
|
320
|
-
const askK8sClusterName = async () => {
|
|
321
|
-
const name = await (0, _basicPrompts.askInput)({
|
|
322
|
-
msg: k8sClusterMessages.enterK8sClusterName,
|
|
323
|
-
defaultValue: cliNowString,
|
|
324
|
-
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateRegex)(_regex.resourceRegex, (0, _regex.invalidResourceMsg)('K8sCluster')))
|
|
325
|
-
});
|
|
326
|
-
return name;
|
|
327
|
-
};
|
|
328
|
-
exports.askK8sClusterName = askK8sClusterName;
|
|
329
|
-
const askAgentName = async (client, defsManager, agentType, scopeName) => {
|
|
330
|
-
var _agents;
|
|
331
|
-
let resourceType;
|
|
332
|
-
let resourceShortName;
|
|
333
|
-
let msg;
|
|
334
|
-
switch (agentType) {
|
|
335
|
-
case _types.AgentTypes.da:
|
|
336
|
-
{
|
|
337
|
-
resourceType = 'DiscoveryAgent';
|
|
338
|
-
resourceShortName = 'da';
|
|
339
|
-
msg = agentMessages.enterDiscoveryAgentName;
|
|
340
|
-
break;
|
|
341
|
-
}
|
|
342
|
-
case _types.AgentTypes.ta:
|
|
343
|
-
{
|
|
344
|
-
resourceType = 'TraceabilityAgent';
|
|
345
|
-
resourceShortName = 'ta';
|
|
346
|
-
msg = agentMessages.enterTraceabilityAgentName;
|
|
347
|
-
break;
|
|
348
|
-
}
|
|
349
|
-
case _types.AgentTypes.ca:
|
|
350
|
-
{
|
|
351
|
-
resourceType = 'ComplianceAgent';
|
|
352
|
-
resourceShortName = 'ca';
|
|
353
|
-
msg = agentMessages.enterComplianceAgentName;
|
|
354
|
-
break;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
let {
|
|
358
|
-
data: agents
|
|
359
|
-
} = await (0, _getters.getListByResource)({
|
|
360
|
-
client,
|
|
361
|
-
defsManager,
|
|
362
|
-
resourceType,
|
|
363
|
-
resourceShortName,
|
|
364
|
-
scopeName
|
|
365
|
-
});
|
|
366
|
-
// if there are no agents scoped to the env, make the agents list blank to validate against
|
|
367
|
-
agents = (_agents = agents) !== null && _agents !== void 0 ? _agents : [];
|
|
368
|
-
const name = await (0, _basicPrompts.askInput)({
|
|
369
|
-
msg: msg,
|
|
370
|
-
defaultValue: cliNowString,
|
|
371
|
-
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateInputIsNew)(agents.map(a => a.name), agentMessages.agentAlreadyExists), (0, _basicPrompts.validateRegex)(_regex.resourceRegex, (0, _regex.invalidResourceMsg)(resourceType)))
|
|
372
|
-
});
|
|
373
|
-
return name;
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* @description Create a secret that contains a public & private key pair for agents to connect to central.
|
|
378
|
-
* If a user is creating a new service account, then the keys should be passed in as args.
|
|
379
|
-
* If they are using an existing account, then the user will be prompted for the keys that created the service account.
|
|
380
|
-
* @param namespace The namespace to create the secret in.
|
|
381
|
-
* @param secretName The name of the secret.
|
|
382
|
-
* @param publicKey The file path to the public key attached to the chosen service account.
|
|
383
|
-
* @param privateKey The file path to the corresponding private key.
|
|
384
|
-
*/
|
|
385
|
-
exports.askAgentName = askAgentName;
|
|
386
|
-
const createAmplifyAgentKeysSecret = async (namespace, secretName, publicKeyName, publicKey, privateKeyName, privateKey) => {
|
|
387
|
-
const {
|
|
388
|
-
error
|
|
389
|
-
} = await _Kubectl.kubectl.create('secret', `-n ${namespace} generic ${secretName} --from-file=${publicKeyName}=${publicKey} --from-file=${privateKeyName}=${privateKey} --from-literal=password=""`);
|
|
390
|
-
if (error) throw new Error(error);
|
|
391
|
-
console.log(`Created ${secretName} in the ${namespace} namespace.`);
|
|
392
|
-
};
|
|
393
|
-
exports.createAmplifyAgentKeysSecret = createAmplifyAgentKeysSecret;
|
|
394
|
-
const createNamespace = async namespace => {
|
|
395
|
-
const res = await _Kubectl.kubectl.create('ns', namespace);
|
|
396
|
-
if (res.error) throw new Error(res.error);
|
|
397
|
-
console.log(`Created namespace ${namespace}.`);
|
|
398
|
-
return namespace;
|
|
399
|
-
};
|
|
400
|
-
exports.createNamespace = createNamespace;
|
|
401
|
-
const createGatewayAgentCredsSecret = async (namespace, secretName, apiManagerAuthUser, apiManagerAuthPass, apiGatewayAuthUser, apiGatewayAuthPass) => {
|
|
402
|
-
const {
|
|
403
|
-
error
|
|
404
|
-
} = await _Kubectl.kubectl.create('secret', `-n ${namespace} generic ${secretName} \
|
|
405
|
-
--from-literal=APIMANAGER_AUTH_USERNAME=${apiManagerAuthUser} \
|
|
406
|
-
--from-literal=APIMANAGER_AUTH_PASSWORD=${apiManagerAuthPass} \
|
|
407
|
-
--from-literal=APIGATEWAY_AUTH_USERNAME=${apiGatewayAuthUser} \
|
|
408
|
-
--from-literal=APIGATEWAY_AUTH_PASSWORD=${apiGatewayAuthPass}`);
|
|
409
|
-
if (error) {
|
|
410
|
-
throw Error(error);
|
|
411
|
-
}
|
|
412
|
-
console.log(`Created ${secretName} in the ${namespace} namespace.`);
|
|
413
|
-
};
|
|
414
|
-
exports.createGatewayAgentCredsSecret = createGatewayAgentCredsSecret;
|
|
415
|
-
const askPublicKeyPath = async () => await (0, _basicPrompts.askInput)({
|
|
416
|
-
msg: enterPublicKeyPath,
|
|
417
|
-
defaultValue: 'public_key.pem'
|
|
418
|
-
});
|
|
419
|
-
exports.askPublicKeyPath = askPublicKeyPath;
|
|
420
|
-
const askPrivateKeyPath = async () => await (0, _basicPrompts.askInput)({
|
|
421
|
-
msg: enterPrivateKeyPath,
|
|
422
|
-
defaultValue: 'private_key.pem'
|
|
423
|
-
});
|
|
424
|
-
exports.askPrivateKeyPath = askPrivateKeyPath;
|
|
425
|
-
const askPublicAndPrivateKeysPath = async () => {
|
|
426
|
-
console.log(_chalk.default.yellow('Please provide the same "private_key.pem" and "public_key.pem" that was used to create the selected Service Account.'));
|
|
427
|
-
const publicKey = await askPublicKeyPath();
|
|
428
|
-
const privateKey = await askPrivateKeyPath();
|
|
429
|
-
return [publicKey, privateKey];
|
|
430
|
-
};
|
|
431
|
-
exports.askPublicAndPrivateKeysPath = askPublicAndPrivateKeysPath;
|
|
432
|
-
const askKeyValuePairLoop = async (msg, keyLabel, validateFunc) => {
|
|
433
|
-
let key = "non-empty";
|
|
434
|
-
let map = new Map();
|
|
435
|
-
console.log(_chalk.default.cyan(msg));
|
|
436
|
-
while (key != "") {
|
|
437
|
-
key = await (0, _basicPrompts.askInput)({
|
|
438
|
-
msg: `Enter the ${keyLabel} name`,
|
|
439
|
-
allowEmptyInput: true,
|
|
440
|
-
validate: validateFunc
|
|
441
|
-
});
|
|
442
|
-
if (key === "") {
|
|
443
|
-
return map;
|
|
444
|
-
}
|
|
445
|
-
let value = await (0, _basicPrompts.askInput)({
|
|
446
|
-
msg: `Enter the ${keyLabel} value`
|
|
447
|
-
});
|
|
448
|
-
map.set(key, value);
|
|
449
|
-
}
|
|
450
|
-
return map;
|
|
451
|
-
};
|
|
452
|
-
exports.askKeyValuePairLoop = askKeyValuePairLoop;
|
|
453
|
-
const askArrayLoop = async msg => {
|
|
454
|
-
let value = "non-empty";
|
|
455
|
-
let array = [];
|
|
456
|
-
console.log(_chalk.default.gray(msg));
|
|
457
|
-
while (value != "") {
|
|
458
|
-
value = await (0, _basicPrompts.askInput)({
|
|
459
|
-
msg: "Enter the value",
|
|
460
|
-
allowEmptyInput: true
|
|
461
|
-
});
|
|
462
|
-
if (value === "") {
|
|
463
|
-
return array;
|
|
464
|
-
}
|
|
465
|
-
array.push(value);
|
|
466
|
-
}
|
|
467
|
-
return array;
|
|
468
|
-
};
|
|
469
|
-
exports.askArrayLoop = askArrayLoop;
|
|
470
|
-
const addIdentityProvider = async () => {
|
|
471
|
-
let providedIDPs = [];
|
|
472
|
-
let providedIDPAuths = [];
|
|
473
|
-
while ((await (0, _basicPrompts.askList)({
|
|
474
|
-
msg: idpMessages.addIDP,
|
|
475
|
-
choices: _types.YesNoChoices,
|
|
476
|
-
default: _types.YesNo.Yes
|
|
477
|
-
})) === _types.YesNo.Yes) {
|
|
478
|
-
console.log("starting IDP Configuration process");
|
|
479
|
-
let idpConfig = new _types.IDPConfiguration();
|
|
480
|
-
idpConfig = await askForIDPConfiguration(idpConfig);
|
|
481
|
-
providedIDPs.push(idpConfig);
|
|
482
|
-
let idpAuthConfig = new _types.IDPAuthConfiguration();
|
|
483
|
-
idpAuthConfig = await askForIDPAuthConfiguration(idpAuthConfig);
|
|
484
|
-
providedIDPAuths.push(idpAuthConfig);
|
|
485
|
-
}
|
|
486
|
-
return [providedIDPs, providedIDPAuths];
|
|
487
|
-
};
|
|
488
|
-
exports.addIdentityProvider = addIdentityProvider;
|
|
489
|
-
const askForIDPAuthAccessToken = async idpAuth => {
|
|
490
|
-
console.log(_chalk.default.gray('gathering the access token auth configuration'));
|
|
491
|
-
idpAuth.token = await (0, _basicPrompts.askInput)({
|
|
492
|
-
msg: idpMessages.enterToken
|
|
493
|
-
});
|
|
494
|
-
return idpAuth;
|
|
495
|
-
};
|
|
496
|
-
const askForIDPAuthClientSecret = async idpAuth => {
|
|
497
|
-
console.log(_chalk.default.gray('gathering the client secret auth configuration'));
|
|
498
|
-
idpAuth.authMethod = await (0, _basicPrompts.askList)({
|
|
499
|
-
msg: idpMessages.selectClientSecretAuthMethod,
|
|
500
|
-
choices: [{
|
|
501
|
-
name: _types.IDPClientSecretAuthMethod.ClientSecretBasic,
|
|
502
|
-
value: _types.IDPClientSecretAuthMethod.ClientSecretBasic
|
|
503
|
-
}, {
|
|
504
|
-
name: _types.IDPClientSecretAuthMethod.ClientSecretPost,
|
|
505
|
-
value: _types.IDPClientSecretAuthMethod.ClientSecretPost
|
|
506
|
-
}, {
|
|
507
|
-
name: _types.IDPClientSecretAuthMethod.ClientSecretJWT,
|
|
508
|
-
value: _types.IDPClientSecretAuthMethod.ClientSecretJWT
|
|
509
|
-
}]
|
|
510
|
-
});
|
|
511
|
-
idpAuth.clientID = await (0, _basicPrompts.askInput)({
|
|
512
|
-
msg: idpMessages.enterClientID
|
|
513
|
-
});
|
|
514
|
-
idpAuth.clientSecret = await (0, _basicPrompts.askInput)({
|
|
515
|
-
msg: idpMessages.enterClientSecret
|
|
516
|
-
});
|
|
517
|
-
idpAuth.clientScopes = await idpTestables.askArrayLoop(idpMessages.enterClientScopes);
|
|
518
|
-
return idpAuth;
|
|
519
|
-
};
|
|
520
|
-
const askForIDPConfiguration = async idpConfigValues => {
|
|
521
|
-
console.log(_chalk.default.gray('gathering idp configuration for azure'));
|
|
522
|
-
idpConfigValues.title = await (0, _basicPrompts.askInput)({
|
|
523
|
-
msg: idpMessages.enterTitle
|
|
524
|
-
});
|
|
525
|
-
idpConfigValues.type = await (0, _basicPrompts.askList)({
|
|
526
|
-
msg: idpMessages.selectType,
|
|
527
|
-
choices: [{
|
|
528
|
-
name: _types.IDPType.Generic,
|
|
529
|
-
value: _types.IDPType.Generic
|
|
530
|
-
}, {
|
|
531
|
-
name: _types.IDPType.KeyCloak,
|
|
532
|
-
value: _types.IDPType.KeyCloak
|
|
533
|
-
}, {
|
|
534
|
-
name: _types.IDPType.Okta,
|
|
535
|
-
value: _types.IDPType.Okta
|
|
536
|
-
}]
|
|
537
|
-
});
|
|
538
|
-
idpConfigValues.metadataURL = await (0, _basicPrompts.askInput)({
|
|
539
|
-
msg: idpMessages.enterMetadataURL,
|
|
540
|
-
validate: (0, _basicPrompts.validateRegex)(_regex.GitLabRegexPatterns.gitLabBaseURLRegex, 'metadataURL must have a valid URL format')
|
|
541
|
-
});
|
|
542
|
-
idpConfigValues.requestHeaders = await idpTestables.askKeyValuePairLoop(idpMessages.provideReqHeadersRegistration, "request header", (0, _basicPrompts.validateRegex)(_regex.keyFromKeyValuePairRegex, 'Please enter a valid value'));
|
|
543
|
-
idpConfigValues.queryParameters = await idpTestables.askKeyValuePairLoop(idpMessages.provideQueryParamsRegistration, "query parameter", (0, _basicPrompts.validateRegex)(_regex.keyFromKeyValuePairRegex, 'Please enter a valid value'));
|
|
544
|
-
idpConfigValues.clientProperties = await idpTestables.askKeyValuePairLoop(idpMessages.provideClientProperties, "client property", (0, _basicPrompts.validateRegex)(_regex.keyFromKeyValuePairRegex, 'Please enter a valid value'));
|
|
545
|
-
idpConfigValues.clientTimeout = await (0, _basicPrompts.askInput)({
|
|
546
|
-
type: 'number',
|
|
547
|
-
msg: idpMessages.enterClientTimeout,
|
|
548
|
-
validate: (0, _basicPrompts.validateValueRange)(30, 600),
|
|
549
|
-
defaultValue: 60,
|
|
550
|
-
allowEmptyInput: true
|
|
551
|
-
});
|
|
552
|
-
return idpConfigValues;
|
|
553
|
-
};
|
|
554
|
-
exports.askForIDPConfiguration = askForIDPConfiguration;
|
|
555
|
-
const askForIDPAuthConfiguration = async idpConfigValues => {
|
|
556
|
-
console.log(_chalk.default.gray('gathering idp auth configuration for azure'));
|
|
557
|
-
idpConfigValues.authType = await (0, _basicPrompts.askList)({
|
|
558
|
-
msg: idpMessages.selectAuthType,
|
|
559
|
-
choices: [{
|
|
560
|
-
name: _types.IDPAuthType.AccessToken,
|
|
561
|
-
value: _types.IDPAuthType.AccessToken
|
|
562
|
-
}, {
|
|
563
|
-
name: _types.IDPAuthType.ClientSecret,
|
|
564
|
-
value: _types.IDPAuthType.ClientSecret
|
|
565
|
-
}]
|
|
566
|
-
});
|
|
567
|
-
log(idpConfigValues.authType);
|
|
568
|
-
switch (idpConfigValues.authType) {
|
|
569
|
-
case _types.IDPAuthType.AccessToken:
|
|
570
|
-
{
|
|
571
|
-
let auth = new _types.IDPAuthAccessToken();
|
|
572
|
-
idpConfigValues.authConfig = await askForIDPAuthAccessToken(auth);
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
case _types.IDPAuthType.ClientSecret:
|
|
576
|
-
{
|
|
577
|
-
let auth = new _types.IDPAuthClientSecret();
|
|
578
|
-
idpConfigValues.authConfig = await askForIDPAuthClientSecret(auth);
|
|
579
|
-
break;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
idpConfigValues.requestHeaders = await idpTestables.askKeyValuePairLoop(idpMessages.provideReqHeadersForTokenFetch, "request header", (0, _basicPrompts.validateRegex)(_regex.keyFromKeyValuePairRegex, 'Please enter a valid value'));
|
|
583
|
-
idpConfigValues.queryParameters = await idpTestables.askKeyValuePairLoop(idpMessages.provideQueryParamsForTokenFetch, "query parameter", (0, _basicPrompts.validateRegex)(_regex.keyFromKeyValuePairRegex, 'Please enter a valid value'));
|
|
584
|
-
return idpConfigValues;
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
// exported inside another object because we want to mock this function when testing
|
|
588
|
-
exports.askForIDPAuthConfiguration = askForIDPAuthConfiguration;
|
|
589
|
-
const idpTestables = exports.idpTestables = {
|
|
590
|
-
addIdentityProvider,
|
|
591
|
-
askKeyValuePairLoop,
|
|
592
|
-
askArrayLoop
|
|
593
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.resourceRegex = exports.namespaceRegex = exports.maskingRegex = exports.keyFromKeyValuePairRegex = exports.invalidResourceMsg = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.WSO2RegexPatterns = exports.KafkaRegexPatterns = exports.GitLabRegexPatterns = exports.GitHubRegexPatterns = exports.AzureRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0;
|
|
7
|
-
const resourceRegex = exports.resourceRegex = '^(?:[a-z0-9]*(?:\\.(?=[a-z0-9])|-+(?=[a-z0-9]))?)+[a-z0-9]$';
|
|
8
|
-
const namespaceRegex = exports.namespaceRegex = '^[a-z0-9]?(?:[-a-z0-9]*[a-z0-9]){1,100}?$';
|
|
9
|
-
const domainNameRegex = exports.domainNameRegex = '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)+([A-Za-z]){2,}$';
|
|
10
|
-
const dosaRegex = exports.dosaRegex = '^[\\w\\s-()[\\]]{1,100}$';
|
|
11
|
-
const frequencyRegex = exports.frequencyRegex = '^(\\d*[d])?(\\d*[h])?(\\d*[m])?$|^$';
|
|
12
|
-
const maskingRegex = exports.maskingRegex = '^[a-zA-Z0-9-*#^~.{}]{0,5}$';
|
|
13
|
-
const keyFromKeyValuePairRegex = exports.keyFromKeyValuePairRegex = '^[A-Za-z]+[_\-\w]+$';
|
|
14
|
-
const invalidDosaName = exports.invalidDosaName = 'Account name can contain A-z 0-9 _ - ( ) [ ] and can include 1-100 characters.';
|
|
15
|
-
const invalidNamespace = exports.invalidNamespace = `Namespace must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character, and be fewer than 100 characters long.`;
|
|
16
|
-
const invalidDomainName = exports.invalidDomainName = 'The host must be valid according to RFC 1123 specification';
|
|
17
|
-
const invalidResourceMsg = resource => {
|
|
18
|
-
return `${resource} must consist of lower case alphanumeric characters, ' - ' or '.', and be fewer than 100 characters long`;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// AWSRegexPatterns - regex patters to validate user inputs
|
|
22
|
-
exports.invalidResourceMsg = invalidResourceMsg;
|
|
23
|
-
const AWSRegexPatterns = exports.AWSRegexPatterns = {
|
|
24
|
-
AWS_REGEXP: '^[0-9A-Za-z\\.\\-_]*(?<!/\\.)$',
|
|
25
|
-
AWS_REGEXP_LOG_GROUP_NAME: '^[0-9A-Za-z\\.\\-_]*(?<!/\\.)$|^$',
|
|
26
|
-
AWS_REGEXP_VPC_ID: '^vpc-[0-9a-z]*$|^$',
|
|
27
|
-
AWS_REGEXP_SECURITY_GROUP: '^sg-[0-9a-z]*$|^$',
|
|
28
|
-
AWS_REGEXP_SUBNET: '^subnet-[0-9a-z]*$|^$',
|
|
29
|
-
AWS_REGEXP_SSH_LOCATION: '^\\d{1,3}(\\.\\d{1,3}){3}\\/\\d{1,2}$',
|
|
30
|
-
AWS_REGEXP_ACCESS_KEY_ID: '((?:ASIA|AKIA|AROA|AIDA)([A-Z0-7]{16}))',
|
|
31
|
-
AWS_REGEXP_SECRET_ACCESS_KEY: '[a-zA-Z0-9+/]{40}',
|
|
32
|
-
AWS_REGEXP_ROLE_ARN: '^arn:aws[a-zA-Z-]*:iam::\\d{12}:role\\/?[a-zA-Z0-9+=,.@\\-_\\/]{1,128}$',
|
|
33
|
-
AWS_ACCESS_LOG_ARN: '^arn:aws[a-zA-Z-]*:logs:[a-zA-Z0-9\-]*:\\d{12}:log-group:[a-zA-Z0-9_\\-\\/\\.#]{1,512}$'
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// APIGEEXRegexPatterns - regex patters to validate user inputs
|
|
37
|
-
const APIGEEXRegexPatterns = exports.APIGEEXRegexPatterns = {
|
|
38
|
-
APIGEEX_REGEXP_PROJECT_ID: '^[a-z][a-z0-9-]{4,28}[a-z0-9]$',
|
|
39
|
-
APIGEEX_REGEXP_EMAIL_ADDRESS: '^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// AzureRegexPatterns - regex patters to validate user inputs
|
|
43
|
-
const AzureRegexPatterns = exports.AzureRegexPatterns = {
|
|
44
|
-
azureApiManagementServiceNameRegex: '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$',
|
|
45
|
-
azureEventHubConsumerGroupRegex: '^[a-zA-Z0-9$][a-zA-Z0-9._\-]{0,48}[a-zA-Z0-9]$'
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// GitHubRegexPatterns - regex patters to validate user inputs
|
|
49
|
-
const GitHubRegexPatterns = exports.GitHubRegexPatterns = {
|
|
50
|
-
gitHubAccessTokenRegex: '^ghp_[a-zA-Z0-9]{36}$',
|
|
51
|
-
gitHubRepositoryOwnerRegex: '^(?!-)(?!.*--)[a-zA-Z0-9-]{1,37}(?<!-)$',
|
|
52
|
-
gitHubRepositoryNameRegex: '^[\\w-\\.]+$',
|
|
53
|
-
gitHubFilePathRegex: '^\/.*$'
|
|
54
|
-
};
|
|
55
|
-
const GitLabRegexPatterns = exports.GitLabRegexPatterns = {
|
|
56
|
-
gitLabAccessTokenRegex: '^[0-9a-zA-Z\-]{20}$',
|
|
57
|
-
gitLabBaseURLRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$',
|
|
58
|
-
gitHubRepositoryIDRegex: '^[0-9]*$',
|
|
59
|
-
gitLabPathRegex: '^\/.*$'
|
|
60
|
-
};
|
|
61
|
-
const KafkaRegexPatterns = exports.KafkaRegexPatterns = {
|
|
62
|
-
bootstrapServerRegex: '^(SASL_SSL:\/\/|SASL_PLAINTEXT:\/\/|PLAINTEXT:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z0-9]{1,5}(:[0-9]{1,5})$',
|
|
63
|
-
urlRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$'
|
|
64
|
-
};
|
|
65
|
-
const WSO2RegexPatterns = exports.WSO2RegexPatterns = {
|
|
66
|
-
wso2BaseURLRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$'
|
|
67
|
-
};
|