@xano/cli 0.0.32 → 0.0.34
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/dist/commands/tenant/backup/create/index.d.ts +1 -4
- package/dist/commands/tenant/backup/create/index.js +8 -8
- package/dist/commands/tenant/backup/delete/index.d.ts +1 -4
- package/dist/commands/tenant/backup/delete/index.js +8 -8
- package/dist/commands/tenant/backup/export/index.d.ts +1 -4
- package/dist/commands/tenant/backup/export/index.js +11 -11
- package/dist/commands/tenant/backup/import/index.d.ts +1 -4
- package/dist/commands/tenant/backup/import/index.js +8 -8
- package/dist/commands/tenant/backup/list/index.d.ts +1 -4
- package/dist/commands/tenant/backup/list/index.js +9 -9
- package/dist/commands/tenant/backup/restore/index.d.ts +1 -4
- package/dist/commands/tenant/backup/restore/index.js +10 -10
- package/dist/commands/tenant/delete/index.d.ts +1 -4
- package/dist/commands/tenant/delete/index.js +13 -13
- package/dist/commands/tenant/{deploy-platform → deploy_platform}/index.d.ts +1 -4
- package/dist/commands/tenant/{deploy-platform → deploy_platform}/index.js +7 -7
- package/dist/commands/tenant/{deploy-release → deploy_release}/index.d.ts +1 -4
- package/dist/commands/tenant/{deploy-release → deploy_release}/index.js +6 -6
- package/dist/commands/tenant/edit/index.d.ts +1 -4
- package/dist/commands/tenant/edit/index.js +6 -6
- package/dist/commands/tenant/get/index.d.ts +1 -4
- package/dist/commands/tenant/get/index.js +8 -8
- package/dist/commands/tenant/list/index.js +1 -1
- package/dist/commands/workflow_test/delete/index.d.ts +21 -0
- package/dist/commands/workflow_test/delete/index.js +130 -0
- package/dist/commands/workflow_test/get/index.d.ts +20 -0
- package/dist/commands/workflow_test/get/index.js +142 -0
- package/dist/commands/workflow_test/list/index.d.ts +14 -0
- package/dist/commands/workflow_test/list/index.js +129 -0
- package/dist/commands/workflow_test/run/index.d.ts +19 -0
- package/dist/commands/workflow_test/run/index.js +119 -0
- package/dist/commands/workflow_test/run_all/index.d.ts +14 -0
- package/dist/commands/workflow_test/run_all/index.js +204 -0
- package/dist/commands/workspace/create/index.d.ts +3 -1
- package/dist/commands/workspace/create/index.js +12 -11
- package/oclif.manifest.json +1992 -1596
- package/package.json +4 -1
- /package/dist/commands/branch/{set-live → set_live}/index.d.ts +0 -0
- /package/dist/commands/branch/{set-live → set_live}/index.js +0 -0
- /package/dist/commands/profile/{get-default → get_default}/index.d.ts +0 -0
- /package/dist/commands/profile/{get-default → get_default}/index.js +0 -0
- /package/dist/commands/profile/{set-default → set_default}/index.d.ts +0 -0
- /package/dist/commands/profile/{set-default → set_default}/index.js +0 -0
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
2
|
export default class TenantBackupCreate extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -6,17 +6,17 @@ import * as path from 'node:path';
|
|
|
6
6
|
import BaseCommand from '../../../../base-command.js';
|
|
7
7
|
export default class TenantBackupCreate extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
|
|
10
|
-
description: 'Tenant
|
|
9
|
+
tenant_name: Args.string({
|
|
10
|
+
description: 'Tenant name to back up',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
14
|
static description = 'Create a backup for a tenant';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano tenant backup create
|
|
17
|
-
Created backup #15 for tenant
|
|
16
|
+
`$ xano tenant backup create t1234-abcd-xyz1 --description "Pre-deploy backup"
|
|
17
|
+
Created backup #15 for tenant t1234-abcd-xyz1
|
|
18
18
|
`,
|
|
19
|
-
`$ xano tenant backup create
|
|
19
|
+
`$ xano tenant backup create t1234-abcd-xyz1 -d "Daily backup" -o json`,
|
|
20
20
|
];
|
|
21
21
|
static flags = {
|
|
22
22
|
...BaseCommand.baseFlags,
|
|
@@ -58,8 +58,8 @@ Created backup #15 for tenant 42
|
|
|
58
58
|
if (!workspaceId) {
|
|
59
59
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
61
|
+
const tenantName = args.tenant_name;
|
|
62
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/backup`;
|
|
63
63
|
try {
|
|
64
64
|
const response = await this.verboseFetch(apiUrl, {
|
|
65
65
|
body: JSON.stringify({ description: flags.description }),
|
|
@@ -79,7 +79,7 @@ Created backup #15 for tenant 42
|
|
|
79
79
|
this.log(JSON.stringify(result, null, 2));
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
-
this.log(`Created backup #${result.id} for tenant ${
|
|
82
|
+
this.log(`Created backup #${result.id} for tenant ${tenantName}`);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
catch (error) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
2
|
export default class TenantBackupDelete extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -7,19 +7,19 @@ import * as yaml from 'js-yaml';
|
|
|
7
7
|
import BaseCommand from '../../../../base-command.js';
|
|
8
8
|
export default class TenantBackupDelete extends BaseCommand {
|
|
9
9
|
static args = {
|
|
10
|
-
|
|
11
|
-
description: 'Tenant
|
|
10
|
+
tenant_name: Args.string({
|
|
11
|
+
description: 'Tenant name that owns the backup',
|
|
12
12
|
required: true,
|
|
13
13
|
}),
|
|
14
14
|
};
|
|
15
15
|
static description = 'Delete a tenant backup permanently. This action cannot be undone.';
|
|
16
16
|
static examples = [
|
|
17
|
-
`$ xano tenant backup delete
|
|
17
|
+
`$ xano tenant backup delete t1234-abcd-xyz1 --backup-id 10
|
|
18
18
|
Are you sure you want to delete backup #10? This action cannot be undone. (y/N) y
|
|
19
19
|
Deleted backup #10
|
|
20
20
|
`,
|
|
21
|
-
`$ xano tenant backup delete
|
|
22
|
-
`$ xano tenant backup delete
|
|
21
|
+
`$ xano tenant backup delete t1234-abcd-xyz1 --backup-id 10 --force`,
|
|
22
|
+
`$ xano tenant backup delete t1234-abcd-xyz1 --backup-id 10 -o json`,
|
|
23
23
|
];
|
|
24
24
|
static flags = {
|
|
25
25
|
...BaseCommand.baseFlags,
|
|
@@ -65,7 +65,7 @@ Deleted backup #10
|
|
|
65
65
|
if (!workspaceId) {
|
|
66
66
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const tenantName = args.tenant_name;
|
|
69
69
|
const backupId = flags['backup-id'];
|
|
70
70
|
if (!flags.force) {
|
|
71
71
|
const confirmed = await this.confirm(`Are you sure you want to delete backup #${backupId}? This action cannot be undone.`);
|
|
@@ -74,7 +74,7 @@ Deleted backup #10
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
77
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/backup/${backupId}`;
|
|
78
78
|
try {
|
|
79
79
|
const response = await this.verboseFetch(apiUrl, {
|
|
80
80
|
headers: {
|
|
@@ -88,7 +88,7 @@ Deleted backup #10
|
|
|
88
88
|
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
89
89
|
}
|
|
90
90
|
if (flags.output === 'json') {
|
|
91
|
-
this.log(JSON.stringify({ backup_id: backupId, deleted: true,
|
|
91
|
+
this.log(JSON.stringify({ backup_id: backupId, deleted: true, tenant_name: tenantName }, null, 2));
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
94
|
this.log(`Deleted backup #${backupId}`);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
2
|
export default class TenantBackupExport extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -6,18 +6,18 @@ import * as yaml from 'js-yaml';
|
|
|
6
6
|
import BaseCommand from '../../../../base-command.js';
|
|
7
7
|
export default class TenantBackupExport extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
|
|
10
|
-
description: 'Tenant
|
|
9
|
+
tenant_name: Args.string({
|
|
10
|
+
description: 'Tenant name to export backup from',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
14
|
static description = 'Export (download) a tenant backup to a local file';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano tenant backup export
|
|
17
|
-
Downloaded backup #10 to ./tenant-
|
|
16
|
+
`$ xano tenant backup export t1234-abcd-xyz1 --backup-id 10
|
|
17
|
+
Downloaded backup #10 to ./tenant-t1234-abcd-xyz1-backup-10.tar.gz
|
|
18
18
|
`,
|
|
19
|
-
`$ xano tenant backup export
|
|
20
|
-
`$ xano tenant backup export
|
|
19
|
+
`$ xano tenant backup export t1234-abcd-xyz1 --backup-id 10 --output ./backups/my-backup.tar.gz`,
|
|
20
|
+
`$ xano tenant backup export t1234-abcd-xyz1 --backup-id 10 -o json`,
|
|
21
21
|
];
|
|
22
22
|
static flags = {
|
|
23
23
|
...BaseCommand.baseFlags,
|
|
@@ -33,7 +33,7 @@ Downloaded backup #10 to ./tenant-42-backup-10.tar.gz
|
|
|
33
33
|
required: false,
|
|
34
34
|
}),
|
|
35
35
|
output: Flags.string({
|
|
36
|
-
description: 'Output file path (defaults to ./tenant-{
|
|
36
|
+
description: 'Output file path (defaults to ./tenant-{name}-backup-{backup_id}.tar.gz)',
|
|
37
37
|
required: false,
|
|
38
38
|
}),
|
|
39
39
|
workspace: Flags.string({
|
|
@@ -61,10 +61,10 @@ Downloaded backup #10 to ./tenant-42-backup-10.tar.gz
|
|
|
61
61
|
if (!workspaceId) {
|
|
62
62
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
63
63
|
}
|
|
64
|
-
const
|
|
64
|
+
const tenantName = args.tenant_name;
|
|
65
65
|
const backupId = flags['backup-id'];
|
|
66
66
|
// Step 1: Get signed download URL
|
|
67
|
-
const exportUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
67
|
+
const exportUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/backup/${backupId}/export`;
|
|
68
68
|
try {
|
|
69
69
|
const response = await this.verboseFetch(exportUrl, {
|
|
70
70
|
headers: {
|
|
@@ -82,7 +82,7 @@ Downloaded backup #10 to ./tenant-42-backup-10.tar.gz
|
|
|
82
82
|
this.error('API did not return a download URL');
|
|
83
83
|
}
|
|
84
84
|
// Step 2: Download the file
|
|
85
|
-
const outputPath = flags.output || `tenant-${
|
|
85
|
+
const outputPath = flags.output || `tenant-${tenantName}-backup-${backupId}.tar.gz`;
|
|
86
86
|
const resolvedPath = path.resolve(outputPath);
|
|
87
87
|
const downloadResponse = await fetch(exportLink.src);
|
|
88
88
|
if (!downloadResponse.ok) {
|
|
@@ -109,7 +109,7 @@ Downloaded backup #10 to ./tenant-42-backup-10.tar.gz
|
|
|
109
109
|
fileStream.on('error', reject);
|
|
110
110
|
});
|
|
111
111
|
if (flags.format === 'json') {
|
|
112
|
-
this.log(JSON.stringify({ backup_id: backupId, bytes: totalBytes, file: resolvedPath,
|
|
112
|
+
this.log(JSON.stringify({ backup_id: backupId, bytes: totalBytes, file: resolvedPath, tenant_name: tenantName }, null, 2));
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
115
|
const sizeMb = (totalBytes / 1024 / 1024).toFixed(2);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
2
|
export default class TenantBackupImport extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -6,17 +6,17 @@ import * as yaml from 'js-yaml';
|
|
|
6
6
|
import BaseCommand from '../../../../base-command.js';
|
|
7
7
|
export default class TenantBackupImport extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
|
|
10
|
-
description: 'Tenant
|
|
9
|
+
tenant_name: Args.string({
|
|
10
|
+
description: 'Tenant name to import backup into',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
14
|
static description = 'Import a backup file into a tenant';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano tenant backup import
|
|
17
|
-
Imported backup as #15 for tenant
|
|
16
|
+
`$ xano tenant backup import t1234-abcd-xyz1 --file ./my-backup.tar.gz
|
|
17
|
+
Imported backup as #15 for tenant t1234-abcd-xyz1
|
|
18
18
|
`,
|
|
19
|
-
`$ xano tenant backup import
|
|
19
|
+
`$ xano tenant backup import t1234-abcd-xyz1 --file ./my-backup.tar.gz --description "Restored from production" -o json`,
|
|
20
20
|
];
|
|
21
21
|
static flags = {
|
|
22
22
|
...BaseCommand.baseFlags,
|
|
@@ -63,12 +63,12 @@ Imported backup as #15 for tenant 42
|
|
|
63
63
|
if (!workspaceId) {
|
|
64
64
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const tenantName = args.tenant_name;
|
|
67
67
|
const filePath = path.resolve(flags.file);
|
|
68
68
|
if (!fs.existsSync(filePath)) {
|
|
69
69
|
this.error(`File not found: ${filePath}`);
|
|
70
70
|
}
|
|
71
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
71
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/backup/import`;
|
|
72
72
|
try {
|
|
73
73
|
const fileBuffer = fs.readFileSync(filePath);
|
|
74
74
|
const blob = new Blob([fileBuffer], { type: 'application/gzip' });
|
|
@@ -93,7 +93,7 @@ Imported backup as #15 for tenant 42
|
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
95
|
const sizeMb = (fileBuffer.length / 1024 / 1024).toFixed(2);
|
|
96
|
-
this.log(`Imported backup as #${result.id} for tenant ${
|
|
96
|
+
this.log(`Imported backup as #${result.id} for tenant ${tenantName} (${sizeMb} MB)`);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
2
|
export default class TenantBackupList extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -6,19 +6,19 @@ import * as path from 'node:path';
|
|
|
6
6
|
import BaseCommand from '../../../../base-command.js';
|
|
7
7
|
export default class TenantBackupList extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
|
|
10
|
-
description: 'Tenant
|
|
9
|
+
tenant_name: Args.string({
|
|
10
|
+
description: 'Tenant name to list backups for',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
14
|
static description = 'List backups for a tenant';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano tenant backup list
|
|
17
|
-
Backups for tenant
|
|
16
|
+
`$ xano tenant backup list t1234-abcd-xyz1
|
|
17
|
+
Backups for tenant t1234-abcd-xyz1:
|
|
18
18
|
- #1 - Pre-deploy backup (2024-01-15)
|
|
19
19
|
- #2 - Daily backup (2024-01-16)
|
|
20
20
|
`,
|
|
21
|
-
`$ xano tenant backup list
|
|
21
|
+
`$ xano tenant backup list t1234-abcd-xyz1 -o json`,
|
|
22
22
|
];
|
|
23
23
|
static flags = {
|
|
24
24
|
...BaseCommand.baseFlags,
|
|
@@ -59,9 +59,9 @@ Backups for tenant 42:
|
|
|
59
59
|
if (!workspaceId) {
|
|
60
60
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const tenantName = args.tenant_name;
|
|
63
63
|
const queryParams = new URLSearchParams({ page: flags.page.toString() });
|
|
64
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
64
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/backup?${queryParams.toString()}`;
|
|
65
65
|
try {
|
|
66
66
|
const response = await this.verboseFetch(apiUrl, {
|
|
67
67
|
headers: {
|
|
@@ -90,10 +90,10 @@ Backups for tenant 42:
|
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
92
|
if (backups.length === 0) {
|
|
93
|
-
this.log(`No backups found for tenant ${
|
|
93
|
+
this.log(`No backups found for tenant ${tenantName}`);
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
|
-
this.log(`Backups for tenant ${
|
|
96
|
+
this.log(`Backups for tenant ${tenantName}:`);
|
|
97
97
|
for (const backup of backups) {
|
|
98
98
|
let date = 'unknown';
|
|
99
99
|
if (backup.created_at) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
2
|
export default class TenantRestore extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -6,18 +6,18 @@ import * as path from 'node:path';
|
|
|
6
6
|
import BaseCommand from '../../../../base-command.js';
|
|
7
7
|
export default class TenantRestore extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
|
|
10
|
-
description: 'Tenant
|
|
9
|
+
tenant_name: Args.string({
|
|
10
|
+
description: 'Tenant name to restore',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
14
|
static description = 'Restore a tenant from a backup. This replaces the current tenant data.';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano tenant backup restore
|
|
17
|
-
Are you sure you want to restore tenant
|
|
18
|
-
Restored tenant
|
|
16
|
+
`$ xano tenant backup restore t1234-abcd-xyz1 --backup-id 10
|
|
17
|
+
Are you sure you want to restore tenant t1234-abcd-xyz1 from backup 10? This will replace current data. (y/N) y
|
|
18
|
+
Restored tenant t1234-abcd-xyz1 from backup #10
|
|
19
19
|
`,
|
|
20
|
-
`$ xano tenant backup restore
|
|
20
|
+
`$ xano tenant backup restore t1234-abcd-xyz1 --backup-id 10 --force -o json`,
|
|
21
21
|
];
|
|
22
22
|
static flags = {
|
|
23
23
|
...BaseCommand.baseFlags,
|
|
@@ -63,16 +63,16 @@ Restored tenant 42 from backup #10
|
|
|
63
63
|
if (!workspaceId) {
|
|
64
64
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const tenantName = args.tenant_name;
|
|
67
67
|
const backupId = flags['backup-id'];
|
|
68
68
|
if (!flags.force) {
|
|
69
|
-
const confirmed = await this.confirm(`Are you sure you want to restore tenant ${
|
|
69
|
+
const confirmed = await this.confirm(`Are you sure you want to restore tenant ${tenantName} from backup ${backupId}? This will replace current data.`);
|
|
70
70
|
if (!confirmed) {
|
|
71
71
|
this.log('Restore cancelled.');
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
75
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/restore`;
|
|
76
76
|
try {
|
|
77
77
|
const response = await this.verboseFetch(apiUrl, {
|
|
78
78
|
body: JSON.stringify({ backup_id: backupId }),
|
|
@@ -92,7 +92,7 @@ Restored tenant 42 from backup #10
|
|
|
92
92
|
this.log(JSON.stringify(tenant, null, 2));
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
this.log(`Restored tenant ${
|
|
95
|
+
this.log(`Restored tenant ${tenantName} from backup #${backupId}`);
|
|
96
96
|
if (tenant.state)
|
|
97
97
|
this.log(` State: ${tenant.state}`);
|
|
98
98
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class TenantDelete extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -6,21 +6,21 @@ import * as path from 'node:path';
|
|
|
6
6
|
import BaseCommand from '../../../base-command.js';
|
|
7
7
|
export default class TenantDelete extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
|
|
10
|
-
description: 'Tenant
|
|
9
|
+
tenant_name: Args.string({
|
|
10
|
+
description: 'Tenant name to delete',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
14
|
static description = 'Delete a tenant permanently. This destroys all associated infrastructure and cannot be undone.';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano tenant delete
|
|
17
|
-
Are you sure you want to delete tenant
|
|
18
|
-
Deleted tenant
|
|
16
|
+
`$ xano tenant delete t1234-abcd-xyz1
|
|
17
|
+
Are you sure you want to delete tenant t1234-abcd-xyz1? This action cannot be undone. (y/N) y
|
|
18
|
+
Deleted tenant t1234-abcd-xyz1
|
|
19
19
|
`,
|
|
20
|
-
`$ xano tenant delete
|
|
21
|
-
Deleted tenant
|
|
20
|
+
`$ xano tenant delete t1234-abcd-xyz1 --force
|
|
21
|
+
Deleted tenant t1234-abcd-xyz1
|
|
22
22
|
`,
|
|
23
|
-
`$ xano tenant delete
|
|
23
|
+
`$ xano tenant delete t1234-abcd-xyz1 -f -o json`,
|
|
24
24
|
];
|
|
25
25
|
static flags = {
|
|
26
26
|
...BaseCommand.baseFlags,
|
|
@@ -62,15 +62,15 @@ Deleted tenant 42
|
|
|
62
62
|
if (!workspaceId) {
|
|
63
63
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
64
64
|
}
|
|
65
|
-
const
|
|
65
|
+
const tenantName = args.tenant_name;
|
|
66
66
|
if (!flags.force) {
|
|
67
|
-
const confirmed = await this.confirm(`Are you sure you want to delete tenant ${
|
|
67
|
+
const confirmed = await this.confirm(`Are you sure you want to delete tenant ${tenantName}? This action cannot be undone.`);
|
|
68
68
|
if (!confirmed) {
|
|
69
69
|
this.log('Deletion cancelled.');
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
73
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}`;
|
|
74
74
|
try {
|
|
75
75
|
const response = await this.verboseFetch(apiUrl, {
|
|
76
76
|
headers: {
|
|
@@ -84,10 +84,10 @@ Deleted tenant 42
|
|
|
84
84
|
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
85
85
|
}
|
|
86
86
|
if (flags.output === 'json') {
|
|
87
|
-
this.log(JSON.stringify({ deleted: true,
|
|
87
|
+
this.log(JSON.stringify({ deleted: true, tenant_name: tenantName }, null, 2));
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
|
-
this.log(`Deleted tenant ${
|
|
90
|
+
this.log(`Deleted tenant ${tenantName}`);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
catch (error) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class TenantDeployPlatform extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -6,17 +6,17 @@ import * as path from 'node:path';
|
|
|
6
6
|
import BaseCommand from '../../../base-command.js';
|
|
7
7
|
export default class TenantDeployPlatform extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
|
|
10
|
-
description: 'Tenant
|
|
9
|
+
tenant_name: Args.string({
|
|
10
|
+
description: 'Tenant name to deploy to',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
14
|
static description = 'Deploy a platform version to a tenant';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano tenant deploy-platform
|
|
17
|
-
Deployed platform 5 to tenant
|
|
16
|
+
`$ xano tenant deploy-platform t1234-abcd-xyz1 --platform-id 5
|
|
17
|
+
Deployed platform 5 to tenant: My Tenant (my-tenant)
|
|
18
18
|
`,
|
|
19
|
-
`$ xano tenant deploy-platform
|
|
19
|
+
`$ xano tenant deploy-platform t1234-abcd-xyz1 --platform-id 5 -o json`,
|
|
20
20
|
];
|
|
21
21
|
static flags = {
|
|
22
22
|
...BaseCommand.baseFlags,
|
|
@@ -56,9 +56,9 @@ Deployed platform 5 to tenant 42
|
|
|
56
56
|
if (!workspaceId) {
|
|
57
57
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const tenantName = args.tenant_name;
|
|
60
60
|
const platformId = flags['platform-id'];
|
|
61
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
61
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/platform/deploy`;
|
|
62
62
|
try {
|
|
63
63
|
const response = await this.verboseFetch(apiUrl, {
|
|
64
64
|
body: JSON.stringify({ platform_id: platformId }),
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class TenantDeployRelease extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -6,17 +6,17 @@ import * as path from 'node:path';
|
|
|
6
6
|
import BaseCommand from '../../../base-command.js';
|
|
7
7
|
export default class TenantDeployRelease extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
|
|
10
|
-
description: 'Tenant
|
|
9
|
+
tenant_name: Args.string({
|
|
10
|
+
description: 'Tenant name to deploy to',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
14
|
static description = 'Deploy a release to a tenant';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano tenant deploy-release
|
|
16
|
+
`$ xano tenant deploy-release t1234-abcd-xyz1 --release-id 10
|
|
17
17
|
Deployed release 10 to tenant: My Tenant (my-tenant)
|
|
18
18
|
`,
|
|
19
|
-
`$ xano tenant deploy-release
|
|
19
|
+
`$ xano tenant deploy-release t1234-abcd-xyz1 --release-id 10 -o json`,
|
|
20
20
|
];
|
|
21
21
|
static flags = {
|
|
22
22
|
...BaseCommand.baseFlags,
|
|
@@ -56,9 +56,9 @@ Deployed release 10 to tenant: My Tenant (my-tenant)
|
|
|
56
56
|
if (!workspaceId) {
|
|
57
57
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const tenantName = args.tenant_name;
|
|
60
60
|
const releaseId = flags['release-id'];
|
|
61
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
61
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/deploy`;
|
|
62
62
|
try {
|
|
63
63
|
const response = await this.verboseFetch(apiUrl, {
|
|
64
64
|
body: JSON.stringify({ release_id: releaseId }),
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class TenantEdit extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|
|
@@ -6,17 +6,17 @@ import * as path from 'node:path';
|
|
|
6
6
|
import BaseCommand from '../../../base-command.js';
|
|
7
7
|
export default class TenantEdit extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
|
|
10
|
-
description: 'Tenant
|
|
9
|
+
tenant_name: Args.string({
|
|
10
|
+
description: 'Tenant name to edit',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
14
|
static description = 'Edit an existing tenant';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano tenant edit
|
|
16
|
+
`$ xano tenant edit t1234-abcd-xyz1 --display "New Name" --description "Updated description"
|
|
17
17
|
Updated tenant: New Name (my-tenant) - ID: 42
|
|
18
18
|
`,
|
|
19
|
-
`$ xano tenant edit
|
|
19
|
+
`$ xano tenant edit t1234-abcd-xyz1 --no-tasks --no-ingress -o json`,
|
|
20
20
|
];
|
|
21
21
|
static flags = {
|
|
22
22
|
...BaseCommand.baseFlags,
|
|
@@ -84,8 +84,8 @@ Updated tenant: New Name (my-tenant) - ID: 42
|
|
|
84
84
|
if (!workspaceId) {
|
|
85
85
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
const baseUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${
|
|
87
|
+
const tenantName = args.tenant_name;
|
|
88
|
+
const baseUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}`;
|
|
89
89
|
const headers = {
|
|
90
90
|
'accept': 'application/json',
|
|
91
91
|
'Authorization': `Bearer ${profile.access_token}`,
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class TenantGet extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
4
|
+
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
5
|
};
|
|
9
6
|
static description: string;
|
|
10
7
|
static examples: string[];
|