From b48dd8aaf421cda8a3bbd068960539447438df23 Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Mon, 21 Mar 2016 14:00:06 -0700 Subject: [PATCH] Support lazy loaded lists and streaming --- .../compute/AvailabilitySetsOperations.java | 6 +- .../AvailabilitySetsOperationsImpl.java | 28 +++-- .../management/compute/UsageOperations.java | 4 +- .../compute/UsageOperationsImpl.java | 15 ++- ...lMachineExtensionImagesOperationsImpl.java | 6 +- ...irtualMachineExtensionsOperationsImpl.java | 2 +- .../VirtualMachineImagesOperationsImpl.java | 6 +- .../VirtualMachineScaleSetVMsOperations.java | 6 +- ...rtualMachineScaleSetVMsOperationsImpl.java | 34 +++--- .../VirtualMachineScaleSetsOperations.java | 7 +- ...VirtualMachineScaleSetsOperationsImpl.java | 49 ++++---- .../VirtualMachineSizesOperations.java | 4 +- .../VirtualMachineSizesOperationsImpl.java | 15 ++- .../compute/VirtualMachinesOperations.java | 8 +- .../VirtualMachinesOperationsImpl.java | 43 ++++--- .../ApplicationGatewaysOperations.java | 6 +- .../ApplicationGatewaysOperationsImpl.java | 28 +++-- ...sRouteCircuitAuthorizationsOperations.java | 4 +- ...teCircuitAuthorizationsOperationsImpl.java | 15 ++- ...ExpressRouteCircuitPeeringsOperations.java | 4 +- ...essRouteCircuitPeeringsOperationsImpl.java | 15 ++- .../ExpressRouteCircuitsOperations.java | 12 +- .../ExpressRouteCircuitsOperationsImpl.java | 67 +++++----- ...xpressRouteServiceProvidersOperations.java | 4 +- ...ssRouteServiceProvidersOperationsImpl.java | 15 ++- .../network/LoadBalancersOperations.java | 6 +- .../network/LoadBalancersOperationsImpl.java | 30 +++-- .../LocalNetworkGatewaysOperations.java | 4 +- .../LocalNetworkGatewaysOperationsImpl.java | 15 ++- .../network/NetworkInterfacesOperations.java | 10 +- .../NetworkInterfacesOperationsImpl.java | 58 +++++---- .../network/NetworkManagementClientImpl.java | 2 +- .../NetworkSecurityGroupsOperations.java | 6 +- .../NetworkSecurityGroupsOperationsImpl.java | 30 +++-- .../network/PublicIPAddressesOperations.java | 6 +- .../PublicIPAddressesOperationsImpl.java | 30 +++-- .../network/RouteTablesOperations.java | 6 +- .../network/RouteTablesOperationsImpl.java | 30 +++-- .../management/network/RoutesOperations.java | 4 +- .../network/RoutesOperationsImpl.java | 15 ++- .../network/SecurityRulesOperations.java | 4 +- .../network/SecurityRulesOperationsImpl.java | 15 ++- .../management/network/SubnetsOperations.java | 4 +- .../network/SubnetsOperationsImpl.java | 17 +-- .../management/network/UsagesOperations.java | 4 +- .../network/UsagesOperationsImpl.java | 15 ++- ...alNetworkGatewayConnectionsOperations.java | 4 +- ...tworkGatewayConnectionsOperationsImpl.java | 19 +-- .../VirtualNetworkGatewaysOperations.java | 4 +- .../VirtualNetworkGatewaysOperationsImpl.java | 17 +-- .../network/VirtualNetworksOperations.java | 6 +- .../VirtualNetworksOperationsImpl.java | 30 +++-- .../network/models/IPConfiguration.java | 8 -- .../network/models/InboundNatRule.java | 7 -- .../network/models/NetworkInterface.java | 7 -- .../NetworkInterfaceIPConfiguration.java | 7 -- .../ClassicAdministratorsOperations.java | 4 +- .../ClassicAdministratorsOperationsImpl.java | 15 ++- .../DeploymentOperationsOperations.java | 6 +- .../DeploymentOperationsOperationsImpl.java | 30 +++-- .../resources/DeploymentsOperations.java | 6 +- .../resources/DeploymentsOperationsImpl.java | 32 ++--- .../resources/FeaturesOperations.java | 6 +- .../resources/FeaturesOperationsImpl.java | 28 +++-- .../resources/PermissionsOperations.java | 6 +- .../resources/PermissionsOperationsImpl.java | 28 +++-- .../PolicyAssignmentsOperations.java | 18 +-- .../PolicyAssignmentsOperationsImpl.java | 114 ++++++++++-------- .../ProviderOperationsMetadataOperations.java | 6 +- ...viderOperationsMetadataOperationsImpl.java | 32 ++--- .../resources/ProvidersOperations.java | 6 +- .../resources/ProvidersOperationsImpl.java | 30 +++-- .../resources/ResourceGroupsOperations.java | 10 +- .../ResourceGroupsOperationsImpl.java | 62 +++++----- ...rceProviderOperationDetailsOperations.java | 4 +- ...roviderOperationDetailsOperationsImpl.java | 15 ++- .../resources/ResourcesOperations.java | 6 +- .../resources/ResourcesOperationsImpl.java | 32 ++--- .../resources/RoleAssignmentsOperations.java | 18 +-- .../RoleAssignmentsOperationsImpl.java | 114 ++++++++++-------- .../resources/RoleDefinitionsOperations.java | 6 +- .../RoleDefinitionsOperationsImpl.java | 30 +++-- .../resources/SubscriptionsOperations.java | 6 +- .../SubscriptionsOperationsImpl.java | 28 +++-- .../management/resources/TagsOperations.java | 4 +- .../resources/TagsOperationsImpl.java | 15 ++- .../resources/TenantsOperations.java | 4 +- .../resources/TenantsOperationsImpl.java | 15 ++- .../StorageAccountsOperationsImpl.java | 2 +- .../website/DomainsOperationsImpl.java | 2 +- ...lobalDomainRegistrationOperationsImpl.java | 2 +- .../website/GlobalOperationsImpl.java | 2 +- .../HostingEnvironmentsOperationsImpl.java | 30 ++--- ...agedHostingEnvironmentsOperationsImpl.java | 4 +- .../RecommendationsOperationsImpl.java | 10 +- .../website/ServerFarmsOperations.java | 5 +- .../website/ServerFarmsOperationsImpl.java | 42 ++++--- .../website/SitesOperationsImpl.java | 72 +++++------ .../TopLevelDomainsOperationsImpl.java | 2 +- 99 files changed, 937 insertions(+), 795 deletions(-) diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperations.java index 106153dbd76bd..8ad3b371cc2a1 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperations.java @@ -15,11 +15,11 @@ import com.microsoft.azure.management.compute.models.AvailabilitySet; import com.microsoft.azure.management.compute.models.PageImpl; import com.microsoft.azure.management.compute.models.VirtualMachineSize; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -106,7 +106,7 @@ public interface AvailabilitySetsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<AvailabilitySet> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The operation to list the availability sets. @@ -128,7 +128,7 @@ public interface AvailabilitySetsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineSize> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAvailableSizes(final String resourceGroupName, final String availabilitySetName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAvailableSizes(final String resourceGroupName, final String availabilitySetName) throws CloudException, IOException, IllegalArgumentException; /** * Lists virtual-machine-sizes available to be used for an availability set. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperationsImpl.java index c744936ac1d01..8f3f89def8735 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperationsImpl.java @@ -17,6 +17,8 @@ import com.microsoft.azure.management.compute.models.AvailabilitySet; import com.microsoft.azure.management.compute.models.PageImpl; import com.microsoft.azure.management.compute.models.VirtualMachineSize; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -348,7 +350,7 @@ private ServiceResponse getDelegate(Response resp * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<AvailabilitySet> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -360,11 +362,12 @@ public ServiceResponse> list(final String resourceGroupNam } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -431,7 +434,7 @@ private ServiceResponse> listDelegate(Response> listAvailableSizes(final String resourceGroupName, final String availabilitySetName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAvailableSizes(final String resourceGroupName, final String availabilitySetName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -446,11 +449,12 @@ public ServiceResponse> listAvailableSizes(final String } Call call = service.listAvailableSizes(resourceGroupName, availabilitySetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAvailableSizesDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAvailableSizesNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAvailableSizesNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperations.java index 0f70b5c8f11d3..c0922684b33c3 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperations.java @@ -14,10 +14,10 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.compute.models.PageImpl; import com.microsoft.azure.management.compute.models.Usage; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -33,7 +33,7 @@ public interface UsageOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException; /** * Lists compute usages for a subscription. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperationsImpl.java index 401752d32f1f9..07069ba4b1834 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.compute.models.PageImpl; import com.microsoft.azure.management.compute.models.Usage; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; @@ -77,7 +79,7 @@ interface UsageService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException { if (location == null) { throw new IllegalArgumentException("Parameter location is required and cannot be null."); } @@ -89,11 +91,12 @@ public ServiceResponse> list(final String location) throws CloudExce } Call call = service.list(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperationsImpl.java index a651064ada09b..0f5b0cb808c7d 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperationsImpl.java @@ -273,9 +273,9 @@ public ServiceResponse> listVersions(String lo if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - VirtualMachineImageResource filter = null; - Integer top = null; - String orderby = null; + final VirtualMachineImageResource filter = null; + final Integer top = null; + final String orderby = null; Call call = service.listVersions(location, publisherName, type, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, orderby, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listVersionsDelegate(call.execute()); } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperationsImpl.java index a61049fd4faed..e05a91a6d85cd 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperationsImpl.java @@ -458,7 +458,7 @@ public ServiceResponse get(String resourceGroupName, St if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceGroupName, vmName, vmExtensionName, this.client.getSubscriptionId(), expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute()); } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperationsImpl.java index 8ea85b4470b18..290e47e6eb4bf 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperationsImpl.java @@ -216,9 +216,9 @@ public ServiceResponse> list(String location, if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - VirtualMachineImageResource filter = null; - Integer top = null; - String orderby = null; + final VirtualMachineImageResource filter = null; + final Integer top = null; + final String orderby = null; Call call = service.list(location, publisherName, offer, skus, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, orderby, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute()); } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperations.java index 93091c07a21c7..24ef2d388b2d2 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperations.java @@ -15,11 +15,11 @@ import com.microsoft.azure.management.compute.models.PageImpl; import com.microsoft.azure.management.compute.models.VirtualMachineScaleSetVM; import com.microsoft.azure.management.compute.models.VirtualMachineScaleSetVMInstanceView; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -239,7 +239,7 @@ public interface VirtualMachineScaleSetVMsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSetVM> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final String virtualMachineScaleSetName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final String virtualMachineScaleSetName) throws CloudException, IOException, IllegalArgumentException; /** * The operation to list virtual machine scale sets VMs. @@ -264,7 +264,7 @@ public interface VirtualMachineScaleSetVMsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSetVM> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final String virtualMachineScaleSetName, final VirtualMachineScaleSetVM filter, final String select, final String expand) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final String virtualMachineScaleSetName, final VirtualMachineScaleSetVM filter, final String select, final String expand) throws CloudException, IOException, IllegalArgumentException; /** * The operation to list virtual machine scale sets VMs. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperationsImpl.java index 4762cc9b50e33..84a5a171bf240 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperationsImpl.java @@ -17,6 +17,8 @@ import com.microsoft.azure.management.compute.models.PageImpl; import com.microsoft.azure.management.compute.models.VirtualMachineScaleSetVM; import com.microsoft.azure.management.compute.models.VirtualMachineScaleSetVMInstanceView; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -802,7 +804,7 @@ private ServiceResponse getInstanceViewDel * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSetVM> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName, final String virtualMachineScaleSetName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final String virtualMachineScaleSetName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -815,16 +817,17 @@ public ServiceResponse> list(final String resourc if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - VirtualMachineScaleSetVM filter = null; - String select = null; - String expand = null; + final VirtualMachineScaleSetVM filter = null; + final String select = null; + final String expand = null; Call call = service.list(resourceGroupName, virtualMachineScaleSetName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), select, expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -895,7 +898,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSetVM> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName, final String virtualMachineScaleSetName, final VirtualMachineScaleSetVM filter, final String select, final String expand) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final String virtualMachineScaleSetName, final VirtualMachineScaleSetVM filter, final String select, final String expand) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -911,11 +914,12 @@ public ServiceResponse> list(final String resourc Validator.validate(filter); Call call = service.list(resourceGroupName, virtualMachineScaleSetName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), select, expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperations.java index 4e59732d0dab2..9d12f33964082 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperations.java @@ -16,6 +16,7 @@ import com.microsoft.azure.management.compute.models.VirtualMachineScaleSet; import com.microsoft.azure.management.compute.models.VirtualMachineScaleSetInstanceView; import com.microsoft.azure.management.compute.models.VirtualMachineScaleSetSku; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -327,7 +328,7 @@ public interface VirtualMachineScaleSetsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSet> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The operation to list virtual machine scale sets under a resource group. @@ -347,7 +348,7 @@ public interface VirtualMachineScaleSetsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSet> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * Gets the list of Virtual Machine Scale Sets in the subscription. Use nextLink property in the response to get the next page of Virtual Machine Scale Sets. Do this till nextLink is not null to fetch all the Virtual Machine Scale Sets. @@ -368,7 +369,7 @@ public interface VirtualMachineScaleSetsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSetSku> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listSkus(final String resourceGroupName, final String vmScaleSetName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listSkus(final String resourceGroupName, final String vmScaleSetName) throws CloudException, IOException, IllegalArgumentException; /** * The operation to list available skus for a virtual machine scale set. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperationsImpl.java index 80ccb0f8091ad..b004abf450d49 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperationsImpl.java @@ -20,6 +20,8 @@ import com.microsoft.azure.management.compute.models.VirtualMachineScaleSetSku; import com.microsoft.azure.management.compute.models.VirtualMachineScaleSetVMInstanceIDs; import com.microsoft.azure.management.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -527,7 +529,7 @@ public ServiceResponse beginDeallocate(String resourceGroupName, String vm if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - List instanceIds = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; if (instanceIds != null) { vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); @@ -1164,7 +1166,7 @@ private ServiceResponse getInstanceViewDeleg * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSet> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1176,11 +1178,12 @@ public ServiceResponse> list(final String resourceG } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1245,7 +1248,7 @@ private ServiceResponse> listDelegate(Response< * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSet> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -1254,11 +1257,12 @@ public ServiceResponse> listAll() throws CloudExcep } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1320,7 +1324,7 @@ private ServiceResponse> listAllDelegate(Respon * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineScaleSetSku> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listSkus(final String resourceGroupName, final String vmScaleSetName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listSkus(final String resourceGroupName, final String vmScaleSetName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1335,11 +1339,12 @@ public ServiceResponse> listSkus(final String re } Call call = service.listSkus(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listSkusDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listSkusNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listSkusNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1585,7 +1590,7 @@ public ServiceResponse beginPowerOff(String resourceGroupName, String vmSc if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - List instanceIds = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; if (instanceIds != null) { vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); @@ -1920,7 +1925,7 @@ public ServiceResponse beginRestart(String resourceGroupName, String vmSca if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - List instanceIds = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; if (instanceIds != null) { vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); @@ -2255,7 +2260,7 @@ public ServiceResponse beginStart(String resourceGroupName, String vmScale if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - List instanceIds = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; if (instanceIds != null) { vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperations.java index 7d2a5f45382e5..f30dac060a07b 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperations.java @@ -14,10 +14,10 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.compute.models.PageImpl; import com.microsoft.azure.management.compute.models.VirtualMachineSize; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -33,7 +33,7 @@ public interface VirtualMachineSizesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineSize> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException; /** * Lists virtual-machine-sizes available in a location for a subscription. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperationsImpl.java index 6f0d22d000464..1074a4e52cbaa 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.compute.models.PageImpl; import com.microsoft.azure.management.compute.models.VirtualMachineSize; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; @@ -77,7 +79,7 @@ interface VirtualMachineSizesService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineSize> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException { if (location == null) { throw new IllegalArgumentException("Parameter location is required and cannot be null."); } @@ -89,11 +91,12 @@ public ServiceResponse> list(final String location) thr } Call call = service.list(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperations.java index 9ede9db46f2e9..13feac4e395a7 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperations.java @@ -17,11 +17,11 @@ import com.microsoft.azure.management.compute.models.VirtualMachineCaptureParameters; import com.microsoft.azure.management.compute.models.VirtualMachineCaptureResult; import com.microsoft.azure.management.compute.models.VirtualMachineSize; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -303,7 +303,7 @@ public interface VirtualMachinesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachine> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The operation to list virtual machines under a resource group. @@ -323,7 +323,7 @@ public interface VirtualMachinesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachine> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the next page of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines. @@ -344,7 +344,7 @@ public interface VirtualMachinesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineSize> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAvailableSizes(final String resourceGroupName, final String vmName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAvailableSizes(final String resourceGroupName, final String vmName) throws CloudException, IOException, IllegalArgumentException; /** * Lists virtual-machine-sizes available to be used for a virtual machine. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperationsImpl.java index b5848d3eef888..11e372a6ef280 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperationsImpl.java @@ -19,6 +19,8 @@ import com.microsoft.azure.management.compute.models.VirtualMachineCaptureParameters; import com.microsoft.azure.management.compute.models.VirtualMachineCaptureResult; import com.microsoft.azure.management.compute.models.VirtualMachineSize; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -672,7 +674,7 @@ public ServiceResponse get(String resourceGroupName, String vmNa if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceGroupName, vmName, this.client.getSubscriptionId(), expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute()); } @@ -1033,7 +1035,7 @@ private ServiceResponse generalizeDelegate(Response response * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachine> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1045,11 +1047,12 @@ public ServiceResponse> list(final String resourceGroupName } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1114,7 +1117,7 @@ private ServiceResponse> listDelegate(Response> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -1123,11 +1126,12 @@ public ServiceResponse> listAll() throws CloudException, IO } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1189,7 +1193,7 @@ private ServiceResponse> listAllDelegate(Response> listAvailableSizes(final String resourceGroupName, final String vmName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAvailableSizes(final String resourceGroupName, final String vmName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1204,11 +1208,12 @@ public ServiceResponse> listAvailableSizes(final String } Call call = service.listAvailableSizes(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAvailableSizesDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAvailableSizesNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAvailableSizesNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperations.java index 8e040c2c56f8f..517ab0cf73dfa 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.ApplicationGateway; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -155,7 +155,7 @@ public interface ApplicationGatewaysOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ApplicationGateway> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The List ApplicationGateway opertion retrieves all the applicationgateways in a resource group. @@ -175,7 +175,7 @@ public interface ApplicationGatewaysOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ApplicationGateway> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * The List applicationgateway opertion retrieves all the applicationgateways in a subscription. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperationsImpl.java index ac1490145367c..6c0be8a890aa9 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.ApplicationGateway; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -521,7 +523,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ApplicationGateway> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -533,11 +535,12 @@ public ServiceResponse> list(final String resourceGroup } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -602,7 +605,7 @@ private ServiceResponse> listDelegate(Response> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -611,11 +614,12 @@ public ServiceResponse> listAll() throws CloudException } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperations.java index 3eea40108b6db..554e09f48cb25 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.ExpressRouteCircuitAuthorization; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -166,7 +166,7 @@ public interface ExpressRouteCircuitAuthorizationsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitAuthorization> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; /** * The List authorization operation retrieves all the authorizations in an ExpressRouteCircuit. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperationsImpl.java index e03cd149beb28..f5e5323e97d2a 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.ExpressRouteCircuitAuthorization; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -540,7 +542,7 @@ private ServiceResponse beginCreateOrUpdateDel * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitAuthorization> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -555,11 +557,12 @@ public ServiceResponse> list(final String } Call call = service.list(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperations.java index d49241a442be5..2abc5f766780e 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.ExpressRouteCircuitPeering; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -166,7 +166,7 @@ public interface ExpressRouteCircuitPeeringsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitPeering> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; /** * The List peering operation retrieves all the peerings in an ExpressRouteCircuit. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperationsImpl.java index 71bae71e8ce08..13d2224b5b984 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.ExpressRouteCircuitPeering; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -540,7 +542,7 @@ private ServiceResponse beginCreateOrUpdateDelegate( * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitPeering> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -555,11 +557,12 @@ public ServiceResponse> list(final String resou } Call call = service.list(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperations.java index 54fe4e32ddf7f..83d8ecd4edf1a 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperations.java @@ -17,11 +17,11 @@ import com.microsoft.azure.management.network.models.ExpressRouteCircuitRoutesTable; import com.microsoft.azure.management.network.models.ExpressRouteCircuitStats; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -159,7 +159,7 @@ public interface ExpressRouteCircuitsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitArpTable> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listArpTable(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listArpTable(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; /** * The ListArpTable from ExpressRouteCircuit opertion retrieves the currently advertised arp table associated with the ExpressRouteCircuits in a resource group. @@ -182,7 +182,7 @@ public interface ExpressRouteCircuitsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitRoutesTable> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listRoutesTable(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listRoutesTable(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; /** * The ListRoutesTable from ExpressRouteCircuit opertion retrieves the currently advertised routes table associated with the ExpressRouteCircuits in a resource group. @@ -205,7 +205,7 @@ public interface ExpressRouteCircuitsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitStats> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listStats(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listStats(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException; /** * The Liststats ExpressRouteCircuit opertion retrieves all the stats from a ExpressRouteCircuits in a resource group. @@ -227,7 +227,7 @@ public interface ExpressRouteCircuitsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuit> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The List ExpressRouteCircuit opertion retrieves all the ExpressRouteCircuits in a resource group. @@ -247,7 +247,7 @@ public interface ExpressRouteCircuitsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuit> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * The List ExpressRouteCircuit opertion retrieves all the ExpressRouteCircuits in a subscription. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperationsImpl.java index 13d2b58609729..6ccfba5b41019 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperationsImpl.java @@ -19,6 +19,8 @@ import com.microsoft.azure.management.network.models.ExpressRouteCircuitRoutesTable; import com.microsoft.azure.management.network.models.ExpressRouteCircuitStats; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -532,7 +534,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Respons * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitArpTable> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listArpTable(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listArpTable(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -547,11 +549,12 @@ public ServiceResponse> listArpTable(final Str } Call call = service.listArpTable(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listArpTableDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listArpTableNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listArpTableNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -623,7 +626,7 @@ private ServiceResponse> listArpTableDeleg * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitRoutesTable> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listRoutesTable(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listRoutesTable(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -638,11 +641,12 @@ public ServiceResponse> listRoutesTable(fin } Call call = service.listRoutesTable(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listRoutesTableDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listRoutesTableNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listRoutesTableNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -714,7 +718,7 @@ private ServiceResponse> listRoutesTabl * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuitStats> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listStats(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listStats(final String resourceGroupName, final String circuitName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -729,11 +733,12 @@ public ServiceResponse> listStats(final String re } Call call = service.listStats(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listStatsDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listStatsNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listStatsNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -804,7 +809,7 @@ private ServiceResponse> listStatsDelegate(Re * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteCircuit> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -816,11 +821,12 @@ public ServiceResponse> list(final String resourceGrou } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -885,7 +891,7 @@ private ServiceResponse> listDelegate(Response> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -894,11 +900,12 @@ public ServiceResponse> listAll() throws CloudExceptio } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperations.java index 3de7efe199bad..30b6e9a5581b2 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperations.java @@ -14,10 +14,10 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.ExpressRouteServiceProvider; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -32,7 +32,7 @@ public interface ExpressRouteServiceProvidersOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteServiceProvider> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; /** * The List ExpressRouteServiceProvider opertion retrieves all the available ExpressRouteServiceProviders. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperationsImpl.java index b752a301e8c71..e03f124e34768 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.ExpressRouteServiceProvider; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; @@ -76,7 +78,7 @@ interface ExpressRouteServiceProvidersService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ExpressRouteServiceProvider> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -85,11 +87,12 @@ public ServiceResponse> list() throws CloudExc } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperations.java index 1512e9f9bcfdf..6e5d2d0abd0ab 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.LoadBalancer; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -178,7 +178,7 @@ public interface LoadBalancersOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<LoadBalancer> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * The List loadBalancer opertion retrieves all the loadbalancers in a subscription. @@ -198,7 +198,7 @@ public interface LoadBalancersOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<LoadBalancer> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The List loadBalancer opertion retrieves all the loadbalancers in a resource group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperationsImpl.java index 23fc40402132e..20e130be98617 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.LoadBalancer; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -272,7 +274,7 @@ public ServiceResponse get(String resourceGroupName, String loadBa if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceGroupName, loadBalancerName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute()); } @@ -578,7 +580,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -587,11 +589,12 @@ public ServiceResponse> listAll() throws CloudException, IOEx } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -652,7 +655,7 @@ private ServiceResponse> listAllDelegate(Response> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -664,11 +667,12 @@ public ServiceResponse> list(final String resourceGroupName) } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperations.java index 9e16ffbbcaf14..21953d733644d 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.LocalNetworkGateway; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -155,7 +155,7 @@ public interface LocalNetworkGatewaysOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<LocalNetworkGateway> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The List LocalNetworkGateways opertion retrieves all the local network gateways stored. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperationsImpl.java index 074f4d18fc3d3..bdf545e8b93c2 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.LocalNetworkGateway; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -496,7 +498,7 @@ private ServiceResponse beginDeleteDelegate(Response respons * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<LocalNetworkGateway> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -508,11 +510,12 @@ public ServiceResponse> list(final String resourceGrou } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperations.java index 303ceb01218b8..9326b974e73ba 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.NetworkInterface; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -181,7 +181,7 @@ public interface NetworkInterfacesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkInterface> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfaces(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfaces(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex) throws CloudException, IOException, IllegalArgumentException; /** * The list network interface operation retrieves information about all network interfaces in a virtual machine from a virtual machine scale set. @@ -205,7 +205,7 @@ public interface NetworkInterfacesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkInterface> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listVirtualMachineScaleSetNetworkInterfaces(final String resourceGroupName, final String virtualMachineScaleSetName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listVirtualMachineScaleSetNetworkInterfaces(final String resourceGroupName, final String virtualMachineScaleSetName) throws CloudException, IOException, IllegalArgumentException; /** * The list network interface operation retrieves information about all network interfaces in a virtual machine scale set. @@ -281,7 +281,7 @@ public interface NetworkInterfacesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkInterface> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * The List networkInterfaces opertion retrieves all the networkInterfaces in a subscription. @@ -301,7 +301,7 @@ public interface NetworkInterfacesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkInterface> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The List networkInterfaces opertion retrieves all the networkInterfaces in a resource group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperationsImpl.java index 056ea51620b61..7ab2070638765 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.NetworkInterface; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -292,7 +294,7 @@ public ServiceResponse get(String resourceGroupName, String ne if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceGroupName, networkInterfaceName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute()); } @@ -601,7 +603,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response> listVirtualMachineScaleSetVMNetworkInterfaces(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfaces(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -619,11 +621,12 @@ public ServiceResponse> listVirtualMachineScaleSetVMNetwo } Call call = service.listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listVirtualMachineScaleSetVMNetworkInterfacesDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listVirtualMachineScaleSetVMNetworkInterfacesNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -700,7 +703,7 @@ private ServiceResponse> listVirtualMachineScaleSetVM * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkInterface> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listVirtualMachineScaleSetNetworkInterfaces(final String resourceGroupName, final String virtualMachineScaleSetName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listVirtualMachineScaleSetNetworkInterfaces(final String resourceGroupName, final String virtualMachineScaleSetName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -715,11 +718,12 @@ public ServiceResponse> listVirtualMachineScaleSetNetwork } Call call = service.listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listVirtualMachineScaleSetNetworkInterfacesDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listVirtualMachineScaleSetNetworkInterfacesNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -812,7 +816,7 @@ public ServiceResponse getVirtualMachineScaleSetNetworkInterfa if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.getVirtualMachineScaleSetNetworkInterface(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getVirtualMachineScaleSetNetworkInterfaceDelegate(call.execute()); } @@ -978,7 +982,7 @@ private ServiceResponse getVirtualMachineScaleSetNetworkInterf * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkInterface> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -987,11 +991,12 @@ public ServiceResponse> listAll() throws CloudException, } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1052,7 +1057,7 @@ private ServiceResponse> listAllDelegate(Response> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1064,11 +1069,12 @@ public ServiceResponse> list(final String resourceGroupNa } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClientImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClientImpl.java index a4aefe76b825c..5662161841434 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClientImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClientImpl.java @@ -418,7 +418,7 @@ public ServiceResponse checkDnsNameAvailability(Strin if (this.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null."); } - String domainNameLabel = null; + final String domainNameLabel = null; Call call = service.checkDnsNameAvailability(location, this.getSubscriptionId(), domainNameLabel, this.getApiVersion(), this.getAcceptLanguage()); return checkDnsNameAvailabilityDelegate(call.execute()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperations.java index ad17a1572f183..9b9b0fb07725d 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.NetworkSecurityGroup; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -178,7 +178,7 @@ public interface NetworkSecurityGroupsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkSecurityGroup> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * The list NetworkSecurityGroups returns all network security groups in a subscription. @@ -198,7 +198,7 @@ public interface NetworkSecurityGroupsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkSecurityGroup> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The list NetworkSecurityGroups returns all network security groups in a resource group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperationsImpl.java index 4cda64d7eeb1c..d423a746bf0bf 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.NetworkSecurityGroup; import com.microsoft.azure.management.network.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -272,7 +274,7 @@ public ServiceResponse get(String resourceGroupName, Strin if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceGroupName, networkSecurityGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute()); } @@ -578,7 +580,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Respon * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkSecurityGroup> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -587,11 +589,12 @@ public ServiceResponse> listAll() throws CloudExcepti } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -652,7 +655,7 @@ private ServiceResponse> listAllDelegate(Response * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<NetworkSecurityGroup> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -664,11 +667,12 @@ public ServiceResponse> list(final String resourceGro } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperations.java index 19fe0f4e621f2..78756687efa1a 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.PublicIPAddress; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -178,7 +178,7 @@ public interface PublicIPAddressesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PublicIPAddress> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * The List publicIpAddress opertion retrieves all the publicIpAddresses in a subscription. @@ -198,7 +198,7 @@ public interface PublicIPAddressesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PublicIPAddress> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The List publicIpAddress opertion retrieves all the publicIpAddresses in a resource group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperationsImpl.java index 9ae3d9be13702..48ceb3cd492d9 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.PublicIPAddress; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -272,7 +274,7 @@ public ServiceResponse get(String resourceGroupName, String pub if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceGroupName, publicIpAddressName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute()); } @@ -578,7 +580,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -587,11 +589,12 @@ public ServiceResponse> listAll() throws CloudException, I } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -652,7 +655,7 @@ private ServiceResponse> listAllDelegate(Response> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -664,11 +667,12 @@ public ServiceResponse> list(final String resourceGroupNam } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperations.java index dc3bc004620b3..e59db22825140 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.RouteTable; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -179,7 +179,7 @@ public interface RouteTablesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RouteTable> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The list RouteTables returns all route tables in a resource group. @@ -199,7 +199,7 @@ public interface RouteTablesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RouteTable> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * The list RouteTables returns all route tables in a subscription. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperationsImpl.java index 3c4351324fe42..56d3745810629 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.RouteTable; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -272,7 +274,7 @@ public ServiceResponse get(String resourceGroupName, String routeTab if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceGroupName, routeTableName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute()); } @@ -579,7 +581,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -591,11 +593,12 @@ public ServiceResponse> list(final String resourceGroupName) th } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -660,7 +663,7 @@ private ServiceResponse> listDelegate(Response> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -669,11 +672,12 @@ public ServiceResponse> listAll() throws CloudException, IOExce } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperations.java index d795ac3d50abf..faf9809bc8c0b 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.Route; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -166,7 +166,7 @@ public interface RoutesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Route> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final String routeTableName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final String routeTableName) throws CloudException, IOException, IllegalArgumentException; /** * The List network security rule opertion retrieves all the routes in a route table. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperationsImpl.java index d2c7e94bb9369..a08806feed752 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.Route; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -540,7 +542,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response> list(final String resourceGroupName, final String routeTableName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final String routeTableName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -555,11 +557,12 @@ public ServiceResponse> list(final String resourceGroupName, final S } Call call = service.list(resourceGroupName, routeTableName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperations.java index f1bee5209a668..1bd5a2466e5cf 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.SecurityRule; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -166,7 +166,7 @@ public interface SecurityRulesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<SecurityRule> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final String networkSecurityGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final String networkSecurityGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The List network security rule opertion retrieves all the security rules in a network security group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperationsImpl.java index 8ded5252bef61..5ce99eecedae5 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.SecurityRule; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -540,7 +542,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response> list(final String resourceGroupName, final String networkSecurityGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final String networkSecurityGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -555,11 +557,12 @@ public ServiceResponse> list(final String resourceGroupName, } Call call = service.list(resourceGroupName, networkSecurityGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperations.java index 2d758ece3f3fe..32899f24053aa 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.Subnet; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -192,7 +192,7 @@ public interface SubnetsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Subnet> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final String virtualNetworkName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final String virtualNetworkName) throws CloudException, IOException, IllegalArgumentException; /** * The List subnets opertion retrieves all the subnets in a virtual network. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperationsImpl.java index 0fbb54bb9b778..03709ae0b5988 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.Subnet; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -285,7 +287,7 @@ public ServiceResponse get(String resourceGroupName, String virtualNetwo if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceGroupName, virtualNetworkName, subnetName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute()); } @@ -624,7 +626,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response> list(final String resourceGroupName, final String virtualNetworkName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final String virtualNetworkName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -639,11 +641,12 @@ public ServiceResponse> list(final String resourceGroupName, final } Call call = service.list(resourceGroupName, virtualNetworkName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperations.java index 145b3e86c154d..6709cfbe159bf 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperations.java @@ -14,10 +14,10 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.Usage; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -33,7 +33,7 @@ public interface UsagesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException; /** * Lists compute usages for a subscription. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperationsImpl.java index f28b8b91c4724..bbb997c71c73e 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.Usage; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; @@ -77,7 +79,7 @@ interface UsagesService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Usage> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String location) throws CloudException, IOException, IllegalArgumentException { if (location == null) { throw new IllegalArgumentException("Parameter location is required and cannot be null."); } @@ -89,11 +91,12 @@ public ServiceResponse> list(final String location) throws CloudExce } Call call = service.list(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperations.java index 56925ec10d529..6ae3075d09a95 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperations.java @@ -17,11 +17,11 @@ import com.microsoft.azure.management.network.models.ConnectionSharedKeyResult; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.VirtualNetworkGatewayConnection; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -181,7 +181,7 @@ public interface VirtualNetworkGatewayConnectionsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualNetworkGatewayConnection> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections created. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperationsImpl.java index 4ac5594fcd238..c746362a230f3 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperationsImpl.java @@ -19,6 +19,8 @@ import com.microsoft.azure.management.network.models.ConnectionSharedKeyResult; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.VirtualNetworkGatewayConnection; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -598,7 +600,7 @@ private ServiceResponse getSharedKeyDelegate(Response * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualNetworkGatewayConnection> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -610,11 +612,12 @@ public ServiceResponse> list(final String } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -841,7 +844,7 @@ public ServiceResponse beginResetSharedKey(String reso if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Long keyLength = null; + final Long keyLength = null; ConnectionResetSharedKey parameters = new ConnectionResetSharedKey(); parameters.setKeyLength(keyLength); Call call = service.beginResetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage(), parameters); @@ -1150,7 +1153,7 @@ public ServiceResponse beginSetSharedKey(String resourceGro if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String value = null; + final String value = null; ConnectionSharedKey parameters = new ConnectionSharedKey(); parameters.setValue(value); Call call = service.beginSetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage(), parameters); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperations.java index 2673b0c519154..399e53a90eeac 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.VirtualNetworkGateway; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -155,7 +155,7 @@ public interface VirtualNetworkGatewaysOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualNetworkGateway> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The List VirtualNetworkGateways opertion retrieves all the virtual network gateways stored. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperationsImpl.java index 61bcc7b38d895..6475589118879 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperationsImpl.java @@ -17,6 +17,8 @@ import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.VirtualNetworkGateway; import com.microsoft.azure.management.network.models.VpnClientParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -510,7 +512,7 @@ private ServiceResponse beginDeleteDelegate(Response respons * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualNetworkGateway> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -522,11 +524,12 @@ public ServiceResponse> list(final String resourceGr } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -774,7 +777,7 @@ public ServiceResponse generatevpnclientpackage(String resourceGroupName if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String processorArchitecture = null; + final String processorArchitecture = null; VpnClientParameters parameters = new VpnClientParameters(); parameters.setProcessorArchitecture(processorArchitecture); Call call = service.generatevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage(), parameters); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperations.java index 9becddde3758f..13ba92df4e9a3 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.VirtualNetwork; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -178,7 +178,7 @@ public interface VirtualNetworksOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualNetwork> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * The list VirtualNetwork returns all Virtual Networks in a subscription. @@ -198,7 +198,7 @@ public interface VirtualNetworksOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualNetwork> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * The list VirtualNetwork returns all Virtual Networks in a resource group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperationsImpl.java index 218df96b05aee..18a54c2f52143 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.models.PageImpl; import com.microsoft.azure.management.network.models.VirtualNetwork; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -272,7 +274,7 @@ public ServiceResponse get(String resourceGroupName, String virt if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceGroupName, virtualNetworkName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute()); } @@ -578,7 +580,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -587,11 +589,12 @@ public ServiceResponse> listAll() throws CloudException, IO } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -652,7 +655,7 @@ private ServiceResponse> listAllDelegate(Response> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -664,11 +667,12 @@ public ServiceResponse> list(final String resourceGroupName } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/IPConfiguration.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/IPConfiguration.java index 00d6f78927f83..372bccb0edf84 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/IPConfiguration.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/IPConfiguration.java @@ -62,14 +62,6 @@ public class IPConfiguration extends SubResource { */ private String etag; - /** - * Creates an instance of IPConfiguration class. - */ - public IPConfiguration() { - subnet = new Subnet(); - publicIPAddress = new PublicIPAddress(); - } - /** * Get the privateIPAddress value. * diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/InboundNatRule.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/InboundNatRule.java index 8db670f6aad34..46eef5b6ced3d 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/InboundNatRule.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/InboundNatRule.java @@ -97,13 +97,6 @@ public class InboundNatRule extends SubResource { */ private String etag; - /** - * Creates an instance of InboundNatRule class. - */ - public InboundNatRule() { - backendIPConfiguration = new NetworkInterfaceIPConfiguration(); - } - /** * Get the frontendIPConfiguration value. * diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/NetworkInterface.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/NetworkInterface.java index ba3eea31a0086..29038d8877938 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/NetworkInterface.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/NetworkInterface.java @@ -82,13 +82,6 @@ public class NetworkInterface extends Resource { */ private String etag; - /** - * Creates an instance of NetworkInterface class. - */ - public NetworkInterface() { - networkSecurityGroup = new NetworkSecurityGroup(); - } - /** * Get the virtualMachine value. * diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/NetworkInterfaceIPConfiguration.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/NetworkInterfaceIPConfiguration.java index 238e12af32a71..4118426357a92 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/NetworkInterfaceIPConfiguration.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/models/NetworkInterfaceIPConfiguration.java @@ -74,13 +74,6 @@ public class NetworkInterfaceIPConfiguration extends SubResource { */ private String etag; - /** - * Creates an instance of NetworkInterfaceIPConfiguration class. - */ - public NetworkInterfaceIPConfiguration() { - subnet = new Subnet(); - } - /** * Get the loadBalancerBackendAddressPools value. * diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ClassicAdministratorsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ClassicAdministratorsOperations.java index 1ed2887fea53c..e9580d1191552 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ClassicAdministratorsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ClassicAdministratorsOperations.java @@ -14,10 +14,10 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.ClassicAdministrator; import com.microsoft.azure.management.resources.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -33,7 +33,7 @@ public interface ClassicAdministratorsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ClassicAdministrator> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String apiVersion) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String apiVersion) throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of classic administrators for the subscription. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ClassicAdministratorsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ClassicAdministratorsOperationsImpl.java index f964d9cfb1a64..a6ec7c5bf3c0d 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ClassicAdministratorsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ClassicAdministratorsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.ClassicAdministrator; import com.microsoft.azure.management.resources.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; @@ -77,7 +79,7 @@ interface ClassicAdministratorsService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ClassicAdministrator> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String apiVersion) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String apiVersion) throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -86,11 +88,12 @@ public ServiceResponse> list(final String apiVersion) } Call call = service.list(this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperations.java index 55ee1c9356327..661d0e78cb732 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.DeploymentOperation; import com.microsoft.azure.management.resources.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -60,7 +60,7 @@ public interface DeploymentOperationsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<DeploymentOperation> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final String deploymentName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final String deploymentName) throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of deployments operations. @@ -83,7 +83,7 @@ public interface DeploymentOperationsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<DeploymentOperation> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final String deploymentName, final Integer top) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final String deploymentName, final Integer top) throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of deployments operations. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperationsImpl.java index 534fcb1251881..de1271d4d700b 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.DeploymentOperation; import com.microsoft.azure.management.resources.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -170,7 +172,7 @@ private ServiceResponse getDelegate(Response * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<DeploymentOperation> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName, final String deploymentName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final String deploymentName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -183,14 +185,15 @@ public ServiceResponse> list(final String resourceGrou if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Integer top = null; + final Integer top = null; Call call = service.list(resourceGroupName, deploymentName, this.client.getSubscriptionId(), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -257,7 +260,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<DeploymentOperation> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName, final String deploymentName, final Integer top) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final String deploymentName, final Integer top) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -272,11 +275,12 @@ public ServiceResponse> list(final String resourceGrou } Call call = service.list(resourceGroupName, deploymentName, this.client.getSubscriptionId(), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperations.java index de7765e04b760..de0d550233e5e 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperations.java @@ -17,11 +17,11 @@ import com.microsoft.azure.management.resources.models.DeploymentExtendedFilter; import com.microsoft.azure.management.resources.models.DeploymentValidateResult; import com.microsoft.azure.management.resources.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -229,7 +229,7 @@ public interface DeploymentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<DeploymentExtended> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * Get a list of deployments. @@ -251,7 +251,7 @@ public interface DeploymentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<DeploymentExtended> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceGroupName, final DeploymentExtendedFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceGroupName, final DeploymentExtendedFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException; /** * Get a list of deployments. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperationsImpl.java index d0f2897fca2a3..2815a44ab28b1 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperationsImpl.java @@ -19,6 +19,8 @@ import com.microsoft.azure.management.resources.models.DeploymentExtendedFilter; import com.microsoft.azure.management.resources.models.DeploymentValidateResult; import com.microsoft.azure.management.resources.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -759,7 +761,7 @@ private ServiceResponse validateDelegate(Response> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -769,15 +771,16 @@ public ServiceResponse> list(final String resourceGroup if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - DeploymentExtendedFilter filter = null; - Integer top = null; + final DeploymentExtendedFilter filter = null; + final Integer top = null; Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -840,7 +843,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<DeploymentExtended> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceGroupName, final DeploymentExtendedFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceGroupName, final DeploymentExtendedFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -853,11 +856,12 @@ public ServiceResponse> list(final String resourceGroup Validator.validate(filter); Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/FeaturesOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/FeaturesOperations.java index 718badcd4f2fa..ed04cdcbec43b 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/FeaturesOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/FeaturesOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.FeatureResult; import com.microsoft.azure.management.resources.models.PageImpl; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -33,7 +33,7 @@ public interface FeaturesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<FeatureResult> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of previewed features for all the providers in the current subscription. @@ -53,7 +53,7 @@ public interface FeaturesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<FeatureResult> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceProviderNamespace) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceProviderNamespace) throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of previewed features of a resource provider. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/FeaturesOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/FeaturesOperationsImpl.java index 1d33264dc64f6..62ab2dc22d635 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/FeaturesOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/FeaturesOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.FeatureResult; import com.microsoft.azure.management.resources.models.PageImpl; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -94,7 +96,7 @@ interface FeaturesService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<FeatureResult> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listAll() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -103,11 +105,12 @@ public ServiceResponse> listAll() throws CloudException, IOE } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listAllDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listAllNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listAllNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -168,7 +171,7 @@ private ServiceResponse> listAllDelegate(Response> list(final String resourceProviderNamespace) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceProviderNamespace) throws CloudException, IOException, IllegalArgumentException { if (resourceProviderNamespace == null) { throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } @@ -180,11 +183,12 @@ public ServiceResponse> list(final String resourceProviderNa } Call call = service.list(resourceProviderNamespace, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PermissionsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PermissionsOperations.java index 93aea3866c41e..83a3a2436593d 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PermissionsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PermissionsOperations.java @@ -14,10 +14,10 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.Permission; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -33,7 +33,7 @@ public interface PermissionsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Permission> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * Gets a resource group permissions. @@ -58,7 +58,7 @@ public interface PermissionsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Permission> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException; /** * Gets a resource permissions. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PermissionsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PermissionsOperationsImpl.java index 7799ade7a2732..81bb2a3c7f548 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PermissionsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PermissionsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.Permission; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; @@ -85,7 +87,7 @@ interface PermissionsService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Permission> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -97,11 +99,12 @@ public ServiceResponse> listForResourceGroup(final String resou } Call call = service.listForResourceGroup(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceGroupDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceGroupNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceGroupNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -171,7 +174,7 @@ private ServiceResponse> listForResourceGroupDelegate(Respo * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Permission> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -195,11 +198,12 @@ public ServiceResponse> listForResource(final String resourceGr } Call call = service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperations.java index a40dd69c77221..90eb425a1cbd8 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.PolicyAssignment; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -38,7 +38,7 @@ public interface PolicyAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException; /** * Gets policy assignments of the resource. @@ -67,7 +67,7 @@ public interface PolicyAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) throws CloudException, IOException, IllegalArgumentException; /** * Gets policy assignments of the resource. @@ -93,7 +93,7 @@ public interface PolicyAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * Gets policy assignments of the resource group. @@ -114,7 +114,7 @@ public interface PolicyAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResourceGroup(final String resourceGroupName, final String filter) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResourceGroup(final String resourceGroupName, final String filter) throws CloudException, IOException, IllegalArgumentException; /** * Gets policy assignments of the resource group. @@ -271,7 +271,7 @@ public interface PolicyAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; /** * Gets policy assignments of the subscription. @@ -290,7 +290,7 @@ public interface PolicyAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String filter) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String filter) throws CloudException, IOException, IllegalArgumentException; /** * Gets policy assignments of the subscription. @@ -311,7 +311,7 @@ public interface PolicyAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForScope(final String scope) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForScope(final String scope) throws CloudException, IOException, IllegalArgumentException; /** * Gets policy assignments of the scope. @@ -332,7 +332,7 @@ public interface PolicyAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForScope(final String scope, final String filter) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForScope(final String scope, final String filter) throws CloudException, IOException, IllegalArgumentException; /** * Gets policy assignments of the scope. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperationsImpl.java index ce6e04ed4abfb..ab02750071cfa 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.PolicyAssignment; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -134,7 +136,7 @@ interface PolicyAssignmentsService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -156,14 +158,15 @@ public ServiceResponse> listForResource(final String reso if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String filter = null; + final String filter = null; Call call = service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -248,7 +251,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -272,11 +275,12 @@ public ServiceResponse> listForResource(final String reso } Call call = service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -363,7 +367,7 @@ private ServiceResponse> listForResourceDelegate(Resp * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -373,14 +377,15 @@ public ServiceResponse> listForResourceGroup(final String if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String filter = null; + final String filter = null; Call call = service.listForResourceGroup(resourceGroupName, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceGroupDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceGroupNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceGroupNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -441,7 +446,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResourceGroup(final String resourceGroupName, final String filter) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResourceGroup(final String resourceGroupName, final String filter) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -453,11 +458,12 @@ public ServiceResponse> listForResourceGroup(final String } Call call = service.listForResourceGroup(resourceGroupName, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceGroupDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceGroupNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceGroupNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -986,21 +992,22 @@ private ServiceResponse getByIdDelegate(Response * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String filter = null; + final String filter = null; Call call = service.list(this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1055,7 +1062,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String filter) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String filter) throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -1064,11 +1071,12 @@ public ServiceResponse> list(final String filter) throws } Call call = service.list(this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1130,7 +1138,7 @@ private ServiceResponse> listDelegate(Response> listForScope(final String scope) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForScope(final String scope) throws CloudException, IOException, IllegalArgumentException { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } @@ -1140,14 +1148,15 @@ public ServiceResponse> listForScope(final String scope) if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String filter = null; + final String filter = null; Call call = service.listForScope(scope, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForScopeDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForScopeNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForScopeNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1208,7 +1217,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<PolicyAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForScope(final String scope, final String filter) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForScope(final String scope, final String filter) throws CloudException, IOException, IllegalArgumentException { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } @@ -1220,11 +1229,12 @@ public ServiceResponse> listForScope(final String scope, } Call call = service.listForScope(scope, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForScopeDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForScopeNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForScopeNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProviderOperationsMetadataOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProviderOperationsMetadataOperations.java index ebed7f69acdeb..a13f3b9b70a8c 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProviderOperationsMetadataOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProviderOperationsMetadataOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.ProviderOperationsMetadata; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -81,7 +81,7 @@ public interface ProviderOperationsMetadataOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ProviderOperationsMetadata> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String apiVersion) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String apiVersion) throws CloudException, IOException, IllegalArgumentException; /** * Gets provider operations metadata list. @@ -102,7 +102,7 @@ public interface ProviderOperationsMetadataOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ProviderOperationsMetadata> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String apiVersion, final String expand) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String apiVersion, final String expand) throws CloudException, IOException, IllegalArgumentException; /** * Gets provider operations metadata list. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProviderOperationsMetadataOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProviderOperationsMetadataOperationsImpl.java index 6a7f5448ea395..1d90522c71613 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProviderOperationsMetadataOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProviderOperationsMetadataOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.ProviderOperationsMetadata; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -90,7 +92,7 @@ public ServiceResponse get(String resourceProviderNa if (apiVersion == null) { throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.get(resourceProviderNamespace, apiVersion, expand, this.client.getAcceptLanguage()); return getDelegate(call.execute()); } @@ -207,18 +209,19 @@ private ServiceResponse getDelegate(Response> list(final String apiVersion) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String apiVersion) throws CloudException, IOException, IllegalArgumentException { if (apiVersion == null) { throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); } - String expand = null; + final String expand = null; Call call = service.list(apiVersion, expand, this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -271,17 +274,18 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ProviderOperationsMetadata> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String apiVersion, final String expand) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String apiVersion, final String expand) throws CloudException, IOException, IllegalArgumentException { if (apiVersion == null) { throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); } Call call = service.list(apiVersion, expand, this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperations.java index 6b784b333af6e..8d5d3b8a5030c 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperations.java @@ -14,11 +14,11 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.Provider; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -75,7 +75,7 @@ public interface ProvidersOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Provider> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of resource providers. @@ -94,7 +94,7 @@ public interface ProvidersOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Provider> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final Integer top) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final Integer top) throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of resource providers. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperationsImpl.java index 7d6d71651c09c..81d6276ac4f67 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.Provider; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -228,21 +230,22 @@ private ServiceResponse registerDelegate(Response respon * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Provider> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Integer top = null; + final Integer top = null; Call call = service.list(this.client.getSubscriptionId(), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -297,7 +300,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Provider> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final Integer top) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final Integer top) throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -306,11 +309,12 @@ public ServiceResponse> list(final Integer top) throws CloudExcep } Call call = service.list(this.client.getSubscriptionId(), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperations.java index f90d1e223d195..ec056fc185715 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperations.java @@ -17,11 +17,11 @@ import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.ResourceGroup; import com.microsoft.azure.management.resources.models.ResourceGroupFilter; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -37,7 +37,7 @@ public interface ResourceGroupsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<GenericResource> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listResources(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listResources(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * Get all of the resources under a subscription. @@ -59,7 +59,7 @@ public interface ResourceGroupsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<GenericResource> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listResources(final String resourceGroupName, final GenericResourceFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listResources(final String resourceGroupName, final GenericResourceFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException; /** * Get all of the resources under a subscription. @@ -212,7 +212,7 @@ public interface ResourceGroupsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ResourceGroup> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; /** * Gets a collection of resource groups. @@ -232,7 +232,7 @@ public interface ResourceGroupsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ResourceGroup> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final ResourceGroupFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final ResourceGroupFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException; /** * Gets a collection of resource groups. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperationsImpl.java index b37cc23e89e82..0f66cd96a8a6a 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperationsImpl.java @@ -19,6 +19,8 @@ import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.ResourceGroup; import com.microsoft.azure.management.resources.models.ResourceGroupFilter; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -121,7 +123,7 @@ interface ResourceGroupsService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<GenericResource> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listResources(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listResources(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -131,15 +133,16 @@ public ServiceResponse> listResources(final String resourc if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - GenericResourceFilter filter = null; - Integer top = null; + final GenericResourceFilter filter = null; + final Integer top = null; Call call = service.listResources(resourceGroupName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listResourcesDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listResourcesNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listResourcesNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -202,7 +205,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<GenericResource> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listResources(final String resourceGroupName, final GenericResourceFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listResources(final String resourceGroupName, final GenericResourceFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -215,11 +218,12 @@ public ServiceResponse> listResources(final String resourc Validator.validate(filter); Call call = service.listResources(resourceGroupName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listResourcesDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listResourcesNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listResourcesNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -716,22 +720,23 @@ private ServiceResponse patchDelegate(Response resp * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ResourceGroup> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - ResourceGroupFilter filter = null; - Integer top = null; + final ResourceGroupFilter filter = null; + final Integer top = null; Call call = service.list(this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -788,7 +793,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ResourceGroup> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final ResourceGroupFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final ResourceGroupFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -798,11 +803,12 @@ public ServiceResponse> list(final ResourceGroupFilter filte Validator.validate(filter); Call call = service.list(this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperations.java index 3e5c8992bd44a..b8b127600e835 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperations.java @@ -14,10 +14,10 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.ResourceProviderOperationDefinition; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -34,7 +34,7 @@ public interface ResourceProviderOperationDetailsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ResourceProviderOperationDefinition> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String resourceProviderNamespace, final String apiVersion) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String resourceProviderNamespace, final String apiVersion) throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of resource providers. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperationsImpl.java index 825760a064aa4..05bedd9b81e8e 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.ResourceProviderOperationDefinition; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; @@ -78,7 +80,7 @@ interface ResourceProviderOperationDetailsService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<ResourceProviderOperationDefinition> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String resourceProviderNamespace, final String apiVersion) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String resourceProviderNamespace, final String apiVersion) throws CloudException, IOException, IllegalArgumentException { if (resourceProviderNamespace == null) { throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } @@ -90,11 +92,12 @@ public ServiceResponse> list(final Str } Call call = service.list(resourceProviderNamespace, this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperations.java index 7583c6ec78605..3d72b12dd7dc4 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperations.java @@ -16,11 +16,11 @@ import com.microsoft.azure.management.resources.models.GenericResourceFilter; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.ResourcesMoveInfo; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -82,7 +82,7 @@ public interface ResourcesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<GenericResource> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; /** * Get all of the resources under a subscription. @@ -102,7 +102,7 @@ public interface ResourcesOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<GenericResource> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final GenericResourceFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final GenericResourceFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException; /** * Get all of the resources under a subscription. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperationsImpl.java index 250d968c524a0..490f17e2bc271 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperationsImpl.java @@ -18,6 +18,8 @@ import com.microsoft.azure.management.resources.models.GenericResourceFilter; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.ResourcesMoveInfo; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -261,22 +263,23 @@ private ServiceResponse beginMoveResourcesDelegate(Response * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<GenericResource> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - GenericResourceFilter filter = null; - Integer top = null; + final GenericResourceFilter filter = null; + final Integer top = null; Call call = service.list(this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -333,7 +336,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<GenericResource> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final GenericResourceFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final GenericResourceFilter filter, final Integer top) throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -343,11 +346,12 @@ public ServiceResponse> list(final GenericResourceFilter f Validator.validate(filter); Call call = service.list(this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleAssignmentsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleAssignmentsOperations.java index d6b60707aef18..d6d34a0f9b261 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleAssignmentsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleAssignmentsOperations.java @@ -16,11 +16,11 @@ import com.microsoft.azure.management.resources.models.RoleAssignment; import com.microsoft.azure.management.resources.models.RoleAssignmentCreateParameters; import com.microsoft.azure.management.resources.models.RoleAssignmentFilter; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -40,7 +40,7 @@ public interface RoleAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException; /** * Gets role assignments of the resource. @@ -69,7 +69,7 @@ public interface RoleAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException; /** * Gets role assignments of the resource. @@ -95,7 +95,7 @@ public interface RoleAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException; /** * Gets role assignments of the resource group. @@ -116,7 +116,7 @@ public interface RoleAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForResourceGroup(final String resourceGroupName, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForResourceGroup(final String resourceGroupName, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException; /** * Gets role assignments of the resource group. @@ -273,7 +273,7 @@ public interface RoleAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; /** * Gets role assignments of the subscription. @@ -292,7 +292,7 @@ public interface RoleAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException; /** * Gets role assignments of the subscription. @@ -313,7 +313,7 @@ public interface RoleAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForScope(final String scope) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForScope(final String scope) throws CloudException, IOException, IllegalArgumentException; /** * Gets role assignments of the scope. @@ -334,7 +334,7 @@ public interface RoleAssignmentsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listForScope(final String scope, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listForScope(final String scope, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException; /** * Gets role assignments of the scope. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleAssignmentsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleAssignmentsOperationsImpl.java index 9190b50f36294..a0e188ce4f858 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleAssignmentsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleAssignmentsOperationsImpl.java @@ -18,6 +18,8 @@ import com.microsoft.azure.management.resources.models.RoleAssignment; import com.microsoft.azure.management.resources.models.RoleAssignmentCreateParameters; import com.microsoft.azure.management.resources.models.RoleAssignmentFilter; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -136,7 +138,7 @@ interface RoleAssignmentsService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -158,14 +160,15 @@ public ServiceResponse> listForResource(final String resour if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - RoleAssignmentFilter filter = null; + final RoleAssignmentFilter filter = null; Call call = service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -250,7 +253,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -275,11 +278,12 @@ public ServiceResponse> listForResource(final String resour Validator.validate(filter); Call call = service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -367,7 +371,7 @@ private ServiceResponse> listForResourceDelegate(Respon * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResourceGroup(final String resourceGroupName) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -377,14 +381,15 @@ public ServiceResponse> listForResourceGroup(final String r if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - RoleAssignmentFilter filter = null; + final RoleAssignmentFilter filter = null; Call call = service.listForResourceGroup(resourceGroupName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceGroupDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceGroupNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceGroupNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -445,7 +450,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForResourceGroup(final String resourceGroupName, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForResourceGroup(final String resourceGroupName, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -458,11 +463,12 @@ public ServiceResponse> listForResourceGroup(final String r Validator.validate(filter); Call call = service.listForResourceGroup(resourceGroupName, this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForResourceGroupDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForResourceGroupNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForResourceGroupNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -950,21 +956,22 @@ private ServiceResponse getByIdDelegate(Response r * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - RoleAssignmentFilter filter = null; + final RoleAssignmentFilter filter = null; Call call = service.list(this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1019,7 +1026,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -1029,11 +1036,12 @@ public ServiceResponse> list(final RoleAssignmentFilter fil Validator.validate(filter); Call call = service.list(this.client.getSubscriptionId(), this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1096,21 +1104,22 @@ private ServiceResponse> listDelegate(Response> listForScope(final String scope) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForScope(final String scope) throws CloudException, IOException, IllegalArgumentException { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - RoleAssignmentFilter filter = null; + final RoleAssignmentFilter filter = null; Call call = service.listForScope(scope, this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForScopeDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForScopeNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForScopeNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1167,7 +1176,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleAssignment> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listForScope(final String scope, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listForScope(final String scope, final RoleAssignmentFilter filter) throws CloudException, IOException, IllegalArgumentException { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } @@ -1177,11 +1186,12 @@ public ServiceResponse> listForScope(final String scope, fi Validator.validate(filter); Call call = service.listForScope(scope, this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listForScopeDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listForScopeNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listForScopeNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleDefinitionsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleDefinitionsOperations.java index 13612d8b96257..1ef9c732bd2ad 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleDefinitionsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleDefinitionsOperations.java @@ -15,11 +15,11 @@ import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.RoleDefinition; import com.microsoft.azure.management.resources.models.RoleDefinitionFilter; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -127,7 +127,7 @@ public interface RoleDefinitionsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleDefinition> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String scope) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String scope) throws CloudException, IOException, IllegalArgumentException; /** * Get all role definitions that are applicable at scope and above. Use atScopeAndBelow filter to search below the given scope as well. @@ -148,7 +148,7 @@ public interface RoleDefinitionsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleDefinition> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list(final String scope, final RoleDefinitionFilter filter) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list(final String scope, final RoleDefinitionFilter filter) throws CloudException, IOException, IllegalArgumentException; /** * Get all role definitions that are applicable at scope and above. Use atScopeAndBelow filter to search below the given scope as well. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleDefinitionsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleDefinitionsOperationsImpl.java index e019267c3d1dd..f8b5ddb374e77 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleDefinitionsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/RoleDefinitionsOperationsImpl.java @@ -17,6 +17,8 @@ import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.RoleDefinition; import com.microsoft.azure.management.resources.models.RoleDefinitionFilter; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -385,21 +387,22 @@ private ServiceResponse getByIdDelegate(Response r * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleDefinition> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String scope) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String scope) throws CloudException, IOException, IllegalArgumentException { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - RoleDefinitionFilter filter = null; + final RoleDefinitionFilter filter = null; Call call = service.list(scope, this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -456,7 +459,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<RoleDefinition> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list(final String scope, final RoleDefinitionFilter filter) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list(final String scope, final RoleDefinitionFilter filter) throws CloudException, IOException, IllegalArgumentException { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } @@ -466,11 +469,12 @@ public ServiceResponse> list(final String scope, final Role Validator.validate(filter); Call call = service.list(scope, this.client.getMapperAdapter().serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperations.java index df9a51fdfa09b..507c578721278 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperations.java @@ -15,11 +15,11 @@ import com.microsoft.azure.management.resources.models.Location; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.Subscription; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -35,7 +35,7 @@ public interface SubscriptionsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Location> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> listLocations(final String subscriptionId) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> listLocations(final String subscriptionId) throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of the subscription locations. @@ -76,7 +76,7 @@ public interface SubscriptionsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Subscription> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of the subscriptionIds. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperationsImpl.java index 1509791f70c93..dbbdf87387321 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperationsImpl.java @@ -17,6 +17,8 @@ import com.microsoft.azure.management.resources.models.Location; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.Subscription; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -91,7 +93,7 @@ interface SubscriptionsService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Location> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> listLocations(final String subscriptionId) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> listLocations(final String subscriptionId) throws CloudException, IOException, IllegalArgumentException { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } @@ -100,11 +102,12 @@ public ServiceResponse> listLocations(final String subscriptionId } Call call = service.listLocations(subscriptionId, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listLocationsDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listLocationsNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listLocationsNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -227,17 +230,18 @@ private ServiceResponse getDelegate(Response respons * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Subscription> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperations.java index 83b6a43c43b8e..0598162610778 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperations.java @@ -15,11 +15,11 @@ import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.TagDetails; import com.microsoft.azure.management.resources.models.TagValue; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -122,7 +122,7 @@ public interface TagsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<TagDetails> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; /** * Get a list of subscription resource tags. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperationsImpl.java index 08bec43f23914..a5edee9396684 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperationsImpl.java @@ -17,6 +17,8 @@ import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.TagDetails; import com.microsoft.azure.management.resources.models.TagValue; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -392,7 +394,7 @@ private ServiceResponse deleteDelegate(Response response) th * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<TagDetails> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } @@ -401,11 +403,12 @@ public ServiceResponse> list() throws CloudException, IOExcepti } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperations.java index 4d65c10142362..b5572957cb263 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperations.java @@ -14,10 +14,10 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.TenantIdDescription; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import java.io.IOException; -import java.util.List; /** * An instance of this class provides access to all the operations defined @@ -32,7 +32,7 @@ public interface TenantsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<TenantIdDescription> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException; /** * Gets a list of the tenantIds. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperationsImpl.java index dfbf678e39d26..8f172ad522a59 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperationsImpl.java @@ -16,6 +16,8 @@ import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.resources.models.PageImpl; import com.microsoft.azure.management.resources.models.TenantIdDescription; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; @@ -75,17 +77,18 @@ interface TenantsService { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<TenantIdDescription> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> list() throws CloudException, IOException, IllegalArgumentException { if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = listDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = listNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return listNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperationsImpl.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperationsImpl.java index ff37429a0807f..3120c02ca7d82 100644 --- a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperationsImpl.java +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperationsImpl.java @@ -131,7 +131,7 @@ public ServiceResponse checkNameAvailability(String if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } - String type = null; + final String type = null; StorageAccountCheckNameAvailabilityParameters accountName = new StorageAccountCheckNameAvailabilityParameters(); accountName.setName(name); accountName.setType(type); diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/DomainsOperationsImpl.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/DomainsOperationsImpl.java index e96fc4bd404ef..6cd2e917df095 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/DomainsOperationsImpl.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/DomainsOperationsImpl.java @@ -347,7 +347,7 @@ public ServiceResponse deleteDomain(String resourceGroupName, String dom if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean forceHardDeleteDomain = null; + final Boolean forceHardDeleteDomain = null; Call call = service.deleteDomain(resourceGroupName, domainName, this.client.getSubscriptionId(), forceHardDeleteDomain, this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteDomainDelegate(call.execute()); } diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/GlobalDomainRegistrationOperationsImpl.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/GlobalDomainRegistrationOperationsImpl.java index ecede63807f67..d832480a3ba1d 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/GlobalDomainRegistrationOperationsImpl.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/GlobalDomainRegistrationOperationsImpl.java @@ -292,7 +292,7 @@ public ServiceResponse checkDomainAvailability() if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String name = null; + final String name = null; NameIdentifier identifier = new NameIdentifier(); identifier.setName(name); Call call = service.checkDomainAvailability(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage(), identifier); diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/GlobalOperationsImpl.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/GlobalOperationsImpl.java index 1324791fbe8da..564d0646a6cd1 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/GlobalOperationsImpl.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/GlobalOperationsImpl.java @@ -388,7 +388,7 @@ public ServiceResponse getAllServerFarms() throws CloudExc if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean detailed = null; + final Boolean detailed = null; Call call = service.getAllServerFarms(this.client.getSubscriptionId(), detailed, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getAllServerFarmsDelegate(call.execute()); } diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/HostingEnvironmentsOperationsImpl.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/HostingEnvironmentsOperationsImpl.java index 5fc9c23af1aca..3e5d77d734b6e 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/HostingEnvironmentsOperationsImpl.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/HostingEnvironmentsOperationsImpl.java @@ -661,7 +661,7 @@ public ServiceResponse beginDeleteHostingEnvironment(String resourceGrou if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean forceDelete = null; + final Boolean forceDelete = null; Call call = service.beginDeleteHostingEnvironment(resourceGroupName, name, this.client.getSubscriptionId(), forceDelete, this.client.getApiVersion(), this.client.getAcceptLanguage()); return beginDeleteHostingEnvironmentDelegate(call.execute()); } @@ -1457,8 +1457,8 @@ public ServiceResponse getHostingEnvironmentMetrics(St if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean details = null; - String filter = null; + final Boolean details = null; + final String filter = null; Call call = service.getHostingEnvironmentMetrics(resourceGroupName, name, this.client.getSubscriptionId(), details, filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getHostingEnvironmentMetricsDelegate(call.execute()); } @@ -1692,7 +1692,7 @@ public ServiceResponse getHostingEnvironmentUsages(Stri if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String filter = null; + final String filter = null; Call call = service.getHostingEnvironmentUsages(resourceGroupName, name, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getHostingEnvironmentUsagesDelegate(call.execute()); } @@ -1845,11 +1845,11 @@ public ServiceResponse getHostingEnvironmentMultiRoleM if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String startTime = null; - String endTime = null; - String timeGrain = null; - Boolean details = null; - String filter = null; + final String startTime = null; + final String endTime = null; + final String timeGrain = null; + final Boolean details = null; + final String filter = null; Call call = service.getHostingEnvironmentMultiRoleMetrics(resourceGroupName, name, this.client.getSubscriptionId(), startTime, endTime, timeGrain, details, filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getHostingEnvironmentMultiRoleMetricsDelegate(call.execute()); } @@ -2018,8 +2018,8 @@ public ServiceResponse getHostingEnvironmentWebWorkerM if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean details = null; - String filter = null; + final Boolean details = null; + final String filter = null; Call call = service.getHostingEnvironmentWebWorkerMetrics(resourceGroupName, name, workerPoolName, this.client.getSubscriptionId(), details, filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getHostingEnvironmentWebWorkerMetricsDelegate(call.execute()); } @@ -2519,7 +2519,7 @@ public ServiceResponse getHostingEnvironmentSites(String resourc if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String propertiesToInclude = null; + final String propertiesToInclude = null; Call call = service.getHostingEnvironmentSites(resourceGroupName, name, this.client.getSubscriptionId(), propertiesToInclude, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getHostingEnvironmentSitesDelegate(call.execute()); } @@ -3681,8 +3681,8 @@ public ServiceResponse getWorkerPoolInstanceMetrics(String resourceGroup if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean details = null; - String filter = null; + final Boolean details = null; + final String filter = null; Call call = service.getWorkerPoolInstanceMetrics(resourceGroupName, name, workerPoolName, instance, this.client.getSubscriptionId(), details, filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getWorkerPoolInstanceMetricsDelegate(call.execute()); } @@ -3966,7 +3966,7 @@ public ServiceResponse getMultiRolePoolInstanceMetrics(String resourceGr if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean details = null; + final Boolean details = null; Call call = service.getMultiRolePoolInstanceMetrics(resourceGroupName, name, instance, this.client.getSubscriptionId(), details, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getMultiRolePoolInstanceMetricsDelegate(call.execute()); } diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ManagedHostingEnvironmentsOperationsImpl.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ManagedHostingEnvironmentsOperationsImpl.java index 2770990970131..b945bbba93a0b 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ManagedHostingEnvironmentsOperationsImpl.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ManagedHostingEnvironmentsOperationsImpl.java @@ -521,7 +521,7 @@ public ServiceResponse beginDeleteManagedHostingEnvironment(String resou if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean forceDelete = null; + final Boolean forceDelete = null; Call call = service.beginDeleteManagedHostingEnvironment(resourceGroupName, name, this.client.getSubscriptionId(), forceDelete, this.client.getApiVersion(), this.client.getAcceptLanguage()); return beginDeleteManagedHostingEnvironmentDelegate(call.execute()); } @@ -914,7 +914,7 @@ public ServiceResponse getManagedHostingEnvironmentSites(String if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String propertiesToInclude = null; + final String propertiesToInclude = null; Call call = service.getManagedHostingEnvironmentSites(resourceGroupName, name, this.client.getSubscriptionId(), propertiesToInclude, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getManagedHostingEnvironmentSitesDelegate(call.execute()); } diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/RecommendationsOperationsImpl.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/RecommendationsOperationsImpl.java index 6a28d1ca6857c..769be41592491 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/RecommendationsOperationsImpl.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/RecommendationsOperationsImpl.java @@ -90,8 +90,8 @@ public ServiceResponse> getRecommendationBySubscription() t if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean featured = null; - String filter = null; + final Boolean featured = null; + final String filter = null; Call call = service.getRecommendationBySubscription(this.client.getSubscriptionId(), featured, filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getRecommendationBySubscriptionDelegate(call.execute()); } @@ -306,7 +306,7 @@ public ServiceResponse> getRecommendedRulesForSite(String r if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean featured = null; + final Boolean featured = null; Call call = service.getRecommendedRulesForSite(resourceGroupName, siteName, this.client.getSubscriptionId(), featured, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getRecommendedRulesForSiteDelegate(call.execute()); } @@ -459,8 +459,8 @@ public ServiceResponse> getRecommendationHistoryForSite(Str if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String startTime = null; - String endTime = null; + final String startTime = null; + final String endTime = null; Call call = service.getRecommendationHistoryForSite(resourceGroupName, siteName, this.client.getSubscriptionId(), startTime, endTime, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getRecommendationHistoryForSiteDelegate(call.execute()); } diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ServerFarmsOperations.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ServerFarmsOperations.java index a429d24a19378..bca04efdc81a7 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ServerFarmsOperations.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ServerFarmsOperations.java @@ -21,6 +21,7 @@ import com.microsoft.azure.management.website.models.VnetGateway; import com.microsoft.azure.management.website.models.VnetInfo; import com.microsoft.azure.management.website.models.VnetRoute; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -526,7 +527,7 @@ public interface ServerFarmsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Site> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> getServerFarmSites(final String resourceGroupName, final String name) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> getServerFarmSites(final String resourceGroupName, final String name) throws CloudException, IOException, IllegalArgumentException; /** * Gets list of Apps associated with an App Service Plan. @@ -551,7 +552,7 @@ public interface ServerFarmsOperations { * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Site> object wrapped in {@link ServiceResponse} if successful. */ - ServiceResponse> getServerFarmSites(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) throws CloudException, IOException, IllegalArgumentException; + ServiceResponse> getServerFarmSites(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) throws CloudException, IOException, IllegalArgumentException; /** * Gets list of Apps associated with an App Service Plan. diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ServerFarmsOperationsImpl.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ServerFarmsOperationsImpl.java index d174522837817..e78ab43c24629 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ServerFarmsOperationsImpl.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/ServerFarmsOperationsImpl.java @@ -23,6 +23,8 @@ import com.microsoft.azure.management.website.models.VnetGateway; import com.microsoft.azure.management.website.models.VnetInfo; import com.microsoft.azure.management.website.models.VnetRoute; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; @@ -493,7 +495,7 @@ public ServiceResponse beginCreateOrUpdateServerFarm(Stri throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(serverFarmEnvelope); - Boolean allowPendingState = null; + final Boolean allowPendingState = null; Call call = service.beginCreateOrUpdateServerFarm(resourceGroupName, name, this.client.getSubscriptionId(), serverFarmEnvelope, allowPendingState, this.client.getApiVersion(), this.client.getAcceptLanguage()); return beginCreateOrUpdateServerFarmDelegate(call.execute()); } @@ -742,8 +744,8 @@ public ServiceResponse getServerFarmMetrics(String res if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean details = null; - String filter = null; + final Boolean details = null; + final String filter = null; Call call = service.getServerFarmMetrics(resourceGroupName, name, this.client.getSubscriptionId(), details, filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getServerFarmMetricsDelegate(call.execute()); } @@ -1832,7 +1834,7 @@ private ServiceResponse updateServerFarmVnetGatewayDelegate(Respons * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Site> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> getServerFarmSites(final String resourceGroupName, final String name) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> getServerFarmSites(final String resourceGroupName, final String name) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1845,16 +1847,17 @@ public ServiceResponse> getServerFarmSites(final String resourceGroup if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String skipToken = null; - String filter = null; - String top = null; + final String skipToken = null; + final String filter = null; + final String top = null; Call call = service.getServerFarmSites(resourceGroupName, name, this.client.getSubscriptionId(), skipToken, filter, top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = getServerFarmSitesDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = getServerFarmSitesNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getServerFarmSitesNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -1925,7 +1928,7 @@ public void onResponse(Call call, Response response) * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<Site> object wrapped in {@link ServiceResponse} if successful. */ - public ServiceResponse> getServerFarmSites(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) throws CloudException, IOException, IllegalArgumentException { + public ServiceResponse> getServerFarmSites(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) throws CloudException, IOException, IllegalArgumentException { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1940,11 +1943,12 @@ public ServiceResponse> getServerFarmSites(final String resourceGroup } Call call = service.getServerFarmSites(resourceGroupName, name, this.client.getSubscriptionId(), skipToken, filter, top, this.client.getApiVersion(), this.client.getAcceptLanguage()); ServiceResponse> response = getServerFarmSitesDelegate(call.execute()); - List result = response.getBody().getItems(); - while (response.getBody().getNextPageLink() != null) { - response = getServerFarmSitesNext(response.getBody().getNextPageLink()); - result.addAll(response.getBody().getItems()); - } + PagedList result = new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) throws CloudException, IOException { + return getServerFarmSitesNext(nextPageLink).getBody(); + } + }; return new ServiceResponse<>(result, response.getResponse()); } @@ -2119,7 +2123,7 @@ public ServiceResponse restartSitesForServerFarm(String resourceGroupNam if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean softRestart = null; + final Boolean softRestart = null; Call call = service.restartSitesForServerFarm(resourceGroupName, name, this.client.getSubscriptionId(), softRestart, this.client.getApiVersion(), this.client.getAcceptLanguage()); return restartSitesForServerFarmDelegate(call.execute()); } diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/SitesOperationsImpl.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/SitesOperationsImpl.java index 4beb25f7799f4..446e1b8b6d519 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/SitesOperationsImpl.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/SitesOperationsImpl.java @@ -2829,7 +2829,7 @@ public ServiceResponse getSiteSlots(String resourceGroupName, St if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String propertiesToInclude = null; + final String propertiesToInclude = null; Call call = service.getSiteSlots(resourceGroupName, name, this.client.getSubscriptionId(), propertiesToInclude, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getSiteSlotsDelegate(call.execute()); } @@ -2978,9 +2978,9 @@ public ServiceResponse getSites(String resourceGroupName) throws if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String propertiesToInclude = null; - String includeSiteTypes = null; - Boolean includeSlots = null; + final String propertiesToInclude = null; + final String includeSiteTypes = null; + final Boolean includeSlots = null; Call call = service.getSites(resourceGroupName, this.client.getSubscriptionId(), propertiesToInclude, includeSiteTypes, includeSlots, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getSitesDelegate(call.execute()); } @@ -3125,7 +3125,7 @@ public ServiceResponse getSite(String resourceGroupName, String name) thro if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String propertiesToInclude = null; + final String propertiesToInclude = null; Call call = service.getSite(resourceGroupName, name, this.client.getSubscriptionId(), propertiesToInclude, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getSiteDelegate(call.execute()); } @@ -3456,10 +3456,10 @@ public ServiceResponse beginCreateOrUpdateSite(String resourceGroupName, S throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(siteEnvelope); - String skipDnsRegistration = null; - String skipCustomDomainVerification = null; - String forceDnsRegistration = null; - String ttlInSeconds = null; + final String skipDnsRegistration = null; + final String skipCustomDomainVerification = null; + final String forceDnsRegistration = null; + final String ttlInSeconds = null; Call call = service.beginCreateOrUpdateSite(resourceGroupName, name, this.client.getSubscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, this.client.getApiVersion(), this.client.getAcceptLanguage()); return beginCreateOrUpdateSiteDelegate(call.execute()); } @@ -3641,10 +3641,10 @@ public ServiceResponse deleteSite(String resourceGroupName, String name) if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String deleteMetrics = null; - String deleteEmptyServerFarm = null; - String skipDnsRegistration = null; - String deleteAllSlots = null; + final String deleteMetrics = null; + final String deleteEmptyServerFarm = null; + final String skipDnsRegistration = null; + final String deleteAllSlots = null; Call call = service.deleteSite(resourceGroupName, name, this.client.getSubscriptionId(), deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration, deleteAllSlots, this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteSiteDelegate(call.execute()); } @@ -3810,7 +3810,7 @@ public ServiceResponse getSiteSlot(String resourceGroupName, String name, if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String propertiesToInclude = null; + final String propertiesToInclude = null; Call call = service.getSiteSlot(resourceGroupName, name, slot, this.client.getSubscriptionId(), propertiesToInclude, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getSiteSlotDelegate(call.execute()); } @@ -4175,10 +4175,10 @@ public ServiceResponse beginCreateOrUpdateSiteSlot(String resourceGroupNam throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(siteEnvelope); - String skipDnsRegistration = null; - String skipCustomDomainVerification = null; - String forceDnsRegistration = null; - String ttlInSeconds = null; + final String skipDnsRegistration = null; + final String skipCustomDomainVerification = null; + final String forceDnsRegistration = null; + final String ttlInSeconds = null; Call call = service.beginCreateOrUpdateSiteSlot(resourceGroupName, name, slot, this.client.getSubscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, this.client.getApiVersion(), this.client.getAcceptLanguage()); return beginCreateOrUpdateSiteSlotDelegate(call.execute()); } @@ -4378,10 +4378,10 @@ public ServiceResponse deleteSiteSlot(String resourceGroupName, String n if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String deleteMetrics = null; - String deleteEmptyServerFarm = null; - String skipDnsRegistration = null; - String deleteAllSlots = null; + final String deleteMetrics = null; + final String deleteEmptyServerFarm = null; + final String skipDnsRegistration = null; + final String deleteAllSlots = null; Call call = service.deleteSiteSlot(resourceGroupName, name, slot, this.client.getSubscriptionId(), deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration, deleteAllSlots, this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteSiteSlotDelegate(call.execute()); } @@ -5307,8 +5307,8 @@ public ServiceResponse getDeletedSites(String resourceGro if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String propertiesToInclude = null; - String includeSiteTypes = null; + final String propertiesToInclude = null; + final String includeSiteTypes = null; Call call = service.getDeletedSites(resourceGroupName, this.client.getSubscriptionId(), propertiesToInclude, includeSiteTypes, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDeletedSitesDelegate(call.execute()); } @@ -13598,7 +13598,7 @@ public ServiceResponse getSiteUsagesSlot(String resourc if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String filter = null; + final String filter = null; Call call = service.getSiteUsagesSlot(resourceGroupName, name, slot, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getSiteUsagesSlotDelegate(call.execute()); } @@ -13765,7 +13765,7 @@ public ServiceResponse getSiteUsages(String resourceGro if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String filter = null; + final String filter = null; Call call = service.getSiteUsages(resourceGroupName, name, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getSiteUsagesDelegate(call.execute()); } @@ -13922,8 +13922,8 @@ public ServiceResponse getSiteMetricsSlot(String resou if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean details = null; - String filter = null; + final Boolean details = null; + final String filter = null; Call call = service.getSiteMetricsSlot(resourceGroupName, name, slot, this.client.getSubscriptionId(), details, filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getSiteMetricsSlotDelegate(call.execute()); } @@ -14093,8 +14093,8 @@ public ServiceResponse getSiteMetrics(String resourceG if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean details = null; - String filter = null; + final Boolean details = null; + final String filter = null; Call call = service.getSiteMetrics(resourceGroupName, name, this.client.getSubscriptionId(), details, filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getSiteMetricsDelegate(call.execute()); } @@ -14415,7 +14415,7 @@ public ServiceResponse listSitePublishingProfileXml(String resource if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String format = null; + final String format = null; CsmPublishingProfileOptions options = new CsmPublishingProfileOptions(); options.setFormat(format); Call call = service.listSitePublishingProfileXml(resourceGroupName, name, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage(), options); @@ -14586,7 +14586,7 @@ public ServiceResponse listSitePublishingProfileXmlSlot(String reso if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - String format = null; + final String format = null; CsmPublishingProfileOptions options = new CsmPublishingProfileOptions(); options.setFormat(format); Call call = service.listSitePublishingProfileXmlSlot(resourceGroupName, name, slot, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage(), options); @@ -14767,8 +14767,8 @@ public ServiceResponse restartSite(String resourceGroupName, String name if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean softRestart = null; - Boolean synchronous = null; + final Boolean softRestart = null; + final Boolean synchronous = null; Call call = service.restartSite(resourceGroupName, name, this.client.getSubscriptionId(), softRestart, synchronous, this.client.getApiVersion(), this.client.getAcceptLanguage()); return restartSiteDelegate(call.execute()); } @@ -14928,8 +14928,8 @@ public ServiceResponse restartSiteSlot(String resourceGroupName, String if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean softRestart = null; - Boolean synchronous = null; + final Boolean softRestart = null; + final Boolean synchronous = null; Call call = service.restartSiteSlot(resourceGroupName, name, slot, this.client.getSubscriptionId(), softRestart, synchronous, this.client.getApiVersion(), this.client.getAcceptLanguage()); return restartSiteSlotDelegate(call.execute()); } diff --git a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/TopLevelDomainsOperationsImpl.java b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/TopLevelDomainsOperationsImpl.java index b4b04324f648e..0d00bf76a0890 100644 --- a/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/TopLevelDomainsOperationsImpl.java +++ b/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/TopLevelDomainsOperationsImpl.java @@ -222,7 +222,7 @@ public ServiceResponse listTopLevelDomainAgreements if (this.client.getApiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } - Boolean includePrivacy = null; + final Boolean includePrivacy = null; TopLevelDomainAgreementOption agreementOption = new TopLevelDomainAgreementOption(); agreementOption.setIncludePrivacy(includePrivacy); Call call = service.listTopLevelDomainAgreements(name, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage(), agreementOption);