fnos-cli 0.2.1 → 0.3.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/CHANGELOG.md +116 -0
- package/README.md +70 -268
- package/bin/fnos +5 -1
- package/docs/commands.md +775 -0
- package/package.json +1 -1
- package/src/commands/auth.js +42 -55
- package/src/commands/catalog/applications.js +30 -0
- package/src/commands/catalog/identity-security.js +52 -0
- package/src/commands/catalog/index.js +21 -0
- package/src/commands/catalog/monitoring.js +40 -0
- package/src/commands/catalog/network-sharing.js +81 -0
- package/src/commands/catalog/storage.js +107 -0
- package/src/commands/catalog/system.js +51 -0
- package/src/commands/index.js +18 -139
- package/src/commands/options.js +128 -0
- package/src/commands/runner.js +37 -0
- package/src/index.js +41 -51
- package/src/utils/auth-helper.js +13 -6
- package/src/utils/client.js +135 -113
- package/src/utils/errors.js +11 -0
- package/src/utils/logger.js +25 -1
- package/src/utils/settings.js +33 -72
- package/src/constants.js +0 -69
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":
|
|
1
|
+
{"name":"fnos-cli","version":"0.3.0","description":"CLI client for 飞牛 fnOS system","main":"src/index.js","bin":{"fnos":"./bin/fnos"},"files":["bin/","src/","README.md","CHANGELOG.md","LICENSE","docs/commands.md"],"scripts":{"start":"node src/index.js","test":"npm run test:unit","test:unit":"mocha \"test/unit/**/*.test.js\"","test:smoke":"mocha --timeout 180000 \"test/smoke/**/*.test.js\"","test:all":"npm run test:unit && npm run test:smoke","docs:commands":"node scripts/generate-command-reference.js"},"keywords":["fnos","cli","nas"],"author":"Timandes White","license":"Apache-2.0","engines":{"node":">=18"},"repository":{"type":"git","url":"git+https://github.com/Timandes/fnos-cli.git"},"bugs":{"url":"https://github.com/Timandes/fnos-cli/issues"},"homepage":"https://github.com/Timandes/fnos-cli#readme","publishConfig":{"registry":"https://registry.npmjs.org/"},"dependencies":{"commander":"^11.1.0","fnos":"^0.4.0","winston":"^3.19.0"},"devDependencies":{"chai":"^5.3.3","mocha":"^10.8.2"}}
|
package/src/commands/auth.js
CHANGED
|
@@ -1,62 +1,49 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Authentication commands (login, logout)
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const { Command } = require('commander');
|
|
6
1
|
const settings = require('../utils/settings');
|
|
7
2
|
const { createClient } = require('../utils/client');
|
|
8
|
-
const {
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Register login command
|
|
12
|
-
* @param {Command} program - Commander program instance
|
|
13
|
-
*/
|
|
14
|
-
function registerLoginCommand(program) {
|
|
15
|
-
program
|
|
16
|
-
.command('login')
|
|
17
|
-
.description('Login to fnOS system and save credentials')
|
|
18
|
-
.requiredOption('-e, --endpoint <endpoint>', 'Server endpoint (e.g., nas-9.timandes.net:5666)')
|
|
19
|
-
.requiredOption('-u, --username <username>', 'Username')
|
|
20
|
-
.requiredOption('-p, --password <password>', 'Password')
|
|
21
|
-
.action(async (options) => {
|
|
22
|
-
try {
|
|
23
|
-
const { endpoint, username, password } = options;
|
|
3
|
+
const { errorMessage } = require('../utils/errors');
|
|
4
|
+
const { registerAuthenticationOptions } = require('./options');
|
|
24
5
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
function registerLoginCommand(program, dependencies = {}) {
|
|
7
|
+
const create = dependencies.createClient || createClient;
|
|
8
|
+
const stderr = dependencies.stderr || console.error;
|
|
9
|
+
const command = program.command('login').description('Login to fnOS and save credentials');
|
|
10
|
+
registerAuthenticationOptions(command, true);
|
|
11
|
+
command.action(async (options) => {
|
|
12
|
+
let client;
|
|
13
|
+
try {
|
|
14
|
+
client = await create({
|
|
15
|
+
endpoint: options.endpoint,
|
|
16
|
+
username: options.username,
|
|
17
|
+
password: options.password,
|
|
18
|
+
timeout: 60,
|
|
19
|
+
saveCredentials: true,
|
|
20
|
+
twofaCode: options.twofaCode,
|
|
21
|
+
trustDevice: options.trustDevice,
|
|
22
|
+
verifySsl: options.verifySsl
|
|
23
|
+
});
|
|
24
|
+
process.exitCode = 0;
|
|
25
|
+
} catch (error) {
|
|
26
|
+
stderr(`Error: ${errorMessage(error)}`);
|
|
27
|
+
process.exitCode = error.exitCode || 1;
|
|
28
|
+
} finally {
|
|
29
|
+
if (client) client.close();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
35
32
|
}
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
console.log('Logged out successfully. Credentials cleared.');
|
|
51
|
-
} else {
|
|
52
|
-
console.log('No saved credentials found.');
|
|
53
|
-
}
|
|
54
|
-
process.exit(0);
|
|
55
|
-
} catch (error) {
|
|
56
|
-
logger.error(`Logout failed: ${error.message}`);
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
34
|
+
function registerLogoutCommand(program, dependencies = {}) {
|
|
35
|
+
const store = dependencies.settings || settings;
|
|
36
|
+
const stdout = dependencies.stdout || console.log;
|
|
37
|
+
program.command('logout').description('Logout and clear saved credentials').action(() => {
|
|
38
|
+
const credentials = store.getCredentials();
|
|
39
|
+
if (credentials && (credentials.endpoint || credentials.username)) {
|
|
40
|
+
store.clearCredentials();
|
|
41
|
+
stdout('Logged out successfully. Credentials cleared.');
|
|
42
|
+
} else {
|
|
43
|
+
stdout('No saved credentials found.');
|
|
44
|
+
}
|
|
45
|
+
process.exitCode = 0;
|
|
46
|
+
});
|
|
60
47
|
}
|
|
61
48
|
|
|
62
|
-
module.exports = { registerLoginCommand, registerLogoutCommand };
|
|
49
|
+
module.exports = { registerLoginCommand, registerLogoutCommand };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const command = (method, description, options = [], timeoutPosition = 'last') => ({
|
|
2
|
+
method,
|
|
3
|
+
description,
|
|
4
|
+
timeoutPosition,
|
|
5
|
+
options
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const applicationsCatalog = {
|
|
9
|
+
docker: {
|
|
10
|
+
className: 'DockerManager',
|
|
11
|
+
commands: {
|
|
12
|
+
listComposes: command('listComposes', 'List Docker Compose projects'),
|
|
13
|
+
listContainers: command('listContainers', 'List Docker containers', [
|
|
14
|
+
{ name: 'all', flag: '--all <boolean>', type: 'boolean', defaultValue: true, description: 'Include stopped containers' }
|
|
15
|
+
]),
|
|
16
|
+
stats: command('stats', 'Get Docker container statistics'),
|
|
17
|
+
getSystemSettings: command('getSystemSettings', 'Get Docker system settings'),
|
|
18
|
+
listImageDownloads: command('listImageDownloads', 'List Docker image downloads'),
|
|
19
|
+
listImages: command('listImages', 'List Docker images'),
|
|
20
|
+
listNetworks: command('listNetworks', 'List Docker networks'),
|
|
21
|
+
listRegistryRepositories: command('listRegistryRepositories', 'List Docker registry repositories', [
|
|
22
|
+
{ name: 'keyword', flag: '--keyword <keyword>', type: 'string', defaultValue: '', description: 'Search keyword' },
|
|
23
|
+
{ name: 'page', flag: '--page <integer>', type: 'integer', min: 1, defaultValue: 1, description: 'Page number' },
|
|
24
|
+
{ name: 'pageSize', flag: '--page-size <integer>', type: 'integer', min: 1, defaultValue: 20, description: 'Items per page' }
|
|
25
|
+
])
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
module.exports = { applicationsCatalog };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const command = (method, description, options = [], timeoutPosition = 'last') => ({
|
|
2
|
+
method,
|
|
3
|
+
description,
|
|
4
|
+
timeoutPosition,
|
|
5
|
+
options
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const identitySecurityCatalog = {
|
|
9
|
+
user: {
|
|
10
|
+
className: 'User',
|
|
11
|
+
commands: {
|
|
12
|
+
info: command('getInfo', 'Get user information'),
|
|
13
|
+
listUG: command('listUserGroups', 'List users and groups'),
|
|
14
|
+
groupUsers: command('groupUsers', 'Get user grouping information'),
|
|
15
|
+
isAdmin: command('isAdmin', 'Check whether the current user is an administrator'),
|
|
16
|
+
listTokens: command('listTokens', 'List authentication tokens'),
|
|
17
|
+
getMyTwofaConfig: command('getMyTwofaConfig', 'Get current user two-factor configuration'),
|
|
18
|
+
getGlobalTwofaConfig: command('getGlobalTwofaConfig', 'Get global two-factor configuration'),
|
|
19
|
+
getUserTwofaConfig: command('getUserTwofaConfig', 'Get a user two-factor configuration', [
|
|
20
|
+
{ name: 'uid', flag: '--uid <integer>', type: 'integer', min: 0, required: true, description: 'User ID' }
|
|
21
|
+
]),
|
|
22
|
+
getActiveState: command('getActiveState', 'Get current user active state'),
|
|
23
|
+
getGroupInfo: command('getGroupInfo', 'Get group information', [
|
|
24
|
+
{ name: 'group', flag: '--group <group>', type: 'string', required: true, description: 'Group name' }
|
|
25
|
+
]),
|
|
26
|
+
listGroups: command('listGroups', 'List groups'),
|
|
27
|
+
listLoginDevices: command('listLoginDevices', 'List login devices'),
|
|
28
|
+
getPreference: command('getPreference', 'Get a user preference', [
|
|
29
|
+
{ name: 'name', flag: '--name <name>', type: 'string', required: true, description: 'Preference name' }
|
|
30
|
+
])
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
ipblock: {
|
|
34
|
+
className: 'IPBlocker',
|
|
35
|
+
commands: {
|
|
36
|
+
listAllowedAddresses: command('listAllowedAddresses', 'List allowed IP addresses'),
|
|
37
|
+
getAutoBlockRule: command('getAutoBlockRule', 'Get automatic IP blocking rule'),
|
|
38
|
+
listDeniedAddresses: command('listDeniedAddresses', 'List denied IP addresses')
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
security: {
|
|
42
|
+
className: 'Security',
|
|
43
|
+
commands: {
|
|
44
|
+
getFirewall: command('getFirewall', 'Get firewall configuration'),
|
|
45
|
+
getProcessTraffic: command('getProcessTraffic', 'Get process traffic data', [
|
|
46
|
+
{ name: 'processes', flag: '--processes <json>', type: 'json-record-array', required: true, description: 'Process objects as a JSON array' }
|
|
47
|
+
])
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = { identitySecurityCatalog };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const { monitoringCatalog } = require('./monitoring');
|
|
2
|
+
const { storageCatalog } = require('./storage');
|
|
3
|
+
const { systemCatalog } = require('./system');
|
|
4
|
+
const { identitySecurityCatalog } = require('./identity-security');
|
|
5
|
+
const { networkSharingCatalog } = require('./network-sharing');
|
|
6
|
+
const { applicationsCatalog } = require('./applications');
|
|
7
|
+
|
|
8
|
+
const COMMAND_CATALOG = Object.freeze({
|
|
9
|
+
...monitoringCatalog,
|
|
10
|
+
...storageCatalog,
|
|
11
|
+
...systemCatalog,
|
|
12
|
+
...identitySecurityCatalog,
|
|
13
|
+
...networkSharingCatalog,
|
|
14
|
+
...applicationsCatalog
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const DOMAIN_COUNT = Object.keys(COMMAND_CATALOG).length;
|
|
18
|
+
const COMMAND_COUNT = Object.values(COMMAND_CATALOG)
|
|
19
|
+
.reduce((count, domain) => count + Object.keys(domain.commands).length, 0);
|
|
20
|
+
|
|
21
|
+
module.exports = { COMMAND_CATALOG, DOMAIN_COUNT, COMMAND_COUNT };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const command = (method, description, options = [], timeoutPosition = 'last') => ({
|
|
2
|
+
method,
|
|
3
|
+
description,
|
|
4
|
+
timeoutPosition,
|
|
5
|
+
options
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const monitoringCatalog = {
|
|
9
|
+
resmon: {
|
|
10
|
+
className: 'ResourceMonitor',
|
|
11
|
+
commands: {
|
|
12
|
+
cpu: command('cpu', 'Get CPU resource monitoring information', [], 'first'),
|
|
13
|
+
gpu: command('gpu', 'Get GPU resource monitoring information', [], 'first'),
|
|
14
|
+
mem: command('memory', 'Get memory resource monitoring information', [], 'first'),
|
|
15
|
+
disk: command('disk', 'Get disk resource monitoring information', [], 'first'),
|
|
16
|
+
net: command('net', 'Get network resource monitoring information', [], 'first'),
|
|
17
|
+
gen: command('general', 'Get general resource monitoring information', [
|
|
18
|
+
{ name: 'items', flag: '--items <items>', type: 'csv', defaultValue: null, description: 'Comma-separated monitoring items' }
|
|
19
|
+
], 'first'),
|
|
20
|
+
npu: command('npu', 'Get NPU resource monitoring information', [], 'first'),
|
|
21
|
+
processes: command('processes', 'List monitored processes', [], 'first'),
|
|
22
|
+
serviceProcesses: command('serviceProcesses', 'List monitored service processes', [], 'first'),
|
|
23
|
+
systemFan: command('systemFan', 'Get system fan monitoring information', [], 'first')
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
event: {
|
|
27
|
+
className: 'EventLogger',
|
|
28
|
+
commands: {
|
|
29
|
+
commonList: command('commonList', 'List common event log entries')
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
notify: {
|
|
33
|
+
className: 'Notify',
|
|
34
|
+
commands: {
|
|
35
|
+
unreadTotal: command('unreadTotal', 'Get unread notification total')
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
module.exports = { monitoringCatalog };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const command = (method, description, options = [], timeoutPosition = 'last') => ({
|
|
2
|
+
method,
|
|
3
|
+
description,
|
|
4
|
+
timeoutPosition,
|
|
5
|
+
options
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const networkSharingCatalog = {
|
|
9
|
+
network: {
|
|
10
|
+
className: 'Network',
|
|
11
|
+
commands: {
|
|
12
|
+
list: command('list', 'List network information', [
|
|
13
|
+
{ name: 'type', flag: '--type <integer>', type: 'integer', allowedValues: [0, 1], defaultValue: 0, description: 'Network list type: 0 or 1' }
|
|
14
|
+
]),
|
|
15
|
+
detect: command('detect', 'Detect a network interface', [
|
|
16
|
+
{ name: 'ifName', flag: '--if-name <name>', legacyFlags: ['--ifName <name>'], type: 'string', required: true, description: 'Network interface name' }
|
|
17
|
+
]),
|
|
18
|
+
getGateway: command('getGateway', 'Get gateway information'),
|
|
19
|
+
getMultiGatewayStatus: command('getMultiGatewayStatus', 'Get multi-gateway status'),
|
|
20
|
+
getNicPerformanceMode: command('getNicPerformanceMode', 'Get NIC performance mode'),
|
|
21
|
+
getInfo: command('getInfo', 'Get network interface information', [
|
|
22
|
+
{ name: 'ifName', flag: '--if-name <name>', legacyFlags: ['--ifName <name>'], type: 'string', required: true, description: 'Network interface name' }
|
|
23
|
+
]),
|
|
24
|
+
getSshStatus: command('getSshStatus', 'Get SSH service status')
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
share: {
|
|
28
|
+
className: 'Share',
|
|
29
|
+
commands: {
|
|
30
|
+
smbOpt: command('smbOpt', 'Get SMB options'),
|
|
31
|
+
dlnaOptions: command('dlnaOptions', 'Get DLNA options'),
|
|
32
|
+
dlnaShareOptions: command('dlnaShareOptions', 'Get DLNA share options'),
|
|
33
|
+
ftpOptions: command('ftpOptions', 'Get FTP options'),
|
|
34
|
+
ftpShareOptions: command('ftpShareOptions', 'Get FTP share options'),
|
|
35
|
+
nfsOptions: command('nfsOptions', 'Get NFS options'),
|
|
36
|
+
nfsShareOptions: command('nfsShareOptions', 'Get NFS share options'),
|
|
37
|
+
smbShareOptions: command('smbShareOptions', 'Get SMB share options'),
|
|
38
|
+
webdavOptions: command('webdavOptions', 'Get WebDAV options'),
|
|
39
|
+
webdavShareOptions: command('webdavShareOptions', 'Get WebDAV share options'),
|
|
40
|
+
getLinkDefaults: command('getLinkDefaults', 'Get share link defaults'),
|
|
41
|
+
getDefaultLink: command('getDefaultLink', 'Get the default share link'),
|
|
42
|
+
listLinks: command('listLinks', 'List share links', [
|
|
43
|
+
{ name: 'isAdmin', flag: '--is-admin <boolean>', type: 'boolean', defaultValue: false, description: 'Use administrator view' },
|
|
44
|
+
{ name: 'keyword', flag: '--keyword <keyword>', type: 'string', defaultValue: '', description: 'Search keyword' },
|
|
45
|
+
{ name: 'page', flag: '--page <integer>', type: 'integer', min: 1, defaultValue: 1, description: 'Page number' },
|
|
46
|
+
{ name: 'pageSize', flag: '--page-size <integer>', type: 'integer', min: 1, defaultValue: 100, description: 'Items per page' },
|
|
47
|
+
{ name: 'sortColumn', flag: '--sort-column <column>', type: 'string', defaultValue: 'createdTime', description: 'Sort column' },
|
|
48
|
+
{ name: 'sortType', flag: '--sort-type <type>', type: 'string', defaultValue: 'DESC', description: 'Sort direction' }
|
|
49
|
+
]),
|
|
50
|
+
getLinkPermission: command('getLinkPermission', 'Get share link permission')
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
iscsi: {
|
|
54
|
+
className: 'IscsiManager',
|
|
55
|
+
commands: {
|
|
56
|
+
getConfig: command('getConfig', 'Get iSCSI configuration'),
|
|
57
|
+
listInitiators: command('listInitiators', 'List iSCSI initiators'),
|
|
58
|
+
listLuns: command('listLuns', 'List iSCSI LUNs'),
|
|
59
|
+
listLunUsergroups: command('listLunUsergroups', 'List iSCSI LUN user groups', [
|
|
60
|
+
{ name: 'lunName', flag: '--lun-name <name>', type: 'string', defaultValue: '', description: 'LUN name filter' },
|
|
61
|
+
{ name: 'wwn', flag: '--wwn <wwn>', type: 'string', defaultValue: '', description: 'WWN filter' }
|
|
62
|
+
]),
|
|
63
|
+
listTargets: command('listTargets', 'List iSCSI targets')
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
netsvr: {
|
|
67
|
+
className: 'NetworkServer',
|
|
68
|
+
commands: {
|
|
69
|
+
listCertificates: command('listCertificates', 'List server certificates'),
|
|
70
|
+
getConnectionConfig: command('getConnectionConfig', 'Get connection configuration'),
|
|
71
|
+
getConnectionStatus: command('getConnectionStatus', 'Get connection status'),
|
|
72
|
+
listDdnsProviders: command('listDdnsProviders', 'List DDNS providers'),
|
|
73
|
+
listDdnsRecords: command('listDdnsRecords', 'List DDNS records', [
|
|
74
|
+
{ name: 'page', flag: '--page <integer>', type: 'integer', min: 1, defaultValue: 1, description: 'Page number' },
|
|
75
|
+
{ name: 'pageSize', flag: '--page-size <integer>', type: 'integer', min: 1, defaultValue: 200, description: 'Items per page' }
|
|
76
|
+
])
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
module.exports = { networkSharingCatalog };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const command = (method, description, options = [], timeoutPosition = 'last') => ({
|
|
2
|
+
method,
|
|
3
|
+
description,
|
|
4
|
+
timeoutPosition,
|
|
5
|
+
options
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const storageCatalog = {
|
|
9
|
+
store: {
|
|
10
|
+
className: 'Store',
|
|
11
|
+
commands: {
|
|
12
|
+
general: command('general', 'Get storage general information'),
|
|
13
|
+
calcSpace: command('calculateSpace', 'Calculate storage space information'),
|
|
14
|
+
listDisk: command('listDisks', 'List disk information', [
|
|
15
|
+
{
|
|
16
|
+
name: 'noHotSpare',
|
|
17
|
+
flag: '--no-hot-spare <boolean>',
|
|
18
|
+
legacyFlags: ['--noHotSpare <boolean>'],
|
|
19
|
+
readNames: ['noHotSpare', 'hotSpare'],
|
|
20
|
+
type: 'boolean',
|
|
21
|
+
defaultValue: true,
|
|
22
|
+
description: 'Exclude hot spare disks'
|
|
23
|
+
}
|
|
24
|
+
]),
|
|
25
|
+
diskSmart: command('getDiskSmart', 'Get disk SMART information', [
|
|
26
|
+
{ name: 'disk', flag: '--disk <disk>', type: 'string', required: true, description: 'Disk device name' }
|
|
27
|
+
]),
|
|
28
|
+
state: command('getState', 'Get storage state information', [
|
|
29
|
+
{ name: 'name', flag: '--name <names>', type: 'csv', defaultValue: [], description: 'Comma-separated array names' },
|
|
30
|
+
{ name: 'uuid', flag: '--uuid <uuids>', type: 'csv', defaultValue: [], description: 'Comma-separated array UUIDs' }
|
|
31
|
+
]),
|
|
32
|
+
getUserStorage: command('getUserStorage', 'Get user storage information', [
|
|
33
|
+
{ name: 'spaceInfo', flag: '--space-info <boolean>', type: 'boolean', defaultValue: false, description: 'Include space information' },
|
|
34
|
+
{ name: 'storInfo', flag: '--stor-info <boolean>', type: 'boolean', defaultValue: false, description: 'Include storage information' },
|
|
35
|
+
{ name: 'quotaInfo', flag: '--quota-info <boolean>', type: 'boolean', defaultValue: false, description: 'Include quota information' }
|
|
36
|
+
]),
|
|
37
|
+
getCacheDeviceState: command('getCacheDeviceState', 'Get cache device state'),
|
|
38
|
+
getDiskIdleTime: command('getDiskIdleTime', 'Get disk idle time'),
|
|
39
|
+
getDiskWakeup: command('getDiskWakeup', 'Get disk wake-up state'),
|
|
40
|
+
getRemovableConfig: command('getRemovableConfig', 'Get removable device configuration'),
|
|
41
|
+
listCacheDevices: command('listCacheDevices', 'List cache devices'),
|
|
42
|
+
listRemovableDevices: command('listRemovableDevices', 'List removable devices')
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
file: {
|
|
46
|
+
className: 'File',
|
|
47
|
+
commands: {
|
|
48
|
+
ls: command('list', 'List files and directories', [
|
|
49
|
+
{ name: 'path', flag: '--path <path>', type: 'string', defaultValue: null, description: 'Directory path' }
|
|
50
|
+
]),
|
|
51
|
+
mkdir: command('mkdir', 'Create a directory', [
|
|
52
|
+
{ name: 'path', flag: '--path <path>', type: 'string', required: true, description: 'Directory path' }
|
|
53
|
+
]),
|
|
54
|
+
rm: command('remove', 'Remove files or directories', [
|
|
55
|
+
{ name: 'files', flag: '--files <files>', type: 'csv', required: true, description: 'Comma-separated file paths' },
|
|
56
|
+
{
|
|
57
|
+
name: 'moveToTrashbin',
|
|
58
|
+
flag: '--move-to-trashbin <boolean>',
|
|
59
|
+
legacyFlags: ['--moveToTrashbin <boolean>'],
|
|
60
|
+
type: 'boolean',
|
|
61
|
+
defaultValue: true,
|
|
62
|
+
description: 'Move removed files to trash'
|
|
63
|
+
},
|
|
64
|
+
{ name: 'details', flag: '--details <json>', type: 'json', defaultValue: null, description: 'File detail object as JSON' }
|
|
65
|
+
]),
|
|
66
|
+
getAcl: command('getAcl', 'Get file ACL information', [
|
|
67
|
+
{ name: 'files', flag: '--files <files>', type: 'csv', required: true, description: 'Comma-separated vol-prefixed paths' }
|
|
68
|
+
]),
|
|
69
|
+
listAppDirectories: command('listAppDirectories', 'List application directories'),
|
|
70
|
+
listFavorites: command('listFavorites', 'List favorite files'),
|
|
71
|
+
listDirectoryEntries: command('listDirectoryEntries', 'List directory entries'),
|
|
72
|
+
listRecent: command('listRecent', 'List recent files'),
|
|
73
|
+
listShared: command('listShared', 'List shared files'),
|
|
74
|
+
listSharedByOthers: command('listSharedByOthers', 'List files shared by others'),
|
|
75
|
+
listTeamTrashBins: command('listTeamTrashBins', 'List team trash bins'),
|
|
76
|
+
listTrash: command('listTrash', 'List trash entries')
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
backup: {
|
|
80
|
+
className: 'BackupManager',
|
|
81
|
+
commands: {
|
|
82
|
+
listTasks: command('listTasks', 'List backup tasks', [
|
|
83
|
+
{ name: 'direction', flag: '--direction <integer>', type: 'integer', required: true, allowedValues: [0, 1], description: 'Backup direction: 0 or 1' }
|
|
84
|
+
])
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
download: {
|
|
88
|
+
className: 'DownloadCenter',
|
|
89
|
+
commands: {
|
|
90
|
+
getDefaultSaveDirectory: command('getDefaultSaveDirectory', 'Get the default download directory'),
|
|
91
|
+
getStatistics: command('getStatistics', 'Get download statistics'),
|
|
92
|
+
queryTasks: command('queryTasks', 'Query download tasks', [
|
|
93
|
+
{ name: 'stateFilter', flag: '--state-filter <integer>', type: 'integer', min: 0, defaultValue: 65535, description: 'Task state bit mask' },
|
|
94
|
+
{ name: 'initFlag', flag: '--init-flag <boolean>', type: 'boolean', defaultValue: true, description: 'Include initialization data' }
|
|
95
|
+
])
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
mount: {
|
|
99
|
+
className: 'MountManager',
|
|
100
|
+
commands: {
|
|
101
|
+
listMounts: command('listMounts', 'List mounted resources'),
|
|
102
|
+
getSettings: command('getSettings', 'Get mount settings')
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
module.exports = { storageCatalog };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const command = (method, description, options = [], timeoutPosition = 'last') => ({
|
|
2
|
+
method,
|
|
3
|
+
description,
|
|
4
|
+
timeoutPosition,
|
|
5
|
+
options
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const systemCatalog = {
|
|
9
|
+
sysinfo: {
|
|
10
|
+
className: 'SystemInfo',
|
|
11
|
+
commands: {
|
|
12
|
+
getHostName: command('getHostName', 'Get host name information'),
|
|
13
|
+
getTrimVersion: command('getTrimVersion', 'Get Trim version information'),
|
|
14
|
+
getMachineId: command('getMachineId', 'Get machine ID information'),
|
|
15
|
+
getHardwareInfo: command('getHardwareInfo', 'Get hardware information'),
|
|
16
|
+
getUptime: command('getUptime', 'Get system uptime information'),
|
|
17
|
+
getReservedPartition: command('getReservedPartition', 'Get reserved partition information')
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
sac: {
|
|
21
|
+
className: 'SAC',
|
|
22
|
+
commands: {
|
|
23
|
+
upsStatus: command('upsStatus', 'Get UPS status information'),
|
|
24
|
+
getEmailConfig: command('getEmailConfig', 'Get email notification configuration'),
|
|
25
|
+
listEmailProviders: command('listEmailProviders', 'List email notification providers')
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
license: {
|
|
29
|
+
className: 'LicenseManager',
|
|
30
|
+
commands: {
|
|
31
|
+
list: command('list', 'List installed software licenses', [
|
|
32
|
+
{ name: 'page', flag: '--page <integer>', type: 'integer', min: 1, defaultValue: 1, description: 'Page number' },
|
|
33
|
+
{ name: 'pageSize', flag: '--page-size <integer>', type: 'integer', min: 1, defaultValue: 200, description: 'Items per page' }
|
|
34
|
+
])
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
liveupdate: {
|
|
38
|
+
className: 'LiveUpdate',
|
|
39
|
+
commands: {
|
|
40
|
+
getStatus: command('getStatus', 'Get live update status')
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
sysrestore: {
|
|
44
|
+
className: 'SystemRestore',
|
|
45
|
+
commands: {
|
|
46
|
+
getInfo: command('getInfo', 'Get system restore information')
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
module.exports = { systemCatalog };
|