diff --git a/storage/resource-manager/v2019_04_01/pom.xml b/storage/resource-manager/v2019_04_01/pom.xml index c27b715546aa..db8e6621c6d9 100644 --- a/storage/resource-manager/v2019_04_01/pom.xml +++ b/storage/resource-manager/v2019_04_01/pom.xml @@ -15,7 +15,7 @@ ../../../pom.management.xml azure-mgmt-storage - 1.0.0-beta-1 + 1.0.0-beta-2 jar Microsoft Azure SDK for Storage Management This package contains Microsoft Storage Management SDK. diff --git a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/LargeFileSharesState.java b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/LargeFileSharesState.java new file mode 100644 index 000000000000..d44bd97c7ef1 --- /dev/null +++ b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/LargeFileSharesState.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage.v2019_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LargeFileSharesState. + */ +public final class LargeFileSharesState extends ExpandableStringEnum { + /** Static value Disabled for LargeFileSharesState. */ + public static final LargeFileSharesState DISABLED = fromString("Disabled"); + + /** Static value Enabled for LargeFileSharesState. */ + public static final LargeFileSharesState ENABLED = fromString("Enabled"); + + /** + * Creates or finds a LargeFileSharesState from its string representation. + * @param name a name to look for + * @return the corresponding LargeFileSharesState + */ + @JsonCreator + public static LargeFileSharesState fromString(String name) { + return fromString(name, LargeFileSharesState.class); + } + + /** + * @return known LargeFileSharesState values + */ + public static Collection values() { + return values(LargeFileSharesState.class); + } +} diff --git a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccount.java b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccount.java index e681cea1848a..5a083c7fffb2 100644 --- a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccount.java +++ b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccount.java @@ -81,6 +81,11 @@ public interface StorageAccount extends HasInner, Resource, */ Kind kind(); + /** + * @return the largeFileSharesState value. + */ + LargeFileSharesState largeFileSharesState(); + /** * @return the lastGeoFailoverTime value. */ @@ -261,6 +266,18 @@ interface WithIsHnsEnabled { WithCreate withIsHnsEnabled(Boolean isHnsEnabled); } + /** + * The stage of the storageaccount definition allowing to specify LargeFileSharesState. + */ + interface WithLargeFileSharesState { + /** + * Specifies largeFileSharesState. + * @param largeFileSharesState Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'Disabled', 'Enabled' + * @return the next definition stage + */ + WithCreate withLargeFileSharesState(LargeFileSharesState largeFileSharesState); + } + /** * The stage of the storageaccount definition allowing to specify NetworkRuleSet. */ @@ -278,13 +295,13 @@ interface WithNetworkRuleSet { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAccessTier, DefinitionStages.WithAzureFilesIdentityBasedAuthentication, DefinitionStages.WithCustomDomain, DefinitionStages.WithEnableHttpsTrafficOnly, DefinitionStages.WithEncryption, DefinitionStages.WithIdentity, DefinitionStages.WithIsHnsEnabled, DefinitionStages.WithNetworkRuleSet { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAccessTier, DefinitionStages.WithAzureFilesIdentityBasedAuthentication, DefinitionStages.WithCustomDomain, DefinitionStages.WithEnableHttpsTrafficOnly, DefinitionStages.WithEncryption, DefinitionStages.WithIdentity, DefinitionStages.WithIsHnsEnabled, DefinitionStages.WithLargeFileSharesState, DefinitionStages.WithNetworkRuleSet { } } /** * The template for a StorageAccount update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAccessTier, UpdateStages.WithAzureFilesIdentityBasedAuthentication, UpdateStages.WithCustomDomain, UpdateStages.WithEnableHttpsTrafficOnly, UpdateStages.WithEncryption, UpdateStages.WithIdentity, UpdateStages.WithKind, UpdateStages.WithNetworkRuleSet, UpdateStages.WithSku { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAccessTier, UpdateStages.WithAzureFilesIdentityBasedAuthentication, UpdateStages.WithCustomDomain, UpdateStages.WithEnableHttpsTrafficOnly, UpdateStages.WithEncryption, UpdateStages.WithIdentity, UpdateStages.WithKind, UpdateStages.WithLargeFileSharesState, UpdateStages.WithNetworkRuleSet, UpdateStages.WithSku { } /** @@ -375,6 +392,18 @@ interface WithKind { Update withKind(Kind kind); } + /** + * The stage of the storageaccount update allowing to specify LargeFileSharesState. + */ + interface WithLargeFileSharesState { + /** + * Specifies largeFileSharesState. + * @param largeFileSharesState Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'Disabled', 'Enabled' + * @return the next update stage + */ + Update withLargeFileSharesState(LargeFileSharesState largeFileSharesState); + } + /** * The stage of the storageaccount update allowing to specify NetworkRuleSet. */ diff --git a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccountCreateParameters.java b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccountCreateParameters.java index b0ff92f40fca..d8c7b7dc36f3 100644 --- a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccountCreateParameters.java +++ b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccountCreateParameters.java @@ -106,6 +106,13 @@ public class StorageAccountCreateParameters { @JsonProperty(value = "properties.isHnsEnabled") private Boolean isHnsEnabled; + /** + * Allow large file shares if sets to Enabled. It cannot be disabled once + * it is enabled. Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.largeFileSharesState") + private LargeFileSharesState largeFileSharesState; + /** * Get required. Gets or sets the SKU name. * @@ -346,4 +353,24 @@ public StorageAccountCreateParameters withIsHnsEnabled(Boolean isHnsEnabled) { return this; } + /** + * Get allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'Disabled', 'Enabled'. + * + * @return the largeFileSharesState value + */ + public LargeFileSharesState largeFileSharesState() { + return this.largeFileSharesState; + } + + /** + * Set allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'Disabled', 'Enabled'. + * + * @param largeFileSharesState the largeFileSharesState value to set + * @return the StorageAccountCreateParameters object itself. + */ + public StorageAccountCreateParameters withLargeFileSharesState(LargeFileSharesState largeFileSharesState) { + this.largeFileSharesState = largeFileSharesState; + return this; + } + } diff --git a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccountUpdateParameters.java b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccountUpdateParameters.java index 14180711401f..24f969061990 100644 --- a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccountUpdateParameters.java +++ b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/StorageAccountUpdateParameters.java @@ -84,6 +84,13 @@ public class StorageAccountUpdateParameters { @JsonProperty(value = "properties.networkAcls") private NetworkRuleSet networkRuleSet; + /** + * Allow large file shares if sets to Enabled. It cannot be disabled once + * it is enabled. Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.largeFileSharesState") + private LargeFileSharesState largeFileSharesState; + /** * Optional. Indicates the type of storage account. Currently only * StorageV2 value supported by server. Possible values include: 'Storage', @@ -272,6 +279,26 @@ public StorageAccountUpdateParameters withNetworkRuleSet(NetworkRuleSet networkR return this; } + /** + * Get allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'Disabled', 'Enabled'. + * + * @return the largeFileSharesState value + */ + public LargeFileSharesState largeFileSharesState() { + return this.largeFileSharesState; + } + + /** + * Set allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'Disabled', 'Enabled'. + * + * @param largeFileSharesState the largeFileSharesState value to set + * @return the StorageAccountUpdateParameters object itself. + */ + public StorageAccountUpdateParameters withLargeFileSharesState(LargeFileSharesState largeFileSharesState) { + this.largeFileSharesState = largeFileSharesState; + return this; + } + /** * Get optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: 'Storage', 'StorageV2', 'BlobStorage', 'FileStorage', 'BlockBlobStorage'. * diff --git a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountImpl.java b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountImpl.java index 9c14e2f82761..60397ba74a9f 100644 --- a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountImpl.java +++ b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountImpl.java @@ -21,6 +21,7 @@ import com.microsoft.azure.management.storage.v2019_04_01.GeoReplicationStats; import com.microsoft.azure.management.storage.v2019_04_01.Identity; import com.microsoft.azure.management.storage.v2019_04_01.Kind; +import com.microsoft.azure.management.storage.v2019_04_01.LargeFileSharesState; import com.microsoft.azure.management.storage.v2019_04_01.NetworkRuleSet; import com.microsoft.azure.management.storage.v2019_04_01.Endpoints; import com.microsoft.azure.management.storage.v2019_04_01.ProvisioningState; @@ -138,6 +139,11 @@ public Kind kind() { return this.inner().kind(); } + @Override + public LargeFileSharesState largeFileSharesState() { + return this.inner().largeFileSharesState(); + } + @Override public DateTime lastGeoFailoverTime() { return this.inner().lastGeoFailoverTime(); @@ -279,6 +285,16 @@ public StorageAccountImpl withIdentity(Identity identity) { return this; } + @Override + public StorageAccountImpl withLargeFileSharesState(LargeFileSharesState largeFileSharesState) { + if (isInCreateMode()) { + this.createParameter.withLargeFileSharesState(largeFileSharesState); + } else { + this.updateParameter.withLargeFileSharesState(largeFileSharesState); + } + return this; + } + @Override public StorageAccountImpl withNetworkRuleSet(NetworkRuleSet networkRuleSet) { if (isInCreateMode()) { diff --git a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountInner.java b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountInner.java index a18bb10bd43d..8f4954da3403 100644 --- a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountInner.java +++ b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountInner.java @@ -20,6 +20,7 @@ import com.microsoft.azure.management.storage.v2019_04_01.AzureFilesIdentityBasedAuthentication; import com.microsoft.azure.management.storage.v2019_04_01.NetworkRuleSet; import com.microsoft.azure.management.storage.v2019_04_01.GeoReplicationStats; +import com.microsoft.azure.management.storage.v2019_04_01.LargeFileSharesState; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -175,6 +176,13 @@ public class StorageAccountInner extends Resource { @JsonProperty(value = "properties.failoverInProgress", access = JsonProperty.Access.WRITE_ONLY) private Boolean failoverInProgress; + /** + * Allow large file shares if sets to Enabled. It cannot be disabled once + * it is enabled. Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.largeFileSharesState") + private LargeFileSharesState largeFileSharesState; + /** * Get gets the SKU. * @@ -408,4 +416,24 @@ public Boolean failoverInProgress() { return this.failoverInProgress; } + /** + * Get allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'Disabled', 'Enabled'. + * + * @return the largeFileSharesState value + */ + public LargeFileSharesState largeFileSharesState() { + return this.largeFileSharesState; + } + + /** + * Set allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'Disabled', 'Enabled'. + * + * @param largeFileSharesState the largeFileSharesState value to set + * @return the StorageAccountInner object itself. + */ + public StorageAccountInner withLargeFileSharesState(LargeFileSharesState largeFileSharesState) { + this.largeFileSharesState = largeFileSharesState; + return this; + } + } diff --git a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountsImpl.java b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountsImpl.java index c49c2ea9aa3a..fc73afdde433 100644 --- a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountsImpl.java +++ b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountsImpl.java @@ -112,10 +112,10 @@ public PagedList list() { public Observable listAsync() { StorageAccountsInner client = this.inner(); return client.listAsync() - .flatMap(new Func1, Observable>() { + .flatMapIterable(new Func1, Iterable>() { @Override - public Observable call(Page innerPage) { - return Observable.from(innerPage.items()); + public Iterable call(Page page) { + return page.items(); } }) .map(new Func1() { diff --git a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountsInner.java b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountsInner.java index 7174b750f392..8d7a6fa7381c 100644 --- a/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountsInner.java +++ b/storage/resource-manager/v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/StorageAccountsInner.java @@ -13,7 +13,9 @@ import com.microsoft.azure.arm.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.storage.v2019_04_01.AccountSasParameters; import com.microsoft.azure.management.storage.v2019_04_01.ServiceSasParameters; import com.microsoft.azure.management.storage.v2019_04_01.StorageAccountCheckNameAvailabilityParameters; @@ -40,6 +42,7 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -134,6 +137,10 @@ interface StorageAccountsService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys") Observable> revokeUserDelegationKeys(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.v2019_04_01.StorageAccounts listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -742,16 +749,17 @@ private ServiceResponse updateDelegate(Response object if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<StorageAccountInner> object if successful. */ public PagedList list() { - PageImpl page = new PageImpl<>(); - page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); - page.setNextPageLink(null); - return new PagedList(page) { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return null; + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -760,34 +768,64 @@ public Page nextPage(String nextPageLink) { * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. * - * @return the observable to the List<StorageAccountInner> object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageAccountInner> object */ public Observable> listAsync() { - return listWithServiceResponseAsync().map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - PageImpl page = new PageImpl<>(); - page.setItems(response.body()); - return page; - } - }); + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. * - * @return the observable to the List<StorageAccountInner> object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageAccountInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<StorageAccountInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listWithServiceResponseAsync() { + public Observable>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -795,17 +833,12 @@ public Observable>> listWithServiceRes throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); - return Observable.just(clientResponse); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -813,9 +846,9 @@ public Observable>> call(Response> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1516,4 +1549,115 @@ private ServiceResponse revokeUserDelegationKeysDelegate(Response listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageAccountInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageAccountInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<StorageAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + }