/// <summary> /// Function that will be asynchronously called - that calls the CSP ARM Pricing Calculation module /// </summary> /// <param name="cspARMPricingCalc">Object of the class whose method will be called to perform CSP ARM Pricing Calculation</param> /// <param name="armTemplateFilePath">Path to the ARM Template File</param> /// <param name="armParamValueFilePath">Path to the ARM Parameter File</param> /// <param name="location">Azure Location selection</param> /// <param name="cspCreds">CSP Account credentials object. A token will be generated using these credentials and used for making the online ARM API call</param> /// <returns> Returns the Result of the CSP ARM Pricing Calculation with resource components and monthly cost estimates</returns> private CSPARMPricingInfo CalculateCSPARMPricing(CSPARMPricingCalculator cspARMPricingCalc, string armTemplateFilePath, string armParamValueFilePath, string location, CSPAccountCreds cspCreds) { CSPARMPricingInfo info = null; try { // Read the ARM Template file and get the object ARMTemplate template = FileUtil.GetResourceList(armTemplateFilePath); // Read the ARM Template file and get the object, Parameter file is optional ARMParamValue paramValue = new ARMParamValue() { ContentVersion = null, Parameters = null }; if (armParamValueFilePath != null && !armParamValueFilePath.Equals(string.Empty)) { paramValue = FileUtil.GetParamValueList(armParamValueFilePath); } // Report progress message this.BackGrndWorker.ReportProgress(50, UIMessageConstants.CSPARMPricingCalculationProgressFileReadCompleteMsg); // Calculate info = cspARMPricingCalc.CalculateCSPARMPricing(template, paramValue, location, cspCreds); // Report progress message this.BackGrndWorker.ReportProgress(100, UIMessageConstants.CSPARMPricingCalculationProgressAllCompleteMsg); } catch (JsonSerializationException ex) { info = new CSPARMPricingInfo(); info.Log.Append(string.Format(UIMessageConstants.CSPARMPricingCalculationInvalidJSONMsg, ex.Message)); } catch (Exception ex) { info = new CSPARMPricingInfo(); info.Log.Append(string.Format("{0}", ex.Message)); } return(info); }
/// <summary> /// Method to fetch the Azure CSP Rate Card, this will be called by the Background worker /// </summary> /// <param name="cspARMPricingCalc">The object of the class to perform the CSP ARM Pricing Calculation</param> /// <param name="cspCreds">CSP Account credentials object. A token will be generated using these credentials and used for making the online Partner Center API call</param> private void FetchRateCard(CSPARMPricingCalculator cspARMPricingCalc, CSPAccountCreds cspCreds) { cspARMPricingCalc.FetchRateCard(cspCreds); }