Создает новый сервер или перезапишет существующий сервер.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}?api-version=2017-12-01
Параметры URI
Имя |
В |
Обязательно |
Тип |
Описание |
resourceGroupName
|
path |
True
|
string
|
Имя группы ресурсов. Регистр букв в имени не учитывается.
|
serverName
|
path |
True
|
string
|
Имя сервера.
|
subscriptionId
|
path |
True
|
string
|
Идентификатор целевой подписки.
|
api-version
|
query |
True
|
string
|
Версия API, используемая для данной операции.
|
Текст запроса
Имя |
Обязательно |
Тип |
Описание |
location
|
True
|
string
|
Расположение, в котором находится ресурс.
|
properties
|
True
|
ServerPropertiesForCreate:
|
Свойства сервера.
|
identity
|
|
ResourceIdentity
|
Удостоверение сервера Azure Active Directory.
|
sku
|
|
Sku
|
Номер SKU (ценовая категория) сервера.
|
tags
|
|
object
|
Метаданные конкретного приложения в формате пар "ключ — значение".
|
Ответы
Имя |
Тип |
Описание |
200 OK
|
Server
|
ОК
|
201 Created
|
Server
|
Создание
|
202 Accepted
|
|
Принято
|
Other Status Codes
|
CloudError
|
Ответ об ошибке, описывающий причину сбоя операции.
|
Безопасность
azure_auth
Поток OAuth2 в Azure Active Directory
Тип:
oauth2
Flow:
implicit
URL-адрес авторизации:
https://login.microsoftonline.com/common/oauth2/authorize
Области
Имя |
Описание |
user_impersonation
|
олицетворения учетной записи пользователя
|
Примеры
Create a database as a point in time restore
Образец запроса
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/targetserver?api-version=2017-12-01
{
"location": "brazilsouth",
"properties": {
"restorePointInTime": "2017-12-14T00:00:37.467Z",
"createMode": "PointInTimeRestore",
"sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"
},
"sku": {
"name": "B_Gen5_2",
"tier": "Basic",
"capacity": 2,
"family": "Gen5"
},
"tags": {
"ElasticServer": "1"
}
}
import com.azure.resourcemanager.postgresql.models.ServerPropertiesForRestore;
import com.azure.resourcemanager.postgresql.models.Sku;
import com.azure.resourcemanager.postgresql.models.SkuTier;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json
*/
/**
* Sample code: Create a database as a point in time restore.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createADatabaseAsAPointInTimeRestore(
com.azure.resourcemanager.postgresql.PostgreSqlManager manager) {
manager
.servers()
.define("targetserver")
.withRegion("brazilsouth")
.withExistingResourceGroup("TargetResourceGroup")
.withProperties(
new ServerPropertiesForRestore()
.withSourceServerId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")
.withRestorePointInTime(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")))
.withTags(mapOf("ElasticServer", "1"))
.withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).withCapacity(2).withFamily("Gen5"))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_create_point_in_time_restore.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_create(
resource_group_name="TargetResourceGroup",
server_name="targetserver",
parameters={
"location": "brazilsouth",
"properties": {
"createMode": "PointInTimeRestore",
"restorePointInTime": "2017-12-14T00:00:37.467Z",
"sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver",
},
"sku": {"capacity": 2, "family": "Gen5", "name": "B_Gen5_2", "tier": "Basic"},
"tags": {"ElasticServer": "1"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.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
package armpostgresql_test
import (
"context"
"log"
"time"
"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/armpostgresql"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json
func ExampleServersClient_BeginCreate_createADatabaseAsAPointInTimeRestore() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresql.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TargetResourceGroup", "targetserver", armpostgresql.ServerForCreate{
Location: to.Ptr("brazilsouth"),
Properties: &armpostgresql.ServerPropertiesForRestore{
CreateMode: to.Ptr(armpostgresql.CreateModePointInTimeRestore),
RestorePointInTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-14T00:00:37.467Z"); return t }()),
SourceServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"),
},
SKU: &armpostgresql.SKU{
Name: to.Ptr("B_Gen5_2"),
Capacity: to.Ptr[int32](2),
Family: to.Ptr("Gen5"),
Tier: to.Ptr(armpostgresql.SKUTierBasic),
},
Tags: map[string]*string{
"ElasticServer": to.Ptr("1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresql.Server{
// Name: to.Ptr("targetserver"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/targetserver"),
// Location: to.Ptr("brazilsouth"),
// Tags: map[string]*string{
// "ElasticServer": to.Ptr("1"),
// },
// Properties: &armpostgresql.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-14T21:08:24.637Z"); return t}()),
// FullyQualifiedDomainName: to.Ptr("targetserver.postgres.database.azure.com"),
// SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled),
// StorageProfile: &armpostgresql.StorageProfile{
// BackupRetentionDays: to.Ptr[int32](7),
// GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled),
// StorageMB: to.Ptr[int32](128000),
// },
// UserVisibleState: to.Ptr(armpostgresql.ServerStateReady),
// Version: to.Ptr(armpostgresql.ServerVersionNine6),
// },
// SKU: &armpostgresql.SKU{
// Name: to.Ptr("B_Gen5_2"),
// Capacity: to.Ptr[int32](2),
// Family: to.Ptr("Gen5"),
// Tier: to.Ptr(armpostgresql.SKUTierBasic),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementClient } = require("@azure/arm-postgresql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new server, or will overwrite an existing server.
*
* @summary Creates a new server, or will overwrite an existing server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json
*/
async function createADatabaseAsAPointInTimeRestore() {
const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = "TargetResourceGroup";
const serverName = "targetserver";
const parameters = {
location: "brazilsouth",
properties: {
createMode: "PointInTimeRestore",
restorePointInTime: new Date("2017-12-14T00:00:37.467Z"),
sourceServerId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver",
},
sku: { name: "B_Gen5_2", capacity: 2, family: "Gen5", tier: "Basic" },
tags: { elasticServer: "1" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
createADatabaseAsAPointInTimeRestore().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.PostgreSql.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json
// this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "TargetResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlServerResource
PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
// invoke the operation
string serverName = "targetserver";
PostgreSqlServerCreateOrUpdateContent content = new PostgreSqlServerCreateOrUpdateContent(new PostgreSqlServerPropertiesForRestore(new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"), DateTimeOffset.Parse("2017-12-14T00:00:37.467Z")), new AzureLocation("brazilsouth"))
{
Sku = new PostgreSqlSku("B_Gen5_2")
{
Tier = PostgreSqlSkuTier.Basic,
Capacity = 2,
Family = "Gen5",
},
Tags =
{
["ElasticServer"] = "1",
},
};
ArmOperation<PostgreSqlServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, content);
PostgreSqlServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Пример ответа
{
"sku": {
"name": "B_Gen5_2",
"tier": "Basic",
"family": "Gen5",
"capacity": 2
},
"properties": {
"administratorLogin": "cloudsa",
"storageProfile": {
"storageMB": 128000,
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"version": "9.6",
"sslEnforcement": "Enabled",
"userVisibleState": "Ready",
"fullyQualifiedDomainName": "targetserver.postgres.database.azure.com",
"earliestRestoreDate": "2017-12-14T21:08:24.637+00:00"
},
"location": "brazilsouth",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/targetserver",
"name": "targetserver",
"type": "Microsoft.DBforPostgreSQL/servers"
}
{
"sku": {
"name": "B_Gen5_2",
"tier": "Basic",
"family": "Gen5",
"capacity": 2
},
"properties": {
"administratorLogin": "cloudsa",
"storageProfile": {
"storageMB": 128000,
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"version": "9.6",
"sslEnforcement": "Enabled",
"userVisibleState": "Ready",
"fullyQualifiedDomainName": "targetserver.postgres.database.azure.com",
"earliestRestoreDate": "2017-12-14T21:08:24.637+00:00"
},
"location": "brazilsouth",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/targetserver",
"name": "targetserver",
"type": "Microsoft.DBforPostgreSQL/servers"
}
Create a new server
Образец запроса
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4?api-version=2017-12-01
{
"location": "westus",
"properties": {
"administratorLogin": "cloudsa",
"administratorLoginPassword": "<administratorLoginPassword>",
"sslEnforcement": "Enabled",
"minimalTlsVersion": "TLS1_2",
"storageProfile": {
"storageMB": 128000,
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"createMode": "Default"
},
"sku": {
"name": "B_Gen5_2",
"tier": "Basic",
"capacity": 2,
"family": "Gen5"
},
"tags": {
"ElasticServer": "1"
}
}
import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup;
import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum;
import com.azure.resourcemanager.postgresql.models.ServerPropertiesForDefaultCreate;
import com.azure.resourcemanager.postgresql.models.Sku;
import com.azure.resourcemanager.postgresql.models.SkuTier;
import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum;
import com.azure.resourcemanager.postgresql.models.StorageProfile;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json
*/
/**
* Sample code: Create a new server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createANewServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) {
manager
.servers()
.define("pgtestsvc4")
.withRegion("westus")
.withExistingResourceGroup("TestGroup")
.withProperties(
new ServerPropertiesForDefaultCreate()
.withSslEnforcement(SslEnforcementEnum.ENABLED)
.withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2)
.withStorageProfile(
new StorageProfile()
.withBackupRetentionDays(7)
.withGeoRedundantBackup(GeoRedundantBackup.DISABLED)
.withStorageMB(128000))
.withAdministratorLogin("cloudsa")
.withAdministratorLoginPassword("<administratorLoginPassword>"))
.withTags(mapOf("ElasticServer", "1"))
.withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).withCapacity(2).withFamily("Gen5"))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_create.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_create(
resource_group_name="TestGroup",
server_name="pgtestsvc4",
parameters={
"location": "westus",
"properties": {
"administratorLogin": "cloudsa",
"administratorLoginPassword": "<administratorLoginPassword>",
"createMode": "Default",
"minimalTlsVersion": "TLS1_2",
"sslEnforcement": "Enabled",
"storageProfile": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled", "storageMB": 128000},
},
"sku": {"capacity": 2, "family": "Gen5", "name": "B_Gen5_2", "tier": "Basic"},
"tags": {"ElasticServer": "1"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.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
package armpostgresql_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/armpostgresql"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json
func ExampleServersClient_BeginCreate_createANewServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresql.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TestGroup", "pgtestsvc4", armpostgresql.ServerForCreate{
Location: to.Ptr("westus"),
Properties: &armpostgresql.ServerPropertiesForDefaultCreate{
CreateMode: to.Ptr(armpostgresql.CreateModeDefault),
MinimalTLSVersion: to.Ptr(armpostgresql.MinimalTLSVersionEnumTLS12),
SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled),
StorageProfile: &armpostgresql.StorageProfile{
BackupRetentionDays: to.Ptr[int32](7),
GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled),
StorageMB: to.Ptr[int32](128000),
},
AdministratorLogin: to.Ptr("cloudsa"),
AdministratorLoginPassword: to.Ptr("<administratorLoginPassword>"),
},
SKU: &armpostgresql.SKU{
Name: to.Ptr("B_Gen5_2"),
Capacity: to.Ptr[int32](2),
Family: to.Ptr("Gen5"),
Tier: to.Ptr(armpostgresql.SKUTierBasic),
},
Tags: map[string]*string{
"ElasticServer": to.Ptr("1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresql.Server{
// Name: to.Ptr("pgtestsvc4"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "ElasticServer": to.Ptr("1"),
// },
// Properties: &armpostgresql.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T21:08:24.637Z"); return t}()),
// FullyQualifiedDomainName: to.Ptr("pgtestsvc4.postgres.database.azure.com"),
// SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled),
// StorageProfile: &armpostgresql.StorageProfile{
// BackupRetentionDays: to.Ptr[int32](7),
// GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled),
// StorageMB: to.Ptr[int32](128000),
// },
// UserVisibleState: to.Ptr(armpostgresql.ServerStateReady),
// Version: to.Ptr(armpostgresql.ServerVersionNine6),
// },
// SKU: &armpostgresql.SKU{
// Name: to.Ptr("B_Gen5_2"),
// Capacity: to.Ptr[int32](2),
// Family: to.Ptr("Gen5"),
// Tier: to.Ptr(armpostgresql.SKUTierBasic),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementClient } = require("@azure/arm-postgresql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new server, or will overwrite an existing server.
*
* @summary Creates a new server, or will overwrite an existing server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json
*/
async function createANewServer() {
const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = "TestGroup";
const serverName = "pgtestsvc4";
const parameters = {
location: "westus",
properties: {
administratorLogin: "cloudsa",
administratorLoginPassword: "<administratorLoginPassword>",
createMode: "Default",
minimalTlsVersion: "TLS1_2",
sslEnforcement: "Enabled",
storageProfile: {
backupRetentionDays: 7,
geoRedundantBackup: "Disabled",
storageMB: 128000,
},
},
sku: { name: "B_Gen5_2", capacity: 2, family: "Gen5", tier: "Basic" },
tags: { elasticServer: "1" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
createANewServer().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.PostgreSql.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json
// this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "TestGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlServerResource
PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
// invoke the operation
string serverName = "pgtestsvc4";
PostgreSqlServerCreateOrUpdateContent content = new PostgreSqlServerCreateOrUpdateContent(new PostgreSqlServerPropertiesForDefaultCreate("cloudsa", "<administratorLoginPassword>")
{
SslEnforcement = PostgreSqlSslEnforcementEnum.Enabled,
MinimalTlsVersion = PostgreSqlMinimalTlsVersionEnum.Tls1_2,
StorageProfile = new PostgreSqlStorageProfile()
{
BackupRetentionDays = 7,
GeoRedundantBackup = PostgreSqlGeoRedundantBackup.Disabled,
StorageInMB = 128000,
},
}, new AzureLocation("westus"))
{
Sku = new PostgreSqlSku("B_Gen5_2")
{
Tier = PostgreSqlSkuTier.Basic,
Capacity = 2,
Family = "Gen5",
},
Tags =
{
["ElasticServer"] = "1",
},
};
ArmOperation<PostgreSqlServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, content);
PostgreSqlServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Пример ответа
{
"sku": {
"name": "B_Gen5_2",
"tier": "Basic",
"family": "Gen5",
"capacity": 2
},
"properties": {
"administratorLogin": "cloudsa",
"storageProfile": {
"storageMB": 128000,
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"version": "9.6",
"sslEnforcement": "Enabled",
"minimalTlsVersion": "TLS1_2",
"userVisibleState": "Ready",
"fullyQualifiedDomainName": "pgtestsvc4.postgres.database.azure.com",
"earliestRestoreDate": "2018-03-14T21:08:24.637+00:00"
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4",
"name": "pgtestsvc4",
"type": "Microsoft.DBforPostgreSQL/servers"
}
{
"sku": {
"name": "B_Gen5_2",
"tier": "Basic",
"family": "Gen5",
"capacity": 2
},
"properties": {
"administratorLogin": "cloudsa",
"storageProfile": {
"storageMB": 128000,
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"version": "9.6",
"sslEnforcement": "Enabled",
"userVisibleState": "Ready",
"fullyQualifiedDomainName": "pgtestsvc4.postgres.database.azure.com",
"earliestRestoreDate": "2018-03-14T21:08:24.637+00:00"
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4",
"name": "pgtestsvc4",
"type": "Microsoft.DBforPostgreSQL/servers"
}
Create a replica server
Образец запроса
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica1?api-version=2017-12-01
{
"location": "westcentralus",
"properties": {
"createMode": "Replica",
"sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"
},
"sku": {
"name": "GP_Gen5_2",
"tier": "GeneralPurpose",
"family": "Gen5",
"capacity": 2
}
}
import com.azure.resourcemanager.postgresql.models.ServerPropertiesForReplica;
import com.azure.resourcemanager.postgresql.models.Sku;
import com.azure.resourcemanager.postgresql.models.SkuTier;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json
*/
/**
* Sample code: Create a replica server.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createAReplicaServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) {
manager
.servers()
.define("testserver-replica1")
.withRegion("westcentralus")
.withExistingResourceGroup("TestGroup_WestCentralUS")
.withProperties(
new ServerPropertiesForReplica()
.withSourceServerId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"))
.withSku(
new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5"))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_create_replica_mode.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_create(
resource_group_name="TestGroup_WestCentralUS",
server_name="testserver-replica1",
parameters={
"location": "westcentralus",
"properties": {
"createMode": "Replica",
"sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master",
},
"sku": {"capacity": 2, "family": "Gen5", "name": "GP_Gen5_2", "tier": "GeneralPurpose"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.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
package armpostgresql_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/armpostgresql"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json
func ExampleServersClient_BeginCreate_createAReplicaServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresql.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TestGroup_WestCentralUS", "testserver-replica1", armpostgresql.ServerForCreate{
Location: to.Ptr("westcentralus"),
Properties: &armpostgresql.ServerPropertiesForReplica{
CreateMode: to.Ptr(armpostgresql.CreateModeReplica),
SourceServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"),
},
SKU: &armpostgresql.SKU{
Name: to.Ptr("GP_Gen5_2"),
Capacity: to.Ptr[int32](2),
Family: to.Ptr("Gen5"),
Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresql.Server{
// Name: to.Ptr("testserver-replica1"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica1"),
// Location: to.Ptr("westcentralus"),
// Properties: &armpostgresql.ServerProperties{
// AdministratorLogin: to.Ptr("postgres"),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-20T00:17:56.677Z"); return t}()),
// FullyQualifiedDomainName: to.Ptr("testserver-replica1.postgres.database.azure.com"),
// MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"),
// ReplicaCapacity: to.Ptr[int32](0),
// ReplicationRole: to.Ptr("Replica"),
// SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumDisabled),
// StorageProfile: &armpostgresql.StorageProfile{
// BackupRetentionDays: to.Ptr[int32](7),
// GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled),
// StorageMB: to.Ptr[int32](2048000),
// },
// UserVisibleState: to.Ptr(armpostgresql.ServerStateReady),
// Version: to.Ptr(armpostgresql.ServerVersionNine6),
// },
// SKU: &armpostgresql.SKU{
// Name: to.Ptr("GP_Gen5_2"),
// Capacity: to.Ptr[int32](2),
// Family: to.Ptr("Gen4"),
// Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementClient } = require("@azure/arm-postgresql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new server, or will overwrite an existing server.
*
* @summary Creates a new server, or will overwrite an existing server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json
*/
async function createAReplicaServer() {
const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = "TestGroup_WestCentralUS";
const serverName = "testserver-replica1";
const parameters = {
location: "westcentralus",
properties: {
createMode: "Replica",
sourceServerId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master",
},
sku: {
name: "GP_Gen5_2",
capacity: 2,
family: "Gen5",
tier: "GeneralPurpose",
},
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
createAReplicaServer().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.PostgreSql.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json
// this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "TestGroup_WestCentralUS";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlServerResource
PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
// invoke the operation
string serverName = "testserver-replica1";
PostgreSqlServerCreateOrUpdateContent content = new PostgreSqlServerCreateOrUpdateContent(new PostgreSqlServerPropertiesForReplica(new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")), new AzureLocation("westcentralus"))
{
Sku = new PostgreSqlSku("GP_Gen5_2")
{
Tier = PostgreSqlSkuTier.GeneralPurpose,
Capacity = 2,
Family = "Gen5",
},
};
ArmOperation<PostgreSqlServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, content);
PostgreSqlServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Пример ответа
{
"sku": {
"name": "GP_Gen5_2",
"tier": "GeneralPurpose",
"family": "Gen5",
"capacity": 2
},
"properties": {
"administratorLogin": "postgres",
"storageProfile": {
"storageMB": 2048000,
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"version": "9.6",
"sslEnforcement": "Disabled",
"userVisibleState": "Ready",
"fullyQualifiedDomainName": "testserver-replica1.postgres.database.azure.com",
"earliestRestoreDate": "2018-06-20T00:17:56.677+00:00",
"replicationRole": "Replica",
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master",
"replicaCapacity": 0
},
"location": "westcentralus",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica1",
"name": "testserver-replica1",
"type": "Microsoft.DBforPostgreSQL/servers"
}
{
"sku": {
"name": "GP_Gen5_2",
"tier": "GeneralPurpose",
"family": "Gen4",
"capacity": 2
},
"properties": {
"administratorLogin": "postgres",
"storageProfile": {
"storageMB": 2048000,
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"version": "9.6",
"sslEnforcement": "Disabled",
"userVisibleState": "Ready",
"fullyQualifiedDomainName": "testserver-replica1.postgres.database.azure.com",
"earliestRestoreDate": "2018-06-20T00:17:56.677+00:00",
"replicationRole": "Replica",
"masterServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master",
"replicaCapacity": 0
},
"location": "westcentralus",
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica1",
"name": "testserver-replica1",
"type": "Microsoft.DBforPostgreSQL/servers"
}
Create a server as a geo restore
Образец запроса
PUT https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/targetserver?api-version=2017-12-01
{
"location": "westus",
"properties": {
"createMode": "GeoRestore",
"sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"
},
"sku": {
"name": "GP_Gen5_2",
"tier": "GeneralPurpose",
"family": "Gen5",
"capacity": 2
},
"tags": {
"ElasticServer": "1"
}
}
import com.azure.resourcemanager.postgresql.models.ServerPropertiesForGeoRestore;
import com.azure.resourcemanager.postgresql.models.Sku;
import com.azure.resourcemanager.postgresql.models.SkuTier;
import java.util.HashMap;
import java.util.Map;
/** Samples for Servers Create. */
public final class Main {
/*
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json
*/
/**
* Sample code: Create a server as a geo restore.
*
* @param manager Entry point to PostgreSqlManager.
*/
public static void createAServerAsAGeoRestore(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) {
manager
.servers()
.define("targetserver")
.withRegion("westus")
.withExistingResourceGroup("TargetResourceGroup")
.withProperties(
new ServerPropertiesForGeoRestore()
.withSourceServerId(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"))
.withTags(mapOf("ElasticServer", "1"))
.withSku(
new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5"))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_create_geo_restore_mode.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_create(
resource_group_name="TargetResourceGroup",
server_name="targetserver",
parameters={
"location": "westus",
"properties": {
"createMode": "GeoRestore",
"sourceServerId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver",
},
"sku": {"capacity": 2, "family": "Gen5", "name": "GP_Gen5_2", "tier": "GeneralPurpose"},
"tags": {"ElasticServer": "1"},
},
).result()
print(response)
# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.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
package armpostgresql_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/armpostgresql"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json
func ExampleServersClient_BeginCreate_createAServerAsAGeoRestore() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpostgresql.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TargetResourceGroup", "targetserver", armpostgresql.ServerForCreate{
Location: to.Ptr("westus"),
Properties: &armpostgresql.ServerPropertiesForGeoRestore{
CreateMode: to.Ptr(armpostgresql.CreateModeGeoRestore),
SourceServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"),
},
SKU: &armpostgresql.SKU{
Name: to.Ptr("GP_Gen5_2"),
Capacity: to.Ptr[int32](2),
Family: to.Ptr("Gen5"),
Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose),
},
Tags: map[string]*string{
"ElasticServer": to.Ptr("1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armpostgresql.Server{
// Name: to.Ptr("targetserver"),
// Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/targetserver"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "ElasticServer": to.Ptr("1"),
// },
// Properties: &armpostgresql.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T21:08:24.637Z"); return t}()),
// FullyQualifiedDomainName: to.Ptr("targetserver.postgres.database.azure.com"),
// SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled),
// StorageProfile: &armpostgresql.StorageProfile{
// BackupRetentionDays: to.Ptr[int32](7),
// GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled),
// StorageMB: to.Ptr[int32](128000),
// },
// UserVisibleState: to.Ptr(armpostgresql.ServerStateReady),
// Version: to.Ptr(armpostgresql.ServerVersionNine6),
// },
// SKU: &armpostgresql.SKU{
// Name: to.Ptr("GP_Gen5_2"),
// Capacity: to.Ptr[int32](2),
// Family: to.Ptr("Gen5"),
// Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { PostgreSQLManagementClient } = require("@azure/arm-postgresql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new server, or will overwrite an existing server.
*
* @summary Creates a new server, or will overwrite an existing server.
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json
*/
async function createAServerAsAGeoRestore() {
const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = "TargetResourceGroup";
const serverName = "targetserver";
const parameters = {
location: "westus",
properties: {
createMode: "GeoRestore",
sourceServerId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver",
},
sku: {
name: "GP_Gen5_2",
capacity: 2,
family: "Gen5",
tier: "GeneralPurpose",
},
tags: { elasticServer: "1" },
};
const credential = new DefaultAzureCredential();
const client = new PostgreSQLManagementClient(credential, subscriptionId);
const result = await client.servers.beginCreateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
createAServerAsAGeoRestore().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.PostgreSql.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.PostgreSql;
// Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json
// this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
string resourceGroupName = "TargetResourceGroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this PostgreSqlServerResource
PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
// invoke the operation
string serverName = "targetserver";
PostgreSqlServerCreateOrUpdateContent content = new PostgreSqlServerCreateOrUpdateContent(new PostgreSqlServerPropertiesForGeoRestore(new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")), new AzureLocation("westus"))
{
Sku = new PostgreSqlSku("GP_Gen5_2")
{
Tier = PostgreSqlSkuTier.GeneralPurpose,
Capacity = 2,
Family = "Gen5",
},
Tags =
{
["ElasticServer"] = "1",
},
};
ArmOperation<PostgreSqlServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, content);
PostgreSqlServerResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
PostgreSqlServerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Пример ответа
{
"sku": {
"name": "GP_Gen5_2",
"tier": "GeneralPurpose",
"family": "Gen5",
"capacity": 2
},
"properties": {
"administratorLogin": "cloudsa",
"storageProfile": {
"storageMB": 128000,
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"version": "9.6",
"sslEnforcement": "Enabled",
"userVisibleState": "Ready",
"fullyQualifiedDomainName": "targetserver.postgres.database.azure.com",
"earliestRestoreDate": "2018-03-14T21:08:24.637+00:00"
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/targetserver",
"name": "targetserver",
"type": "Microsoft.DBforPostgreSQL/servers"
}
{
"sku": {
"name": "GP_Gen5_2",
"tier": "GeneralPurpose",
"family": "Gen5",
"capacity": 2
},
"properties": {
"administratorLogin": "cloudsa",
"storageProfile": {
"storageMB": 128000,
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled"
},
"version": "9.6",
"sslEnforcement": "Enabled",
"userVisibleState": "Ready",
"fullyQualifiedDomainName": "targetserver.postgres.database.azure.com",
"earliestRestoreDate": "2018-03-14T21:08:24.637+00:00"
},
"location": "westus",
"tags": {
"ElasticServer": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/targetserver",
"name": "targetserver",
"type": "Microsoft.DBforPostgreSQL/servers"
}
Определения
Имя |
Описание |
CloudError
|
Ответ об ошибке от пакетной службы.
|
ErrorAdditionalInfo
|
Дополнительные сведения об ошибке управления ресурсами.
|
ErrorResponse
|
Сообщение об ошибке
|
GeoRedundantBackup
|
Включите геоизбыточное или нет для резервного копирования сервера.
|
IdentityType
|
Тип удостоверения. Задайте для этого параметра значение SystemAssigned, чтобы автоматически создать и назначить субъект Azure Active Directory для ресурса.
|
InfrastructureEncryption
|
Добавьте второй уровень шифрования данных с помощью нового алгоритма шифрования, который обеспечивает дополнительную защиту данных. Значение является необязательным, но при передаче должно быть "Disabled" или "Enabled".
|
MinimalTlsVersionEnum
|
Примените минимальную версию TLS для сервера.
|
PrivateEndpointProperty
|
|
PrivateEndpointProvisioningState
|
Состояние подключения к частной конечной точке.
|
PrivateLinkServiceConnectionStateActionsRequire
|
Действия, необходимые для подключения службы приватного канала.
|
PrivateLinkServiceConnectionStateStatus
|
Состояние подключения службы приватного канала.
|
PublicNetworkAccessEnum
|
Разрешен ли доступ к общедоступной сети для этого сервера. Значение является необязательным, но при передаче должно быть "Включено" или "Отключено".
|
ResourceIdentity
|
Конфигурация удостоверения Azure Active Directory для ресурса.
|
Server
|
Представляет сервер.
|
ServerForCreate
|
Представляет создаваемый сервер.
|
ServerPrivateEndpointConnection
|
Подключение к частной конечной точке на сервере
|
ServerPrivateEndpointConnectionProperties
|
Свойства подключения к частной конечной точке.
|
ServerPrivateLinkServiceConnectionStateProperty
|
|
ServerPropertiesForDefaultCreate
|
Свойства, используемые для создания нового сервера.
|
ServerPropertiesForGeoRestore
|
Свойства, используемые для создания нового сервера путем восстановления в другом регионе из геореплицированной резервной копии.
|
ServerPropertiesForReplica
|
Свойства для создания нового реплика.
|
ServerPropertiesForRestore
|
Свойства, используемые для создания нового сервера путем восстановления из резервной копии.
|
ServerState
|
Состояние сервера, видимое пользователю.
|
ServerVersion
|
Версия сервера.
|
Sku
|
Свойства сервера, связанные со сведениями о выставлении счетов.
|
SkuTier
|
Уровень конкретного номера SKU, например Базовый.
|
SslEnforcementEnum
|
Включите принудительное применение ssl или нет при подключении к серверу.
|
StorageAutogrow
|
Включите автоматическое увеличение хранилища.
|
StorageProfile
|
Свойства профиля хранилища сервера
|
CloudError
Ответ об ошибке от пакетной службы.
Имя |
Тип |
Описание |
error
|
ErrorResponse
|
Сообщение об ошибке
Общие ответы об ошибках для всех API Azure Resource Manager, возвращающие сведения об ошибке для неудачных операций. (Он также соответствует формату ответа об ошибке OData.)
|
ErrorAdditionalInfo
Дополнительные сведения об ошибке управления ресурсами.
Имя |
Тип |
Описание |
info
|
object
|
Дополнительные сведения.
|
type
|
string
|
Тип дополнительных сведений.
|
ErrorResponse
Сообщение об ошибке
Имя |
Тип |
Описание |
additionalInfo
|
ErrorAdditionalInfo[]
|
Дополнительные сведения об ошибке.
|
code
|
string
|
Код ошибки.
|
details
|
ErrorResponse[]
|
Сведения об ошибке.
|
message
|
string
|
Сообщение об ошибке.
|
target
|
string
|
Целевой объект ошибки.
|
GeoRedundantBackup
Включите геоизбыточное или нет для резервного копирования сервера.
Имя |
Тип |
Описание |
Disabled
|
string
|
|
Enabled
|
string
|
|
IdentityType
Тип удостоверения. Задайте для этого параметра значение SystemAssigned, чтобы автоматически создать и назначить субъект Azure Active Directory для ресурса.
Имя |
Тип |
Описание |
SystemAssigned
|
string
|
|
InfrastructureEncryption
Добавьте второй уровень шифрования данных с помощью нового алгоритма шифрования, который обеспечивает дополнительную защиту данных. Значение является необязательным, но при передаче должно быть "Disabled" или "Enabled".
Имя |
Тип |
Описание |
Disabled
|
string
|
Дополнительный (второй) уровень шифрования неактивных данных
|
Enabled
|
string
|
Значение по умолчанию для одного уровня шифрования неактивных данных.
|
MinimalTlsVersionEnum
Примените минимальную версию TLS для сервера.
Имя |
Тип |
Описание |
TLS1_0
|
string
|
|
TLS1_1
|
string
|
|
TLS1_2
|
string
|
|
TLSEnforcementDisabled
|
string
|
|
PrivateEndpointProperty
Имя |
Тип |
Описание |
id
|
string
|
Идентификатор ресурса частной конечной точки.
|
PrivateEndpointProvisioningState
Состояние подключения к частной конечной точке.
Имя |
Тип |
Описание |
Approving
|
string
|
|
Dropping
|
string
|
|
Failed
|
string
|
|
Ready
|
string
|
|
Rejecting
|
string
|
|
PrivateLinkServiceConnectionStateActionsRequire
Действия, необходимые для подключения службы приватного канала.
Имя |
Тип |
Описание |
None
|
string
|
|
PrivateLinkServiceConnectionStateStatus
Состояние подключения службы приватного канала.
Имя |
Тип |
Описание |
Approved
|
string
|
|
Disconnected
|
string
|
|
Pending
|
string
|
|
Rejected
|
string
|
|
PublicNetworkAccessEnum
Разрешен ли доступ к общедоступной сети для этого сервера. Значение является необязательным, но при передаче должно быть "Включено" или "Отключено".
Имя |
Тип |
Описание |
Disabled
|
string
|
|
Enabled
|
string
|
|
ResourceIdentity
Конфигурация удостоверения Azure Active Directory для ресурса.
Имя |
Тип |
Описание |
principalId
|
string
|
Идентификатор субъекта Azure Active Directory.
|
tenantId
|
string
|
Идентификатор клиента Azure Active Directory.
|
type
|
IdentityType
|
Тип удостоверения. Задайте для этого параметра значение SystemAssigned, чтобы автоматически создать и назначить субъект Azure Active Directory для ресурса.
|
Server
Представляет сервер.
Имя |
Тип |
Описание |
id
|
string
|
Полный идентификатор ресурса. Например: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
ResourceIdentity
|
Удостоверение Сервера Azure Active Directory.
|
location
|
string
|
Географическое расположение, в котором находится ресурс
|
name
|
string
|
Имя ресурса.
|
properties.administratorLogin
|
string
|
Имя входа администратора сервера. Можно указать только при создании сервера (и требуется для создания).
|
properties.byokEnforcement
|
string
|
Состояние, показывающее, включено ли шифрование данных сервера с помощью ключей, управляемых клиентом.
|
properties.earliestRestoreDate
|
string
|
Самое раннее время создания точки восстановления (формат ISO8601)
|
properties.fullyQualifiedDomainName
|
string
|
Полное доменное имя сервера.
|
properties.infrastructureEncryption
|
InfrastructureEncryption
|
Состояние, показывающее, включил ли сервер шифрование инфраструктуры.
|
properties.masterServerId
|
string
|
Идентификатор master сервера реплика.
|
properties.minimalTlsVersion
|
MinimalTlsVersionEnum
|
Примените минимальную версию TLS для сервера.
|
properties.privateEndpointConnections
|
ServerPrivateEndpointConnection[]
|
Список подключений к частной конечной точке на сервере
|
properties.publicNetworkAccess
|
PublicNetworkAccessEnum
|
Разрешен ли доступ к общедоступной сети для этого сервера. Значение является необязательным, но при передаче должно быть "Включено" или "Отключено".
|
properties.replicaCapacity
|
integer
|
Максимальное количество реплик, которое может иметь сервер master.
|
properties.replicationRole
|
string
|
Роль репликации сервера.
|
properties.sslEnforcement
|
SslEnforcementEnum
|
Включите принудительное применение ssl или нет при подключении к серверу.
|
properties.storageProfile
|
StorageProfile
|
Профиль хранилища сервера.
|
properties.userVisibleState
|
ServerState
|
Состояние сервера, видимое пользователю.
|
properties.version
|
ServerVersion
|
Версия сервера.
|
sku
|
Sku
|
Номер SKU (ценовая категория) сервера.
|
tags
|
object
|
Теги ресурсов.
|
type
|
string
|
Тип ресурса. Например, Microsoft.Compute/virtualMachines или Microsoft.Storage/storageAccounts.
|
ServerForCreate
Представляет создаваемый сервер.
Имя |
Тип |
Описание |
identity
|
ResourceIdentity
|
Удостоверение Сервера Azure Active Directory.
|
location
|
string
|
Расположение, в котором находится ресурс.
|
properties
|
ServerPropertiesForCreate:
|
Свойства сервера.
|
sku
|
Sku
|
Номер SKU (ценовая категория) сервера.
|
tags
|
object
|
Метаданные конкретного приложения в формате пар "ключ — значение".
|
ServerPrivateEndpointConnection
Подключение к частной конечной точке на сервере
ServerPrivateEndpointConnectionProperties
Свойства подключения к частной конечной точке.
ServerPrivateLinkServiceConnectionStateProperty
ServerPropertiesForDefaultCreate
Свойства, используемые для создания нового сервера.
Имя |
Тип |
Описание |
administratorLogin
|
string
|
Имя входа администратора сервера. Можно указать только при создании сервера (и требуется для создания).
|
administratorLoginPassword
|
string
|
Пароль для входа администратора.
|
createMode
|
string:
Default
|
Режим для создания нового сервера.
|
infrastructureEncryption
|
InfrastructureEncryption
|
Состояние, показывающее, включил ли сервер шифрование инфраструктуры.
|
minimalTlsVersion
|
MinimalTlsVersionEnum
|
Примените минимальную версию TLS для сервера.
|
publicNetworkAccess
|
PublicNetworkAccessEnum
|
Разрешен ли доступ к общедоступной сети для этого сервера. Значение является необязательным, но при передаче должно быть "Включено" или "Отключено".
|
sslEnforcement
|
SslEnforcementEnum
|
Включите принудительное применение ssl или нет при подключении к серверу.
|
storageProfile
|
StorageProfile
|
Профиль хранилища сервера.
|
version
|
ServerVersion
|
Версия сервера.
|
ServerPropertiesForGeoRestore
Свойства, используемые для создания нового сервера путем восстановления в другом регионе из геореплицированной резервной копии.
Имя |
Тип |
Описание |
createMode
|
string:
GeoRestore
|
Режим для создания нового сервера.
|
infrastructureEncryption
|
InfrastructureEncryption
|
Состояние, показывающее, включил ли сервер шифрование инфраструктуры.
|
minimalTlsVersion
|
MinimalTlsVersionEnum
|
Примените минимальную версию TLS для сервера.
|
publicNetworkAccess
|
PublicNetworkAccessEnum
|
Разрешен ли доступ к общедоступной сети для этого сервера. Значение является необязательным, но при передаче должно быть "Включено" или "Отключено".
|
sourceServerId
|
string
|
Идентификатор исходного сервера для восстановления.
|
sslEnforcement
|
SslEnforcementEnum
|
Включите принудительное применение ssl или нет при подключении к серверу.
|
storageProfile
|
StorageProfile
|
Профиль хранилища сервера.
|
version
|
ServerVersion
|
Версия сервера.
|
ServerPropertiesForReplica
Свойства для создания нового реплика.
Имя |
Тип |
Описание |
createMode
|
string:
Replica
|
Режим для создания нового сервера.
|
infrastructureEncryption
|
InfrastructureEncryption
|
Состояние, показывающее, включил ли сервер шифрование инфраструктуры.
|
minimalTlsVersion
|
MinimalTlsVersionEnum
|
Примените минимальную версию TLS для сервера.
|
publicNetworkAccess
|
PublicNetworkAccessEnum
|
Разрешен ли доступ к общедоступной сети для этого сервера. Значение является необязательным, но при передаче должно быть "Включено" или "Отключено".
|
sourceServerId
|
string
|
Идентификатор сервера master для создания реплика.
|
sslEnforcement
|
SslEnforcementEnum
|
Включите принудительное применение ssl или нет при подключении к серверу.
|
storageProfile
|
StorageProfile
|
Профиль хранилища сервера.
|
version
|
ServerVersion
|
Версия сервера.
|
ServerPropertiesForRestore
Свойства, используемые для создания нового сервера путем восстановления из резервной копии.
Имя |
Тип |
Описание |
createMode
|
string:
PointInTimeRestore
|
Режим для создания нового сервера.
|
infrastructureEncryption
|
InfrastructureEncryption
|
Состояние, показывающее, включил ли сервер шифрование инфраструктуры.
|
minimalTlsVersion
|
MinimalTlsVersionEnum
|
Примените минимальную версию TLS для сервера.
|
publicNetworkAccess
|
PublicNetworkAccessEnum
|
Разрешен ли доступ к общедоступной сети для этого сервера. Значение является необязательным, но при передаче должно быть "Включено" или "Отключено".
|
restorePointInTime
|
string
|
Время создания точки восстановления (ISO8601 формате), указывающее время восстановления.
|
sourceServerId
|
string
|
Идентификатор исходного сервера для восстановления.
|
sslEnforcement
|
SslEnforcementEnum
|
Включите принудительное применение ssl или нет при подключении к серверу.
|
storageProfile
|
StorageProfile
|
Профиль хранилища сервера.
|
version
|
ServerVersion
|
Версия сервера.
|
ServerState
Состояние сервера, видимое пользователю.
Имя |
Тип |
Описание |
Disabled
|
string
|
|
Dropping
|
string
|
|
Inaccessible
|
string
|
|
Ready
|
string
|
|
ServerVersion
Версия сервера.
Имя |
Тип |
Описание |
10
|
string
|
|
10.0
|
string
|
|
10.2
|
string
|
|
11
|
string
|
|
9.5
|
string
|
|
9.6
|
string
|
|
Sku
Свойства сервера, связанные со сведениями о выставлении счетов.
Имя |
Тип |
Описание |
capacity
|
integer
|
Емкость увеличения и уменьшения масштаба, представляющая единицы вычислений сервера.
|
family
|
string
|
Семейство оборудования.
|
name
|
string
|
Имя SKU, как правило, уровень + семейство + ядра, например B_Gen4_1, GP_Gen5_8.
|
size
|
string
|
Код размера, который будет интерпретироваться ресурсом соответствующим образом.
|
tier
|
SkuTier
|
Уровень конкретного номера SKU, например Базовый.
|
SkuTier
Уровень конкретного номера SKU, например Базовый.
Имя |
Тип |
Описание |
Basic
|
string
|
|
GeneralPurpose
|
string
|
|
MemoryOptimized
|
string
|
|
SslEnforcementEnum
Включите принудительное применение ssl или нет при подключении к серверу.
Имя |
Тип |
Описание |
Disabled
|
string
|
|
Enabled
|
string
|
|
StorageAutogrow
Включите автоматическое увеличение хранилища.
Имя |
Тип |
Описание |
Disabled
|
string
|
|
Enabled
|
string
|
|
StorageProfile
Свойства профиля хранилища сервера
Имя |
Тип |
Описание |
backupRetentionDays
|
integer
|
Дни хранения резервных копий для сервера.
|
geoRedundantBackup
|
GeoRedundantBackup
|
Включите геоизбыточное или нет для резервного копирования сервера.
|
storageAutogrow
|
StorageAutogrow
|
Включите автоматическое увеличение хранилища.
|
storageMB
|
integer
|
Максимальный объем хранилища, разрешенный для сервера.
|