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
2 changes: 1 addition & 1 deletion src/Reservations/Az.Reservations.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 3/13/2023
# Generated on: 3/14/2023
#

@{
Expand Down
2 changes: 2 additions & 0 deletions src/Reservations/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
-->
## Upcoming Release
* Added cmdlet `Invoke-AzReservationReturn`
* Removed parameters `RefreshSummary`, `Skiptoken`, `Take` from cmdlet `Get-AzReservation`
* Added parameters `First`, `Skip` for cmdlet `Get-AzReservation`

## Version 0.11.0
* Added new commands to CalculateRefund and Return reservation
Expand Down
13 changes: 13 additions & 0 deletions src/Reservations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ directive:
subject-prefix: Reservation
subject: Return
hide: true

### Hide command parameter
- where:
verb: Get
subject: Reservation
parameter-name: Skiptoken|Take|RefreshSummary
hide: true

### Rename property name
- where:
Expand Down Expand Up @@ -434,6 +441,12 @@ directive:
model-name: RefundResponse
set:
suppress-format: true

- where:
verb: Get
variant: ^List1(.*)
set:
clientside-pagination: true

- no-inline:
- Price
Expand Down
70 changes: 35 additions & 35 deletions src/Reservations/Reservations.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{1177B5F0-C049-4A3F-A470-3670889E8450}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{14B788BB-1062-41A3-B03C-AF1B2DF2D961}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{6AD85668-D55E-4756-817C-6A2F2126741F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{152F59C4-3EFA-4C9F-89CF-9B09CE32AD40}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{C19E6B79-6484-4A73-B1DF-26699372E87A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{43D81BEF-08CD-484D-916C-8CCB74DCEAD3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{259997FB-AB09-499F-AE7C-7A052F8600EF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{0B9A8D52-FBB5-4F46-BCC6-A2DDFE9ECBE5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{2B01E114-6EC5-4A14-90D1-50A4ADA431EC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{65B22626-3659-48F4-88F3-AC04DD59A2BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{7CDBCF71-514C-456C-9522-0788F74D806E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{AF527A31-6CD5-4AFF-B55B-88CF539E08A0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Reservations", "Az.Reservations.csproj", "{52BEE358-2F42-4573-8DB7-3F12D9E5C8FC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Reservations", "Az.Reservations.csproj", "{CF21494E-914E-4B33-A201-C148F5220349}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -26,33 +26,33 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1177B5F0-C049-4A3F-A470-3670889E8450}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1177B5F0-C049-4A3F-A470-3670889E8450}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1177B5F0-C049-4A3F-A470-3670889E8450}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1177B5F0-C049-4A3F-A470-3670889E8450}.Release|Any CPU.Build.0 = Release|Any CPU
{6AD85668-D55E-4756-817C-6A2F2126741F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6AD85668-D55E-4756-817C-6A2F2126741F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AD85668-D55E-4756-817C-6A2F2126741F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AD85668-D55E-4756-817C-6A2F2126741F}.Release|Any CPU.Build.0 = Release|Any CPU
{C19E6B79-6484-4A73-B1DF-26699372E87A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C19E6B79-6484-4A73-B1DF-26699372E87A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C19E6B79-6484-4A73-B1DF-26699372E87A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C19E6B79-6484-4A73-B1DF-26699372E87A}.Release|Any CPU.Build.0 = Release|Any CPU
{259997FB-AB09-499F-AE7C-7A052F8600EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{259997FB-AB09-499F-AE7C-7A052F8600EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{259997FB-AB09-499F-AE7C-7A052F8600EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{259997FB-AB09-499F-AE7C-7A052F8600EF}.Release|Any CPU.Build.0 = Release|Any CPU
{2B01E114-6EC5-4A14-90D1-50A4ADA431EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B01E114-6EC5-4A14-90D1-50A4ADA431EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B01E114-6EC5-4A14-90D1-50A4ADA431EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B01E114-6EC5-4A14-90D1-50A4ADA431EC}.Release|Any CPU.Build.0 = Release|Any CPU
{7CDBCF71-514C-456C-9522-0788F74D806E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7CDBCF71-514C-456C-9522-0788F74D806E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CDBCF71-514C-456C-9522-0788F74D806E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CDBCF71-514C-456C-9522-0788F74D806E}.Release|Any CPU.Build.0 = Release|Any CPU
{52BEE358-2F42-4573-8DB7-3F12D9E5C8FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52BEE358-2F42-4573-8DB7-3F12D9E5C8FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52BEE358-2F42-4573-8DB7-3F12D9E5C8FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52BEE358-2F42-4573-8DB7-3F12D9E5C8FC}.Release|Any CPU.Build.0 = Release|Any CPU
{14B788BB-1062-41A3-B03C-AF1B2DF2D961}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14B788BB-1062-41A3-B03C-AF1B2DF2D961}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14B788BB-1062-41A3-B03C-AF1B2DF2D961}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14B788BB-1062-41A3-B03C-AF1B2DF2D961}.Release|Any CPU.Build.0 = Release|Any CPU
{152F59C4-3EFA-4C9F-89CF-9B09CE32AD40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{152F59C4-3EFA-4C9F-89CF-9B09CE32AD40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{152F59C4-3EFA-4C9F-89CF-9B09CE32AD40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{152F59C4-3EFA-4C9F-89CF-9B09CE32AD40}.Release|Any CPU.Build.0 = Release|Any CPU
{43D81BEF-08CD-484D-916C-8CCB74DCEAD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43D81BEF-08CD-484D-916C-8CCB74DCEAD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43D81BEF-08CD-484D-916C-8CCB74DCEAD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43D81BEF-08CD-484D-916C-8CCB74DCEAD3}.Release|Any CPU.Build.0 = Release|Any CPU
{0B9A8D52-FBB5-4F46-BCC6-A2DDFE9ECBE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B9A8D52-FBB5-4F46-BCC6-A2DDFE9ECBE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B9A8D52-FBB5-4F46-BCC6-A2DDFE9ECBE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B9A8D52-FBB5-4F46-BCC6-A2DDFE9ECBE5}.Release|Any CPU.Build.0 = Release|Any CPU
{65B22626-3659-48F4-88F3-AC04DD59A2BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65B22626-3659-48F4-88F3-AC04DD59A2BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65B22626-3659-48F4-88F3-AC04DD59A2BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65B22626-3659-48F4-88F3-AC04DD59A2BA}.Release|Any CPU.Build.0 = Release|Any CPU
{AF527A31-6CD5-4AFF-B55B-88CF539E08A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF527A31-6CD5-4AFF-B55B-88CF539E08A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF527A31-6CD5-4AFF-B55B-88CF539E08A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF527A31-6CD5-4AFF-B55B-88CF539E08A0}.Release|Any CPU.Build.0 = Release|Any CPU
{CF21494E-914E-4B33-A201-C148F5220349}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF21494E-914E-4B33-A201-C148F5220349}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF21494E-914E-4B33-A201-C148F5220349}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF21494E-914E-4B33-A201-C148F5220349}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
40 changes: 3 additions & 37 deletions src/Reservations/examples/Invoke-AzReservationReturn.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,8 @@ Invoke-AzReservationCalculateRefund -ReservationOrderId $orderId -ReservationToR
```

```output
BillingInformationBillingCurrencyProratedAmount : {
"currencyCode": "USD",
"amount": 12.9
}
BillingInformationBillingCurrencyRemainingCommitmentAmount : {
"currencyCode": "USD",
"amount": 18.06
}
BillingInformationBillingCurrencyTotalPaidAmount : {
"currencyCode": "USD",
"amount": 15.48
}
BillingInformationBillingPlan : Monthly
BillingInformationCompletedTransaction : 5
BillingInformationTotalTransaction : 12
BillingRefundAmount : {
"currencyCode": "USD",
"amount": 2.58
}
ConsumedRefundsTotal : {
"currencyCode": "USD",
"amount": 368.23
}
Id : /providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000003/reservations/30000000-aaaa-bbbb-cccc-100000000003
Location :
MaxRefundLimit : {
"currencyCode": "USD",
"amount": 50000
}
PolicyError : {}
PricingRefundAmount : {
"currencyCode": "USD",
"amount": 2.58
}
Quantity : 1
ResourceGroupName :
SessionId : 93fe5df2-d888-47c5-b00c-cd0ccb1f29b9
ReservationOrderId DisplayName Term State Quantity Reservations
------------------ ----------- ---- ----- -------- ------------
179ef21b-90ec-4fe4-9423-f794b856dfee VM_RI_08-20-2021_15-47 P3Y Succeeded 1 {{…
```
Proceed reservations return with session ID obtained from Invoke-AzReservationCalculateRefund.
22 changes: 8 additions & 14 deletions src/Reservations/exports/Get-AzReservation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,23 @@ param(
# May be used to sort order by reservation properties.
${Orderby},

[Parameter(ParameterSetName='List1')]
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Query')]
[System.String]
# To indicate whether to refresh the roll up counts of the reservations group by provisioning states
${RefreshSummary},

[Parameter(ParameterSetName='List1')]
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Query')]
[System.String]
# The selected provisioning state
${SelectedState},

[Parameter(ParameterSetName='List1')]
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Query')]
[System.Single]
# The number of reservations to skip from the list before returning results
${Skiptoken},
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Body')]
[System.UInt64]
# Gets only the first 'n' objects.
${First},

[Parameter(ParameterSetName='List1')]
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Query')]
[System.Single]
# To number of reservations to return
${Take},
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Body')]
[System.UInt64]
# Ignores the first 'n' objects and then gets the remaining objects.
${Skip},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
Expand Down
22 changes: 8 additions & 14 deletions src/Reservations/exports/ProxyCmdletDefinitions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1315,29 +1315,23 @@ param(
# May be used to sort order by reservation properties.
${Orderby},

[Parameter(ParameterSetName='List1')]
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Query')]
[System.String]
# To indicate whether to refresh the roll up counts of the reservations group by provisioning states
${RefreshSummary},

[Parameter(ParameterSetName='List1')]
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Query')]
[System.String]
# The selected provisioning state
${SelectedState},

[Parameter(ParameterSetName='List1')]
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Query')]
[System.Single]
# The number of reservations to skip from the list before returning results
${Skiptoken},
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Body')]
[System.UInt64]
# Gets only the first 'n' objects.
${First},

[Parameter(ParameterSetName='List1')]
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Query')]
[System.Single]
# To number of reservations to return
${Take},
[Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category('Body')]
[System.UInt64]
# Ignores the first 'n' objects and then gets the remaining objects.
${Skip},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
Expand Down
2 changes: 1 addition & 1 deletion src/Reservations/generate-info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"swagger_commit": "ba9f30eed00b61ebb1ceedecd65a8ce82c81609b",
"swagger_commit": "d4dfb3388ab40185cf302512268ad1406f666d64",
"node": "v14.15.5",
"autorest": "`-- (empty)",
"autorest_core": "3.9.4",
Expand Down
21 changes: 18 additions & 3 deletions src/Reservations/generated/cmdlets/GetAzReservation_List1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Reservations.Cmdlets
/// <remarks>
/// [OpenAPI] ListAll=>GET:"/providers/Microsoft.Capacity/reservations"
/// </remarks>
[global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzReservation_List1")]
[global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzReservation_List1", SupportsPaging = true)]
[global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Reservations.Models.Api20221101.IReservationResponse))]
[global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.Description(@"List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant.")]
[global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.Generated]
Expand Down Expand Up @@ -150,6 +150,7 @@ public partial class GetAzReservation_List1 : global::System.Management.Automati
Description = @"To indicate whether to refresh the roll up counts of the reservations group by provisioning states",
SerializedName = @"refreshSummary",
PossibleTypes = new [] { typeof(string) })]
[global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.DoNotExport]
[global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.ParameterCategory.Query)]
public string RefreshSummary { get => this._refreshSummary; set => this._refreshSummary = value; }

Expand Down Expand Up @@ -178,6 +179,7 @@ public partial class GetAzReservation_List1 : global::System.Management.Automati
Description = @"The number of reservations to skip from the list before returning results",
SerializedName = @"$skiptoken",
PossibleTypes = new [] { typeof(float) })]
[global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.DoNotExport]
[global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.ParameterCategory.Query)]
public float Skiptoken { get => this._skiptoken; set => this._skiptoken = value; }

Expand All @@ -192,6 +194,7 @@ public partial class GetAzReservation_List1 : global::System.Management.Automati
Description = @"To number of reservations to return",
SerializedName = @"take",
PossibleTypes = new [] { typeof(float) })]
[global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.DoNotExport]
[global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Reservations.ParameterCategory.Query)]
public float Take { get => this._take; set => this._take = value; }

Expand Down Expand Up @@ -447,15 +450,27 @@ protected override void StopProcessing()
return ;
}
// onOk - response for 200 / application/json
// clientside pagination enabled
// response should be returning an array of some kind. +Pageable
// pageable / value / nextLink
var result = await response;
WriteObject(result.Value,true);
if ((ulong)result.Value.Length <= this.PagingParameters.Skip)
{
this.PagingParameters.Skip = this.PagingParameters.Skip - (ulong)result.Value.Length;
}
else
{
ulong toRead = Math.Min(this.PagingParameters.First, (ulong)result.Value.Length - this.PagingParameters.Skip);
var requiredResult = result.Value.SubArray((int)this.PagingParameters.Skip, (int)toRead);
WriteObject(requiredResult, true);
this.PagingParameters.Skip = 0;
this.PagingParameters.First = this.PagingParameters.First <= toRead ? 0 : this.PagingParameters.First - toRead;
}
_nextLink = result.NextLink;
if (_isFirst)
{
_isFirst = false;
while (_nextLink != null)
while (_nextLink != null && this.PagingParameters.First > 0)
{
if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage )
{
Expand Down
Loading