@axway/axway-central-cli 3.0.0 → 3.1.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 -0
- package/dist/commands/get/index.js +32 -7
- package/dist/common/ApiServerClient.js +12 -6
- package/dist/common/types.js +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -308,6 +308,7 @@ GET OPTIONS:
|
|
|
308
308
|
--attribute [key=value] Attribute in key=value pair format to filter by
|
|
309
309
|
--no-cache Do not use cache when communicating with the server
|
|
310
310
|
--account [value] Override your default account config
|
|
311
|
+
--language [langCode] Show the language detail of the retruned object. One of: * | fr-fr | en-us | de-de | pt-br
|
|
311
312
|
-o, --output [value] Additional output formats. One of: yaml | json
|
|
312
313
|
-q, --query [RSQL query] RSQL-formatted query to search for filters that match specific parameters
|
|
313
314
|
--region [value] Override your region config
|
|
@@ -337,6 +338,8 @@ axway central get envs,apisvc
|
|
|
337
338
|
axway central get env,apisvc commonname -s env1 -o json
|
|
338
339
|
# get apiservice with name "testsvc" in the scope "Environment" with name "testenv"
|
|
339
340
|
axway central get apisvc testsvc -s Environment/testenv
|
|
341
|
+
# get product with name "testproduct" with all available language information and output in json
|
|
342
|
+
axway central get products testproduct --language="*" -o json
|
|
340
343
|
# get assets with titles that start with "a"
|
|
341
344
|
axway central get assets -q "title==a*"
|
|
342
345
|
# get assets with titles that start with a or i
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.get = void 0;
|
|
7
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
8
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
+
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
9
|
var _ApiServerClient = require("../../common/ApiServerClient");
|
|
10
10
|
var _DefinitionsManager = require("../../common/DefinitionsManager");
|
|
11
11
|
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
@@ -16,18 +16,20 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
16
16
|
const {
|
|
17
17
|
log
|
|
18
18
|
} = (0, _snooplogg.default)('central: get');
|
|
19
|
-
const getListOrByName = async (resourceDef, client, scopeName, resourceName, scopeDef, query, progressListener) => {
|
|
19
|
+
const getListOrByName = async (resourceDef, client, scopeName, resourceName, scopeDef, query, progressListener, expand) => {
|
|
20
20
|
return resourceName ? await client.getResourceByName({
|
|
21
21
|
resourceDef,
|
|
22
22
|
resourceName,
|
|
23
23
|
scopeDef,
|
|
24
|
-
scopeName
|
|
24
|
+
scopeName,
|
|
25
|
+
expand
|
|
25
26
|
}) : await client.getResourcesList({
|
|
26
27
|
resourceDef,
|
|
27
28
|
scopeDef,
|
|
28
29
|
scopeName,
|
|
29
30
|
query,
|
|
30
|
-
progressListener
|
|
31
|
+
progressListener,
|
|
32
|
+
expand
|
|
31
33
|
});
|
|
32
34
|
};
|
|
33
35
|
const get = exports.get = {
|
|
@@ -70,8 +72,28 @@ const get = exports.get = {
|
|
|
70
72
|
});
|
|
71
73
|
const defsManager = await new _DefinitionsManager.DefinitionsManager(client).init();
|
|
72
74
|
const scope = (0, _utils.parseScopeParam)(argv.scope);
|
|
75
|
+
let languageExpand = argv.language;
|
|
73
76
|
const formattedFilter = (0, _utils.transformSimpleFilters)(title, attribute, tag);
|
|
74
77
|
const query = argv.query ? argv.query : formattedFilter;
|
|
78
|
+
if (languageExpand) {
|
|
79
|
+
// when "*" is provided, expand all supported languages
|
|
80
|
+
let lang = "";
|
|
81
|
+
let i = 0;
|
|
82
|
+
if (languageExpand.trim() === "*") {
|
|
83
|
+
lang = "languages-*";
|
|
84
|
+
} else {
|
|
85
|
+
let langCodeArr = languageExpand.split(',');
|
|
86
|
+
langCodeArr.forEach(v => {
|
|
87
|
+
if (i < langCodeArr.length - 1) {
|
|
88
|
+
lang = lang + "languages-" + v.trim() + ",";
|
|
89
|
+
} else {
|
|
90
|
+
lang = lang + "languages-" + v.trim();
|
|
91
|
+
}
|
|
92
|
+
i++;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
languageExpand = 'languages,' + lang;
|
|
96
|
+
}
|
|
75
97
|
if (argv.query && formattedFilter) {
|
|
76
98
|
console.log(`${_chalk.default.yellow('Both simple queries and advanced query parameters have been provided. Only the advanced query parameter will be applied.')}`);
|
|
77
99
|
}
|
|
@@ -127,7 +149,7 @@ ${defsManager.getDefsTableForHelpMsg()}`);
|
|
|
127
149
|
*/
|
|
128
150
|
if (scope) {
|
|
129
151
|
const results = await Promise.all(defs.filter(defs => !scope.kind || !defs.scope || defs.scope.spec.kind === scope.kind).map(async defs => ({
|
|
130
|
-
response: await getListOrByName(defs.resource, client, scope.name, resourceName, defs.scope, query, progressListener),
|
|
152
|
+
response: await getListOrByName(defs.resource, client, scope.name, resourceName, defs.scope, query, progressListener, languageExpand),
|
|
131
153
|
cli: defs.cli
|
|
132
154
|
})));
|
|
133
155
|
results.forEach(({
|
|
@@ -147,7 +169,7 @@ ${defsManager.getDefsTableForHelpMsg()}`);
|
|
|
147
169
|
}
|
|
148
170
|
});
|
|
149
171
|
const results = await Promise.all(Object.values(defsMatchingGroup).map(async defs => ({
|
|
150
|
-
response: await getListOrByName(defs.resource, client, undefined, resourceName, undefined, query, progressListener),
|
|
172
|
+
response: await getListOrByName(defs.resource, client, undefined, resourceName, undefined, query, progressListener, languageExpand),
|
|
151
173
|
cli: defs.cli
|
|
152
174
|
})));
|
|
153
175
|
results.forEach(({
|
|
@@ -208,6 +230,9 @@ ${defsManager.getDefsTableForHelpMsg()}`);
|
|
|
208
230
|
desc: 'Tag of resource(s) to fetch'
|
|
209
231
|
},
|
|
210
232
|
'--team [guid|name]': 'The team name or guid to use',
|
|
211
|
-
'--no-owner': 'Returns resources which do not have an owner'
|
|
233
|
+
'--no-owner': 'Returns resources which do not have an owner',
|
|
234
|
+
'--language [langCode]': {
|
|
235
|
+
desc: `Show the language detail of the retruned object. One of: * | Comma Separated values of ${_types.LanguageTypes.French} | ${_types.LanguageTypes.US} | ${_types.LanguageTypes.German} | ${_types.LanguageTypes.Portugese}`
|
|
236
|
+
}
|
|
212
237
|
}
|
|
213
238
|
};
|
|
@@ -64,13 +64,15 @@ class ApiServerClient {
|
|
|
64
64
|
resourceName,
|
|
65
65
|
scopeDef,
|
|
66
66
|
scopeName,
|
|
67
|
-
version = ApiServerVersions.v1alpha1
|
|
67
|
+
version = ApiServerVersions.v1alpha1,
|
|
68
|
+
expand
|
|
68
69
|
}) {
|
|
69
70
|
const groupUrl = `/${resourceDef.metadata.scope.name}/${version}`;
|
|
70
71
|
const scopeUrl = scopeName && scopeDef ? `/${scopeDef.spec.plural}/${encodeURIComponent(scopeName)}` : '';
|
|
71
72
|
const resourceUrl = `/${resourceDef.spec.plural}`;
|
|
72
73
|
const nameUrl = resourceName ? `/${encodeURIComponent(resourceName)}` : '';
|
|
73
|
-
|
|
74
|
+
const expandUrl = expand ? `?expand=${expand}` : '';
|
|
75
|
+
return `${groupUrl}${scopeUrl}${resourceUrl}${nameUrl}${expandUrl}`;
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
/**
|
|
@@ -473,7 +475,8 @@ class ApiServerClient {
|
|
|
473
475
|
scopeName,
|
|
474
476
|
version = ApiServerVersions.v1alpha1,
|
|
475
477
|
query,
|
|
476
|
-
progressListener
|
|
478
|
+
progressListener,
|
|
479
|
+
expand
|
|
477
480
|
}) {
|
|
478
481
|
log(`getResourcesList, spec.kind = ${resourceDef.spec.kind}`);
|
|
479
482
|
const result = {
|
|
@@ -491,7 +494,8 @@ class ApiServerClient {
|
|
|
491
494
|
resourceDef,
|
|
492
495
|
scopeDef,
|
|
493
496
|
scopeName,
|
|
494
|
-
version
|
|
497
|
+
version,
|
|
498
|
+
expand
|
|
495
499
|
});
|
|
496
500
|
const response = await service.getWithPagination(url, query, 50, {}, progressListener);
|
|
497
501
|
result.data = response;
|
|
@@ -521,7 +525,8 @@ class ApiServerClient {
|
|
|
521
525
|
resourceName,
|
|
522
526
|
scopeDef,
|
|
523
527
|
scopeName,
|
|
524
|
-
version = ApiServerVersions.v1alpha1
|
|
528
|
+
version = ApiServerVersions.v1alpha1,
|
|
529
|
+
expand
|
|
525
530
|
}) {
|
|
526
531
|
log(`getResourceByName, spec.kind = ${resourceDef.spec.kind}, name = ${resourceName}`);
|
|
527
532
|
const result = {
|
|
@@ -540,7 +545,8 @@ class ApiServerClient {
|
|
|
540
545
|
resourceName,
|
|
541
546
|
scopeDef,
|
|
542
547
|
scopeName,
|
|
543
|
-
version
|
|
548
|
+
version,
|
|
549
|
+
expand
|
|
544
550
|
});
|
|
545
551
|
const response = await service.get(url);
|
|
546
552
|
result.data = response;
|
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.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.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; }
|
|
@@ -143,6 +143,13 @@ let OutputTypes = exports.OutputTypes = /*#__PURE__*/function (OutputTypes) {
|
|
|
143
143
|
OutputTypes["json"] = "json";
|
|
144
144
|
return OutputTypes;
|
|
145
145
|
}({});
|
|
146
|
+
let LanguageTypes = exports.LanguageTypes = /*#__PURE__*/function (LanguageTypes) {
|
|
147
|
+
LanguageTypes["French"] = "fr-fr";
|
|
148
|
+
LanguageTypes["US"] = "en-us";
|
|
149
|
+
LanguageTypes["German"] = "de-de";
|
|
150
|
+
LanguageTypes["Portugese"] = "pt-br";
|
|
151
|
+
return LanguageTypes;
|
|
152
|
+
}({});
|
|
146
153
|
let TrueFalse = exports.TrueFalse = /*#__PURE__*/function (TrueFalse) {
|
|
147
154
|
TrueFalse["True"] = "True";
|
|
148
155
|
TrueFalse["False"] = "False";
|