UNPKG

@pnp/cli-microsoft365

Version:

Manage Microsoft 365 and SharePoint Framework projects on any platform

44 lines 1.54 kB
import { z } from 'zod'; import { globalOptionsZod } from '../../../../Command.js'; import request from '../../../../request.js'; import { validation } from '../../../../utils/validation.js'; import GraphCommand from '../../../base/GraphCommand.js'; import commands from '../../commands.js'; export const options = z.strictObject({ ...globalOptionsZod.shape, id: z.string().refine(val => validation.isValidGuid(val), { error: 'The value must be a valid GUID.' }).alias('i') }); class PurviewRetentionLabelGetCommand extends GraphCommand { get name() { return commands.RETENTIONLABEL_GET; } get description() { return 'Gets a retention label'; } get schema() { return options; } async commandAction(logger, args) { try { if (this.verbose) { await logger.logToStderr(`Retrieving retention label with id ${args.options.id}`); } const requestOptions = { url: `${this.resource}/beta/security/labels/retentionLabels/${args.options.id}`, headers: { accept: 'application/json;odata.metadata=none' }, responseType: 'json' }; const res = await request.get(requestOptions); await logger.log(res); } catch (err) { this.handleRejectedODataJsonPromise(err); } } } export default new PurviewRetentionLabelGetCommand(); //# sourceMappingURL=retentionlabel-get.js.map