Skip to content

Commit

Permalink
[Billing] Re-name about Get-UsageAggregates and added alias (#26121)
Browse files Browse the repository at this point in the history
* Re-name about Get-UsageAggregates and added alias

* update changelog

* update

* update

* update

* Update ChangeLog.md

---------

Co-authored-by: Jin Lei <54836179+msJinLei@users.noreply.github.com>
  • Loading branch information
2 people authored and azure-powershell-bot committed Sep 18, 2024
1 parent 535f9c8 commit 6ad7888
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/Billing/Billing/Az.Billing.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ CmdletsToExport = 'Get-AzBillingAccount', 'Get-AzBillingInvoice', 'Get-AzBilling
'Get-AzConsumptionReservationDetail',
'Get-AzConsumptionReservationSummary',
'Get-AzConsumptionUsageDetail', 'Get-AzEnrollmentAccount',
'Get-AzInvoiceSection', 'Get-UsageAggregates',
'Get-AzInvoiceSection', 'Get-AzUsageAggregate',
'New-AzConsumptionBudget', 'Remove-AzConsumptionBudget',
'Set-AzConsumptionBudget'

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

# 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.
AliasesToExport = @()
AliasesToExport = 'Get-UsageAggregates'

# DSC resources to export from this module
# DscResourcesToExport = @()
Expand Down
1 change: 1 addition & 0 deletions src/Billing/Billing/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Renamed `Get-UsageAggregates` to `Get-AzUsageAggregate` and added `Get-UsageAggregates` as the alias to avoid breaking change.

## Version 2.0.4
* Removed the outdated deps.json file.
Expand Down
2 changes: 1 addition & 1 deletion src/Billing/Billing/help/Az.Billing.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Get usage details of the subscription.
### [Get-AzEnrollmentAccount](Get-AzEnrollmentAccount.md)
Get enrollment accounts.

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

### [New-AzConsumptionBudget](New-AzConsumptionBudget.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
---
external help file: Microsoft.Azure.PowerShell.Cmdlets.UsageAggregates.dll-Help.xml
Module Name: Az.Billing
ms.assetid: 52B3ECCB-80E5-4E16-954A-B83D0BDC7E22
online version: https://learn.microsoft.com/powershell/module/az.billing/get-usageaggregates
online version: https://learn.microsoft.com/powershell/module/az.billing/get-azusageaggregate
schema: 2.0.0
---

# Get-UsageAggregates
# Get-AzUsageAggregate

## SYNOPSIS
Gets the reported Azure subscription usage details.

## SYNTAX

```
Get-UsageAggregates -ReportedStartTime <DateTime> -ReportedEndTime <DateTime>
[-AggregationGranularity <AggregationGranularity>] [-ShowDetails <Boolean>] [-ContinuationToken <String>]
Get-AzUsageAggregate -ReportedStartTime <DateTime> -ReportedEndTime <DateTime>
[-AggregationGranularity <AggregationGranularity>] [-ShowDetail <Boolean>] [-ContinuationToken <String>]
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

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

### Example 1: Retrieve subscription data
```powershell
Get-UsageAggregates -ReportedStartTime "5/2/2015" -ReportedEndTime "5/5/2015"
Get-AzUsageAggregate -ReportedStartTime "5/2/2015" -ReportedEndTime "5/5/2015"
```

This command retrieves the reported usage data for the subscription between 5/2/2015 and 5/5/2015.
Expand Down Expand Up @@ -76,7 +75,7 @@ Accept wildcard characters: False
```
### -DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
The credentials, account, tenant, and subscription used for communication with Azure.
```yaml
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Expand Down Expand Up @@ -124,7 +123,7 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -ShowDetails
### -ShowDetail
Indicates whether this cmdlet returns instance-level details with the usage data.
The default value is $True.
If $False, the service aggregates the results on the server side, and therefore returns fewer aggregate groups.
Expand All @@ -134,7 +133,7 @@ However, when the value is $False, all the data for the same **subscriptionId**,
```yaml
Type: System.Boolean
Parameter Sets: (All)
Aliases:
Aliases: ShowDetails

Required: False
Position: Named
Expand All @@ -144,7 +143,7 @@ Accept wildcard characters: False
```
### CommonParameters
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).
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).
## INPUTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public UsageAggregatesTests(ITestOutputHelper output) : base(output)
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetUsageAggregatesWithDefaultParameters()
{
TestRunner.RunTestScript("Test-GetUsageAggregatesWithDefaultParameters");
TestRunner.RunTestScript("Test-GetAzUsageAggregateWithDefaultParameters");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
.SYNOPSIS
Tests retrieving some usage data
#>
function Test-GetUsageAggregatesWithDefaultParameters()
function Test-GetAzUsageAggregateWithDefaultParameters()
{
$result = Get-UsageAggregates -ReportedStartTime "5/1/2015" -ReportedEndTime "5/2/2015"
$result = Get-AzUsageAggregate -ReportedStartTime "5/1/2015" -ReportedEndTime "5/2/2015"
Write-Debug $result
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
// limitations under the License.
// ----------------------------------------------------------------------------------


using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Models;
using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Models;
using Microsoft.Azure.Commerce.UsageAggregates;

namespace Microsoft.Azure.Commands.UsageAggregates
Expand All @@ -25,12 +24,13 @@ namespace Microsoft.Azure.Commands.UsageAggregates
using System;
using System.Management.Automation;

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

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

[Alias("ShowDetails")]
[Parameter(Mandatory = false, HelpMessage = "When set to true (default), the aggregates are broken down into the instance metadata which is more granular.")]
public bool ShowDetails
public bool ShowDetail
{
get { return _showDetails; }
set { _showDetails = value; }
get { return _showDetail; }
set { _showDetail = value; }
}

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

UsageAggregationGetResponse aggregations = _theClient.UsageAggregates.Get(ReportedStartTime,
ReportedEndTime, AggregationGranularity, ShowDetails,
ReportedEndTime, AggregationGranularity, ShowDetail,
ContinuationToken);

WriteObject(aggregations);
Expand Down

0 comments on commit 6ad7888

Please sign in to comment.