UNPKG

@pnp/cli-microsoft365

Version:

Manage Microsoft 365 and SharePoint Framework projects on any platform

60 lines 2.89 kB
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _PpEnvironmentGetCommand_instances, _PpEnvironmentGetCommand_initTelemetry, _PpEnvironmentGetCommand_initOptions; import request from '../../../../request.js'; import { formatting } from '../../../../utils/formatting.js'; import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js'; import commands from '../../commands.js'; class PpEnvironmentGetCommand extends PowerPlatformCommand { get name() { return commands.ENVIRONMENT_GET; } get description() { return 'Gets information about the specified Power Platform environment'; } constructor() { super(); _PpEnvironmentGetCommand_instances.add(this); __classPrivateFieldGet(this, _PpEnvironmentGetCommand_instances, "m", _PpEnvironmentGetCommand_initTelemetry).call(this); __classPrivateFieldGet(this, _PpEnvironmentGetCommand_instances, "m", _PpEnvironmentGetCommand_initOptions).call(this); } async commandAction(logger, args) { if (this.verbose) { await logger.logToStderr(`Retrieving environment: ${args.options.name || 'default'}`); } let url = `${this.resource}/providers/Microsoft.BusinessAppPlatform`; if (args.options.asAdmin) { url += '/scopes/admin'; } const envName = args.options.name ? formatting.encodeQueryParameter(args.options.name) : '~Default'; url += `/environments/${envName}?api-version=2020-10-01`; const requestOptions = { url: url, headers: { accept: 'application/json;odata.metadata=none' }, responseType: 'json' }; const response = await request.get(requestOptions); await logger.log(response); } } _PpEnvironmentGetCommand_instances = new WeakSet(), _PpEnvironmentGetCommand_initTelemetry = function _PpEnvironmentGetCommand_initTelemetry() { this.telemetry.push((args) => { Object.assign(this.telemetryProperties, { name: typeof args.options.name !== 'undefined', asAdmin: !!args.options.asAdmin }); }); }, _PpEnvironmentGetCommand_initOptions = function _PpEnvironmentGetCommand_initOptions() { this.options.unshift({ option: '-n, --name [name]' }, { option: '--asAdmin' }); }; export default new PpEnvironmentGetCommand(); //# sourceMappingURL=environment-get.js.map