diff --git a/sdk/hdinsight/mgmt-v2018_06_01_preview/pom.xml b/sdk/hdinsight/mgmt-v2018_06_01_preview/pom.xml
index d80e5051a173c..3befdcfee2e13 100644
--- a/sdk/hdinsight/mgmt-v2018_06_01_preview/pom.xml
+++ b/sdk/hdinsight/mgmt-v2018_06_01_preview/pom.xml
@@ -11,11 +11,11 @@
com.microsoft.azure
azure-arm-parent
- 1.2.0
+ 1.1.0
../../../pom.management.xml
azure-mgmt-hdinsight
- 1.3.1
+ 1.0.0-beta
jar
Microsoft Azure SDK for HDInsight Management
This package contains Microsoft HDInsight Management SDK.
diff --git a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/HostInfo.java b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/HostInfo.java
new file mode 100644
index 0000000000000..61a80ab75053d
--- /dev/null
+++ b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/HostInfo.java
@@ -0,0 +1,43 @@
+/**
+ * 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.hdinsight.v2018_06_01_preview;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The cluster host information.
+ */
+public class HostInfo {
+ /**
+ * The host name.
+ */
+ @JsonProperty(value = "name")
+ private String name;
+
+ /**
+ * Get the host name.
+ *
+ * @return the name value
+ */
+ public String name() {
+ return this.name;
+ }
+
+ /**
+ * Set the host name.
+ *
+ * @param name the name value to set
+ * @return the HostInfo object itself.
+ */
+ public HostInfo withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+}
diff --git a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/HostInfoListResult.java b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/HostInfoListResult.java
new file mode 100644
index 0000000000000..eff76e93aa0cf
--- /dev/null
+++ b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/HostInfoListResult.java
@@ -0,0 +1,26 @@
+/**
+ * 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.hdinsight.v2018_06_01_preview;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation.HDInsightManager;
+import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation.HostInfoListResultInner;
+import java.util.List;
+
+/**
+ * Type representing HostInfoListResult.
+ */
+public interface HostInfoListResult extends HasInner, HasManager {
+ /**
+ * @return the value value.
+ */
+ List value();
+
+}
diff --git a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VirtualMachines.java b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VirtualMachines.java
new file mode 100644
index 0000000000000..93fc52d4f5b5e
--- /dev/null
+++ b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VirtualMachines.java
@@ -0,0 +1,42 @@
+/**
+ * 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.hdinsight.v2018_06_01_preview;
+
+import rx.Completable;
+import rx.Observable;
+import java.util.List;
+import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation.VirtualMachinesInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing VirtualMachines.
+ */
+public interface VirtualMachines extends HasInner {
+ /**
+ * Lists the HDInsight clusters hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable listHostsAsync(String resourceGroupName, String clusterName);
+
+ /**
+ * Restarts the specified HDInsight cluster hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @param hosts The list of hosts to restart
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Completable restartHostsAsync(String resourceGroupName, String clusterName, List hosts);
+
+}
diff --git a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HDInsightManagementClientImpl.java b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HDInsightManagementClientImpl.java
index 969d8f76cf069..d0d8b6ff7a3a4 100644
--- a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HDInsightManagementClientImpl.java
+++ b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HDInsightManagementClientImpl.java
@@ -236,6 +236,19 @@ public OperationsInner operations() {
return this.operations;
}
+ /**
+ * The VirtualMachinesInner object to access its operations.
+ */
+ private VirtualMachinesInner virtualMachines;
+
+ /**
+ * Gets the VirtualMachinesInner object to access its operations.
+ * @return the VirtualMachinesInner object.
+ */
+ public VirtualMachinesInner virtualMachines() {
+ return this.virtualMachines;
+ }
+
/**
* Initializes an instance of HDInsightManagementClient client.
*
@@ -279,6 +292,7 @@ protected void initialize() {
this.scriptActions = new ScriptActionsInner(restClient().retrofit(), this);
this.scriptExecutionHistorys = new ScriptExecutionHistorysInner(restClient().retrofit(), this);
this.operations = new OperationsInner(restClient().retrofit(), this);
+ this.virtualMachines = new VirtualMachinesInner(restClient().retrofit(), this);
this.azureClient = new AzureClient(this);
}
diff --git a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HDInsightManager.java b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HDInsightManager.java
index ce22fb29a7680..b884e3f944b76 100644
--- a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HDInsightManager.java
+++ b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HDInsightManager.java
@@ -24,6 +24,7 @@
import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ScriptActions;
import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ScriptExecutionHistorys;
import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.Operations;
+import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VirtualMachines;
import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl;
import com.microsoft.azure.arm.resources.implementation.ManagerCore;
@@ -39,6 +40,7 @@ public final class HDInsightManager extends ManagerCore implements HostInfoListResult {
+ private final HDInsightManager manager;
+ HostInfoListResultImpl(HostInfoListResultInner inner, HDInsightManager manager) {
+ super(inner);
+ this.manager = manager;
+ }
+
+ @Override
+ public HDInsightManager manager() {
+ return this.manager;
+ }
+
+ @Override
+ public List value() {
+ return this.inner().value();
+ }
+
+}
diff --git a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HostInfoListResultInner.java b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HostInfoListResultInner.java
new file mode 100644
index 0000000000000..1f7c7672e1c3a
--- /dev/null
+++ b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/HostInfoListResultInner.java
@@ -0,0 +1,45 @@
+/**
+ * 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.hdinsight.v2018_06_01_preview.implementation;
+
+import java.util.List;
+import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.HostInfo;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Result of the request to list cluster hosts.
+ */
+public class HostInfoListResultInner {
+ /**
+ * The list of cluster hosts.
+ */
+ @JsonProperty(value = "value")
+ private List value;
+
+ /**
+ * Get the list of cluster hosts.
+ *
+ * @return the value value
+ */
+ public List value() {
+ return this.value;
+ }
+
+ /**
+ * Set the list of cluster hosts.
+ *
+ * @param value the value value to set
+ * @return the HostInfoListResultInner object itself.
+ */
+ public HostInfoListResultInner withValue(List value) {
+ this.value = value;
+ return this;
+ }
+
+}
diff --git a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/VirtualMachinesImpl.java b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/VirtualMachinesImpl.java
new file mode 100644
index 0000000000000..d43a271f65438
--- /dev/null
+++ b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/VirtualMachinesImpl.java
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ * abc
+ */
+
+package com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation;
+
+import com.microsoft.azure.arm.model.implementation.WrapperImpl;
+import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VirtualMachines;
+import rx.Completable;
+import rx.functions.Func1;
+import rx.Observable;
+import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.HostInfoListResult;
+import java.util.List;
+
+class VirtualMachinesImpl extends WrapperImpl implements VirtualMachines {
+ private final HDInsightManager manager;
+
+ VirtualMachinesImpl(HDInsightManager manager) {
+ super(manager.inner().virtualMachines());
+ this.manager = manager;
+ }
+
+ public HDInsightManager manager() {
+ return this.manager;
+ }
+
+ @Override
+ public Observable listHostsAsync(String resourceGroupName, String clusterName) {
+ VirtualMachinesInner client = this.inner();
+ return client.listHostsAsync(resourceGroupName, clusterName)
+ .map(new Func1() {
+ @Override
+ public HostInfoListResult call(HostInfoListResultInner inner) {
+ return new HostInfoListResultImpl(inner, manager());
+ }
+ });
+ }
+
+ @Override
+ public Completable restartHostsAsync(String resourceGroupName, String clusterName, List hosts) {
+ VirtualMachinesInner client = this.inner();
+ return client.restartHostsAsync(resourceGroupName, clusterName, hosts).toCompletable();
+ }
+
+}
diff --git a/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/VirtualMachinesInner.java b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/VirtualMachinesInner.java
new file mode 100644
index 0000000000000..281d78b214e79
--- /dev/null
+++ b/sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/VirtualMachinesInner.java
@@ -0,0 +1,327 @@
+/**
+ * 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.hdinsight.v2018_06_01_preview.implementation;
+
+import retrofit2.Retrofit;
+import com.google.common.reflect.TypeToken;
+import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ErrorResponseException;
+import com.microsoft.rest.ServiceCallback;
+import com.microsoft.rest.ServiceFuture;
+import com.microsoft.rest.ServiceResponse;
+import com.microsoft.rest.Validator;
+import java.io.IOException;
+import java.util.List;
+import okhttp3.ResponseBody;
+import retrofit2.http.Body;
+import retrofit2.http.Header;
+import retrofit2.http.Headers;
+import retrofit2.http.Path;
+import retrofit2.http.POST;
+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 VirtualMachines.
+ */
+public class VirtualMachinesInner {
+ /** The Retrofit service to perform REST calls. */
+ private VirtualMachinesService service;
+ /** The service client containing this operation class. */
+ private HDInsightManagementClientImpl client;
+
+ /**
+ * Initializes an instance of VirtualMachinesInner.
+ *
+ * @param retrofit the Retrofit instance built from a Retrofit Builder.
+ * @param client the instance of the service client containing this operation class.
+ */
+ public VirtualMachinesInner(Retrofit retrofit, HDInsightManagementClientImpl client) {
+ this.service = retrofit.create(VirtualMachinesService.class);
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for VirtualMachines to be
+ * used by Retrofit to perform actually REST calls.
+ */
+ interface VirtualMachinesService {
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VirtualMachines listHosts" })
+ @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts")
+ Observable> listHosts(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @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.hdinsight.v2018_06_01_preview.VirtualMachines restartHosts" })
+ @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts")
+ Observable> restartHosts(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body List hosts, @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.hdinsight.v2018_06_01_preview.VirtualMachines beginRestartHosts" })
+ @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts")
+ Observable> beginRestartHosts(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body List hosts, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ }
+
+ /**
+ * Lists the HDInsight clusters hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @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 HostInfoListResultInner object if successful.
+ */
+ public HostInfoListResultInner listHosts(String resourceGroupName, String clusterName) {
+ return listHostsWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
+ }
+
+ /**
+ * Lists the HDInsight clusters hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @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 listHostsAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) {
+ return ServiceFuture.fromResponse(listHostsWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback);
+ }
+
+ /**
+ * Lists the HDInsight clusters hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the HostInfoListResultInner object
+ */
+ public Observable listHostsAsync(String resourceGroupName, String clusterName) {
+ return listHostsWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, HostInfoListResultInner>() {
+ @Override
+ public HostInfoListResultInner call(ServiceResponse response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Lists the HDInsight clusters hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the HostInfoListResultInner object
+ */
+ public Observable> listHostsWithServiceResponseAsync(String resourceGroupName, String clusterName) {
+ if (this.client.subscriptionId() == null) {
+ throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
+ }
+ if (resourceGroupName == null) {
+ throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
+ }
+ if (clusterName == null) {
+ throw new IllegalArgumentException("Parameter clusterName 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.listHosts(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
+ .flatMap(new Func1, Observable>>() {
+ @Override
+ public Observable> call(Response response) {
+ try {
+ ServiceResponse clientResponse = listHostsDelegate(response);
+ return Observable.just(clientResponse);
+ } catch (Throwable t) {
+ return Observable.error(t);
+ }
+ }
+ });
+ }
+
+ private ServiceResponse listHostsDelegate(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);
+ }
+
+ /**
+ * Restarts the specified HDInsight cluster hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @param hosts The list of hosts to restart
+ * @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
+ */
+ public void restartHosts(String resourceGroupName, String clusterName, List hosts) {
+ restartHostsWithServiceResponseAsync(resourceGroupName, clusterName, hosts).toBlocking().last().body();
+ }
+
+ /**
+ * Restarts the specified HDInsight cluster hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @param hosts The list of hosts to restart
+ * @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 restartHostsAsync(String resourceGroupName, String clusterName, List hosts, final ServiceCallback serviceCallback) {
+ return ServiceFuture.fromResponse(restartHostsWithServiceResponseAsync(resourceGroupName, clusterName, hosts), serviceCallback);
+ }
+
+ /**
+ * Restarts the specified HDInsight cluster hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @param hosts The list of hosts to restart
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ public Observable restartHostsAsync(String resourceGroupName, String clusterName, List hosts) {
+ return restartHostsWithServiceResponseAsync(resourceGroupName, clusterName, hosts).map(new Func1, Void>() {
+ @Override
+ public Void call(ServiceResponse response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Restarts the specified HDInsight cluster hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @param hosts The list of hosts to restart
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ public Observable> restartHostsWithServiceResponseAsync(String resourceGroupName, String clusterName, List hosts) {
+ if (this.client.subscriptionId() == null) {
+ throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
+ }
+ if (resourceGroupName == null) {
+ throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
+ }
+ if (clusterName == null) {
+ throw new IllegalArgumentException("Parameter clusterName is required and cannot be null.");
+ }
+ if (this.client.apiVersion() == null) {
+ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
+ }
+ if (hosts == null) {
+ throw new IllegalArgumentException("Parameter hosts is required and cannot be null.");
+ }
+ Validator.validate(hosts);
+ Observable> observable = service.restartHosts(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), hosts, this.client.acceptLanguage(), this.client.userAgent());
+ return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType());
+ }
+
+ /**
+ * Restarts the specified HDInsight cluster hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @param hosts The list of hosts to restart
+ * @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
+ */
+ public void beginRestartHosts(String resourceGroupName, String clusterName, List hosts) {
+ beginRestartHostsWithServiceResponseAsync(resourceGroupName, clusterName, hosts).toBlocking().single().body();
+ }
+
+ /**
+ * Restarts the specified HDInsight cluster hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @param hosts The list of hosts to restart
+ * @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 beginRestartHostsAsync(String resourceGroupName, String clusterName, List hosts, final ServiceCallback serviceCallback) {
+ return ServiceFuture.fromResponse(beginRestartHostsWithServiceResponseAsync(resourceGroupName, clusterName, hosts), serviceCallback);
+ }
+
+ /**
+ * Restarts the specified HDInsight cluster hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @param hosts The list of hosts to restart
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the {@link ServiceResponse} object if successful.
+ */
+ public Observable beginRestartHostsAsync(String resourceGroupName, String clusterName, List hosts) {
+ return beginRestartHostsWithServiceResponseAsync(resourceGroupName, clusterName, hosts).map(new Func1, Void>() {
+ @Override
+ public Void call(ServiceResponse response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Restarts the specified HDInsight cluster hosts.
+ *
+ * @param resourceGroupName The name of the resource group.
+ * @param clusterName The name of the cluster.
+ * @param hosts The list of hosts to restart
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the {@link ServiceResponse} object if successful.
+ */
+ public Observable> beginRestartHostsWithServiceResponseAsync(String resourceGroupName, String clusterName, List hosts) {
+ if (this.client.subscriptionId() == null) {
+ throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
+ }
+ if (resourceGroupName == null) {
+ throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
+ }
+ if (clusterName == null) {
+ throw new IllegalArgumentException("Parameter clusterName is required and cannot be null.");
+ }
+ if (this.client.apiVersion() == null) {
+ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
+ }
+ if (hosts == null) {
+ throw new IllegalArgumentException("Parameter hosts is required and cannot be null.");
+ }
+ Validator.validate(hosts);
+ return service.beginRestartHosts(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), hosts, this.client.acceptLanguage(), this.client.userAgent())
+ .flatMap(new Func1, Observable>>() {
+ @Override
+ public Observable> call(Response response) {
+ try {
+ ServiceResponse clientResponse = beginRestartHostsDelegate(response);
+ return Observable.just(clientResponse);
+ } catch (Throwable t) {
+ return Observable.error(t);
+ }
+ }
+ });
+ }
+
+ private ServiceResponse beginRestartHostsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException {
+ return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
+ .register(200, new TypeToken() { }.getType())
+ .register(202, new TypeToken() { }.getType())
+ .registerError(ErrorResponseException.class)
+ .build(response);
+ }
+
+}