-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e3ef17
commit 3194b48
Showing
21 changed files
with
144 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
coster/src/AzureVmCoster/Models/VmPricing.cs → coster/src/AzureVmCoster/Models/VmPrice.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace AzureVmCoster.Services; | ||
|
||
internal class VmPriceParser | ||
{ | ||
private readonly string _priceDirectory; | ||
|
||
public VmPriceParser(PriceDirectory priceDirectory) | ||
{ | ||
_priceDirectory = priceDirectory.Directory; | ||
} | ||
|
||
public async Task<IList<VmPrice>> ParseAsync() | ||
{ | ||
var priceFiles = Directory.GetFiles(_priceDirectory, "*.json"); | ||
|
||
var allVmPrices = new List<VmPrice>(); | ||
|
||
foreach (var priceFile in priceFiles) | ||
{ | ||
var fileIdentifier = FileIdentifier.From(new FileInfo(priceFile)); | ||
|
||
var fileVmPrices = await JsonReader.DeserializeAsync<List<VmPrice>>(priceFile); | ||
|
||
if (fileVmPrices == null || fileVmPrices.Count == 0) | ||
{ | ||
continue; | ||
} | ||
|
||
fileVmPrices.ForEach(price => | ||
{ | ||
price.Region = fileIdentifier.Region; | ||
price.OperatingSystem = fileIdentifier.OperatingSystem; | ||
}); | ||
|
||
allVmPrices.AddRange(fileVmPrices); | ||
} | ||
|
||
return allVmPrices; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.