diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/MessagingRegionsProperties.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/MessagingRegionsProperties.java new file mode 100644 index 00000000000..f81fbd568bb --- /dev/null +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/MessagingRegionsProperties.java @@ -0,0 +1,47 @@ +/** + * 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.eventhub; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MessagingRegionsProperties model. + */ +public class MessagingRegionsProperties { + /** + * Region code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Full name of the region. + */ + @JsonProperty(value = "fullName", access = JsonProperty.Access.WRITE_ONLY) + private String fullName; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the fullName value. + * + * @return the fullName value + */ + public String fullName() { + return this.fullName; + } + +} diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ArmDisasterRecoveryInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ArmDisasterRecoveryInner.java index 65dd2d3c930..76a5d532adc 100644 --- a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ArmDisasterRecoveryInner.java +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ArmDisasterRecoveryInner.java @@ -12,12 +12,13 @@ import com.microsoft.azure.management.eventhub.RoleDisasterRecovery; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; /** * Single item in List or Get Alias(Disaster Recovery configuration) operation. */ @JsonFlatten -public class ArmDisasterRecoveryInner extends NestedResourceInner { +public class ArmDisasterRecoveryInner extends Resource { /** * Provisioning state of the Alias(Disaster Recovery configuration) - * possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/AuthorizationRuleInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/AuthorizationRuleInner.java index faf22fdb350..2ffe95ff6e4 100644 --- a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/AuthorizationRuleInner.java +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/AuthorizationRuleInner.java @@ -12,12 +12,13 @@ import com.microsoft.azure.management.eventhub.AccessRights; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; /** * Single item in a List or Get AuthorizationRule operation. */ @JsonFlatten -public class AuthorizationRuleInner extends NestedResourceInner { +public class AuthorizationRuleInner extends Resource { /** * The rights associated with the rule. */ diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ConsumerGroupInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ConsumerGroupInner.java index 9bee470ac67..54404c992d8 100644 --- a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ConsumerGroupInner.java +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ConsumerGroupInner.java @@ -11,12 +11,13 @@ import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; /** * Single item in List or Get Consumer group operation. */ @JsonFlatten -public class ConsumerGroupInner extends NestedResourceInner { +public class ConsumerGroupInner extends Resource { /** * Exact time the message was created. */ diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ConsumerGroupsInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ConsumerGroupsInner.java index b3ff3fdaf8b..23a5eca762f 100644 --- a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ConsumerGroupsInner.java +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/ConsumerGroupsInner.java @@ -74,7 +74,7 @@ interface ConsumerGroupsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhub.ConsumerGroups listByEventHub" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups") - Observable> listByEventHub(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> listByEventHub(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("eventHubName") String eventHubName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.eventhub.ConsumerGroups listByEventHubNext" }) @GET @@ -569,16 +569,152 @@ public Observable>> call(ServiceRespons }); } + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConsumerGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEventHubSinglePageAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + 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 (eventHubName == null) { + throw new IllegalArgumentException("Parameter eventHubName 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."); + } + final Integer skip = null; + final Integer top = null; + return service.listByEventHub(resourceGroupName, namespaceName, eventHubName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEventHubDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @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<ConsumerGroupInner> object if successful. + */ + public PagedList listByEventHub(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top) { + ServiceResponse> response = listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEventHubNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @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> listByEventHubAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEventHubNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConsumerGroupInner> object + */ + public Observable> listByEventHubAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top) { + return listByEventHubWithServiceResponseAsync(resourceGroupName, namespaceName, eventHubName, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @param eventHubName The Event Hub name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConsumerGroupInner> object + */ + public Observable>> listByEventHubWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top) { + return listByEventHubSinglePageAsync(resourceGroupName, namespaceName, eventHubName, skip, top) + .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(listByEventHubNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + /** * Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists in the Namespace. * ServiceResponse> * @param resourceGroupName Name of the resource group within the azure subscription. ServiceResponse> * @param namespaceName The Namespace name ServiceResponse> * @param eventHubName The Event Hub name + ServiceResponse> * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ConsumerGroupInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByEventHubSinglePageAsync(final String resourceGroupName, final String namespaceName, final String eventHubName) { + public Observable>> listByEventHubSinglePageAsync(final String resourceGroupName, final String namespaceName, final String eventHubName, final Integer skip, final Integer top) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -594,7 +730,7 @@ public Observable>> listByEventHubSingl if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.listByEventHub(resourceGroupName, namespaceName, eventHubName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.listByEventHub(resourceGroupName, namespaceName, eventHubName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EHNamespaceInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EHNamespaceInner.java index e8c5bba7938..fe9ac071069 100644 --- a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EHNamespaceInner.java +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EHNamespaceInner.java @@ -8,7 +8,6 @@ package com.microsoft.azure.management.eventhub.implementation; -import com.microsoft.azure.Resource; import com.microsoft.azure.management.eventhub.Sku; import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; @@ -18,7 +17,7 @@ * Single Namespace item in List or Get Operation. */ @JsonFlatten -public class EHNamespaceInner extends Resource { +public class EHNamespaceInner extends TrackedResourceInner { /** * Properties of sku resource. */ diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventHubManagementClientImpl.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventHubManagementClientImpl.java index 96670a46a4c..27dcff17f42 100644 --- a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventHubManagementClientImpl.java +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventHubManagementClientImpl.java @@ -197,6 +197,19 @@ public ConsumerGroupsInner consumerGroups() { return this.consumerGroups; } + /** + * The RegionsInner object to access its operations. + */ + private RegionsInner regions; + + /** + * Gets the RegionsInner object to access its operations. + * @return the RegionsInner object. + */ + public RegionsInner regions() { + return this.regions; + } + /** * Initializes an instance of EventHubManagementClient client. * @@ -237,6 +250,7 @@ protected void initialize() { this.disasterRecoveryConfigs = new DisasterRecoveryConfigsInner(restClient().retrofit(), this); this.eventHubs = new EventHubsInner(restClient().retrofit(), this); this.consumerGroups = new ConsumerGroupsInner(restClient().retrofit(), this); + this.regions = new RegionsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventHubsInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventHubsInner.java index 06ccbd67e58..98afdbeb8b6 100644 --- a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventHubsInner.java +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventHubsInner.java @@ -65,7 +65,7 @@ public EventHubsInner(Retrofit retrofit, EventHubManagementClientImpl client) { interface EventHubsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhub.EventHubs listByNamespace" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs") - Observable> listByNamespace(@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); + Observable> listByNamespace(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.eventhub.EventHubs createOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}") @@ -194,15 +194,143 @@ public Observable>> call(ServiceResponse>> listByNamespaceSinglePageAsync(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."); + } + final Integer skip = null; + final Integer top = null; + return service.listByNamespace(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByNamespaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @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<EventhubInner> object if successful. + */ + public PagedList listByNamespace(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + ServiceResponse> response = listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @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> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByNamespaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + return listByNamespaceWithServiceResponseAsync(resourceGroupName, namespaceName, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Event Hubs in a Namespace. + * + * @param resourceGroupName Name of the resource group within the azure subscription. + * @param namespaceName The Namespace name + * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventhubInner> object + */ + public Observable>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { + return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName, skip, top) + .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(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + /** * Gets all the Event Hubs in a Namespace. * ServiceResponse> * @param resourceGroupName Name of the resource group within the azure subscription. ServiceResponse> * @param namespaceName The Namespace name + ServiceResponse> * @param skip Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skip parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<EventhubInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByNamespaceSinglePageAsync(final String resourceGroupName, final String namespaceName) { + public Observable>> listByNamespaceSinglePageAsync(final String resourceGroupName, final String namespaceName, final Integer skip, final Integer top) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -215,7 +343,7 @@ public Observable>> listByNamespaceSinglePag if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.listByNamespace(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.listByNamespace(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), skip, top, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventhubInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventhubInner.java index 89202b6c439..488ccded263 100644 --- a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventhubInner.java +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/EventhubInner.java @@ -14,12 +14,13 @@ import com.microsoft.azure.management.eventhub.CaptureDescription; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; /** * Single item in List or Get Event Hub operation. */ @JsonFlatten -public class EventhubInner extends NestedResourceInner { +public class EventhubInner extends Resource { /** * Current number of shards on the Event Hub. */ diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/MessagingPlanInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/MessagingPlanInner.java new file mode 100644 index 00000000000..43d1d212270 --- /dev/null +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/MessagingPlanInner.java @@ -0,0 +1,80 @@ +/** + * 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.eventhub.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Messaging Plan for the namespace. + */ +@JsonFlatten +public class MessagingPlanInner extends TrackedResourceInner { + /** + * Sku type. + */ + @JsonProperty(value = "properties.sku", access = JsonProperty.Access.WRITE_ONLY) + private Integer sku; + + /** + * Selected event hub unit. + */ + @JsonProperty(value = "properties.selectedEventHubUnit", access = JsonProperty.Access.WRITE_ONLY) + private Integer selectedEventHubUnit; + + /** + * The exact time the messaging plan was updated. + */ + @JsonProperty(value = "properties.updatedAt", access = JsonProperty.Access.WRITE_ONLY) + private DateTime updatedAt; + + /** + * revision number. + */ + @JsonProperty(value = "properties.revision", access = JsonProperty.Access.WRITE_ONLY) + private Long revision; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Integer sku() { + return this.sku; + } + + /** + * Get the selectedEventHubUnit value. + * + * @return the selectedEventHubUnit value + */ + public Integer selectedEventHubUnit() { + return this.selectedEventHubUnit; + } + + /** + * Get the updatedAt value. + * + * @return the updatedAt value + */ + public DateTime updatedAt() { + return this.updatedAt; + } + + /** + * Get the revision value. + * + * @return the revision value + */ + public Long revision() { + return this.revision; + } + +} diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/MessagingPlansInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/MessagingPlansInner.java new file mode 100644 index 00000000000..dffff1f6d2f --- /dev/null +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/MessagingPlansInner.java @@ -0,0 +1,146 @@ +/** + * 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.eventhub.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MessagingPlans. + */ +public class MessagingPlansInner { + /** The Retrofit service to perform REST calls. */ + private MessagingPlansService service; + /** The service client containing this operation class. */ + private EventHubManagementClientImpl client; + + /** + * Initializes an instance of MessagingPlansInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MessagingPlansInner(Retrofit retrofit, EventHubManagementClientImpl client) { + this.service = retrofit.create(MessagingPlansService.class); + this.client = client; + } + + /** + * The interface defining all the services for MessagingPlans to be + * used by Retrofit to perform actually REST calls. + */ + interface MessagingPlansService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhub.MessagingPlans get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/messagingplan") + Observable> get(@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); + + } + + /** + * Gets a description for the specified 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 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 MessagingPlanInner object if successful. + */ + public MessagingPlanInner get(String resourceGroupName, String namespaceName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Gets a description for the specified 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 getAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * Gets a description for the specified 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 MessagingPlanInner object + */ + public Observable getAsync(String resourceGroupName, String namespaceName) { + return getWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, MessagingPlanInner>() { + @Override + public MessagingPlanInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a description for the specified 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 MessagingPlanInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, 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.get(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 clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/MessagingRegionsInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/MessagingRegionsInner.java new file mode 100644 index 00000000000..de66ccf3167 --- /dev/null +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/MessagingRegionsInner.java @@ -0,0 +1,44 @@ +/** + * 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.eventhub.implementation; + +import com.microsoft.azure.management.eventhub.MessagingRegionsProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Messaging Region. + */ +public class MessagingRegionsInner extends TrackedResourceInner { + /** + * The properties property. + */ + @JsonProperty(value = "properties") + private MessagingRegionsProperties properties; + + /** + * Get the properties value. + * + * @return the properties value + */ + public MessagingRegionsProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the MessagingRegionsInner object itself. + */ + public MessagingRegionsInner withProperties(MessagingRegionsProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/NamespacesInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/NamespacesInner.java index 3acbd1089e2..21a4c7a6185 100644 --- a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/NamespacesInner.java +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/NamespacesInner.java @@ -104,6 +104,10 @@ interface NamespacesService { @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}") Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Body EHNamespaceInner parameters, @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.eventhub.Namespaces getMessagingPlan" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/messagingplan") + Observable> getMessagingPlan(@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.eventhub.Namespaces listAuthorizationRules" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules") Observable> listAuthorizationRules(@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); @@ -956,6 +960,92 @@ private ServiceResponse updateDelegate(Response .build(response); } + /** + * Gets messaging plan for specified 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 MessagingPlanInner object if successful. + */ + public MessagingPlanInner getMessagingPlan(String resourceGroupName, String namespaceName) { + return getMessagingPlanWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Gets messaging plan for specified 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 getMessagingPlanAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getMessagingPlanWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * Gets messaging plan for specified 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 MessagingPlanInner object + */ + public Observable getMessagingPlanAsync(String resourceGroupName, String namespaceName) { + return getMessagingPlanWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, MessagingPlanInner>() { + @Override + public MessagingPlanInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets messaging plan for specified 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 MessagingPlanInner object + */ + public Observable> getMessagingPlanWithServiceResponseAsync(String resourceGroupName, 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.getMessagingPlan(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 clientResponse = getMessagingPlanDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMessagingPlanDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Gets a list of authorization rules for a Namespace. * diff --git a/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/RegionsInner.java b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/RegionsInner.java new file mode 100644 index 00000000000..b992d14f9b6 --- /dev/null +++ b/azure-mgmt-eventhub/src/main/java/com/microsoft/azure/management/eventhub/implementation/RegionsInner.java @@ -0,0 +1,295 @@ +/** + * 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.eventhub.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.eventhub.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Regions. + */ +public class RegionsInner { + /** The Retrofit service to perform REST calls. */ + private RegionsService service; + /** The service client containing this operation class. */ + private EventHubManagementClientImpl client; + + /** + * Initializes an instance of RegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RegionsInner(Retrofit retrofit, EventHubManagementClientImpl client) { + this.service = retrofit.create(RegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Regions to be + * used by Retrofit to perform actually REST calls. + */ + interface RegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.eventhub.Regions listBySku" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.EventHub/sku/{sku}/regions") + Observable> listBySku(@Path("subscriptionId") String subscriptionId, @Path("sku") String sku, @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.eventhub.Regions listBySkuNext" }) + @GET + Observable> listBySkuNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @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<MessagingRegionsInner> object if successful. + */ + public PagedList listBySku(final String sku) { + ServiceResponse> response = listBySkuSinglePageAsync(sku).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @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> listBySkuAsync(final String sku, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySkuSinglePageAsync(sku), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MessagingRegionsInner> object + */ + public Observable> listBySkuAsync(final String sku) { + return listBySkuWithServiceResponseAsync(sku) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MessagingRegionsInner> object + */ + public Observable>> listBySkuWithServiceResponseAsync(final String sku) { + return listBySkuSinglePageAsync(sku) + .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(listBySkuNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + ServiceResponse> * @param sku The sku type. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MessagingRegionsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySkuSinglePageAsync(final String sku) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (sku == null) { + throw new IllegalArgumentException("Parameter sku 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.listBySku(this.client.subscriptionId(), sku, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySkuDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySkuDelegate(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 the available Regions for a given sku. + * + * @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<MessagingRegionsInner> object if successful. + */ + public PagedList listBySkuNext(final String nextPageLink) { + ServiceResponse> response = listBySkuNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the available Regions for a given sku. + * + * @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> listBySkuNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySkuNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySkuNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the available Regions for a given sku. + * + * @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<MessagingRegionsInner> object + */ + public Observable> listBySkuNextAsync(final String nextPageLink) { + return listBySkuNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + * @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<MessagingRegionsInner> object + */ + public Observable>> listBySkuNextWithServiceResponseAsync(final String nextPageLink) { + return listBySkuNextSinglePageAsync(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(listBySkuNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the available Regions for a given sku. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MessagingRegionsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySkuNextSinglePageAsync(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.listBySkuNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySkuNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySkuNextDelegate(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); + } + +}