function getPreviewStack()

in rules/preview-rule/IAC_misconfiguration_proactive_plugin/lib/index.js [131:152]


function getPreviewStack(config, templateBody) {
    var _a, _b;
    return __awaiter(this, void 0, void 0, function* () {
        config.endpoint = `ros.aliyuncs.com`;
        let client = new ros20190910_1.default(config);
        let previewStackRequest = new $ROS20190910.PreviewStackRequest({
            regionId: "cn-shanghai",
            templateBody: templateBody,
            stackName: "tmp",
        });
        let runtime = new $Util.RuntimeOptions({});
        try {
            const statckResponse = yield client.previewStackWithOptions(previewStackRequest, runtime);
            step.info(`PreviewStackResponse result=${statckResponse}`);
            return ((_b = (_a = statckResponse.body) === null || _a === void 0 ? void 0 : _a.stack) === null || _b === void 0 ? void 0 : _b.resources) || [];
        }
        catch (error) {
            step.info(`stackProperties error=${error}`);
            return [];
        }
    });
}