├── .gitignore
├── CSPARMPricingCal
├── CSPARMPricingCalOps
│ ├── CSPARMPricingCalculator.cs
│ ├── CSPARMPricingCalculatorOps.csproj
│ ├── DataModel
│ │ ├── AADTokenDetails.cs
│ │ ├── ARMParamValue.cs
│ │ ├── ARMTemplate.cs
│ │ ├── CSPARMPricingInfo.cs
│ │ ├── CSPAccountCreds.cs
│ │ ├── ComponentModel
│ │ │ ├── PublicIPProperties.cs
│ │ │ ├── StorageProperties.cs
│ │ │ └── VMProperties.cs
│ │ ├── Meter.cs
│ │ ├── RateCard.cs
│ │ ├── Resource.cs
│ │ ├── ResourceComponent.cs
│ │ ├── VMSKUVersion.cs
│ │ ├── VMSKUVersionListItem.cs
│ │ └── VMSizeList.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Util
│ │ ├── AuthManager.cs
│ │ ├── Constants.cs
│ │ ├── Helper
│ │ │ ├── ExceptionLogger.cs
│ │ │ ├── Online
│ │ │ │ ├── ARMAPIHelper.cs
│ │ │ │ └── VMOnlineHelper.cs
│ │ │ ├── PropertyHelper.cs
│ │ │ ├── ResourceTypeHelper.cs
│ │ │ ├── VMHelper.cs
│ │ │ └── VMImageHelper.cs
│ │ ├── RateCardUtil.cs
│ │ ├── ResourceComponents
│ │ │ ├── ComponentFetcher.cs
│ │ │ ├── IComponentFetcher.cs
│ │ │ ├── PublicIPComponentFetcher.cs
│ │ │ └── VMComponentFetcher.cs
│ │ └── ResourceRateCalc.cs
│ └── packages.config
├── CSPARMPricingCalUI
│ ├── App.config
│ ├── CSPARMPricingCalculatorForm.Designer.cs
│ ├── CSPARMPricingCalculatorForm.cs
│ ├── CSPARMPricingCalculatorForm.resx
│ ├── CSPARMPricingCalculatorUI.csproj
│ ├── Constants.cs
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── Util
│ │ └── FileUtil.cs
│ └── packages.config
├── CSPARMPricingCalculator.sln
└── TestData
│ ├── azuredep.json
│ └── azuredeploy.parameters.json
├── Documentation
├── app_setup.md
├── contributing.md
├── deployment.md
└── images
│ ├── app_setup
│ ├── image1.png
│ ├── image10.png
│ ├── image11.jpg
│ ├── image12.png
│ ├── image13.png
│ ├── image14.png
│ ├── image15.png
│ ├── image2.png
│ ├── image3.png
│ ├── image4.png
│ ├── image5.png
│ ├── image6.png
│ ├── image7.png
│ ├── image8.png
│ └── image9.png
│ └── deployment
│ ├── image1.png
│ ├── image10.png
│ ├── image11.png
│ ├── image12.png
│ ├── image13.png
│ ├── image14.png
│ ├── image15.png
│ ├── image2.png
│ ├── image3.png
│ ├── image4.png
│ ├── image5.png
│ ├── image6.png
│ ├── image7.png
│ ├── image8.png
│ └── image9.png
├── LICENSE
├── README.md
└── SECURITY.md
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 | *.VC.VC.opendb
85 |
86 | # Visual Studio profiler
87 | *.psess
88 | *.vsp
89 | *.vspx
90 | *.sap
91 |
92 | # TFS 2012 Local Workspace
93 | $tf/
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 | *.DotSettings.user
102 |
103 | # JustCode is a .NET coding add-in
104 | .JustCode
105 |
106 | # TeamCity is a build add-in
107 | _TeamCity*
108 |
109 | # DotCover is a Code Coverage Tool
110 | *.dotCover
111 |
112 | # NCrunch
113 | _NCrunch_*
114 | .*crunch*.local.xml
115 | nCrunchTemp_*
116 |
117 | # MightyMoose
118 | *.mm.*
119 | AutoTest.Net/
120 |
121 | # Web workbench (sass)
122 | .sass-cache/
123 |
124 | # Installshield output folder
125 | [Ee]xpress/
126 |
127 | # DocProject is a documentation generator add-in
128 | DocProject/buildhelp/
129 | DocProject/Help/*.HxT
130 | DocProject/Help/*.HxC
131 | DocProject/Help/*.hhc
132 | DocProject/Help/*.hhk
133 | DocProject/Help/*.hhp
134 | DocProject/Help/Html2
135 | DocProject/Help/html
136 |
137 | # Click-Once directory
138 | publish/
139 |
140 | # Publish Web Output
141 | *.[Pp]ublish.xml
142 | *.azurePubxml
143 | # TODO: Comment the next line if you want to checkin your web deploy settings
144 | # but database connection strings (with potential passwords) will be unencrypted
145 | *.pubxml
146 | *.publishproj
147 |
148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
149 | # checkin your Azure Web App publish settings, but sensitive information contained
150 | # in these scripts will be unencrypted
151 | PublishScripts/
152 |
153 | # NuGet Packages
154 | *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
253 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/CSPARMPricingCalculator.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps
8 | {
9 | using System;
10 | using System.Collections.Generic;
11 | using System.Text;
12 | using DataModel;
13 | using Util;
14 | using Util.ResourceComponents;
15 |
16 | ///
17 | /// Class that has methods to fetch Rate card and perform CSP ARM Pricing Calculation for an ARM Template
18 | ///
19 | public class CSPARMPricingCalculator
20 | {
21 | ///
22 | /// Variable to store the ARM Template object
23 | ///
24 | private ARMTemplate template;
25 |
26 | ///
27 | /// Variable to store the list of meters in the CSP Rate Card
28 | ///
29 | private List meterlist;
30 |
31 | ///
32 | /// Variable to store the currency of the Azure CSP Partner
33 | ///
34 | private string currency;
35 |
36 | ///
37 | /// Gets the resource components for the Virtual machine resource in an ARM template
38 | ///
39 | /// The object containing the ARM Template
40 | /// The object containing the values in the Parameter file
41 | /// The Azure Location
42 | /// CSP Account credentials object. A token will be generated using these credentials and used for making the online API call.
43 | /// Returns the result of the CSP ARM Pricing Calculation
44 | public CSPARMPricingInfo CalculateCSPARMPricing(ARMTemplate template, ARMParamValue paramValue, string location, CSPAccountCreds cspCreds)
45 | {
46 | CSPARMPricingInfo info = new CSPARMPricingInfo();
47 | StringBuilder log = new StringBuilder(string.Empty);
48 | info.Log = new StringBuilder(string.Empty);
49 | this.template = template;
50 |
51 | // Fetch the list of resource components for the ARM Template
52 | List components = ComponentFetcher.GetResourceComponentsForTemplate(template, paramValue, location, cspCreds, out log);
53 |
54 | if (log != null)
55 | {
56 | // Append log of exception messages if any
57 | info.Log.Append(log.ToString());
58 | }
59 |
60 | // Fetch the Rates for the Resource components and Calculate monthly Estimates
61 | List ratedComponents = null;
62 | if (components != null && components.Count > 0)
63 | {
64 | ratedComponents = ResourceRateCalc.CalculateResourceComponentRates(components, location, this.meterlist, out log);
65 | }
66 |
67 | if (log != null)
68 | {
69 | // Append log of exception messages if any
70 | info.Log.Append(log.ToString());
71 | }
72 |
73 | // Set currency and object of resource component with pricing and estimation details
74 | info.Currency = this.currency;
75 | info.CSPARMPricingList = ratedComponents;
76 |
77 | return info;
78 | }
79 |
80 | ///
81 | /// Load the Azure CSP Rate Card
82 | ///
83 | /// CSP Account credentials object. A token will be generated using these credentials and used for making the online Partner Center API call.
84 | public void FetchRateCard(CSPAccountCreds cspCreds)
85 | {
86 | try
87 | {
88 | // Load CSP Azure RateCard
89 | this.meterlist = RateCardUtil.GetRateCard(cspCreds);
90 | }
91 | catch (Exception)
92 | {
93 | throw;
94 | }
95 |
96 | this.currency = cspCreds.CSPCurrency;
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/CSPARMPricingCalculatorOps.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {5DE96F04-76F7-4DC0-88F5-1FFFE0C75477}
8 | Library
9 | Properties
10 | CSPARMPricingCalOps
11 | CSPARMPricingCalOps
12 | v4.5.2
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 | false
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | ..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.23.302261847\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
36 | True
37 |
38 |
39 | ..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.23.302261847\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll
40 | True
41 |
42 |
43 | ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll
44 | True
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
102 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/AADTokenDetails.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using System;
10 | using Newtonsoft.Json;
11 |
12 | ///
13 | /// Class that defines the deserialized data for the JSON of the Azure AD Token
14 | ///
15 | public class AADTokenDetails
16 | {
17 | [JsonProperty("token_type")]
18 | public string Token_type { get; set; }
19 |
20 | [JsonProperty("expires_in")]
21 | public int Expires_in { get; set; }
22 |
23 | [JsonProperty("expires_on")]
24 | public string Expires_on { get; set; }
25 |
26 | [JsonProperty("not_before")]
27 | public string Not_before { get; set; }
28 |
29 | [JsonProperty("resource")]
30 | public string Resource { get; set; }
31 |
32 | [JsonProperty("access_token")]
33 | public string Access_token { get; set; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/ARMParamValue.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using Newtonsoft.Json;
10 | using Newtonsoft.Json.Linq;
11 |
12 | ///
13 | /// Class that defines the deserialized data for the JSON of the Parameter file for an ARM Template deployment
14 | ///
15 | public class ARMParamValue
16 | {
17 | [JsonProperty("contentVersion")]
18 | public string ContentVersion { get; set; }
19 |
20 | [JsonProperty("parameters")]
21 | public JObject Parameters { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/ARMTemplate.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using System.Collections.Generic;
10 | using Newtonsoft.Json;
11 | using Newtonsoft.Json.Linq;
12 |
13 | ///
14 | /// Class that defines the deserialized data for the JSON of the ARM Template file for an ARM Template deployment
15 | ///
16 | public class ARMTemplate
17 | {
18 | [JsonProperty("contentVersion")]
19 | public string ContentVersion { get; set; }
20 |
21 | [JsonProperty("parameters")]
22 | public JObject Parameters { get; set; }
23 |
24 | [JsonProperty("variables")]
25 | public JObject Variables { get; set; }
26 |
27 | [JsonProperty("resources")]
28 | public List Resources { get; set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/CSPARMPricingInfo.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using System;
10 | using System.Collections.Generic;
11 | using System.Text;
12 |
13 | ///
14 | /// Class that defines the output of the CSP ARM Pricing Calculation. Includes the list of individual components and their associated cost estimates
15 | ///
16 | public class CSPARMPricingInfo
17 | {
18 | ///
19 | /// Initializes a new instance of the class.
20 | ///
21 | public CSPARMPricingInfo()
22 | {
23 | this.Log = new StringBuilder();
24 | }
25 |
26 | ///
27 | /// Gets or sets the Log with exception messages.
28 | ///
29 | public StringBuilder Log { get; set; }
30 |
31 | ///
32 | /// Gets or sets the output for the ARM Pricing Calculation in List of ResourceComponent objects.
33 | ///
34 | public List CSPARMPricingList { get; set; }
35 |
36 | ///
37 | /// Gets or sets the currency for the ARM Pricing Calculation.
38 | ///
39 | public string Currency { get; set; }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/CSPAccountCreds.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using System;
10 |
11 | ///
12 | /// Class that defines the configuration values including the CSP Partner Account credentials required to make Partner Center and ARM API calls
13 | ///
14 | public class CSPAccountCreds
15 | {
16 | ///
17 | /// Gets or sets the App Id for the Native App registered on Partner Center portal. This will be used for fetching CSP Rate Card.
18 | ///
19 | public string CSPClientId { get; set; }
20 |
21 | ///
22 | /// Gets or sets the Tenant Id or Microsoft Id for the CSP Partner.
23 | ///
24 | public string CSPResellerTenantID { get; set; }
25 |
26 | ///
27 | /// Gets or sets the Region for the CSP Partner.
28 | ///
29 | public string CSPRegion { get; set; }
30 |
31 | ///
32 | /// Gets or sets the Currency for the CSP Partner.
33 | ///
34 | public string CSPCurrency { get; set; }
35 |
36 | ///
37 | /// Gets or sets App Id for the Native App registered for ARM APIs with Pre-Consent.
38 | ///
39 | public string CSPNativeAppClientId { get; set; }
40 |
41 | ///
42 | /// Gets or sets Tenant Id or Microsoft Id for a CSP Customer.
43 | ///
44 | public string CSPCustomerTenantId { get; set; }
45 |
46 | ///
47 | /// Gets or sets the Subscription Id of an Azure CSP Subscription.
48 | ///
49 | public string CSPAzureSubscriptionId { get; set; }
50 |
51 | ///
52 | /// Gets or sets the Username of an Admin Agent user of the CSP Partner Org.
53 | ///
54 | public string CSPAdminAgentUserName { get; set; }
55 |
56 | ///
57 | /// Gets or sets the Password of the Admin Agent user of the CSP Partner Org.
58 | ///
59 | public string CSPAdminAgentPassword { get; set; }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/ComponentModel/PublicIPProperties.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel.ComponentModel
8 | {
9 | using Newtonsoft.Json;
10 |
11 | ///
12 | /// Class that defines the deserialized data for the JSON in properties section for the ARM resource of "type": "Microsoft.Network/publicIPAddresses" in an ARM Template
13 | /// ARM Resource API Version: 2015-06-15
14 | ///
15 | public class PublicIPProperties
16 | {
17 | [JsonProperty("publicIPAllocationMethod")]
18 | public string PublicIPAllocationMethod { get; set; }
19 |
20 | [JsonProperty("dnsSettings")]
21 | public DNSSettings DnsSettings { get; set; }
22 | }
23 |
24 | ///
25 | /// DNSSettings class
26 | ///
27 | public class DNSSettings
28 | {
29 | [JsonProperty("domainNameLabel")]
30 | public string DomainNameLabel { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/ComponentModel/StorageProperties.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel.ComponentModel
8 | {
9 | using Newtonsoft.Json;
10 |
11 | ///
12 | /// Class that defines the deserialized data for the JSON in properties section for the ARM resource of "type": "Microsoft.Storage/storageAccounts" in an ARM Template
13 | /// ARM Resource API Version: 2015-06-15
14 | ///
15 | public class StorageProperties
16 | {
17 | [JsonProperty("accountType")]
18 | public string AccountType { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/ComponentModel/VMProperties.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel.ComponentModel
8 | {
9 | using System.Collections.Generic;
10 | using Newtonsoft.Json;
11 |
12 | ///
13 | /// Class that defines the deserialized data for the JSON in properties section for the ARM resource of "type": "Microsoft.Compute/virtualMachines" in an ARM Template
14 | /// ARM Resource API Version: 2015-06-15
15 | ///
16 | public class VMProperties
17 | {
18 | [JsonProperty("hardwareProfile")]
19 | public HardwareProfile HardwareProfile { get; set; }
20 |
21 | [JsonProperty("osProfile")]
22 | public OsProfile OsProfile { get; set; }
23 |
24 | [JsonProperty("storageProfile")]
25 | public StorageProfile StorageProfile { get; set; }
26 |
27 | [JsonProperty("networkProfile")]
28 | public NetworkProfile NetworkProfile { get; set; }
29 |
30 | [JsonProperty("diagnosticsProfile")]
31 | public DiagnosticsProfile DiagnosticsProfile { get; set; }
32 | }
33 |
34 | ///
35 | /// DataDisk class
36 | ///
37 | public class DataDisk
38 | {
39 | [JsonProperty("name")]
40 | public string Name { get; set; }
41 |
42 | [JsonProperty("diskSizeGB")]
43 | public string DiskSizeGB { get; set; }
44 |
45 | [JsonProperty("lun")]
46 | public int Lun { get; set; }
47 |
48 | [JsonProperty("vhd")]
49 | public Vhd Vhd { get; set; }
50 |
51 | [JsonProperty("createOption")]
52 | public string CreateOption { get; set; }
53 | }
54 |
55 | ///
56 | /// StorageProfile class
57 | ///
58 | public class StorageProfile
59 | {
60 | [JsonProperty("imageReference")]
61 | public ImageReference ImageReference { get; set; }
62 |
63 | [JsonProperty("osDisk")]
64 | public OsDisk OsDisk { get; set; }
65 |
66 | [JsonProperty("dataDisks")]
67 | public List DataDisks { get; set; }
68 | }
69 |
70 | ///
71 | /// NetworkInterface class
72 | ///
73 | public class NetworkInterface
74 | {
75 | [JsonProperty("id")]
76 | public string Id { get; set; }
77 | }
78 |
79 | ///
80 | /// NetworkProfile class
81 | ///
82 | public class NetworkProfile
83 | {
84 | [JsonProperty("networkInterfaces")]
85 | public List NetworkInterfaces { get; set; }
86 | }
87 |
88 | ///
89 | /// BootDiagnostics class
90 | ///
91 | public class BootDiagnostics
92 | {
93 | [JsonProperty("enabled")]
94 | public string Enabled { get; set; }
95 |
96 | [JsonProperty("storageUri")]
97 | public string StorageUri { get; set; }
98 | }
99 |
100 | ///
101 | /// DiagnosticsProfile class
102 | ///
103 | public class DiagnosticsProfile
104 | {
105 | [JsonProperty("bootDiagnostics")]
106 | public BootDiagnostics BootDiagnostics { get; set; }
107 | }
108 |
109 | ///
110 | /// HardwareProfile class
111 | ///
112 | public class HardwareProfile
113 | {
114 | [JsonProperty("vmSize")]
115 | public string VmSize { get; set; }
116 | }
117 |
118 | ///
119 | /// OsProfile class
120 | ///
121 | public class OsProfile
122 | {
123 | [JsonProperty("computerName")]
124 | public string ComputerName { get; set; }
125 |
126 | [JsonProperty("adminUsername")]
127 | public string AdminUsername { get; set; }
128 |
129 | [JsonProperty("adminPassword")]
130 | public string AdminPassword { get; set; }
131 | }
132 |
133 | ///
134 | /// ImageReference class
135 | ///
136 | public class ImageReference
137 | {
138 | [JsonProperty("publisher")]
139 | public string Publisher { get; set; }
140 |
141 | [JsonProperty("offer")]
142 | public string Offer { get; set; }
143 |
144 | [JsonProperty("sku")]
145 | public string Sku { get; set; }
146 |
147 | [JsonProperty("version")]
148 | public string Version { get; set; }
149 | }
150 |
151 | ///
152 | /// Vhd class
153 | ///
154 | public class Vhd
155 | {
156 | [JsonProperty("uri")]
157 | public string Uri { get; set; }
158 | }
159 |
160 | ///
161 | /// OsDisk class
162 | ///
163 | public class OsDisk
164 | {
165 | [JsonProperty("name")]
166 | public string Name { get; set; }
167 |
168 | [JsonProperty("osType")]
169 | public string OsType { get; set; }
170 |
171 | [JsonProperty("vhd")]
172 | public Vhd Vhd { get; set; }
173 |
174 | [JsonProperty("caching")]
175 | public string Caching { get; set; }
176 |
177 | [JsonProperty("createOption")]
178 | public string CreateOption { get; set; }
179 | }
180 | }
181 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/Meter.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using System.Collections.Specialized;
10 | using Newtonsoft.Json;
11 |
12 | ///
13 | /// Class that defines the deserialized data for the JSON of the meter object of CSP Azure Rate Card
14 | ///
15 | public class Meter
16 | {
17 | [JsonProperty("id")]
18 | public string MeterId { get; set; }
19 |
20 | [JsonProperty("name")]
21 | public string MeterName { get; set; }
22 |
23 | [JsonProperty("category")]
24 | public string MeterCategory { get; set; }
25 |
26 | [JsonProperty("subcategory")]
27 | public string MeterSubCategory { get; set; }
28 |
29 | [JsonProperty("unit")]
30 | public string Unit { get; set; }
31 |
32 | [JsonProperty("region")]
33 | public string MeterRegion { get; set; }
34 |
35 | [JsonProperty("rates")]
36 | public OrderedDictionary MeterRates { get; set; }
37 |
38 | [JsonProperty("effectiveDate")]
39 | public string EffectiveDate { get; set; }
40 |
41 | [JsonProperty("includedQuantity")]
42 | public double IncludedQuantity { get; set; }
43 | }
44 | }
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/RateCard.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using System.Collections.Generic;
10 | using Newtonsoft.Json;
11 |
12 | ///
13 | /// Class that defines the deserialized data for the JSON of the response of CSP Azure Partner Center Rate Card API call
14 | ///
15 | public class RateCard
16 | {
17 | [JsonProperty("Meters")]
18 | public List Meters { get; set; }
19 |
20 | [JsonProperty("Currency")]
21 | public string Currency { get; set; }
22 |
23 | [JsonProperty("Locale")]
24 | public string Locale { get; set; }
25 |
26 | [JsonProperty("IsTaxIncluded")]
27 | public bool IsTaxIncluded { get; set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/Resource.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using System.Collections.Generic;
10 | using Newtonsoft.Json;
11 | using Newtonsoft.Json.Linq;
12 |
13 | ///
14 | /// Class that defines the deserialized data for the JSON of an ARM resource in an ARM Template
15 | ///
16 | public class Resource
17 | {
18 | ///
19 | /// Gets or sets the type of the resource in the ARM Template.
20 | ///
21 | [JsonProperty("type")]
22 | public string Type { get; set; }
23 |
24 | ///
25 | /// Gets or sets the name of the resource in the ARM Template.
26 | ///
27 | [JsonProperty("name")]
28 | public string Name { get; set; }
29 |
30 | ///
31 | /// Gets or sets the API Version of the resource in the ARM Template.
32 | ///
33 | [JsonProperty("apiVersion")]
34 | public string ApiVersion { get; set; }
35 |
36 | ///
37 | /// Gets or sets the Location of the resource in the ARM Template.
38 | ///
39 | [JsonProperty("location")]
40 | public string Location { get; set; }
41 |
42 | ///
43 | /// Gets or sets the properties section of the resource in the ARM Template.
44 | ///
45 | [JsonProperty("properties")]
46 | public JObject Properties { get; set; }
47 |
48 | ///
49 | /// Gets or sets the depends On section of the resource in the ARM Template.
50 | ///
51 | [JsonProperty("dependsOn")]
52 | public List DependsOn { get; set; }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/ResourceComponent.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using System;
10 |
11 | ///
12 | /// Class that defines the components of resource in an ARM template and its associated cost and estimates
13 | ///
14 | public class ResourceComponent
15 | {
16 | ///
17 | /// Gets or sets the name of the resource component.
18 | ///
19 | public string ResourceName { get; set; }
20 |
21 | ///
22 | /// Gets or sets the type of the resource component.
23 | ///
24 | public string ResourceType { get; set; }
25 |
26 | ///
27 | /// Gets or sets the Azure Pricing Meter Name associated with the resource component.
28 | ///
29 | public string MeterName { get; set; }
30 |
31 | ///
32 | /// Gets or sets the Azure Pricing Meter Category associated with the resource component.
33 | ///
34 | public string MeterCategory { get; set; }
35 |
36 | ///
37 | /// Gets or sets the Azure Pricing Meter SubCategory associated with the resource component.
38 | ///
39 | public string MeterSubCategory { get; set; }
40 |
41 | ///
42 | /// Gets or sets the Quantity of the resource component.
43 | ///
44 | public double Quantity { get; set; }
45 |
46 | ///
47 | /// Gets or sets a value indicating whether the resource component is chargeable or not.
48 | ///
49 | public bool IsChargeable { get; set; }
50 |
51 | ///
52 | /// Gets or sets the Azure Rate of the resource component.
53 | ///
54 | public double Rate { get; set; }
55 |
56 | ///
57 | /// Gets or sets the estimated cost over the month for the resource component.
58 | ///
59 | public double CostPerMonth { get; set; }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/CSPARMPricingCal/CSPARMPricingCalOps/DataModel/VMSKUVersion.cs:
--------------------------------------------------------------------------------
1 | // -----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // -----------------------------------------------------------------------
6 |
7 | namespace CSPARMPricingCalOps.DataModel
8 | {
9 | using System.Collections.Generic;
10 | using Newtonsoft.Json;
11 |
12 | ///
13 | /// Class that defines the deserialized data for the JSON of the ARM API call to fetch the information of a Virtual machine image
14 | ///
15 | public class VMSKUVersion
16 | {
17 | [JsonProperty("properties")]
18 | public Properties Properties { get; set; }
19 |
20 | [JsonProperty("location")]
21 | public string Location { get; set; }
22 |
23 | [JsonProperty("name")]
24 | public string Name { get; set; }
25 |
26 | [JsonProperty("id")]
27 | public string Id { get; set; }
28 | }
29 |
30 | ///
31 | /// OSDiskImage class
32 | ///
33 | public class OSDiskImage
34 | {
35 | [JsonProperty("operatingSystem")]
36 | public string OperatingSystem { get; set; }
37 | }
38 |
39 | ///
40 | /// Properties class
41 | ///
42 | public class Properties
43 | {
44 | [JsonProperty("osDiskImage")]
45 | public OSDiskImage OsDiskImage { get; set; }
46 |
47 | [JsonProperty("dataDiskImages")]
48 | public List