/// <summary> /// Gets the <see cref="ResourceGroupCostResultKey"/> instance. /// </summary> /// <param name="result"><see cref="ResourceGroupCostResult"/> instance.</param> /// <returns>Returns the <see cref="ResourceGroupCostResultKey"/> instance.</returns> public static ResourceGroupCostResultKey GetResourceGroupCostResultKey(ResourceGroupCostResult result) { var key = new ResourceGroupCostResultKey() { ResourceGroupName = result.ResourceGroupName, OwnerEmails = result.OwnerEmails, TotalSpendLimit = result.TotalSpendLimit, DailySpendLimit = result.DailySpendLimit, OverspendAction = result.OverspendAction, DateStart = result.DateStart, DateEnd = result.DateEnd }; return(key); }
/// <summary> /// Gets the <see cref="ResourceGroupCostResult"/> instance. /// </summary> /// <param name="group"><see cref="ResourceGroupCostResultKey"/> instance.</param> /// <param name="records">List of <see cref="ResourceGroupCostResult"/> instances.</param> /// <returns>Returns the <see cref="ResourceGroupCostResult"/> instance.</returns> public static ResourceGroupCostResult GetResourceGroupCostResult(ResourceGroupCostResultKey group, IEnumerable <ResourceGroupCostResult> records) { var result = new ResourceGroupCostResult() { ResourceGroupName = group.ResourceGroupName, OwnerEmails = group.OwnerEmails, Cost = records.Sum(q => q.Cost), DateStart = group.DateStart, DateEnd = group.DateEnd, TotalSpendLimit = group.TotalSpendLimit, DailySpendLimit = group.DailySpendLimit, OverspendAction = group.OverspendAction }; return(result); }