-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdelete.ts
More file actions
41 lines (33 loc) · 1.36 KB
/
delete.ts
File metadata and controls
41 lines (33 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Copyright (c) 2025, Salesforce, Inc.
* SPDX-License-Identifier: Apache-2
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
*/
import {Args} from '@oclif/core';
import {AmCommand} from '@salesforce/b2c-tooling-sdk/cli';
import {t} from '../../../i18n/index.js';
/**
* Command to delete an Account Manager API client.
* The API client must have been disabled for at least 7 days before it can be deleted.
*/
export default class ClientDelete extends AmCommand<typeof ClientDelete> {
static args = {
'api-client-id': Args.string({
description: 'API client ID (UUID)',
required: true,
}),
};
static description = t(
'commands.client.delete.description',
'Delete an Account Manager API client (must be disabled 7+ days)',
);
static examples = ['<%= config.bin %> <%= command.id %> <api-client-id>'];
async run(): Promise<void> {
// Prevent deletion in safe mode
this.assertDestructiveOperationAllowed('delete API client');
const apiClientId = this.args['api-client-id'];
this.log(t('commands.client.delete.deleting', 'Deleting API client {{id}}...', {id: apiClientId}));
await this.accountManagerClient.deleteApiClient(apiClientId);
this.log(t('commands.client.delete.success', 'API client {{id}} deleted successfully.', {id: apiClientId}));
}
}