mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Configurations: 'specification/sql/resource-manager/Microsoft.Sql/SQL/tspconfig.yaml', API Version: 2025-01-01, SDK Release Type: stable, and CommitSHA: '41784cfad64229e05cb37b1532a686a0cc3a60a9` in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6276195 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. Release plan link: [https://azsdk-releaseplan-dashboard-hveph5aqhhcfhtgu](https://azsdk-releaseplan-dashboard-hveph5aqhhcfhtgu.westus-01.azurewebsites.net/?releasePlan=2227).[westus-01.azurewebsites.net/?releasePlan=2227](https://azsdk-releaseplan-dashboard-hveph5aqhhcfhtgu.westus-01.azurewebsites.net/?releasePlan=2227) Submitted by: [[email protected]](mailto:[email protected]) ### Release Plan Details Release Plan: https://azsdk-releaseplan-dashboard-hveph5aqhhcfhtgu.westus-01.azurewebsites.net/?releasePlan=2227 Spec pull request: [Azure/azure-rest-api-specs#41520](https://github.com/Azure/azure-rest-api-specs/pull/41520) Spec API version: --------- Co-authored-by: kazrael2119 <[email protected]>
187 lines
6.5 KiB
TypeScript
187 lines
6.5 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
import { SqlManagementClient } from "@azure/arm-sql";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
/**
|
|
* This sample demonstrates how to updates an elastic pool.
|
|
*
|
|
* @summary updates an elastic pool.
|
|
* x-ms-original-file: 2025-01-01/ElasticPoolUpdateAssignMaintenanceConfiguration.json
|
|
*/
|
|
async function assignsMaintenanceConfigurationToAnElasticPool(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new SqlManagementClient(credential, subscriptionId);
|
|
const result = await client.elasticPools.update(
|
|
"sqlcrudtest-2369",
|
|
"sqlcrudtest-8069",
|
|
"sqlcrudtest-8102",
|
|
{
|
|
maintenanceConfigurationId:
|
|
"/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1",
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to updates an elastic pool.
|
|
*
|
|
* @summary updates an elastic pool.
|
|
* x-ms-original-file: 2025-01-01/ElasticPoolUpdateMax.json
|
|
*/
|
|
async function updateAnElasticPoolWithAllParameter(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new SqlManagementClient(credential, subscriptionId);
|
|
const result = await client.elasticPools.update(
|
|
"sqlcrudtest-2369",
|
|
"sqlcrudtest-8069",
|
|
"sqlcrudtest-8102",
|
|
{
|
|
licenseType: "LicenseIncluded",
|
|
perDatabaseSettings: { maxCapacity: 1, minCapacity: 0.25 },
|
|
zoneRedundant: true,
|
|
sku: { name: "BC_Gen4", capacity: 2, tier: "BusinessCritical" },
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to updates an elastic pool.
|
|
*
|
|
* @summary updates an elastic pool.
|
|
* x-ms-original-file: 2025-01-01/ElasticPoolUpdateMin.json
|
|
*/
|
|
async function updateAnElasticPoolWithMinimumParameters(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new SqlManagementClient(credential, subscriptionId);
|
|
const result = await client.elasticPools.update(
|
|
"sqlcrudtest-2369",
|
|
"sqlcrudtest-8069",
|
|
"sqlcrudtest-8102",
|
|
{},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to updates an elastic pool.
|
|
*
|
|
* @summary updates an elastic pool.
|
|
* x-ms-original-file: 2025-01-01/ElasticPoolUpdateResetMaintenanceConfiguration.json
|
|
*/
|
|
async function resetsMaintenanceConfigurationOfAnElasticPoolToDefault(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new SqlManagementClient(credential, subscriptionId);
|
|
const result = await client.elasticPools.update(
|
|
"sqlcrudtest-2369",
|
|
"sqlcrudtest-8069",
|
|
"sqlcrudtest-8102",
|
|
{
|
|
maintenanceConfigurationId:
|
|
"/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default",
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to updates an elastic pool.
|
|
*
|
|
* @summary updates an elastic pool.
|
|
* x-ms-original-file: 2025-01-01/ElasticPoolUpdateServerlessProperties.json
|
|
*/
|
|
async function updateAnElasticPoolWithServerlessProperties(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new SqlManagementClient(credential, subscriptionId);
|
|
const result = await client.elasticPools.update(
|
|
"sqlcrudtest-2369",
|
|
"sqlcrudtest-8069",
|
|
"sqlcrudtest-8102",
|
|
{
|
|
autoPauseDelay: 60,
|
|
minCapacity: 0.5,
|
|
perDatabaseSettings: { autoPauseDelay: 80, maxCapacity: 2, minCapacity: 0 },
|
|
sku: { name: "GP_S_Gen5_2", capacity: 2, tier: "GeneralPurpose" },
|
|
},
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to updates an elastic pool.
|
|
*
|
|
* @summary updates an elastic pool.
|
|
* x-ms-original-file: 2025-01-01/ElasticPoolUpdateWithDefaultPreferredEnclaveType.json
|
|
*/
|
|
async function updateAnElasticPoolWithPreferredEnclaveTypeParameterAsDefault(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new SqlManagementClient(credential, subscriptionId);
|
|
const result = await client.elasticPools.update(
|
|
"sqlcrudtest-2369",
|
|
"sqlcrudtest-8069",
|
|
"sqlcrudtest-8102",
|
|
{ preferredEnclaveType: "Default", sku: { name: "GP_Gen5_4" } },
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to updates an elastic pool.
|
|
*
|
|
* @summary updates an elastic pool.
|
|
* x-ms-original-file: 2025-01-01/ElasticPoolUpdateWithVBSPreferredEnclaveType.json
|
|
*/
|
|
async function updateAnElasticPoolWithPreferredEnclaveTypeParameterAsVBS(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new SqlManagementClient(credential, subscriptionId);
|
|
const result = await client.elasticPools.update(
|
|
"sqlcrudtest-2369",
|
|
"sqlcrudtest-8069",
|
|
"sqlcrudtest-8102",
|
|
{ preferredEnclaveType: "VBS", sku: { name: "GP_Gen5_4" } },
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
/**
|
|
* This sample demonstrates how to updates an elastic pool.
|
|
*
|
|
* @summary updates an elastic pool.
|
|
* x-ms-original-file: 2025-01-01/HyperscaleElasticPoolUpdateSetHighAvailabilityReplicaCount.json
|
|
*/
|
|
async function updateHighAvailabilityReplicaCountOfAHyperscaleElasticPool(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const client = new SqlManagementClient(credential, subscriptionId);
|
|
const result = await client.elasticPools.update(
|
|
"sqlcrudtest-2369",
|
|
"sqlcrudtest-8069",
|
|
"sqlcrudtest-8102",
|
|
{ highAvailabilityReplicaCount: 2 },
|
|
);
|
|
console.log(result);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await assignsMaintenanceConfigurationToAnElasticPool();
|
|
await updateAnElasticPoolWithAllParameter();
|
|
await updateAnElasticPoolWithMinimumParameters();
|
|
await resetsMaintenanceConfigurationOfAnElasticPoolToDefault();
|
|
await updateAnElasticPoolWithServerlessProperties();
|
|
await updateAnElasticPoolWithPreferredEnclaveTypeParameterAsDefault();
|
|
await updateAnElasticPoolWithPreferredEnclaveTypeParameterAsVBS();
|
|
await updateHighAvailabilityReplicaCountOfAHyperscaleElasticPool();
|
|
}
|
|
|
|
main().catch(console.error);
|