diff --git a/sdk/servicebus/mgmt-v2017_04_01/pom.xml b/sdk/servicebus/mgmt-v2017_04_01/pom.xml index 7b00002800b0..29c6060d5338 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/pom.xml +++ b/sdk/servicebus/mgmt-v2017_04_01/pom.xml @@ -11,8 +11,8 @@ com.microsoft.azure azure-arm-parent - 1.2.0 - ../../parents/azure-arm-parent + 1.1.0 + ../../../pom.management.xml azure-mgmt-servicebus 1.0.0-beta @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Namespaces.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Namespaces.java index 53a1692d1da7..85164d19e4d8 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Namespaces.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/Namespaces.java @@ -19,6 +19,7 @@ import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.NamespacesInner; import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.management.servicebus.v2017_04_01.NamespaceSBAuthorizationRule; +import com.microsoft.azure.management.servicebus.v2017_04_01.NetworkRuleSet; import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.NetworkRuleSetInner; /** @@ -107,6 +108,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/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleSet.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleSet.java index e38c0cc505ff..530fb26328bc 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleSet.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/NetworkRuleSet.java @@ -9,9 +9,9 @@ package com.microsoft.azure.management.servicebus.v2017_04_01; import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.NetworkRuleSetInner; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.ServiceBusManager; -import com.microsoft.azure.management.servicebus.v2017_04_01.implementation.NetworkRuleSetInner; import java.util.List; /** diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ResourceNamespacePatch.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ResourceNamespacePatch.java index 25e7281a3056..d1072bc13bd1 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ResourceNamespacePatch.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/ResourceNamespacePatch.java @@ -8,11 +8,64 @@ package com.microsoft.azure.management.servicebus.v2017_04_01; -import com.microsoft.azure.Resource; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; /** * The Resource definition. */ -public class ResourceNamespacePatch extends Resource { +public class ResourceNamespacePatch extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the ResourceNamespacePatch object itself. + */ + public ResourceNamespacePatch withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ResourceNamespacePatch object itself. + */ + public ResourceNamespacePatch withTags(Map tags) { + this.tags = tags; + return this; + } } diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlFilter.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlFilter.java index a917c1821c4f..ac0a9021ba14 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlFilter.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/SqlFilter.java @@ -25,7 +25,7 @@ public class SqlFilter { * This property is reserved for future use. An integer value showing the * compatibility level, currently hard-coded to 20. */ - @JsonProperty(value = "compatibilityLevel", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "compatibilityLevel") private Integer compatibilityLevel; /** @@ -63,6 +63,17 @@ public Integer compatibilityLevel() { return this.compatibilityLevel; } + /** + * Set this property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. + * + * @param compatibilityLevel the compatibilityLevel value to set + * @return the SqlFilter object itself. + */ + public SqlFilter withCompatibilityLevel(Integer compatibilityLevel) { + this.compatibilityLevel = compatibilityLevel; + return this; + } + /** * Get value that indicates whether the rule action requires preprocessing. * diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java index d1e32adbb74f..0522b355e330 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/DisasterRecoveryConfigsImpl.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/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 getSBAuthorizationRuleInnerUsingDis 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 DisasterRecoveryConfigNamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { - return wrapDisasterRecoveryConfigNamespaceSBAuthorizationRuleModel(inner); + public Observable call(SBAuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DisasterRecoveryConfigNamespaceSBAuthorizationRule)wrapDisasterRecoveryConfigNamespaceSBAuthorizationRuleModel(inner)); + } } }); } diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsImpl.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsImpl.java index 53b139e8bcaa..c17e8ca21c90 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsImpl.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigsImpl.java @@ -76,10 +76,14 @@ public MigrationConfigProperties call(MigrationConfigPropertiesInner inner) { public Observable getAsync(String resourceGroupName, String namespaceName) { MigrationConfigsInner client = this.inner(); return client.getAsync(resourceGroupName, namespaceName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public MigrationConfigProperties call(MigrationConfigPropertiesInner inner) { - return wrapModel(inner); + public Observable call(MigrationConfigPropertiesInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((MigrationConfigProperties)wrapModel(inner)); + } } }); } diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesImpl.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesImpl.java index a3d14e72a7b3..91e98b609eb9 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesImpl.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesImpl.java @@ -172,6 +172,10 @@ private NamespaceSBAuthorizationRuleImpl wrapNamespaceSBAuthorizationRuleModel(S return new NamespaceSBAuthorizationRuleImpl(inner, manager()); } + private NetworkRuleSetImpl wrapNetworkRuleSetModel(NetworkRuleSetInner inner) { + return new NetworkRuleSetImpl(inner, manager()); + } + private Observable getSBAuthorizationRuleInnerUsingNamespacesInnerAsync(String id) { String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); String namespaceName = IdParsingUtils.getValueFromIdByName(id, "namespaces"); @@ -184,10 +188,14 @@ private Observable getSBAuthorizationRuleInnerUsingNam 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 NamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { - return wrapNamespaceSBAuthorizationRuleModel(inner); + public Observable call(SBAuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((NamespaceSBAuthorizationRule)wrapNamespaceSBAuthorizationRuleModel(inner)); + } } }); } @@ -240,6 +248,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/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesInner.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesInner.java index 9ccdbb2c48dc..a33b3c1c3dd8 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesInner.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NamespacesInner.java @@ -144,6 +144,10 @@ interface NamespacesService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2017_04_01.Namespaces listNetworkRuleSets" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/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.servicebus.v2017_04_01.Namespaces listNext" }) @GET Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -156,6 +160,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.servicebus.v2017_04_01.Namespaces listNetworkRuleSetsNext" }) + @GET + Observable> listNetworkRuleSetsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -1851,6 +1859,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); + } + /** * Gets all the available namespaces within the subscription, irrespective of the resource groups. * @@ -2184,4 +2315,115 @@ private ServiceResponse> listAuthorizationRul .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/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetImpl.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetImpl.java index 2b0eae6e1e38..e13ec320ef38 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetImpl.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/NetworkRuleSetImpl.java @@ -10,6 +10,7 @@ import com.microsoft.azure.management.servicebus.v2017_04_01.NetworkRuleSet; import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; import com.microsoft.azure.management.servicebus.v2017_04_01.DefaultAction; import java.util.List; import com.microsoft.azure.management.servicebus.v2017_04_01.NWRuleSetIpRules; @@ -17,7 +18,8 @@ class NetworkRuleSetImpl extends WrapperImpl implements NetworkRuleSet { private final ServiceBusManager manager; - NetworkRuleSetImpl(NetworkRuleSetInner inner, ServiceBusManager manager) { + + NetworkRuleSetImpl(NetworkRuleSetInner inner, ServiceBusManager manager) { super(inner); this.manager = manager; } @@ -27,6 +29,8 @@ public ServiceBusManager manager() { return this.manager; } + + @Override public DefaultAction defaultAction() { return this.inner().defaultAction(); diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesImpl.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesImpl.java index 0211a389ac2e..1e8393b7f4ce 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesImpl.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/QueuesImpl.java @@ -67,10 +67,14 @@ public SBQueue call(SBQueueInner inner) { public Observable getAsync(String resourceGroupName, String namespaceName, String queueName) { QueuesInner client = this.inner(); return client.getAsync(resourceGroupName, namespaceName, queueName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SBQueue call(SBQueueInner inner) { - return wrapModel(inner); + public Observable call(SBQueueInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SBQueue)wrapModel(inner)); + } } }); } @@ -107,10 +111,14 @@ private Observable getSBAuthorizationRuleInnerUsingQue public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String queueName, String authorizationRuleName) { QueuesInner client = this.inner(); return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, queueName, authorizationRuleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public QueueNamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { - return wrapQueueNamespaceSBAuthorizationRuleModel(inner); + public Observable call(SBAuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((QueueNamespaceSBAuthorizationRule)wrapQueueNamespaceSBAuthorizationRuleModel(inner)); + } } }); } diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesImpl.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesImpl.java index b07be1440337..62139d161a5f 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesImpl.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/RulesImpl.java @@ -64,10 +64,14 @@ public Rule call(RuleInner inner) { public Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName, String ruleName) { RulesInner client = this.inner(); return client.getAsync(resourceGroupName, namespaceName, topicName, subscriptionName, ruleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public Rule call(RuleInner inner) { - return wrapModel(inner); + public Observable call(RuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Rule)wrapModel(inner)); + } } }); } diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsImpl.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsImpl.java index 275987ab62fb..9dbc2c0612ec 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsImpl.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/SubscriptionsImpl.java @@ -64,10 +64,14 @@ public SBSubscription call(SBSubscriptionInner inner) { public Observable getAsync(String resourceGroupName, String namespaceName, String topicName, String subscriptionName) { SubscriptionsInner client = this.inner(); return client.getAsync(resourceGroupName, namespaceName, topicName, subscriptionName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SBSubscription call(SBSubscriptionInner inner) { - return wrapModel(inner); + public Observable call(SBSubscriptionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SBSubscription)wrapModel(inner)); + } } }); } diff --git a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsImpl.java b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsImpl.java index c74872e74fc4..bfe3b6bff2d2 100644 --- a/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsImpl.java +++ b/sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/TopicsImpl.java @@ -67,10 +67,14 @@ public SBTopic call(SBTopicInner inner) { public Observable getAsync(String resourceGroupName, String namespaceName, String topicName) { TopicsInner client = this.inner(); return client.getAsync(resourceGroupName, namespaceName, topicName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SBTopic call(SBTopicInner inner) { - return wrapModel(inner); + public Observable call(SBTopicInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SBTopic)wrapModel(inner)); + } } }); } @@ -107,10 +111,14 @@ private Observable getSBAuthorizationRuleInnerUsingTop public Observable getAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String topicName, String authorizationRuleName) { TopicsInner client = this.inner(); return client.getAuthorizationRuleAsync(resourceGroupName, namespaceName, topicName, authorizationRuleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public TopicNamespaceSBAuthorizationRule call(SBAuthorizationRuleInner inner) { - return wrapTopicNamespaceSBAuthorizationRuleModel(inner); + public Observable call(SBAuthorizationRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((TopicNamespaceSBAuthorizationRule)wrapTopicNamespaceSBAuthorizationRuleModel(inner)); + } } }); }