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