Skip to content

Commit 9c4c3d7

Browse files
committed
Update
1 parent d5a5ba9 commit 9c4c3d7

File tree

3 files changed

+84
-86
lines changed

3 files changed

+84
-86
lines changed

src/ResourceManager/Compute/Commands.Compute/Generated/cli.js

Lines changed: 36 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -5827,6 +5827,14 @@ exports.init = function (cli) {
58275827
var subscription = profile.current.getSubscription(options.subscription);
58285828
var computeManagementClient = utils.createComputeManagementClient(subscription);
58295829
var result = computeManagementClient.virtualMachineScaleSets.list(resourceGroupName, _);
5830+
var nextPageLink = result.nextPageLink;
5831+
while (nextPageLink) {
5832+
var pageResult = computeManagementClient.virtualMachineScaleSets.listNext(nextPageLink, _);
5833+
pageResult.forEach(function(item) {
5834+
result.push(item);
5835+
});
5836+
nextPageLink = pageResult.nextPageLink;
5837+
}
58305838
cli.output.json(result);
58315839
});
58325840
/*
@@ -5843,44 +5851,14 @@ exports.init = function (cli) {
58435851
var subscription = profile.current.getSubscription(options.subscription);
58445852
var computeManagementClient = utils.createComputeManagementClient(subscription);
58455853
var result = computeManagementClient.virtualMachineScaleSets.listAll(_);
5846-
cli.output.json(result);
5847-
});
5848-
/*
5849-
VirtualMachineScaleSets ListAllNext
5850-
--next-page-link
5851-
*/
5852-
var virtualMachineScaleSetsListAllNext = cli.category('vmss')
5853-
.description($('Commands to manage your virtual machine scale sets. '));
5854-
virtualMachineScaleSetsListAllNext.command('list-all-next [next-page-link]')
5855-
.description($('Commands to manage your virtual machine scale sets by the list-all-next method.'))
5856-
.usage('[options] <next-page-link>')
5857-
.option('--next-page-link <next-page-link>', $('next-page-link'))
5858-
.option('--parameter-file <parameter-file>', $('the input parameter file'))
5859-
.option('-s, --subscription <subscription>', $('the subscription identifier'))
5860-
.execute(function(nextPageLink, options, _) {
5861-
cli.output.verbose('nextPageLink = ' + nextPageLink);
5862-
var subscription = profile.current.getSubscription(options.subscription);
5863-
var computeManagementClient = utils.createComputeManagementClient(subscription);
5864-
var result = computeManagementClient.virtualMachineScaleSets.listAllNext(nextPageLink, _);
5865-
cli.output.json(result);
5866-
});
5867-
/*
5868-
VirtualMachineScaleSets ListNext
5869-
--next-page-link
5870-
*/
5871-
var virtualMachineScaleSetsListNext = cli.category('vmss')
5872-
.description($('Commands to manage your virtual machine scale sets. '));
5873-
virtualMachineScaleSetsListNext.command('list-next [next-page-link]')
5874-
.description($('Commands to manage your virtual machine scale sets by the list-next method.'))
5875-
.usage('[options] <next-page-link>')
5876-
.option('--next-page-link <next-page-link>', $('next-page-link'))
5877-
.option('--parameter-file <parameter-file>', $('the input parameter file'))
5878-
.option('-s, --subscription <subscription>', $('the subscription identifier'))
5879-
.execute(function(nextPageLink, options, _) {
5880-
cli.output.verbose('nextPageLink = ' + nextPageLink);
5881-
var subscription = profile.current.getSubscription(options.subscription);
5882-
var computeManagementClient = utils.createComputeManagementClient(subscription);
5883-
var result = computeManagementClient.virtualMachineScaleSets.listNext(nextPageLink, _);
5854+
var nextPageLink = result.nextPageLink;
5855+
while (nextPageLink) {
5856+
var pageResult = computeManagementClient.virtualMachineScaleSets.listAllNext(nextPageLink, _);
5857+
pageResult.forEach(function(item) {
5858+
result.push(item);
5859+
});
5860+
nextPageLink = pageResult.nextPageLink;
5861+
}
58845862
cli.output.json(result);
58855863
});
58865864
/*
@@ -5903,25 +5881,14 @@ exports.init = function (cli) {
59035881
var subscription = profile.current.getSubscription(options.subscription);
59045882
var computeManagementClient = utils.createComputeManagementClient(subscription);
59055883
var result = computeManagementClient.virtualMachineScaleSets.listSkus(resourceGroupName, vMScaleSetName, _);
5906-
cli.output.json(result);
5907-
});
5908-
/*
5909-
VirtualMachineScaleSets ListSkusNext
5910-
--next-page-link
5911-
*/
5912-
var virtualMachineScaleSetsListSkusNext = cli.category('vmss')
5913-
.description($('Commands to manage your virtual machine scale sets. '));
5914-
virtualMachineScaleSetsListSkusNext.command('list-skus-next [next-page-link]')
5915-
.description($('Commands to manage your virtual machine scale sets by the list-skus-next method.'))
5916-
.usage('[options] <next-page-link>')
5917-
.option('--next-page-link <next-page-link>', $('next-page-link'))
5918-
.option('--parameter-file <parameter-file>', $('the input parameter file'))
5919-
.option('-s, --subscription <subscription>', $('the subscription identifier'))
5920-
.execute(function(nextPageLink, options, _) {
5921-
cli.output.verbose('nextPageLink = ' + nextPageLink);
5922-
var subscription = profile.current.getSubscription(options.subscription);
5923-
var computeManagementClient = utils.createComputeManagementClient(subscription);
5924-
var result = computeManagementClient.virtualMachineScaleSets.listSkusNext(nextPageLink, _);
5884+
var nextPageLink = result.nextPageLink;
5885+
while (nextPageLink) {
5886+
var pageResult = computeManagementClient.virtualMachineScaleSets.listSkusNext(nextPageLink, _);
5887+
pageResult.forEach(function(item) {
5888+
result.push(item);
5889+
});
5890+
nextPageLink = pageResult.nextPageLink;
5891+
}
59255892
cli.output.json(result);
59265893
});
59275894
/*
@@ -6188,47 +6155,30 @@ exports.init = function (cli) {
61886155
VirtualMachineScaleSetVMs List
61896156
--resource-group-name
61906157
--virtual-machine-scale-set-name
6191-
--odata-query
6192-
--select
61936158
*/
61946159
var virtualMachineScaleSetVMsList = cli.category('vmssvm')
61956160
.description($('Commands to manage your virtual machine scale set vm. '));
6196-
virtualMachineScaleSetVMsList.command('list [resource-group-name] [virtual-machine-scale-set-name] [odata-query] [select]')
6161+
virtualMachineScaleSetVMsList.command('list [resource-group-name] [virtual-machine-scale-set-name]')
61976162
.description($('Commands to manage your virtual machine scale set vm by the list method.'))
6198-
.usage('[options] <resource-group-name> <virtual-machine-scale-set-name> <odata-query> <select>')
6163+
.usage('[options] <resource-group-name> <virtual-machine-scale-set-name>')
61996164
.option('-g, --resource-group-name <resource-group-name>', $('resource-group-name'))
62006165
.option('-n, --virtual-machine-scale-set-name <virtual-machine-scale-set-name>', $('virtual-machine-scale-set-name'))
6201-
.option('--odata-query <odata-query>', $('odata-query'))
6202-
.option('--select <select>', $('select'))
62036166
.option('--parameter-file <parameter-file>', $('the input parameter file'))
62046167
.option('-s, --subscription <subscription>', $('the subscription identifier'))
6205-
.execute(function(resourceGroupName, virtualMachineScaleSetName, odataQuery, select, options, _) {
6168+
.execute(function(resourceGroupName, virtualMachineScaleSetName, options, _) {
62066169
cli.output.verbose('resourceGroupName = ' + resourceGroupName);
62076170
cli.output.verbose('virtualMachineScaleSetName = ' + virtualMachineScaleSetName);
6208-
cli.output.verbose('odataQuery = ' + odataQuery);
6209-
cli.output.verbose('select = ' + select);
62106171
var subscription = profile.current.getSubscription(options.subscription);
62116172
var computeManagementClient = utils.createComputeManagementClient(subscription);
6212-
var result = computeManagementClient.virtualMachineScaleSetVMs.list(resourceGroupName, virtualMachineScaleSetName, odataQuery, select, _);
6213-
cli.output.json(result);
6214-
});
6215-
/*
6216-
VirtualMachineScaleSetVMs ListNext
6217-
--next-page-link
6218-
*/
6219-
var virtualMachineScaleSetVMsListNext = cli.category('vmssvm')
6220-
.description($('Commands to manage your virtual machine scale set vm. '));
6221-
virtualMachineScaleSetVMsListNext.command('list-next [next-page-link]')
6222-
.description($('Commands to manage your virtual machine scale set vm by the list-next method.'))
6223-
.usage('[options] <next-page-link>')
6224-
.option('--next-page-link <next-page-link>', $('next-page-link'))
6225-
.option('--parameter-file <parameter-file>', $('the input parameter file'))
6226-
.option('-s, --subscription <subscription>', $('the subscription identifier'))
6227-
.execute(function(nextPageLink, options, _) {
6228-
cli.output.verbose('nextPageLink = ' + nextPageLink);
6229-
var subscription = profile.current.getSubscription(options.subscription);
6230-
var computeManagementClient = utils.createComputeManagementClient(subscription);
6231-
var result = computeManagementClient.virtualMachineScaleSetVMs.listNext(nextPageLink, _);
6173+
var result = computeManagementClient.virtualMachineScaleSetVMs.list(resourceGroupName, virtualMachineScaleSetName, _);
6174+
var nextPageLink = result.nextPageLink;
6175+
while (nextPageLink) {
6176+
var pageResult = computeManagementClient.virtualMachineScaleSetVMs.listNext(nextPageLink, _);
6177+
pageResult.forEach(function(item) {
6178+
result.push(item);
6179+
});
6180+
nextPageLink = pageResult.nextPageLink;
6181+
}
62326182
cli.output.json(result);
62336183
});
62346184
/*

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Generate-FunctionCommand.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,8 +967,15 @@ function Generate-CliFunctionCommandImpl
967967
[string]$FileOutputFolder = $null
968968
)
969969

970+
# Skip Pagination Function
971+
if (CheckIf-PaginationMethod $MethodInfo)
972+
{
973+
return;
974+
}
975+
970976
$methodParameters = $MethodInfo.GetParameters();
971977
$methodName = ($MethodInfo.Name.Replace('Async', ''));
978+
972979
$methodParamNameList = @();
973980
$methodParamTypeDict = @{};
974981
$allStringFieldCheck = @{};
@@ -990,6 +997,14 @@ function Generate-CliFunctionCommandImpl
990997
{
991998
continue;
992999
}
1000+
elseif ($paramItem.Name -eq 'odataQuery')
1001+
{
1002+
continue;
1003+
}
1004+
elseif ($paramType.IsEquivalentTo([string]) -and $paramItem.Name -eq 'select')
1005+
{
1006+
continue;
1007+
}
9931008
else
9941009
{
9951010
# Record the Normalized Parameter Name, i.e. 'vmName' => 'VMName', 'resourceGroup' => 'ResourceGroup', etc.
@@ -1250,6 +1265,19 @@ function Generate-CliFunctionCommandImpl
12501265
}
12511266

12521267
$code += "_);" + $NEW_LINE;
1268+
1269+
if ($PageMethodInfo -ne $null)
1270+
{
1271+
$code += " var nextPageLink = result.nextPageLink;" + $NEW_LINE;
1272+
$code += " while (nextPageLink) {" + $NEW_LINE;
1273+
$code += " var pageResult = ${componentNameInLowerCase}ManagementClient.${cliOperationName}.${cliMethodFuncName}Next(nextPageLink, _);" + $NEW_LINE;
1274+
$code += " pageResult.forEach(function(item) {" + $NEW_LINE;
1275+
$code += " result.push(item);" + $NEW_LINE;
1276+
$code += " });" + $NEW_LINE;
1277+
$code += " nextPageLink = pageResult.nextPageLink;" + $NEW_LINE;
1278+
$code += " }" + $NEW_LINE;
1279+
}
1280+
12531281
$code += " cli.output.json(result);" + $NEW_LINE;
12541282
$code += " });" + $NEW_LINE;
12551283

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Automation/Import-TypeFunction.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,4 +814,24 @@ function Find-MatchedMethod
814814
}
815815

816816
return $null;
817+
}
818+
819+
function CheckIf-PaginationMethod
820+
{
821+
param
822+
(
823+
[Parameter(Mandatory = $true)]
824+
[System.Reflection.MethodInfo]$MethodInfo
825+
)
826+
827+
if ($MethodInfo.Name -like "List*Next")
828+
{
829+
$methodParameters = $MethodInfo.GetParameters();
830+
if ($methodParameters.Count -eq 2 -and $methodParameters[1].ParameterType.IsEquivalentTo([string]))
831+
{
832+
return $true;
833+
}
834+
}
835+
836+
return $false;
817837
}

0 commit comments

Comments
 (0)