Skip to content

Commit a0d7df0

Browse files
authored
[Az.CostManagement] Update generation tool version: autorest.powershell v3 -> v4 (Azure#27562)
1 parent e961c97 commit a0d7df0

File tree

38 files changed

+1199
-503
lines changed

38 files changed

+1199
-503
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0 (the ""License"");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an ""AS IS"" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
12+
// is regenerated.
13+
14+
using System;
15+
using System.Reflection;
16+
using System.Runtime.CompilerServices;
17+
using System.Runtime.InteropServices;
18+
19+
[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
20+
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
21+
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
22+
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - CostManagement")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0")]
25+
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
26+
[assembly: System.CLSCompliantAttribute(false)]

src/CostManagement/CostManagement.Autorest/README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,12 @@ module-version: 0.3.0
5454

5555
service-name: CostManagement
5656

57-
identity-correction-for-post: true
58-
59-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
60-
use-extension:
61-
"@autorest/powershell": "3.x"
62-
6357
directive:
6458
- where:
65-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
59+
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
60+
remove: true
61+
- where:
62+
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
6663
remove: true
6764
- from: source-file-csharp
6865
where: $
@@ -84,18 +81,18 @@ directive:
8481
remove: true
8582
# Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header.
8683
- where:
87-
subject: GenerateCostDetailReportOperationResult
84+
subject: GenerateCostDetailsReportOperationResult
8885
verb: Get
8986
remove: true
9087

9188
- where:
92-
subject: GenerateCostDetailReportOperation
89+
subject: GenerateCostDetailsReportOperation
9390
set:
9491
subject: DetailReport
9592

9693
# The schema of their response body is the same
9794
- where:
98-
subject: ByGenerateReservationDetailReportBillingAccountId|ByGenerateReservationDetailReportBillingProfileId
95+
subject: ByGenerateReservationDetailsReportBillingAccountId|ByGenerateReservationDetailsReportBillingProfileId
9996
set:
10097
subject: ReservationDetailReport
10198
- where:
@@ -220,4 +217,9 @@ directive:
220217
- ReportConfigFilterAutoGenerated
221218
- QueryFilter
222219
- ReportConfigFilter
220+
- model-cmdlet:
221+
- model-name: QueryFilter
222+
cmdlet-name: New-AzCostManagementQueryFilterObject
223+
- model-name: QueryComparisonExpression
224+
cmdlet-name: New-AzCostManagementQueryComparisonExpressionObject
223225
```

src/CostManagement/CostManagement.Autorest/custom/Invoke-AzCostManagementQuery.ps1

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Query the usage data for scope defined.
2020
Query the usage data for scope defined.
2121
#>
2222
function Invoke-AzCostManagementQuery {
23-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.IQueryResult])]
23+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.IQueryResult])]
2424
[CmdletBinding(DefaultParameterSetName='UsageExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
2525
param(
2626
[Parameter(ParameterSetName='UsageExpanded', Mandatory, HelpMessage="This includes 'subscriptions/{subscriptionId}/' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId} for Management Group scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners.")]
@@ -37,27 +37,27 @@ param(
3737
${ExternalCloudProviderId},
3838

3939
[Parameter(ParameterSetName='UsageExpanded1', Mandatory, HelpMessage="The external cloud provider type associated with dimension/query operations.")]
40-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExternalCloudProviderType])]
40+
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.PSArgumentCompleterAttribute("ExternalBillingAccounts", "ExternalSubscriptions")]
4141
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Path')]
42-
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExternalCloudProviderType]
42+
[System.String]
4343
# The external cloud provider type associated with dimension/query operations.
4444
# This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account.
4545
${ExternalCloudProviderType},
4646

4747
[Parameter(ParameterSetName='UsageExpanded', Mandatory, HelpMessage="The time frame for pulling data for the query.")]
4848
[Parameter(ParameterSetName='UsageExpanded1', Mandatory, HelpMessage="The time frame for pulling data for the query.")]
49-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.TimeframeType])]
49+
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.PSArgumentCompleterAttribute("MonthToDate", "BillingMonthToDate", "TheLastMonth", "TheLastBillingMonth", "WeekToDate", "Custom")]
5050
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')]
51-
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.TimeframeType]
51+
[System.String]
5252
# The time frame for pulling data for the query.
5353
# If custom, then a specific time period must be provided.
5454
${Timeframe},
5555

5656
[Parameter(ParameterSetName='UsageExpanded', Mandatory, HelpMessage="The type of the query.")]
5757
[Parameter(ParameterSetName='UsageExpanded1', Mandatory, HelpMessage="The type of the query.")]
58-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExportType])]
58+
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.PSArgumentCompleterAttribute("Usage", "ActualCost", "AmortizedCost")]
5959
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')]
60-
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.ExportType]
60+
[System.String]
6161
# The type of the query.
6262
${Type},
6363

@@ -73,7 +73,7 @@ param(
7373
[Parameter(ParameterSetName='UsageExpanded', HelpMessage="Dictionary of aggregation expression to use in the query.")]
7474
[Parameter(ParameterSetName='UsageExpanded1', HelpMessage="Dictionary of aggregation expression to use in the query.")]
7575
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')]
76-
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.IQueryDatasetAggregation]))]
76+
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.IQueryDatasetAggregation]))]
7777
[System.Collections.Hashtable]
7878
# Dictionary of aggregation expression to use in the query.
7979
# The key of each item in the dictionary is the alias for the aggregated column.
@@ -83,23 +83,23 @@ param(
8383
[Parameter(ParameterSetName='UsageExpanded', HelpMessage="Has filter expression to use in the query.")]
8484
[Parameter(ParameterSetName='UsageExpanded1', HelpMessage="Has filter expression to use in the query.")]
8585
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')]
86-
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.IQueryFilter]
86+
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.IQueryFilter]
8787
# Has filter expression to use in the query.
8888
# To construct, see NOTES section for DATASETFILTER properties and create a hash table.
8989
${DatasetFilter},
9090

9191
[Parameter(ParameterSetName='UsageExpanded', HelpMessage="The granularity of rows in the query.")]
9292
[Parameter(ParameterSetName='UsageExpanded1', HelpMessage="The granularity of rows in the query.")]
93-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType])]
93+
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.PSArgumentCompleterAttribute("Daily")]
9494
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')]
95-
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Support.GranularityType]
95+
[System.String]
9696
# The granularity of rows in the query.
9797
${DatasetGranularity},
9898

9999
[Parameter(ParameterSetName='UsageExpanded', HelpMessage='Array of group by expression to use in the query.')]
100100
[Parameter(ParameterSetName='UsageExpanded1', HelpMessage="Array of group by expression to use in the query.")]
101101
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Category('Body')]
102-
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.IQueryGrouping[]]
102+
[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.IQueryGrouping[]]
103103
# Array of group by expression to use in the query.
104104
# Query can have up to 2 group by clauses.
105105
# To construct, see NOTES section for DATASETGROUPING properties and create a hash table.
@@ -178,7 +178,7 @@ param(
178178
"$Scope/providers/Microsoft.CostManagement/query?api-version=$ApiVersion", "\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")
179179
}
180180

181-
$Request = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.QueryDefinition]::New()
181+
$Request = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.QueryDefinition]::New()
182182
if ($PSBoundParameters.ContainsKey('ConfigurationColumn')) {
183183
$Request.ConfigurationColumn = $ConfigurationColumn
184184
}
@@ -206,7 +206,7 @@ param(
206206
if ($PSBoundParameters.ContainsKey('Type')) {
207207
$Request.Type = $Type
208208
}
209-
$Result = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.QueryResult]::New()
209+
$Result = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.QueryResult]::New()
210210
$SkipToken = $null
211211
$RowList = New-Object System.Collections.Generic.List[System.Collections.Generic.List[string]]
212212
while ($true) {
@@ -228,7 +228,7 @@ param(
228228
}
229229

230230
function Invoke-AzCostManagementUsageQueryInternal {
231-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.IQueryResult])]
231+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.IQueryResult])]
232232
param(
233233
[System.String]
234234
${URL},
@@ -245,16 +245,16 @@ function Invoke-AzCostManagementUsageQueryInternal {
245245
}
246246
$ResponseContent = (Invoke-AzRest -Path $URL -Payload $Payload -Method POST).Content | ConvertFrom-Json
247247

248-
$Result = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.QueryResult]::New()
248+
$Result = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.QueryResult]::New()
249249
if ($null -ne $ResponseContent.Properties.NextLink)
250250
{
251251
$Result.NextLink = $ResponseContent.Properties.NextLink.split('&')[1]
252252
}
253253

254-
$ColumnList = New-Object System.Collections.Generic.List[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.IQueryColumn]
254+
$ColumnList = New-Object System.Collections.Generic.List[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.IQueryColumn]
255255
foreach ($Column in $ResponseContent.Properties.Columns) {
256256
Write-Host $Column.ToString()
257-
$QueryColumn = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.QueryColumn]::New()
257+
$QueryColumn = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.QueryColumn]::New()
258258
$QueryColumn.Name = $Column.Name
259259
$QueryColumn.Type = $Column.Type
260260
$ColumnList.Add($QueryColumn)

0 commit comments

Comments
 (0)