Skip to content

Commit 789536d

Browse files
[Billing] Re-name about Get-UsageAggregates and added alias (#26121)
* Re-name about Get-UsageAggregates and added alias * update changelog * update * update * update * Update ChangeLog.md --------- Co-authored-by: Jin Lei <[email protected]>
1 parent 9e4fef6 commit 789536d

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

src/Billing/Billing/Az.Billing.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ CmdletsToExport = 'Get-AzBillingAccount', 'Get-AzBillingInvoice', 'Get-AzBilling
8585
'Get-AzConsumptionReservationDetail',
8686
'Get-AzConsumptionReservationSummary',
8787
'Get-AzConsumptionUsageDetail', 'Get-AzEnrollmentAccount',
88-
'Get-AzInvoiceSection', 'Get-UsageAggregates',
88+
'Get-AzInvoiceSection', 'Get-AzUsageAggregate',
8989
'New-AzConsumptionBudget', 'Remove-AzConsumptionBudget',
9090
'Set-AzConsumptionBudget'
9191

9292
# Variables to export from this module
9393
# VariablesToExport = @()
9494

9595
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
96-
AliasesToExport = @()
96+
AliasesToExport = 'Get-UsageAggregates'
9797

9898
# DSC resources to export from this module
9999
# DscResourcesToExport = @()

src/Billing/Billing/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Renamed `Get-UsageAggregates` to `Get-AzUsageAggregate` and added `Get-UsageAggregates` as the alias to avoid breaking change.
2122

2223
## Version 2.0.4
2324
* Removed the outdated deps.json file.

src/Billing/Billing/help/Az.Billing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Get usage details of the subscription.
3838
### [Get-AzEnrollmentAccount](Get-AzEnrollmentAccount.md)
3939
Get enrollment accounts.
4040

41-
### [Get-UsageAggregates](Get-UsageAggregates.md)
41+
### [Get-AzUsageAggregate](Get-AzUsageAggregate.md)
4242
Gets the reported Azure subscription usage details.
4343

4444
### [New-AzConsumptionBudget](New-AzConsumptionBudget.md)

src/Billing/Billing/help/Get-UsageAggregates.md renamed to src/Billing/Billing/help/Get-AzUsageAggregate.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.UsageAggregates.dll-Help.xml
33
Module Name: Az.Billing
4-
ms.assetid: 52B3ECCB-80E5-4E16-954A-B83D0BDC7E22
5-
online version: https://learn.microsoft.com/powershell/module/az.billing/get-usageaggregates
4+
online version: https://learn.microsoft.com/powershell/module/az.billing/get-azusageaggregate
65
schema: 2.0.0
76
---
87

9-
# Get-UsageAggregates
8+
# Get-AzUsageAggregate
109

1110
## SYNOPSIS
1211
Gets the reported Azure subscription usage details.
1312

1413
## SYNTAX
1514

1615
```
17-
Get-UsageAggregates -ReportedStartTime <DateTime> -ReportedEndTime <DateTime>
18-
[-AggregationGranularity <AggregationGranularity>] [-ShowDetails <Boolean>] [-ContinuationToken <String>]
16+
Get-AzUsageAggregate -ReportedStartTime <DateTime> -ReportedEndTime <DateTime>
17+
[-AggregationGranularity <AggregationGranularity>] [-ShowDetail <Boolean>] [-ContinuationToken <String>]
1918
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2019
```
2120

2221
## DESCRIPTION
23-
The **Get-UsageAggregates** cmdlet gets aggregated Azure subscription usage data by the following properties:
22+
The **Get-AzUsageAggregate** cmdlet gets aggregated Azure subscription usage data by the following properties:
2423
- Start and end times of when the usage was reported.
2524
- Aggregation precision, either daily or hourly.
2625
- Instance level detail for multiple instances of the same resource.
@@ -31,7 +30,7 @@ For more information, see Azure Billing REST API Referencehttps://msdn.microsoft
3130

3231
### Example 1: Retrieve subscription data
3332
```powershell
34-
Get-UsageAggregates -ReportedStartTime "5/2/2015" -ReportedEndTime "5/5/2015"
33+
Get-AzUsageAggregate -ReportedStartTime "5/2/2015" -ReportedEndTime "5/5/2015"
3534
```
3635

3736
This command retrieves the reported usage data for the subscription between 5/2/2015 and 5/5/2015.
@@ -76,7 +75,7 @@ Accept wildcard characters: False
7675
```
7776
7877
### -DefaultProfile
79-
The credentials, account, tenant, and subscription used for communication with azure.
78+
The credentials, account, tenant, and subscription used for communication with Azure.
8079
8180
```yaml
8281
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
@@ -124,7 +123,7 @@ Accept pipeline input: False
124123
Accept wildcard characters: False
125124
```
126125
127-
### -ShowDetails
126+
### -ShowDetail
128127
Indicates whether this cmdlet returns instance-level details with the usage data.
129128
The default value is $True.
130129
If $False, the service aggregates the results on the server side, and therefore returns fewer aggregate groups.
@@ -134,7 +133,7 @@ However, when the value is $False, all the data for the same **subscriptionId**,
134133
```yaml
135134
Type: System.Boolean
136135
Parameter Sets: (All)
137-
Aliases:
136+
Aliases: ShowDetails
138137

139138
Required: False
140139
Position: Named
@@ -144,7 +143,7 @@ Accept wildcard characters: False
144143
```
145144
146145
### CommonParameters
147-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
146+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
148147
149148
## INPUTS
150149

src/Billing/UsageAggregates.Test/ScenarioTests/UsageAggregatesTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public UsageAggregatesTests(ITestOutputHelper output) : base(output)
2929
[Trait(Category.AcceptanceType, Category.CheckIn)]
3030
public void TestGetUsageAggregatesWithDefaultParameters()
3131
{
32-
TestRunner.RunTestScript("Test-GetUsageAggregatesWithDefaultParameters");
32+
TestRunner.RunTestScript("Test-GetAzUsageAggregateWithDefaultParameters");
3333
}
3434
}
3535
}

src/Billing/UsageAggregates.Test/ScenarioTests/UsageAggregatesTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
.SYNOPSIS
1717
Tests retrieving some usage data
1818
#>
19-
function Test-GetUsageAggregatesWithDefaultParameters()
19+
function Test-GetAzUsageAggregateWithDefaultParameters()
2020
{
21-
$result = Get-UsageAggregates -ReportedStartTime "5/1/2015" -ReportedEndTime "5/2/2015"
21+
$result = Get-AzUsageAggregate -ReportedStartTime "5/1/2015" -ReportedEndTime "5/2/2015"
2222
Write-Debug $result
2323
}

src/Billing/UsageAggregates/GetUsageAggregatesCommand.cs renamed to src/Billing/UsageAggregates/GetAzureRmUsageAggregateCommand.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
16-
using Microsoft.Azure.Commands.Common.Authentication;
17-
using Microsoft.Azure.Commands.Common.Authentication.Models;
15+
using Microsoft.Azure.Commands.Common.Authentication;
16+
using Microsoft.Azure.Commands.Common.Authentication.Models;
1817
using Microsoft.Azure.Commerce.UsageAggregates;
1918

2019
namespace Microsoft.Azure.Commands.UsageAggregates
@@ -25,12 +24,13 @@ namespace Microsoft.Azure.Commands.UsageAggregates
2524
using System;
2625
using System.Management.Automation;
2726

28-
[Cmdlet(VerbsCommon.Get, "UsageAggregates"), OutputType(typeof(UsageAggregationGetResponse))]
29-
public class GetUsageAggregatesCommand : AzureRMCmdlet
27+
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "UsageAggregate"), OutputType(typeof(UsageAggregationGetResponse))]
28+
[Alias("Get-UsageAggregates")]
29+
public class GetAzureRmUsageAggregateCommand : AzureRMCmdlet
3030
{
3131
private UsageAggregationManagementClient _theClient;
3232
private AggregationGranularity _aggregationGranularity = AggregationGranularity.Daily;
33-
private bool _showDetails = true;
33+
private bool _showDetail = true;
3434

3535
[Parameter(Mandatory = true, HelpMessage = "The start of the time range to retrieve data for.")]
3636
public DateTime ReportedStartTime { get; set; }
@@ -45,11 +45,12 @@ public AggregationGranularity AggregationGranularity
4545
set { _aggregationGranularity = value; }
4646
}
4747

48+
[Alias("ShowDetails")]
4849
[Parameter(Mandatory = false, HelpMessage = "When set to true (default), the aggregates are broken down into the instance metadata which is more granular.")]
49-
public bool ShowDetails
50+
public bool ShowDetail
5051
{
51-
get { return _showDetails; }
52-
set { _showDetails = value; }
52+
get { return _showDetail; }
53+
set { _showDetail = value; }
5354
}
5455

5556
[Parameter(Mandatory = false, HelpMessage = "Retrieved from previous calls, this is the bookmark used for progress when the responses are paged.")]
@@ -64,7 +65,7 @@ public override void ExecuteCmdlet()
6465
}
6566

6667
UsageAggregationGetResponse aggregations = _theClient.UsageAggregates.Get(ReportedStartTime,
67-
ReportedEndTime, AggregationGranularity, ShowDetails,
68+
ReportedEndTime, AggregationGranularity, ShowDetail,
6869
ContinuationToken);
6970

7071
WriteObject(aggregations);

0 commit comments

Comments
 (0)