UNPKG

@pnp/cli-microsoft365

Version:

Manage Microsoft 365 and SharePoint Framework projects on any platform

48 lines 1.86 kB
import { z } from 'zod'; import { globalOptionsZod } from '../../../../Command.js'; import { odata } from '../../../../utils/odata.js'; import GraphCommand from '../../../base/GraphCommand.js'; import commands from '../../commands.js'; export const options = z.strictObject({ ...globalOptionsZod.shape, id: z.uuid().optional().alias('i'), displayName: z.string().optional().alias('n') }); class EntraGroupSettingTemplateGetCommand extends GraphCommand { get name() { return commands.GROUPSETTINGTEMPLATE_GET; } get description() { return 'Gets information about the specified Entra group settings template'; } get schema() { return options; } getRefinedSchema(schema) { return schema .refine(options => [options.id, options.displayName].filter(Boolean).length === 1, { error: 'Specify either id or displayName', params: { customCode: 'optionSet', options: ['id', 'displayName'] } }); } async commandAction(logger, args) { try { const templates = await odata.getAllItems(`${this.resource}/v1.0/groupSettingTemplates`); const groupSettingTemplate = templates.filter(t => args.options.id ? t.id === args.options.id : t.displayName === args.options.displayName); if (groupSettingTemplate && groupSettingTemplate.length > 0) { await logger.log(groupSettingTemplate.pop()); } else { throw `Resource '${(args.options.id || args.options.displayName)}' does not exist.`; } } catch (err) { this.handleRejectedODataJsonPromise(err); } } } export default new EntraGroupSettingTemplateGetCommand(); //# sourceMappingURL=groupsettingtemplate-get.js.map