Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the ""License"");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an ""AS IS"" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - CostManagement")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
22 changes: 12 additions & 10 deletions src/CostManagement/CostManagement.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,12 @@ module-version: 0.3.0

service-name: CostManagement

identity-correction-for-post: true

# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
use-extension:
"@autorest/powershell": "3.x"

directive:
- where:
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true
- where:
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
remove: true
- from: source-file-csharp
where: $
Expand All @@ -84,18 +81,18 @@ directive:
remove: true
# Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header.
- where:
subject: GenerateCostDetailReportOperationResult
subject: GenerateCostDetailsReportOperationResult
verb: Get
remove: true

- where:
subject: GenerateCostDetailReportOperation
subject: GenerateCostDetailsReportOperation
set:
subject: DetailReport

# The schema of their response body is the same
- where:
subject: ByGenerateReservationDetailReportBillingAccountId|ByGenerateReservationDetailReportBillingProfileId
subject: ByGenerateReservationDetailsReportBillingAccountId|ByGenerateReservationDetailsReportBillingProfileId
set:
subject: ReservationDetailReport
- where:
Expand Down Expand Up @@ -220,4 +217,9 @@ directive:
- ReportConfigFilterAutoGenerated
- QueryFilter
- ReportConfigFilter
- model-cmdlet:
- model-name: QueryFilter
cmdlet-name: New-AzCostManagementQueryFilterObject
- model-name: QueryComparisonExpression
cmdlet-name: New-AzCostManagementQueryComparisonExpressionObject
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Query the usage data for scope defined.
Query the usage data for scope defined.
#>
function Invoke-AzCostManagementQuery {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.IQueryResult])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.IQueryResult])]
[CmdletBinding(DefaultParameterSetName='UsageExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[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.")]
Expand All @@ -37,27 +37,27 @@ param(
${ExternalCloudProviderId},

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

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

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

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

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

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

$Request = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.QueryDefinition]::New()
$Request = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.QueryDefinition]::New()
if ($PSBoundParameters.ContainsKey('ConfigurationColumn')) {
$Request.ConfigurationColumn = $ConfigurationColumn
}
Expand Down Expand Up @@ -206,7 +206,7 @@ param(
if ($PSBoundParameters.ContainsKey('Type')) {
$Request.Type = $Type
}
$Result = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.QueryResult]::New()
$Result = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.QueryResult]::New()
$SkipToken = $null
$RowList = New-Object System.Collections.Generic.List[System.Collections.Generic.List[string]]
while ($true) {
Expand All @@ -228,7 +228,7 @@ param(
}

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

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

$ColumnList = New-Object System.Collections.Generic.List[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.IQueryColumn]
$ColumnList = New-Object System.Collections.Generic.List[Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.IQueryColumn]
foreach ($Column in $ResponseContent.Properties.Columns) {
Write-Host $Column.ToString()
$QueryColumn = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.Api20211001.QueryColumn]::New()
$QueryColumn = [Microsoft.Azure.PowerShell.Cmdlets.CostManagement.Models.QueryColumn]::New()
$QueryColumn.Name = $Column.Name
$QueryColumn.Type = $Column.Type
$ColumnList.Add($QueryColumn)
Expand Down
Loading