[mgmt] cosmosforpostgresql release (#28851)

https://github.com/Azure/sdk-release-request/issues/4993
This commit is contained in:
ZiWei Chen 2024-03-29 15:24:27 +08:00 коммит произвёл GitHub
Родитель 0725abec9e
Коммит ead6f2a2cc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
143 изменённых файлов: 5785 добавлений и 1618 удалений

Просмотреть файл

@ -12937,7 +12937,7 @@ packages:
dev: false
file:projects/arm-cosmosdbforpostgresql.tgz:
resolution: {integrity: sha512-1kFWZx86s/1MB7d50kKIqEXOd20/HYaa76Vr6znMZ1oi7VhNM82bwcFXhqr/Ha8QJp7+tp95dRGyOkZPX4Q6OQ==, tarball: file:projects/arm-cosmosdbforpostgresql.tgz}
resolution: {integrity: sha512-MabHKWwbfn4tzfVSSs2Tb6wN1OeWsoPWoASSTWGSIo7ezsV2vMpFfQ0v8OcrVoUqdGyo4kuObB1b5MOsB1dDKA==, tarball: file:projects/arm-cosmosdbforpostgresql.tgz}
name: '@rush-temp/arm-cosmosdbforpostgresql'
version: 0.0.0
dependencies:
@ -12950,6 +12950,7 @@ packages:
chai: 4.3.10
cross-env: 7.0.3
dotenv: 16.4.5
esm: 3.2.25
mkdirp: 2.1.6
mocha: 10.3.0
rimraf: 5.0.5

Просмотреть файл

@ -1,15 +1,29 @@
# Release History
## 1.1.0-beta.1 (2024-03-11)
**Features**
## 1.0.1 (Unreleased)
### Features Added
### Breaking Changes
### Bugs Fixed
### Other Changes
- Added Interface AuthConfig
- Added Interface PromoteRequest
- Added Type Alias ActiveDirectoryAuth
- Added Type Alias PasswordAuth
- Added Type Alias PrincipalType
- Added Type Alias RoleType
- Interface Cluster has a new optional parameter authConfig
- Interface Cluster has a new optional parameter databaseName
- Interface Cluster has a new optional parameter enableGeoBackup
- Interface ClustersPromoteReadReplicaOptionalParams has a new optional parameter promoteRequest
- Interface Role has a new optional parameter objectId
- Interface Role has a new optional parameter principalType
- Interface Role has a new optional parameter roleType
- Interface Role has a new optional parameter tenantId
- Added Enum KnownActiveDirectoryAuth
- Added Enum KnownPasswordAuth
- Added Enum KnownPrincipalType
- Added Enum KnownRoleType
## 1.0.0 (2023-09-04)
The package of @azure/arm-cosmosdbforpostgresql is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ).

Просмотреть файл

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2023 Microsoft
Copyright (c) 2024 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -6,7 +6,7 @@ Azure Cosmos DB for PostgreSQL database service resource provider REST APIs
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql) |
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-cosmosdbforpostgresql) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-cosmosdbforpostgresql) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-cosmosdbforpostgresql?view=azure-node-preview) |
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
## Getting started

Просмотреть файл

@ -1,8 +1,8 @@
{
"commit": "95c0363e4cae8756c6a33b58add67776db427bbc",
"commit": "41d1c179dc166b7f16b7e40ef4f2a1d9c85b10cc",
"readme": "specification/postgresqlhsc/resource-manager/readme.md",
"autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\postgresqlhsc\\resource-manager\\readme.md --use=@autorest/typescript@6.0.8 --generate-sample=true",
"autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\postgresqlhsc\\resource-manager\\readme.md --use=@autorest/typescript@6.0.17 --generate-sample=true",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.7.2",
"use": "@autorest/typescript@6.0.8"
"release_tool": "@azure-tools/js-sdk-release-tools@2.7.4",
"use": "@autorest/typescript@6.0.17"
}

Просмотреть файл

@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "js",
"TagPrefix": "js/cosmosforpostgresql/arm-cosmosdbforpostgresql",
"Tag": "js/cosmosforpostgresql/arm-cosmosdbforpostgresql_7b52b0391e"
"Tag": "js/cosmosforpostgresql/arm-cosmosdbforpostgresql_61e5c17ff8"
}

Просмотреть файл

@ -3,7 +3,7 @@
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for CosmosDBForPostgreSQL.",
"version": "1.0.1",
"version": "1.1.0-beta.1",
"engines": {
"node": ">=18.0.0"
},
@ -12,8 +12,8 @@
"@azure/abort-controller": "^1.0.0",
"@azure/core-paging": "^1.2.0",
"@azure/core-client": "^1.7.0",
"@azure/core-auth": "^1.3.0",
"@azure/core-rest-pipeline": "^1.12.0",
"@azure/core-auth": "^1.6.0",
"@azure/core-rest-pipeline": "^1.14.0",
"tslib": "^2.2.0"
},
"keywords": [
@ -32,19 +32,20 @@
"mkdirp": "^2.1.2",
"typescript": "~5.3.3",
"uglify-js": "^3.4.9",
"rimraf": "^5.0.5",
"rimraf": "^5.0.0",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@azure-tools/test-credential": "^1.0.0",
"mocha": "^10.0.0",
"@types/mocha": "^10.0.0",
"esm": "^3.2.18",
"@types/chai": "^4.2.8",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"@types/node": "^18.0.0",
"ts-node": "^10.0.0",
"@azure/dev-tool": "^1.0.0",
"@types/mocha": "^10.0.0"
"ts-node": "^10.0.0"
},
"repository": {
"type": "git",
@ -77,7 +78,6 @@
"pack": "npm pack 2>&1",
"extract-api": "api-extractor run --local",
"lint": "echo skipped",
"audit": "echo skipped",
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"build:node": "echo skipped",
"build:browser": "echo skipped",
@ -115,4 +115,4 @@
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-cosmosdbforpostgresql?view=azure-node-preview"
}
}
}

Просмотреть файл

@ -10,16 +10,30 @@ import { OperationState } from '@azure/core-lro';
import { PagedAsyncIterableIterator } from '@azure/core-paging';
import { SimplePollerLike } from '@azure/core-lro';
// @public
export type ActiveDirectoryAuth = string;
// @public
export interface AuthConfig {
// (undocumented)
activeDirectoryAuth?: ActiveDirectoryAuth;
// (undocumented)
passwordAuth?: PasswordAuth;
}
// @public
export interface Cluster extends TrackedResource {
readonly administratorLogin?: string;
administratorLoginPassword?: string;
authConfig?: AuthConfig;
citusVersion?: string;
coordinatorEnablePublicIpAccess?: boolean;
coordinatorServerEdition?: string;
coordinatorStorageQuotaInMb?: number;
coordinatorVCores?: number;
databaseName?: string;
readonly earliestRestoreTime?: Date;
enableGeoBackup?: boolean;
enableHa?: boolean;
enableShardsOnCoordinator?: boolean;
maintenanceWindow?: MaintenanceWindow;
@ -214,6 +228,7 @@ export interface ClustersPromoteReadReplicaHeaders {
// @public
export interface ClustersPromoteReadReplicaOptionalParams extends coreClient.OperationOptions {
promoteRequest?: PromoteRequest;
resumeFrom?: string;
updateIntervalInMs?: number;
}
@ -522,6 +537,12 @@ export type FirewallRulesListByClusterResponse = FirewallRuleListResult;
// @public
export function getContinuationToken(page: unknown): string | undefined;
// @public
export enum KnownActiveDirectoryAuth {
Disabled = "disabled",
Enabled = "enabled"
}
// @public
export enum KnownConfigurationDataType {
Boolean = "Boolean",
@ -545,6 +566,19 @@ export enum KnownOperationOrigin {
User = "user"
}
// @public
export enum KnownPasswordAuth {
Disabled = "disabled",
Enabled = "enabled"
}
// @public
export enum KnownPrincipalType {
Group = "group",
ServicePrincipal = "servicePrincipal",
User = "user"
}
// @public
export enum KnownPrivateEndpointConnectionProvisioningState {
Creating = "Creating",
@ -568,6 +602,12 @@ export enum KnownProvisioningState {
Succeeded = "Succeeded"
}
// @public
export enum KnownRoleType {
Admin = "admin",
User = "user"
}
// @public
export enum KnownServerRole {
Coordinator = "Coordinator",
@ -636,6 +676,12 @@ export interface OperationsListOptionalParams extends coreClient.OperationOption
// @public
export type OperationsListResponse = OperationListResult;
// @public
export type PasswordAuth = string;
// @public
export type PrincipalType = string;
// @public
export interface PrivateEndpoint {
readonly id?: string;
@ -762,6 +808,11 @@ export interface PrivateLinkServiceConnectionState {
status?: PrivateEndpointServiceConnectionStatus;
}
// @public
export interface PromoteRequest {
enableGeoBackup?: boolean;
}
// @public
export type ProvisioningState = string;
@ -779,8 +830,16 @@ export interface Resource {
// @public
export interface Role extends ProxyResource {
password: string;
// (undocumented)
objectId?: string;
password?: string;
// (undocumented)
principalType?: PrincipalType;
readonly provisioningState?: ProvisioningState;
// (undocumented)
roleType?: RoleType;
// (undocumented)
tenantId?: string;
}
// @public
@ -846,6 +905,9 @@ export interface RolesListByClusterOptionalParams extends coreClient.OperationOp
// @public
export type RolesListByClusterResponse = RoleListResult;
// @public
export type RoleType = string;
// @public
export interface ServerConfiguration extends ProxyResource {
readonly allowedValues?: string;

Просмотреть файл

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
NameAvailabilityRequest,
CosmosDBForPostgreSQL
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,7 +21,7 @@ dotenv.config();
* This sample demonstrates how to Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen.
*
* @summary Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/CheckNameAvailability.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/CheckNameAvailability.json
*/
async function checkNameAvailability() {
const subscriptionId =
@ -29,12 +29,12 @@ async function checkNameAvailability() {
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const nameAvailabilityRequest: NameAvailabilityRequest = {
name: "name1",
type: "Microsoft.DBforPostgreSQL/serverGroupsv2"
type: "Microsoft.DBforPostgreSQL/serverGroupsv2",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.checkNameAvailability(
nameAvailabilityRequest
nameAvailabilityRequest,
);
console.log(result);
}

Просмотреть файл

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
Cluster,
CosmosDBForPostgreSQL
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,7 +21,7 @@ dotenv.config();
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreatePITR.json
*/
async function createANewClusterAsAPointInTimeRestore() {
const subscriptionId =
@ -35,14 +35,14 @@ async function createANewClusterAsAPointInTimeRestore() {
pointInTimeUTC: new Date("2017-12-14T00:00:37.467Z"),
sourceLocation: "westus",
sourceResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster"
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}
@ -51,7 +51,7 @@ async function createANewClusterAsAPointInTimeRestore() {
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateReadReplica.json
*/
async function createANewClusterAsAReadReplica() {
const subscriptionId =
@ -64,14 +64,14 @@ async function createANewClusterAsAReadReplica() {
location: "westus",
sourceLocation: "westus",
sourceResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster"
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}
@ -80,7 +80,7 @@ async function createANewClusterAsAReadReplica() {
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateMultiNode.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateMultiNode.json
*/
async function createANewMultiNodeCluster() {
const subscriptionId =
@ -106,14 +106,14 @@ async function createANewMultiNodeCluster() {
nodeVCores: 8,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: {}
tags: {},
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}
@ -122,7 +122,7 @@ async function createANewMultiNodeCluster() {
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev1.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateBurstablev1.json
*/
async function createANewSingleNodeBurstable1VCoreCluster() {
const subscriptionId =
@ -144,14 +144,14 @@ async function createANewSingleNodeBurstable1VCoreCluster() {
nodeCount: 0,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: { owner: "JohnDoe" }
tags: { owner: "JohnDoe" },
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}
@ -160,7 +160,7 @@ async function createANewSingleNodeBurstable1VCoreCluster() {
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev2.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateBurstablev2.json
*/
async function createANewSingleNodeBurstable2VCoresCluster() {
const subscriptionId =
@ -182,14 +182,14 @@ async function createANewSingleNodeBurstable2VCoresCluster() {
nodeCount: 0,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: { owner: "JohnDoe" }
tags: { owner: "JohnDoe" },
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}
@ -198,7 +198,7 @@ async function createANewSingleNodeBurstable2VCoresCluster() {
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateSingleNode.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateSingleNode.json
*/
async function createANewSingleNodeCluster() {
const subscriptionId =
@ -220,14 +220,14 @@ async function createANewSingleNodeCluster() {
nodeCount: 0,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: { owner: "JohnDoe" }
tags: { owner: "JohnDoe" },
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Deletes a cluster together with servers in it.
*
* @summary Deletes a cluster together with servers in it.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterDelete.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterDelete.json
*/
async function deleteTheCluster() {
const subscriptionId =
@ -31,7 +31,7 @@ async function deleteTheCluster() {
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginDeleteAndWait(
resourceGroupName,
clusterName
clusterName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time.
*
* @summary Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterGet.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterGet.json
*/
async function getTheCluster() {
const subscriptionId =

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Lists all clusters in a resource group.
*
* @summary Lists all clusters in a resource group.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterListByResourceGroup.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterListByResourceGroup.json
*/
async function listTheClustersByResourceGroup() {
const subscriptionId =
@ -30,7 +30,7 @@ async function listTheClustersByResourceGroup() {
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusters.listByResourceGroup(
resourceGroupName
resourceGroupName,
)) {
resArray.push(item);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Lists all clusters in a subscription.
*
* @summary Lists all clusters in a subscription.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterList.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterList.json
*/
async function listAllTheClusters() {
const subscriptionId =

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Promotes read replica cluster to an independent read-write cluster.
*
* @summary Promotes read replica cluster to an independent read-write cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterPromoteReadReplica.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterPromoteReadReplica.json
*/
async function promoteReadReplicaClusterToAnIndependentReadWriteCluster() {
const subscriptionId =
@ -31,7 +31,7 @@ async function promoteReadReplicaClusterToAnIndependentReadWriteCluster() {
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginPromoteReadReplicaAndWait(
resourceGroupName,
clusterName
clusterName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Restarts all nodes in the cluster.
*
* @summary Restarts all nodes in the cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterRestart.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterRestart.json
*/
async function restartAllServersInTheCluster() {
const subscriptionId =
@ -31,7 +31,7 @@ async function restartAllServersInTheCluster() {
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginRestartAndWait(
resourceGroupName,
clusterName
clusterName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Starts stopped compute on all cluster nodes.
*
* @summary Starts stopped compute on all cluster nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterStart.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStart.json
*/
async function startAllServersInTheCluster() {
const subscriptionId =
@ -31,7 +31,7 @@ async function startAllServersInTheCluster() {
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginStartAndWait(
resourceGroupName,
clusterName
clusterName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Stops compute on all cluster nodes.
*
* @summary Stops compute on all cluster nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterStop.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStop.json
*/
async function stopAllServersInTheCluster() {
const subscriptionId =
@ -31,7 +31,7 @@ async function stopAllServersInTheCluster() {
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginStopAndWait(
resourceGroupName,
clusterName
clusterName,
);
console.log(result);
}

Просмотреть файл

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
ClusterForUpdate,
CosmosDBForPostgreSQL
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,7 +21,7 @@ dotenv.config();
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterScaleCompute.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterScaleCompute.json
*/
async function scaleComputeUpOrDown() {
const subscriptionId =
@ -36,7 +36,7 @@ async function scaleComputeUpOrDown() {
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}
@ -45,7 +45,7 @@ async function scaleComputeUpOrDown() {
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterAddNode.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterAddNode.json
*/
async function scaleOutAddNewWorkerNodes() {
const subscriptionId =
@ -60,7 +60,7 @@ async function scaleOutAddNewWorkerNodes() {
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}
@ -69,7 +69,7 @@ async function scaleOutAddNewWorkerNodes() {
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterScaleStorage.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterScaleStorage.json
*/
async function scaleUpStorage() {
const subscriptionId =
@ -84,7 +84,7 @@ async function scaleUpStorage() {
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}
@ -93,7 +93,7 @@ async function scaleUpStorage() {
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterUpdate.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterUpdate.json
*/
async function updateMultipleConfigurationSettingsOfTheCluster() {
const subscriptionId =
@ -106,14 +106,14 @@ async function updateMultipleConfigurationSettingsOfTheCluster() {
administratorLoginPassword: "newpassword",
coordinatorVCores: 16,
nodeCount: 4,
nodeVCores: 16
nodeVCores: 16,
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}
@ -122,7 +122,7 @@ async function updateMultipleConfigurationSettingsOfTheCluster() {
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterUpdateMaintenanceWindow.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterUpdateMaintenanceWindow.json
*/
async function updateOrDefineMaintenanceWindow() {
const subscriptionId =
@ -136,15 +136,15 @@ async function updateOrDefineMaintenanceWindow() {
customWindow: "Enabled",
dayOfWeek: 0,
startHour: 8,
startMinute: 0
}
startMinute: 0,
},
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters
parameters,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets information of a configuration for coordinator.
*
* @summary Gets information of a configuration for coordinator.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGetCoordinator.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetCoordinator.json
*/
async function getConfigurationDetailsForCoordinator() {
const subscriptionId =
@ -33,7 +33,7 @@ async function getConfigurationDetailsForCoordinator() {
const result = await client.configurations.getCoordinator(
resourceGroupName,
clusterName,
configurationName
configurationName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets information of a configuration for worker nodes.
*
* @summary Gets information of a configuration for worker nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGetNode.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetNode.json
*/
async function getConfigurationDetailsForNode() {
const subscriptionId =
@ -33,7 +33,7 @@ async function getConfigurationDetailsForNode() {
const result = await client.configurations.getNode(
resourceGroupName,
clusterName,
configurationName
configurationName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets information of a configuration for coordinator and nodes.
*
* @summary Gets information of a configuration for coordinator and nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationGet.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGet.json
*/
async function getConfigurationDetails() {
const subscriptionId =
@ -33,7 +33,7 @@ async function getConfigurationDetails() {
const result = await client.configurations.get(
resourceGroupName,
clusterName,
configurationName
configurationName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to List all the configurations of a cluster.
*
* @summary List all the configurations of a cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationListByCluster.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByCluster.json
*/
async function listConfigurationsOfTheCluster() {
const subscriptionId =
@ -32,7 +32,7 @@ async function listConfigurationsOfTheCluster() {
const resArray = new Array();
for await (let item of client.configurations.listByCluster(
resourceGroupName,
clusterName
clusterName,
)) {
resArray.push(item);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to List all the configurations of a server in cluster.
*
* @summary List all the configurations of a server in cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationListByServer.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByServer.json
*/
async function listConfigurationsOfTheServerThatInTheCluster() {
const subscriptionId =
@ -34,7 +34,7 @@ async function listConfigurationsOfTheServerThatInTheCluster() {
for await (let item of client.configurations.listByServer(
resourceGroupName,
clusterName,
serverName
serverName,
)) {
resArray.push(item);
}

Просмотреть файл

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
ServerConfiguration,
CosmosDBForPostgreSQL
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,7 +21,7 @@ dotenv.config();
* This sample demonstrates how to Updates configuration of coordinator in a cluster
*
* @summary Updates configuration of coordinator in a cluster
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationUpdateCoordinator.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationUpdateCoordinator.json
*/
async function updateSingleConfigurationOfCoordinator() {
const subscriptionId =
@ -38,7 +38,7 @@ async function updateSingleConfigurationOfCoordinator() {
resourceGroupName,
clusterName,
configurationName,
parameters
parameters,
);
console.log(result);
}

Просмотреть файл

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
ServerConfiguration,
CosmosDBForPostgreSQL
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,7 +21,7 @@ dotenv.config();
* This sample demonstrates how to Updates configuration of worker nodes in a cluster
*
* @summary Updates configuration of worker nodes in a cluster
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ConfigurationUpdateNode.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationUpdateNode.json
*/
async function updateSingleConfigurationOfNodes() {
const subscriptionId =
@ -38,7 +38,7 @@ async function updateSingleConfigurationOfNodes() {
resourceGroupName,
clusterName,
configurationName,
parameters
parameters,
);
console.log(result);
}

Просмотреть файл

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
FirewallRule,
CosmosDBForPostgreSQL
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,7 +21,7 @@ dotenv.config();
* This sample demonstrates how to Creates a new cluster firewall rule or updates an existing cluster firewall rule.
*
* @summary Creates a new cluster firewall rule or updates an existing cluster firewall rule.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/FirewallRuleCreate.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleCreate.json
*/
async function createAFirewallRuleOfTheCluster() {
const subscriptionId =
@ -33,7 +33,7 @@ async function createAFirewallRuleOfTheCluster() {
const firewallRuleName = "rule1";
const parameters: FirewallRule = {
endIpAddress: "255.255.255.255",
startIpAddress: "0.0.0.0"
startIpAddress: "0.0.0.0",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
@ -41,7 +41,7 @@ async function createAFirewallRuleOfTheCluster() {
resourceGroupName,
clusterName,
firewallRuleName,
parameters
parameters,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Deletes a cluster firewall rule.
*
* @summary Deletes a cluster firewall rule.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/FirewallRuleDelete.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleDelete.json
*/
async function deleteTheFirewallRuleOfTheCluster() {
const subscriptionId =
@ -33,7 +33,7 @@ async function deleteTheFirewallRuleOfTheCluster() {
const result = await client.firewallRules.beginDeleteAndWait(
resourceGroupName,
clusterName,
firewallRuleName
firewallRuleName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets information about a cluster firewall rule.
*
* @summary Gets information about a cluster firewall rule.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/FirewallRuleGet.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleGet.json
*/
async function getTheFirewallRuleOfTheCluster() {
const subscriptionId =
@ -33,7 +33,7 @@ async function getTheFirewallRuleOfTheCluster() {
const result = await client.firewallRules.get(
resourceGroupName,
clusterName,
firewallRuleName
firewallRuleName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Lists all the firewall rules on cluster.
*
* @summary Lists all the firewall rules on cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/FirewallRuleListByCluster.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleListByCluster.json
*/
async function listFirewallRulesOfTheCluster() {
const subscriptionId =
@ -32,7 +32,7 @@ async function listFirewallRulesOfTheCluster() {
const resArray = new Array();
for await (let item of client.firewallRules.listByCluster(
resourceGroupName,
clusterName
clusterName,
)) {
resArray.push(item);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Lists all of the available REST API operations.
*
* @summary Lists all of the available REST API operations.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/OperationList.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/OperationList.json
*/
async function listAllAvailableOperations() {
const subscriptionId =

Просмотреть файл

@ -10,7 +10,7 @@
// Licensed under the MIT License.
import {
PrivateEndpointConnection,
CosmosDBForPostgreSQL
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
@ -21,7 +21,7 @@ dotenv.config();
* This sample demonstrates how to Approves or Rejects a private endpoint connection with a given name.
*
* @summary Approves or Rejects a private endpoint connection with a given name.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionCreateOrUpdate.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionCreateOrUpdate.json
*/
async function approvesOrRejectsAPrivateEndpointConnectionWithAGivenName() {
const subscriptionId =
@ -34,17 +34,18 @@ async function approvesOrRejectsAPrivateEndpointConnectionWithAGivenName() {
const parameters: PrivateEndpointConnection = {
privateLinkServiceConnectionState: {
description: "Approved by johndoe@contoso.com",
status: "Approved"
}
status: "Approved",
},
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.privateEndpointConnections.beginCreateOrUpdateAndWait(
resourceGroupName,
clusterName,
privateEndpointConnectionName,
parameters
);
const result =
await client.privateEndpointConnections.beginCreateOrUpdateAndWait(
resourceGroupName,
clusterName,
privateEndpointConnectionName,
parameters,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Deletes a private endpoint connection with a given name.
*
* @summary Deletes a private endpoint connection with a given name.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsDelete.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsDelete.json
*/
async function deletesAPrivateEndpointConnectionWithAGivenName() {
const subscriptionId =
@ -33,7 +33,7 @@ async function deletesAPrivateEndpointConnectionWithAGivenName() {
const result = await client.privateEndpointConnections.beginDeleteAndWait(
resourceGroupName,
clusterName,
privateEndpointConnectionName
privateEndpointConnectionName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets private endpoint connection.
*
* @summary Gets private endpoint connection.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsGet.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsGet.json
*/
async function getsPrivateEndpointConnection() {
const subscriptionId =
@ -33,7 +33,7 @@ async function getsPrivateEndpointConnection() {
const result = await client.privateEndpointConnections.get(
resourceGroupName,
clusterName,
privateEndpointConnectionName
privateEndpointConnectionName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets list of private endpoint connections on a cluster.
*
* @summary Gets list of private endpoint connections on a cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateEndpointConnectionsListByCluster.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsListByCluster.json
*/
async function getsListOfPrivateEndpointConnectionsOnACluster() {
const subscriptionId =
@ -32,7 +32,7 @@ async function getsListOfPrivateEndpointConnectionsOnACluster() {
const resArray = new Array();
for await (let item of client.privateEndpointConnections.listByCluster(
resourceGroupName,
clusterName
clusterName,
)) {
resArray.push(item);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets a private link resource for cluster.
*
* @summary Gets a private link resource for cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateLinkResourcesGet.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateLinkResourcesGet.json
*/
async function getsAPrivateLinkResourceForCluster() {
const subscriptionId =
@ -33,7 +33,7 @@ async function getsAPrivateLinkResourceForCluster() {
const result = await client.privateLinkResources.get(
resourceGroupName,
clusterName,
privateLinkResourceName
privateLinkResourceName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets the private link resources for cluster.
*
* @summary Gets the private link resources for cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/PrivateLinkResourceListByCluster.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateLinkResourceListByCluster.json
*/
async function getsThePrivateLinkResourcesForCluster() {
const subscriptionId =
@ -32,7 +32,7 @@ async function getsThePrivateLinkResourcesForCluster() {
const resArray = new Array();
for await (let item of client.privateLinkResources.listByCluster(
resourceGroupName,
clusterName
clusterName,
)) {
resArray.push(item);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Creates a new role or updates an existing role.
*
* @summary Creates a new role or updates an existing role.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/RoleCreate.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleCreate.json
*/
async function roleCreate() {
const subscriptionId =
@ -35,7 +35,7 @@ async function roleCreate() {
resourceGroupName,
clusterName,
roleName,
parameters
parameters,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Deletes a cluster role.
*
* @summary Deletes a cluster role.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/RoleDelete.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleDelete.json
*/
async function roleDelete() {
const subscriptionId =
@ -33,7 +33,7 @@ async function roleDelete() {
const result = await client.roles.beginDeleteAndWait(
resourceGroupName,
clusterName,
roleName
roleName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets information about a cluster role.
*
* @summary Gets information about a cluster role.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/RoleGet.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleGet.json
*/
async function getTheRoleOfTheCluster() {
const subscriptionId =
@ -33,7 +33,7 @@ async function getTheRoleOfTheCluster() {
const result = await client.roles.get(
resourceGroupName,
clusterName,
roleName
roleName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to List all the roles in a given cluster.
*
* @summary List all the roles in a given cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/RoleListByCluster.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleListByCluster.json
*/
async function roleList() {
const subscriptionId =
@ -32,7 +32,7 @@ async function roleList() {
const resArray = new Array();
for await (let item of client.roles.listByCluster(
resourceGroupName,
clusterName
clusterName,
)) {
resArray.push(item);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Gets information about a server in cluster.
*
* @summary Gets information about a server in cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ServerGet.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ServerGet.json
*/
async function getTheServerOfCluster() {
const subscriptionId =
@ -33,7 +33,7 @@ async function getTheServerOfCluster() {
const result = await client.servers.get(
resourceGroupName,
clusterName,
serverName
serverName,
);
console.log(result);
}

Просмотреть файл

@ -18,7 +18,7 @@ dotenv.config();
* This sample demonstrates how to Lists servers of a cluster.
*
* @summary Lists servers of a cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ServerListByCluster.json
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ServerListByCluster.json
*/
async function listServersOfTheCluster() {
const subscriptionId =
@ -32,7 +32,7 @@ async function listServersOfTheCluster() {
const resArray = new Array();
for await (let item of client.servers.listByCluster(
resourceGroupName,
clusterName
clusterName,
)) {
resArray.push(item);
}

Просмотреть файл

@ -0,0 +1,118 @@
# client library samples for JavaScript (Beta)
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [clustersCheckNameAvailabilitySample.js][clusterschecknameavailabilitysample] | Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/CheckNameAvailability.json |
| [clustersCreateSample.js][clusterscreatesample] | Creates a new cluster with servers. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreatePITR.json |
| [clustersDeleteSample.js][clustersdeletesample] | Deletes a cluster together with servers in it. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterDelete.json |
| [clustersGetSample.js][clustersgetsample] | Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterGet.json |
| [clustersListByResourceGroupSample.js][clusterslistbyresourcegroupsample] | Lists all clusters in a resource group. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterListByResourceGroup.json |
| [clustersListSample.js][clusterslistsample] | Lists all clusters in a subscription. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterList.json |
| [clustersPromoteReadReplicaSample.js][clusterspromotereadreplicasample] | Promotes read replica cluster to an independent read-write cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterPromoteReadReplica.json |
| [clustersRestartSample.js][clustersrestartsample] | Restarts all nodes in the cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterRestart.json |
| [clustersStartSample.js][clustersstartsample] | Starts stopped compute on all cluster nodes. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStart.json |
| [clustersStopSample.js][clustersstopsample] | Stops compute on all cluster nodes. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStop.json |
| [clustersUpdateSample.js][clustersupdatesample] | Updates an existing cluster. The request body can contain one or several properties from the cluster definition. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterScaleCompute.json |
| [configurationsGetCoordinatorSample.js][configurationsgetcoordinatorsample] | Gets information of a configuration for coordinator. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetCoordinator.json |
| [configurationsGetNodeSample.js][configurationsgetnodesample] | Gets information of a configuration for worker nodes. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetNode.json |
| [configurationsGetSample.js][configurationsgetsample] | Gets information of a configuration for coordinator and nodes. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGet.json |
| [configurationsListByClusterSample.js][configurationslistbyclustersample] | List all the configurations of a cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByCluster.json |
| [configurationsListByServerSample.js][configurationslistbyserversample] | List all the configurations of a server in cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByServer.json |
| [configurationsUpdateOnCoordinatorSample.js][configurationsupdateoncoordinatorsample] | Updates configuration of coordinator in a cluster x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationUpdateCoordinator.json |
| [configurationsUpdateOnNodeSample.js][configurationsupdateonnodesample] | Updates configuration of worker nodes in a cluster x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationUpdateNode.json |
| [firewallRulesCreateOrUpdateSample.js][firewallrulescreateorupdatesample] | Creates a new cluster firewall rule or updates an existing cluster firewall rule. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleCreate.json |
| [firewallRulesDeleteSample.js][firewallrulesdeletesample] | Deletes a cluster firewall rule. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleDelete.json |
| [firewallRulesGetSample.js][firewallrulesgetsample] | Gets information about a cluster firewall rule. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleGet.json |
| [firewallRulesListByClusterSample.js][firewallruleslistbyclustersample] | Lists all the firewall rules on cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleListByCluster.json |
| [operationsListSample.js][operationslistsample] | Lists all of the available REST API operations. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/OperationList.json |
| [privateEndpointConnectionsCreateOrUpdateSample.js][privateendpointconnectionscreateorupdatesample] | Approves or Rejects a private endpoint connection with a given name. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionCreateOrUpdate.json |
| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | Deletes a private endpoint connection with a given name. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsDelete.json |
| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | Gets private endpoint connection. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsGet.json |
| [privateEndpointConnectionsListByClusterSample.js][privateendpointconnectionslistbyclustersample] | Gets list of private endpoint connections on a cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsListByCluster.json |
| [privateLinkResourcesGetSample.js][privatelinkresourcesgetsample] | Gets a private link resource for cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateLinkResourcesGet.json |
| [privateLinkResourcesListByClusterSample.js][privatelinkresourceslistbyclustersample] | Gets the private link resources for cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateLinkResourceListByCluster.json |
| [rolesCreateSample.js][rolescreatesample] | Creates a new role or updates an existing role. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleCreate.json |
| [rolesDeleteSample.js][rolesdeletesample] | Deletes a cluster role. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleDelete.json |
| [rolesGetSample.js][rolesgetsample] | Gets information about a cluster role. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleGet.json |
| [rolesListByClusterSample.js][roleslistbyclustersample] | List all the roles in a given cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleListByCluster.json |
| [serversGetSample.js][serversgetsample] | Gets information about a server in cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ServerGet.json |
| [serversListByClusterSample.js][serverslistbyclustersample] | Lists servers of a cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ServerListByCluster.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node clustersCheckNameAvailabilitySample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID="<cosmosforpostgresql subscription id>" node clustersCheckNameAvailabilitySample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[clusterschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersCheckNameAvailabilitySample.js
[clusterscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersCreateSample.js
[clustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersDeleteSample.js
[clustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersGetSample.js
[clusterslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersListByResourceGroupSample.js
[clusterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersListSample.js
[clusterspromotereadreplicasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersPromoteReadReplicaSample.js
[clustersrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersRestartSample.js
[clustersstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersStartSample.js
[clustersstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersStopSample.js
[clustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/clustersUpdateSample.js
[configurationsgetcoordinatorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/configurationsGetCoordinatorSample.js
[configurationsgetnodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/configurationsGetNodeSample.js
[configurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/configurationsGetSample.js
[configurationslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/configurationsListByClusterSample.js
[configurationslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/configurationsListByServerSample.js
[configurationsupdateoncoordinatorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/configurationsUpdateOnCoordinatorSample.js
[configurationsupdateonnodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/configurationsUpdateOnNodeSample.js
[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/firewallRulesCreateOrUpdateSample.js
[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/firewallRulesDeleteSample.js
[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/firewallRulesGetSample.js
[firewallruleslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/firewallRulesListByClusterSample.js
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/operationsListSample.js
[privateendpointconnectionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/privateEndpointConnectionsCreateOrUpdateSample.js
[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js
[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js
[privateendpointconnectionslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/privateEndpointConnectionsListByClusterSample.js
[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/privateLinkResourcesGetSample.js
[privatelinkresourceslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/privateLinkResourcesListByClusterSample.js
[rolescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/rolesCreateSample.js
[rolesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/rolesDeleteSample.js
[rolesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/rolesGetSample.js
[roleslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/rolesListByClusterSample.js
[serversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/serversGetSample.js
[serverslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/javascript/serversListByClusterSample.js
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-cosmosdbforpostgresql?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/README.md

Просмотреть файл

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen.
*
* @summary Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/CheckNameAvailability.json
*/
async function checkNameAvailability() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const nameAvailabilityRequest = {
name: "name1",
type: "Microsoft.DBforPostgreSQL/serverGroupsv2",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.checkNameAvailability(nameAvailabilityRequest);
console.log(result);
}
async function main() {
checkNameAvailability();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,227 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreatePITR.json
*/
async function createANewClusterAsAPointInTimeRestore() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters = {
location: "westus",
pointInTimeUTC: new Date("2017-12-14T00:00:37.467Z"),
sourceLocation: "westus",
sourceResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateReadReplica.json
*/
async function createANewClusterAsAReadReplica() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters = {
location: "westus",
sourceLocation: "westus",
sourceResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateMultiNode.json
*/
async function createANewMultiNodeCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster-multinode";
const parameters = {
administratorLoginPassword: "password",
citusVersion: "11.1",
coordinatorEnablePublicIpAccess: true,
coordinatorServerEdition: "GeneralPurpose",
coordinatorStorageQuotaInMb: 524288,
coordinatorVCores: 4,
enableHa: true,
enableShardsOnCoordinator: false,
location: "westus",
nodeCount: 3,
nodeEnablePublicIpAccess: false,
nodeServerEdition: "MemoryOptimized",
nodeStorageQuotaInMb: 524288,
nodeVCores: 8,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: {},
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateBurstablev1.json
*/
async function createANewSingleNodeBurstable1VCoreCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster-burstablev1";
const parameters = {
administratorLoginPassword: "password",
citusVersion: "11.3",
coordinatorEnablePublicIpAccess: true,
coordinatorServerEdition: "BurstableMemoryOptimized",
coordinatorStorageQuotaInMb: 131072,
coordinatorVCores: 1,
enableHa: false,
enableShardsOnCoordinator: true,
location: "westus",
nodeCount: 0,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: { owner: "JohnDoe" },
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateBurstablev2.json
*/
async function createANewSingleNodeBurstable2VCoresCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster-burstablev2";
const parameters = {
administratorLoginPassword: "password",
citusVersion: "11.3",
coordinatorEnablePublicIpAccess: true,
coordinatorServerEdition: "BurstableGeneralPurpose",
coordinatorStorageQuotaInMb: 131072,
coordinatorVCores: 2,
enableHa: false,
enableShardsOnCoordinator: true,
location: "westus",
nodeCount: 0,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: { owner: "JohnDoe" },
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateSingleNode.json
*/
async function createANewSingleNodeCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster-singlenode";
const parameters = {
administratorLoginPassword: "password",
citusVersion: "11.3",
coordinatorEnablePublicIpAccess: true,
coordinatorServerEdition: "GeneralPurpose",
coordinatorStorageQuotaInMb: 131072,
coordinatorVCores: 8,
enableHa: true,
enableShardsOnCoordinator: true,
location: "westus",
nodeCount: 0,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: { owner: "JohnDoe" },
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
async function main() {
createANewClusterAsAPointInTimeRestore();
createANewClusterAsAReadReplica();
createANewMultiNodeCluster();
createANewSingleNodeBurstable1VCoreCluster();
createANewSingleNodeBurstable2VCoresCluster();
createANewSingleNodeCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Deletes a cluster together with servers in it.
*
* @summary Deletes a cluster together with servers in it.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterDelete.json
*/
async function deleteTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginDeleteAndWait(resourceGroupName, clusterName);
console.log(result);
}
async function main() {
deleteTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time.
*
* @summary Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterGet.json
*/
async function getTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.get(resourceGroupName, clusterName);
console.log(result);
}
async function main() {
getTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists all clusters in a resource group.
*
* @summary Lists all clusters in a resource group.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterListByResourceGroup.json
*/
async function listTheClustersByResourceGroup() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusters.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listTheClustersByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists all clusters in a subscription.
*
* @summary Lists all clusters in a subscription.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterList.json
*/
async function listAllTheClusters() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusters.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAllTheClusters();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Promotes read replica cluster to an independent read-write cluster.
*
* @summary Promotes read replica cluster to an independent read-write cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterPromoteReadReplica.json
*/
async function promoteReadReplicaClusterToAnIndependentReadWriteCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginPromoteReadReplicaAndWait(
resourceGroupName,
clusterName,
);
console.log(result);
}
async function main() {
promoteReadReplicaClusterToAnIndependentReadWriteCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Restarts all nodes in the cluster.
*
* @summary Restarts all nodes in the cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterRestart.json
*/
async function restartAllServersInTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginRestartAndWait(resourceGroupName, clusterName);
console.log(result);
}
async function main() {
restartAllServersInTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Starts stopped compute on all cluster nodes.
*
* @summary Starts stopped compute on all cluster nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStart.json
*/
async function startAllServersInTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginStartAndWait(resourceGroupName, clusterName);
console.log(result);
}
async function main() {
startAllServersInTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Stops compute on all cluster nodes.
*
* @summary Stops compute on all cluster nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStop.json
*/
async function stopAllServersInTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginStopAndWait(resourceGroupName, clusterName);
console.log(result);
}
async function main() {
stopAllServersInTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,145 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterScaleCompute.json
*/
async function scaleComputeUpOrDown() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters = { nodeVCores: 16 };
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterAddNode.json
*/
async function scaleOutAddNewWorkerNodes() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters = { nodeCount: 2 };
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterScaleStorage.json
*/
async function scaleUpStorage() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters = { nodeStorageQuotaInMb: 2097152 };
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterUpdate.json
*/
async function updateMultipleConfigurationSettingsOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters = {
administratorLoginPassword: "newpassword",
coordinatorVCores: 16,
nodeCount: 4,
nodeVCores: 16,
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterUpdateMaintenanceWindow.json
*/
async function updateOrDefineMaintenanceWindow() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters = {
maintenanceWindow: {
customWindow: "Enabled",
dayOfWeek: 0,
startHour: 8,
startMinute: 0,
},
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
async function main() {
scaleComputeUpOrDown();
scaleOutAddNewWorkerNodes();
scaleUpStorage();
updateMultipleConfigurationSettingsOfTheCluster();
updateOrDefineMaintenanceWindow();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,42 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets information of a configuration for coordinator.
*
* @summary Gets information of a configuration for coordinator.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetCoordinator.json
*/
async function getConfigurationDetailsForCoordinator() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const configurationName = "array_nulls";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.configurations.getCoordinator(
resourceGroupName,
clusterName,
configurationName,
);
console.log(result);
}
async function main() {
getConfigurationDetailsForCoordinator();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,42 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets information of a configuration for worker nodes.
*
* @summary Gets information of a configuration for worker nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetNode.json
*/
async function getConfigurationDetailsForNode() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const configurationName = "array_nulls";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.configurations.getNode(
resourceGroupName,
clusterName,
configurationName,
);
console.log(result);
}
async function main() {
getConfigurationDetailsForNode();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets information of a configuration for coordinator and nodes.
*
* @summary Gets information of a configuration for coordinator and nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGet.json
*/
async function getConfigurationDetails() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const configurationName = "client_encoding";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.configurations.get(resourceGroupName, clusterName, configurationName);
console.log(result);
}
async function main() {
getConfigurationDetails();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to List all the configurations of a cluster.
*
* @summary List all the configurations of a cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByCluster.json
*/
async function listConfigurationsOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.configurations.listByCluster(resourceGroupName, clusterName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listConfigurationsOfTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,45 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to List all the configurations of a server in cluster.
*
* @summary List all the configurations of a server in cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByServer.json
*/
async function listConfigurationsOfTheServerThatInTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const serverName = "testserver";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.configurations.listByServer(
resourceGroupName,
clusterName,
serverName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listConfigurationsOfTheServerThatInTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Updates configuration of coordinator in a cluster
*
* @summary Updates configuration of coordinator in a cluster
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationUpdateCoordinator.json
*/
async function updateSingleConfigurationOfCoordinator() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const configurationName = "array_nulls";
const parameters = { value: "on" };
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.configurations.beginUpdateOnCoordinatorAndWait(
resourceGroupName,
clusterName,
configurationName,
parameters,
);
console.log(result);
}
async function main() {
updateSingleConfigurationOfCoordinator();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Updates configuration of worker nodes in a cluster
*
* @summary Updates configuration of worker nodes in a cluster
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationUpdateNode.json
*/
async function updateSingleConfigurationOfNodes() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const configurationName = "array_nulls";
const parameters = { value: "off" };
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.configurations.beginUpdateOnNodeAndWait(
resourceGroupName,
clusterName,
configurationName,
parameters,
);
console.log(result);
}
async function main() {
updateSingleConfigurationOfNodes();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Creates a new cluster firewall rule or updates an existing cluster firewall rule.
*
* @summary Creates a new cluster firewall rule or updates an existing cluster firewall rule.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleCreate.json
*/
async function createAFirewallRuleOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "pgtestsvc4";
const firewallRuleName = "rule1";
const parameters = {
endIpAddress: "255.255.255.255",
startIpAddress: "0.0.0.0",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.firewallRules.beginCreateOrUpdateAndWait(
resourceGroupName,
clusterName,
firewallRuleName,
parameters,
);
console.log(result);
}
async function main() {
createAFirewallRuleOfTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,41 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Deletes a cluster firewall rule.
*
* @summary Deletes a cluster firewall rule.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleDelete.json
*/
async function deleteTheFirewallRuleOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "pgtestsvc4";
const firewallRuleName = "rule1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.firewallRules.beginDeleteAndWait(
resourceGroupName,
clusterName,
firewallRuleName,
);
console.log(result);
}
async function main() {
deleteTheFirewallRuleOfTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets information about a cluster firewall rule.
*
* @summary Gets information about a cluster firewall rule.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleGet.json
*/
async function getTheFirewallRuleOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "pgtestsvc4";
const firewallRuleName = "rule1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.firewallRules.get(resourceGroupName, clusterName, firewallRuleName);
console.log(result);
}
async function main() {
getTheFirewallRuleOfTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists all the firewall rules on cluster.
*
* @summary Lists all the firewall rules on cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleListByCluster.json
*/
async function listFirewallRulesOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "pgtestsvc4";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.firewallRules.listByCluster(resourceGroupName, clusterName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listFirewallRulesOfTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists all of the available REST API operations.
*
* @summary Lists all of the available REST API operations.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/OperationList.json
*/
async function listAllAvailableOperations() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAllAvailableOperations();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,32 @@
{
"name": "@azure-samples/arm-cosmosdbforpostgresql-js-beta",
"private": true,
"version": "1.0.0",
"description": " client library samples for JavaScript (Beta)",
"engines": {
"node": ">=18.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql",
"dependencies": {
"@azure/arm-cosmosdbforpostgresql": "next",
"dotenv": "latest",
"@azure/identity": "^4.0.1"
}
}

Просмотреть файл

@ -0,0 +1,48 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Approves or Rejects a private endpoint connection with a given name.
*
* @summary Approves or Rejects a private endpoint connection with a given name.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionCreateOrUpdate.json
*/
async function approvesOrRejectsAPrivateEndpointConnectionWithAGivenName() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const privateEndpointConnectionName = "private-endpoint-connection-name";
const parameters = {
privateLinkServiceConnectionState: {
description: "Approved by johndoe@contoso.com",
status: "Approved",
},
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.privateEndpointConnections.beginCreateOrUpdateAndWait(
resourceGroupName,
clusterName,
privateEndpointConnectionName,
parameters,
);
console.log(result);
}
async function main() {
approvesOrRejectsAPrivateEndpointConnectionWithAGivenName();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,41 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Deletes a private endpoint connection with a given name.
*
* @summary Deletes a private endpoint connection with a given name.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsDelete.json
*/
async function deletesAPrivateEndpointConnectionWithAGivenName() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const privateEndpointConnectionName = "private-endpoint-connection-name";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.privateEndpointConnections.beginDeleteAndWait(
resourceGroupName,
clusterName,
privateEndpointConnectionName,
);
console.log(result);
}
async function main() {
deletesAPrivateEndpointConnectionWithAGivenName();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,41 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets private endpoint connection.
*
* @summary Gets private endpoint connection.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsGet.json
*/
async function getsPrivateEndpointConnection() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const privateEndpointConnectionName = "private-endpoint-connection-name";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.privateEndpointConnections.get(
resourceGroupName,
clusterName,
privateEndpointConnectionName,
);
console.log(result);
}
async function main() {
getsPrivateEndpointConnection();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets list of private endpoint connections on a cluster.
*
* @summary Gets list of private endpoint connections on a cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsListByCluster.json
*/
async function getsListOfPrivateEndpointConnectionsOnACluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.privateEndpointConnections.listByCluster(
resourceGroupName,
clusterName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
getsListOfPrivateEndpointConnectionsOnACluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,41 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets a private link resource for cluster.
*
* @summary Gets a private link resource for cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateLinkResourcesGet.json
*/
async function getsAPrivateLinkResourceForCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const privateLinkResourceName = "plr";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.privateLinkResources.get(
resourceGroupName,
clusterName,
privateLinkResourceName,
);
console.log(result);
}
async function main() {
getsAPrivateLinkResourceForCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets the private link resources for cluster.
*
* @summary Gets the private link resources for cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateLinkResourceListByCluster.json
*/
async function getsThePrivateLinkResourcesForCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.privateLinkResources.listByCluster(
resourceGroupName,
clusterName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
getsThePrivateLinkResourcesForCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Creates a new role or updates an existing role.
*
* @summary Creates a new role or updates an existing role.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleCreate.json
*/
async function roleCreate() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "pgtestsvc4";
const roleName = "role1";
const parameters = { password: "password" };
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.roles.beginCreateAndWait(
resourceGroupName,
clusterName,
roleName,
parameters,
);
console.log(result);
}
async function main() {
roleCreate();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Deletes a cluster role.
*
* @summary Deletes a cluster role.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleDelete.json
*/
async function roleDelete() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "pgtestsvc4";
const roleName = "role1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.roles.beginDeleteAndWait(resourceGroupName, clusterName, roleName);
console.log(result);
}
async function main() {
roleDelete();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets information about a cluster role.
*
* @summary Gets information about a cluster role.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleGet.json
*/
async function getTheRoleOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "pgtestsvc4";
const roleName = "role1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.roles.get(resourceGroupName, clusterName, roleName);
console.log(result);
}
async function main() {
getTheRoleOfTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to List all the roles in a given cluster.
*
* @summary List all the roles in a given cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleListByCluster.json
*/
async function roleList() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "pgtestsvc4";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.roles.listByCluster(resourceGroupName, clusterName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
roleList();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Gets information about a server in cluster.
*
* @summary Gets information about a server in cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ServerGet.json
*/
async function getTheServerOfCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const serverName = "testcluster1-c";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.servers.get(resourceGroupName, clusterName, serverName);
console.log(result);
}
async function main() {
getTheServerOfCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { CosmosDBForPostgreSQL } = require("@azure/arm-cosmosdbforpostgresql");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists servers of a cluster.
*
* @summary Lists servers of a cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ServerListByCluster.json
*/
async function listServersOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.servers.listByCluster(resourceGroupName, clusterName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listServersOfTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,131 @@
# client library samples for TypeScript (Beta)
These sample programs show how to use the TypeScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [clustersCheckNameAvailabilitySample.ts][clusterschecknameavailabilitysample] | Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/CheckNameAvailability.json |
| [clustersCreateSample.ts][clusterscreatesample] | Creates a new cluster with servers. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreatePITR.json |
| [clustersDeleteSample.ts][clustersdeletesample] | Deletes a cluster together with servers in it. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterDelete.json |
| [clustersGetSample.ts][clustersgetsample] | Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterGet.json |
| [clustersListByResourceGroupSample.ts][clusterslistbyresourcegroupsample] | Lists all clusters in a resource group. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterListByResourceGroup.json |
| [clustersListSample.ts][clusterslistsample] | Lists all clusters in a subscription. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterList.json |
| [clustersPromoteReadReplicaSample.ts][clusterspromotereadreplicasample] | Promotes read replica cluster to an independent read-write cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterPromoteReadReplica.json |
| [clustersRestartSample.ts][clustersrestartsample] | Restarts all nodes in the cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterRestart.json |
| [clustersStartSample.ts][clustersstartsample] | Starts stopped compute on all cluster nodes. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStart.json |
| [clustersStopSample.ts][clustersstopsample] | Stops compute on all cluster nodes. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStop.json |
| [clustersUpdateSample.ts][clustersupdatesample] | Updates an existing cluster. The request body can contain one or several properties from the cluster definition. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterScaleCompute.json |
| [configurationsGetCoordinatorSample.ts][configurationsgetcoordinatorsample] | Gets information of a configuration for coordinator. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetCoordinator.json |
| [configurationsGetNodeSample.ts][configurationsgetnodesample] | Gets information of a configuration for worker nodes. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetNode.json |
| [configurationsGetSample.ts][configurationsgetsample] | Gets information of a configuration for coordinator and nodes. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGet.json |
| [configurationsListByClusterSample.ts][configurationslistbyclustersample] | List all the configurations of a cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByCluster.json |
| [configurationsListByServerSample.ts][configurationslistbyserversample] | List all the configurations of a server in cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByServer.json |
| [configurationsUpdateOnCoordinatorSample.ts][configurationsupdateoncoordinatorsample] | Updates configuration of coordinator in a cluster x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationUpdateCoordinator.json |
| [configurationsUpdateOnNodeSample.ts][configurationsupdateonnodesample] | Updates configuration of worker nodes in a cluster x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationUpdateNode.json |
| [firewallRulesCreateOrUpdateSample.ts][firewallrulescreateorupdatesample] | Creates a new cluster firewall rule or updates an existing cluster firewall rule. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleCreate.json |
| [firewallRulesDeleteSample.ts][firewallrulesdeletesample] | Deletes a cluster firewall rule. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleDelete.json |
| [firewallRulesGetSample.ts][firewallrulesgetsample] | Gets information about a cluster firewall rule. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleGet.json |
| [firewallRulesListByClusterSample.ts][firewallruleslistbyclustersample] | Lists all the firewall rules on cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/FirewallRuleListByCluster.json |
| [operationsListSample.ts][operationslistsample] | Lists all of the available REST API operations. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/OperationList.json |
| [privateEndpointConnectionsCreateOrUpdateSample.ts][privateendpointconnectionscreateorupdatesample] | Approves or Rejects a private endpoint connection with a given name. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionCreateOrUpdate.json |
| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | Deletes a private endpoint connection with a given name. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsDelete.json |
| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | Gets private endpoint connection. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsGet.json |
| [privateEndpointConnectionsListByClusterSample.ts][privateendpointconnectionslistbyclustersample] | Gets list of private endpoint connections on a cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateEndpointConnectionsListByCluster.json |
| [privateLinkResourcesGetSample.ts][privatelinkresourcesgetsample] | Gets a private link resource for cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateLinkResourcesGet.json |
| [privateLinkResourcesListByClusterSample.ts][privatelinkresourceslistbyclustersample] | Gets the private link resources for cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/PrivateLinkResourceListByCluster.json |
| [rolesCreateSample.ts][rolescreatesample] | Creates a new role or updates an existing role. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleCreate.json |
| [rolesDeleteSample.ts][rolesdeletesample] | Deletes a cluster role. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleDelete.json |
| [rolesGetSample.ts][rolesgetsample] | Gets information about a cluster role. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleGet.json |
| [rolesListByClusterSample.ts][roleslistbyclustersample] | List all the roles in a given cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/RoleListByCluster.json |
| [serversGetSample.ts][serversgetsample] | Gets information about a server in cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ServerGet.json |
| [serversListByClusterSample.ts][serverslistbyclustersample] | Lists servers of a cluster. x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ServerListByCluster.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
```bash
npm install -g typescript
```
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Compile the samples:
```bash
npm run build
```
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node dist/clustersCheckNameAvailabilitySample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID="<cosmosforpostgresql subscription id>" node dist/clustersCheckNameAvailabilitySample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[clusterschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersCheckNameAvailabilitySample.ts
[clusterscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersCreateSample.ts
[clustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersDeleteSample.ts
[clustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersGetSample.ts
[clusterslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersListByResourceGroupSample.ts
[clusterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersListSample.ts
[clusterspromotereadreplicasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersPromoteReadReplicaSample.ts
[clustersrestartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersRestartSample.ts
[clustersstartsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersStartSample.ts
[clustersstopsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersStopSample.ts
[clustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/clustersUpdateSample.ts
[configurationsgetcoordinatorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/configurationsGetCoordinatorSample.ts
[configurationsgetnodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/configurationsGetNodeSample.ts
[configurationsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/configurationsGetSample.ts
[configurationslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/configurationsListByClusterSample.ts
[configurationslistbyserversample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/configurationsListByServerSample.ts
[configurationsupdateoncoordinatorsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/configurationsUpdateOnCoordinatorSample.ts
[configurationsupdateonnodesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/configurationsUpdateOnNodeSample.ts
[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts
[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts
[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/firewallRulesGetSample.ts
[firewallruleslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/firewallRulesListByClusterSample.ts
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/operationsListSample.ts
[privateendpointconnectionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateOrUpdateSample.ts
[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts
[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts
[privateendpointconnectionslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/privateEndpointConnectionsListByClusterSample.ts
[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/privateLinkResourcesGetSample.ts
[privatelinkresourceslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/privateLinkResourcesListByClusterSample.ts
[rolescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/rolesCreateSample.ts
[rolesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/rolesDeleteSample.ts
[rolesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/rolesGetSample.ts
[roleslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/rolesListByClusterSample.ts
[serversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/serversGetSample.ts
[serverslistbyclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/samples/v1-beta/typescript/src/serversListByClusterSample.ts
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-cosmosdbforpostgresql?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql/README.md
[typescript]: https://www.typescriptlang.org/docs/home.html

Просмотреть файл

@ -0,0 +1,41 @@
{
"name": "@azure-samples/arm-cosmosdbforpostgresql-ts-beta",
"private": true,
"version": "1.0.0",
"description": " client library samples for TypeScript (Beta)",
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"build": "tsc",
"prebuild": "rimraf dist/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosforpostgresql/arm-cosmosdbforpostgresql",
"dependencies": {
"@azure/arm-cosmosdbforpostgresql": "next",
"dotenv": "latest",
"@azure/identity": "^4.0.1"
},
"devDependencies": {
"@types/node": "^18.0.0",
"typescript": "~5.3.3",
"rimraf": "latest"
}
}

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
NameAvailabilityRequest,
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen.
*
* @summary Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/CheckNameAvailability.json
*/
async function checkNameAvailability() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const nameAvailabilityRequest: NameAvailabilityRequest = {
name: "name1",
type: "Microsoft.DBforPostgreSQL/serverGroupsv2",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.checkNameAvailability(
nameAvailabilityRequest,
);
console.log(result);
}
async function main() {
checkNameAvailability();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,244 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
Cluster,
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreatePITR.json
*/
async function createANewClusterAsAPointInTimeRestore() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters: Cluster = {
location: "westus",
pointInTimeUTC: new Date("2017-12-14T00:00:37.467Z"),
sourceLocation: "westus",
sourceResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateReadReplica.json
*/
async function createANewClusterAsAReadReplica() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters: Cluster = {
location: "westus",
sourceLocation: "westus",
sourceResourceId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster",
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateMultiNode.json
*/
async function createANewMultiNodeCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster-multinode";
const parameters: Cluster = {
administratorLoginPassword: "password",
citusVersion: "11.1",
coordinatorEnablePublicIpAccess: true,
coordinatorServerEdition: "GeneralPurpose",
coordinatorStorageQuotaInMb: 524288,
coordinatorVCores: 4,
enableHa: true,
enableShardsOnCoordinator: false,
location: "westus",
nodeCount: 3,
nodeEnablePublicIpAccess: false,
nodeServerEdition: "MemoryOptimized",
nodeStorageQuotaInMb: 524288,
nodeVCores: 8,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: {},
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateBurstablev1.json
*/
async function createANewSingleNodeBurstable1VCoreCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster-burstablev1";
const parameters: Cluster = {
administratorLoginPassword: "password",
citusVersion: "11.3",
coordinatorEnablePublicIpAccess: true,
coordinatorServerEdition: "BurstableMemoryOptimized",
coordinatorStorageQuotaInMb: 131072,
coordinatorVCores: 1,
enableHa: false,
enableShardsOnCoordinator: true,
location: "westus",
nodeCount: 0,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: { owner: "JohnDoe" },
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateBurstablev2.json
*/
async function createANewSingleNodeBurstable2VCoresCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster-burstablev2";
const parameters: Cluster = {
administratorLoginPassword: "password",
citusVersion: "11.3",
coordinatorEnablePublicIpAccess: true,
coordinatorServerEdition: "BurstableGeneralPurpose",
coordinatorStorageQuotaInMb: 131072,
coordinatorVCores: 2,
enableHa: false,
enableShardsOnCoordinator: true,
location: "westus",
nodeCount: 0,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: { owner: "JohnDoe" },
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Creates a new cluster with servers.
*
* @summary Creates a new cluster with servers.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterCreateSingleNode.json
*/
async function createANewSingleNodeCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster-singlenode";
const parameters: Cluster = {
administratorLoginPassword: "password",
citusVersion: "11.3",
coordinatorEnablePublicIpAccess: true,
coordinatorServerEdition: "GeneralPurpose",
coordinatorStorageQuotaInMb: 131072,
coordinatorVCores: 8,
enableHa: true,
enableShardsOnCoordinator: true,
location: "westus",
nodeCount: 0,
postgresqlVersion: "15",
preferredPrimaryZone: "1",
tags: { owner: "JohnDoe" },
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
async function main() {
createANewClusterAsAPointInTimeRestore();
createANewClusterAsAReadReplica();
createANewMultiNodeCluster();
createANewSingleNodeBurstable1VCoreCluster();
createANewSingleNodeBurstable2VCoresCluster();
createANewSingleNodeCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Deletes a cluster together with servers in it.
*
* @summary Deletes a cluster together with servers in it.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterDelete.json
*/
async function deleteTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginDeleteAndWait(
resourceGroupName,
clusterName,
);
console.log(result);
}
async function main() {
deleteTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time.
*
* @summary Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterGet.json
*/
async function getTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.get(resourceGroupName, clusterName);
console.log(result);
}
async function main() {
getTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all clusters in a resource group.
*
* @summary Lists all clusters in a resource group.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterListByResourceGroup.json
*/
async function listTheClustersByResourceGroup() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusters.listByResourceGroup(
resourceGroupName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listTheClustersByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all clusters in a subscription.
*
* @summary Lists all clusters in a subscription.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterList.json
*/
async function listAllTheClusters() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.clusters.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAllTheClusters();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Promotes read replica cluster to an independent read-write cluster.
*
* @summary Promotes read replica cluster to an independent read-write cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterPromoteReadReplica.json
*/
async function promoteReadReplicaClusterToAnIndependentReadWriteCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginPromoteReadReplicaAndWait(
resourceGroupName,
clusterName,
);
console.log(result);
}
async function main() {
promoteReadReplicaClusterToAnIndependentReadWriteCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Restarts all nodes in the cluster.
*
* @summary Restarts all nodes in the cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterRestart.json
*/
async function restartAllServersInTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginRestartAndWait(
resourceGroupName,
clusterName,
);
console.log(result);
}
async function main() {
restartAllServersInTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Starts stopped compute on all cluster nodes.
*
* @summary Starts stopped compute on all cluster nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStart.json
*/
async function startAllServersInTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginStartAndWait(
resourceGroupName,
clusterName,
);
console.log(result);
}
async function main() {
startAllServersInTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Stops compute on all cluster nodes.
*
* @summary Stops compute on all cluster nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterStop.json
*/
async function stopAllServersInTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginStopAndWait(
resourceGroupName,
clusterName,
);
console.log(result);
}
async function main() {
stopAllServersInTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,160 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
ClusterForUpdate,
CosmosDBForPostgreSQL,
} from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterScaleCompute.json
*/
async function scaleComputeUpOrDown() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters: ClusterForUpdate = { nodeVCores: 16 };
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterAddNode.json
*/
async function scaleOutAddNewWorkerNodes() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters: ClusterForUpdate = { nodeCount: 2 };
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterScaleStorage.json
*/
async function scaleUpStorage() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters: ClusterForUpdate = { nodeStorageQuotaInMb: 2097152 };
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterUpdate.json
*/
async function updateMultipleConfigurationSettingsOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters: ClusterForUpdate = {
administratorLoginPassword: "newpassword",
coordinatorVCores: 16,
nodeCount: 4,
nodeVCores: 16,
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
/**
* This sample demonstrates how to Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
*
* @summary Updates an existing cluster. The request body can contain one or several properties from the cluster definition.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ClusterUpdateMaintenanceWindow.json
*/
async function updateOrDefineMaintenanceWindow() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestGroup";
const clusterName = "testcluster";
const parameters: ClusterForUpdate = {
maintenanceWindow: {
customWindow: "Enabled",
dayOfWeek: 0,
startHour: 8,
startMinute: 0,
},
};
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.clusters.beginUpdateAndWait(
resourceGroupName,
clusterName,
parameters,
);
console.log(result);
}
async function main() {
scaleComputeUpOrDown();
scaleOutAddNewWorkerNodes();
scaleUpStorage();
updateMultipleConfigurationSettingsOfTheCluster();
updateOrDefineMaintenanceWindow();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,45 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets information of a configuration for coordinator.
*
* @summary Gets information of a configuration for coordinator.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetCoordinator.json
*/
async function getConfigurationDetailsForCoordinator() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const configurationName = "array_nulls";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.configurations.getCoordinator(
resourceGroupName,
clusterName,
configurationName,
);
console.log(result);
}
async function main() {
getConfigurationDetailsForCoordinator();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,45 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets information of a configuration for worker nodes.
*
* @summary Gets information of a configuration for worker nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGetNode.json
*/
async function getConfigurationDetailsForNode() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const configurationName = "array_nulls";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.configurations.getNode(
resourceGroupName,
clusterName,
configurationName,
);
console.log(result);
}
async function main() {
getConfigurationDetailsForNode();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,45 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Gets information of a configuration for coordinator and nodes.
*
* @summary Gets information of a configuration for coordinator and nodes.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationGet.json
*/
async function getConfigurationDetails() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const configurationName = "client_encoding";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const result = await client.configurations.get(
resourceGroupName,
clusterName,
configurationName,
);
console.log(result);
}
async function main() {
getConfigurationDetails();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List all the configurations of a cluster.
*
* @summary List all the configurations of a cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByCluster.json
*/
async function listConfigurationsOfTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.configurations.listByCluster(
resourceGroupName,
clusterName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listConfigurationsOfTheCluster();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,48 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { CosmosDBForPostgreSQL } from "@azure/arm-cosmosdbforpostgresql";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List all the configurations of a server in cluster.
*
* @summary List all the configurations of a server in cluster.
* x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-02-preview/examples/ConfigurationListByServer.json
*/
async function listConfigurationsOfTheServerThatInTheCluster() {
const subscriptionId =
process.env["COSMOSFORPOSTGRESQL_SUBSCRIPTION_ID"] ||
"ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName =
process.env["COSMOSFORPOSTGRESQL_RESOURCE_GROUP"] || "TestResourceGroup";
const clusterName = "testcluster";
const serverName = "testserver";
const credential = new DefaultAzureCredential();
const client = new CosmosDBForPostgreSQL(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.configurations.listByServer(
resourceGroupName,
clusterName,
serverName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listConfigurationsOfTheServerThatInTheCluster();
}
main().catch(console.error);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше