From 94643bc1915faaef13de7ef9aa8900d3e5e552fd Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 6 Dec 2019 22:18:17 +0000 Subject: [PATCH] Generated from e6fe8982616bc5219be3f69b2486aa9cb00d6cf2 Update EventHub.json --- sdk/eventhubs/mgmt-v2017_04_01/pom.xml | 4 +- .../eventhubs/v2017_04_01/Namespaces.java | 11 + .../eventhubs/v2017_04_01/NetworkRuleSet.java | 2 +- .../implementation/ConsumerGroupsImpl.java | 10 +- .../DisasterRecoveryConfigsImpl.java | 20 +- .../implementation/EventHubsImpl.java | 20 +- .../implementation/EventHubsInner.java | 8 +- .../implementation/NamespacesImpl.java | 32 ++- .../implementation/NamespacesInner.java | 242 ++++++++++++++++++ .../implementation/NetworkRuleSetImpl.java | 6 +- 10 files changed, 330 insertions(+), 25 deletions(-) diff --git a/sdk/eventhubs/mgmt-v2017_04_01/pom.xml b/sdk/eventhubs/mgmt-v2017_04_01/pom.xml index 4cb97ac55ad12..6fbfcfc5c8c3a 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/pom.xml +++ b/sdk/eventhubs/mgmt-v2017_04_01/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.2.0 + 1.1.0 ../../../pom.management.xml azure-mgmt-eventhubs @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/Namespaces.java b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/Namespaces.java index 95de862b638fb..0f88ea90c5b00 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/Namespaces.java +++ b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/Namespaces.java @@ -19,6 +19,7 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.management.eventhubs.v2017_04_01.NamespaceAuthorizationRule; import rx.Completable; +import com.microsoft.azure.management.eventhubs.v2017_04_01.NetworkRuleSet; import com.microsoft.azure.management.eventhubs.v2017_04_01.implementation.NetworkRuleSetInner; /** @@ -106,6 +107,16 @@ public interface Namespaces extends SupportsCreating regenerateKeysAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, RegenerateAccessKeyParameters parameters); + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listNetworkRuleSetsAsync(final String resourceGroupName, final String namespaceName); + /** * Create or update NetworkRuleSet for a Namespace. * diff --git a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/NetworkRuleSet.java b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/NetworkRuleSet.java index 5c369bab42b5f..9a54d323ccab6 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/NetworkRuleSet.java +++ b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/NetworkRuleSet.java @@ -9,9 +9,9 @@ package com.microsoft.azure.management.eventhubs.v2017_04_01; import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.eventhubs.v2017_04_01.implementation.NetworkRuleSetInner; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.eventhubs.v2017_04_01.implementation.EventHubsManager; -import com.microsoft.azure.management.eventhubs.v2017_04_01.implementation.NetworkRuleSetInner; import java.util.List; /** diff --git a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/ConsumerGroupsImpl.java b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/ConsumerGroupsImpl.java index dd9e9c5849d7d..47375a1be0882 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/ConsumerGroupsImpl.java +++ b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/ConsumerGroupsImpl.java @@ -64,10 +64,14 @@ public ConsumerGroup call(ConsumerGroupInner inner) { public Observable getAsync(String resourceGroupName, String namespaceName, String eventHubName, String consumerGroupName) { ConsumerGroupsInner client = this.inner(); return client.getAsync(resourceGroupName, namespaceName, eventHubName, consumerGroupName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ConsumerGroup call(ConsumerGroupInner inner) { - return wrapModel(inner); + public Observable call(ConsumerGroupInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ConsumerGroup)wrapModel(inner)); + } } }); } diff --git a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java index ade19f09c14ab..418df6666c285 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java +++ b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java @@ -91,10 +91,14 @@ public ArmDisasterRecovery call(ArmDisasterRecoveryInner inner) { public Observable getAsync(String resourceGroupName, String namespaceName, String alias) { DisasterRecoveryConfigsInner client = this.inner(); return client.getAsync(resourceGroupName, namespaceName, alias) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ArmDisasterRecovery call(ArmDisasterRecoveryInner inner) { - return wrapModel(inner); + public Observable call(ArmDisasterRecoveryInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ArmDisasterRecovery)wrapModel(inner)); + } } }); } @@ -122,10 +126,14 @@ private Observable getAuthorizationRuleInnerUsingDisaste public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String alias, String authorizationRuleName) { DisasterRecoveryConfigsInner client = this.inner(); return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, alias, authorizationRuleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public DisasterRecoveryConfigNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { - return wrapDisasterRecoveryConfigNamespaceAuthorizationRuleModel(inner); + public Observable call(AuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DisasterRecoveryConfigNamespaceAuthorizationRule)wrapDisasterRecoveryConfigNamespaceAuthorizationRuleModel(inner)); + } } }); } diff --git a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/EventHubsImpl.java b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/EventHubsImpl.java index 0e04e4e867428..2399469cd90d9 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/EventHubsImpl.java +++ b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/EventHubsImpl.java @@ -67,10 +67,14 @@ public Eventhub call(EventhubInner inner) { public Observable getAsync(String resourceGroupName, String namespaceName, String eventHubName) { EventHubsInner client = this.inner(); return client.getAsync(resourceGroupName, namespaceName, eventHubName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public Eventhub call(EventhubInner inner) { - return wrapModel(inner); + public Observable call(EventhubInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Eventhub)wrapModel(inner)); + } } }); } @@ -107,10 +111,14 @@ private Observable getAuthorizationRuleInnerUsingEventHu public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String eventHubName, String authorizationRuleName) { EventHubsInner client = this.inner(); return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public EventhubNamespaceAuthorizationRule call(AuthorizationRuleInner inner) { - return wrapEventhubNamespaceAuthorizationRuleModel(inner); + public Observable call(AuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((EventhubNamespaceAuthorizationRule)wrapEventhubNamespaceAuthorizationRuleModel(inner)); + } } }); } diff --git a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/EventHubsInner.java b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/EventHubsInner.java index 0ab251bb33f32..779505c5e3504 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/EventHubsInner.java +++ b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/EventHubsInner.java @@ -784,7 +784,7 @@ private ServiceResponse> listAuthorizationRules } /** - * Creates or updates an AuthorizationRule for the specified Event Hub. + * Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the AuthorizationRule will take a few seconds to take effect. * * @param resourceGroupName Name of the resource group within the azure subscription. * @param namespaceName The Namespace name @@ -801,7 +801,7 @@ public AuthorizationRuleInner createOrUpdateAuthorizationRule(String resourceGro } /** - * Creates or updates an AuthorizationRule for the specified Event Hub. + * Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the AuthorizationRule will take a few seconds to take effect. * * @param resourceGroupName Name of the resource group within the azure subscription. * @param namespaceName The Namespace name @@ -817,7 +817,7 @@ public ServiceFuture createOrUpdateAuthorizationRuleAsyn } /** - * Creates or updates an AuthorizationRule for the specified Event Hub. + * Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the AuthorizationRule will take a few seconds to take effect. * * @param resourceGroupName Name of the resource group within the azure subscription. * @param namespaceName The Namespace name @@ -837,7 +837,7 @@ public AuthorizationRuleInner call(ServiceResponse respo } /** - * Creates or updates an AuthorizationRule for the specified Event Hub. + * Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the AuthorizationRule will take a few seconds to take effect. * * @param resourceGroupName Name of the resource group within the azure subscription. * @param namespaceName The Namespace name diff --git a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NamespacesImpl.java b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NamespacesImpl.java index 41b163351847f..3146fa5f8f19b 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NamespacesImpl.java +++ b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NamespacesImpl.java @@ -178,6 +178,10 @@ private NamespaceAuthorizationRuleImpl wrapNamespaceAuthorizationRuleModel(Autho return new NamespaceAuthorizationRuleImpl(inner, manager()); } + private NetworkRuleSetImpl wrapNetworkRuleSetModel(NetworkRuleSetInner inner) { + return new NetworkRuleSetImpl(inner, manager()); + } + private Observable getAuthorizationRuleInnerUsingNamespacesInnerAsync(String id) { String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); @@ -190,10 +194,14 @@ private Observable getAuthorizationRuleInnerUsingNamespa public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName) { NamespacesInner client = this.inner(); return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public NamespaceAuthorizationRule call(AuthorizationRuleInner inner) { - return wrapNamespaceAuthorizationRuleModel(inner); + public Observable call(AuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((NamespaceAuthorizationRule)wrapNamespaceAuthorizationRuleModel(inner)); + } } }); } @@ -246,6 +254,24 @@ public AccessKeys call(AccessKeysInner inner) { }); } + @Override + public Observable listNetworkRuleSetsAsync(final String resourceGroupName, final String namespaceName) { + NamespacesInner client = this.inner(); + return client.listNetworkRuleSetsAsync(resourceGroupName, namespaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NetworkRuleSet call(NetworkRuleSetInner inner) { + return wrapNetworkRuleSetModel(inner); + } + }); + } + @Override public Observable createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters) { NamespacesInner client = this.inner(); diff --git a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NamespacesInner.java b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NamespacesInner.java index 2a656ffb6b3e9..a1dc81f975c0a 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NamespacesInner.java +++ b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NamespacesInner.java @@ -141,6 +141,10 @@ interface NamespacesService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default") Observable> getNetworkRuleSet(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @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.eventhubs.v2017_04_01.Namespaces listNetworkRuleSets" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets") + Observable> listNetworkRuleSets(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @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.eventhubs.v2017_04_01.Namespaces listNext" }) @GET Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -153,6 +157,10 @@ interface NamespacesService { @GET Observable> listAuthorizationRulesNext(@Url String nextUrl, @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.eventhubs.v2017_04_01.Namespaces listNetworkRuleSetsNext" }) + @GET + Observable> listNetworkRuleSetsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -1841,6 +1849,129 @@ private ServiceResponse getNetworkRuleSetDelegate(Response< .build(response); } + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<NetworkRuleSetInner> object if successful. + */ + public PagedList listNetworkRuleSets(final String resourceGroupName, final String namespaceName) { + ServiceResponse> response = listNetworkRuleSetsSinglePageAsync(resourceGroupName, namespaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @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> listNetworkRuleSetsAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNetworkRuleSetsSinglePageAsync(resourceGroupName, namespaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NetworkRuleSetInner> object + */ + public Observable> listNetworkRuleSetsAsync(final String resourceGroupName, final String namespaceName) { + return listNetworkRuleSetsWithServiceResponseAsync(resourceGroupName, namespaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NetworkRuleSetInner> object + */ + public Observable>> listNetworkRuleSetsWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { + return listNetworkRuleSetsSinglePageAsync(resourceGroupName, namespaceName) + .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(listNetworkRuleSetsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + ServiceResponse> * @param resourceGroupName Name of the resource group within the azure subscription. + ServiceResponse> * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NetworkRuleSetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNetworkRuleSetsSinglePageAsync(final String resourceGroupName, final String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listNetworkRuleSets(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNetworkRuleSetsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNetworkRuleSetsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Lists all the available Namespaces within a subscription, irrespective of the resource groups. * @@ -2174,4 +2305,115 @@ private ServiceResponse> listAuthorizationRules .build(response); } + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<NetworkRuleSetInner> object if successful. + */ + public PagedList listNetworkRuleSetsNext(final String nextPageLink) { + ServiceResponse> response = listNetworkRuleSetsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @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> listNetworkRuleSetsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNetworkRuleSetsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @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<NetworkRuleSetInner> object + */ + public Observable> listNetworkRuleSetsNextAsync(final String nextPageLink) { + return listNetworkRuleSetsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + * @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<NetworkRuleSetInner> object + */ + public Observable>> listNetworkRuleSetsNextWithServiceResponseAsync(final String nextPageLink) { + return listNetworkRuleSetsNextSinglePageAsync(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(listNetworkRuleSetsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets list of NetworkRuleSet for a Namespace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NetworkRuleSetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNetworkRuleSetsNextSinglePageAsync(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.listNetworkRuleSetsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNetworkRuleSetsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNetworkRuleSetsNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + } diff --git a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NetworkRuleSetImpl.java b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NetworkRuleSetImpl.java index 55553c9d4d0e1..c96f414c12a6e 100644 --- a/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NetworkRuleSetImpl.java +++ b/sdk/eventhubs/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/eventhubs/v2017_04_01/implementation/NetworkRuleSetImpl.java @@ -10,6 +10,7 @@ import com.microsoft.azure.management.eventhubs.v2017_04_01.NetworkRuleSet; import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; import com.microsoft.azure.management.eventhubs.v2017_04_01.DefaultAction; import java.util.List; import com.microsoft.azure.management.eventhubs.v2017_04_01.NWRuleSetIpRules; @@ -17,7 +18,8 @@ class NetworkRuleSetImpl extends WrapperImpl implements NetworkRuleSet { private final EventHubsManager manager; - NetworkRuleSetImpl(NetworkRuleSetInner inner, EventHubsManager manager) { + + NetworkRuleSetImpl(NetworkRuleSetInner inner, EventHubsManager manager) { super(inner); this.manager = manager; } @@ -27,6 +29,8 @@ public EventHubsManager manager() { return this.manager; } + + @Override public DefaultAction defaultAction() { return this.inner().defaultAction();