@axway/axway-central-cli 4.1.0 → 4.2.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.
@@ -35,6 +35,7 @@ const ConfigFiles = exports.ConfigFiles = {
35
35
  // ApigeeXPrompts - prompts for user inputs
36
36
  const ApigeeXPrompts = {
37
37
  AUTHENTICATION_TYPE: 'Authenticate with an Impersonation of a Service Account or by providing a Credential File',
38
+ SETUP_CONTROL_PLANE_REGION: 'The APIGEE X Gateway service allows you to configure a regionalized control plane for a more specific service endpoint location. Do you want to configure that?',
38
39
  PROJECT_ID: 'Enter the APIGEE X Project ID the agent will use',
39
40
  DEVELOPER_EMAIL_ADDRESS: 'Enter the APIGEE X Developer Email Address the agent will use',
40
41
  AUTH_FILE_NAME: 'Enter the GCP key file name (place in the same directory as your Axway public and private keys)',
@@ -46,7 +47,7 @@ const ApigeeXPrompts = {
46
47
  FILTER_METRICS: 'Do you want metrics filtering?',
47
48
  FILTERED_APIS: 'Enter APIs to filter metrics for',
48
49
  ENTER_MORE_APIS: 'Do you want to add another API?',
49
- ENVIRONMENT: 'Enter the Apigee Envirnoment to filter discovered APIs/metrics'
50
+ ENVIRONMENT: 'Enter the Apigee Environment to filter discovered APIs/metrics'
50
51
  };
51
52
  const askBundleType = async gateway => {
52
53
  console.log(gateway);
@@ -72,6 +73,14 @@ const askApigeeXProjectId = async () => await (0, _basicPrompts.askInput)({
72
73
  msg: ApigeeXPrompts.PROJECT_ID,
73
74
  validate: (0, _basicPrompts.validateRegex)(helpers.APIGEEXRegexPatterns.APIGEEX_REGEXP_PROJECT_ID, helpers.invalidValueExampleErrMsg('Project ID', 'rd-amplify-apigee-x'))
74
75
  });
76
+ const askToCreateControlPlaneRegionSetup = async () => {
77
+ return (await (0, _basicPrompts.askList)({
78
+ msg: ApigeeXPrompts.SETUP_CONTROL_PLANE_REGION,
79
+ choices: _types.YesNoChoices,
80
+ default: _types.YesNo.Yes
81
+ })) === _types.YesNo.Yes ? _types.YesNo.Yes : _types.YesNo.No;
82
+ };
83
+ const askApigeexControlPlaneRegion = async () => await helpers.askApigeexControlPlaneRegion();
75
84
  const askApigeeXDeveloperEmailAddress = async () => await (0, _basicPrompts.askInput)({
76
85
  msg: ApigeeXPrompts.DEVELOPER_EMAIL_ADDRESS
77
86
  });
@@ -174,6 +183,14 @@ const dockerSuccessMsg = installConfig => {
174
183
  async function askDiscoveryPrompts(apigeeXAgentValues) {
175
184
  // Apigee X ProjectId
176
185
  apigeeXAgentValues.projectId = await askApigeeXProjectId();
186
+
187
+ // Ask if Control Plane Region support is needed
188
+ let controlPlaneRegionSupport = await askToCreateControlPlaneRegionSetup();
189
+ if (controlPlaneRegionSupport === _types.YesNo.Yes) {
190
+ // Apigee X Control Plane Region
191
+ apigeeXAgentValues.controlPlaneRegion = await askApigeexControlPlaneRegion();
192
+ }
193
+
177
194
  // Apigee X Developer Email Address
178
195
  apigeeXAgentValues.developerEmailAddress = await askApigeeXDeveloperEmailAddress();
179
196
  // Apigee X Auth File Path
@@ -26,13 +26,15 @@ class DataplaneConfig {
26
26
  }
27
27
  }
28
28
  class APIGEEXDataplaneConfig extends DataplaneConfig {
29
- constructor(projectID, developerEmail, mode, metricsFilter, environment) {
29
+ constructor(controlPlaneRegion, projectID, developerEmail, mode, metricsFilter, environment) {
30
30
  super("Apigee X");
31
+ _defineProperty(this, "controlPlaneRegion", void 0);
31
32
  _defineProperty(this, "projectId", void 0);
32
33
  _defineProperty(this, "developerEmail", void 0);
33
34
  _defineProperty(this, "mode", void 0);
34
35
  _defineProperty(this, "metricsFilter", void 0);
35
36
  _defineProperty(this, "environment", void 0);
37
+ this.controlPlaneRegion = controlPlaneRegion;
36
38
  this.projectId = projectID;
37
39
  this.developerEmail = developerEmail;
38
40
  this.mode = mode;
@@ -60,6 +62,7 @@ class SaasAPIGEEXAgentValues extends SaasAgentValues {
60
62
  _defineProperty(this, "authType", void 0);
61
63
  _defineProperty(this, "clientEmailAddress", void 0);
62
64
  _defineProperty(this, "credentialJSON", void 0);
65
+ _defineProperty(this, "controlPlaneRegion", void 0);
63
66
  _defineProperty(this, "projectId", void 0);
64
67
  _defineProperty(this, "developerEmailAddress", void 0);
65
68
  _defineProperty(this, "mode", void 0);
@@ -69,6 +72,7 @@ class SaasAPIGEEXAgentValues extends SaasAgentValues {
69
72
  this.clientEmailAddress = '';
70
73
  this.credentialJSON = '';
71
74
  this.projectId = '';
75
+ this.controlPlaneRegion = '';
72
76
  this.developerEmailAddress = '';
73
77
  this.mode = _types.APIGEEXDISCOVERYMODES.PROXY;
74
78
  this.metricsFilter = new _types.ApigeeMetricsFilterConfig(true, []);
@@ -92,6 +96,7 @@ const ConfigFiles = {};
92
96
  const SaasPrompts = {
93
97
  AUTHENTICATION_TYPE: 'Authenticate with an Impersonation of a Service Account or by providing a Credential File',
94
98
  PROJECT_ID: 'Enter the APIGEE X Project ID the agent will use',
99
+ CONTROL_PLANE_REGION: 'Enter the service endpoint URL where the API Services reside',
95
100
  DEVELOPER_EMAIL_ADDRESS: 'Enter the APIGEE X Developer Email Address the agent will use',
96
101
  CLIENT_EMAIL_ADDRESS: 'Enter the Client Email Address the agent will use for the APIGEE X Service Account',
97
102
  UPLOAD_CREDENTIAL_FILE: 'Upload a JSON Credential file to be used for APIGEE X Authentication',
@@ -116,6 +121,10 @@ const askConfigType = async () => {
116
121
  };
117
122
  const askForAPIGEEXCredentials = async hostedAgentValues => {
118
123
  log("gathering access details for apigee x");
124
+ hostedAgentValues.controlPlaneRegion = await (0, _basicPrompts.askInput)({
125
+ msg: SaasPrompts.CONTROL_PLANE_REGION,
126
+ defaultValue: hostedAgentValues.controlPlaneRegion !== '' ? hostedAgentValues.controlPlaneRegion : undefined
127
+ });
119
128
  hostedAgentValues.projectId = await (0, _basicPrompts.askInput)({
120
129
  msg: SaasPrompts.PROJECT_ID,
121
130
  defaultValue: hostedAgentValues.projectId !== '' ? hostedAgentValues.projectId : undefined,
@@ -251,7 +260,7 @@ const completeInstall = async (installConfig, apiServerClient, defsManager) => {
251
260
  production: installConfig.centralConfig.production
252
261
  }) : installConfig.centralConfig.ampcEnvInfo.name;
253
262
  if (installConfig.gatewayType === _types.SaaSGatewayTypes.APIGEEX_GATEWAY) {
254
- apigeeXAgentValues.dataplaneConfig = new APIGEEXDataplaneConfig(apigeeXAgentValues.projectId, apigeeXAgentValues.developerEmailAddress, apigeeXAgentValues.mode, apigeeXAgentValues.metricsFilter, apigeeXAgentValues.environment);
263
+ apigeeXAgentValues.dataplaneConfig = new APIGEEXDataplaneConfig(apigeeXAgentValues.controlPlaneRegion, apigeeXAgentValues.projectId, apigeeXAgentValues.developerEmailAddress, apigeeXAgentValues.mode, apigeeXAgentValues.metricsFilter, apigeeXAgentValues.environment);
255
264
  }
256
265
 
257
266
  // create the data plane resource
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.serviceAccountNameAlreadyExists = exports.selectServiceAccount = exports.selectIngestionProtocol = 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.askIngestionProtocol = exports.askForSecretName = exports.askForIDPConfiguration = exports.askForIDPAuthConfiguration = exports.askEnvironmentName = exports.askDosaClientId = exports.askBundleType = exports.askArrayLoop = exports.askAgentName = exports.askAWSRegion = exports.agentMessages = exports.addIdentityProvider = void 0;
6
+ exports.serviceAccountNameAlreadyExists = exports.selectServiceAccount = exports.selectIngestionProtocol = exports.selectApigeexControlPlaneRegion = 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.enterApigeexControlPlaneRegion = 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.askIngestionProtocol = exports.askForSecretName = exports.askForIDPConfiguration = exports.askForIDPAuthConfiguration = exports.askEnvironmentName = exports.askDosaClientId = exports.askBundleType = exports.askArrayLoop = exports.askApigeexControlPlaneRegion = exports.askAgentName = exports.askAWSRegion = exports.agentMessages = exports.addIdentityProvider = void 0;
7
7
  var _chalk = _interopRequireDefault(require("chalk"));
8
8
  var _snooplogg = _interopRequireDefault(require("snooplogg"));
9
9
  var _inquirer = _interopRequireDefault(require("inquirer"));
@@ -70,6 +70,8 @@ const selectIngestionProtocol = exports.selectIngestionProtocol = 'Select Tracea
70
70
  const serviceAccountNameAlreadyExists = exports.serviceAccountNameAlreadyExists = 'Service account already exists. Please enter a new name.';
71
71
  const selectAWSRegion = exports.selectAWSRegion = 'Select an AWS Region';
72
72
  const enterAWSRegion = exports.enterAWSRegion = 'Enter an AWS Region';
73
+ const selectApigeexControlPlaneRegion = exports.selectApigeexControlPlaneRegion = 'Select an Apigeex Control Plane Region';
74
+ const enterApigeexControlPlaneRegion = exports.enterApigeexControlPlaneRegion = 'Enter an Apigeex Control Plane Region';
73
75
  const askAWSRegion = async (region = '') => {
74
76
  let regions = Object.values(_types.AWSRegions).map(str => ({
75
77
  name: str,
@@ -92,6 +94,28 @@ const askAWSRegion = async (region = '') => {
92
94
  }
93
95
  };
94
96
  exports.askAWSRegion = askAWSRegion;
97
+ const askApigeexControlPlaneRegion = async (region = '') => {
98
+ let regions = Object.values(_types.ApigeexControlPlaneRegions).map(str => ({
99
+ name: str,
100
+ value: str
101
+ }));
102
+ let answer = await (0, _basicPrompts.askList)({
103
+ msg: selectApigeexControlPlaneRegion,
104
+ default: region,
105
+ choices: [{
106
+ name: 'Enter an Apigeex Control Plane Region not on the list',
107
+ value: 'CREATE_NEW'
108
+ }, ...regions]
109
+ });
110
+ if (answer === 'CREATE_NEW') {
111
+ return await (0, _basicPrompts.askInput)({
112
+ msg: enterApigeexControlPlaneRegion
113
+ });
114
+ } else {
115
+ return answer;
116
+ }
117
+ };
118
+ exports.askApigeexControlPlaneRegion = askApigeexControlPlaneRegion;
95
119
  const askServiceAccountName = async serviceAccountNames => {
96
120
  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`));
97
121
  const name = await (0, _basicPrompts.askInput)({
@@ -13,6 +13,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
13
13
  */
14
14
  class ApigeeXAgentValues {
15
15
  constructor() {
16
+ _defineProperty(this, "controlPlaneRegion", void 0);
16
17
  _defineProperty(this, "projectId", void 0);
17
18
  _defineProperty(this, "developerEmailAddress", void 0);
18
19
  _defineProperty(this, "mode", void 0);
@@ -21,6 +22,7 @@ class ApigeeXAgentValues {
21
22
  _defineProperty(this, "metricsFilter", void 0);
22
23
  _defineProperty(this, "centralConfig", void 0);
23
24
  _defineProperty(this, "traceabilityConfig", void 0);
25
+ this.controlPlaneRegion = "";
24
26
  this.projectId = "";
25
27
  this.developerEmailAddress = "";
26
28
  this.mode = _types.APIGEEXDISCOVERYMODES.PROXY;
@@ -38,6 +40,9 @@ class ApigeeXAgentValues {
38
40
  exports.ApigeeXAgentValues = ApigeeXAgentValues;
39
41
  const apigeeXTAEnvVarTemplate = () => {
40
42
  return `# ApigeeX configs
43
+ {{#if controlPlaneRegion}}
44
+ APIGEE_CONTROLPLANEREGION={{controlPlaneRegion}}
45
+ {{/if}}
41
46
  APIGEE_PROJECTID={{projectId}}
42
47
  APIGEE_DEVELOPEREMAIL={{developerEmailAddress}}
43
48
  APIGEE_MODE={{mode}}
@@ -84,6 +89,9 @@ LOG_FILE_PATH=logs
84
89
  exports.apigeeXTAEnvVarTemplate = apigeeXTAEnvVarTemplate;
85
90
  const apigeeXDAEnvVarTemplate = () => {
86
91
  return `# Azure configs
92
+ {{#if controlPlaneRegion}}
93
+ APIGEE_CONTROLPLANEREGION={{controlPlaneRegion}}
94
+ {{/if}}
87
95
  APIGEE_PROJECTID={{projectId}}
88
96
  APIGEE_DEVELOPEREMAIL={{developerEmailAddress}}
89
97
  APIGEE_MODE={{mode}}
@@ -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.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.AzureDataplaneMode = exports.AuthUrls = exports.ApigeeMetricsFilterConfig = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APIGEEXAuthType = 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.AzureDataplaneMode = exports.AuthUrls = exports.ApigeexControlPlaneRegions = exports.ApigeeMetricsFilterConfig = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APIGEEXAuthType = 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; }
@@ -338,6 +338,20 @@ let AWSRegions = exports.AWSRegions = /*#__PURE__*/function (AWSRegions) {
338
338
  AWSRegions["EU_WEST_2"] = "eu-west-2";
339
339
  AWSRegions["EU_WEST_3"] = "eu-west-3";
340
340
  return AWSRegions;
341
+ }({}); // Apigee X Control Plane Regions
342
+ let ApigeexControlPlaneRegions = exports.ApigeexControlPlaneRegions = /*#__PURE__*/function (ApigeexControlPlaneRegions) {
343
+ ApigeexControlPlaneRegions["US"] = "us";
344
+ ApigeexControlPlaneRegions["CANADA"] = "ca";
345
+ ApigeexControlPlaneRegions["EUROPEAN_UNION"] = "eu";
346
+ ApigeexControlPlaneRegions["GERMANY"] = "de";
347
+ ApigeexControlPlaneRegions["FRANCE"] = "fr";
348
+ ApigeexControlPlaneRegions["SWITZERLAND"] = "ch";
349
+ ApigeexControlPlaneRegions["AUSTRALIA"] = "au";
350
+ ApigeexControlPlaneRegions["INDIA"] = "in";
351
+ ApigeexControlPlaneRegions["JAPAN"] = "jp";
352
+ ApigeexControlPlaneRegions["SAUDI_ARABIA"] = "sa";
353
+ ApigeexControlPlaneRegions["ISRAEL"] = "il";
354
+ return ApigeexControlPlaneRegions;
341
355
  }({});
342
356
  let APIGEEXDISCOVERYMODES = exports.APIGEEXDISCOVERYMODES = /*#__PURE__*/function (APIGEEXDISCOVERYMODES) {
343
357
  APIGEEXDISCOVERYMODES["PROXY"] = "proxy";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axway/axway-central-cli",
3
- "version": "4.1.0",
3
+ "version": "4.2.0-rc.0",
4
4
  "description": "Manage APIs, services and publish to the Amplify Marketplace",
5
5
  "homepage": "https://platform.axway.com",
6
6
  "author": {