@axway/axway-central-cli 2.19.0-rc.2 → 2.19.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/README.md +3 -56
- package/dist/cli.js +0 -2
- package/dist/commands/install/agents.js +0 -2
- package/dist/commands/install/helpers/index.js +0 -12
- package/dist/commands/install/helpers/regex.js +1 -6
- package/dist/common/types.js +0 -5
- package/package.json +1 -1
- package/dist/commands/install/gitLabAgents.js +0 -174
- package/dist/commands/install/helpers/templates/gitLabTemplates.js +0 -69
- package/dist/commands/proxies/create.js +0 -73
- package/dist/commands/proxies/index.js +0 -24
- package/dist/commands/proxies/promote.js +0 -84
package/README.md
CHANGED
|
@@ -129,7 +129,6 @@ Axway CENTRAL COMMANDS:
|
|
|
129
129
|
edit Edit and update resources by using the default editor
|
|
130
130
|
get List one or more resources
|
|
131
131
|
install Install additional platform resources
|
|
132
|
-
proxies Manage API proxies
|
|
133
132
|
```
|
|
134
133
|
|
|
135
134
|
# Commands reference:
|
|
@@ -224,37 +223,11 @@ axway central config ls
|
|
|
224
223
|
|
|
225
224
|
---
|
|
226
225
|
|
|
227
|
-
|
|
226
|
+
### Proxies: create/update a proxy:
|
|
228
227
|
|
|
229
|
-
|
|
230
|
-
axway central proxies <command> [options]
|
|
231
|
-
|
|
232
|
-
PROXIES COMMANDS:
|
|
233
|
-
create
|
|
234
|
-
promote
|
|
235
|
-
|
|
236
|
-
PROXIES OPTIONS:
|
|
237
|
-
--client-id=<value> Override your DevOps account client ID
|
|
238
|
-
--json Show JSON output
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### proxies: create/update a proxy:
|
|
242
|
-
|
|
243
|
-
```text
|
|
244
|
-
axway central proxies create [options] <proxyDefinition>
|
|
245
|
-
|
|
246
|
-
CREATE AMPLIFY CENTRAL PROXY ARGUMENTS:
|
|
247
|
-
proxyDefinition A YAML definition of your proxy
|
|
248
|
-
|
|
249
|
-
CREATE AMPLIFY CENTRAL PROXY OPTIONS:
|
|
250
|
-
-f,--force force create a new proxy
|
|
228
|
+
The ability to create/update proxies have been deprecated from the CLI verison 2.19.0
|
|
251
229
|
|
|
252
|
-
|
|
253
|
-
--client-id=<value> Override your DevOps account client ID
|
|
254
|
-
--json Show JSON output
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
CLI supports multiple versions of proxy definition file. For more details and examples visit our [docs portal](https://docs.axway.com/bundle/amplify-central/page/docs/integrate_with_central/cli_central/index.html) and [stoplight hub](https://d-api.docs.stoplight.io/).
|
|
230
|
+
---
|
|
258
231
|
|
|
259
232
|
- **v0**
|
|
260
233
|
|
|
@@ -298,32 +271,6 @@ proxy:
|
|
|
298
271
|
name: 'Default Team'
|
|
299
272
|
```
|
|
300
273
|
|
|
301
|
-
### proxies: promote/deploy a proxy:
|
|
302
|
-
|
|
303
|
-
```text
|
|
304
|
-
axway central proxies promote [options] <proxyDefinition>
|
|
305
|
-
|
|
306
|
-
PROMOTE AMPLIFY CENTRAL PROXY ARGUMENTS:
|
|
307
|
-
proxyDefinition A YAML definition of your proxy
|
|
308
|
-
|
|
309
|
-
PROMOTE AMPLIFY CENTRAL PROXY OPTIONS:
|
|
310
|
-
--source=<runtime> The runtime to promote from
|
|
311
|
-
--target=<runtime> The runtime to promote to
|
|
312
|
-
|
|
313
|
-
PROXIES OPTIONS:
|
|
314
|
-
--client-id=<value> Override your DevOps account client ID
|
|
315
|
-
--json Show JSON output
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
### proxies examples
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
# create a proxy
|
|
322
|
-
axway central proxies create ./some/folder/proxy.yaml
|
|
323
|
-
# promote a proxy
|
|
324
|
-
axway central proxies promote ./some/folder/proxy.yaml --target="Test Runtime"
|
|
325
|
-
```
|
|
326
|
-
|
|
327
274
|
---
|
|
328
275
|
|
|
329
276
|
## GET
|
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,6 @@ var _delete = require("./commands/delete");
|
|
|
16
16
|
var _edit = require("./commands/edit");
|
|
17
17
|
var _get = require("./commands/get");
|
|
18
18
|
var _install = require("./commands/install");
|
|
19
|
-
var _proxies = require("./commands/proxies");
|
|
20
19
|
var _utils = require("./common/utils");
|
|
21
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
21
|
_dayjs.default.extend(_relativeTime.default);
|
|
@@ -46,7 +45,6 @@ const cliParams = exports.cliParams = {
|
|
|
46
45
|
delete: _delete.deleteCmd,
|
|
47
46
|
edit: _edit.edit,
|
|
48
47
|
get: _get.get,
|
|
49
|
-
proxies: _proxies.proxies,
|
|
50
48
|
install: _install.install
|
|
51
49
|
},
|
|
52
50
|
extensions
|
|
@@ -17,7 +17,6 @@ var _types = require("../../common/types");
|
|
|
17
17
|
var _utils = require("../../common/utils");
|
|
18
18
|
var awsAgents = _interopRequireWildcard(require("./awsAgents"));
|
|
19
19
|
var gitHubAgents = _interopRequireWildcard(require("./gitHubSaasAgents"));
|
|
20
|
-
var gitLabAgents = _interopRequireWildcard(require("./gitLabAgents"));
|
|
21
20
|
var azureAgents = _interopRequireWildcard(require("./azureAgents"));
|
|
22
21
|
var edgeAgents = _interopRequireWildcard(require("./edgeAgents"));
|
|
23
22
|
var apigeeSaaSAgents = _interopRequireWildcard(require("./apigeexSaasAgents"));
|
|
@@ -41,7 +40,6 @@ const agentInstallFlows = {
|
|
|
41
40
|
[_types.GatewayTypes.EDGE_GATEWAY_ONLY]: edgeAgents.EdgeGWOnlyInstallMethods,
|
|
42
41
|
[_types.GatewayTypes.AWS_GATEWAY]: awsAgents.AWSInstallMethods,
|
|
43
42
|
[_types.GatewayTypes.GITHUB]: gitHubAgents.GitHubSaaSInstallMethods,
|
|
44
|
-
[_types.GatewayTypes.GITLAB]: gitLabAgents.GitLabInstallMethods,
|
|
45
43
|
[_types.GatewayTypes.APIGEEX_GATEWAY]: apigeeSaaSAgents.APIGEEXSaaSInstallMethods,
|
|
46
44
|
[_types.GatewayTypes.AZURE_GATEWAY]: azureAgents.AzureInstallMethods,
|
|
47
45
|
[_types.GatewayTypes.ISTIO]: istioAgents.IstioInstallMethods
|
|
@@ -128,18 +128,6 @@ Object.keys(_istioTemplates).forEach(function (key) {
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
});
|
|
131
|
-
var _gitLabTemplates = require("./templates/gitLabTemplates");
|
|
132
|
-
Object.keys(_gitLabTemplates).forEach(function (key) {
|
|
133
|
-
if (key === "default" || key === "__esModule") return;
|
|
134
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
135
|
-
if (key in exports && exports[key] === _gitLabTemplates[key]) return;
|
|
136
|
-
Object.defineProperty(exports, key, {
|
|
137
|
-
enumerable: true,
|
|
138
|
-
get: function () {
|
|
139
|
-
return _gitLabTemplates[key];
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
131
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
144
132
|
const streamPipeline = exports.streamPipeline = _util.default.promisify(_stream.default.pipeline);
|
|
145
133
|
const unzip = async filePath => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.resourceRegex = exports.percentageRegex = exports.namespaceRegex = exports.maskingRegex = exports.invalidResourceMsg = exports.invalidPercentage = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.
|
|
6
|
+
exports.resourceRegex = exports.percentageRegex = exports.namespaceRegex = exports.maskingRegex = exports.invalidResourceMsg = exports.invalidPercentage = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.GitHubRegexPatterns = exports.AzureRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0;
|
|
7
7
|
const resourceRegex = exports.resourceRegex = '^(?:[a-z0-9]*(?:\\.(?=[a-z0-9])|-+(?=[a-z0-9]))?)+[a-z0-9]$';
|
|
8
8
|
const namespaceRegex = exports.namespaceRegex = '^[a-z0-9]?(?:[-a-z0-9]*[a-z0-9]){1,100}?$';
|
|
9
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,}$';
|
|
@@ -51,9 +51,4 @@ const GitHubRegexPatterns = exports.GitHubRegexPatterns = {
|
|
|
51
51
|
gitHubRepositoryOwnerRegex: '^(?!-)(?!.*--)[a-zA-Z0-9-]{1,37}(?<!-)$',
|
|
52
52
|
gitHubRepositoryNameRegex: '^[\w-\.]+$',
|
|
53
53
|
gitHubFilePathRegex: '^\/.*$'
|
|
54
|
-
};
|
|
55
|
-
const GitLabRegexPatterns = exports.GitLabRegexPatterns = {
|
|
56
|
-
gitLabAccessTokenRegex: '^[0-9a-zA-Z\-]{20}$',
|
|
57
|
-
gitHubRepositoryIDRegex: '^[0-9]*$',
|
|
58
|
-
gitLabPathRegex: '^\/.*$'
|
|
59
54
|
};
|
package/dist/common/types.js
CHANGED
|
@@ -37,7 +37,6 @@ const KindTypes = exports.KindTypes = [Kind.Environment, Kind.APIService, Kind.A
|
|
|
37
37
|
const PublicRepoUrl = exports.PublicRepoUrl = 'https://axway.jfrog.io';
|
|
38
38
|
const PublicDockerRepoBaseUrl = exports.PublicDockerRepoBaseUrl = 'axway.jfrog.io/ampc-public-docker-release';
|
|
39
39
|
let BasePaths = exports.BasePaths = /*#__PURE__*/function (BasePaths) {
|
|
40
|
-
BasePaths["Aggregator"] = "/api/apiAggregator/v1";
|
|
41
40
|
BasePaths["ApiServer"] = "/apis";
|
|
42
41
|
BasePaths["ApiCentral"] = "/api/v1";
|
|
43
42
|
BasePaths["Platform"] = "/platform/api/v1";
|
|
@@ -215,7 +214,6 @@ let AgentNames = exports.AgentNames = /*#__PURE__*/function (AgentNames) {
|
|
|
215
214
|
AgentNames["AWS_DA"] = "aws-apigw-discovery-agent";
|
|
216
215
|
AgentNames["AWS_TA"] = "aws-apigw-traceability-agent";
|
|
217
216
|
AgentNames["GITHUB_DA"] = "github-discovery-agent";
|
|
218
|
-
AgentNames["GITLAB_DA"] = "gitlab-discovery-agent";
|
|
219
217
|
AgentNames["APIGEEX_DA"] = "apigee-discovery-agent";
|
|
220
218
|
AgentNames["APIGEEX_TA"] = "apigee-traceability-agent";
|
|
221
219
|
AgentNames["AZURE_DA"] = "azure-discovery-agent";
|
|
@@ -230,7 +228,6 @@ let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) {
|
|
|
230
228
|
GatewayTypes["APIGEEX_GATEWAY"] = "Apigee X Gateway";
|
|
231
229
|
GatewayTypes["AZURE_GATEWAY"] = "Azure API Gateway";
|
|
232
230
|
GatewayTypes["GITHUB"] = "GitHub";
|
|
233
|
-
GatewayTypes["GITLAB"] = "GitLab";
|
|
234
231
|
GatewayTypes["ISTIO"] = "Istio";
|
|
235
232
|
GatewayTypes["EDGE_GATEWAY_ONLY"] = "Amplify API Gateway only";
|
|
236
233
|
return GatewayTypes;
|
|
@@ -245,7 +242,6 @@ let DataPlaneNames = exports.DataPlaneNames = /*#__PURE__*/function (DataPlaneNa
|
|
|
245
242
|
DataPlaneNames["APIGEE"] = "Apigee";
|
|
246
243
|
DataPlaneNames["AWS"] = "AWS";
|
|
247
244
|
DataPlaneNames["GITHUB"] = "GitHub";
|
|
248
|
-
DataPlaneNames["GITLAB"] = "GitLab";
|
|
249
245
|
DataPlaneNames["AZURE"] = "Azure";
|
|
250
246
|
DataPlaneNames["EDGE"] = "Edge";
|
|
251
247
|
DataPlaneNames["KONG"] = "Kong";
|
|
@@ -259,7 +255,6 @@ const GatewayTypeToDataPlane = exports.GatewayTypeToDataPlane = {
|
|
|
259
255
|
[GatewayTypes.EDGE_GATEWAY_ONLY]: DataPlaneNames.EDGE,
|
|
260
256
|
[GatewayTypes.AWS_GATEWAY]: DataPlaneNames.AWS,
|
|
261
257
|
[GatewayTypes.GITHUB]: DataPlaneNames.GITHUB,
|
|
262
|
-
[GatewayTypes.GITLAB]: DataPlaneNames.GITLAB,
|
|
263
258
|
[GatewayTypes.AZURE_GATEWAY]: DataPlaneNames.AZURE,
|
|
264
259
|
[GatewayTypes.ISTIO]: 'Istio',
|
|
265
260
|
[GatewayTypes.APIGEEX_GATEWAY]: DataPlaneNames.APIGEE
|
package/package.json
CHANGED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.testables = exports.installPreprocess = exports.gitLabPrompts = exports.gatewayConnectivity = exports.completeInstall = exports.askConfigType = exports.askBundleType = exports.GitLabInstallMethods = exports.ConfigFiles = void 0;
|
|
7
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
-
var _basicPrompts = require("../../common/basicPrompts");
|
|
10
|
-
var _types = require("../../common/types");
|
|
11
|
-
var _utils = require("../../common/utils");
|
|
12
|
-
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
13
|
-
var _gitLabTemplates = require("./helpers/templates/gitLabTemplates");
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
const {
|
|
19
|
-
log
|
|
20
|
-
} = (0, _snooplogg.default)('central: install: agents: gitLab:');
|
|
21
|
-
const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.GITLAB_DA}`;
|
|
22
|
-
|
|
23
|
-
// ConfigFiles - all the config file that are used in the setup
|
|
24
|
-
const ConfigFiles = exports.ConfigFiles = {
|
|
25
|
-
DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`
|
|
26
|
-
};
|
|
27
|
-
const gitLabPrompts = exports.gitLabPrompts = {
|
|
28
|
-
ACCESS_TOKEN: 'Enter the GitLab Access Token the agent will use',
|
|
29
|
-
BASE_URL: 'Enter the GitLab base URL that the agent will use',
|
|
30
|
-
REPOSITORY_ID: 'Enter the GitLab Repository ID the agent will use',
|
|
31
|
-
REPOSITORY_BRANCH: 'Enter the Repository Branch the agent will use',
|
|
32
|
-
PATHS: 'Enter a Path within the repository that the agent will use',
|
|
33
|
-
FILTERS: 'Enter a filter that the agent will use (Optional)',
|
|
34
|
-
DA_FREQUENCY: 'How often should the discovery run, leave blank for integrating in CI/CD process',
|
|
35
|
-
QUEUE: 'Do you want to discover immediately after installation',
|
|
36
|
-
ENTER_MORE_PATHS: 'Do you want to enter another path ?',
|
|
37
|
-
ENTER_MORE_FILTERS: 'Do you want to enter another filter ?'
|
|
38
|
-
};
|
|
39
|
-
const askBundleType = async () => {
|
|
40
|
-
return _types.BundleType.DISCOVERY;
|
|
41
|
-
};
|
|
42
|
-
exports.askBundleType = askBundleType;
|
|
43
|
-
const askConfigType = async () => {
|
|
44
|
-
return _types.AgentConfigTypes.DOCKERIZED;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// Questions for the gitLab configuration
|
|
48
|
-
exports.askConfigType = askConfigType;
|
|
49
|
-
const askForGitLabToken = async () => await (0, _basicPrompts.askInput)({
|
|
50
|
-
msg: gitLabPrompts.ACCESS_TOKEN,
|
|
51
|
-
validate: (0, _basicPrompts.validateRegex)(helpers.GitLabRegexPatterns.gitLabAccessTokenRegex, helpers.invalidValueExampleErrMsg('AccessToken', 'mockToken'))
|
|
52
|
-
});
|
|
53
|
-
const askForGitLabBaseURL = async () => await (0, _basicPrompts.askInput)({
|
|
54
|
-
msg: gitLabPrompts.BASE_URL
|
|
55
|
-
});
|
|
56
|
-
const askForGitLabRepositoryID = async () => await (0, _basicPrompts.askInput)({
|
|
57
|
-
msg: gitLabPrompts.REPOSITORY_ID,
|
|
58
|
-
validate: (0, _basicPrompts.validateRegex)(helpers.GitLabRegexPatterns.gitHubRepositoryIDRegex, helpers.invalidValueExampleErrMsg('RepositoryID', '12312'))
|
|
59
|
-
});
|
|
60
|
-
const askForGitLabRepositoryBranch = async () => await (0, _basicPrompts.askInput)({
|
|
61
|
-
msg: gitLabPrompts.REPOSITORY_BRANCH
|
|
62
|
-
});
|
|
63
|
-
const askForGitLabPaths = async () => {
|
|
64
|
-
let askPaths = true;
|
|
65
|
-
let paths = [];
|
|
66
|
-
console.log(_chalk.default.gray("An array of paths within the repository that the agent will gather files for looking for specs"));
|
|
67
|
-
while (askPaths) {
|
|
68
|
-
const path = await (0, _basicPrompts.askInput)({
|
|
69
|
-
msg: gitLabPrompts.PATHS,
|
|
70
|
-
allowEmptyInput: false,
|
|
71
|
-
validate: (0, _basicPrompts.validateRegex)(helpers.GitLabRegexPatterns.gitLabPathRegex, helpers.invalidValueExampleErrMsg('File Path', '/apis'))
|
|
72
|
-
});
|
|
73
|
-
paths.push(path);
|
|
74
|
-
askPaths = (await (0, _basicPrompts.askList)({
|
|
75
|
-
msg: gitLabPrompts.ENTER_MORE_PATHS,
|
|
76
|
-
default: _types.YesNo.No,
|
|
77
|
-
choices: _types.YesNoChoices
|
|
78
|
-
})) === _types.YesNo.Yes;
|
|
79
|
-
}
|
|
80
|
-
return paths;
|
|
81
|
-
};
|
|
82
|
-
const askForGitLabFilters = async () => {
|
|
83
|
-
let askFilters = true;
|
|
84
|
-
let filters = [];
|
|
85
|
-
console.log(_chalk.default.gray("An array of regular expressions that a file name must match to be discovered"));
|
|
86
|
-
while (askFilters) {
|
|
87
|
-
const filter = await (0, _basicPrompts.askInput)({
|
|
88
|
-
msg: gitLabPrompts.FILTERS,
|
|
89
|
-
allowEmptyInput: true
|
|
90
|
-
});
|
|
91
|
-
filters.push(filter);
|
|
92
|
-
askFilters = (await (0, _basicPrompts.askList)({
|
|
93
|
-
msg: gitLabPrompts.ENTER_MORE_FILTERS,
|
|
94
|
-
default: _types.YesNo.No,
|
|
95
|
-
choices: _types.YesNoChoices
|
|
96
|
-
})) === _types.YesNo.Yes;
|
|
97
|
-
}
|
|
98
|
-
return filters;
|
|
99
|
-
};
|
|
100
|
-
const gatewayConnectivity = async installConfig => {
|
|
101
|
-
let gitLabAgentValues = new _gitLabTemplates.GitLabAgentValues();
|
|
102
|
-
if (installConfig.switches.isDockerInstall) {
|
|
103
|
-
console.log('\nCONNECTION TO GitHub API GATEWAY:');
|
|
104
|
-
console.log(_chalk.default.gray("The Discovery Agent needs to connect to the GitHub API Gateway to discover API's for publishing to Amplify Central"));
|
|
105
|
-
gitLabAgentValues.token = await askForGitLabToken();
|
|
106
|
-
gitLabAgentValues.baseURL = await askForGitLabBaseURL();
|
|
107
|
-
gitLabAgentValues.repositoryID = await askForGitLabRepositoryID();
|
|
108
|
-
gitLabAgentValues.repositoryBranch = await askForGitLabRepositoryBranch();
|
|
109
|
-
gitLabAgentValues.paths = await askForGitLabPaths();
|
|
110
|
-
gitLabAgentValues.filters = await askForGitLabFilters();
|
|
111
|
-
}
|
|
112
|
-
return gitLabAgentValues;
|
|
113
|
-
};
|
|
114
|
-
exports.gatewayConnectivity = gatewayConnectivity;
|
|
115
|
-
const dockerSuccessMsg = installConfig => {
|
|
116
|
-
let dockerInfo;
|
|
117
|
-
const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
|
|
118
|
-
const runDaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
|
|
119
|
-
const startDaLinuxMsg = `\nStart the Discovery Agent on a Linux based machine`;
|
|
120
|
-
const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
|
|
121
|
-
if (installConfig.switches.isDaEnabled) {
|
|
122
|
-
dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
|
|
123
|
-
}
|
|
124
|
-
console.log(_chalk.default.whiteBright(dockerInfo), '\n');
|
|
125
|
-
if (installConfig.switches.isDaEnabled) {
|
|
126
|
-
const daImageVersion = `${daImage}:${installConfig.daVersion}`;
|
|
127
|
-
console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
|
|
128
|
-
console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
|
|
129
|
-
console.log(_chalk.default.white(_utils.isWindows ? startDaWinMsg : startDaLinuxMsg));
|
|
130
|
-
console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
|
|
131
|
-
console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`));
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
const generateSuccessHelpMsg = installConfig => {
|
|
135
|
-
const configType = installConfig.deploymentType;
|
|
136
|
-
if (configType === _types.AgentConfigTypes.DOCKERIZED) {
|
|
137
|
-
dockerSuccessMsg(installConfig);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const installPreprocess = async installConfig => {
|
|
141
|
-
return installConfig;
|
|
142
|
-
};
|
|
143
|
-
exports.installPreprocess = installPreprocess;
|
|
144
|
-
const completeInstall = async installConfig => {
|
|
145
|
-
/**
|
|
146
|
-
* Create agent resources
|
|
147
|
-
*/
|
|
148
|
-
const gitLabAgentValues = installConfig.gatewayConfig;
|
|
149
|
-
|
|
150
|
-
// Add final settings to gitLabAgentValues
|
|
151
|
-
gitLabAgentValues.centralConfig = installConfig.centralConfig;
|
|
152
|
-
gitLabAgentValues.daVersion = installConfig.daVersion;
|
|
153
|
-
if (installConfig.switches.isDockerInstall) {
|
|
154
|
-
if (installConfig.switches.isDaEnabled) {
|
|
155
|
-
(0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, gitLabAgentValues, helpers.gitLabDAEnvVarTemplate);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
console.log('Configuration file(s) have been successfully created.\n');
|
|
159
|
-
generateSuccessHelpMsg(installConfig);
|
|
160
|
-
};
|
|
161
|
-
exports.completeInstall = completeInstall;
|
|
162
|
-
const GitLabInstallMethods = exports.GitLabInstallMethods = {
|
|
163
|
-
GetBundleType: askBundleType,
|
|
164
|
-
GetDeploymentType: askConfigType,
|
|
165
|
-
AskGatewayQuestions: gatewayConnectivity,
|
|
166
|
-
InstallPreprocess: installPreprocess,
|
|
167
|
-
FinalizeGatewayInstall: completeInstall,
|
|
168
|
-
ConfigFiles: Object.values(ConfigFiles),
|
|
169
|
-
GatewayDisplay: _types.GatewayTypes.GITLAB
|
|
170
|
-
};
|
|
171
|
-
const testables = exports.testables = {
|
|
172
|
-
gitLabPrompts,
|
|
173
|
-
ConfigFiles
|
|
174
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.gitLabDAEnvVarTemplate = exports.GitLabAgentValues = void 0;
|
|
7
|
-
var _types = require("../../../../common/types");
|
|
8
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
10
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
|
|
11
|
-
* @description Values to provide to the gitLab templates.
|
|
12
|
-
*/
|
|
13
|
-
class GitLabAgentValues {
|
|
14
|
-
constructor() {
|
|
15
|
-
_defineProperty(this, "token", void 0);
|
|
16
|
-
_defineProperty(this, "baseURL", void 0);
|
|
17
|
-
_defineProperty(this, "repositoryID", void 0);
|
|
18
|
-
_defineProperty(this, "repositoryBranch", void 0);
|
|
19
|
-
_defineProperty(this, "paths", void 0);
|
|
20
|
-
_defineProperty(this, "filters", void 0);
|
|
21
|
-
_defineProperty(this, "daQueueName", void 0);
|
|
22
|
-
_defineProperty(this, "daVersion", void 0);
|
|
23
|
-
_defineProperty(this, "centralConfig", void 0);
|
|
24
|
-
this.token = '';
|
|
25
|
-
this.baseURL = '';
|
|
26
|
-
this.repositoryID = '';
|
|
27
|
-
this.repositoryBranch = '';
|
|
28
|
-
this.daQueueName = '';
|
|
29
|
-
this.daVersion = '';
|
|
30
|
-
this.paths = [];
|
|
31
|
-
this.filters = [];
|
|
32
|
-
this.centralConfig = new _types.CentralAgentConfig();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.GitLabAgentValues = GitLabAgentValues;
|
|
36
|
-
const gitLabDAEnvVarTemplate = () => {
|
|
37
|
-
return `# GitLab configs
|
|
38
|
-
GITLAB_TOKEN={{token}}
|
|
39
|
-
GITLAB_BASE_URL={{baseURL}}
|
|
40
|
-
GITLAB_REPOSITORY_ID={{repositoryID}}
|
|
41
|
-
GITLAB_REPOSITORY_BRANCH={{repositoryBranch}}
|
|
42
|
-
GITLAB_REPOSITORY_SPEC_PATHS={{paths}}
|
|
43
|
-
GITLAB_REPOSITORY_SPEC_FILTERS={{filters}}
|
|
44
|
-
|
|
45
|
-
# Amplify Central configs
|
|
46
|
-
CENTRAL_AGENTNAME={{centralConfig.daAgentName}}
|
|
47
|
-
CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
|
|
48
|
-
CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
|
|
49
|
-
CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
|
|
50
|
-
CENTRAL_ENVIRONMENT={{centralConfig.environment}}
|
|
51
|
-
CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
|
|
52
|
-
{{#compare . centralConfig.ampcTeamName "" operator="!=" }}
|
|
53
|
-
CENTRAL_TEAM={{centralConfig.ampcTeamName}}
|
|
54
|
-
{{/compare}}
|
|
55
|
-
CENTRAL_SINGLEURL={{centralConfig.singleEntryPointUrl}}
|
|
56
|
-
{{#compare . centralConfig.region "US" operator="!="}}
|
|
57
|
-
CENTRAL_URL={{centralConfig.url}}
|
|
58
|
-
{{/compare}}
|
|
59
|
-
|
|
60
|
-
# Logging configs
|
|
61
|
-
# Define the logging level: info, debug, error
|
|
62
|
-
LOG_LEVEL=info
|
|
63
|
-
# Specify where to send the log: stdout, file, both
|
|
64
|
-
LOG_OUTPUT=stdout
|
|
65
|
-
# Define where the log files are written
|
|
66
|
-
LOG_FILE_PATH=logs
|
|
67
|
-
`;
|
|
68
|
-
};
|
|
69
|
-
exports.gitLabDAEnvVarTemplate = gitLabDAEnvVarTemplate;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.create = void 0;
|
|
7
|
-
var _cliKit = require("cli-kit");
|
|
8
|
-
var _formData = _interopRequireDefault(require("form-data"));
|
|
9
|
-
var _fsExtra = require("fs-extra");
|
|
10
|
-
var _ora = _interopRequireDefault(require("ora"));
|
|
11
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
12
|
-
var _dataService = require("../../common/dataService");
|
|
13
|
-
var _errorHandler = require("../../common/errorHandler");
|
|
14
|
-
var _resultsRenderers = require("../../common/resultsRenderers");
|
|
15
|
-
var _types = require("../../common/types");
|
|
16
|
-
var _utils = require("../../common/utils");
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
const {
|
|
19
|
-
log
|
|
20
|
-
} = (0, _snooplogg.default)('central: proxies: create');
|
|
21
|
-
const action = async ({
|
|
22
|
-
argv,
|
|
23
|
-
console
|
|
24
|
-
}) => {
|
|
25
|
-
const {
|
|
26
|
-
baseUrl,
|
|
27
|
-
clientId,
|
|
28
|
-
account,
|
|
29
|
-
force,
|
|
30
|
-
json,
|
|
31
|
-
proxyDefinition,
|
|
32
|
-
region
|
|
33
|
-
} = argv;
|
|
34
|
-
const spinner = !(process.env['DEBUG'] || json) ? (0, _ora.default)({
|
|
35
|
-
spinner: 'dots3',
|
|
36
|
-
text: 'Creating API Proxy'
|
|
37
|
-
}).start() : null;
|
|
38
|
-
try {
|
|
39
|
-
log(`Verifying file: ${proxyDefinition}`);
|
|
40
|
-
(0, _utils.verifyFile)(proxyDefinition);
|
|
41
|
-
const service = await (0, _dataService.dataService)({
|
|
42
|
-
baseUrl,
|
|
43
|
-
basePath: _types.BasePaths.Aggregator,
|
|
44
|
-
clientId,
|
|
45
|
-
account,
|
|
46
|
-
region
|
|
47
|
-
});
|
|
48
|
-
const body = new _formData.default();
|
|
49
|
-
body.append('config', (0, _fsExtra.createReadStream)(proxyDefinition));
|
|
50
|
-
body.append('forceCreate', force.toString());
|
|
51
|
-
const result = await service.postFormData('/proxies', body);
|
|
52
|
-
spinner ? spinner.succeed((0, _cliKit.chalk)`{greenBright "${result.proxyName}" has successfully been created.}`) : (0, _resultsRenderers.renderResponse)(console, result, _types.OutputTypes.json);
|
|
53
|
-
} catch (e) {
|
|
54
|
-
log('command error', e);
|
|
55
|
-
(0, _errorHandler.handleErrors)(console, e, spinner);
|
|
56
|
-
} finally {
|
|
57
|
-
log('command successful');
|
|
58
|
-
spinner && spinner.stop();
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const create = exports.create = {
|
|
62
|
-
title: 'Create Amplify Central Proxy',
|
|
63
|
-
desc: '',
|
|
64
|
-
options: {
|
|
65
|
-
'-f, --force': 'Force create a new proxy'
|
|
66
|
-
},
|
|
67
|
-
args: [{
|
|
68
|
-
name: 'proxyDefinition',
|
|
69
|
-
desc: 'A YAML definition of your proxy',
|
|
70
|
-
required: true
|
|
71
|
-
}],
|
|
72
|
-
action
|
|
73
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.proxies = void 0;
|
|
7
|
-
var _create = require("./create");
|
|
8
|
-
var _promote = require("./promote");
|
|
9
|
-
var _types = require("../../common/types");
|
|
10
|
-
const proxies = exports.proxies = {
|
|
11
|
-
action: () => {
|
|
12
|
-
throw new Error(`Missing one of required commands: [create, promote]`);
|
|
13
|
-
},
|
|
14
|
-
commands: {
|
|
15
|
-
create: _create.create,
|
|
16
|
-
promote: _promote.promote
|
|
17
|
-
},
|
|
18
|
-
desc: 'Manage API proxies',
|
|
19
|
-
options: {
|
|
20
|
-
..._types.commonCmdArgsDescription,
|
|
21
|
-
'--client-id [value]': `Override your DevOps account's client ID`,
|
|
22
|
-
'--json': 'Show JSON output'
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.promote = void 0;
|
|
7
|
-
var _cliKit = require("cli-kit");
|
|
8
|
-
var _formData = _interopRequireDefault(require("form-data"));
|
|
9
|
-
var _fsExtra = require("fs-extra");
|
|
10
|
-
var _ora = _interopRequireDefault(require("ora"));
|
|
11
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
12
|
-
var _dataService = require("../../common/dataService");
|
|
13
|
-
var _errorHandler = require("../../common/errorHandler");
|
|
14
|
-
var _resultsRenderers = require("../../common/resultsRenderers");
|
|
15
|
-
var _types = require("../../common/types");
|
|
16
|
-
var _utils = require("../../common/utils");
|
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
const {
|
|
19
|
-
log
|
|
20
|
-
} = (0, _snooplogg.default)('central: proxies: promote');
|
|
21
|
-
const action = async ({
|
|
22
|
-
argv,
|
|
23
|
-
console
|
|
24
|
-
}) => {
|
|
25
|
-
const {
|
|
26
|
-
baseUrl,
|
|
27
|
-
clientId,
|
|
28
|
-
account,
|
|
29
|
-
region,
|
|
30
|
-
json,
|
|
31
|
-
proxyDefinition,
|
|
32
|
-
source,
|
|
33
|
-
target
|
|
34
|
-
} = argv;
|
|
35
|
-
const spinner = !(process.env['DEBUG'] || json) ? (0, _ora.default)({
|
|
36
|
-
spinner: 'dots3',
|
|
37
|
-
text: `Promoting API Proxy to ${target}`
|
|
38
|
-
}).start() : null;
|
|
39
|
-
try {
|
|
40
|
-
log(`Verifying file: ${proxyDefinition}`);
|
|
41
|
-
(0, _utils.verifyFile)(proxyDefinition);
|
|
42
|
-
const service = await (0, _dataService.dataService)({
|
|
43
|
-
baseUrl,
|
|
44
|
-
basePath: _types.BasePaths.Aggregator,
|
|
45
|
-
clientId,
|
|
46
|
-
account,
|
|
47
|
-
region
|
|
48
|
-
});
|
|
49
|
-
const body = new _formData.default();
|
|
50
|
-
body.append('config', (0, _fsExtra.createReadStream)(proxyDefinition));
|
|
51
|
-
body.append('target', target);
|
|
52
|
-
if (source) {
|
|
53
|
-
body.append('source', source);
|
|
54
|
-
}
|
|
55
|
-
const response = await service.postFormData('/promote', body);
|
|
56
|
-
if (spinner) {
|
|
57
|
-
spinner.succeed((0, _cliKit.chalk)`{greenBright The deployed service can now be accessed at {cyan.underline ${response.url}}}`);
|
|
58
|
-
response.apiKeys && spinner.succeed((0, _cliKit.chalk)`{greenBright You can access it with these API Keys: {cyan ${response.apiKeys}}}`);
|
|
59
|
-
} else (0, _resultsRenderers.renderResponse)(console, response, _types.OutputTypes.json);
|
|
60
|
-
} catch (e) {
|
|
61
|
-
log('command error', e);
|
|
62
|
-
(0, _errorHandler.handleErrors)(console, e, spinner);
|
|
63
|
-
} finally {
|
|
64
|
-
log('command successful');
|
|
65
|
-
spinner && spinner.stop();
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const promote = exports.promote = {
|
|
69
|
-
title: 'Promote Amplify Central proxy',
|
|
70
|
-
desc: '',
|
|
71
|
-
args: [{
|
|
72
|
-
name: 'proxyDefinition',
|
|
73
|
-
desc: 'A YAML definition of your proxy',
|
|
74
|
-
required: true
|
|
75
|
-
}],
|
|
76
|
-
options: {
|
|
77
|
-
'--source [runtime]': 'The runtime to promote from',
|
|
78
|
-
'--target [runtime]': {
|
|
79
|
-
desc: 'The runtime to promote to',
|
|
80
|
-
required: true
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
action
|
|
84
|
-
};
|