@pnp/cli-microsoft365
Version:
Manage Microsoft 365 and SharePoint Framework projects on any platform
62 lines • 3.12 kB
JavaScript
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 _PaEnvironmentGetCommand_instances, _PaEnvironmentGetCommand_initTelemetry, _PaEnvironmentGetCommand_initOptions;
import request from '../../../../request.js';
import { formatting } from '../../../../utils/formatting.js';
import PowerAppsCommand from '../../../base/PowerAppsCommand.js';
import commands from '../../commands.js';
class PaEnvironmentGetCommand extends PowerAppsCommand {
get name() {
return commands.ENVIRONMENT_GET;
}
get description() {
return 'Gets information about the specified Microsoft Power Apps environment';
}
constructor() {
super();
_PaEnvironmentGetCommand_instances.add(this);
__classPrivateFieldGet(this, _PaEnvironmentGetCommand_instances, "m", _PaEnvironmentGetCommand_initTelemetry).call(this);
__classPrivateFieldGet(this, _PaEnvironmentGetCommand_instances, "m", _PaEnvironmentGetCommand_initOptions).call(this);
}
async commandAction(logger, args) {
if (this.verbose) {
await logger.logToStderr(`Retrieving information about Microsoft Power Apps environment ${args.options.name || 'default'}...`);
}
const environmentName = args.options.name ? formatting.encodeQueryParameter(args.options.name) : '~default';
const requestOptions = {
url: `${this.resource}/providers/Microsoft.PowerApps/environments/${environmentName}?api-version=2016-11-01`,
headers: {
accept: 'application/json'
},
responseType: 'json'
};
try {
const res = await request.get(requestOptions);
res.displayName = res.properties.displayName;
res.provisioningState = res.properties.provisioningState;
res.environmentSku = res.properties.environmentSku;
res.azureRegionHint = res.properties.azureRegionHint;
res.isDefault = res.properties.isDefault;
await logger.log(res);
}
catch (err) {
this.handleRejectedODataJsonPromise(err);
}
}
}
_PaEnvironmentGetCommand_instances = new WeakSet(), _PaEnvironmentGetCommand_initTelemetry = function _PaEnvironmentGetCommand_initTelemetry() {
this.telemetry.push((args) => {
Object.assign(this.telemetryProperties, {
name: typeof args.options.name !== 'undefined'
});
});
}, _PaEnvironmentGetCommand_initOptions = function _PaEnvironmentGetCommand_initOptions() {
this.options.unshift({
option: '-n, --name [name]'
});
};
export default new PaEnvironmentGetCommand();
//# sourceMappingURL=environment-get.js.map