@pnp/cli-microsoft365
Version:
Manage Microsoft 365 and SharePoint Framework projects on any platform
52 lines • 1.82 kB
JavaScript
import { z } from 'zod';
import { cli } from '../../../../cli/cli.js';
import { globalOptionsZod } from '../../../../Command.js';
import request from '../../../../request.js';
import GraphCommand from '../../../base/GraphCommand.js';
import commands from '../../commands.js';
export const options = z.strictObject({
...globalOptionsZod.shape,
id: z.uuid().alias('i'),
force: z.boolean().optional().alias('f')
});
class EntraGroupSettingRemoveCommand extends GraphCommand {
get name() {
return commands.GROUPSETTING_REMOVE;
}
get description() {
return 'Removes the particular group setting';
}
get schema() {
return options;
}
async commandAction(logger, args) {
const removeGroupSetting = async () => {
if (this.verbose) {
await logger.logToStderr(`Removing group setting: ${args.options.id}...`);
}
try {
const requestOptions = {
url: `${this.resource}/v1.0/groupSettings/${args.options.id}`,
headers: {
'accept': 'application/json;odata.metadata=none'
}
};
await request.delete(requestOptions);
}
catch (err) {
this.handleRejectedODataJsonPromise(err);
}
};
if (args.options.force) {
await removeGroupSetting();
}
else {
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove the group setting ${args.options.id}?` });
if (result) {
await removeGroupSetting();
}
}
}
}
export default new EntraGroupSettingRemoveCommand();
//# sourceMappingURL=groupsetting-remove.js.map