Servers - Restart
Riavvia un server.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart?api-version=2021-06-01
Parametri dell'URI
Nome
In
Necessario
Tipo
Descrizione
resourceGroupName
path
True
string
minLength: 1 maxLength: 90
Nome del gruppo di risorse. Il nome è insensibile alle maiuscole e minuscole.
serverName
path
True
string
Il nome del server.
subscriptionId
path
True
string
minLength: 1
ID della sottoscrizione di destinazione.
api-version
query
True
string
minLength: 1
Versione dell'API da usare per questa operazione.
Corpo della richiesta
Nome
Tipo
Descrizione
failoverMode
FailoverMode
Modalità di failover.
restartWithFailover
boolean
Indica se riavviare il server con failover.
Risposte
Nome
Tipo
Descrizione
200 OK
Va bene
202 Accepted
Accettato
Other Status Codes
CloudError
Risposta di errore che descrive il motivo per cui l'operazione non è riuscita.
Sicurezza
azure_auth
Flusso OAuth2 di Azure Active Directory
Tipo:
oauth2
Flow:
implicit
URL di autorizzazione:
https://login.microsoftonline.com/common/oauth2/authorize
Ambiti
Nome
Descrizione
user_impersonation
rappresentare l'account utente
Esempio
ServerRestart
Esempio di richiesta
POST https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/restart?api-version=2021-06-01
import com.azure.core.util.Context;
/** Samples for Servers Restart. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerRestart.json
*/
/**
* Sample code: ServerRestart.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void serverRestart(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager.servers().restart("testrg", "testserver", null, Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
package armpostgresqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerRestart.json
func ExampleServersClient_BeginRestart() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := client.BeginRestart(ctx,
"testrg",
"testserver",
&armpostgresqlflexibleservers.ServersClientBeginRestartOptions{Parameters: 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)
}
}
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Restarts a server.
*
* @summary Restarts a server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerRestart.json
*/
async function serverRestart() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "testrg";
const serverName = "testserver";
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginRestartAndWait(resourceGroupName, serverName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
ServerRestartWithFailover
Esempio di richiesta
POST https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/restart?api-version=2021-06-01
{
"restartWithFailover": true,
"failoverMode": "ForcedFailover"
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.postgresqlflexibleserver.models.FailoverMode;
import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter;
/** Samples for Servers Restart. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerRestartWithFailover.json
*/
/**
* Sample code: ServerRestartWithFailover.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void serverRestartWithFailover(
com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) {
manager
.servers()
.restart(
"testrg",
"testserver",
new RestartParameter().withRestartWithFailover(true).withFailoverMode(FailoverMode.FORCED_FAILOVER),
Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementFlexibleServerClient } = require("@azure/arm-postgresql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Restarts a server.
*
* @summary Restarts a server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerRestartWithFailover.json
*/
async function serverRestartWithFailover() {
const subscriptionId =
process.env["POSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["POSTGRESQL_RESOURCE_GROUP"] || "testrg";
const serverName = "testserver";
const parameters = {
failoverMode: "ForcedFailover",
restartWithFailover: true,
};
const options = { parameters };
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginRestartAndWait(resourceGroupName, serverName, options);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
Definizioni
CloudError
Object
Risposta di errore dal servizio Batch.
Nome
Tipo
Descrizione
error
ErrorResponse
Risposta di errore
Risposta di errore comune per tutte le API di Azure Resource Manager per restituire i dettagli dell'errore per le operazioni non riuscite. Questo segue anche il formato di risposta di errore OData.
ErrorAdditionalInfo
Object
Informazioni aggiuntive sull'errore di gestione delle risorse.
Nome
Tipo
Descrizione
info
object
Informazioni aggiuntive.
type
string
Tipo di informazioni aggiuntive.
ErrorResponse
Object
Risposta di errore
Nome
Tipo
Descrizione
additionalInfo
ErrorAdditionalInfo []
Informazioni aggiuntive sull'errore.
code
string
Codice di errore.
details
ErrorResponse []
Dettagli dell'errore.
message
string
Messaggio di errore.
target
string
Destinazione dell'errore.
FailoverMode
Enumerazione
Modalità di failover.
Valore
Descrizione
PlannedFailover
ForcedFailover
PlannedSwitchover
ForcedSwitchover
RestartParameter
Object
Rappresenta i parametri di riavvio del server.
Nome
Tipo
Descrizione
failoverMode
FailoverMode
Modalità di failover.
restartWithFailover
boolean
Indica se riavviare il server con failover.