Skip to content

Commit 1f7aa58

Browse files
author
REDMOND\chanwan
committed
Addressed comments on Tag, csproj files, depreciated InvoiceName, missing parameters in PSUsage model
1 parent 42b3974 commit 1f7aa58

12 files changed

+156
-179
lines changed

src/ResourceManager/Consumption/Commands.Consumption.Test/Commands.Consumption.Test.csproj

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
</Reference>
6565
<Reference Include="Microsoft.Azure.Management.Consumption, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6666
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Consumption.3.0.0\lib\net452\Microsoft.Azure.Management.Consumption.dll</HintPath>
67-
<Private>True</Private>
6867
</Reference>
6968
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7069
<SpecificVersion>False</SpecificVersion>
@@ -85,14 +84,6 @@
8584
<SpecificVersion>False</SpecificVersion>
8685
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
8786
</Reference>
88-
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
89-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
90-
<Private>True</Private>
91-
</Reference>
92-
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
93-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.10\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
94-
<Private>True</Private>
95-
</Reference>
9687
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
9788
<SpecificVersion>False</SpecificVersion>
9889
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.2.9-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>

src/ResourceManager/Consumption/Commands.Consumption.Test/SessionRecords/Microsoft.Azure.Commands.Consumption.Test.ScenarioTests.UsageDetailsTests/TestListBillingPeriodUsageDetails.json

Lines changed: 12 additions & 15 deletions
Large diffs are not rendered by default.

src/ResourceManager/Consumption/Commands.Consumption.Test/SessionRecords/Microsoft.Azure.Commands.Consumption.Test.ScenarioTests.UsageDetailsTests/TestListBillingPeriodUsageDetailsWithDateFilter.json

Lines changed: 13 additions & 16 deletions
Large diffs are not rendered by default.

src/ResourceManager/Consumption/Commands.Consumption.Test/SessionRecords/Microsoft.Azure.Commands.Consumption.Test.ScenarioTests.UsageDetailsTests/TestListBillingPeriodUsageDetailsWithFilterOnInstanceName.json

Lines changed: 12 additions & 15 deletions
Large diffs are not rendered by default.

src/ResourceManager/Consumption/Commands.Consumption.Test/SessionRecords/Microsoft.Azure.Commands.Consumption.Test.ScenarioTests.UsageDetailsTests/TestListUsageDetails.json

Lines changed: 13 additions & 16 deletions
Large diffs are not rendered by default.

src/ResourceManager/Consumption/Commands.Consumption.Test/SessionRecords/Microsoft.Azure.Commands.Consumption.Test.ScenarioTests.UsageDetailsTests/TestListUsageDetailsWithAdditionalPropertiesExpand.json

Lines changed: 0 additions & 83 deletions
This file was deleted.

src/ResourceManager/Consumption/Commands.Consumption.Test/SessionRecords/Microsoft.Azure.Commands.Consumption.Test.ScenarioTests.UsageDetailsTests/TestListUsageDetailsWithDateFilter.json

Lines changed: 80 additions & 0 deletions
Large diffs are not rendered by default.

src/ResourceManager/Consumption/Commands.Consumption.Test/SessionRecords/Microsoft.Azure.Commands.Consumption.Test.ScenarioTests.UsageDetailsTests/TestListUsageDetailsWithMeterDetailsExpand.json

Lines changed: 14 additions & 17 deletions
Large diffs are not rendered by default.

src/ResourceManager/Consumption/Commands.Consumption.Test/packages.config

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
1515
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net45" />
1616
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
17-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
18-
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.10" targetFramework="net452" />
1917
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.2.9-preview" targetFramework="net452" />
2018
<package id="Microsoft.Rest.ClientRuntime.Azure.TestFramework" version="1.5.1-preview" targetFramework="net452" />
2119
<package id="Microsoft.WindowsAzure.Management" version="4.0.1" targetFramework="net45" />

src/ResourceManager/Consumption/Commands.Consumption/Cmdlets/UsageDetails/GetAzureRmConsumptionUsageDetail.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using System.Collections.Generic;
2222
using System.Linq;
2323
using System.Management.Automation;
24+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2425

2526
namespace Microsoft.Azure.Commands.Consumption.Cmdlets.UsageDetails
2627
{
@@ -65,7 +66,7 @@ public class GetAzureRmConsumptionUsageDetail : AzureConsumptionCmdletBase
6566

6667
[Parameter(Mandatory = false, HelpMessage = "The tag of the usages to filter.")]
6768
[ValidateNotNull]
68-
public string Tags { get; set; }
69+
public string Tag { get; set; }
6970

7071
[Parameter(Mandatory = false, HelpMessage = "Determine the maximum number of records to return.")]
7172
[ValidateNotNull]
@@ -75,6 +76,7 @@ public class GetAzureRmConsumptionUsageDetail : AzureConsumptionCmdletBase
7576
[ValidateNotNull]
7677
public int? Top { get; set; }
7778

79+
[CmdletParameterBreakingChange("InvoiceName", ChangeDescription = "InvoiceName is being deprecated without being replaced.")]
7880
[Parameter(Mandatory = false, HelpMessage = "Name of a specific invoice to get the usage details that associate with.")]
7981
[ValidateNotNullOrEmpty]
8082
public string InvoiceName { get; set; }
@@ -165,9 +167,9 @@ public override void ExecuteCmdlet()
165167
}
166168
}
167169

168-
if (!string.IsNullOrWhiteSpace(this.Tags))
170+
if (!string.IsNullOrWhiteSpace(this.Tag))
169171
{
170-
string tagsFilter = "properties/tags eq " + "'" + this.Tags + "'";
172+
string tagsFilter = "properties/tags eq " + "'" + this.Tag + "'";
171173
if (string.IsNullOrWhiteSpace(filter))
172174
{
173175
filter = tagsFilter;

src/ResourceManager/Consumption/Commands.Consumption/Commands.Consumption.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
<ItemGroup>
4545
<Reference Include="Microsoft.Azure.Management.Consumption, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4646
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Consumption.3.0.0\lib\net452\Microsoft.Azure.Management.Consumption.dll</HintPath>
47-
<Private>True</Private>
4847
</Reference>
4948
<Reference Include="System.Web" />
5049
</ItemGroup>

src/ResourceManager/Consumption/Commands.Consumption/Models/PSUsageDetail.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using System;
1616
using System.Collections.Generic;
17+
using Microsoft.Azure.Commands.Consumption.Common;
1718
using ApiUsageDetail = Microsoft.Azure.Management.Consumption.Models.UsageDetail;
1819
using MeterDetails = Microsoft.Azure.Management.Consumption.Models.MeterDetails;
1920

@@ -25,6 +26,7 @@ public class PSUsageDetail
2526
public string AdditionalProperties { get; set; }
2627
public decimal? BillableQuantity { get; set; }
2728
public string BillingPeriodId { get; set; }
29+
public string BillingPeriodName { get; set; }
2830
public string ConsumedService { get; set; }
2931
public string CostCenter { get; set; }
3032
public string Currency { get; set; }
@@ -34,6 +36,7 @@ public class PSUsageDetail
3436
public string InstanceLocation { get; set; }
3537
public string InstanceName { get; set; }
3638
public string InvoiceId { get; set; }
39+
public string InvoiceName { get; set; }
3740
public bool? IsEstimated { get; set; }
3841
public MeterDetails MeterDetails { get; set; }
3942
public string MeterId { get; set; }
@@ -42,7 +45,7 @@ public class PSUsageDetail
4245
public string Product { get; set; }
4346
public string SubscriptionGuid { get; set; }
4447
public string SubscriptionName { get; set; }
45-
public IDictionary<string, string> Tags { get; private set; }
48+
public IDictionary<string, string> Tag { get; private set; }
4649
public string Type { get; private set; }
4750
public DateTime? UsageEnd { get; private set; }
4851
public decimal? UsageQuantity { get; set; }
@@ -60,6 +63,7 @@ public PSUsageDetail(ApiUsageDetail usageDetail)
6063
this.AdditionalProperties = usageDetail.AdditionalProperties;
6164
this.BillableQuantity = usageDetail.BillableQuantity;
6265
this.BillingPeriodId = usageDetail.BillingPeriodId;
66+
this.BillingPeriodName = Utilities.GetResourceNameFromId(usageDetail.BillingPeriodId);
6367
this.ConsumedService = usageDetail.ConsumedService;
6468
this.CostCenter = usageDetail.CostCenter;
6569
this.Currency = usageDetail.Currency;
@@ -69,6 +73,7 @@ public PSUsageDetail(ApiUsageDetail usageDetail)
6973
this.InstanceLocation = usageDetail.InstanceLocation;
7074
this.InstanceName = usageDetail.InstanceName;
7175
this.InvoiceId = usageDetail.InvoiceId;
76+
this.InvoiceName = Utilities.GetResourceNameFromId(usageDetail.InvoiceId);
7277
this.IsEstimated = usageDetail.IsEstimated;
7378
this.MeterDetails = usageDetail.MeterDetails;
7479
this.MeterId = usageDetail.MeterId;
@@ -77,7 +82,7 @@ public PSUsageDetail(ApiUsageDetail usageDetail)
7782
this.Product = usageDetail.Product;
7883
this.SubscriptionGuid = usageDetail.SubscriptionGuid;
7984
this.SubscriptionName = usageDetail.SubscriptionName;
80-
this.Tags = usageDetail.Tags;
85+
this.Tag = usageDetail.Tags;
8186
this.Type = usageDetail.Type;
8287
this.UsageEnd = usageDetail.UsageEnd;
8388
this.UsageQuantity = usageDetail.UsageQuantity;

0 commit comments

Comments
 (0)