diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Services.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Services.java index 4987a4293efa..bfec1f068a1c 100644 --- a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Services.java +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Services.java @@ -14,13 +14,14 @@ import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; import rx.Observable; import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.ServicesInner; import com.microsoft.azure.arm.model.HasInner; /** * Type representing Services. */ -public interface Services extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, HasInner { +public interface Services extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { /** * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). * diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesImpl.java index 8f1322ec711e..df6f410e5bd3 100644 --- a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesImpl.java +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesImpl.java @@ -97,6 +97,30 @@ public SearchService call(SearchServiceInner inner) { }); } + @Override + public PagedList list() { + ServicesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ServicesInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public SearchService call(SearchServiceInner inner) { + return wrapModel(inner); + } + }); + } + @Override public SearchServiceImpl define(String name) { return wrapModel(name); diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesInner.java index d0b5575244a6..f42279671768 100644 --- a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesInner.java +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesInner.java @@ -10,6 +10,7 @@ import com.microsoft.azure.arm.collection.InnerSupportsGet; import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; @@ -43,7 +44,7 @@ * An instance of this class provides access to all the operations defined * in Services. */ -public class ServicesInner implements InnerSupportsGet, InnerSupportsDelete { +public class ServicesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { /** The Retrofit service to perform REST calls. */ private ServicesService service; /** The service client containing this operation class. */ @@ -89,6 +90,10 @@ interface ServicesService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices") Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services checkNameAvailability" }) @POST("subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability") Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Body CheckNameAvailabilityInput checkNameAvailabilityInput, @Header("User-Agent") String userAgent); @@ -1176,6 +1181,172 @@ private ServiceResponse> listByResourceGroupDelegat .build(response); } + /** + * Gets a list of all Search services in the given subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @return the observable to the List<SearchServiceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @return the observable to the List<SearchServiceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + 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 SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the PagedList object if successful. + */ + public PagedList list(SearchManagementRequestOptions searchManagementRequestOptions) { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync(searchManagementRequestOptions).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param searchManagementRequestOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(searchManagementRequestOptions), serviceCallback); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the observable to the List<SearchServiceInner> object + */ + public Observable> listAsync(SearchManagementRequestOptions searchManagementRequestOptions) { + return listWithServiceResponseAsync(searchManagementRequestOptions).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the observable to the List<SearchServiceInner> object + */ + public Observable>> listWithServiceResponseAsync(SearchManagementRequestOptions searchManagementRequestOptions) { + 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."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). *