diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e5b2dd2f31b2..09c9404a4e74 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -16712,13 +16712,13 @@ packages: dev: false file:projects/arm-mongocluster.tgz: - resolution: {integrity: sha512-C+Fh0CPft28MXX2huCTJ6UMZoBvu50cB2jlvAaHN0EsOCRHSgzeT3L7RkqgxlRsMypTy4aa3msN080B5T0KIiQ==, tarball: file:projects/arm-mongocluster.tgz} + resolution: {integrity: sha512-BXIAXomfaj0HGoO/IHj9dJHOu8gYDLcYxd39Zad3at+CoR92nXmVq5sSEGfHyYuGdtkF9233viTra3eAsusgVw==, tarball: file:projects/arm-mongocluster.tgz} name: '@rush-temp/arm-mongocluster' version: 0.0.0 dependencies: '@microsoft/api-extractor': 7.47.9(@types/node@18.19.55) '@types/node': 18.19.55 - '@vitest/browser': 2.1.3(playwright@1.48.0)(typescript@5.6.3)(vitest@2.1.3) + '@vitest/browser': 2.1.3(playwright@1.48.0)(typescript@5.5.4)(vitest@2.1.3) '@vitest/coverage-istanbul': 2.1.3(vitest@2.1.3) dotenv: 16.4.5 eslint: 8.57.1 @@ -16726,9 +16726,9 @@ packages: playwright: 1.48.0 prettier: 3.3.3 rimraf: 5.0.10 - tshy: 2.0.1 + tshy: 1.18.0 tslib: 2.7.0 - typescript: 5.6.3 + typescript: 5.5.4 vitest: 2.1.3(@types/node@18.19.55)(@vitest/browser@2.1.3) transitivePeerDependencies: - '@edge-runtime/vm' @@ -19905,7 +19905,7 @@ packages: dev: false file:projects/communication-common.tgz: - resolution: {integrity: sha512-BoEaaH3sJLyt/JMQFr7Fw+iEtJ+73S+Ycef8OXgaLJZqUqrKFHONVPvT9PgnMKMm7Drv75jkfxY/yY18ZlOp8A==, tarball: file:projects/communication-common.tgz} + resolution: {integrity: sha512-Wr6eM/yhM5LxsFiCMr1W/yKXpomNZSvt0OWPrqiCIvqFEbubo/2aP+ruDIOHPnrEyjzTNyg4ft7Ndb2Ko/UW7A==, tarball: file:projects/communication-common.tgz} name: '@rush-temp/communication-common' version: 0.0.0 dependencies: @@ -20622,7 +20622,7 @@ packages: dev: false file:projects/core-auth.tgz: - resolution: {integrity: sha512-jFQh88yO9S1mDW8im/imluq1K8wK6vefKOWPXXUcn24FdVvLzlxhaeyhlA+Z7UNYSR1tJMo7CsBIZcQAC+eFNw==, tarball: file:projects/core-auth.tgz} + resolution: {integrity: sha512-RZAaWHXxKCFv8sxtH7gUIXVSxB1fCbTOgDVDfCNhcHB82QY8tMKoSTPUCOskC8/KWJjvYUx+HqVC19qYMES5uw==, tarball: file:projects/core-auth.tgz} name: '@rush-temp/core-auth' version: 0.0.0 dependencies: @@ -20843,7 +20843,7 @@ packages: dev: false file:projects/core-rest-pipeline.tgz: - resolution: {integrity: sha512-HX6qgpLR1ensAItzcq5VAZYfZEJ7RWGEBut7YApBUCR6bp344rcVvpRlnBWZHkqXn+g+Mgq7m5F08MbLBLqAEw==, tarball: file:projects/core-rest-pipeline.tgz} + resolution: {integrity: sha512-oLtDVMidlOo+R29FiVr7BqT6W7wCy1kAiNr8RSDFkB9sTjTAtXSv5i9TkuIgNEhd0xCo7mITRVOyzvEkcQyMmg==, tarball: file:projects/core-rest-pipeline.tgz} name: '@rush-temp/core-rest-pipeline' version: 0.0.0 dependencies: @@ -21938,7 +21938,7 @@ packages: dev: false file:projects/identity-broker.tgz: - resolution: {integrity: sha512-AQBiNaB80DZYZ60YqO0uJuMTvxymE/vTC0Xkl0NR0Im1FWTzBd5+ydSh7kye/jy0zHHltW+msY7EWtz+AlRW2A==, tarball: file:projects/identity-broker.tgz} + resolution: {integrity: sha512-1tahR+8G2KdUFKmtBN5ZaakniCNAyO2WKdC6v3oS7V5vo1gdIMXk13JF2gtAtE/3k438uLFdSgq2ezTtpsJ+wQ==, tarball: file:projects/identity-broker.tgz} name: '@rush-temp/identity-broker' version: 0.0.0 dependencies: @@ -22037,7 +22037,7 @@ packages: dev: false file:projects/identity.tgz: - resolution: {integrity: sha512-jG/nY9yv3aWJVO752420iBV6lAZ4+ro5mVuPj/DTqNsGbdaOrgDJ3w4lunNVUsgVKZ+qkLD5WLx81dsrkEXfrw==, tarball: file:projects/identity.tgz} + resolution: {integrity: sha512-+CgeC7Z8IxP8R7RNW+A2SORwc6oPEQSQ6ZcIqy16sO8U6v9Hw7oj/mTjbKxxcuESfdy6DFr1uaij89mUu5pGeQ==, tarball: file:projects/identity.tgz} name: '@rush-temp/identity' version: 0.0.0 dependencies: @@ -22266,7 +22266,7 @@ packages: dev: false file:projects/keyvault-common.tgz: - resolution: {integrity: sha512-I2Xr9P7ab6GgkrVV5N+LgvtTn6v/KiEwhiuxmg/t7Ixma5UjL9Q+v0TGLtZN9ThouU/GHBUKYIQH6vdVMbC+4g==, tarball: file:projects/keyvault-common.tgz} + resolution: {integrity: sha512-fhIITLWXGA7iRET2+R9P9CniupXNlgz3yaD1f3uA9MeK2KwTSmNlz26rvRYGQn0G6OAWEVvxpaVbCEAGSKjA3A==, tarball: file:projects/keyvault-common.tgz} name: '@rush-temp/keyvault-common' version: 0.0.0 dependencies: diff --git a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md index 33a58588941d..7803009a5f53 100644 --- a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md +++ b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md @@ -1,10 +1,33 @@ # Release History -## 1.0.1 (2024-10-14) +## 2.0.0-beta.1 (2024-10-17) +Compared with version 1.0.0 + +### Features Added + + - Added Interface DataApiProperties + - Added Interface ErrorAdditionalInfo + - Added Interface ErrorDetail + - Added Interface ErrorResponse + - Added Type Alias DataApiMode + - Added Type Alias ResourceProvisioningState + - Added Type Alias Versions + - Interface MongoClusterProperties has a new optional parameter dataApi + - Interface MongoClusterUpdateProperties has a new optional parameter dataApi + - Added Enum KnownDataApiMode + - Added Enum KnownResourceProvisioningState + - Enum KnownOrigin has a new value "user,system" + - Enum KnownOrigin has a new value system + - Enum KnownOrigin has a new value user -### Bugs Fixed -- Fix missing package information issue in user agent +### Breaking Changes + - Removed Enum KnownProvisioningState + - Enum KnownOrigin no longer has value System + - Enum KnownOrigin no longer has value User + - Enum KnownOrigin no longer has value UserSystem + + ## 1.0.0 (2024-09-26) ### Features Added diff --git a/sdk/mongocluster/arm-mongocluster/README.md b/sdk/mongocluster/arm-mongocluster/README.md index 8bbefa478cf6..122e2ee1c563 100644 --- a/sdk/mongocluster/arm-mongocluster/README.md +++ b/sdk/mongocluster/arm-mongocluster/README.md @@ -4,7 +4,6 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mongocluster/arm-mongocluster) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-mongocluster) | [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-mongocluster?view=azure-node-preview) | @@ -29,7 +28,7 @@ Install the Azure MongoClusterManagement client library for JavaScript with `npm npm install @azure/arm-mongocluster ``` -### Create and authenticate a `MongoClusterManagementClient` +### Create and authenticate a `DocumentDBClient` To create a client object to access the Azure MongoClusterManagement API, you will need the `endpoint` of your Azure MongoClusterManagement resource and a `credential`. The Azure MongoClusterManagement client can use Azure Active Directory credentials to authenticate. You can find the endpoint for your Azure MongoClusterManagement resource in the [Azure Portal][azure_portal]. @@ -48,19 +47,19 @@ Set the values of the client ID, tenant ID, and client secret of the AAD applica For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). ```javascript -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DocumentDBClient } = require("@azure/arm-mongocluster"); const { DefaultAzureCredential } = require("@azure/identity"); // For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. const subscriptionId = "00000000-0000-0000-0000-000000000000"; -const client = new MongoClusterManagementClient(new DefaultAzureCredential(), subscriptionId); +const client = new DocumentDBClient(new DefaultAzureCredential(), subscriptionId); // For client-side applications running in the browser, use this code instead: // const credential = new InteractiveBrowserCredential({ // tenantId: "", // clientId: "" // }); -// const client = new MongoClusterManagementClient(credential, subscriptionId); +// const client = new DocumentDBClient(credential, subscriptionId); ``` @@ -69,9 +68,9 @@ To use this client library in the browser, first you need to use a bundler. For ## Key concepts -### MongoClusterManagementClient +### DocumentDBClient -`MongoClusterManagementClient` is the primary interface for developers using the Azure MongoClusterManagement client library. Explore the methods on this client object to understand the different features of the Azure MongoClusterManagement service that you can access. +`DocumentDBClient` is the primary interface for developers using the Azure MongoClusterManagement client library. Explore the methods on this client object to understand the different features of the Azure MongoClusterManagement service that you can access. ## Troubleshooting diff --git a/sdk/mongocluster/arm-mongocluster/assets.json b/sdk/mongocluster/arm-mongocluster/assets.json deleted file mode 100644 index bebf6e77b401..000000000000 --- a/sdk/mongocluster/arm-mongocluster/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/mongocluster/arm-mongocluster", - "Tag": "js/mongocluster/arm-mongocluster_2bd0c69134" -} diff --git a/sdk/mongocluster/arm-mongocluster/eslint.config.mjs b/sdk/mongocluster/arm-mongocluster/eslint.config.mjs index 03244d34a19f..113bdc3eaf5f 100644 --- a/sdk/mongocluster/arm-mongocluster/eslint.config.mjs +++ b/sdk/mongocluster/arm-mongocluster/eslint.config.mjs @@ -11,7 +11,7 @@ export default [ "@azure/azure-sdk/ts-package-json-module": "off", "@azure/azure-sdk/ts-package-json-files-required": "off", "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", - "tsdoc/syntax": "warn", - }, - }, + "tsdoc/syntax": "warn" + } + } ]; diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index 046181c4d2a1..b9674df77df9 100644 --- a/sdk/mongocluster/arm-mongocluster/package.json +++ b/sdk/mongocluster/arm-mongocluster/package.json @@ -1,6 +1,6 @@ { "name": "@azure/arm-mongocluster", - "version": "1.0.1", + "version": "2.0.0-beta.1", "description": "A generated SDK for DocumentDBClient.", "engines": { "node": ">=18.0.0" @@ -11,6 +11,7 @@ "exports": { "./package.json": "./package.json", ".": "./src/index.ts", + "./api": "./src/api/index.ts", "./models": "./src/models/index.ts" }, "dialects": [ @@ -50,110 +51,130 @@ "//metadata": { "constantPaths": [ { - "path": "src/api/mongoClusterManagementContext.ts", + "path": "src/rest/documentDBClient.ts", "prefix": "userAgentInfo" } ] }, "dependencies": { + "@azure/core-util": "^1.9.2", "@azure-rest/core-client": "^2.1.0", - "@azure/abort-controller": "^2.1.2", "@azure/core-auth": "^1.6.0", - "@azure/core-lro": "^3.0.0", "@azure/core-rest-pipeline": "^1.5.0", - "@azure/core-util": "^1.9.2", "@azure/logger": "^1.0.0", - "tslib": "^2.6.2" + "tslib": "^2.6.2", + "@azure/core-lro": "^3.0.0", + "@azure/abort-controller": "^2.1.2" }, "devDependencies": { - "@azure-tools/test-credential": "^2.0.0", - "@azure-tools/test-recorder": "^4.0.0", - "@azure/arm-network": "^33.2.0", - "@azure/dev-tool": "^1.0.0", - "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@azure/identity": "^4.2.1", + "dotenv": "^16.0.0", "@microsoft/api-extractor": "^7.40.3", "@types/node": "^18.0.0", - "@vitest/browser": "^2.0.5", - "@vitest/coverage-istanbul": "^2.0.5", - "dotenv": "^16.0.0", "eslint": "^8.55.0", - "mkdirp": "^3.0.1", - "playwright": "^1.41.2", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "tshy": "^2.0.0", - "typescript": "~5.6.2", - "vitest": "^2.0.5" + "mkdirp": "^3.0.1", + "typescript": "~5.5.3", + "tshy": "^1.11.1", + "@azure/identity": "^4.2.1", + "@vitest/browser": "^2.0.5", + "@vitest/coverage-istanbul": "^2.0.5", + "playwright": "^1.41.2", + "vitest": "^2.0.5", + "@azure-tools/test-credential": "^2.0.0", + "@azure-tools/test-recorder": "^4.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/eslint-plugin-azure-sdk": "^3.0.0" }, "scripts": { - "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", - "build": "npm run clean && dev-tool run build-package && mkdirp ./review && dev-tool run extract-api", - "build:samples": "dev-tool run typecheck --paths samples-dev/*.ts && dev-tool samples publish -f", - "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", - "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "dev-tool samples run samples-dev", "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api", - "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", - "generate:client": "echo skipped", - "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:browser": "echo skipped", - "integration-test:node": "echo skipped", - "lint": "echo skipped", - "lint:fix": "echo skipped", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "pack": "npm pack 2>&1", - "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", - "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", - "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", + "lint": "eslint package.json api-extractor.json src test", + "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", "unit-test": "npm run unit-test:node && npm run unit-test:browser", "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser", "unit-test:node": "dev-tool run test:vitest", - "update-snippets": "echo skipped" - }, - "//sampleConfiguration": { - "productName": "@azure/arm-mongocluster", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-mongocluster?view=azure-node-preview" + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build:samples": "echo skipped", + "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", + "execute:samples": "echo skipped", + "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", + "generate:client": "echo skipped", + "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "build:test": "npm run clean && tshy && dev-tool run build-test", + "build": "npm run clean && tshy && mkdirp ./review && dev-tool run extract-api", + "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", + "test": "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test" }, "exports": { "./package.json": "./package.json", ".": { "browser": { + "source": "./src/index.ts", "types": "./dist/browser/index.d.ts", "default": "./dist/browser/index.js" }, "react-native": { + "source": "./src/index.ts", "types": "./dist/react-native/index.d.ts", "default": "./dist/react-native/index.js" }, "import": { + "source": "./src/index.ts", "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.js" }, "require": { + "source": "./src/index.ts", "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } }, + "./api": { + "browser": { + "source": "./src/api/index.ts", + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "source": "./src/api/index.ts", + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "source": "./src/api/index.ts", + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "source": "./src/api/index.ts", + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, "./models": { "browser": { + "source": "./src/models/index.ts", "types": "./dist/browser/models/index.d.ts", "default": "./dist/browser/models/index.js" }, "react-native": { + "source": "./src/models/index.ts", "types": "./dist/react-native/models/index.d.ts", "default": "./dist/react-native/models/index.js" }, "import": { + "source": "./src/models/index.ts", "types": "./dist/esm/models/index.d.ts", "default": "./dist/esm/models/index.js" }, "require": { + "source": "./src/models/index.ts", "types": "./dist/commonjs/models/index.d.ts", "default": "./dist/commonjs/models/index.js" } diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md new file mode 100644 index 000000000000..00d3bab3fe22 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md @@ -0,0 +1,88 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export function createMongoClusterManagement(credential: TokenCredential, options?: MongoClusterManagementClientOptionalParams): DocumentDBContext; + +// @public (undocumented) +export interface DocumentDBContext extends Client { +} + +// @public +export function firewallRulesCreateOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams): PollerLike, FirewallRule>; + +// @public +export function firewallRulesDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): PollerLike, void>; + +// @public +export function firewallRulesGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; + +// @public +export function firewallRulesListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface MongoClusterManagementClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + +// @public +export function mongoClustersCheckNameAvailability(context: DocumentDBContext, subscriptionId: string, location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams): Promise; + +// @public +export function mongoClustersCreateOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams): PollerLike, MongoCluster>; + +// @public +export function mongoClustersDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): PollerLike, void>; + +// @public +export function mongoClustersGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): Promise; + +// @public +export function mongoClustersList(context: DocumentDBContext, subscriptionId: string, options?: MongoClustersListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function mongoClustersListByResourceGroup(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function mongoClustersListConnectionStrings(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): Promise; + +// @public +export function mongoClustersPromote(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, body: PromoteReplicaRequest, options?: MongoClustersPromoteOptionalParams): PollerLike, void>; + +// @public +export function mongoClustersUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams): PollerLike, MongoCluster>; + +// @public +export function operationsList(context: DocumentDBContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function privateEndpointConnectionsCreate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, PrivateEndpointConnectionResource>; + +// @public +export function privateEndpointConnectionsDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): PollerLike, void>; + +// @public +export function privateEndpointConnectionsGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; + +// @public +export function privateEndpointConnectionsListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public +export function privateLinksListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public +export function replicasListByParent(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: ReplicasListByParentOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md index 7311ad1896d0..332c3d4dd4e6 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md @@ -54,6 +54,34 @@ export type CreatedByType = string; // @public export type CreateMode = string; +// @public +export type DataApiMode = string; + +// @public +export interface DataApiProperties { + mode?: DataApiMode; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + // @public export interface FirewallRule extends ProxyResource { properties?: FirewallRuleProperties; @@ -119,6 +147,12 @@ export enum KnownCreateMode { Replica = "Replica" } +// @public +export enum KnownDataApiMode { + Disabled = "Disabled", + Enabled = "Enabled" +} + // @public export enum KnownHighAvailabilityMode { Disabled = "Disabled", @@ -139,9 +173,9 @@ export enum KnownMongoClusterStatus { // @public export enum KnownOrigin { - System = "system", - User = "user", - UserSystem = "user,system" + "user,system" = "user,system", + system = "system", + user = "user" } // @public @@ -174,16 +208,6 @@ export enum KnownPromoteOption { Forced = "Forced" } -// @public -export enum KnownProvisioningState { - Canceled = "Canceled", - Dropping = "Dropping", - Failed = "Failed", - InProgress = "InProgress", - Succeeded = "Succeeded", - Updating = "Updating" -} - // @public export enum KnownPublicNetworkAccess { Disabled = "Disabled", @@ -207,6 +231,13 @@ export enum KnownReplicationState { Updating = "Updating" } +// @public +export enum KnownResourceProvisioningState { + Canceled = "Canceled", + Failed = "Failed", + Succeeded = "Succeeded" +} + // @public export interface ListConnectionStringsResult { readonly connectionStrings?: ConnectionString[]; @@ -225,6 +256,7 @@ export interface MongoClusterProperties { compute?: ComputeProperties; readonly connectionString?: string; createMode?: CreateMode; + dataApi?: DataApiProperties; highAvailability?: HighAvailabilityProperties; readonly infrastructureVersion?: string; previewFeatures?: PreviewFeature[]; @@ -305,6 +337,7 @@ export interface MongoClusterUpdateProperties { administrator?: AdministratorProperties; backup?: BackupProperties; compute?: ComputeProperties; + dataApi?: DataApiProperties; highAvailability?: HighAvailabilityProperties; previewFeatures?: PreviewFeature[]; publicNetworkAccess?: PublicNetworkAccess; @@ -423,7 +456,7 @@ export interface PromoteReplicaRequest { } // @public -export type ProvisioningState = string; +export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; // @public export interface ProxyResource extends Resource { @@ -462,6 +495,9 @@ export interface Resource { readonly type?: string; } +// @public +export type ResourceProvisioningState = string; + // @public export interface ShardingProperties { shardCount?: number; @@ -488,6 +524,9 @@ export interface TrackedResource extends Resource { tags?: Record; } +// @public +export type Versions = "2024-03-01-preview" | "2024-06-01-preview" | "2024-07-01" | "2024-10-01-preview"; + // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md index 18735143ef6f..a2e0021babfe 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md @@ -66,6 +66,34 @@ export type CreatedByType = string; // @public export type CreateMode = string; +// @public +export type DataApiMode = string; + +// @public +export interface DataApiProperties { + mode?: DataApiMode; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + // @public export interface FirewallRule extends ProxyResource { properties?: FirewallRuleProperties; @@ -139,6 +167,12 @@ export enum KnownCreateMode { Replica = "Replica" } +// @public +export enum KnownDataApiMode { + Disabled = "Disabled", + Enabled = "Enabled" +} + // @public export enum KnownHighAvailabilityMode { Disabled = "Disabled", @@ -159,9 +193,9 @@ export enum KnownMongoClusterStatus { // @public export enum KnownOrigin { - System = "system", - User = "user", - UserSystem = "user,system" + "user,system" = "user,system", + system = "system", + user = "user" } // @public @@ -194,16 +228,6 @@ export enum KnownPromoteOption { Forced = "Forced" } -// @public -export enum KnownProvisioningState { - Canceled = "Canceled", - Dropping = "Dropping", - Failed = "Failed", - InProgress = "InProgress", - Succeeded = "Succeeded", - Updating = "Updating" -} - // @public export enum KnownPublicNetworkAccess { Disabled = "Disabled", @@ -227,6 +251,13 @@ export enum KnownReplicationState { Updating = "Updating" } +// @public +export enum KnownResourceProvisioningState { + Canceled = "Canceled", + Failed = "Failed", + Succeeded = "Succeeded" +} + // @public export interface ListConnectionStringsResult { readonly connectionStrings?: ConnectionString[]; @@ -262,6 +293,7 @@ export interface MongoClusterProperties { compute?: ComputeProperties; readonly connectionString?: string; createMode?: CreateMode; + dataApi?: DataApiProperties; highAvailability?: HighAvailabilityProperties; readonly infrastructureVersion?: string; previewFeatures?: PreviewFeature[]; @@ -355,6 +387,7 @@ export interface MongoClusterUpdateProperties { administrator?: AdministratorProperties; backup?: BackupProperties; compute?: ComputeProperties; + dataApi?: DataApiProperties; highAvailability?: HighAvailabilityProperties; previewFeatures?: PreviewFeature[]; publicNetworkAccess?: PublicNetworkAccess; @@ -503,7 +536,7 @@ export interface PromoteReplicaRequest { } // @public -export type ProvisioningState = string; +export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; // @public export interface ProxyResource extends Resource { @@ -547,6 +580,9 @@ export interface Resource { readonly type?: string; } +// @public +export type ResourceProvisioningState = string; + // @public export function restorePoller(client: MongoClusterManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; @@ -583,6 +619,9 @@ export interface TrackedResource extends Resource { tags?: Record; } +// @public +export type Versions = "2024-03-01-preview" | "2024-06-01-preview" | "2024-07-01" | "2024-10-01-preview"; + // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/mongocluster/arm-mongocluster/sample.env b/sdk/mongocluster/arm-mongocluster/sample.env deleted file mode 100644 index efbc7787bd3b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/sample.env +++ /dev/null @@ -1 +0,0 @@ -# Feel free to add your own environment variables. diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesCreateOrUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesCreateOrUpdateSample.ts deleted file mode 100644 index a25e99c695a4..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesCreateOrUpdateSample.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * - * @summary creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleCreate.json - */ -async function createsAFirewallRuleOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.createOrUpdate("TestGroup", "myMongoCluster", "rule1", { - properties: { - startIpAddress: "0.0.0.0", - endIpAddress: "255.255.255.255", - }, - }); - console.log(result); -} - -async function main() { - createsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesDeleteSample.ts deleted file mode 100644 index aef7d96808d8..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesDeleteSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to deletes a mongo cluster firewall rule. - * - * @summary deletes a mongo cluster firewall rule. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleDelete.json - */ -async function deletesAFirewallRuleOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.firewallRules.delete("TestGroup", "myMongoCluster", "rule1"); -} - -async function main() { - deletesAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesGetSample.ts deleted file mode 100644 index e7a15965955b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesGetSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to gets information about a mongo cluster firewall rule. - * - * @summary gets information about a mongo cluster firewall rule. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleGet.json - */ -async function getsAFirewallRuleOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.get("TestGroup", "myMongoCluster", "rule1"); - console.log(result); -} - -async function main() { - getsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesListByMongoClusterSample.ts deleted file mode 100644 index 1d2d5bd00ac2..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesListByMongoClusterSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list all the firewall rules in a given mongo cluster. - * - * @summary list all the firewall rules in a given mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleList.json - */ -async function listTheFirewallRulesOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.firewallRules.listByMongoCluster("TestGroup", "myMongoCluster")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listTheFirewallRulesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCheckNameAvailabilitySample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCheckNameAvailabilitySample.ts deleted file mode 100644 index 6c023932593f..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCheckNameAvailabilitySample.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to check if mongo cluster name is available for use. - * - * @summary check if mongo cluster name is available for use. - * x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability.json - */ -async function checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability("westus2", { - name: "newmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }); - console.log(result); -} - -/** - * This sample demonstrates how to check if mongo cluster name is available for use. - * - * @summary check if mongo cluster name is available for use. - * x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json - */ -async function checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability("westus2", { - name: "existingmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }); - console.log(result); -} - -async function main() { - checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse(); - checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCreateOrUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCreateOrUpdateSample.ts deleted file mode 100644 index facf0b5fef3e..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCreateOrUpdateSample.ts +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * - * @summary create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * x-ms-original-file: 2024-07-01/MongoClusters_Create.json - */ -async function createsANewMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.createOrUpdate("TestResourceGroup", "myMongoCluster", { - location: "westus2", - properties: { - administrator: { userName: "mongoAdmin", password: "password" }, - serverVersion: "5.0", - storage: { sizeGb: 128 }, - compute: { tier: "M30" }, - sharding: { shardCount: 1 }, - highAvailability: { targetMode: "SameZone" }, - }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * - * @summary create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * x-ms-original-file: 2024-07-01/MongoClusters_CreateGeoReplica.json - */ -async function createsAReplicaMongoClusterResourceFromASourceResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.createOrUpdate( - "TestResourceGroup", - "myReplicaMongoCluster", - { - location: "centralus", - properties: { - createMode: "GeoReplica", - replicaParameters: { - sourceResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster", - sourceLocation: "eastus", - }, - }, - }, - ); - console.log(result); -} - -/** - * This sample demonstrates how to create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * - * @summary create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * x-ms-original-file: 2024-07-01/MongoClusters_CreatePITR.json - */ -async function createsAMongoClusterResourceFromAPointInTimeRestore() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.createOrUpdate("TestResourceGroup", "myMongoCluster", { - location: "westus2", - properties: { - createMode: "PointInTimeRestore", - restoreParameters: { - pointInTimeUTC: new Date("2023-01-13T20:07:35Z"), - sourceResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster", - }, - }, - }); - console.log(result); -} - -async function main() { - createsANewMongoClusterResource(); - createsAReplicaMongoClusterResourceFromASourceResource(); - createsAMongoClusterResourceFromAPointInTimeRestore(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersDeleteSample.ts deleted file mode 100644 index 1d34ddd7974b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersDeleteSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to deletes a mongo cluster. - * - * @summary deletes a mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_Delete.json - */ -async function deletesAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.mongoClusters.delete("TestResourceGroup", "myMongoCluster"); -} - -async function main() { - deletesAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersGetSample.ts deleted file mode 100644 index 3ba2bb2f7cdc..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersGetSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to gets information about a mongo cluster. - * - * @summary gets information about a mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_Get.json - */ -async function getsAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.get("TestResourceGroup", "myMongoCluster"); - console.log(result); -} - -async function main() { - getsAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListByResourceGroupSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListByResourceGroupSample.ts deleted file mode 100644 index 6f83623f499e..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListByResourceGroupSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list all the mongo clusters in a given resource group. - * - * @summary list all the mongo clusters in a given resource group. - * x-ms-original-file: 2024-07-01/MongoClusters_ListByResourceGroup.json - */ -async function listsTheMongoClusterResourcesInAResourceGroup() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.mongoClusters.listByResourceGroup("TestResourceGroup")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsTheMongoClusterResourcesInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListConnectionStringsSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListConnectionStringsSample.ts deleted file mode 100644 index 44aba027b45e..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListConnectionStringsSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. - * - * @summary list mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_ListConnectionStrings.json - */ -async function listTheAvailableConnectionStringsForTheMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.listConnectionStrings("TestGroup", "myMongoCluster"); - console.log(result); -} - -async function main() { - listTheAvailableConnectionStringsForTheMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListSample.ts deleted file mode 100644 index 40c81c93e8c9..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list all the mongo clusters in a given subscription. - * - * @summary list all the mongo clusters in a given subscription. - * x-ms-original-file: 2024-07-01/MongoClusters_List.json - */ -async function listsTheMongoClusterResourcesInASubscription() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.mongoClusters.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsTheMongoClusterResourcesInASubscription(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersPromoteSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersPromoteSample.ts deleted file mode 100644 index a5ec6fd16da5..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersPromoteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to promotes a replica mongo cluster to a primary role. - * - * @summary promotes a replica mongo cluster to a primary role. - * x-ms-original-file: 2024-07-01/MongoClusters_ForcePromoteReplica.json - */ -async function promotesAReplicaMongoClusterResourceToAPrimaryRole() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.mongoClusters.promote("TestGroup", "myMongoCluster", { - promoteOption: "Forced", - mode: "Switchover", - }); -} - -async function main() { - promotesAReplicaMongoClusterResourceToAPrimaryRole(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersUpdateSample.ts deleted file mode 100644 index 19a90b9937fe..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersUpdateSample.ts +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_PatchDiskSize.json - */ -async function updatesTheDiskSizeOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { storage: { sizeGb: 256 } }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json - */ -async function disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { publicNetworkAccess: "Disabled" }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_ResetPassword.json - */ -async function resetsTheAdministratorLoginPassword() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { - administrator: { userName: "mongoAdmin", password: "password" }, - }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_Update.json - */ -async function updatesAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { - administrator: { userName: "mongoAdmin" }, - serverVersion: "5.0", - storage: { sizeGb: 256 }, - compute: { tier: "M50" }, - sharding: { shardCount: 4 }, - highAvailability: { targetMode: "SameZone" }, - previewFeatures: [], - publicNetworkAccess: "Enabled", - }, - }); - console.log(result); -} - -async function main() { - updatesTheDiskSizeOnAMongoClusterResource(); - disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection(); - resetsTheAdministratorLoginPassword(); - updatesAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/operationsListSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/operationsListSample.ts deleted file mode 100644 index b3a8e433900a..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/operationsListSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2024-07-01/Operations_List.json - */ -async function operationsList() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsCreateSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsCreateSample.ts deleted file mode 100644 index 6f27eb6793e2..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsCreateSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a Private endpoint connection - * - * @summary create a Private endpoint connection - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json - */ -async function approvesAPrivateEndpointConnectionOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.create( - "TestGroup", - "myMongoCluster", - "pecTest", - { - properties: { - privateLinkServiceConnectionState: { - status: "Approved", - description: "Auto-Approved", - }, - }, - }, - ); - console.log(result); -} - -async function main() { - approvesAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsDeleteSample.ts deleted file mode 100644 index d1799b1c96ee..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsDeleteSample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete the private endpoint connection - * - * @summary delete the private endpoint connection - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json - */ -async function deleteAPrivateEndpointConnectionOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.privateEndpointConnections.delete( - "TestGroup", - "myMongoCluster", - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", - ); -} - -async function main() { - deleteAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsGetSample.ts deleted file mode 100644 index be9b4b1d7d86..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsGetSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a specific private connection - * - * @summary get a specific private connection - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json - */ -async function getAPrivateEndpointConnectionOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.get( - "TestGroup", - "myMongoCluster", - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", - ); - console.log(result); -} - -async function main() { - getAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsListByMongoClusterSample.ts deleted file mode 100644 index 75e98fc72afc..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsListByMongoClusterSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list existing private connections - * - * @summary list existing private connections - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json - */ -async function listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateEndpointConnections.listByMongoCluster( - "TestGroup", - "myMongoCluster", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/privateLinksListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/privateLinksListByMongoClusterSample.ts deleted file mode 100644 index 642f611f2aea..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateLinksListByMongoClusterSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list private links on the given resource - * - * @summary list private links on the given resource - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateLinkResourceList.json - */ -async function listsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateLinks.listByMongoCluster("TestGroup", "myMongoCluster")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsThePrivateLinkResourcesAvailableOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/replicasListByParentSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/replicasListByParentSample.ts deleted file mode 100644 index 712c23963cbe..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/replicasListByParentSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list all the replicas for the mongo cluster. - * - * @summary list all the replicas for the mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_ReplicaList.json - */ -async function listTheReplicasLinkedToAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.replicas.listByParent("TestGroup", "myMongoCluster")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listTheReplicasLinkedToAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/README.md b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/README.md deleted file mode 100644 index 6e6bd52671e4..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/README.md +++ /dev/null @@ -1,88 +0,0 @@ -# @azure/arm-mongocluster client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for @azure/arm-mongocluster in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [firewallRulesCreateOrUpdateSample.js][firewallrulescreateorupdatesample] | creates a new firewall rule or updates an existing firewall rule on a mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleCreate.json | -| [firewallRulesDeleteSample.js][firewallrulesdeletesample] | deletes a mongo cluster firewall rule. x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleDelete.json | -| [firewallRulesGetSample.js][firewallrulesgetsample] | gets information about a mongo cluster firewall rule. x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleGet.json | -| [firewallRulesListByMongoClusterSample.js][firewallruleslistbymongoclustersample] | list all the firewall rules in a given mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleList.json | -| [mongoClustersCheckNameAvailabilitySample.js][mongoclusterschecknameavailabilitysample] | check if mongo cluster name is available for use. x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability.json | -| [mongoClustersCreateOrUpdateSample.js][mongoclusterscreateorupdatesample] | create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. x-ms-original-file: 2024-07-01/MongoClusters_Create.json | -| [mongoClustersDeleteSample.js][mongoclustersdeletesample] | deletes a mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_Delete.json | -| [mongoClustersGetSample.js][mongoclustersgetsample] | gets information about a mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_Get.json | -| [mongoClustersListByResourceGroupSample.js][mongoclusterslistbyresourcegroupsample] | list all the mongo clusters in a given resource group. x-ms-original-file: 2024-07-01/MongoClusters_ListByResourceGroup.json | -| [mongoClustersListConnectionStringsSample.js][mongoclusterslistconnectionstringssample] | list mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. x-ms-original-file: 2024-07-01/MongoClusters_ListConnectionStrings.json | -| [mongoClustersListSample.js][mongoclusterslistsample] | list all the mongo clusters in a given subscription. x-ms-original-file: 2024-07-01/MongoClusters_List.json | -| [mongoClustersPromoteSample.js][mongoclusterspromotesample] | promotes a replica mongo cluster to a primary role. x-ms-original-file: 2024-07-01/MongoClusters_ForcePromoteReplica.json | -| [mongoClustersUpdateSample.js][mongoclustersupdatesample] | updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. x-ms-original-file: 2024-07-01/MongoClusters_PatchDiskSize.json | -| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-07-01/Operations_List.json | -| [privateEndpointConnectionsCreateSample.js][privateendpointconnectionscreatesample] | create a Private endpoint connection x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json | -| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | delete the private endpoint connection x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json | -| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | get a specific private connection x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json | -| [privateEndpointConnectionsListByMongoClusterSample.js][privateendpointconnectionslistbymongoclustersample] | list existing private connections x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json | -| [privateLinksListByMongoClusterSample.js][privatelinkslistbymongoclustersample] | list private links on the given resource x-ms-original-file: 2024-07-01/MongoClusters_PrivateLinkResourceList.json | -| [replicasListByParentSample.js][replicaslistbyparentsample] | list all the replicas for the mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_ReplicaList.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 firewallRulesCreateOrUpdateSample.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 node firewallRulesCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesCreateOrUpdateSample.js -[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesDeleteSample.js -[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesGetSample.js -[firewallruleslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesListByMongoClusterSample.js -[mongoclusterschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersCheckNameAvailabilitySample.js -[mongoclusterscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersCreateOrUpdateSample.js -[mongoclustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersDeleteSample.js -[mongoclustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersGetSample.js -[mongoclusterslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListByResourceGroupSample.js -[mongoclusterslistconnectionstringssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListConnectionStringsSample.js -[mongoclusterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListSample.js -[mongoclusterspromotesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersPromoteSample.js -[mongoclustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersUpdateSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/operationsListSample.js -[privateendpointconnectionscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsCreateSample.js -[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsDeleteSample.js -[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsGetSample.js -[privateendpointconnectionslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsListByMongoClusterSample.js -[privatelinkslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateLinksListByMongoClusterSample.js -[replicaslistbyparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/replicasListByParentSample.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-mongocluster?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mongocluster/arm-mongocluster/README.md diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesCreateOrUpdateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesCreateOrUpdateSample.js deleted file mode 100644 index 45cfa02f4fe7..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesCreateOrUpdateSample.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * - * @summary creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleCreate.json - */ -async function createsAFirewallRuleOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.createOrUpdate("TestGroup", "myMongoCluster", "rule1", { - properties: { - startIpAddress: "0.0.0.0", - endIpAddress: "255.255.255.255", - }, - }); - console.log(result); -} - -async function main() { - createsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesDeleteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesDeleteSample.js deleted file mode 100644 index 95715ac2867c..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesDeleteSample.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to deletes a mongo cluster firewall rule. - * - * @summary deletes a mongo cluster firewall rule. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleDelete.json - */ -async function deletesAFirewallRuleOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.firewallRules.delete("TestGroup", "myMongoCluster", "rule1"); -} - -async function main() { - deletesAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesGetSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesGetSample.js deleted file mode 100644 index 5329281bd63f..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesGetSample.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to gets information about a mongo cluster firewall rule. - * - * @summary gets information about a mongo cluster firewall rule. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleGet.json - */ -async function getsAFirewallRuleOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.get("TestGroup", "myMongoCluster", "rule1"); - console.log(result); -} - -async function main() { - getsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesListByMongoClusterSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesListByMongoClusterSample.js deleted file mode 100644 index 5b03469f23c5..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/firewallRulesListByMongoClusterSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list all the firewall rules in a given mongo cluster. - * - * @summary list all the firewall rules in a given mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleList.json - */ -async function listTheFirewallRulesOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.firewallRules.listByMongoCluster("TestGroup", "myMongoCluster")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listTheFirewallRulesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersCheckNameAvailabilitySample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersCheckNameAvailabilitySample.js deleted file mode 100644 index ee66d946caef..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersCheckNameAvailabilitySample.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to check if mongo cluster name is available for use. - * - * @summary check if mongo cluster name is available for use. - * x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability.json - */ -async function checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability("westus2", { - name: "newmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }); - console.log(result); -} - -/** - * This sample demonstrates how to check if mongo cluster name is available for use. - * - * @summary check if mongo cluster name is available for use. - * x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json - */ -async function checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability("westus2", { - name: "existingmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }); - console.log(result); -} - -async function main() { - checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse(); - checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersCreateOrUpdateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersCreateOrUpdateSample.js deleted file mode 100644 index 1169bd998a55..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersCreateOrUpdateSample.js +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * - * @summary create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * x-ms-original-file: 2024-07-01/MongoClusters_Create.json - */ -async function createsANewMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.createOrUpdate("TestResourceGroup", "myMongoCluster", { - location: "westus2", - properties: { - administrator: { userName: "mongoAdmin", password: "password" }, - serverVersion: "5.0", - storage: { sizeGb: 128 }, - compute: { tier: "M30" }, - sharding: { shardCount: 1 }, - highAvailability: { targetMode: "SameZone" }, - }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * - * @summary create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * x-ms-original-file: 2024-07-01/MongoClusters_CreateGeoReplica.json - */ -async function createsAReplicaMongoClusterResourceFromASourceResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.createOrUpdate( - "TestResourceGroup", - "myReplicaMongoCluster", - { - location: "centralus", - properties: { - createMode: "GeoReplica", - replicaParameters: { - sourceResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster", - sourceLocation: "eastus", - }, - }, - }, - ); - console.log(result); -} - -/** - * This sample demonstrates how to create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * - * @summary create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * x-ms-original-file: 2024-07-01/MongoClusters_CreatePITR.json - */ -async function createsAMongoClusterResourceFromAPointInTimeRestore() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.createOrUpdate("TestResourceGroup", "myMongoCluster", { - location: "westus2", - properties: { - createMode: "PointInTimeRestore", - restoreParameters: { - pointInTimeUTC: new Date("2023-01-13T20:07:35Z"), - sourceResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster", - }, - }, - }); - console.log(result); -} - -async function main() { - createsANewMongoClusterResource(); - createsAReplicaMongoClusterResourceFromASourceResource(); - createsAMongoClusterResourceFromAPointInTimeRestore(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersDeleteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersDeleteSample.js deleted file mode 100644 index 0867d0b93679..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersDeleteSample.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to deletes a mongo cluster. - * - * @summary deletes a mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_Delete.json - */ -async function deletesAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.mongoClusters.delete("TestResourceGroup", "myMongoCluster"); -} - -async function main() { - deletesAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersGetSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersGetSample.js deleted file mode 100644 index 36ab4dc936fc..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersGetSample.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to gets information about a mongo cluster. - * - * @summary gets information about a mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_Get.json - */ -async function getsAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.get("TestResourceGroup", "myMongoCluster"); - console.log(result); -} - -async function main() { - getsAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListByResourceGroupSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListByResourceGroupSample.js deleted file mode 100644 index 19f680c82644..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListByResourceGroupSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list all the mongo clusters in a given resource group. - * - * @summary list all the mongo clusters in a given resource group. - * x-ms-original-file: 2024-07-01/MongoClusters_ListByResourceGroup.json - */ -async function listsTheMongoClusterResourcesInAResourceGroup() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.mongoClusters.listByResourceGroup("TestResourceGroup")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsTheMongoClusterResourcesInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListConnectionStringsSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListConnectionStringsSample.js deleted file mode 100644 index 697d9632b333..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListConnectionStringsSample.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. - * - * @summary list mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_ListConnectionStrings.json - */ -async function listTheAvailableConnectionStringsForTheMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.listConnectionStrings("TestGroup", "myMongoCluster"); - console.log(result); -} - -async function main() { - listTheAvailableConnectionStringsForTheMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListSample.js deleted file mode 100644 index 2d682ada1a0c..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersListSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list all the mongo clusters in a given subscription. - * - * @summary list all the mongo clusters in a given subscription. - * x-ms-original-file: 2024-07-01/MongoClusters_List.json - */ -async function listsTheMongoClusterResourcesInASubscription() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.mongoClusters.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsTheMongoClusterResourcesInASubscription(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersPromoteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersPromoteSample.js deleted file mode 100644 index 77b698c44989..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersPromoteSample.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to promotes a replica mongo cluster to a primary role. - * - * @summary promotes a replica mongo cluster to a primary role. - * x-ms-original-file: 2024-07-01/MongoClusters_ForcePromoteReplica.json - */ -async function promotesAReplicaMongoClusterResourceToAPrimaryRole() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.mongoClusters.promote("TestGroup", "myMongoCluster", { - promoteOption: "Forced", - mode: "Switchover", - }); -} - -async function main() { - promotesAReplicaMongoClusterResourceToAPrimaryRole(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersUpdateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersUpdateSample.js deleted file mode 100644 index 1753990eaa02..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/mongoClustersUpdateSample.js +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_PatchDiskSize.json - */ -async function updatesTheDiskSizeOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { storage: { sizeGb: 256 } }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json - */ -async function disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { publicNetworkAccess: "Disabled" }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_ResetPassword.json - */ -async function resetsTheAdministratorLoginPassword() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { - administrator: { userName: "mongoAdmin", password: "password" }, - }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_Update.json - */ -async function updatesAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { - administrator: { userName: "mongoAdmin" }, - serverVersion: "5.0", - storage: { sizeGb: 256 }, - compute: { tier: "M50" }, - sharding: { shardCount: 4 }, - highAvailability: { targetMode: "SameZone" }, - previewFeatures: [], - publicNetworkAccess: "Enabled", - }, - }); - console.log(result); -} - -async function main() { - updatesTheDiskSizeOnAMongoClusterResource(); - disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection(); - resetsTheAdministratorLoginPassword(); - updatesAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/operationsListSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/operationsListSample.js deleted file mode 100644 index 0f90ce16f300..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/operationsListSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2024-07-01/Operations_List.json - */ -async function operationsList() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/package.json b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/package.json deleted file mode 100644 index 2906b19aad57..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@azure-samples/arm-mongocluster-js", - "private": true, - "version": "1.0.0", - "description": "@azure/arm-mongocluster client library samples for JavaScript", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/mongocluster/arm-mongocluster" - }, - "keywords": [ - "node", - "azure", - "cloud", - "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/mongocluster/arm-mongocluster", - "dependencies": { - "@azure/arm-mongocluster": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - } -} diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsCreateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsCreateSample.js deleted file mode 100644 index db7c89c199e8..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsCreateSample.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to create a Private endpoint connection - * - * @summary create a Private endpoint connection - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json - */ -async function approvesAPrivateEndpointConnectionOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.create( - "TestGroup", - "myMongoCluster", - "pecTest", - { - properties: { - privateLinkServiceConnectionState: { - status: "Approved", - description: "Auto-Approved", - }, - }, - }, - ); - console.log(result); -} - -async function main() { - approvesAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsDeleteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsDeleteSample.js deleted file mode 100644 index c028569d2be4..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsDeleteSample.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to delete the private endpoint connection - * - * @summary delete the private endpoint connection - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json - */ -async function deleteAPrivateEndpointConnectionOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.privateEndpointConnections.delete( - "TestGroup", - "myMongoCluster", - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", - ); -} - -async function main() { - deleteAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsGetSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsGetSample.js deleted file mode 100644 index da4687d00793..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsGetSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to get a specific private connection - * - * @summary get a specific private connection - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json - */ -async function getAPrivateEndpointConnectionOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.get( - "TestGroup", - "myMongoCluster", - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", - ); - console.log(result); -} - -async function main() { - getAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsListByMongoClusterSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsListByMongoClusterSample.js deleted file mode 100644 index bb6c588be253..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateEndpointConnectionsListByMongoClusterSample.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list existing private connections - * - * @summary list existing private connections - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json - */ -async function listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateEndpointConnections.listByMongoCluster( - "TestGroup", - "myMongoCluster", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateLinksListByMongoClusterSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateLinksListByMongoClusterSample.js deleted file mode 100644 index 3466be2685ab..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/privateLinksListByMongoClusterSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list private links on the given resource - * - * @summary list private links on the given resource - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateLinkResourceList.json - */ -async function listsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateLinks.listByMongoCluster("TestGroup", "myMongoCluster")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsThePrivateLinkResourcesAvailableOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/replicasListByParentSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/replicasListByParentSample.js deleted file mode 100644 index dcac0e86898f..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/replicasListByParentSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list all the replicas for the mongo cluster. - * - * @summary list all the replicas for the mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_ReplicaList.json - */ -async function listTheReplicasLinkedToAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.replicas.listByParent("TestGroup", "myMongoCluster")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listTheReplicasLinkedToAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/sample.env b/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/sample.env deleted file mode 100644 index efbc7787bd3b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/javascript/sample.env +++ /dev/null @@ -1 +0,0 @@ -# Feel free to add your own environment variables. diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/README.md b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/README.md deleted file mode 100644 index fa46af9d4d7f..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# @azure/arm-mongocluster client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for @azure/arm-mongocluster in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [firewallRulesCreateOrUpdateSample.ts][firewallrulescreateorupdatesample] | creates a new firewall rule or updates an existing firewall rule on a mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleCreate.json | -| [firewallRulesDeleteSample.ts][firewallrulesdeletesample] | deletes a mongo cluster firewall rule. x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleDelete.json | -| [firewallRulesGetSample.ts][firewallrulesgetsample] | gets information about a mongo cluster firewall rule. x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleGet.json | -| [firewallRulesListByMongoClusterSample.ts][firewallruleslistbymongoclustersample] | list all the firewall rules in a given mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleList.json | -| [mongoClustersCheckNameAvailabilitySample.ts][mongoclusterschecknameavailabilitysample] | check if mongo cluster name is available for use. x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability.json | -| [mongoClustersCreateOrUpdateSample.ts][mongoclusterscreateorupdatesample] | create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. x-ms-original-file: 2024-07-01/MongoClusters_Create.json | -| [mongoClustersDeleteSample.ts][mongoclustersdeletesample] | deletes a mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_Delete.json | -| [mongoClustersGetSample.ts][mongoclustersgetsample] | gets information about a mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_Get.json | -| [mongoClustersListByResourceGroupSample.ts][mongoclusterslistbyresourcegroupsample] | list all the mongo clusters in a given resource group. x-ms-original-file: 2024-07-01/MongoClusters_ListByResourceGroup.json | -| [mongoClustersListConnectionStringsSample.ts][mongoclusterslistconnectionstringssample] | list mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. x-ms-original-file: 2024-07-01/MongoClusters_ListConnectionStrings.json | -| [mongoClustersListSample.ts][mongoclusterslistsample] | list all the mongo clusters in a given subscription. x-ms-original-file: 2024-07-01/MongoClusters_List.json | -| [mongoClustersPromoteSample.ts][mongoclusterspromotesample] | promotes a replica mongo cluster to a primary role. x-ms-original-file: 2024-07-01/MongoClusters_ForcePromoteReplica.json | -| [mongoClustersUpdateSample.ts][mongoclustersupdatesample] | updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. x-ms-original-file: 2024-07-01/MongoClusters_PatchDiskSize.json | -| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-07-01/Operations_List.json | -| [privateEndpointConnectionsCreateSample.ts][privateendpointconnectionscreatesample] | create a Private endpoint connection x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json | -| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | delete the private endpoint connection x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json | -| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | get a specific private connection x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json | -| [privateEndpointConnectionsListByMongoClusterSample.ts][privateendpointconnectionslistbymongoclustersample] | list existing private connections x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json | -| [privateLinksListByMongoClusterSample.ts][privatelinkslistbymongoclustersample] | list private links on the given resource x-ms-original-file: 2024-07-01/MongoClusters_PrivateLinkResourceList.json | -| [replicasListByParentSample.ts][replicaslistbyparentsample] | list all the replicas for the mongo cluster. x-ms-original-file: 2024-07-01/MongoClusters_ReplicaList.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/firewallRulesCreateOrUpdateSample.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 node dist/firewallRulesCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesCreateOrUpdateSample.ts -[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesDeleteSample.ts -[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesGetSample.ts -[firewallruleslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesListByMongoClusterSample.ts -[mongoclusterschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersCheckNameAvailabilitySample.ts -[mongoclusterscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersCreateOrUpdateSample.ts -[mongoclustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersDeleteSample.ts -[mongoclustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersGetSample.ts -[mongoclusterslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListByResourceGroupSample.ts -[mongoclusterslistconnectionstringssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListConnectionStringsSample.ts -[mongoclusterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListSample.ts -[mongoclusterspromotesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersPromoteSample.ts -[mongoclustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersUpdateSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/operationsListSample.ts -[privateendpointconnectionscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsCreateSample.ts -[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsDeleteSample.ts -[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsGetSample.ts -[privateendpointconnectionslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts -[privatelinkslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateLinksListByMongoClusterSample.ts -[replicaslistbyparentsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/replicasListByParentSample.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-mongocluster?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mongocluster/arm-mongocluster/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/package.json b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/package.json deleted file mode 100644 index fe6bcf99e45c..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@azure-samples/arm-mongocluster-ts", - "private": true, - "version": "1.0.0", - "description": "@azure/arm-mongocluster client library samples for TypeScript", - "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/mongocluster/arm-mongocluster" - }, - "keywords": [ - "node", - "azure", - "cloud", - "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/mongocluster/arm-mongocluster", - "dependencies": { - "@azure/arm-mongocluster": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.5.3", - "rimraf": "latest" - } -} diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/sample.env b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/sample.env deleted file mode 100644 index efbc7787bd3b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/sample.env +++ /dev/null @@ -1 +0,0 @@ -# Feel free to add your own environment variables. diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesCreateOrUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesCreateOrUpdateSample.ts deleted file mode 100644 index a25e99c695a4..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesCreateOrUpdateSample.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * - * @summary creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleCreate.json - */ -async function createsAFirewallRuleOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.createOrUpdate("TestGroup", "myMongoCluster", "rule1", { - properties: { - startIpAddress: "0.0.0.0", - endIpAddress: "255.255.255.255", - }, - }); - console.log(result); -} - -async function main() { - createsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesDeleteSample.ts deleted file mode 100644 index aef7d96808d8..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesDeleteSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to deletes a mongo cluster firewall rule. - * - * @summary deletes a mongo cluster firewall rule. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleDelete.json - */ -async function deletesAFirewallRuleOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.firewallRules.delete("TestGroup", "myMongoCluster", "rule1"); -} - -async function main() { - deletesAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesGetSample.ts deleted file mode 100644 index e7a15965955b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesGetSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to gets information about a mongo cluster firewall rule. - * - * @summary gets information about a mongo cluster firewall rule. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleGet.json - */ -async function getsAFirewallRuleOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.get("TestGroup", "myMongoCluster", "rule1"); - console.log(result); -} - -async function main() { - getsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesListByMongoClusterSample.ts deleted file mode 100644 index 1d2d5bd00ac2..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/firewallRulesListByMongoClusterSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list all the firewall rules in a given mongo cluster. - * - * @summary list all the firewall rules in a given mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleList.json - */ -async function listTheFirewallRulesOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.firewallRules.listByMongoCluster("TestGroup", "myMongoCluster")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listTheFirewallRulesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersCheckNameAvailabilitySample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersCheckNameAvailabilitySample.ts deleted file mode 100644 index 6c023932593f..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersCheckNameAvailabilitySample.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to check if mongo cluster name is available for use. - * - * @summary check if mongo cluster name is available for use. - * x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability.json - */ -async function checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability("westus2", { - name: "newmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }); - console.log(result); -} - -/** - * This sample demonstrates how to check if mongo cluster name is available for use. - * - * @summary check if mongo cluster name is available for use. - * x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json - */ -async function checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability("westus2", { - name: "existingmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }); - console.log(result); -} - -async function main() { - checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse(); - checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersCreateOrUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersCreateOrUpdateSample.ts deleted file mode 100644 index facf0b5fef3e..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersCreateOrUpdateSample.ts +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * - * @summary create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * x-ms-original-file: 2024-07-01/MongoClusters_Create.json - */ -async function createsANewMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.createOrUpdate("TestResourceGroup", "myMongoCluster", { - location: "westus2", - properties: { - administrator: { userName: "mongoAdmin", password: "password" }, - serverVersion: "5.0", - storage: { sizeGb: 128 }, - compute: { tier: "M30" }, - sharding: { shardCount: 1 }, - highAvailability: { targetMode: "SameZone" }, - }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * - * @summary create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * x-ms-original-file: 2024-07-01/MongoClusters_CreateGeoReplica.json - */ -async function createsAReplicaMongoClusterResourceFromASourceResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.createOrUpdate( - "TestResourceGroup", - "myReplicaMongoCluster", - { - location: "centralus", - properties: { - createMode: "GeoReplica", - replicaParameters: { - sourceResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster", - sourceLocation: "eastus", - }, - }, - }, - ); - console.log(result); -} - -/** - * This sample demonstrates how to create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * - * @summary create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. - * x-ms-original-file: 2024-07-01/MongoClusters_CreatePITR.json - */ -async function createsAMongoClusterResourceFromAPointInTimeRestore() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.createOrUpdate("TestResourceGroup", "myMongoCluster", { - location: "westus2", - properties: { - createMode: "PointInTimeRestore", - restoreParameters: { - pointInTimeUTC: new Date("2023-01-13T20:07:35Z"), - sourceResourceId: - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster", - }, - }, - }); - console.log(result); -} - -async function main() { - createsANewMongoClusterResource(); - createsAReplicaMongoClusterResourceFromASourceResource(); - createsAMongoClusterResourceFromAPointInTimeRestore(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersDeleteSample.ts deleted file mode 100644 index 1d34ddd7974b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersDeleteSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to deletes a mongo cluster. - * - * @summary deletes a mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_Delete.json - */ -async function deletesAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.mongoClusters.delete("TestResourceGroup", "myMongoCluster"); -} - -async function main() { - deletesAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersGetSample.ts deleted file mode 100644 index 3ba2bb2f7cdc..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersGetSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to gets information about a mongo cluster. - * - * @summary gets information about a mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_Get.json - */ -async function getsAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.get("TestResourceGroup", "myMongoCluster"); - console.log(result); -} - -async function main() { - getsAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListByResourceGroupSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListByResourceGroupSample.ts deleted file mode 100644 index 6f83623f499e..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListByResourceGroupSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list all the mongo clusters in a given resource group. - * - * @summary list all the mongo clusters in a given resource group. - * x-ms-original-file: 2024-07-01/MongoClusters_ListByResourceGroup.json - */ -async function listsTheMongoClusterResourcesInAResourceGroup() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.mongoClusters.listByResourceGroup("TestResourceGroup")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsTheMongoClusterResourcesInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListConnectionStringsSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListConnectionStringsSample.ts deleted file mode 100644 index 44aba027b45e..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListConnectionStringsSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. - * - * @summary list mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_ListConnectionStrings.json - */ -async function listTheAvailableConnectionStringsForTheMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.listConnectionStrings("TestGroup", "myMongoCluster"); - console.log(result); -} - -async function main() { - listTheAvailableConnectionStringsForTheMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListSample.ts deleted file mode 100644 index 40c81c93e8c9..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersListSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list all the mongo clusters in a given subscription. - * - * @summary list all the mongo clusters in a given subscription. - * x-ms-original-file: 2024-07-01/MongoClusters_List.json - */ -async function listsTheMongoClusterResourcesInASubscription() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.mongoClusters.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsTheMongoClusterResourcesInASubscription(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersPromoteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersPromoteSample.ts deleted file mode 100644 index a5ec6fd16da5..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersPromoteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to promotes a replica mongo cluster to a primary role. - * - * @summary promotes a replica mongo cluster to a primary role. - * x-ms-original-file: 2024-07-01/MongoClusters_ForcePromoteReplica.json - */ -async function promotesAReplicaMongoClusterResourceToAPrimaryRole() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.mongoClusters.promote("TestGroup", "myMongoCluster", { - promoteOption: "Forced", - mode: "Switchover", - }); -} - -async function main() { - promotesAReplicaMongoClusterResourceToAPrimaryRole(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersUpdateSample.ts deleted file mode 100644 index 19a90b9937fe..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/mongoClustersUpdateSample.ts +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_PatchDiskSize.json - */ -async function updatesTheDiskSizeOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { storage: { sizeGb: 256 } }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json - */ -async function disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { publicNetworkAccess: "Disabled" }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_ResetPassword.json - */ -async function resetsTheAdministratorLoginPassword() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { - administrator: { userName: "mongoAdmin", password: "password" }, - }, - }); - console.log(result); -} - -/** - * This sample demonstrates how to updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * - * @summary updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. - * x-ms-original-file: 2024-07-01/MongoClusters_Update.json - */ -async function updatesAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.update("TestResourceGroup", "myMongoCluster", { - properties: { - administrator: { userName: "mongoAdmin" }, - serverVersion: "5.0", - storage: { sizeGb: 256 }, - compute: { tier: "M50" }, - sharding: { shardCount: 4 }, - highAvailability: { targetMode: "SameZone" }, - previewFeatures: [], - publicNetworkAccess: "Enabled", - }, - }); - console.log(result); -} - -async function main() { - updatesTheDiskSizeOnAMongoClusterResource(); - disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection(); - resetsTheAdministratorLoginPassword(); - updatesAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/operationsListSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/operationsListSample.ts deleted file mode 100644 index b3a8e433900a..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2024-07-01/Operations_List.json - */ -async function operationsList() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsCreateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsCreateSample.ts deleted file mode 100644 index 6f27eb6793e2..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsCreateSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a Private endpoint connection - * - * @summary create a Private endpoint connection - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json - */ -async function approvesAPrivateEndpointConnectionOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.create( - "TestGroup", - "myMongoCluster", - "pecTest", - { - properties: { - privateLinkServiceConnectionState: { - status: "Approved", - description: "Auto-Approved", - }, - }, - }, - ); - console.log(result); -} - -async function main() { - approvesAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsDeleteSample.ts deleted file mode 100644 index d1799b1c96ee..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsDeleteSample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete the private endpoint connection - * - * @summary delete the private endpoint connection - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json - */ -async function deleteAPrivateEndpointConnectionOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - await client.privateEndpointConnections.delete( - "TestGroup", - "myMongoCluster", - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", - ); -} - -async function main() { - deleteAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsGetSample.ts deleted file mode 100644 index be9b4b1d7d86..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsGetSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a specific private connection - * - * @summary get a specific private connection - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json - */ -async function getAPrivateEndpointConnectionOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.get( - "TestGroup", - "myMongoCluster", - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", - ); - console.log(result); -} - -async function main() { - getAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts deleted file mode 100644 index 75e98fc72afc..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list existing private connections - * - * @summary list existing private connections - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json - */ -async function listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateEndpointConnections.listByMongoCluster( - "TestGroup", - "myMongoCluster", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateLinksListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateLinksListByMongoClusterSample.ts deleted file mode 100644 index 642f611f2aea..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/privateLinksListByMongoClusterSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list private links on the given resource - * - * @summary list private links on the given resource - * x-ms-original-file: 2024-07-01/MongoClusters_PrivateLinkResourceList.json - */ -async function listsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateLinks.listByMongoCluster("TestGroup", "myMongoCluster")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listsThePrivateLinkResourcesAvailableOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/replicasListByParentSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/replicasListByParentSample.ts deleted file mode 100644 index 712c23963cbe..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/src/replicasListByParentSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list all the replicas for the mongo cluster. - * - * @summary list all the replicas for the mongo cluster. - * x-ms-original-file: 2024-07-01/MongoClusters_ReplicaList.json - */ -async function listTheReplicasLinkedToAMongoClusterResource() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.replicas.listByParent("TestGroup", "myMongoCluster")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listTheReplicasLinkedToAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/tsconfig.json b/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/tsconfig.json deleted file mode 100644 index 984eed535aa8..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts index 950805b92794..dfb6afaa4d5b 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts @@ -13,11 +13,11 @@ import { PathUncheckedResponse, createRestError, } from "@azure-rest/core-client"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { FirewallRulesGetOptionalParams, @@ -195,7 +195,6 @@ export function firewallRulesCreateOrUpdate( resource, options, ), - resourceLocationConfig: "azure-async-operation", }, ) as PollerLike, FirewallRule>; } @@ -239,20 +238,24 @@ export function firewallRulesDelete( firewallRuleName: string, options: FirewallRulesDeleteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller(context, _firewallRulesDeleteDeserialize, ["202", "204", "200"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _firewallRulesDeleteSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - firewallRuleName, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, void>; + return getLongRunningPoller( + context, + _firewallRulesDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _firewallRulesDeleteSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + options, + ), + }, + ) as PollerLike, void>; } export function _firewallRulesListByMongoClusterSend( diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts index 56b628fa6ef6..09fad59199b8 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts @@ -8,7 +8,8 @@ import { logger } from "../logger.js"; export interface DocumentDBContext extends Client {} /** Optional parameters for the client. */ -export interface MongoClusterManagementClientOptionalParams extends ClientOptions { +export interface MongoClusterManagementClientOptionalParams + extends ClientOptions { /** The API version to use for this operation. */ apiVersion?: string; } @@ -18,13 +19,13 @@ export function createMongoClusterManagement( credential: TokenCredential, options: MongoClusterManagementClientOptionalParams = {}, ): DocumentDBContext { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentInfo = `azsdk-js-arm-mongocluster/1.0.1`; const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` - : `azsdk-js-api ${userAgentInfo}`; + ? `${prefixFromOptions} azsdk-js-api` + : "azsdk-js-api"; const { apiVersion: _, ...updatedOptions } = { ...options, userAgentOptions: { userAgentPrefix }, @@ -35,7 +36,7 @@ export function createMongoClusterManagement( }; const clientContext = getClient(endpointUrl, credential, updatedOptions); clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - const apiVersion = options.apiVersion ?? "2024-07-01"; + const apiVersion = options.apiVersion ?? "2024-10-01-preview"; clientContext.pipeline.addPolicy({ name: "ClientApiVersionPolicy", sendRequest: (req, next) => { diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts index 06ac0d12fbb9..08ae1bd74421 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts @@ -20,11 +20,11 @@ import { createRestError, } from "@azure-rest/core-client"; import { serializeRecord } from "../../helpers/serializerHelpers.js"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { MongoClustersGetOptionalParams, @@ -93,16 +93,29 @@ export async function _mongoClustersGetDeserialize( ? undefined : { pointInTimeUTC: - result.body.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(result.body.properties?.restoreParameters?.["pointInTimeUTC"]) + result.body.properties?.restoreParameters?.[ + "pointInTimeUTC" + ] !== undefined + ? new Date( + result.body.properties?.restoreParameters?.[ + "pointInTimeUTC" + ], + ) : undefined, - sourceResourceId: result.body.properties?.restoreParameters?.["sourceResourceId"], + sourceResourceId: + result.body.properties?.restoreParameters?.[ + "sourceResourceId" + ], }, replicaParameters: !result.body.properties?.replicaParameters ? undefined : { - sourceResourceId: result.body.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: result.body.properties?.replicaParameters?.["sourceLocation"], + sourceResourceId: + result.body.properties?.replicaParameters?.[ + "sourceResourceId" + ], + sourceLocation: + result.body.properties?.replicaParameters?.["sourceLocation"], }, administrator: !result.body.properties?.administrator ? undefined @@ -118,7 +131,8 @@ export async function _mongoClustersGetDeserialize( highAvailability: !result.body.properties?.highAvailability ? undefined : { - targetMode: result.body.properties?.highAvailability?.["targetMode"], + targetMode: + result.body.properties?.highAvailability?.["targetMode"], }, storage: !result.body.properties?.storage ? undefined @@ -132,59 +146,77 @@ export async function _mongoClustersGetDeserialize( backup: !result.body.properties?.backup ? undefined : { - earliestRestoreTime: result.body.properties?.backup?.["earliestRestoreTime"], + earliestRestoreTime: + result.body.properties?.backup?.["earliestRestoreTime"], }, + dataApi: !result.body.properties?.dataApi + ? undefined + : { mode: result.body.properties?.dataApi?.["mode"] }, privateEndpointConnections: result.body.properties?.["privateEndpointConnections"] === undefined ? result.body.properties?.["privateEndpointConnections"] - : result.body.properties?.["privateEndpointConnections"].map((p: any) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { id: p.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState["actionsRequired"], + : result.body.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { id: p.properties?.privateEndpoint?.["id"] }, + privateLinkServiceConnectionState: { + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], + }, + }; + }, + ), previewFeatures: result.body.properties?.["previewFeatures"], replica: !result.body.properties?.replica ? undefined : { - sourceResourceId: result.body.properties?.replica?.["sourceResourceId"], + sourceResourceId: + result.body.properties?.replica?.["sourceResourceId"], role: result.body.properties?.replica?.["role"], - replicationState: result.body.properties?.replica?.["replicationState"], + replicationState: + result.body.properties?.replica?.["replicationState"], }, - infrastructureVersion: result.body.properties?.["infrastructureVersion"], + infrastructureVersion: + result.body.properties?.["infrastructureVersion"], }, }; } @@ -225,7 +257,9 @@ export function _mongoClustersCreateOrUpdateSend( .put({ ...operationOptionsToRequestParameters(options), body: { - tags: !resource.tags ? resource.tags : (serializeRecord(resource.tags as any) as any), + tags: !resource.tags + ? resource.tags + : (serializeRecord(resource.tags as any) as any), location: resource["location"], properties: !resource.properties ? resource.properties @@ -272,16 +306,29 @@ export async function _mongoClustersCreateOrUpdateDeserialize( ? undefined : { pointInTimeUTC: - result.body.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(result.body.properties?.restoreParameters?.["pointInTimeUTC"]) + result.body.properties?.restoreParameters?.[ + "pointInTimeUTC" + ] !== undefined + ? new Date( + result.body.properties?.restoreParameters?.[ + "pointInTimeUTC" + ], + ) : undefined, - sourceResourceId: result.body.properties?.restoreParameters?.["sourceResourceId"], + sourceResourceId: + result.body.properties?.restoreParameters?.[ + "sourceResourceId" + ], }, replicaParameters: !result.body.properties?.replicaParameters ? undefined : { - sourceResourceId: result.body.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: result.body.properties?.replicaParameters?.["sourceLocation"], + sourceResourceId: + result.body.properties?.replicaParameters?.[ + "sourceResourceId" + ], + sourceLocation: + result.body.properties?.replicaParameters?.["sourceLocation"], }, administrator: !result.body.properties?.administrator ? undefined @@ -297,7 +344,8 @@ export async function _mongoClustersCreateOrUpdateDeserialize( highAvailability: !result.body.properties?.highAvailability ? undefined : { - targetMode: result.body.properties?.highAvailability?.["targetMode"], + targetMode: + result.body.properties?.highAvailability?.["targetMode"], }, storage: !result.body.properties?.storage ? undefined @@ -311,59 +359,77 @@ export async function _mongoClustersCreateOrUpdateDeserialize( backup: !result.body.properties?.backup ? undefined : { - earliestRestoreTime: result.body.properties?.backup?.["earliestRestoreTime"], + earliestRestoreTime: + result.body.properties?.backup?.["earliestRestoreTime"], }, + dataApi: !result.body.properties?.dataApi + ? undefined + : { mode: result.body.properties?.dataApi?.["mode"] }, privateEndpointConnections: result.body.properties?.["privateEndpointConnections"] === undefined ? result.body.properties?.["privateEndpointConnections"] - : result.body.properties?.["privateEndpointConnections"].map((p: any) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { id: p.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState["actionsRequired"], + : result.body.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, + }, + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { id: p.properties?.privateEndpoint?.["id"] }, + privateLinkServiceConnectionState: { + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), + }; + }, + ), previewFeatures: result.body.properties?.["previewFeatures"], replica: !result.body.properties?.replica ? undefined : { - sourceResourceId: result.body.properties?.replica?.["sourceResourceId"], + sourceResourceId: + result.body.properties?.replica?.["sourceResourceId"], role: result.body.properties?.replica?.["role"], - replicationState: result.body.properties?.replica?.["replicationState"], + replicationState: + result.body.properties?.replica?.["replicationState"], }, - infrastructureVersion: result.body.properties?.["infrastructureVersion"], + infrastructureVersion: + result.body.properties?.["infrastructureVersion"], }, }; } @@ -377,20 +443,24 @@ export function mongoClustersCreateOrUpdate( resource: MongoCluster, options: MongoClustersCreateOrUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, MongoCluster> { - return getLongRunningPoller(context, _mongoClustersCreateOrUpdateDeserialize, ["200", "201"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _mongoClustersCreateOrUpdateSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - resource, - options, - ), - resourceLocationConfig: "azure-async-operation", - }) as PollerLike, MongoCluster>; + return getLongRunningPoller( + context, + _mongoClustersCreateOrUpdateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _mongoClustersCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + resource, + options, + ), + }, + ) as PollerLike, MongoCluster>; } export function _mongoClustersUpdateSend( @@ -411,7 +481,9 @@ export function _mongoClustersUpdateSend( .patch({ ...operationOptionsToRequestParameters(options), body: { - tags: !properties.tags ? properties.tags : (serializeRecord(properties.tags as any) as any), + tags: !properties.tags + ? properties.tags + : (serializeRecord(properties.tags as any) as any), properties: !properties.properties ? properties.properties : mongoClusterUpdatePropertiesSerializer(properties.properties), @@ -457,16 +529,29 @@ export async function _mongoClustersUpdateDeserialize( ? undefined : { pointInTimeUTC: - result.body.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(result.body.properties?.restoreParameters?.["pointInTimeUTC"]) + result.body.properties?.restoreParameters?.[ + "pointInTimeUTC" + ] !== undefined + ? new Date( + result.body.properties?.restoreParameters?.[ + "pointInTimeUTC" + ], + ) : undefined, - sourceResourceId: result.body.properties?.restoreParameters?.["sourceResourceId"], + sourceResourceId: + result.body.properties?.restoreParameters?.[ + "sourceResourceId" + ], }, replicaParameters: !result.body.properties?.replicaParameters ? undefined : { - sourceResourceId: result.body.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: result.body.properties?.replicaParameters?.["sourceLocation"], + sourceResourceId: + result.body.properties?.replicaParameters?.[ + "sourceResourceId" + ], + sourceLocation: + result.body.properties?.replicaParameters?.["sourceLocation"], }, administrator: !result.body.properties?.administrator ? undefined @@ -482,7 +567,8 @@ export async function _mongoClustersUpdateDeserialize( highAvailability: !result.body.properties?.highAvailability ? undefined : { - targetMode: result.body.properties?.highAvailability?.["targetMode"], + targetMode: + result.body.properties?.highAvailability?.["targetMode"], }, storage: !result.body.properties?.storage ? undefined @@ -496,59 +582,77 @@ export async function _mongoClustersUpdateDeserialize( backup: !result.body.properties?.backup ? undefined : { - earliestRestoreTime: result.body.properties?.backup?.["earliestRestoreTime"], + earliestRestoreTime: + result.body.properties?.backup?.["earliestRestoreTime"], }, + dataApi: !result.body.properties?.dataApi + ? undefined + : { mode: result.body.properties?.dataApi?.["mode"] }, privateEndpointConnections: result.body.properties?.["privateEndpointConnections"] === undefined ? result.body.properties?.["privateEndpointConnections"] - : result.body.properties?.["privateEndpointConnections"].map((p: any) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { id: p.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState["actionsRequired"], + : result.body.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, + }, + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { id: p.properties?.privateEndpoint?.["id"] }, + privateLinkServiceConnectionState: { + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), + }; + }, + ), previewFeatures: result.body.properties?.["previewFeatures"], replica: !result.body.properties?.replica ? undefined : { - sourceResourceId: result.body.properties?.replica?.["sourceResourceId"], + sourceResourceId: + result.body.properties?.replica?.["sourceResourceId"], role: result.body.properties?.replica?.["role"], - replicationState: result.body.properties?.replica?.["replicationState"], + replicationState: + result.body.properties?.replica?.["replicationState"], }, - infrastructureVersion: result.body.properties?.["infrastructureVersion"], + infrastructureVersion: + result.body.properties?.["infrastructureVersion"], }, }; } @@ -562,20 +666,24 @@ export function mongoClustersUpdate( properties: MongoClusterUpdate, options: MongoClustersUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, MongoCluster> { - return getLongRunningPoller(context, _mongoClustersUpdateDeserialize, ["200", "202"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _mongoClustersUpdateSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - properties, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, MongoCluster>; + return getLongRunningPoller( + context, + _mongoClustersUpdateDeserialize, + ["200", "202"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _mongoClustersUpdateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + properties, + options, + ), + }, + ) as PollerLike, MongoCluster>; } export function _mongoClustersDeleteSend( @@ -614,19 +722,23 @@ export function mongoClustersDelete( mongoClusterName: string, options: MongoClustersDeleteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller(context, _mongoClustersDeleteDeserialize, ["202", "204", "200"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _mongoClustersDeleteSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, void>; + return getLongRunningPoller( + context, + _mongoClustersDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _mongoClustersDeleteSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + }, + ) as PollerLike, void>; } export function _mongoClustersListByResourceGroupSend( @@ -686,16 +798,22 @@ export async function _mongoClustersListByResourceGroupDeserialize( ? undefined : { pointInTimeUTC: - p.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(p.properties?.restoreParameters?.["pointInTimeUTC"]) + p.properties?.restoreParameters?.["pointInTimeUTC"] !== + undefined + ? new Date( + p.properties?.restoreParameters?.["pointInTimeUTC"], + ) : undefined, - sourceResourceId: p.properties?.restoreParameters?.["sourceResourceId"], + sourceResourceId: + p.properties?.restoreParameters?.["sourceResourceId"], }, replicaParameters: !p.properties?.replicaParameters ? undefined : { - sourceResourceId: p.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: p.properties?.replicaParameters?.["sourceLocation"], + sourceResourceId: + p.properties?.replicaParameters?.["sourceResourceId"], + sourceLocation: + p.properties?.replicaParameters?.["sourceLocation"], }, administrator: !p.properties?.administrator ? undefined @@ -725,61 +843,80 @@ export async function _mongoClustersListByResourceGroupDeserialize( backup: !p.properties?.backup ? undefined : { - earliestRestoreTime: p.properties?.backup?.["earliestRestoreTime"], + earliestRestoreTime: + p.properties?.backup?.["earliestRestoreTime"], }, + dataApi: !p.properties?.dataApi + ? undefined + : { mode: p.properties?.dataApi?.["mode"] }, privateEndpointConnections: p.properties?.["privateEndpointConnections"] === undefined ? p.properties?.["privateEndpointConnections"] - : p.properties?.["privateEndpointConnections"].map((p: any) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { - id: p.properties?.privateEndpoint?.["id"], - }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState[ - "actionsRequired" - ], + : p.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: + p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { + id: p.properties?.privateEndpoint?.["id"], + }, + privateLinkServiceConnectionState: { + status: + p.properties + ?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties + ?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties + ?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], + }, + }; + }, + ), previewFeatures: p.properties?.["previewFeatures"], replica: !p.properties?.replica ? undefined : { - sourceResourceId: p.properties?.replica?.["sourceResourceId"], + sourceResourceId: + p.properties?.replica?.["sourceResourceId"], role: p.properties?.replica?.["role"], - replicationState: p.properties?.replica?.["replicationState"], + replicationState: + p.properties?.replica?.["replicationState"], }, infrastructureVersion: p.properties?.["infrastructureVersion"], }, @@ -801,7 +938,12 @@ export function mongoClustersListByResourceGroup( return buildPagedAsyncIterator( context, () => - _mongoClustersListByResourceGroupSend(context, subscriptionId, resourceGroupName, options), + _mongoClustersListByResourceGroupSend( + context, + subscriptionId, + resourceGroupName, + options, + ), _mongoClustersListByResourceGroupDeserialize, ["200"], { itemName: "value", nextLinkName: "nextLink" }, @@ -861,16 +1003,22 @@ export async function _mongoClustersListDeserialize( ? undefined : { pointInTimeUTC: - p.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(p.properties?.restoreParameters?.["pointInTimeUTC"]) + p.properties?.restoreParameters?.["pointInTimeUTC"] !== + undefined + ? new Date( + p.properties?.restoreParameters?.["pointInTimeUTC"], + ) : undefined, - sourceResourceId: p.properties?.restoreParameters?.["sourceResourceId"], + sourceResourceId: + p.properties?.restoreParameters?.["sourceResourceId"], }, replicaParameters: !p.properties?.replicaParameters ? undefined : { - sourceResourceId: p.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: p.properties?.replicaParameters?.["sourceLocation"], + sourceResourceId: + p.properties?.replicaParameters?.["sourceResourceId"], + sourceLocation: + p.properties?.replicaParameters?.["sourceLocation"], }, administrator: !p.properties?.administrator ? undefined @@ -900,61 +1048,80 @@ export async function _mongoClustersListDeserialize( backup: !p.properties?.backup ? undefined : { - earliestRestoreTime: p.properties?.backup?.["earliestRestoreTime"], + earliestRestoreTime: + p.properties?.backup?.["earliestRestoreTime"], }, + dataApi: !p.properties?.dataApi + ? undefined + : { mode: p.properties?.dataApi?.["mode"] }, privateEndpointConnections: p.properties?.["privateEndpointConnections"] === undefined ? p.properties?.["privateEndpointConnections"] - : p.properties?.["privateEndpointConnections"].map((p: any) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { - id: p.properties?.privateEndpoint?.["id"], - }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState[ - "actionsRequired" - ], + : p.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: + p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { + id: p.properties?.privateEndpoint?.["id"], + }, + privateLinkServiceConnectionState: { + status: + p.properties + ?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties + ?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties + ?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], + }, + }; + }, + ), previewFeatures: p.properties?.["previewFeatures"], replica: !p.properties?.replica ? undefined : { - sourceResourceId: p.properties?.replica?.["sourceResourceId"], + sourceResourceId: + p.properties?.replica?.["sourceResourceId"], role: p.properties?.replica?.["role"], - replicationState: p.properties?.replica?.["replicationState"], + replicationState: + p.properties?.replica?.["replicationState"], }, infrastructureVersion: p.properties?.["infrastructureVersion"], }, @@ -1137,18 +1304,22 @@ export function mongoClustersPromote( body: PromoteReplicaRequest, options: MongoClustersPromoteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller(context, _mongoClustersPromoteDeserialize, ["202", "200"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _mongoClustersPromoteSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - body, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, void>; + return getLongRunningPoller( + context, + _mongoClustersPromoteDeserialize, + ["202", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _mongoClustersPromoteSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + body, + options, + ), + }, + ) as PollerLike, void>; } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts index 89db93887a8d..9e310b33dac0 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts @@ -13,11 +13,11 @@ import { PathUncheckedResponse, createRestError, } from "@azure-rest/core-client"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { PrivateEndpointConnectionsListByMongoClusterOptionalParams, @@ -83,9 +83,16 @@ export async function _privateEndpointConnectionsListByMongoClusterDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: p.properties?.privateLinkServiceConnectionState["actionsRequired"], + status: + p.properties?.privateLinkServiceConnectionState["status"], + description: + p.properties?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], }, provisioningState: p.properties?.["provisioningState"], }, @@ -176,10 +183,18 @@ export async function _privateEndpointConnectionsGetDeserialize( ? undefined : { id: result.body.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: result.body.properties?.privateLinkServiceConnectionState["status"], - description: result.body.properties?.privateLinkServiceConnectionState["description"], + status: + result.body.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + result.body.properties?.privateLinkServiceConnectionState[ + "description" + ], actionsRequired: - result.body.properties?.privateLinkServiceConnectionState["actionsRequired"], + result.body.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], }, provisioningState: result.body.properties?.["provisioningState"], }, @@ -271,10 +286,18 @@ export async function _privateEndpointConnectionsCreateDeserialize( ? undefined : { id: result.body.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: result.body.properties?.privateLinkServiceConnectionState["status"], - description: result.body.properties?.privateLinkServiceConnectionState["description"], + status: + result.body.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + result.body.properties?.privateLinkServiceConnectionState[ + "description" + ], actionsRequired: - result.body.properties?.privateLinkServiceConnectionState["actionsRequired"], + result.body.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], }, provisioningState: result.body.properties?.["provisioningState"], }, @@ -313,7 +336,6 @@ export function privateEndpointConnectionsCreate( resource, options, ), - resourceLocationConfig: "azure-async-operation", }, ) as PollerLike< OperationState, @@ -380,7 +402,6 @@ export function privateEndpointConnectionsDelete( privateEndpointConnectionName, options, ), - resourceLocationConfig: "location", }, ) as PollerLike, void>; } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts index de8d18d0f8c2..ae3e65e8b38c 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts @@ -1,7 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { PrivateLinkResource, _PrivateLinkResourceListResult } from "../../models/models.js"; +import { + PrivateLinkResource, + _PrivateLinkResourceListResult, +} from "../../models/models.js"; import { DocumentDBContext as Client } from "../index.js"; import { StreamableMethod, diff --git a/sdk/mongocluster/arm-mongocluster/src/api/replicas/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/replicas/index.ts index 86813d8922d5..a670e5a35cb7 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/replicas/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/replicas/index.ts @@ -70,16 +70,22 @@ export async function _replicasListByParentDeserialize( ? undefined : { pointInTimeUTC: - p.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(p.properties?.restoreParameters?.["pointInTimeUTC"]) + p.properties?.restoreParameters?.["pointInTimeUTC"] !== + undefined + ? new Date( + p.properties?.restoreParameters?.["pointInTimeUTC"], + ) : undefined, - sourceResourceId: p.properties?.restoreParameters?.["sourceResourceId"], + sourceResourceId: + p.properties?.restoreParameters?.["sourceResourceId"], }, replicaParameters: !p.properties?.replicaParameters ? undefined : { - sourceResourceId: p.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: p.properties?.replicaParameters?.["sourceLocation"], + sourceResourceId: + p.properties?.replicaParameters?.["sourceResourceId"], + sourceLocation: + p.properties?.replicaParameters?.["sourceLocation"], }, administrator: !p.properties?.administrator ? undefined @@ -109,61 +115,80 @@ export async function _replicasListByParentDeserialize( backup: !p.properties?.backup ? undefined : { - earliestRestoreTime: p.properties?.backup?.["earliestRestoreTime"], + earliestRestoreTime: + p.properties?.backup?.["earliestRestoreTime"], }, + dataApi: !p.properties?.dataApi + ? undefined + : { mode: p.properties?.dataApi?.["mode"] }, privateEndpointConnections: p.properties?.["privateEndpointConnections"] === undefined ? p.properties?.["privateEndpointConnections"] - : p.properties?.["privateEndpointConnections"].map((p: any) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { - id: p.properties?.privateEndpoint?.["id"], - }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState[ - "actionsRequired" - ], + : p.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: + p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, + }, + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { + id: p.properties?.privateEndpoint?.["id"], + }, + privateLinkServiceConnectionState: { + status: + p.properties + ?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties + ?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties + ?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), + }; + }, + ), previewFeatures: p.properties?.["previewFeatures"], replica: !p.properties?.replica ? undefined : { - sourceResourceId: p.properties?.replica?.["sourceResourceId"], + sourceResourceId: + p.properties?.replica?.["sourceResourceId"], role: p.properties?.replica?.["role"], - replicationState: p.properties?.replica?.["replicationState"], + replicationState: + p.properties?.replica?.["replicationState"], }, infrastructureVersion: p.properties?.["infrastructureVersion"], }, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts index 867f92b187b7..1f317d481c38 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts @@ -50,7 +50,10 @@ export interface FirewallRulesOperations { ) => PagedAsyncIterableIterator; } -export function getFirewallRules(context: DocumentDBContext, subscriptionId: string) { +export function getFirewallRules( + context: DocumentDBContext, + subscriptionId: string, +) { return { get: ( resourceGroupName: string, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts index bf53a76fc5dc..ba71bc7aa5ba 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts @@ -69,7 +69,9 @@ export interface MongoClustersOperations { options?: MongoClustersListByResourceGroupOptionalParams, ) => PagedAsyncIterableIterator; /** List all the mongo clusters in a given subscription. */ - list: (options?: MongoClustersListOptionalParams) => PagedAsyncIterableIterator; + list: ( + options?: MongoClustersListOptionalParams, + ) => PagedAsyncIterableIterator; /** List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well as other connection strings supported by the cluster. */ listConnectionStrings: ( resourceGroupName: string, @@ -91,13 +93,23 @@ export interface MongoClustersOperations { ) => PollerLike, void>; } -export function getMongoClusters(context: DocumentDBContext, subscriptionId: string) { +export function getMongoClusters( + context: DocumentDBContext, + subscriptionId: string, +) { return { get: ( resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams, - ) => mongoClustersGet(context, subscriptionId, resourceGroupName, mongoClusterName, options), + ) => + mongoClustersGet( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), createOrUpdate: ( resourceGroupName: string, mongoClusterName: string, @@ -130,11 +142,24 @@ export function getMongoClusters(context: DocumentDBContext, subscriptionId: str resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams, - ) => mongoClustersDelete(context, subscriptionId, resourceGroupName, mongoClusterName, options), + ) => + mongoClustersDelete( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), listByResourceGroup: ( resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams, - ) => mongoClustersListByResourceGroup(context, subscriptionId, resourceGroupName, options), + ) => + mongoClustersListByResourceGroup( + context, + subscriptionId, + resourceGroupName, + options, + ), list: (options?: MongoClustersListOptionalParams) => mongoClustersList(context, subscriptionId, options), listConnectionStrings: ( @@ -153,7 +178,14 @@ export function getMongoClusters(context: DocumentDBContext, subscriptionId: str location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams, - ) => mongoClustersCheckNameAvailability(context, subscriptionId, location, body, options), + ) => + mongoClustersCheckNameAvailability( + context, + subscriptionId, + location, + body, + options, + ), promote: ( resourceGroupName: string, mongoClusterName: string, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts index 567cf05a0b0a..89092f5188e5 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts @@ -10,16 +10,21 @@ import { OperationsListOptionalParams } from "../../models/options.js"; /** Interface representing a Operations operations. */ export interface OperationsOperations { /** List the operations for the provider */ - list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; + list: ( + options?: OperationsListOptionalParams, + ) => PagedAsyncIterableIterator; } export function getOperations(context: DocumentDBContext) { return { - list: (options?: OperationsListOptionalParams) => operationsList(context, options), + list: (options?: OperationsListOptionalParams) => + operationsList(context, options), }; } -export function getOperationsOperations(context: DocumentDBContext): OperationsOperations { +export function getOperationsOperations( + context: DocumentDBContext, +): OperationsOperations { return { ...getOperations(context), }; diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts index adfe4e65d864..51f9313a1ec9 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts @@ -53,7 +53,10 @@ export interface PrivateEndpointConnectionsOperations { ) => PollerLike, void>; } -export function getPrivateEndpointConnections(context: DocumentDBContext, subscriptionId: string) { +export function getPrivateEndpointConnections( + context: DocumentDBContext, + subscriptionId: string, +) { return { listByMongoCluster: ( resourceGroupName: string, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts index a0111d477e3c..9fbf6acfbf50 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts @@ -17,7 +17,10 @@ export interface PrivateLinksOperations { ) => PagedAsyncIterableIterator; } -export function getPrivateLinks(context: DocumentDBContext, subscriptionId: string) { +export function getPrivateLinks( + context: DocumentDBContext, + subscriptionId: string, +) { return { listByMongoCluster: ( resourceGroupName: string, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/replicas/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/replicas/index.ts index f257e4c3f8d5..a655beef2936 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/replicas/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/replicas/index.ts @@ -17,14 +17,23 @@ export interface ReplicasOperations { ) => PagedAsyncIterableIterator; } -export function getReplicas(context: DocumentDBContext, subscriptionId: string) { +export function getReplicas( + context: DocumentDBContext, + subscriptionId: string, +) { return { listByParent: ( resourceGroupName: string, mongoClusterName: string, options?: ReplicasListByParentOptionalParams, ) => - replicasListByParent(context, subscriptionId, resourceGroupName, mongoClusterName, options), + replicasListByParent( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/helpers/serializerHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/helpers/serializerHelpers.ts index 7518a16c2ee9..4baaac77c8be 100644 --- a/sdk/mongocluster/arm-mongocluster/src/helpers/serializerHelpers.ts +++ b/sdk/mongocluster/arm-mongocluster/src/helpers/serializerHelpers.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export function serializeRecord( - item: Record, -): Record; +export function serializeRecord< + T extends string | number | boolean | Date | null, + R, +>(item: Record): Record; export function serializeRecord( item: Record, serializer: (item: T) => R, @@ -32,5 +33,8 @@ export function serializeRecord( } function isSupportedRecordType(t: any) { - return ["number", "string", "boolean", "null"].includes(typeof t) || t instanceof Date; + return ( + ["number", "string", "boolean", "null"].includes(typeof t) || + t instanceof Date + ); } diff --git a/sdk/mongocluster/arm-mongocluster/src/index.ts b/sdk/mongocluster/arm-mongocluster/src/index.ts index 9b74677592e8..ba919ebe21e0 100644 --- a/sdk/mongocluster/arm-mongocluster/src/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/index.ts @@ -25,7 +25,8 @@ export { MongoClusterRestoreParameters, MongoClusterReplicaParameters, AdministratorProperties, - KnownProvisioningState, + KnownResourceProvisioningState, + ResourceProvisioningState, KnownMongoClusterStatus, MongoClusterStatus, KnownPublicNetworkAccess, @@ -37,6 +38,9 @@ export { ShardingProperties, ComputeProperties, BackupProperties, + DataApiProperties, + KnownDataApiMode, + DataApiMode, PrivateEndpointConnection, PrivateEndpointConnectionProperties, PrivateEndpoint, @@ -52,6 +56,9 @@ export { ReplicationRole, KnownReplicationState, ReplicationState, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, PrivateLinkResource, PrivateLinkResourceProperties, PrivateEndpointConnectionResource, @@ -78,6 +85,7 @@ export { Origin, KnownActionType, ActionType, + Versions, ProvisioningState, OperationsListOptionalParams, MongoClustersGetOptionalParams, diff --git a/sdk/mongocluster/arm-mongocluster/src/models/index.ts b/sdk/mongocluster/arm-mongocluster/src/models/index.ts index e278a20bf06b..ddaaf273a998 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/index.ts @@ -14,7 +14,8 @@ export { MongoClusterRestoreParameters, MongoClusterReplicaParameters, AdministratorProperties, - KnownProvisioningState, + KnownResourceProvisioningState, + ResourceProvisioningState, KnownMongoClusterStatus, MongoClusterStatus, KnownPublicNetworkAccess, @@ -26,6 +27,9 @@ export { ShardingProperties, ComputeProperties, BackupProperties, + DataApiProperties, + KnownDataApiMode, + DataApiMode, PrivateEndpointConnection, PrivateEndpointConnectionProperties, PrivateEndpoint, @@ -41,6 +45,9 @@ export { ReplicationRole, KnownReplicationState, ReplicationState, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, PrivateLinkResource, PrivateLinkResourceProperties, PrivateEndpointConnectionResource, @@ -67,6 +74,7 @@ export { Origin, KnownActionType, ActionType, + Versions, ProvisioningState, } from "./models.js"; export { diff --git a/sdk/mongocluster/arm-mongocluster/src/models/models.ts b/sdk/mongocluster/arm-mongocluster/src/models/models.ts index 70c7f64725c2..b065a52e1d9c 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/models.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/models.ts @@ -110,6 +110,8 @@ export interface MongoClusterProperties { compute?: ComputeProperties; /** The backup properties of the mongo cluster. */ backup?: BackupProperties; + /** The Data API properties of the mongo cluster. */ + dataApi?: DataApiProperties; /** List of private endpoint connections. */ readonly privateEndpointConnections?: PrivateEndpointConnection[]; /** List of private endpoint connections. */ @@ -139,10 +141,21 @@ export function mongoClusterPropertiesSerializer( highAvailability: !item.highAvailability ? item.highAvailability : highAvailabilityPropertiesSerializer(item.highAvailability), - storage: !item.storage ? item.storage : storagePropertiesSerializer(item.storage), - sharding: !item.sharding ? item.sharding : shardingPropertiesSerializer(item.sharding), - compute: !item.compute ? item.compute : computePropertiesSerializer(item.compute), - backup: !item.backup ? item.backup : backupPropertiesSerializer(item.backup), + storage: !item.storage + ? item.storage + : storagePropertiesSerializer(item.storage), + sharding: !item.sharding + ? item.sharding + : shardingPropertiesSerializer(item.sharding), + compute: !item.compute + ? item.compute + : computePropertiesSerializer(item.compute), + backup: !item.backup + ? item.backup + : backupPropertiesSerializer(item.backup), + dataApi: !item.dataApi + ? item.dataApi + : dataApiPropertiesSerializer(item.dataApi), previewFeatures: item["previewFeatures"], }; } @@ -222,6 +235,27 @@ export function administratorPropertiesSerializer( }; } +/** Known values of {@link ResourceProvisioningState} that the service accepts. */ +export enum KnownResourceProvisioningState { + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed", + /** Canceled */ + Canceled = "Canceled", +} + +/** + * The provisioning state of a resource type. \ + * {@link KnownResourceProvisioningState} can be used interchangeably with ResourceProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Canceled** + */ +export type ResourceProvisioningState = string; + /** Known values of {@link MongoClusterStatus} that the service accepts. */ export enum KnownMongoClusterStatus { /** Ready */ @@ -314,7 +348,9 @@ export interface StorageProperties { sizeGb?: number; } -export function storagePropertiesSerializer(item: StorageProperties): Record { +export function storagePropertiesSerializer( + item: StorageProperties, +): Record { return { sizeGb: item["sizeGb"], }; @@ -326,7 +362,9 @@ export interface ShardingProperties { shardCount?: number; } -export function shardingPropertiesSerializer(item: ShardingProperties): Record { +export function shardingPropertiesSerializer( + item: ShardingProperties, +): Record { return { shardCount: item["shardCount"], }; @@ -338,7 +376,9 @@ export interface ComputeProperties { tier?: string; } -export function computePropertiesSerializer(item: ComputeProperties): Record { +export function computePropertiesSerializer( + item: ComputeProperties, +): Record { return { tier: item["tier"], }; @@ -354,6 +394,38 @@ export function backupPropertiesSerializer(item: BackupProperties) { return item as any; } +/** Data API properties. */ +export interface DataApiProperties { + /** The mode to indicate whether the Mongo Data API is enabled for a cluster. */ + mode?: DataApiMode; +} + +export function dataApiPropertiesSerializer( + item: DataApiProperties, +): Record { + return { + mode: item["mode"], + }; +} + +/** Known values of {@link DataApiMode} that the service accepts. */ +export enum KnownDataApiMode { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * The mode to apply to the Mongo Data API. \ + * {@link KnownDataApiMode} can be used interchangeably with DataApiMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type DataApiMode = string; + /** The private endpoint connection resource */ export interface PrivateEndpointConnection extends Resource { /** The private endpoint connection properties */ @@ -379,9 +451,10 @@ export function privateEndpointConnectionPropertiesSerializer( privateEndpoint: !item.privateEndpoint ? item.privateEndpoint : privateEndpointSerializer(item.privateEndpoint), - privateLinkServiceConnectionState: privateLinkServiceConnectionStateSerializer( - item.privateLinkServiceConnectionState, - ), + privateLinkServiceConnectionState: + privateLinkServiceConnectionStateSerializer( + item.privateLinkServiceConnectionState, + ), }; } @@ -536,6 +609,34 @@ export enum KnownReplicationState { */ export type ReplicationState = string; +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: Record; +} + /** The response of a PrivateLinkResource list operation. */ export interface _PrivateLinkResourceListResult { /** The PrivateLinkResource items on this page */ @@ -590,7 +691,9 @@ export interface FirewallRule extends ProxyResource { properties?: FirewallRuleProperties; } -export function firewallRuleSerializer(item: FirewallRule): Record { +export function firewallRuleSerializer( + item: FirewallRule, +): Record { return { properties: !item.properties ? item.properties @@ -633,7 +736,9 @@ export interface TrackedResource extends Resource { location: string; } -export function trackedResourceSerializer(item: TrackedResource): Record { +export function trackedResourceSerializer( + item: TrackedResource, +): Record { return { tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), location: item["location"], @@ -646,7 +751,9 @@ export interface MongoCluster extends TrackedResource { properties?: MongoClusterProperties; } -export function mongoClusterSerializer(item: MongoCluster): Record { +export function mongoClusterSerializer( + item: MongoCluster, +): Record { return { tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), location: item["location"], @@ -664,7 +771,9 @@ export interface MongoClusterUpdate { properties?: MongoClusterUpdateProperties; } -export function mongoClusterUpdateSerializer(item: MongoClusterUpdate): Record { +export function mongoClusterUpdateSerializer( + item: MongoClusterUpdate, +): Record { return { tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), properties: !item.properties @@ -691,6 +800,8 @@ export interface MongoClusterUpdateProperties { compute?: ComputeProperties; /** The backup properties of the mongo cluster. */ backup?: BackupProperties; + /** The Data API properties of the mongo cluster. */ + dataApi?: DataApiProperties; /** List of private endpoint connections. */ previewFeatures?: PreviewFeature[]; } @@ -707,10 +818,21 @@ export function mongoClusterUpdatePropertiesSerializer( highAvailability: !item.highAvailability ? item.highAvailability : highAvailabilityPropertiesSerializer(item.highAvailability), - storage: !item.storage ? item.storage : storagePropertiesSerializer(item.storage), - sharding: !item.sharding ? item.sharding : shardingPropertiesSerializer(item.sharding), - compute: !item.compute ? item.compute : computePropertiesSerializer(item.compute), - backup: !item.backup ? item.backup : backupPropertiesSerializer(item.backup), + storage: !item.storage + ? item.storage + : storagePropertiesSerializer(item.storage), + sharding: !item.sharding + ? item.sharding + : shardingPropertiesSerializer(item.sharding), + compute: !item.compute + ? item.compute + : computePropertiesSerializer(item.compute), + backup: !item.backup + ? item.backup + : backupPropertiesSerializer(item.backup), + dataApi: !item.dataApi + ? item.dataApi + : dataApiPropertiesSerializer(item.dataApi), previewFeatures: item["previewFeatures"], }; } @@ -868,11 +990,11 @@ export interface OperationDisplay { /** Known values of {@link Origin} that the service accepts. */ export enum KnownOrigin { /** user */ - User = "user", + user = "user", /** system */ - System = "system", + system = "system", /** user,system */ - UserSystem = "user,system", + "user,system" = "user,system", } /** @@ -900,34 +1022,16 @@ export enum KnownActionType { * **Internal** */ export type ActionType = string; - -/** Known values of {@link ProvisioningState } that the service accepts. */ -export enum KnownProvisioningState { - /** Succeeded */ - Succeeded = "Succeeded", - /** Failed */ - Failed = "Failed", - /** Canceled */ - Canceled = "Canceled", - /** InProgress */ - InProgress = "InProgress", - /** Updating */ - Updating = "Updating", - /** Dropping */ - Dropping = "Dropping", -} - -/** - * The provisioning state of a resource type. \ - * {@link KnownProvisioningState } can be used interchangeably with ResourceProvisioningState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Succeeded** \ - * **Failed** \ - * **Canceled** \ - * **InProgress** \ - * **Updating** \ - * **Dropping** - */ - -export type ProvisioningState = string; +/** The available API versions. */ +export type Versions = + | "2024-03-01-preview" + | "2024-06-01-preview" + | "2024-07-01" + | "2024-10-01-preview"; +/** Alias for ProvisioningState */ +export type ProvisioningState = + | string + | ResourceProvisioningState + | "InProgress" + | "Updating" + | "Dropping"; diff --git a/sdk/mongocluster/arm-mongocluster/src/models/options.ts b/sdk/mongocluster/arm-mongocluster/src/models/options.ts index 846a8c0efd09..d4537ed300f0 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/options.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/options.ts @@ -10,7 +10,8 @@ export interface OperationsListOptionalParams extends OperationOptions {} export interface MongoClustersGetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface MongoClustersCreateOrUpdateOptionalParams extends OperationOptions { +export interface MongoClustersCreateOrUpdateOptionalParams + extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } @@ -28,16 +29,19 @@ export interface MongoClustersDeleteOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface MongoClustersListByResourceGroupOptionalParams extends OperationOptions {} +export interface MongoClustersListByResourceGroupOptionalParams + extends OperationOptions {} /** Optional parameters. */ export interface MongoClustersListOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface MongoClustersListConnectionStringsOptionalParams extends OperationOptions {} +export interface MongoClustersListConnectionStringsOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface MongoClustersCheckNameAvailabilityOptionalParams extends OperationOptions {} +export interface MongoClustersCheckNameAvailabilityOptionalParams + extends OperationOptions {} /** Optional parameters. */ export interface MongoClustersPromoteOptionalParams extends OperationOptions { @@ -49,7 +53,8 @@ export interface MongoClustersPromoteOptionalParams extends OperationOptions { export interface FirewallRulesGetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { +export interface FirewallRulesCreateOrUpdateOptionalParams + extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } @@ -61,29 +66,34 @@ export interface FirewallRulesDeleteOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions {} +export interface FirewallRulesListByMongoClusterOptionalParams + extends OperationOptions {} /** Optional parameters. */ export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions {} +export interface PrivateEndpointConnectionsGetOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { +export interface PrivateEndpointConnectionsCreateOptionalParams + extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } /** Optional parameters. */ -export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { +export interface PrivateEndpointConnectionsDeleteOptionalParams + extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } /** Optional parameters. */ -export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions {} +export interface PrivateLinksListByMongoClusterOptionalParams + extends OperationOptions {} /** Optional parameters. */ export interface ReplicasListByParentOptionalParams extends OperationOptions {} diff --git a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts index 921a933f659d..783c12624c26 100644 --- a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts @@ -3,7 +3,10 @@ import { TokenCredential } from "@azure/core-auth"; import { Pipeline } from "@azure/core-rest-pipeline"; -import { getOperationsOperations, OperationsOperations } from "./classic/operations/index.js"; +import { + getOperationsOperations, + OperationsOperations, +} from "./classic/operations/index.js"; import { getMongoClustersOperations, MongoClustersOperations, @@ -16,8 +19,14 @@ import { getPrivateEndpointConnectionsOperations, PrivateEndpointConnectionsOperations, } from "./classic/privateEndpointConnections/index.js"; -import { getPrivateLinksOperations, PrivateLinksOperations } from "./classic/privateLinks/index.js"; -import { getReplicasOperations, ReplicasOperations } from "./classic/replicas/index.js"; +import { + getPrivateLinksOperations, + PrivateLinksOperations, +} from "./classic/privateLinks/index.js"; +import { + getReplicasOperations, + ReplicasOperations, +} from "./classic/replicas/index.js"; import { createMongoClusterManagement, DocumentDBContext, @@ -47,8 +56,14 @@ export class MongoClusterManagementClient { }); this.pipeline = this._client.pipeline; this.operations = getOperationsOperations(this._client); - this.mongoClusters = getMongoClustersOperations(this._client, subscriptionId); - this.firewallRules = getFirewallRulesOperations(this._client, subscriptionId); + this.mongoClusters = getMongoClustersOperations( + this._client, + subscriptionId, + ); + this.firewallRules = getFirewallRulesOperations( + this._client, + subscriptionId, + ); this.privateEndpointConnections = getPrivateEndpointConnectionsOperations( this._client, subscriptionId, diff --git a/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts index 537bb5010d58..feb90d7aa41b 100644 --- a/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts +++ b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts @@ -17,7 +17,10 @@ import { _privateEndpointConnectionsDeleteDeserialize, } from "./api/privateEndpointConnections/index.js"; import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; -import { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import { + OperationOptions, + PathUncheckedResponse, +} from "@azure-rest/core-client"; import { AbortSignalLike } from "@azure/abort-controller"; import { PollerLike, @@ -48,7 +51,9 @@ export interface RestorePollerOptions< export function restorePoller( client: MongoClusterManagementClient, serializedState: string, - sourceOperation: (...args: any[]) => PollerLike, TResult>, + sourceOperation: ( + ...args: any[] + ) => PollerLike, TResult>, options?: RestorePollerOptions, ): PollerLike, TResult> { const pollerConfig = deserializeState(serializedState).config; @@ -157,17 +162,24 @@ function getDeserializationHelper( // track if we have found a match to return the values found. let found = true; - for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { - if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + for ( + let i = candidateParts.length - 1, j = pathParts.length - 1; + i >= 1 && j >= 1; + i--, j-- + ) { + if ( + candidateParts[i]?.startsWith("{") && + candidateParts[i]?.indexOf("}") !== -1 + ) { const start = candidateParts[i]!.indexOf("}") + 1, end = candidateParts[i]?.length; // If the current part of the candidate is a "template" part // Try to use the suffix of pattern to match the path // {guid} ==> $ // {guid}:export ==> :export$ - const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( - pathParts[j] || "", - ); + const isMatched = new RegExp( + `${candidateParts[i]?.slice(start, end)}`, + ).test(pathParts[j] || ""); if (!isMatched) { found = false; diff --git a/sdk/mongocluster/arm-mongocluster/src/static-helpers/pagingHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/static-helpers/pagingHelpers.ts index ce33af5f4178..dc35b0af242d 100644 --- a/sdk/mongocluster/arm-mongocluster/src/static-helpers/pagingHelpers.ts +++ b/sdk/mongocluster/arm-mongocluster/src/static-helpers/pagingHelpers.ts @@ -1,7 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + Client, + createRestError, + PathUncheckedResponse, +} from "@azure-rest/core-client"; import { RestError } from "@azure/core-rest-pipeline"; /** @@ -39,11 +46,17 @@ export interface PagedAsyncIterableIterator< /** * The connection to the async iterator, part of the iteration protocol */ - [Symbol.asyncIterator](): PagedAsyncIterableIterator; + [Symbol.asyncIterator](): PagedAsyncIterableIterator< + TElement, + TPage, + TPageSettings + >; /** * Return an AsyncIterableIterator that works a page at a time */ - byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + byPage: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; } /** @@ -61,11 +74,15 @@ export interface PagedResult< /** * A method that returns a page of results. */ - getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + getPage: ( + pageLink?: string, + ) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; /** * a function to implement the `byPage` method on the paged async iterator. */ - byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + byPage?: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; /** * A function to extract elements from a page. @@ -138,7 +155,9 @@ function getPagedAsyncIterator< >( pagedResult: PagedResult, ): PagedAsyncIterableIterator { - const iter = getItemAsyncIterator(pagedResult); + const iter = getItemAsyncIterator( + pagedResult, + ); return { next() { return iter.next(); @@ -157,7 +176,11 @@ function getPagedAsyncIterator< }; } -async function* getItemAsyncIterator( +async function* getItemAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( pagedResult: PagedResult, ): AsyncIterableIterator { const pages = getPageAsyncIterator(pagedResult); @@ -166,14 +189,20 @@ async function* getItemAsyncIterator( +async function* getPageAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( pagedResult: PagedResult, options: { pageLink?: string; } = {}, ): AsyncIterableIterator> { const { pageLink } = options; - let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + let response = await pagedResult.getPage( + pageLink ?? pagedResult.firstPageLink, + ); if (!response) { return; } @@ -201,7 +230,11 @@ function getNextLink(body: unknown, nextLinkName?: string): string | undefined { const nextLink = (body as Record)[nextLinkName]; - if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + if ( + typeof nextLink !== "string" && + typeof nextLink !== "undefined" && + nextLink !== null + ) { throw new RestError( `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, ); @@ -231,7 +264,10 @@ function getElements(body: unknown, itemName: string): T[] { /** * Checks if a request failed */ -function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { +function checkPagingRequest( + response: PathUncheckedResponse, + expectedStatuses: string[], +): void { if (!expectedStatuses.includes(response.status)) { throw createRestError( `Pagination failed with unexpected statusCode ${response.status}`, diff --git a/sdk/mongocluster/arm-mongocluster/src/static-helpers/pollingHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/static-helpers/pollingHelpers.ts index f01c41bab69d..87a63b1fc5d1 100644 --- a/sdk/mongocluster/arm-mongocluster/src/static-helpers/pollingHelpers.ts +++ b/sdk/mongocluster/arm-mongocluster/src/static-helpers/pollingHelpers.ts @@ -1,6 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { PollerLike, OperationState, @@ -10,7 +13,11 @@ import { OperationResponse, } from "@azure/core-lro"; -import { Client, PathUncheckedResponse, createRestError } from "@azure-rest/core-client"; +import { + Client, + PathUncheckedResponse, + createRestError, +} from "@azure-rest/core-client"; import { AbortSignalLike } from "@azure/abort-controller"; export interface GetLongRunningPollerOptions { @@ -38,7 +45,10 @@ export interface GetLongRunningPollerOptions { */ getInitialResponse?: () => PromiseLike; } -export function getLongRunningPoller( +export function getLongRunningPoller< + TResponse extends PathUncheckedResponse, + TResult = void, +>( client: Client, processResponseBody: (result: TResponse) => Promise, expectedStatuses: string[], @@ -46,14 +56,18 @@ export function getLongRunningPoller, TResult> { const { restoreFrom, getInitialResponse } = options; if (!restoreFrom && !getInitialResponse) { - throw new Error("Either restoreFrom or getInitialResponse must be specified"); + throw new Error( + "Either restoreFrom or getInitialResponse must be specified", + ); } let initialResponse: TResponse | undefined = undefined; const pollAbortController = new AbortController(); const poller: RunningOperation = { sendInitialRequest: async () => { if (!getInitialResponse) { - throw new Error("getInitialResponse is required when initializing a new poller"); + throw new Error( + "getInitialResponse is required when initializing a new poller", + ); } initialResponse = await getInitialResponse(); return getLroResponse(initialResponse, expectedStatuses); diff --git a/sdk/mongocluster/arm-mongocluster/test/public/mongoclusterOperations.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/mongoclusterOperations.spec.ts deleted file mode 100644 index 386cb6acbcd0..000000000000 --- a/sdk/mongocluster/arm-mongocluster/test/public/mongoclusterOperations.spec.ts +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - -import { env, Recorder, isPlaybackMode, delay } from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; -import { MongoClusterManagementClient } from "../../src/mongoClusterManagementClient.js"; -import { createRecorder } from "./utils/recordedClient.js"; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("MongoCluster test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: MongoClusterManagementClient; - let location: string; - let resourceGroup: string; - let resourcename: string; - let fireWallName: string; - - beforeEach(async (context) => { - process.env.SystemRoot = process.env.SystemRoot || "C:\\Windows"; - recorder = await createRecorder(context); - subscriptionId = env.SUBSCRIPTION_ID || ""; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new MongoClusterManagementClient( - credential, - subscriptionId, - recorder.configureClientOptions({}), - ); - location = "eastus"; - resourceGroup = "czwjstest"; - resourcename = "testmongocluster"; - fireWallName = "testfilerule"; - }); - - afterEach(async function () { - if (recorder?.recordingId) { - await recorder.stop(); - } - }); - - it("operations list test", async function () { - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - assert.notEqual(resArray.length, 0); - }); - - it("mongoClusters create test", async function () { - const res = await client.mongoClusters.createOrUpdate( - resourceGroup, - resourcename, - { - tags: { tag: "test" }, - location, - properties: { - administrator: { - userName: "mongoAdmin", - password: "SecureString;", - }, - serverVersion: "5.0", - storage: { sizeGb: 128 }, - compute: { tier: "M30" }, - sharding: { shardCount: 1 }, - highAvailability: { targetMode: "Disabled" }, - }, - }, - testPollingOptions, - ); - assert.equal(res.name, resourcename); - }); - - it("firerules create test", async function () { - const res = await client.firewallRules.createOrUpdate( - resourceGroup, - resourcename, - fireWallName, - { - properties: { - startIpAddress: "0.0.0.0", - endIpAddress: "255.255.255.255", - }, - }, - testPollingOptions, - ); - console.log(res); - assert.equal(res.name, fireWallName); - }); - - it("mongoClusters get test", async function () { - const res = await client.mongoClusters.get(resourceGroup, resourcename); - assert.equal(res.name, resourcename); - }); - - it("firerules get test", async function () { - const res = await client.firewallRules.get(resourceGroup, resourcename, fireWallName); - console.log(res); - assert.equal(res.name, fireWallName); - }); - - it("mongoClusters list test", async function () { - const resArray = new Array(); - for await (let item of client.mongoClusters.listByResourceGroup(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 1); - }); - - it("firewallRules list test", async function () { - const resArray = new Array(); - for await (let item of client.firewallRules.listByMongoCluster(resourceGroup, resourcename)) { - resArray.push(item); - } - assert.equal(resArray.length, 1); - }); - - it("mongoClusters update test", async function () { - const res = await client.mongoClusters.update(resourceGroup, resourcename, { - tags: {}, - }); - assert.equal(res.name, resourcename); - assert.deepEqual(res.tags, {}); - }); - - it("firewallRules delete test", async function () { - const resArray = new Array(); - await client.firewallRules.delete(resourceGroup, resourcename, fireWallName); - for await (let item of client.firewallRules.listByMongoCluster(resourceGroup, resourcename)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); - - it("mongoClusters delete test", async function () { - const resArray = new Array(); - await client.mongoClusters.delete(resourceGroup, resourcename); - for await (let item of client.mongoClusters.listByResourceGroup(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - - await delay(isPlaybackMode() ? 1000 : 60000); - }); -}); diff --git a/sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts deleted file mode 100644 index edae6deca35a..000000000000 --- a/sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - -import { env, Recorder, isPlaybackMode, delay } from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; -import { MongoClusterManagementClient } from "../../../src/mongoClusterManagementClient.js"; -import { createRecorder } from "../utils/recordedClient.js"; -import { NetworkManagementClient } from "@azure/arm-network"; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("MongoCluster test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: MongoClusterManagementClient; - let networkClient: NetworkManagementClient; - let location: string; - let resourceGroup: string; - let resourcename: string; - let connectionName: string; - let virtualNetworkName: string; - let privateEndpointName: string; - - beforeEach(async (context) => { - process.env.SystemRoot = process.env.SystemRoot || "C:\\Windows"; - recorder = await createRecorder(context); - subscriptionId = env.SUBSCRIPTION_ID || ""; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new MongoClusterManagementClient( - credential, - subscriptionId, - recorder.configureClientOptions({}), - ); - networkClient = new NetworkManagementClient( - credential, - subscriptionId, - recorder.configureClientOptions({}), - ); - location = "eastus"; - resourceGroup = "myjstest"; - resourcename = "resourcetest1"; - virtualNetworkName = "testvn"; - privateEndpointName = "testPEC"; - }); - - afterEach(async function () { - if (recorder?.recordingId) { - await recorder.stop(); - } - }); - - it("mongoClusters for private endpoint create test", async function () { - const res = await client.mongoClusters.createOrUpdate( - resourceGroup, - resourcename, - { - location, - properties: { - administrator: { - userName: "mongoAdmin", - password: "SecureString;", - }, - serverVersion: "5.0", - storage: { sizeGb: 128 }, - compute: { tier: "M30" }, - sharding: { shardCount: 1 }, - highAvailability: { targetMode: "Disabled" }, - }, - }, - testPollingOptions, - ); - assert.equal(res.name, resourcename); - }); - - it("virtual network create test", async function () { - const res = await networkClient.virtualNetworks.beginCreateOrUpdateAndWait( - resourceGroup, - virtualNetworkName, - { - addressSpace: { addressPrefixes: ["10.0.0.0/16"] }, - flowTimeoutInMinutes: 10, - location, - }, - ); - assert.equal(res.name, virtualNetworkName); - - await networkClient.subnets.beginCreateOrUpdateAndWait( - resourceGroup, - virtualNetworkName, - "testsubnet", - { addressPrefix: "10.0.0.0/16" }, - ); - }); - - it("private endpoit create test", async function () { - const clusterRes = await client.mongoClusters.get(resourceGroup, resourcename); - const res = await networkClient.privateEndpoints.beginCreateOrUpdateAndWait( - resourceGroup, - privateEndpointName, - { - location, - customNetworkInterfaceName: privateEndpointName + "-nic", - privateLinkServiceConnections: [ - { - name: privateEndpointName, - groupIds: ["MongoCluster"], - privateLinkServiceId: clusterRes.id, - requestMessage: "Please approve my connection.", - }, - ], - subnet: { - id: - "/subscriptions/" + - subscriptionId + - "/resourceGroups/" + - resourceGroup + - "/providers/Microsoft.Network/virtualNetworks/" + - virtualNetworkName + - "/subnets/testsubnet", - }, - }, - testPollingOptions, - ); - assert.equal(res.name, privateEndpointName); - }); - - // need create a mongocluster first then create a private endpoint named testPEC with the mongocluster. - it("private endpoint connection create test", async function () { - for await (let item of client.privateEndpointConnections.listByMongoCluster( - resourceGroup, - resourcename, - )) { - connectionName = String(item.name); - } - const res = await client.privateEndpointConnections.create( - resourceGroup, - resourcename, - connectionName, - { - properties: { - privateLinkServiceConnectionState: { - status: "Rejected", - }, - }, - }, - testPollingOptions, - ); - console.log(res); - assert.equal(res.name, connectionName); - }); - - it("private endpoint connection get test", async function () { - const res = await client.privateEndpointConnections.get( - resourceGroup, - resourcename, - connectionName, - ); - console.log(res); - assert.equal(res.name, connectionName); - }); - it("private endpoint connection list test", async function () { - const resArray = new Array(); - for await (let item of client.privateEndpointConnections.listByMongoCluster( - resourceGroup, - resourcename, - )) { - resArray.push(item); - } - assert.equal(resArray.length, 1); - }); - - it("private endpoint connection delete test", async function () { - for await (let item of client.privateEndpointConnections.listByMongoCluster( - resourceGroup, - resourcename, - )) { - connectionName = String(item.name); - } - const resArray = new Array(); - await client.privateEndpointConnections.delete(resourceGroup, resourcename, connectionName); - for await (let item of client.privateEndpointConnections.listByMongoCluster( - resourceGroup, - resourcename, - )) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); - - it("private endpoint delete test", async function () { - const resArray = new Array(); - await networkClient.privateEndpoints.beginDeleteAndWait(resourceGroup, privateEndpointName); - for await (let item of networkClient.privateEndpoints.list(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); - - it("virtual network delete test", async function () { - const resArray = new Array(); - await networkClient.virtualNetworks.beginDeleteAndWait(resourceGroup, virtualNetworkName); - for await (let item of networkClient.virtualNetworks.list(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); - - it("mongoClusters for private endpoint delete test", async function () { - const resArray = new Array(); - await client.mongoClusters.delete(resourceGroup, resourcename); - for await (let item of client.mongoClusters.listByResourceGroup(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - - await delay(isPlaybackMode() ? 1000 : 60000); - }); -}); diff --git a/sdk/mongocluster/arm-mongocluster/test/public/sampleTest.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..d4919ac91ac5 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/test/public/sampleTest.spec.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createRecorder } from "./utils/recordedClient.js"; +import { assert, beforeEach, afterEach, it, describe } from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + beforeEach(async function () { + // recorder = await createRecorder(this); + }); + + afterEach(async function () { + // await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts b/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts index 527ccc9dee86..6e425fdcfdf9 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts @@ -1,7 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; +import { + Recorder, + RecorderStartOptions, + VitestTestContext, +} from "@azure-tools/test-recorder"; const replaceableVariables: Record = { SUBSCRIPTION_ID: "azure_subscription_id", @@ -9,10 +13,6 @@ const replaceableVariables: Record = { const recorderEnvSetup: RecorderStartOptions = { envSetupForPlayback: replaceableVariables, - removeCentralSanitizers: [ - "AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section - "AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section - ], }; /** @@ -20,7 +20,9 @@ const recorderEnvSetup: RecorderStartOptions = { * Should be called first in the test suite to make sure environment variables are * read before they are being used. */ -export async function createRecorder(context: VitestTestContext): Promise { +export async function createRecorder( + context: VitestTestContext, +): Promise { const recorder = new Recorder(context); await recorder.start(recorderEnvSetup); return recorder; diff --git a/sdk/mongocluster/arm-mongocluster/tsconfig.json b/sdk/mongocluster/arm-mongocluster/tsconfig.json index 6977ffdba11d..8c962911295c 100644 --- a/sdk/mongocluster/arm-mongocluster/tsconfig.json +++ b/sdk/mongocluster/arm-mongocluster/tsconfig.json @@ -4,15 +4,13 @@ "module": "NodeNext", "moduleResolution": "NodeNext", "rootDir": ".", - "skipLibCheck": true, - "paths": { "@azure/arm-mongocluster": ["./src/index"] } + "skipLibCheck": true }, "include": [ "./src/**/*.ts", "./src/**/*.mts", "./src/**/*.cts", "test/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ] } diff --git a/sdk/mongocluster/arm-mongocluster/tsp-location.yaml b/sdk/mongocluster/arm-mongocluster/tsp-location.yaml index e5d3419ba98d..63eea526fcf1 100644 --- a/sdk/mongocluster/arm-mongocluster/tsp-location.yaml +++ b/sdk/mongocluster/arm-mongocluster/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/mongocluster/DocumentDB.MongoCluster.Management -commit: 24fb335f3adce78299c9eca5fd43f66dfc5dadf7 -repo: Azure/azure-rest-api-specs -additionalDirectories: +commit: 65623703ab93d1cf23b605a95fd845cd38c92d52 +repo: ../azure-rest-api-specs +additionalDirectories: diff --git a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts index 93f3735b960c..5e0dc418cfa2 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts @@ -33,6 +33,5 @@ export default defineConfig({ reportsDirectory: "coverage-browser", }, testTimeout: 1200000, - hookTimeout: 1200000 }, }); diff --git a/sdk/mongocluster/arm-mongocluster/vitest.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.config.ts index 11fcb98a3ab4..f8ab2a758bf9 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.config.ts @@ -29,6 +29,5 @@ export default defineConfig({ reportsDirectory: "coverage", }, testTimeout: 1200000, - hookTimeout: 1200000 }, }); diff --git a/sdk/mongocluster/ci.mgmt.yml b/sdk/mongocluster/ci.mgmt.yml index 9b07c486fba5..9e2f2c4642f2 100644 --- a/sdk/mongocluster/ci.mgmt.yml +++ b/sdk/mongocluster/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -13,7 +13,6 @@ trigger: include: - sdk/mongocluster/arm-mongocluster - sdk/mongocluster/ci.mgmt.yml - pr: branches: include: @@ -27,7 +26,6 @@ pr: include: - sdk/mongocluster/arm-mongocluster - sdk/mongocluster/ci.mgmt.yml - extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -35,4 +33,3 @@ extends: Artifacts: - name: azure-arm-mongocluster safeName: azurearmmongocluster - \ No newline at end of file