@axway/axway-central-cli 3.1.0 → 3.2.0-rc.1
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.
|
@@ -29,6 +29,7 @@ var kafkaAgents = _interopRequireWildcard(require("./kafkaAgents"));
|
|
|
29
29
|
var swaggerHubAgents = _interopRequireWildcard(require("./swaggerHubSaasAgents"));
|
|
30
30
|
var graylogAgent = _interopRequireWildcard(require("./graylogAgent"));
|
|
31
31
|
var ibmAPIConnectAgent = _interopRequireWildcard(require("./ibmAPIConnectAgents"));
|
|
32
|
+
var traceableAgent = _interopRequireWildcard(require("./traceableAgents"));
|
|
32
33
|
var platform = _interopRequireWildcard(require("./platform"));
|
|
33
34
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
34
35
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -50,7 +51,8 @@ const agentInstallFlows = {
|
|
|
50
51
|
[_types.GatewayTypes.ISTIO]: istioAgents.IstioInstallMethods,
|
|
51
52
|
[_types.GatewayTypes.KAFKA]: kafkaAgents.KafkaInstallMethods,
|
|
52
53
|
[_types.GatewayTypes.GRAYLOG]: graylogAgent.GraylogInstallMethods,
|
|
53
|
-
[_types.GatewayTypes.IBMAPICONNECT]: ibmAPIConnectAgent.IBMAPIConnectInstallMethods
|
|
54
|
+
[_types.GatewayTypes.IBMAPICONNECT]: ibmAPIConnectAgent.IBMAPIConnectInstallMethods,
|
|
55
|
+
[_types.GatewayTypes.TRACEABLE]: traceableAgent.TraceableInstallMethods
|
|
54
56
|
};
|
|
55
57
|
const saasAgentInstallFlows = {
|
|
56
58
|
[_types.SaaSGatewayTypes.AWS_GATEWAY]: awsSaaSAgents.AWSSaaSInstallMethods,
|
|
@@ -176,6 +176,18 @@ Object.keys(_ibmAPIConnectTemplates).forEach(function (key) {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
});
|
|
179
|
+
var _traceableTemplates = require("./templates/traceableTemplates");
|
|
180
|
+
Object.keys(_traceableTemplates).forEach(function (key) {
|
|
181
|
+
if (key === "default" || key === "__esModule") return;
|
|
182
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
183
|
+
if (key in exports && exports[key] === _traceableTemplates[key]) return;
|
|
184
|
+
Object.defineProperty(exports, key, {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
get: function () {
|
|
187
|
+
return _traceableTemplates[key];
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
179
191
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
180
192
|
const streamPipeline = exports.streamPipeline = _util.default.promisify(_stream.default.pipeline);
|
|
181
193
|
const unzip = async filePath => {
|
|
@@ -198,7 +210,8 @@ const amplifyAgentsCredsSecret = exports.amplifyAgentsCredsSecret = 'amplify-age
|
|
|
198
210
|
// configFiles - the agent config file names
|
|
199
211
|
const configFiles = exports.configFiles = {
|
|
200
212
|
DA_ENV_VARS: 'da_env_vars.env',
|
|
201
|
-
TA_ENV_VARS: 'ta_env_vars.env'
|
|
213
|
+
TA_ENV_VARS: 'ta_env_vars.env',
|
|
214
|
+
AGENT_ENV_VARS: 'agent_env_vars.env'
|
|
202
215
|
};
|
|
203
216
|
const agentsDocsUrl = exports.agentsDocsUrl = {
|
|
204
217
|
V7: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/connect_api_manager/index.html',
|
|
@@ -206,7 +219,8 @@ const agentsDocsUrl = exports.agentsDocsUrl = {
|
|
|
206
219
|
AZURE: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/connect_azure_gateway/index.html',
|
|
207
220
|
ISTIO: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/mesh_management/index.html',
|
|
208
221
|
GRAYLOG: 'https://docs.axway.com/bundle/amplify-central/page/docs/connect_manage_environ/mesh_management/index.html',
|
|
209
|
-
IBMAPICONNECT: ''
|
|
222
|
+
IBMAPICONNECT: '',
|
|
223
|
+
TRACEABLE: ''
|
|
210
224
|
};
|
|
211
225
|
|
|
212
226
|
// export * from './updaters';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.traceableHelmOverrideTemplate = exports.traceableEnvVarTemplate = exports.TraceableAgentValues = void 0;
|
|
7
|
+
var _types = require("../../../../common/types");
|
|
8
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
/**
|
|
12
|
+
* @description Parameters to provide to the Traceable handlebars templates.
|
|
13
|
+
*/
|
|
14
|
+
class TraceableAgentValues {
|
|
15
|
+
constructor() {
|
|
16
|
+
_defineProperty(this, "namespace", void 0);
|
|
17
|
+
_defineProperty(this, "traceableToken", void 0);
|
|
18
|
+
_defineProperty(this, "traceableRegion", void 0);
|
|
19
|
+
_defineProperty(this, "environments", void 0);
|
|
20
|
+
_defineProperty(this, "internalDomains", void 0);
|
|
21
|
+
_defineProperty(this, "basePathSegmentLen", void 0);
|
|
22
|
+
_defineProperty(this, "centralConfig", void 0);
|
|
23
|
+
_defineProperty(this, "traceabilityConfig", void 0);
|
|
24
|
+
this.namespace = {
|
|
25
|
+
name: '',
|
|
26
|
+
isNew: false
|
|
27
|
+
};
|
|
28
|
+
this.traceableToken = '';
|
|
29
|
+
this.traceableRegion = _types.TraceableRegionType.US;
|
|
30
|
+
this.environments = [];
|
|
31
|
+
this.internalDomains = false;
|
|
32
|
+
this.basePathSegmentLen = 2;
|
|
33
|
+
this.centralConfig = new _types.CentralAgentConfig();
|
|
34
|
+
this.traceabilityConfig = new _types.TraceabilityConfig();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @description Generates the helm override file for the Amplify Traceable Agent.
|
|
40
|
+
*/
|
|
41
|
+
exports.TraceableAgentValues = TraceableAgentValues;
|
|
42
|
+
const traceableHelmOverrideTemplate = () => {
|
|
43
|
+
return `---
|
|
44
|
+
traceable:
|
|
45
|
+
token: {{traceableToken}}
|
|
46
|
+
environments: {{environments}}
|
|
47
|
+
region: {{traceableRegion}}
|
|
48
|
+
internalDomains: {{internalDomains}}
|
|
49
|
+
basePathSegmentLen: {{basePathSegmentLen}}
|
|
50
|
+
|
|
51
|
+
env:
|
|
52
|
+
CENTRAL_REGION={{centralConfig.region}}
|
|
53
|
+
CENTRAL_ORGANIZATIONID: "{{centralConfig.orgId}}"
|
|
54
|
+
CENTRAL_TEAM: {{centralConfig.ampcTeamName}}
|
|
55
|
+
CENTRAL_ENVIRONMENT: {{centralConfig.environment}}
|
|
56
|
+
CENTRAL_AGENTNAME: {{centralConfig.taAgentName}}
|
|
57
|
+
CENTRAL_AUTH_CLIENTID: {{centralConfig.dosaAccount.clientId}}
|
|
58
|
+
TRACEABILITY_PROTOCOL: {{traceabilityConfig.protocol}}
|
|
59
|
+
`;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @description Generates the Amplify Traceable Agent env vars file.
|
|
64
|
+
*/
|
|
65
|
+
exports.traceableHelmOverrideTemplate = traceableHelmOverrideTemplate;
|
|
66
|
+
const traceableEnvVarTemplate = () => {
|
|
67
|
+
return `# Traceable configs
|
|
68
|
+
TRACEABLE_TOKEN={{traceableToken}}
|
|
69
|
+
TRACEABLE_REGION={{traceableRegion}}
|
|
70
|
+
TRACEABLE_ENVIRONMENTS={{environments}}
|
|
71
|
+
TRACEABLE_INTERNAL_DOMAINS={{internalDomains}}
|
|
72
|
+
|
|
73
|
+
# Amplify Central configs
|
|
74
|
+
CENTRAL_AGENTNAME={{centralConfig.taAgentName}}
|
|
75
|
+
CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
|
|
76
|
+
CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
|
|
77
|
+
CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
|
|
78
|
+
CENTRAL_ENVIRONMENT={{centralConfig.environment}}
|
|
79
|
+
CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
|
|
80
|
+
CENTRAL_TEAM={{centralConfig.ampcTeamName}}
|
|
81
|
+
CENTRAL_REGION={{centralConfig.region}}
|
|
82
|
+
{{#compare . traceabilityConfig.protocol "https"}}
|
|
83
|
+
TRACEABILITY_PROTOCOL={{traceabilityConfig.protocol}}
|
|
84
|
+
{{/compare}}
|
|
85
|
+
|
|
86
|
+
# Logging configs
|
|
87
|
+
# Define the logging level: info, debug, error
|
|
88
|
+
LOG_LEVEL=info
|
|
89
|
+
# Specify where to send the log: stdout, file, both
|
|
90
|
+
LOG_OUTPUT=stdout
|
|
91
|
+
# Define where the log files are written
|
|
92
|
+
LOG_FILE_PATH=logs
|
|
93
|
+
`;
|
|
94
|
+
};
|
|
95
|
+
exports.traceableEnvVarTemplate = traceableEnvVarTemplate;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.testables = exports.gatewayConnectivity = exports.completeInstall = exports.askTraceableRegion = exports.askConfigType = exports.askBundleType = exports.amplifyAgentsNs = exports.TraceableInstallMethods = exports.ConfigFiles = void 0;
|
|
7
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
+
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
+
var _Kubectl = require("../../common/Kubectl");
|
|
10
|
+
var _basicPrompts = require("../../common/basicPrompts");
|
|
11
|
+
var _inputs = require("./helpers/inputs");
|
|
12
|
+
var _types = require("../../common/types");
|
|
13
|
+
var _utils = require("../../common/utils");
|
|
14
|
+
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
15
|
+
var _traceableTemplates = require("./helpers/templates/traceableTemplates");
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
const {
|
|
21
|
+
log
|
|
22
|
+
} = (0, _snooplogg.default)('central: install: agents: Traceable');
|
|
23
|
+
const taImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.TRACEABLE_TA}`;
|
|
24
|
+
const amplifyAgentsNs = exports.amplifyAgentsNs = 'amplify-agents';
|
|
25
|
+
|
|
26
|
+
// ConfigFiles - all the config file that are used in the setup
|
|
27
|
+
const ConfigFiles = exports.ConfigFiles = {
|
|
28
|
+
helmOverride: 'agent-overrides.yaml',
|
|
29
|
+
agentEnvVars: `${helpers.configFiles.AGENT_ENV_VARS}`
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// TraceablePrompts - prompts for user inputs
|
|
33
|
+
const prompts = {
|
|
34
|
+
configTypeMsg: 'Select the mode of installation',
|
|
35
|
+
agentNamespace: 'Enter the namespace to use for the Amplify Traceable Agents',
|
|
36
|
+
enterToken: 'Enter the token that the agent will use',
|
|
37
|
+
enterRegion: 'Enter the region that the agent will use',
|
|
38
|
+
enterEnvironments: 'Enter an environment that the agent will use',
|
|
39
|
+
enterInternalDomains: 'Enter if the internal domains should be used by the agent',
|
|
40
|
+
enterBasePathSegmentLen: 'Enter the base path segment length that agent will use for lookup',
|
|
41
|
+
enterMoreEnviroments: 'Do you want to enter another environment ?'
|
|
42
|
+
};
|
|
43
|
+
const askBundleType = async () => {
|
|
44
|
+
return _types.BundleType.TRACEABILITY;
|
|
45
|
+
};
|
|
46
|
+
exports.askBundleType = askBundleType;
|
|
47
|
+
const askConfigType = async () => {
|
|
48
|
+
return await (0, _basicPrompts.askList)({
|
|
49
|
+
msg: prompts.configTypeMsg,
|
|
50
|
+
choices: [_types.AgentConfigTypes.DOCKERIZED, _types.AgentConfigTypes.HELM]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
//
|
|
55
|
+
// Questions for the configuration of Traceable agent
|
|
56
|
+
//
|
|
57
|
+
exports.askConfigType = askConfigType;
|
|
58
|
+
const askToken = async () => await (0, _basicPrompts.askInput)({
|
|
59
|
+
msg: prompts.enterToken,
|
|
60
|
+
allowEmptyInput: false
|
|
61
|
+
});
|
|
62
|
+
const askTraceableRegion = async () => {
|
|
63
|
+
return await (0, _basicPrompts.askList)({
|
|
64
|
+
msg: prompts.enterRegion,
|
|
65
|
+
choices: Object.entries(_types.TraceableRegionType).reduce((accumulator, curr) => {
|
|
66
|
+
return accumulator.concat({
|
|
67
|
+
name: curr[0],
|
|
68
|
+
value: curr[1]
|
|
69
|
+
});
|
|
70
|
+
}, []),
|
|
71
|
+
default: _types.TraceableRegionType.US
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
exports.askTraceableRegion = askTraceableRegion;
|
|
75
|
+
const askEnvironments = async () => {
|
|
76
|
+
let askEnvs = true;
|
|
77
|
+
let envs = [];
|
|
78
|
+
console.log(_chalk.default.gray("An array of environments that the agent will use"));
|
|
79
|
+
while (askEnvs) {
|
|
80
|
+
const env = await (0, _basicPrompts.askInput)({
|
|
81
|
+
msg: prompts.enterEnvironments,
|
|
82
|
+
allowEmptyInput: true
|
|
83
|
+
});
|
|
84
|
+
if (envs.length === 0 && env.toString().trim() === "") {
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (env && env.toString().trim() !== "") {
|
|
88
|
+
envs.push(env);
|
|
89
|
+
}
|
|
90
|
+
askEnvs = (await (0, _basicPrompts.askList)({
|
|
91
|
+
msg: prompts.enterMoreEnviroments,
|
|
92
|
+
default: _types.YesNo.No,
|
|
93
|
+
choices: _types.YesNoChoices
|
|
94
|
+
})) === _types.YesNo.Yes;
|
|
95
|
+
}
|
|
96
|
+
return envs;
|
|
97
|
+
};
|
|
98
|
+
const askInternalDomains = async () => (await (0, _basicPrompts.askList)({
|
|
99
|
+
msg: prompts.enterInternalDomains,
|
|
100
|
+
default: _types.YesNo.No,
|
|
101
|
+
choices: _types.YesNoChoices
|
|
102
|
+
})) === _types.YesNo.Yes;
|
|
103
|
+
const askBasePathSegmentLen = async () => await (0, _basicPrompts.askInput)({
|
|
104
|
+
msg: prompts.enterBasePathSegmentLen,
|
|
105
|
+
type: 'number',
|
|
106
|
+
defaultValue: 2
|
|
107
|
+
});
|
|
108
|
+
const gatewayConnectivity = async installConfig => {
|
|
109
|
+
let traceableAgentValues = new _traceableTemplates.TraceableAgentValues();
|
|
110
|
+
if (installConfig.switches.isHelmInstall) {
|
|
111
|
+
console.log(_chalk.default.gray(`The Amplify Traceable Agent needs to be deployed to your Kubernetes cluster to discover APIs for publishing to Amplify Central.`));
|
|
112
|
+
const {
|
|
113
|
+
error
|
|
114
|
+
} = await _Kubectl.kubectl.isInstalled();
|
|
115
|
+
if (error) {
|
|
116
|
+
throw new Error(`Kubectl is required to fill out the following prompts. It appears to be missing or misconfigured.\n${error}`);
|
|
117
|
+
}
|
|
118
|
+
traceableAgentValues.namespace = await (0, _inputs.askNamespace)(prompts.agentNamespace, amplifyAgentsNs);
|
|
119
|
+
}
|
|
120
|
+
if (installConfig.switches.isDockerInstall) {
|
|
121
|
+
console.log('\nCONNECTION TO TRACEABLE API GATEWAY:');
|
|
122
|
+
console.log(_chalk.default.gray("The Discovery Agent needs to connect to the Traceable API Gateway to discover API's for publishing to Amplify Central."));
|
|
123
|
+
}
|
|
124
|
+
traceableAgentValues.traceableToken = await askToken();
|
|
125
|
+
traceableAgentValues.traceableRegion = await askTraceableRegion();
|
|
126
|
+
traceableAgentValues.environments = await askEnvironments();
|
|
127
|
+
traceableAgentValues.internalDomains = await askInternalDomains();
|
|
128
|
+
traceableAgentValues.basePathSegmentLen = await askBasePathSegmentLen();
|
|
129
|
+
return traceableAgentValues;
|
|
130
|
+
};
|
|
131
|
+
exports.gatewayConnectivity = gatewayConnectivity;
|
|
132
|
+
const dockerSuccessMsg = installConfig => {
|
|
133
|
+
let dockerInfo;
|
|
134
|
+
const runAgentLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.AGENT_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
|
|
135
|
+
const runAgentWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.AGENT_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
|
|
136
|
+
const startAgentLinuxMsg = `\nStart the Traceable Agent on a Linux based machine`;
|
|
137
|
+
const startAgentWinMsg = `\nStart the Traceable Agent on a Windows machine`;
|
|
138
|
+
if (installConfig.switches.isTaEnabled) {
|
|
139
|
+
dockerInfo = `To utilize the agent, pull the latest Docker image and run it using the appropriate supplied environment file, (${helpers.configFiles.AGENT_ENV_VARS}):`;
|
|
140
|
+
console.log(_chalk.default.whiteBright(dockerInfo), '\n');
|
|
141
|
+
const taImageVersion = `${taImage}:${installConfig.taVersion}`;
|
|
142
|
+
console.log(_chalk.default.white('Pull the latest image of the Agent:'));
|
|
143
|
+
console.log(_chalk.default.cyan(`docker pull ${taImageVersion}`));
|
|
144
|
+
console.log(_chalk.default.white(_utils.isWindows ? startAgentWinMsg : startAgentLinuxMsg));
|
|
145
|
+
console.log(_chalk.default.cyan(_utils.isWindows ? runAgentWinMsg : runAgentLinuxMsg));
|
|
146
|
+
console.log('\t', _chalk.default.cyan(`-v /data ${taImageVersion}`), '\n');
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const helmSuccessMsg = namespace => {
|
|
150
|
+
console.log(`Traceable Agent override file has been placed at ${process.cwd()}/${ConfigFiles.helmOverride}`);
|
|
151
|
+
const installCmd = `helm upgrade --install --namespace ${namespace} Traceable-agent axway/Traceable-agent -f ${ConfigFiles.helmOverride}`;
|
|
152
|
+
console.log('To complete the Traceable Agent installation run the following commands:', _chalk.default.cyan('\n helm repo add axway https://helm.repository.axway.com --username=<client_id> --password=<client_secret>'), _chalk.default.cyan(`\n helm repo update\n ${installCmd}`), _chalk.default.cyan(`\n`), _chalk.default.white(`\n* client_id - service account id for your Amplify Platform organization`), _chalk.default.white(`\n* client_secret - service account secret for your Amplify Platform organization`));
|
|
153
|
+
};
|
|
154
|
+
const generateSuccessHelpMsg = installConfig => {
|
|
155
|
+
const traceableAgentValues = installConfig.gatewayConfig;
|
|
156
|
+
const configType = installConfig.deploymentType;
|
|
157
|
+
if (installConfig.centralConfig.ampcDosaInfo.isNew && !installConfig.switches.isHelmInstall) {
|
|
158
|
+
console.log(_chalk.default.yellow('\nPlease make sure to copy the "private_key.pem" and "public_key.pem" files for the existing service account you selected.'));
|
|
159
|
+
}
|
|
160
|
+
if (configType === _types.AgentConfigTypes.DOCKERIZED) {
|
|
161
|
+
dockerSuccessMsg(installConfig);
|
|
162
|
+
} else if (configType === _types.AgentConfigTypes.HELM) {
|
|
163
|
+
helmSuccessMsg(traceableAgentValues.namespace.name);
|
|
164
|
+
}
|
|
165
|
+
console.log('Configuration file(s) have been successfully created.\n');
|
|
166
|
+
console.log(_chalk.default.gray(`\nAdditional information about agent features can be found here:\n${helpers.agentsDocsUrl.TRACEABLE}`));
|
|
167
|
+
};
|
|
168
|
+
const completeInstall = async installConfig => {
|
|
169
|
+
// Add final settings to TraceableAgentValues
|
|
170
|
+
const traceableAgentValues = installConfig.gatewayConfig;
|
|
171
|
+
traceableAgentValues.centralConfig = installConfig.centralConfig;
|
|
172
|
+
traceableAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
|
|
173
|
+
if (installConfig.switches.isHelmInstall) {
|
|
174
|
+
if (traceableAgentValues.namespace.isNew) {
|
|
175
|
+
await helpers.createNamespace(traceableAgentValues.namespace.name);
|
|
176
|
+
}
|
|
177
|
+
await helpers.createSecret(traceableAgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, async () => {
|
|
178
|
+
if (installConfig.centralConfig.ampcDosaInfo.isNew) {
|
|
179
|
+
console.log(_chalk.default.yellow(`The secret '${helpers.amplifyAgentsKeysSecret}' will be created with the same "private_key.pem" and "public_key.pem" that was auto generated to create the Service Account.`));
|
|
180
|
+
}
|
|
181
|
+
await helpers.createAmplifyAgentKeysSecret(traceableAgentValues.namespace.name, helpers.amplifyAgentsKeysSecret, 'publicKey', traceableAgentValues.centralConfig.dosaAccount.publicKey, 'privateKey', traceableAgentValues.centralConfig.dosaAccount.privateKey);
|
|
182
|
+
});
|
|
183
|
+
await helpers.createSecret(traceableAgentValues.namespace.name, helpers.amplifyAgentsCredsSecret, async () => {
|
|
184
|
+
await createTraceableCredsSecret(traceableAgentValues.namespace.name, helpers.amplifyAgentsCredsSecret, traceableAgentValues.traceableToken);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
console.log('Generating the configuration file(s)...');
|
|
188
|
+
if (installConfig.switches.isDockerInstall) {
|
|
189
|
+
if (installConfig.switches.isTaEnabled) {
|
|
190
|
+
(0, _utils.writeTemplates)(ConfigFiles.agentEnvVars, traceableAgentValues, helpers.traceableEnvVarTemplate);
|
|
191
|
+
}
|
|
192
|
+
} else if (installConfig.switches.isHelmInstall) {
|
|
193
|
+
(0, _utils.writeTemplates)(ConfigFiles.helmOverride, traceableAgentValues, helpers.traceableHelmOverrideTemplate);
|
|
194
|
+
}
|
|
195
|
+
generateSuccessHelpMsg(installConfig);
|
|
196
|
+
};
|
|
197
|
+
exports.completeInstall = completeInstall;
|
|
198
|
+
const createTraceableCredsSecret = async (namespace, secretName, token) => {
|
|
199
|
+
const {
|
|
200
|
+
error
|
|
201
|
+
} = await _Kubectl.kubectl.create('secret', `-n ${namespace} generic ${secretName} \
|
|
202
|
+
--from-literal=token=${token} `);
|
|
203
|
+
if (error) {
|
|
204
|
+
throw Error(error);
|
|
205
|
+
}
|
|
206
|
+
console.log(`Created ${secretName} in the ${namespace} namespace.`);
|
|
207
|
+
};
|
|
208
|
+
const TraceableInstallMethods = exports.TraceableInstallMethods = {
|
|
209
|
+
GetBundleType: askBundleType,
|
|
210
|
+
GetDeploymentType: askConfigType,
|
|
211
|
+
AskGatewayQuestions: gatewayConnectivity,
|
|
212
|
+
FinalizeGatewayInstall: completeInstall,
|
|
213
|
+
ConfigFiles: Object.values(ConfigFiles),
|
|
214
|
+
AgentNameMap: {
|
|
215
|
+
[_types.AgentTypes.da]: _types.AgentNames.TRACEABLE_TA,
|
|
216
|
+
[_types.AgentTypes.ta]: _types.AgentNames.TRACEABLE_TA
|
|
217
|
+
},
|
|
218
|
+
GatewayDisplay: _types.GatewayTypes.TRACEABLE
|
|
219
|
+
};
|
|
220
|
+
const testables = exports.testables = {
|
|
221
|
+
prompts,
|
|
222
|
+
ConfigFiles
|
|
223
|
+
};
|
package/dist/common/types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.docsUrl = exports.commonCmdArgsDescription = exports.cliVersionHeader = exports.YesNoChoices = exports.YesNo = exports.WAIT_TIMEOUT = exports.TrueFalseChoices = exports.TrueFalse = exports.TraceabilityConfig = exports.SingleEntryPointUrls = exports.SaaSGatewayTypes = exports.Regions = exports.PublicRepoUrl = exports.PublicDockerRepoBaseUrl = exports.Protocol = exports.ProdBaseUrls = exports.Platforms = exports.OutputTypes = exports.MAX_TABLE_STRING_LENGTH = exports.MAX_FILE_SIZE = exports.MAX_CACHE_FILE_SIZE = exports.LoggingSource = exports.LanguageTypes = exports.KindTypes = exports.Kind = exports.IstioProfileChoices = exports.IstioInstallValues = exports.IstioAgentValues = exports.IngestionProtocolToHosts = exports.IngestionProtocol = exports.IngestionHostsHTTP = exports.IngestionHosts = exports.IngestionHTTPHosts = exports.IDPType = exports.IDPConfiguration = exports.IDPClientSecretAuthMethod = exports.IDPAuthType = exports.IDPAuthConfiguration = exports.IDPAuthClientSecret = exports.IDPAuthAccessToken = exports.GatewayTypes = exports.GatewayTypeToDataPlane = exports.GatewayMode = exports.EnvironmentConfigInfo = exports.DosaAccount = exports.DataPlaneNames = exports.DOSAConfigInfo = exports.ConfigTypes = exports.CloudFormationConfig = exports.Certificate = exports.CentralAgentConfig = exports.CACHE_FILE_TTL_MILLISECONDS = exports.BundleType = exports.BasePaths = exports.AuthUrls = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APICDeployments = exports.ABORT_TIMEOUT = void 0;
|
|
6
|
+
exports.docsUrl = exports.commonCmdArgsDescription = exports.cliVersionHeader = exports.YesNoChoices = exports.YesNo = exports.WAIT_TIMEOUT = exports.TrueFalseChoices = exports.TrueFalse = exports.TraceableRegionType = exports.TraceabilityConfig = exports.SingleEntryPointUrls = exports.SaaSGatewayTypes = exports.Regions = exports.PublicRepoUrl = exports.PublicDockerRepoBaseUrl = exports.Protocol = exports.ProdBaseUrls = exports.Platforms = exports.OutputTypes = exports.MAX_TABLE_STRING_LENGTH = exports.MAX_FILE_SIZE = exports.MAX_CACHE_FILE_SIZE = exports.LoggingSource = exports.LanguageTypes = exports.KindTypes = exports.Kind = exports.IstioProfileChoices = exports.IstioInstallValues = exports.IstioAgentValues = exports.IngestionProtocolToHosts = exports.IngestionProtocol = exports.IngestionHostsHTTP = exports.IngestionHosts = exports.IngestionHTTPHosts = exports.IDPType = exports.IDPConfiguration = exports.IDPClientSecretAuthMethod = exports.IDPAuthType = exports.IDPAuthConfiguration = exports.IDPAuthClientSecret = exports.IDPAuthAccessToken = exports.GatewayTypes = exports.GatewayTypeToDataPlane = exports.GatewayMode = exports.EnvironmentConfigInfo = exports.DosaAccount = exports.DataPlaneNames = exports.DOSAConfigInfo = exports.ConfigTypes = exports.CloudFormationConfig = exports.Certificate = exports.CentralAgentConfig = exports.CACHE_FILE_TTL_MILLISECONDS = exports.BundleType = exports.BasePaths = exports.AuthUrls = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APICDeployments = exports.ABORT_TIMEOUT = void 0;
|
|
7
7
|
var _dataService = require("./dataService");
|
|
8
8
|
var _utils = require("./utils");
|
|
9
9
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -235,6 +235,7 @@ let AgentNames = exports.AgentNames = /*#__PURE__*/function (AgentNames) {
|
|
|
235
235
|
AgentNames["GRAYLOG_TA"] = "graylog-agent";
|
|
236
236
|
AgentNames["IBMAPICONNECT_DA"] = "ibm-apiconnect-discovery-agent";
|
|
237
237
|
AgentNames["IBMAPICONNECT_TA"] = "ibm-apiconnect-traceability-agent";
|
|
238
|
+
AgentNames["TRACEABLE_TA"] = "traceable-agent";
|
|
238
239
|
return AgentNames;
|
|
239
240
|
}({});
|
|
240
241
|
let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) {
|
|
@@ -247,6 +248,7 @@ let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) {
|
|
|
247
248
|
GatewayTypes["KAFKA"] = "Kafka";
|
|
248
249
|
GatewayTypes["GRAYLOG"] = "Graylog";
|
|
249
250
|
GatewayTypes["IBMAPICONNECT"] = "IBM API Connect";
|
|
251
|
+
GatewayTypes["TRACEABLE"] = "Traceable";
|
|
250
252
|
return GatewayTypes;
|
|
251
253
|
}({});
|
|
252
254
|
let SaaSGatewayTypes = exports.SaaSGatewayTypes = /*#__PURE__*/function (SaaSGatewayTypes) {
|
|
@@ -268,6 +270,7 @@ let DataPlaneNames = exports.DataPlaneNames = /*#__PURE__*/function (DataPlaneNa
|
|
|
268
270
|
DataPlaneNames["IBMAPICONNECT"] = "APIConnect";
|
|
269
271
|
DataPlaneNames["KONG"] = "Kong";
|
|
270
272
|
DataPlaneNames["SWAGGERHUB"] = "SwaggerHub";
|
|
273
|
+
DataPlaneNames["TRACEABLE"] = "Traceable";
|
|
271
274
|
DataPlaneNames["MULESOFT"] = "Mulesoft";
|
|
272
275
|
DataPlaneNames["WSO2"] = "WSO2";
|
|
273
276
|
DataPlaneNames["OTHER"] = "Other";
|
|
@@ -285,7 +288,8 @@ const GatewayTypeToDataPlane = exports.GatewayTypeToDataPlane = {
|
|
|
285
288
|
[GatewayTypes.KAFKA]: DataPlaneNames.KAFKA,
|
|
286
289
|
[SaaSGatewayTypes.SWAGGERHUB]: DataPlaneNames.SWAGGERHUB,
|
|
287
290
|
[GatewayTypes.GRAYLOG]: DataPlaneNames.GRAYLOG,
|
|
288
|
-
[GatewayTypes.IBMAPICONNECT]: DataPlaneNames.IBMAPICONNECT
|
|
291
|
+
[GatewayTypes.IBMAPICONNECT]: DataPlaneNames.IBMAPICONNECT,
|
|
292
|
+
[GatewayTypes.TRACEABLE]: DataPlaneNames.TRACEABLE
|
|
289
293
|
};
|
|
290
294
|
let AgentResourceKind = exports.AgentResourceKind = /*#__PURE__*/function (AgentResourceKind) {
|
|
291
295
|
AgentResourceKind["da"] = "DiscoveryAgent";
|
|
@@ -738,4 +742,10 @@ let IDPAuthType = exports.IDPAuthType = /*#__PURE__*/function (IDPAuthType) {
|
|
|
738
742
|
IDPAuthType["AccessToken"] = "AccessToken";
|
|
739
743
|
IDPAuthType["ClientSecret"] = "ClientSecret";
|
|
740
744
|
return IDPAuthType;
|
|
745
|
+
}({});
|
|
746
|
+
let TraceableRegionType = exports.TraceableRegionType = /*#__PURE__*/function (TraceableRegionType) {
|
|
747
|
+
TraceableRegionType["US"] = "US";
|
|
748
|
+
TraceableRegionType["EU"] = "EU";
|
|
749
|
+
TraceableRegionType["AP"] = "AP";
|
|
750
|
+
return TraceableRegionType;
|
|
741
751
|
}({});
|