Reinicia un servidor.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart?api-version=2022-12-01
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
resourceGroupName
|
path |
True
|
string
|
Nombre del grupo de recursos. El nombre distingue mayúsculas de minúsculas.
|
serverName
|
path |
True
|
string
|
El nombre del servidor.
Patrón de Regex: ^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*
|
subscriptionId
|
path |
True
|
string
|
Identificador de la suscripción de destino.
|
api-version
|
query |
True
|
string
|
Versión de API que se usará para la operación.
|
Cuerpo de la solicitud
Nombre |
Tipo |
Description |
failoverMode
|
FailoverMode
|
Modo de conmutación por error.
|
restartWithFailover
|
boolean
|
Indica si se debe reiniciar el servidor con conmutación por error.
|
Respuestas
Nombre |
Tipo |
Description |
200 OK
|
|
Aceptar
|
202 Accepted
|
|
Aceptado
Encabezados
Location: string
|
Other Status Codes
|
ErrorResponse
|
Respuesta de error que describe el motivo del error de la operación.
|
Seguridad
azure_auth
Flujo OAuth2 de Azure Active Directory
Tipo:
oauth2
Flujo:
implicit
Dirección URL de autorización:
https://login.microsoftonline.com/common/oauth2/authorize
Ámbitos
Nombre |
Description |
user_impersonation
|
suplantación de su cuenta de usuario
|
Ejemplos
ServerRestart
Solicitud de ejemplo
POST https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/restart?api-version=2022-12-01
/** Samples for Servers Restart. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-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, com.azure.core.util.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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/75ece9197dbac70ac0ba651c53a79c1841944be2/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerRestart.json
func ExampleServersClient_BeginRestart_serverRestart() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().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/2022-12-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
Respuesta de muestra
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/southeastasia/azureAsyncOperation/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2022-12-01
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/southeastasia/operationResults/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2022-12-01
ServerRestartWithFailover
Solicitud de ejemplo
POST https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver/restart?api-version=2022-12-01
{
"restartWithFailover": true,
"failoverMode": "ForcedFailover"
}
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/2022-12-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),
com.azure.core.util.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/75ece9197dbac70ac0ba651c53a79c1841944be2/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerRestartWithFailover.json
func ExampleServersClient_BeginRestart_serverRestartWithFailover() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginRestart(ctx, "testrg", "testserver", &armpostgresqlflexibleservers.ServersClientBeginRestartOptions{Parameters: &armpostgresqlflexibleservers.RestartParameter{
FailoverMode: to.Ptr(armpostgresqlflexibleservers.FailoverModeForcedFailover),
RestartWithFailover: to.Ptr(true),
},
})
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/2022-12-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
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_restart_with_failover.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = PostgreSQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_restart(
resource_group_name="testrg",
server_name="testserver",
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerRestartWithFailover.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/southeastasia/azureAsyncOperation/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2022-12-01
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforPostgreSQL/locations/southeastasia/operationResults/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2022-12-01
Definiciones
ErrorAdditionalInfo
Información adicional sobre el error de administración de recursos.
Nombre |
Tipo |
Description |
info
|
object
|
Información adicional.
|
type
|
string
|
Tipo de información adicional.
|
ErrorDetail
Detalle del error.
Nombre |
Tipo |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Información adicional del error.
|
code
|
string
|
Código de error.
|
details
|
ErrorDetail[]
|
Los detalles del error.
|
message
|
string
|
El mensaje de error.
|
target
|
string
|
Destino del error.
|
ErrorResponse
Respuesta de error
Nombre |
Tipo |
Description |
error
|
ErrorDetail
|
Objeto de error.
|
FailoverMode
Modo de conmutación por error.
Nombre |
Tipo |
Description |
ForcedFailover
|
string
|
|
ForcedSwitchover
|
string
|
|
PlannedFailover
|
string
|
|
PlannedSwitchover
|
string
|
|
RestartParameter
Representa los parámetros de reinicio del servidor.
Nombre |
Tipo |
Description |
failoverMode
|
FailoverMode
|
Modo de conmutación por error.
|
restartWithFailover
|
boolean
|
Indica si se debe reiniciar el servidor con conmutación por error.
|