Virtual Machines - Restart Hosts
Menghidupkan ulang host kluster HDInsight yang ditentukan.
Dalam artikel ini
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts?api-version=2021-06-01
Parameter URI
Name
In
Required
Type
Description
clusterName
path
True
Nama kluster.
resourceGroupName
path
True
Nama grup sumber daya.
subscriptionId
path
True
Info masuk langganan yang secara unik mengidentifikasi langganan Microsoft Azure. ID langganan membentuk bagian dari URI untuk setiap panggilan layanan.
api-version
query
True
Versi API klien HDInsight.
Isi Permintaan
Name
Type
Description
hosts
Daftar host yang akan dimulai ulang
Respons
Name
Type
Description
200 OK
Definisi respons OK.
202 Accepted
Definisi respons yang diterima.
Other Status Codes
Respons kesalahan yang menjelaskan mengapa operasi gagal.
Keamanan
azure_auth
Azure Active Directory Flow OAuth2
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name
Description
user_impersonation
meniru akun pengguna Anda
Contoh
Restarts the specified HDInsight cluster hosts.
Sample Request
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/restartHosts?api-version=2021-06-01
[
"gateway1",
"gateway3"
]
import com.azure.core.util.Context;
import java.util.Arrays;
/** Samples for VirtualMachines RestartHosts. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/RestartVirtualMachinesOperation.json
*/
/**
* Sample code: Restarts the specified HDInsight cluster hosts.
*
* @param manager Entry point to HDInsightManager.
*/
public static void restartsTheSpecifiedHDInsightClusterHosts(
com.azure.resourcemanager.hdinsight.HDInsightManager manager) {
manager.virtualMachines().restartHosts("rg1", "cluster1", Arrays.asList("gateway1", "gateway3"), Context.NONE);
}
}
Read this SDK documentation on how to add the SDK to your project and authenticate.
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/RestartVirtualMachinesOperation.json
func ExampleVirtualMachinesClient_BeginRestartHosts() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armhdinsight.NewVirtualMachinesClient("subid", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := client.BeginRestartHosts(ctx,
"rg1",
"cluster1",
[]*string{
to.Ptr("gateway1"),
to.Ptr("gateway3")},
nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
Read this SDK documentation on how to add the SDK to your project and authenticate.
Sample Response
location: https://management.azure.com/subscriptions/subid/providers/Microsoft.HDInsight/pathToOperationResult
location: https://management.azure.com/subscriptions/subid/providers/Microsoft.HDInsight/pathToOperationResult
Definisi
ErrorResponse
Menjelaskan format respons Kesalahan.
Name
Type
Description
code
Kode kesalahan
message
Pesan kesalahan yang menunjukkan mengapa operasi gagal.