com.azure.resourcemanager.hdinsight.implementation.VirtualMachinesImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hdinsight Show documentation
Show all versions of azure-resourcemanager-hdinsight Show documentation
This package contains Microsoft Azure SDK for HDInsight Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Management Client. Package tag package-2024-08-preview.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.hdinsight.implementation;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.hdinsight.fluent.VirtualMachinesClient;
import com.azure.resourcemanager.hdinsight.fluent.models.AsyncOperationResultInner;
import com.azure.resourcemanager.hdinsight.fluent.models.HostInfoInner;
import com.azure.resourcemanager.hdinsight.models.AsyncOperationResult;
import com.azure.resourcemanager.hdinsight.models.HostInfo;
import com.azure.resourcemanager.hdinsight.models.VirtualMachines;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public final class VirtualMachinesImpl implements VirtualMachines {
private static final ClientLogger LOGGER = new ClientLogger(VirtualMachinesImpl.class);
private final VirtualMachinesClient innerClient;
private final com.azure.resourcemanager.hdinsight.HDInsightManager serviceManager;
public VirtualMachinesImpl(VirtualMachinesClient innerClient,
com.azure.resourcemanager.hdinsight.HDInsightManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public Response> listHostsWithResponse(String resourceGroupName, String clusterName,
Context context) {
Response> inner
= this.serviceClient().listHostsWithResponse(resourceGroupName, clusterName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
inner.getValue()
.stream()
.map(inner1 -> new HostInfoImpl(inner1, this.manager()))
.collect(Collectors.toList()));
} else {
return null;
}
}
public List listHosts(String resourceGroupName, String clusterName) {
List inner = this.serviceClient().listHosts(resourceGroupName, clusterName);
if (inner != null) {
return Collections.unmodifiableList(
inner.stream().map(inner1 -> new HostInfoImpl(inner1, this.manager())).collect(Collectors.toList()));
} else {
return Collections.emptyList();
}
}
public void restartHosts(String resourceGroupName, String clusterName, List hosts) {
this.serviceClient().restartHosts(resourceGroupName, clusterName, hosts);
}
public void restartHosts(String resourceGroupName, String clusterName, List hosts, Context context) {
this.serviceClient().restartHosts(resourceGroupName, clusterName, hosts, context);
}
public Response getAsyncOperationStatusWithResponse(String resourceGroupName,
String clusterName, String operationId, Context context) {
Response inner = this.serviceClient()
.getAsyncOperationStatusWithResponse(resourceGroupName, clusterName, operationId, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new AsyncOperationResultImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public AsyncOperationResult getAsyncOperationStatus(String resourceGroupName, String clusterName,
String operationId) {
AsyncOperationResultInner inner
= this.serviceClient().getAsyncOperationStatus(resourceGroupName, clusterName, operationId);
if (inner != null) {
return new AsyncOperationResultImpl(inner, this.manager());
} else {
return null;
}
}
private VirtualMachinesClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.hdinsight.HDInsightManager manager() {
return this.serviceManager;
}
}