diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 99371afd82ed..4c06f681ccdb 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3111,7 +3111,7 @@ packages: version: 0.0.0 '@rush-temp/arm-mongocluster@file:projects/arm-mongocluster.tgz': - resolution: {integrity: sha512-uHXY8aiy59HNsKOlADr+OcpDG8TihgYdOW4ZXH1ap6Lc+nlMFoMVFYFbM2O0w40S2Me9pQaUbHOe+/94MCjoWQ==, tarball: file:projects/arm-mongocluster.tgz} + resolution: {integrity: sha512-j+IBSofAYCW3ut606x6Lof2k/GWHa2gWxmCZD3kzWmNmZYQJYiYsUbbE+gVks3Yioqj6aQVLoHVdKEPjX+cjRg==, tarball: file:projects/arm-mongocluster.tgz} version: 0.0.0 '@rush-temp/arm-monitor-profile-2020-09-01-hybrid@file:projects/arm-monitor-profile-2020-09-01-hybrid.tgz': @@ -13538,13 +13538,13 @@ snapshots: '@rush-temp/arm-mongocluster@file:projects/arm-mongocluster.tgz(msw@2.6.8(@types/node@20.17.10)(typescript@5.7.2))(vite@5.4.11(@types/node@20.17.10))': dependencies: + '@microsoft/api-extractor': 7.48.0(@types/node@18.19.68) '@types/node': 18.19.68 '@vitest/browser': 2.1.8(@types/node@18.19.68)(playwright@1.49.1)(typescript@5.6.3)(vite@5.4.11(@types/node@20.17.10))(vitest@2.1.8) '@vitest/coverage-istanbul': 2.1.8(vitest@2.1.8) dotenv: 16.4.7 eslint: 9.16.0 playwright: 1.49.1 - prettier: 3.4.2 tslib: 2.8.1 typescript: 5.6.3 vitest: 2.1.8(@types/node@18.19.68)(@vitest/browser@2.1.8)(msw@2.6.8(@types/node@20.17.10)(typescript@5.7.2)) @@ -20673,7 +20673,7 @@ snapshots: ajv-formats@3.0.1: dependencies: - ajv: 8.13.0 + ajv: 8.17.1 ajv@6.12.6: dependencies: diff --git a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md index d216998428df..4ffd171d234f 100644 --- a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md +++ b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md @@ -1,15 +1,26 @@ # Release History - -## 1.0.2 (Unreleased) - + +## 2.0.0 (2024-12-12) + ### Features Added -### Breaking Changes - -### Bugs Fixed + - Added Interface ErrorAdditionalInfo + - Added Interface ErrorDetail + - Added Interface ErrorResponse + - Added Enum KnownVersions + - Enum KnownOrigin has a new value "user,system" + - Enum KnownOrigin has a new value system + - Enum KnownOrigin has a new value user + - Enum KnownProvisioningState has a new value UpdatingTest2 -### Other Changes +### Breaking Changes + - Enum KnownOrigin no longer has value System + - Enum KnownOrigin no longer has value User + - Enum KnownOrigin no longer has value UserSystem + - Enum KnownProvisioningState no longer has value Updating + + ## 1.0.1 (2024-10-14) ### Bugs Fixed diff --git a/sdk/mongocluster/arm-mongocluster/README.md b/sdk/mongocluster/arm-mongocluster/README.md index 8bbefa478cf6..e1c16cc422a9 100644 --- a/sdk/mongocluster/arm-mongocluster/README.md +++ b/sdk/mongocluster/arm-mongocluster/README.md @@ -4,9 +4,11 @@ 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) | +Key links: + +- [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) ## Getting started @@ -29,7 +31,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]. @@ -43,24 +45,23 @@ npm install @azure/identity ``` You will also need to **register a new AAD application and grant access to Azure MongoClusterManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). -Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. For more 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 +70,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 a9fcfbef11ff..113bdc3eaf5f 100644 --- a/sdk/mongocluster/arm-mongocluster/eslint.config.mjs +++ b/sdk/mongocluster/arm-mongocluster/eslint.config.mjs @@ -1,6 +1,7 @@ import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; -export default azsdkEslint.config([ +export default [ + ...azsdkEslint.configs.recommended, { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", @@ -10,7 +11,7 @@ export default azsdkEslint.config([ "@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 0a254d432298..305e8f52b900 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.2", + "version": "2.0.0", "description": "A generated SDK for DocumentDBClient.", "engines": { "node": ">=18.0.0" @@ -46,6 +46,7 @@ "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/README.md", "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "//metadata": { "constantPaths": [ @@ -56,65 +57,56 @@ ] }, "dependencies": { - "@azure-rest/core-client": "^2.1.0", - "@azure/abort-controller": "^2.1.2", + "@azure/core-util": "^1.9.2", + "@azure-rest/core-client": "^2.3.1", "@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.1.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", + "eslint": "^9.9.0", + "typescript": "~5.6.2", + "@azure/identity": "^4.2.1", "@vitest/browser": "^2.0.5", "@vitest/coverage-istanbul": "^2.0.5", - "dotenv": "^16.0.0", - "eslint": "^9.9.0", "playwright": "^1.41.2", - "prettier": "^3.2.5", - "typescript": "~5.6.2", - "vitest": "^2.0.5" + "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": { - "build": "npm run clean && dev-tool run build-package && dev-tool run vendored 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": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "dev-tool samples run samples-dev", "extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored 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", + "pack": "npm pack 2>&1", + "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", "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": "dev-tool run vendored 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", + "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": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", + "build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", - "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", + "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", "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" - }, "exports": { "./package.json": "./package.json", ".": { 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..bc43a61b82d3 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md @@ -4,8 +4,6 @@ ```ts -import { OperationOptions } from '@azure-rest/core-client'; - // @public export type ActionType = string; @@ -55,33 +53,35 @@ export type CreatedByType = string; export type CreateMode = string; // @public -export interface FirewallRule extends ProxyResource { - properties?: FirewallRuleProperties; -} - -// @public -export interface FirewallRuleProperties { - endIpAddress: string; - readonly provisioningState?: ProvisioningState; - startIpAddress: string; +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; } // @public -export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; } // @public -export interface FirewallRulesDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; +export interface ErrorResponse { + error?: ErrorDetail; } // @public -export interface FirewallRulesGetOptionalParams extends OperationOptions { +export interface FirewallRule extends ProxyResource { + properties?: FirewallRuleProperties; } // @public -export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { +export interface FirewallRuleProperties { + endIpAddress: string; + readonly provisioningState?: ProvisioningState; + startIpAddress: string; } // @public @@ -139,9 +139,9 @@ export enum KnownMongoClusterStatus { // @public export enum KnownOrigin { - System = "system", - User = "user", - UserSystem = "user,system" + "user,system" = "user,system", + system = "system", + user = "user" } // @public @@ -181,7 +181,7 @@ export enum KnownProvisioningState { Failed = "Failed", InProgress = "InProgress", Succeeded = "Succeeded", - Updating = "Updating" + UpdatingTest2 = "UpdatingTest2" } // @public @@ -207,6 +207,11 @@ export enum KnownReplicationState { Updating = "Updating" } +// @public +export enum KnownVersions { + v2024_07_01 = "2024-07-01" +} + // @public export interface ListConnectionStringsResult { readonly connectionStrings?: ConnectionString[]; @@ -251,49 +256,9 @@ export interface MongoClusterRestoreParameters { sourceResourceId?: string; } -// @public -export interface MongoClustersCheckNameAvailabilityOptionalParams extends OperationOptions { -} - -// @public -export interface MongoClustersCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface MongoClustersDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface MongoClustersGetOptionalParams extends OperationOptions { -} - -// @public -export interface MongoClustersListByResourceGroupOptionalParams extends OperationOptions { -} - -// @public -export interface MongoClustersListConnectionStringsOptionalParams extends OperationOptions { -} - -// @public -export interface MongoClustersListOptionalParams extends OperationOptions { -} - -// @public -export interface MongoClustersPromoteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - // @public export type MongoClusterStatus = string; -// @public -export interface MongoClustersUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - // @public export interface MongoClusterUpdate { properties?: MongoClusterUpdateProperties; @@ -330,10 +295,6 @@ export interface OperationDisplay { readonly resource?: string; } -// @public -export interface OperationsListOptionalParams extends OperationOptions { -} - // @public export type Origin = string; @@ -366,24 +327,6 @@ export interface PrivateEndpointConnectionResource extends ProxyResource { properties?: PrivateEndpointConnectionProperties; } -// @public -export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { -} - -// @public -export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends OperationOptions { -} - // @public export type PrivateEndpointServiceConnectionStatus = string; @@ -406,10 +349,6 @@ export interface PrivateLinkServiceConnectionState { status?: PrivateEndpointServiceConnectionStatus; } -// @public -export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions { -} - // @public export type PromoteMode = string; @@ -437,10 +376,6 @@ export interface Replica extends ProxyResource { properties?: MongoClusterProperties; } -// @public -export interface ReplicasListByParentOptionalParams extends OperationOptions { -} - // @public export interface ReplicationProperties { readonly replicationState?: ReplicationState; diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md index 18735143ef6f..e7813b673f40 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md @@ -66,6 +66,26 @@ export type CreatedByType = string; // @public export type CreateMode = string; +// @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; @@ -159,9 +179,9 @@ export enum KnownMongoClusterStatus { // @public export enum KnownOrigin { - System = "system", - User = "user", - UserSystem = "user,system" + "user,system" = "user,system", + system = "system", + user = "user" } // @public @@ -201,7 +221,7 @@ export enum KnownProvisioningState { Failed = "Failed", InProgress = "InProgress", Succeeded = "Succeeded", - Updating = "Updating" + UpdatingTest2 = "UpdatingTest2" } // @public @@ -227,6 +247,11 @@ export enum KnownReplicationState { Updating = "Updating" } +// @public +export enum KnownVersions { + v2024_07_01 = "2024-07-01" +} + // @public export interface ListConnectionStringsResult { readonly connectionStrings?: ConnectionString[]; diff --git a/sdk/mongocluster/arm-mongocluster/sample.env b/sdk/mongocluster/arm-mongocluster/sample.env index efbc7787bd3b..508439fc7d62 100644 --- a/sdk/mongocluster/arm-mongocluster/sample.env +++ b/sdk/mongocluster/arm-mongocluster/sample.env @@ -1 +1 @@ -# Feel free to add your own environment variables. +# Feel free to add your own environment variables. \ No newline at end of file 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 d712c2ad41af..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 dev-tool run vendored 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 122173cd00de..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 dev-tool run vendored 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 4c61430a123e..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.6.2", - "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..9e2666d47e37 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts @@ -2,29 +2,31 @@ // Licensed under the MIT License. import { - firewallRulePropertiesSerializer, + MongoClusterManagementContext as Client, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesGetOptionalParams, + FirewallRulesListByMongoClusterOptionalParams, +} from "../index.js"; +import { FirewallRule, + firewallRuleSerializer, + firewallRuleDeserializer, _FirewallRuleListResult, + _firewallRuleListResultDeserializer, } from "../../models/models.js"; -import { DocumentDBContext as Client } from "../index.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { StreamableMethod, - operationOptionsToRequestParameters, PathUncheckedResponse, createRestError, + operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; -import { - PagedAsyncIterableIterator, - buildPagedAsyncIterator, -} from "../../static-helpers/pagingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; -import { - FirewallRulesGetOptionalParams, - FirewallRulesCreateOrUpdateOptionalParams, - FirewallRulesDeleteOptionalParams, - FirewallRulesListByMongoClusterOptionalParams, -} from "../../models/options.js"; export function _firewallRulesGetSend( context: Client, @@ -53,34 +55,7 @@ export async function _firewallRulesGetDeserialize( throw createRestError(result); } - return { - id: result.body["id"], - name: result.body["name"], - type: result.body["type"], - systemData: !result.body.systemData - ? undefined - : { - createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], - createdAt: - result.body.systemData?.["createdAt"] !== undefined - ? new Date(result.body.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], - lastModifiedAt: - result.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(result.body.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !result.body.properties - ? undefined - : { - provisioningState: result.body.properties?.["provisioningState"], - startIpAddress: result.body.properties?.["startIpAddress"], - endIpAddress: result.body.properties?.["endIpAddress"], - }, - }; + return firewallRuleDeserializer(result.body); } /** Gets information about a mongo cluster firewall rule. */ @@ -122,11 +97,7 @@ export function _firewallRulesCreateOrUpdateSend( ) .put({ ...operationOptionsToRequestParameters(options), - body: { - properties: !resource.properties - ? resource.properties - : firewallRulePropertiesSerializer(resource.properties), - }, + body: firewallRuleSerializer(resource), }); } @@ -138,34 +109,7 @@ export async function _firewallRulesCreateOrUpdateDeserialize( throw createRestError(result); } - return { - id: result.body["id"], - name: result.body["name"], - type: result.body["type"], - systemData: !result.body.systemData - ? undefined - : { - createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], - createdAt: - result.body.systemData?.["createdAt"] !== undefined - ? new Date(result.body.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], - lastModifiedAt: - result.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(result.body.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !result.body.properties - ? undefined - : { - provisioningState: result.body.properties?.["provisioningState"], - startIpAddress: result.body.properties?.["startIpAddress"], - endIpAddress: result.body.properties?.["endIpAddress"], - }, - }; + return firewallRuleDeserializer(result.body); } /** Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. */ @@ -239,20 +183,25 @@ 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, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; } export function _firewallRulesListByMongoClusterSend( @@ -282,39 +231,7 @@ export async function _firewallRulesListByMongoClusterDeserialize( throw createRestError(result); } - return { - value: result.body["value"].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 - : { - provisioningState: p.properties?.["provisioningState"], - startIpAddress: p.properties?.["startIpAddress"], - endIpAddress: p.properties?.["endIpAddress"], - }, - }; - }), - nextLink: result.body["nextLink"], - }; + return _firewallRuleListResultDeserializer(result.body); } /** List all the firewall rules in a given mongo cluster. */ diff --git a/sdk/mongocluster/arm-mongocluster/src/api/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/index.ts index f7dce8bfa6ad..3b958c1bdbc5 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/index.ts @@ -3,9 +3,31 @@ export { createMongoClusterManagement, - DocumentDBContext, + MongoClusterManagementContext, MongoClusterManagementClientOptionalParams, } from "./mongoClusterManagementContext.js"; +export { + OperationsListOptionalParams, + MongoClustersGetOptionalParams, + MongoClustersCreateOrUpdateOptionalParams, + MongoClustersUpdateOptionalParams, + MongoClustersDeleteOptionalParams, + MongoClustersListByResourceGroupOptionalParams, + MongoClustersListOptionalParams, + MongoClustersListConnectionStringsOptionalParams, + MongoClustersCheckNameAvailabilityOptionalParams, + MongoClustersPromoteOptionalParams, + FirewallRulesGetOptionalParams, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesListByMongoClusterOptionalParams, + PrivateEndpointConnectionsListByMongoClusterOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateLinksListByMongoClusterOptionalParams, + ReplicasListByParentOptionalParams, +} from "./options.js"; export { firewallRulesGet, firewallRulesCreateOrUpdate, diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts index 4443e0ab14bf..cb9c7aea3d14 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts @@ -1,15 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { TokenCredential } from "@azure/core-auth"; -import { ClientOptions, Client, getClient } from "@azure-rest/core-client"; import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; -export interface DocumentDBContext extends Client {} +/** 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. */ +export interface MongoClusterManagementContext 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. */ + /** Known values of {@link KnownVersions} that the service accepts. */ apiVersion?: string; } @@ -17,11 +21,11 @@ export interface MongoClusterManagementClientOptionalParams extends ClientOption export function createMongoClusterManagement( credential: TokenCredential, options: MongoClusterManagementClientOptionalParams = {}, -): DocumentDBContext { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; - +): MongoClusterManagementContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentInfo = `azsdk-js-arm-mongocluster/1.0.2`; + const userAgentInfo = `azsdk-js-arm-mongocluster/1.0.0-beta.1`; const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` : `azsdk-js-api ${userAgentInfo}`; diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts index 06ac0d12fbb9..38f262fb4048 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts @@ -2,41 +2,46 @@ // Licensed under the MIT License. import { - mongoClusterPropertiesSerializer, - mongoClusterUpdatePropertiesSerializer, + MongoClusterManagementContext as Client, + MongoClustersCheckNameAvailabilityOptionalParams, + MongoClustersCreateOrUpdateOptionalParams, + MongoClustersDeleteOptionalParams, + MongoClustersGetOptionalParams, + MongoClustersListByResourceGroupOptionalParams, + MongoClustersListConnectionStringsOptionalParams, + MongoClustersListOptionalParams, + MongoClustersPromoteOptionalParams, + MongoClustersUpdateOptionalParams, +} from "../index.js"; +import { MongoCluster, + mongoClusterSerializer, + mongoClusterDeserializer, MongoClusterUpdate, + mongoClusterUpdateSerializer, + _MongoClusterListResult, + _mongoClusterListResultDeserializer, ListConnectionStringsResult, + listConnectionStringsResultDeserializer, CheckNameAvailabilityRequest, + checkNameAvailabilityRequestSerializer, CheckNameAvailabilityResponse, + checkNameAvailabilityResponseDeserializer, PromoteReplicaRequest, - _MongoClusterListResult, + promoteReplicaRequestSerializer, } from "../../models/models.js"; -import { DocumentDBContext as Client } from "../index.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { StreamableMethod, - operationOptionsToRequestParameters, PathUncheckedResponse, createRestError, + operationOptionsToRequestParameters, } 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 { PollerLike, OperationState } from "@azure/core-lro"; -import { - MongoClustersGetOptionalParams, - MongoClustersCreateOrUpdateOptionalParams, - MongoClustersUpdateOptionalParams, - MongoClustersDeleteOptionalParams, - MongoClustersListByResourceGroupOptionalParams, - MongoClustersListOptionalParams, - MongoClustersListConnectionStringsOptionalParams, - MongoClustersCheckNameAvailabilityOptionalParams, - MongoClustersPromoteOptionalParams, -} from "../../models/options.js"; export function _mongoClustersGetSend( context: Client, @@ -63,130 +68,7 @@ export async function _mongoClustersGetDeserialize( throw createRestError(result); } - return { - tags: result.body["tags"], - location: result.body["location"], - id: result.body["id"], - name: result.body["name"], - type: result.body["type"], - systemData: !result.body.systemData - ? undefined - : { - createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], - createdAt: - result.body.systemData?.["createdAt"] !== undefined - ? new Date(result.body.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], - lastModifiedAt: - result.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(result.body.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !result.body.properties - ? undefined - : { - createMode: result.body.properties?.["createMode"], - restoreParameters: !result.body.properties?.restoreParameters - ? undefined - : { - pointInTimeUTC: - result.body.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(result.body.properties?.restoreParameters?.["pointInTimeUTC"]) - : undefined, - sourceResourceId: result.body.properties?.restoreParameters?.["sourceResourceId"], - }, - replicaParameters: !result.body.properties?.replicaParameters - ? undefined - : { - sourceResourceId: result.body.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: result.body.properties?.replicaParameters?.["sourceLocation"], - }, - administrator: !result.body.properties?.administrator - ? undefined - : { - userName: result.body.properties?.administrator?.["userName"], - password: result.body.properties?.administrator?.["password"], - }, - serverVersion: result.body.properties?.["serverVersion"], - connectionString: result.body.properties?.["connectionString"], - provisioningState: result.body.properties?.["provisioningState"], - clusterStatus: result.body.properties?.["clusterStatus"], - publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], - highAvailability: !result.body.properties?.highAvailability - ? undefined - : { - targetMode: result.body.properties?.highAvailability?.["targetMode"], - }, - storage: !result.body.properties?.storage - ? undefined - : { sizeGb: result.body.properties?.storage?.["sizeGb"] }, - sharding: !result.body.properties?.sharding - ? undefined - : { shardCount: result.body.properties?.sharding?.["shardCount"] }, - compute: !result.body.properties?.compute - ? undefined - : { tier: result.body.properties?.compute?.["tier"] }, - backup: !result.body.properties?.backup - ? undefined - : { - earliestRestoreTime: result.body.properties?.backup?.["earliestRestoreTime"], - }, - 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"], - }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), - previewFeatures: result.body.properties?.["previewFeatures"], - replica: !result.body.properties?.replica - ? undefined - : { - sourceResourceId: result.body.properties?.replica?.["sourceResourceId"], - role: result.body.properties?.replica?.["role"], - replicationState: result.body.properties?.replica?.["replicationState"], - }, - infrastructureVersion: result.body.properties?.["infrastructureVersion"], - }, - }; + return mongoClusterDeserializer(result.body); } /** Gets information about a mongo cluster. */ @@ -224,13 +106,7 @@ export function _mongoClustersCreateOrUpdateSend( ) .put({ ...operationOptionsToRequestParameters(options), - body: { - tags: !resource.tags ? resource.tags : (serializeRecord(resource.tags as any) as any), - location: resource["location"], - properties: !resource.properties - ? resource.properties - : mongoClusterPropertiesSerializer(resource.properties), - }, + body: mongoClusterSerializer(resource), }); } @@ -242,130 +118,7 @@ export async function _mongoClustersCreateOrUpdateDeserialize( throw createRestError(result); } - return { - tags: result.body["tags"], - location: result.body["location"], - id: result.body["id"], - name: result.body["name"], - type: result.body["type"], - systemData: !result.body.systemData - ? undefined - : { - createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], - createdAt: - result.body.systemData?.["createdAt"] !== undefined - ? new Date(result.body.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], - lastModifiedAt: - result.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(result.body.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !result.body.properties - ? undefined - : { - createMode: result.body.properties?.["createMode"], - restoreParameters: !result.body.properties?.restoreParameters - ? undefined - : { - pointInTimeUTC: - result.body.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(result.body.properties?.restoreParameters?.["pointInTimeUTC"]) - : undefined, - sourceResourceId: result.body.properties?.restoreParameters?.["sourceResourceId"], - }, - replicaParameters: !result.body.properties?.replicaParameters - ? undefined - : { - sourceResourceId: result.body.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: result.body.properties?.replicaParameters?.["sourceLocation"], - }, - administrator: !result.body.properties?.administrator - ? undefined - : { - userName: result.body.properties?.administrator?.["userName"], - password: result.body.properties?.administrator?.["password"], - }, - serverVersion: result.body.properties?.["serverVersion"], - connectionString: result.body.properties?.["connectionString"], - provisioningState: result.body.properties?.["provisioningState"], - clusterStatus: result.body.properties?.["clusterStatus"], - publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], - highAvailability: !result.body.properties?.highAvailability - ? undefined - : { - targetMode: result.body.properties?.highAvailability?.["targetMode"], - }, - storage: !result.body.properties?.storage - ? undefined - : { sizeGb: result.body.properties?.storage?.["sizeGb"] }, - sharding: !result.body.properties?.sharding - ? undefined - : { shardCount: result.body.properties?.sharding?.["shardCount"] }, - compute: !result.body.properties?.compute - ? undefined - : { tier: result.body.properties?.compute?.["tier"] }, - backup: !result.body.properties?.backup - ? undefined - : { - earliestRestoreTime: result.body.properties?.backup?.["earliestRestoreTime"], - }, - 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"], - }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), - previewFeatures: result.body.properties?.["previewFeatures"], - replica: !result.body.properties?.replica - ? undefined - : { - sourceResourceId: result.body.properties?.replica?.["sourceResourceId"], - role: result.body.properties?.replica?.["role"], - replicationState: result.body.properties?.replica?.["replicationState"], - }, - infrastructureVersion: result.body.properties?.["infrastructureVersion"], - }, - }; + return mongoClusterDeserializer(result.body); } /** Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. */ @@ -377,20 +130,25 @@ 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, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, MongoCluster>; } export function _mongoClustersUpdateSend( @@ -410,12 +168,7 @@ export function _mongoClustersUpdateSend( ) .patch({ ...operationOptionsToRequestParameters(options), - body: { - tags: !properties.tags ? properties.tags : (serializeRecord(properties.tags as any) as any), - properties: !properties.properties - ? properties.properties - : mongoClusterUpdatePropertiesSerializer(properties.properties), - }, + body: mongoClusterUpdateSerializer(properties), }); } @@ -427,130 +180,7 @@ export async function _mongoClustersUpdateDeserialize( throw createRestError(result); } - return { - tags: result.body["tags"], - location: result.body["location"], - id: result.body["id"], - name: result.body["name"], - type: result.body["type"], - systemData: !result.body.systemData - ? undefined - : { - createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], - createdAt: - result.body.systemData?.["createdAt"] !== undefined - ? new Date(result.body.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], - lastModifiedAt: - result.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(result.body.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !result.body.properties - ? undefined - : { - createMode: result.body.properties?.["createMode"], - restoreParameters: !result.body.properties?.restoreParameters - ? undefined - : { - pointInTimeUTC: - result.body.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(result.body.properties?.restoreParameters?.["pointInTimeUTC"]) - : undefined, - sourceResourceId: result.body.properties?.restoreParameters?.["sourceResourceId"], - }, - replicaParameters: !result.body.properties?.replicaParameters - ? undefined - : { - sourceResourceId: result.body.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: result.body.properties?.replicaParameters?.["sourceLocation"], - }, - administrator: !result.body.properties?.administrator - ? undefined - : { - userName: result.body.properties?.administrator?.["userName"], - password: result.body.properties?.administrator?.["password"], - }, - serverVersion: result.body.properties?.["serverVersion"], - connectionString: result.body.properties?.["connectionString"], - provisioningState: result.body.properties?.["provisioningState"], - clusterStatus: result.body.properties?.["clusterStatus"], - publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], - highAvailability: !result.body.properties?.highAvailability - ? undefined - : { - targetMode: result.body.properties?.highAvailability?.["targetMode"], - }, - storage: !result.body.properties?.storage - ? undefined - : { sizeGb: result.body.properties?.storage?.["sizeGb"] }, - sharding: !result.body.properties?.sharding - ? undefined - : { shardCount: result.body.properties?.sharding?.["shardCount"] }, - compute: !result.body.properties?.compute - ? undefined - : { tier: result.body.properties?.compute?.["tier"] }, - backup: !result.body.properties?.backup - ? undefined - : { - earliestRestoreTime: result.body.properties?.backup?.["earliestRestoreTime"], - }, - 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"], - }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), - previewFeatures: result.body.properties?.["previewFeatures"], - replica: !result.body.properties?.replica - ? undefined - : { - sourceResourceId: result.body.properties?.replica?.["sourceResourceId"], - role: result.body.properties?.replica?.["role"], - replicationState: result.body.properties?.replica?.["replicationState"], - }, - infrastructureVersion: result.body.properties?.["infrastructureVersion"], - }, - }; + return mongoClusterDeserializer(result.body); } /** Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. */ @@ -562,20 +192,25 @@ 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, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, MongoCluster>; } export function _mongoClustersDeleteSend( @@ -614,19 +249,24 @@ 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, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; } export function _mongoClustersListByResourceGroupSend( @@ -654,139 +294,7 @@ export async function _mongoClustersListByResourceGroupDeserialize( throw createRestError(result); } - return { - value: result.body["value"].map((p: any) => { - return { - tags: p["tags"], - location: p["location"], - 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 - : { - createMode: p.properties?.["createMode"], - restoreParameters: !p.properties?.restoreParameters - ? undefined - : { - pointInTimeUTC: - p.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(p.properties?.restoreParameters?.["pointInTimeUTC"]) - : undefined, - sourceResourceId: p.properties?.restoreParameters?.["sourceResourceId"], - }, - replicaParameters: !p.properties?.replicaParameters - ? undefined - : { - sourceResourceId: p.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: p.properties?.replicaParameters?.["sourceLocation"], - }, - administrator: !p.properties?.administrator - ? undefined - : { - userName: p.properties?.administrator?.["userName"], - password: p.properties?.administrator?.["password"], - }, - serverVersion: p.properties?.["serverVersion"], - connectionString: p.properties?.["connectionString"], - provisioningState: p.properties?.["provisioningState"], - clusterStatus: p.properties?.["clusterStatus"], - publicNetworkAccess: p.properties?.["publicNetworkAccess"], - highAvailability: !p.properties?.highAvailability - ? undefined - : { - targetMode: p.properties?.highAvailability?.["targetMode"], - }, - storage: !p.properties?.storage - ? undefined - : { sizeGb: p.properties?.storage?.["sizeGb"] }, - sharding: !p.properties?.sharding - ? undefined - : { shardCount: p.properties?.sharding?.["shardCount"] }, - compute: !p.properties?.compute - ? undefined - : { tier: p.properties?.compute?.["tier"] }, - backup: !p.properties?.backup - ? undefined - : { - earliestRestoreTime: p.properties?.backup?.["earliestRestoreTime"], - }, - 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" - ], - }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), - previewFeatures: p.properties?.["previewFeatures"], - replica: !p.properties?.replica - ? undefined - : { - sourceResourceId: p.properties?.replica?.["sourceResourceId"], - role: p.properties?.replica?.["role"], - replicationState: p.properties?.replica?.["replicationState"], - }, - infrastructureVersion: p.properties?.["infrastructureVersion"], - }, - }; - }), - nextLink: result.body["nextLink"], - }; + return _mongoClusterListResultDeserializer(result.body); } /** List all the mongo clusters in a given resource group. */ @@ -801,7 +309,12 @@ export function mongoClustersListByResourceGroup( return buildPagedAsyncIterator( context, () => - _mongoClustersListByResourceGroupSend(context, subscriptionId, resourceGroupName, options), + _mongoClustersListByResourceGroupSend( + context, + subscriptionId, + resourceGroupName, + options, + ), _mongoClustersListByResourceGroupDeserialize, ["200"], { itemName: "value", nextLinkName: "nextLink" }, @@ -829,139 +342,7 @@ export async function _mongoClustersListDeserialize( throw createRestError(result); } - return { - value: result.body["value"].map((p: any) => { - return { - tags: p["tags"], - location: p["location"], - 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 - : { - createMode: p.properties?.["createMode"], - restoreParameters: !p.properties?.restoreParameters - ? undefined - : { - pointInTimeUTC: - p.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(p.properties?.restoreParameters?.["pointInTimeUTC"]) - : undefined, - sourceResourceId: p.properties?.restoreParameters?.["sourceResourceId"], - }, - replicaParameters: !p.properties?.replicaParameters - ? undefined - : { - sourceResourceId: p.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: p.properties?.replicaParameters?.["sourceLocation"], - }, - administrator: !p.properties?.administrator - ? undefined - : { - userName: p.properties?.administrator?.["userName"], - password: p.properties?.administrator?.["password"], - }, - serverVersion: p.properties?.["serverVersion"], - connectionString: p.properties?.["connectionString"], - provisioningState: p.properties?.["provisioningState"], - clusterStatus: p.properties?.["clusterStatus"], - publicNetworkAccess: p.properties?.["publicNetworkAccess"], - highAvailability: !p.properties?.highAvailability - ? undefined - : { - targetMode: p.properties?.highAvailability?.["targetMode"], - }, - storage: !p.properties?.storage - ? undefined - : { sizeGb: p.properties?.storage?.["sizeGb"] }, - sharding: !p.properties?.sharding - ? undefined - : { shardCount: p.properties?.sharding?.["shardCount"] }, - compute: !p.properties?.compute - ? undefined - : { tier: p.properties?.compute?.["tier"] }, - backup: !p.properties?.backup - ? undefined - : { - earliestRestoreTime: p.properties?.backup?.["earliestRestoreTime"], - }, - 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" - ], - }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), - previewFeatures: p.properties?.["previewFeatures"], - replica: !p.properties?.replica - ? undefined - : { - sourceResourceId: p.properties?.replica?.["sourceResourceId"], - role: p.properties?.replica?.["role"], - replicationState: p.properties?.replica?.["replicationState"], - }, - infrastructureVersion: p.properties?.["infrastructureVersion"], - }, - }; - }), - nextLink: result.body["nextLink"], - }; + return _mongoClusterListResultDeserializer(result.body); } /** List all the mongo clusters in a given subscription. */ @@ -1006,18 +387,7 @@ export async function _mongoClustersListConnectionStringsDeserialize( throw createRestError(result); } - return { - connectionStrings: - result.body["connectionStrings"] === undefined - ? result.body["connectionStrings"] - : result.body["connectionStrings"].map((p: any) => { - return { - connectionString: p["connectionString"], - description: p["description"], - name: p["name"], - }; - }), - }; + return listConnectionStringsResultDeserializer(result.body); } /** 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. */ @@ -1057,7 +427,7 @@ export function _mongoClustersCheckNameAvailabilitySend( ) .post({ ...operationOptionsToRequestParameters(options), - body: { name: body["name"], type: body["type"] }, + body: checkNameAvailabilityRequestSerializer(body), }); } @@ -1069,11 +439,7 @@ export async function _mongoClustersCheckNameAvailabilityDeserialize( throw createRestError(result); } - return { - nameAvailable: result.body["nameAvailable"], - reason: result.body["reason"], - message: result.body["message"], - }; + return checkNameAvailabilityResponseDeserializer(result.body); } /** Check if mongo cluster name is available for use. */ @@ -1113,7 +479,7 @@ export function _mongoClustersPromoteSend( ) .post({ ...operationOptionsToRequestParameters(options), - body: { promoteOption: body["promoteOption"], mode: body["mode"] }, + body: promoteReplicaRequestSerializer(body), }); } @@ -1137,18 +503,23 @@ 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, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts index 0b20535b1576..6199f5a1a5b7 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts @@ -1,19 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Operation, _OperationListResult } from "../../models/models.js"; -import { DocumentDBContext as Client } from "../index.js"; import { - StreamableMethod, - operationOptionsToRequestParameters, - PathUncheckedResponse, - createRestError, -} from "@azure-rest/core-client"; + MongoClusterManagementContext as Client, + OperationsListOptionalParams, +} from "../index.js"; +import { + _OperationListResult, + _operationListResultDeserializer, + Operation, +} from "../../models/models.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js"; -import { OperationsListOptionalParams } from "../../models/options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; export function _operationsListSend( context: Client, @@ -32,25 +38,7 @@ export async function _operationsListDeserialize( throw createRestError(result); } - return { - value: result.body["value"].map((p: any) => { - return { - name: p["name"], - isDataAction: p["isDataAction"], - display: !p.display - ? undefined - : { - provider: p.display?.["provider"], - resource: p.display?.["resource"], - operation: p.display?.["operation"], - description: p.display?.["description"], - }, - origin: p["origin"], - actionType: p["actionType"], - }; - }), - nextLink: result.body["nextLink"], - }; + return _operationListResultDeserializer(result.body); } /** List the operations for the provider */ diff --git a/sdk/mongocluster/arm-mongocluster/src/models/options.ts b/sdk/mongocluster/arm-mongocluster/src/api/options.ts similarity index 74% rename from sdk/mongocluster/arm-mongocluster/src/models/options.ts rename to sdk/mongocluster/arm-mongocluster/src/api/options.ts index 846a8c0efd09..d4537ed300f0 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/options.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/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/api/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts index 89db93887a8d..04d2df2287ca 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts @@ -2,29 +2,31 @@ // Licensed under the MIT License. import { - privateEndpointConnectionPropertiesSerializer, - PrivateEndpointConnectionResource, + MongoClusterManagementContext as Client, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsListByMongoClusterOptionalParams, +} from "../index.js"; +import { _PrivateEndpointConnectionResourceListResult, + _privateEndpointConnectionResourceListResultDeserializer, + PrivateEndpointConnectionResource, + privateEndpointConnectionResourceSerializer, + privateEndpointConnectionResourceDeserializer, } from "../../models/models.js"; -import { DocumentDBContext as Client } from "../index.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; import { StreamableMethod, - operationOptionsToRequestParameters, PathUncheckedResponse, createRestError, + operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; -import { - PagedAsyncIterableIterator, - buildPagedAsyncIterator, -} from "../../static-helpers/pagingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; -import { - PrivateEndpointConnectionsListByMongoClusterOptionalParams, - PrivateEndpointConnectionsGetOptionalParams, - PrivateEndpointConnectionsCreateOptionalParams, - PrivateEndpointConnectionsDeleteOptionalParams, -} from "../../models/options.js"; export function _privateEndpointConnectionsListByMongoClusterSend( context: Client, @@ -53,46 +55,7 @@ export async function _privateEndpointConnectionsListByMongoClusterDeserialize( throw createRestError(result); } - return { - value: result.body["value"].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"], - }, - }; - }), - nextLink: result.body["nextLink"], - }; + return _privateEndpointConnectionResourceListResultDeserializer(result.body); } /** List existing private connections */ @@ -148,42 +111,7 @@ export async function _privateEndpointConnectionsGetDeserialize( throw createRestError(result); } - return { - id: result.body["id"], - name: result.body["name"], - type: result.body["type"], - systemData: !result.body.systemData - ? undefined - : { - createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], - createdAt: - result.body.systemData?.["createdAt"] !== undefined - ? new Date(result.body.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], - lastModifiedAt: - result.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(result.body.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !result.body.properties - ? undefined - : { - groupIds: result.body.properties?.["groupIds"], - privateEndpoint: !result.body.properties?.privateEndpoint - ? undefined - : { id: result.body.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: result.body.properties?.privateLinkServiceConnectionState["status"], - description: result.body.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - result.body.properties?.privateLinkServiceConnectionState["actionsRequired"], - }, - provisioningState: result.body.properties?.["provisioningState"], - }, - }; + return privateEndpointConnectionResourceDeserializer(result.body); } /** Get a specific private connection */ @@ -227,11 +155,7 @@ export function _privateEndpointConnectionsCreateSend( ) .put({ ...operationOptionsToRequestParameters(options), - body: { - properties: !resource.properties - ? resource.properties - : privateEndpointConnectionPropertiesSerializer(resource.properties), - }, + body: privateEndpointConnectionResourceSerializer(resource), }); } @@ -243,42 +167,7 @@ export async function _privateEndpointConnectionsCreateDeserialize( throw createRestError(result); } - return { - id: result.body["id"], - name: result.body["name"], - type: result.body["type"], - systemData: !result.body.systemData - ? undefined - : { - createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], - createdAt: - result.body.systemData?.["createdAt"] !== undefined - ? new Date(result.body.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], - lastModifiedAt: - result.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(result.body.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !result.body.properties - ? undefined - : { - groupIds: result.body.properties?.["groupIds"], - privateEndpoint: !result.body.properties?.privateEndpoint - ? undefined - : { id: result.body.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: result.body.properties?.privateLinkServiceConnectionState["status"], - description: result.body.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - result.body.properties?.privateLinkServiceConnectionState["actionsRequired"], - }, - provisioningState: result.body.properties?.["provisioningState"], - }, - }; + return privateEndpointConnectionResourceDeserializer(result.body); } /** Create a Private endpoint connection */ diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts index de8d18d0f8c2..dd9053ba03a9 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts @@ -1,19 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { PrivateLinkResource, _PrivateLinkResourceListResult } from "../../models/models.js"; -import { DocumentDBContext as Client } from "../index.js"; import { - StreamableMethod, - operationOptionsToRequestParameters, - PathUncheckedResponse, - createRestError, -} from "@azure-rest/core-client"; + MongoClusterManagementContext as Client, + PrivateLinksListByMongoClusterOptionalParams, +} from "../index.js"; +import { + _PrivateLinkResourceListResult, + _privateLinkResourceListResultDeserializer, + PrivateLinkResource, +} from "../../models/models.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js"; -import { PrivateLinksListByMongoClusterOptionalParams } from "../../models/options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; export function _privateLinksListByMongoClusterSend( context: Client, @@ -42,39 +48,7 @@ export async function _privateLinksListByMongoClusterDeserialize( throw createRestError(result); } - return { - value: result.body["value"].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 - : { - groupId: p.properties?.["groupId"], - requiredMembers: p.properties?.["requiredMembers"], - requiredZoneNames: p.properties?.["requiredZoneNames"], - }, - }; - }), - nextLink: result.body["nextLink"], - }; + return _privateLinkResourceListResultDeserializer(result.body); } /** list private links on the given resource */ diff --git a/sdk/mongocluster/arm-mongocluster/src/api/replicas/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/replicas/index.ts index 86813d8922d5..ed7b6d6ccf25 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/replicas/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/replicas/index.ts @@ -1,19 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Replica, _ReplicaListResult } from "../../models/models.js"; -import { DocumentDBContext as Client } from "../index.js"; import { - StreamableMethod, - operationOptionsToRequestParameters, - PathUncheckedResponse, - createRestError, -} from "@azure-rest/core-client"; + MongoClusterManagementContext as Client, + ReplicasListByParentOptionalParams, +} from "../index.js"; +import { + _ReplicaListResult, + _replicaListResultDeserializer, + Replica, +} from "../../models/models.js"; import { PagedAsyncIterableIterator, buildPagedAsyncIterator, } from "../../static-helpers/pagingHelpers.js"; -import { ReplicasListByParentOptionalParams } from "../../models/options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; export function _replicasListByParentSend( context: Client, @@ -40,137 +46,7 @@ export async function _replicasListByParentDeserialize( throw createRestError(result); } - return { - value: result.body["value"].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 - : { - createMode: p.properties?.["createMode"], - restoreParameters: !p.properties?.restoreParameters - ? undefined - : { - pointInTimeUTC: - p.properties?.restoreParameters?.["pointInTimeUTC"] !== undefined - ? new Date(p.properties?.restoreParameters?.["pointInTimeUTC"]) - : undefined, - sourceResourceId: p.properties?.restoreParameters?.["sourceResourceId"], - }, - replicaParameters: !p.properties?.replicaParameters - ? undefined - : { - sourceResourceId: p.properties?.replicaParameters?.["sourceResourceId"], - sourceLocation: p.properties?.replicaParameters?.["sourceLocation"], - }, - administrator: !p.properties?.administrator - ? undefined - : { - userName: p.properties?.administrator?.["userName"], - password: p.properties?.administrator?.["password"], - }, - serverVersion: p.properties?.["serverVersion"], - connectionString: p.properties?.["connectionString"], - provisioningState: p.properties?.["provisioningState"], - clusterStatus: p.properties?.["clusterStatus"], - publicNetworkAccess: p.properties?.["publicNetworkAccess"], - highAvailability: !p.properties?.highAvailability - ? undefined - : { - targetMode: p.properties?.highAvailability?.["targetMode"], - }, - storage: !p.properties?.storage - ? undefined - : { sizeGb: p.properties?.storage?.["sizeGb"] }, - sharding: !p.properties?.sharding - ? undefined - : { shardCount: p.properties?.sharding?.["shardCount"] }, - compute: !p.properties?.compute - ? undefined - : { tier: p.properties?.compute?.["tier"] }, - backup: !p.properties?.backup - ? undefined - : { - earliestRestoreTime: p.properties?.backup?.["earliestRestoreTime"], - }, - 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" - ], - }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), - previewFeatures: p.properties?.["previewFeatures"], - replica: !p.properties?.replica - ? undefined - : { - sourceResourceId: p.properties?.replica?.["sourceResourceId"], - role: p.properties?.replica?.["role"], - replicationState: p.properties?.replica?.["replicationState"], - }, - infrastructureVersion: p.properties?.["infrastructureVersion"], - }, - }; - }), - nextLink: result.body["nextLink"], - }; + return _replicaListResultDeserializer(result.body); } /** List all the replicas for the mongo cluster. */ diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts index 867f92b187b7..36259eff6e02 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; -import { FirewallRule } from "../../models/models.js"; +import { MongoClusterManagementContext } from "../../api/mongoClusterManagementContext.js"; import { firewallRulesGet, firewallRulesCreateOrUpdate, firewallRulesDelete, firewallRulesListByMongoCluster, } from "../../api/firewallRules/index.js"; +import { FirewallRule } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { @@ -16,7 +16,7 @@ import { FirewallRulesCreateOrUpdateOptionalParams, FirewallRulesDeleteOptionalParams, FirewallRulesListByMongoClusterOptionalParams, -} from "../../models/options.js"; +} from "../../api/options.js"; /** Interface representing a FirewallRules operations. */ export interface FirewallRulesOperations { @@ -50,7 +50,10 @@ export interface FirewallRulesOperations { ) => PagedAsyncIterableIterator; } -export function getFirewallRules(context: DocumentDBContext, subscriptionId: string) { +export function getFirewallRules( + context: MongoClusterManagementContext, + subscriptionId: string, +) { return { get: ( resourceGroupName: string, @@ -112,7 +115,7 @@ export function getFirewallRules(context: DocumentDBContext, subscriptionId: str } export function getFirewallRulesOperations( - context: DocumentDBContext, + context: MongoClusterManagementContext, subscriptionId: string, ): FirewallRulesOperations { return { diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts index bf53a76fc5dc..393d577f7f99 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts @@ -1,15 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; -import { - MongoCluster, - MongoClusterUpdate, - ListConnectionStringsResult, - CheckNameAvailabilityRequest, - CheckNameAvailabilityResponse, - PromoteReplicaRequest, -} from "../../models/models.js"; +import { MongoClusterManagementContext } from "../../api/mongoClusterManagementContext.js"; import { mongoClustersGet, mongoClustersCreateOrUpdate, @@ -21,8 +13,6 @@ import { mongoClustersCheckNameAvailability, mongoClustersPromote, } from "../../api/mongoClusters/index.js"; -import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -import { PollerLike, OperationState } from "@azure/core-lro"; import { MongoClustersGetOptionalParams, MongoClustersCreateOrUpdateOptionalParams, @@ -33,7 +23,17 @@ import { MongoClustersListConnectionStringsOptionalParams, MongoClustersCheckNameAvailabilityOptionalParams, MongoClustersPromoteOptionalParams, -} from "../../models/options.js"; +} from "../../api/options.js"; +import { + MongoCluster, + MongoClusterUpdate, + ListConnectionStringsResult, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, + PromoteReplicaRequest, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; /** Interface representing a MongoClusters operations. */ export interface MongoClustersOperations { @@ -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: MongoClusterManagementContext, + 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, @@ -172,7 +204,7 @@ export function getMongoClusters(context: DocumentDBContext, subscriptionId: str } export function getMongoClustersOperations( - context: DocumentDBContext, + context: MongoClusterManagementContext, subscriptionId: string, ): MongoClustersOperations { return { diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts index 567cf05a0b0a..815887673997 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts @@ -1,25 +1,30 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; -import { Operation } from "../../models/models.js"; +import { MongoClusterManagementContext } from "../../api/mongoClusterManagementContext.js"; import { operationsList } from "../../api/operations/index.js"; +import { OperationsListOptionalParams } from "../../api/options.js"; +import { Operation } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -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) { +export function getOperations(context: MongoClusterManagementContext) { return { - list: (options?: OperationsListOptionalParams) => operationsList(context, options), + list: (options?: OperationsListOptionalParams) => + operationsList(context, options), }; } -export function getOperationsOperations(context: DocumentDBContext): OperationsOperations { +export function getOperationsOperations( + context: MongoClusterManagementContext, +): 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..aefe778f95c7 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts @@ -1,22 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; -import { PrivateEndpointConnectionResource } from "../../models/models.js"; +import { MongoClusterManagementContext } from "../../api/mongoClusterManagementContext.js"; +import { + PrivateEndpointConnectionsListByMongoClusterOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, +} from "../../api/options.js"; import { privateEndpointConnectionsListByMongoCluster, privateEndpointConnectionsGet, privateEndpointConnectionsCreate, privateEndpointConnectionsDelete, } from "../../api/privateEndpointConnections/index.js"; +import { PrivateEndpointConnectionResource } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; -import { - PrivateEndpointConnectionsListByMongoClusterOptionalParams, - PrivateEndpointConnectionsGetOptionalParams, - PrivateEndpointConnectionsCreateOptionalParams, - PrivateEndpointConnectionsDeleteOptionalParams, -} from "../../models/options.js"; /** Interface representing a PrivateEndpointConnections operations. */ export interface PrivateEndpointConnectionsOperations { @@ -53,7 +53,10 @@ export interface PrivateEndpointConnectionsOperations { ) => PollerLike, void>; } -export function getPrivateEndpointConnections(context: DocumentDBContext, subscriptionId: string) { +export function getPrivateEndpointConnections( + context: MongoClusterManagementContext, + subscriptionId: string, +) { return { listByMongoCluster: ( resourceGroupName: string, @@ -115,7 +118,7 @@ export function getPrivateEndpointConnections(context: DocumentDBContext, subscr } export function getPrivateEndpointConnectionsOperations( - context: DocumentDBContext, + context: MongoClusterManagementContext, subscriptionId: string, ): PrivateEndpointConnectionsOperations { return { diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts index a0111d477e3c..004af4a2c60a 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; -import { PrivateLinkResource } from "../../models/models.js"; +import { MongoClusterManagementContext } from "../../api/mongoClusterManagementContext.js"; +import { PrivateLinksListByMongoClusterOptionalParams } from "../../api/options.js"; import { privateLinksListByMongoCluster } from "../../api/privateLinks/index.js"; +import { PrivateLinkResource } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -import { PrivateLinksListByMongoClusterOptionalParams } from "../../models/options.js"; /** Interface representing a PrivateLinks operations. */ export interface PrivateLinksOperations { @@ -17,7 +17,10 @@ export interface PrivateLinksOperations { ) => PagedAsyncIterableIterator; } -export function getPrivateLinks(context: DocumentDBContext, subscriptionId: string) { +export function getPrivateLinks( + context: MongoClusterManagementContext, + subscriptionId: string, +) { return { listByMongoCluster: ( resourceGroupName: string, @@ -35,7 +38,7 @@ export function getPrivateLinks(context: DocumentDBContext, subscriptionId: stri } export function getPrivateLinksOperations( - context: DocumentDBContext, + context: MongoClusterManagementContext, subscriptionId: string, ): PrivateLinksOperations { return { diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/replicas/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/replicas/index.ts index f257e4c3f8d5..8869968ea300 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/replicas/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/replicas/index.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; -import { Replica } from "../../models/models.js"; +import { MongoClusterManagementContext } from "../../api/mongoClusterManagementContext.js"; +import { ReplicasListByParentOptionalParams } from "../../api/options.js"; import { replicasListByParent } from "../../api/replicas/index.js"; +import { Replica } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -import { ReplicasListByParentOptionalParams } from "../../models/options.js"; /** Interface representing a Replicas operations. */ export interface ReplicasOperations { @@ -17,19 +17,28 @@ export interface ReplicasOperations { ) => PagedAsyncIterableIterator; } -export function getReplicas(context: DocumentDBContext, subscriptionId: string) { +export function getReplicas( + context: MongoClusterManagementContext, + subscriptionId: string, +) { return { listByParent: ( resourceGroupName: string, mongoClusterName: string, options?: ReplicasListByParentOptionalParams, ) => - replicasListByParent(context, subscriptionId, resourceGroupName, mongoClusterName, options), + replicasListByParent( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), }; } export function getReplicasOperations( - context: DocumentDBContext, + context: MongoClusterManagementContext, subscriptionId: string, ): ReplicasOperations { return { 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..e901a78d3feb 100644 --- a/sdk/mongocluster/arm-mongocluster/src/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/index.ts @@ -7,17 +7,9 @@ import { PagedAsyncIterableIterator, } from "./static-helpers/pagingHelpers.js"; -export { - MongoClusterManagementClient, - MongoClusterManagementClientOptionalParams, -} from "./mongoClusterManagementClient.js"; +export { MongoClusterManagementClient } from "./mongoClusterManagementClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { - Resource, - SystemData, - KnownCreatedByType, - CreatedByType, - ProxyResource, Replica, MongoClusterProperties, KnownCreateMode, @@ -26,6 +18,7 @@ export { MongoClusterReplicaParameters, AdministratorProperties, KnownProvisioningState, + ProvisioningState, KnownMongoClusterStatus, MongoClusterStatus, KnownPublicNetworkAccess, @@ -52,13 +45,21 @@ export { ReplicationRole, KnownReplicationState, ReplicationState, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + ProxyResource, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, PrivateLinkResource, PrivateLinkResourceProperties, PrivateEndpointConnectionResource, FirewallRule, FirewallRuleProperties, - TrackedResource, MongoCluster, + TrackedResource, MongoClusterUpdate, MongoClusterUpdateProperties, ListConnectionStringsResult, @@ -78,7 +79,10 @@ export { Origin, KnownActionType, ActionType, - ProvisioningState, + KnownVersions, +} from "./models/index.js"; +export { + MongoClusterManagementClientOptionalParams, OperationsListOptionalParams, MongoClustersGetOptionalParams, MongoClustersCreateOrUpdateOptionalParams, @@ -99,7 +103,7 @@ export { PrivateEndpointConnectionsDeleteOptionalParams, PrivateLinksListByMongoClusterOptionalParams, ReplicasListByParentOptionalParams, -} from "./models/index.js"; +} from "./api/index.js"; export { FirewallRulesOperations, MongoClustersOperations, diff --git a/sdk/mongocluster/arm-mongocluster/src/models/index.ts b/sdk/mongocluster/arm-mongocluster/src/models/index.ts index e278a20bf06b..0e79bc138dde 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/index.ts @@ -2,11 +2,6 @@ // Licensed under the MIT License. export { - Resource, - SystemData, - KnownCreatedByType, - CreatedByType, - ProxyResource, Replica, MongoClusterProperties, KnownCreateMode, @@ -15,6 +10,7 @@ export { MongoClusterReplicaParameters, AdministratorProperties, KnownProvisioningState, + ProvisioningState, KnownMongoClusterStatus, MongoClusterStatus, KnownPublicNetworkAccess, @@ -41,13 +37,21 @@ export { ReplicationRole, KnownReplicationState, ReplicationState, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + ProxyResource, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, PrivateLinkResource, PrivateLinkResourceProperties, PrivateEndpointConnectionResource, FirewallRule, FirewallRuleProperties, - TrackedResource, MongoCluster, + TrackedResource, MongoClusterUpdate, MongoClusterUpdateProperties, ListConnectionStringsResult, @@ -67,27 +71,5 @@ export { Origin, KnownActionType, ActionType, - ProvisioningState, + KnownVersions, } from "./models.js"; -export { - OperationsListOptionalParams, - MongoClustersGetOptionalParams, - MongoClustersCreateOrUpdateOptionalParams, - MongoClustersUpdateOptionalParams, - MongoClustersDeleteOptionalParams, - MongoClustersListByResourceGroupOptionalParams, - MongoClustersListOptionalParams, - MongoClustersListConnectionStringsOptionalParams, - MongoClustersCheckNameAvailabilityOptionalParams, - MongoClustersPromoteOptionalParams, - FirewallRulesGetOptionalParams, - FirewallRulesCreateOrUpdateOptionalParams, - FirewallRulesDeleteOptionalParams, - FirewallRulesListByMongoClusterOptionalParams, - PrivateEndpointConnectionsListByMongoClusterOptionalParams, - PrivateEndpointConnectionsGetOptionalParams, - PrivateEndpointConnectionsCreateOptionalParams, - PrivateEndpointConnectionsDeleteOptionalParams, - PrivateLinksListByMongoClusterOptionalParams, - ReplicasListByParentOptionalParams, -} from "./options.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/models/models.ts b/sdk/mongocluster/arm-mongocluster/src/models/models.ts index 70c7f64725c2..6e1f286fda28 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/models.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/models.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { serializeRecord } from "../helpers/serializerHelpers.js"; - /** The response of a Replica list operation. */ export interface _ReplicaListResult { /** The Replica items on this page */ @@ -11,67 +9,17 @@ export interface _ReplicaListResult { nextLink?: string; } -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ - readonly id?: string; - /** The name of the resource */ - readonly name?: string; - /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ - readonly type?: string; - /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - readonly systemData?: SystemData; -} - -export function resourceSerializer(item: Resource) { - return item as any; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key", +export function _replicaListResultDeserializer(item: any): _ReplicaListResult { + return { + value: replicaArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; } -/** - * The kind of entity that created the resource. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export interface ProxyResource extends Resource {} - -export function proxyResourceSerializer(item: ProxyResource) { - return item as any; +export function replicaArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return replicaDeserializer(item); + }); } /** Represents a mongo cluster replica. */ @@ -80,6 +28,20 @@ export interface Replica extends ProxyResource { properties?: MongoClusterProperties; } +export function replicaDeserializer(item: any): Replica { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : mongoClusterPropertiesDeserializer(item["properties"]), + }; +} + /** The properties of a mongo cluster. */ export interface MongoClusterProperties { /** The mode to create a mongo cluster. */ @@ -122,40 +84,103 @@ export interface MongoClusterProperties { export function mongoClusterPropertiesSerializer( item: MongoClusterProperties, -): Record { +): any { return { createMode: item["createMode"], - restoreParameters: !item.restoreParameters - ? item.restoreParameters - : mongoClusterRestoreParametersSerializer(item.restoreParameters), - replicaParameters: !item.replicaParameters - ? item.replicaParameters - : mongoClusterReplicaParametersSerializer(item.replicaParameters), - administrator: !item.administrator - ? item.administrator - : administratorPropertiesSerializer(item.administrator), + restoreParameters: !item["restoreParameters"] + ? item["restoreParameters"] + : mongoClusterRestoreParametersSerializer(item["restoreParameters"]), + replicaParameters: !item["replicaParameters"] + ? item["replicaParameters"] + : mongoClusterReplicaParametersSerializer(item["replicaParameters"]), + administrator: !item["administrator"] + ? item["administrator"] + : administratorPropertiesSerializer(item["administrator"]), serverVersion: item["serverVersion"], publicNetworkAccess: item["publicNetworkAccess"], - 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), - previewFeatures: item["previewFeatures"], + 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"]), + previewFeatures: !item["previewFeatures"] + ? item["previewFeatures"] + : item["previewFeatures"].map((p: any) => { + return p; + }), }; } -/** Known values of {@link CreateMode} that the service accepts. */ +export function mongoClusterPropertiesDeserializer( + item: any, +): MongoClusterProperties { + return { + createMode: item["createMode"], + restoreParameters: !item["restoreParameters"] + ? item["restoreParameters"] + : mongoClusterRestoreParametersDeserializer(item["restoreParameters"]), + replicaParameters: !item["replicaParameters"] + ? item["replicaParameters"] + : mongoClusterReplicaParametersDeserializer(item["replicaParameters"]), + administrator: !item["administrator"] + ? item["administrator"] + : administratorPropertiesDeserializer(item["administrator"]), + serverVersion: item["serverVersion"], + connectionString: item["connectionString"], + provisioningState: item["provisioningState"], + clusterStatus: item["clusterStatus"], + publicNetworkAccess: item["publicNetworkAccess"], + highAvailability: !item["highAvailability"] + ? item["highAvailability"] + : highAvailabilityPropertiesDeserializer(item["highAvailability"]), + storage: !item["storage"] + ? item["storage"] + : storagePropertiesDeserializer(item["storage"]), + sharding: !item["sharding"] + ? item["sharding"] + : shardingPropertiesDeserializer(item["sharding"]), + compute: !item["compute"] + ? item["compute"] + : computePropertiesDeserializer(item["compute"]), + backup: !item["backup"] + ? item["backup"] + : backupPropertiesDeserializer(item["backup"]), + privateEndpointConnections: !item["privateEndpointConnections"] + ? item["privateEndpointConnections"] + : privateEndpointConnectionArrayDeserializer( + item["privateEndpointConnections"], + ), + previewFeatures: !item["previewFeatures"] + ? item["previewFeatures"] + : item["previewFeatures"].map((p: any) => { + return p; + }), + replica: !item["replica"] + ? item["replica"] + : replicationPropertiesDeserializer(item["replica"]), + infrastructureVersion: item["infrastructureVersion"], + }; +} + +/** The mode that the Mongo Cluster is created with. */ export enum KnownCreateMode { - /** Default */ + /** Create a new mongo cluster. */ Default = "Default", - /** PointInTimeRestore */ + /** Create a mongo cluster from a restore point-in-time. */ PointInTimeRestore = "PointInTimeRestore", - /** GeoReplica */ + /** Create a replica cluster in distinct geographic region from the source cluster. */ GeoReplica = "GeoReplica", - /** Replica */ + /** Create a replica cluster in the same geographic region as the source cluster. */ Replica = "Replica", } @@ -164,10 +189,10 @@ export enum KnownCreateMode { * {@link KnownCreateMode} can be used interchangeably with CreateMode, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Default** \ - * **PointInTimeRestore** \ - * **GeoReplica** \ - * **Replica** + * **Default**: Create a new mongo cluster. \ + * **PointInTimeRestore**: Create a mongo cluster from a restore point-in-time. \ + * **GeoReplica**: Create a replica cluster in distinct geographic region from the source cluster. \ + * **Replica**: Create a replica cluster in the same geographic region as the source cluster. */ export type CreateMode = string; @@ -181,13 +206,24 @@ export interface MongoClusterRestoreParameters { export function mongoClusterRestoreParametersSerializer( item: MongoClusterRestoreParameters, -): Record { +): any { return { pointInTimeUTC: item["pointInTimeUTC"]?.toISOString(), sourceResourceId: item["sourceResourceId"], }; } +export function mongoClusterRestoreParametersDeserializer( + item: any, +): MongoClusterRestoreParameters { + return { + pointInTimeUTC: !item["pointInTimeUTC"] + ? item["pointInTimeUTC"] + : new Date(item["pointInTimeUTC"]), + sourceResourceId: item["sourceResourceId"], + }; +} + /** Parameters used for replica operations. */ export interface MongoClusterReplicaParameters { /** The id of the replication source cluster. */ @@ -198,7 +234,16 @@ export interface MongoClusterReplicaParameters { export function mongoClusterReplicaParametersSerializer( item: MongoClusterReplicaParameters, -): Record { +): any { + return { + sourceResourceId: item["sourceResourceId"], + sourceLocation: item["sourceLocation"], + }; +} + +export function mongoClusterReplicaParametersDeserializer( + item: any, +): MongoClusterReplicaParameters { return { sourceResourceId: item["sourceResourceId"], sourceLocation: item["sourceLocation"], @@ -215,28 +260,64 @@ export interface AdministratorProperties { export function administratorPropertiesSerializer( item: AdministratorProperties, -): Record { +): any { + return { userName: item["userName"], password: item["password"] }; +} + +export function administratorPropertiesDeserializer( + item: any, +): AdministratorProperties { return { userName: item["userName"], password: item["password"], }; } -/** Known values of {@link MongoClusterStatus} that the service accepts. */ +/** The provisioning state of the last accepted operation. */ +export enum KnownProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** An operation is in-progress on the resource. */ + InProgress = "InProgress", + /** An update operation is in-progress on the resource. */ + UpdatingTest2 = "UpdatingTest2", + /** A drop operation is in-progress on the resource. */ + Dropping = "Dropping", +} + +/** + * The provisioning state of the last accepted operation. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. \ + * **InProgress**: An operation is in-progress on the resource. \ + * **UpdatingTest2**: An update operation is in-progress on the resource. \ + * **Dropping**: A drop operation is in-progress on the resource. + */ +export type ProvisioningState = string; + +/** The status of the Mongo cluster resource. */ export enum KnownMongoClusterStatus { - /** Ready */ + /** The mongo cluster resource is ready for use. */ Ready = "Ready", - /** Provisioning */ + /** The mongo cluster resource is being provisioned. */ Provisioning = "Provisioning", - /** Updating */ + /** The mongo cluster resource is being updated. */ Updating = "Updating", - /** Starting */ + /** The mongo cluster resource is being started. */ Starting = "Starting", - /** Stopping */ + /** The mongo cluster resource is being stopped. */ Stopping = "Stopping", - /** Stopped */ + /** The mongo cluster resource is stopped. */ Stopped = "Stopped", - /** Dropping */ + /** The mongo cluster resource is being dropped. */ Dropping = "Dropping", } @@ -245,21 +326,21 @@ export enum KnownMongoClusterStatus { * {@link KnownMongoClusterStatus} can be used interchangeably with MongoClusterStatus, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Ready** \ - * **Provisioning** \ - * **Updating** \ - * **Starting** \ - * **Stopping** \ - * **Stopped** \ - * **Dropping** + * **Ready**: The mongo cluster resource is ready for use. \ + * **Provisioning**: The mongo cluster resource is being provisioned. \ + * **Updating**: The mongo cluster resource is being updated. \ + * **Starting**: The mongo cluster resource is being started. \ + * **Stopping**: The mongo cluster resource is being stopped. \ + * **Stopped**: The mongo cluster resource is stopped. \ + * **Dropping**: The mongo cluster resource is being dropped. */ export type MongoClusterStatus = string; -/** Known values of {@link PublicNetworkAccess} that the service accepts. */ +/** Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is 'Enabled' */ export enum KnownPublicNetworkAccess { - /** Enabled */ + /** If set, mongo cluster can be accessed through private and public methods. */ Enabled = "Enabled", - /** Disabled */ + /** If set, the private endpoints are the exclusive access method. */ Disabled = "Disabled", } @@ -268,8 +349,8 @@ export enum KnownPublicNetworkAccess { * {@link KnownPublicNetworkAccess} can be used interchangeably with PublicNetworkAccess, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Enabled** \ - * **Disabled** + * **Enabled**: If set, mongo cluster can be accessed through private and public methods. \ + * **Disabled**: If set, the private endpoints are the exclusive access method. */ export type PublicNetworkAccess = string; @@ -281,19 +362,25 @@ export interface HighAvailabilityProperties { export function highAvailabilityPropertiesSerializer( item: HighAvailabilityProperties, -): Record { +): any { + return { targetMode: item["targetMode"] }; +} + +export function highAvailabilityPropertiesDeserializer( + item: any, +): HighAvailabilityProperties { return { targetMode: item["targetMode"], }; } -/** Known values of {@link HighAvailabilityMode} that the service accepts. */ +/** The high availability modes for a cluster. */ export enum KnownHighAvailabilityMode { - /** Disabled */ + /** High availability mode is disabled. This mode is can see availability impact during faults or maintenance and is not recommended for production. */ Disabled = "Disabled", - /** SameZone */ + /** High availability mode is enabled, where each server in a shard is placed in the same availability zone. */ SameZone = "SameZone", - /** ZoneRedundantPreferred */ + /** High availability mode is enabled and preferences ZoneRedundant if availability zones capacity is available in the region, otherwise falls-back to provisioning with SameZone. */ ZoneRedundantPreferred = "ZoneRedundantPreferred", } @@ -302,9 +389,9 @@ export enum KnownHighAvailabilityMode { * {@link KnownHighAvailabilityMode} can be used interchangeably with HighAvailabilityMode, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Disabled** \ - * **SameZone** \ - * **ZoneRedundantPreferred** + * **Disabled**: High availability mode is disabled. This mode is can see availability impact during faults or maintenance and is not recommended for production. \ + * **SameZone**: High availability mode is enabled, where each server in a shard is placed in the same availability zone. \ + * **ZoneRedundantPreferred**: High availability mode is enabled and preferences ZoneRedundant if availability zones capacity is available in the region, otherwise falls-back to provisioning with SameZone. */ export type HighAvailabilityMode = string; @@ -314,7 +401,11 @@ export interface StorageProperties { sizeGb?: number; } -export function storagePropertiesSerializer(item: StorageProperties): Record { +export function storagePropertiesSerializer(item: StorageProperties): any { + return { sizeGb: item["sizeGb"] }; +} + +export function storagePropertiesDeserializer(item: any): StorageProperties { return { sizeGb: item["sizeGb"], }; @@ -326,7 +417,11 @@ export interface ShardingProperties { shardCount?: number; } -export function shardingPropertiesSerializer(item: ShardingProperties): Record { +export function shardingPropertiesSerializer(item: ShardingProperties): any { + return { shardCount: item["shardCount"] }; +} + +export function shardingPropertiesDeserializer(item: any): ShardingProperties { return { shardCount: item["shardCount"], }; @@ -338,7 +433,11 @@ export interface ComputeProperties { tier?: string; } -export function computePropertiesSerializer(item: ComputeProperties): Record { +export function computePropertiesSerializer(item: ComputeProperties): any { + return { tier: item["tier"] }; +} + +export function computePropertiesDeserializer(item: any): ComputeProperties { return { tier: item["tier"], }; @@ -350,8 +449,22 @@ export interface BackupProperties { readonly earliestRestoreTime?: string; } -export function backupPropertiesSerializer(item: BackupProperties) { - return item as any; +export function backupPropertiesSerializer(item: BackupProperties): any { + return item; +} + +export function backupPropertiesDeserializer(item: any): BackupProperties { + return { + earliestRestoreTime: item["earliestRestoreTime"], + }; +} + +export function privateEndpointConnectionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return privateEndpointConnectionDeserializer(item); + }); } /** The private endpoint connection resource */ @@ -360,6 +473,22 @@ export interface PrivateEndpointConnection extends Resource { properties?: PrivateEndpointConnectionProperties; } +export function privateEndpointConnectionDeserializer( + item: any, +): PrivateEndpointConnection { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : privateEndpointConnectionPropertiesDeserializer(item["properties"]), + }; +} + /** Properties of the private endpoint connection. */ export interface PrivateEndpointConnectionProperties { /** The group ids for the private endpoint resource. */ @@ -374,14 +503,35 @@ export interface PrivateEndpointConnectionProperties { export function privateEndpointConnectionPropertiesSerializer( item: PrivateEndpointConnectionProperties, -): Record { +): any { return { - privateEndpoint: !item.privateEndpoint - ? item.privateEndpoint - : privateEndpointSerializer(item.privateEndpoint), - privateLinkServiceConnectionState: privateLinkServiceConnectionStateSerializer( - item.privateLinkServiceConnectionState, - ), + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointSerializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: + privateLinkServiceConnectionStateSerializer( + item["privateLinkServiceConnectionState"], + ), + }; +} + +export function privateEndpointConnectionPropertiesDeserializer( + item: any, +): PrivateEndpointConnectionProperties { + return { + groupIds: !item["groupIds"] + ? item["groupIds"] + : item["groupIds"].map((p: any) => { + return p; + }), + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointDeserializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: + privateLinkServiceConnectionStateDeserializer( + item["privateLinkServiceConnectionState"], + ), + provisioningState: item["provisioningState"], }; } @@ -391,8 +541,14 @@ export interface PrivateEndpoint { readonly id?: string; } -export function privateEndpointSerializer(item: PrivateEndpoint) { - return item as any; +export function privateEndpointSerializer(item: PrivateEndpoint): any { + return item; +} + +export function privateEndpointDeserializer(item: any): PrivateEndpoint { + return { + id: item["id"], + }; } /** A collection of information about the state of the connection between service consumer and provider. */ @@ -407,7 +563,7 @@ export interface PrivateLinkServiceConnectionState { export function privateLinkServiceConnectionStateSerializer( item: PrivateLinkServiceConnectionState, -): Record { +): any { return { status: item["status"], description: item["description"], @@ -415,13 +571,23 @@ export function privateLinkServiceConnectionStateSerializer( }; } -/** Known values of {@link PrivateEndpointServiceConnectionStatus} that the service accepts. */ +export function privateLinkServiceConnectionStateDeserializer( + item: any, +): PrivateLinkServiceConnectionState { + return { + status: item["status"], + description: item["description"], + actionsRequired: item["actionsRequired"], + }; +} + +/** The private endpoint connection status. */ export enum KnownPrivateEndpointServiceConnectionStatus { - /** Pending */ + /** Connectionaiting for approval or rejection */ Pending = "Pending", - /** Approved */ + /** Connection approved */ Approved = "Approved", - /** Rejected */ + /** Connection Rejected */ Rejected = "Rejected", } @@ -430,21 +596,21 @@ export enum KnownPrivateEndpointServiceConnectionStatus { * {@link KnownPrivateEndpointServiceConnectionStatus} can be used interchangeably with PrivateEndpointServiceConnectionStatus, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Pending** \ - * **Approved** \ - * **Rejected** + * **Pending**: Connectionaiting for approval or rejection \ + * **Approved**: Connection approved \ + * **Rejected**: Connection Rejected */ export type PrivateEndpointServiceConnectionStatus = string; -/** Known values of {@link PrivateEndpointConnectionProvisioningState} that the service accepts. */ +/** The current provisioning state. */ export enum KnownPrivateEndpointConnectionProvisioningState { - /** Succeeded */ + /** Connection has been provisioned */ Succeeded = "Succeeded", - /** Creating */ + /** Connection is being created */ Creating = "Creating", - /** Deleting */ + /** Connection is being deleted */ Deleting = "Deleting", - /** Failed */ + /** Connection provisioning has failed */ Failed = "Failed", } @@ -453,16 +619,16 @@ export enum KnownPrivateEndpointConnectionProvisioningState { * {@link KnownPrivateEndpointConnectionProvisioningState} can be used interchangeably with PrivateEndpointConnectionProvisioningState, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Succeeded** \ - * **Creating** \ - * **Deleting** \ - * **Failed** + * **Succeeded**: Connection has been provisioned \ + * **Creating**: Connection is being created \ + * **Deleting**: Connection is being deleted \ + * **Failed**: Connection provisioning has failed */ export type PrivateEndpointConnectionProvisioningState = string; -/** Known values of {@link PreviewFeature} that the service accepts. */ +/** Preview features that can be enabled on a mongo cluster. */ export enum KnownPreviewFeature { - /** GeoReplicas */ + /** Enables geo replicas preview feature. The feature must be set at create-time on new cluster to enable linking a geo-replica cluster to it. */ GeoReplicas = "GeoReplicas", } @@ -471,7 +637,7 @@ export enum KnownPreviewFeature { * {@link KnownPreviewFeature} can be used interchangeably with PreviewFeature, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **GeoReplicas** + * **GeoReplicas**: Enables geo replicas preview feature. The feature must be set at create-time on new cluster to enable linking a geo-replica cluster to it. */ export type PreviewFeature = string; @@ -485,13 +651,23 @@ export interface ReplicationProperties { readonly replicationState?: ReplicationState; } -/** Known values of {@link ReplicationRole} that the service accepts. */ +export function replicationPropertiesDeserializer( + item: any, +): ReplicationProperties { + return { + sourceResourceId: item["sourceResourceId"], + role: item["role"], + replicationState: item["replicationState"], + }; +} + +/** Replication role of the mongo cluster. */ export enum KnownReplicationRole { - /** Primary */ + /** The cluster is a primary replica. */ Primary = "Primary", - /** AsyncReplica */ + /** The cluster is a local asynchronous replica. */ AsyncReplica = "AsyncReplica", - /** GeoAsyncReplica */ + /** The cluster is a geo-asynchronous replica. */ GeoAsyncReplica = "GeoAsyncReplica", } @@ -500,25 +676,25 @@ export enum KnownReplicationRole { * {@link KnownReplicationRole} can be used interchangeably with ReplicationRole, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Primary** \ - * **AsyncReplica** \ - * **GeoAsyncReplica** + * **Primary**: The cluster is a primary replica. \ + * **AsyncReplica**: The cluster is a local asynchronous replica. \ + * **GeoAsyncReplica**: The cluster is a geo-asynchronous replica. */ export type ReplicationRole = string; -/** Known values of {@link ReplicationState} that the service accepts. */ +/** The state of the replication link between the replica and source cluster. */ export enum KnownReplicationState { - /** Active */ + /** Replication link is active. */ Active = "Active", - /** Catchup */ + /** Replica is catching-up with the primary. This can occur after the replica is created or after a promotion is triggered. */ Catchup = "Catchup", - /** Provisioning */ + /** Replica and replication link to the primary is being created. */ Provisioning = "Provisioning", - /** Updating */ + /** Replication link is being updated due to a change on the replica or an upgrade. */ Updating = "Updating", - /** Broken */ + /** Replication link is broken and the replica may need to be recreated. */ Broken = "Broken", - /** Reconfiguring */ + /** Replication link is re-configuring due to a promotion event. */ Reconfiguring = "Reconfiguring", } @@ -527,15 +703,201 @@ export enum KnownReplicationState { * {@link KnownReplicationState} can be used interchangeably with ReplicationState, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Active** \ - * **Catchup** \ - * **Provisioning** \ - * **Updating** \ - * **Broken** \ - * **Reconfiguring** + * **Active**: Replication link is active. \ + * **Catchup**: Replica is catching-up with the primary. This can occur after the replica is created or after a promotion is triggered. \ + * **Provisioning**: Replica and replication link to the primary is being created. \ + * **Updating**: Replication link is being updated due to a change on the replica or an upgrade. \ + * **Broken**: Replication link is broken and the replica may need to be recreated. \ + * **Reconfiguring**: Replication link is re-configuring due to a promotion event. */ export type ReplicationState = string; +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] + ? item["createdAt"] + : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnowncreatedByType} can be used interchangeably with createdByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(item: ProxyResource): any { + return item; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] + ? item["error"] + : errorDetailDeserializer(item["error"]), + }; +} + +/** 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[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] + ? item["details"] + : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: Record; +} + +export function errorAdditionalInfoDeserializer( + item: any, +): ErrorAdditionalInfo { + return { + type: item["type"], + info: !item["info"] + ? item["info"] + : _errorAdditionalInfoInfoDeserializer(item["info"]), + }; +} + +/** model interface _ErrorAdditionalInfoInfo */ +export interface _ErrorAdditionalInfoInfo {} + +export function _errorAdditionalInfoInfoDeserializer( + item: any, +): _ErrorAdditionalInfoInfo { + return item; +} + /** The response of a PrivateLinkResource list operation. */ export interface _PrivateLinkResourceListResult { /** The PrivateLinkResource items on this page */ @@ -544,12 +906,45 @@ export interface _PrivateLinkResourceListResult { nextLink?: string; } +export function _privateLinkResourceListResultDeserializer( + item: any, +): _PrivateLinkResourceListResult { + return { + value: privateLinkResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function privateLinkResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return privateLinkResourceDeserializer(item); + }); +} + /** Concrete proxy resource types can be created by aliasing this type using a specific property type. */ export interface PrivateLinkResource extends ProxyResource { /** The resource-specific properties for this resource. */ properties?: PrivateLinkResourceProperties; } +export function privateLinkResourceDeserializer( + item: any, +): PrivateLinkResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : privateLinkResourcePropertiesDeserializer(item["properties"]), + }; +} + /** Properties of a private link resource. */ export interface PrivateLinkResourceProperties { /** The private link resource group id. */ @@ -560,6 +955,24 @@ export interface PrivateLinkResourceProperties { requiredZoneNames?: string[]; } +export function privateLinkResourcePropertiesDeserializer( + item: any, +): PrivateLinkResourceProperties { + return { + groupId: item["groupId"], + requiredMembers: !item["requiredMembers"] + ? item["requiredMembers"] + : item["requiredMembers"].map((p: any) => { + return p; + }), + requiredZoneNames: !item["requiredZoneNames"] + ? item["requiredZoneNames"] + : item["requiredZoneNames"].map((p: any) => { + return p; + }), + }; +} + /** The response of a PrivateEndpointConnectionResource list operation. */ export interface _PrivateEndpointConnectionResourceListResult { /** The PrivateEndpointConnectionResource items on this page */ @@ -568,6 +981,31 @@ export interface _PrivateEndpointConnectionResourceListResult { nextLink?: string; } +export function _privateEndpointConnectionResourceListResultDeserializer( + item: any, +): _PrivateEndpointConnectionResourceListResult { + return { + value: privateEndpointConnectionResourceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function privateEndpointConnectionResourceArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return privateEndpointConnectionResourceSerializer(item); + }); +} + +export function privateEndpointConnectionResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return privateEndpointConnectionResourceDeserializer(item); + }); +} + /** Concrete proxy resource types can be created by aliasing this type using a specific property type. */ export interface PrivateEndpointConnectionResource extends ProxyResource { /** The resource-specific properties for this resource. */ @@ -576,11 +1014,27 @@ export interface PrivateEndpointConnectionResource extends ProxyResource { export function privateEndpointConnectionResourceSerializer( item: PrivateEndpointConnectionResource, -): Record { +): any { return { - properties: !item.properties - ? item.properties - : privateEndpointConnectionPropertiesSerializer(item.properties), + properties: !item["properties"] + ? item["properties"] + : privateEndpointConnectionPropertiesSerializer(item["properties"]), + }; +} + +export function privateEndpointConnectionResourceDeserializer( + item: any, +): PrivateEndpointConnectionResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : privateEndpointConnectionPropertiesDeserializer(item["properties"]), }; } @@ -590,11 +1044,25 @@ export interface FirewallRule extends ProxyResource { properties?: FirewallRuleProperties; } -export function firewallRuleSerializer(item: FirewallRule): Record { +export function firewallRuleSerializer(item: FirewallRule): any { return { - properties: !item.properties - ? item.properties - : firewallRulePropertiesSerializer(item.properties), + properties: !item["properties"] + ? item["properties"] + : firewallRulePropertiesSerializer(item["properties"]), + }; +} + +export function firewallRuleDeserializer(item: any): FirewallRule { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : firewallRulePropertiesDeserializer(item["properties"]), }; } @@ -610,8 +1078,18 @@ export interface FirewallRuleProperties { export function firewallRulePropertiesSerializer( item: FirewallRuleProperties, -): Record { +): any { + return { + startIpAddress: item["startIpAddress"], + endIpAddress: item["endIpAddress"], + }; +} + +export function firewallRulePropertiesDeserializer( + item: any, +): FirewallRuleProperties { return { + provisioningState: item["provisioningState"], startIpAddress: item["startIpAddress"], endIpAddress: item["endIpAddress"], }; @@ -625,34 +1103,85 @@ export interface _FirewallRuleListResult { nextLink?: string; } -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -export interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: Record; - /** The geo-location where the resource lives */ - location: string; -} - -export function trackedResourceSerializer(item: TrackedResource): Record { +export function _firewallRuleListResultDeserializer( + item: any, +): _FirewallRuleListResult { return { - tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), - location: item["location"], + value: firewallRuleArrayDeserializer(item["value"]), + nextLink: item["nextLink"], }; } +export function firewallRuleArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return firewallRuleSerializer(item); + }); +} + +export function firewallRuleArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return firewallRuleDeserializer(item); + }); +} + /** Represents a mongo cluster resource. */ export interface MongoCluster extends TrackedResource { /** The resource-specific properties for this resource. */ properties?: MongoClusterProperties; } -export function mongoClusterSerializer(item: MongoCluster): Record { +export function mongoClusterSerializer(item: MongoCluster): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : mongoClusterPropertiesSerializer(item["properties"]), + }; +} + +export function mongoClusterDeserializer(item: any): MongoCluster { return { - tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : mongoClusterPropertiesDeserializer(item["properties"]), + }; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], location: item["location"], - properties: !item.properties - ? item.properties - : mongoClusterPropertiesSerializer(item.properties), }; } @@ -664,12 +1193,12 @@ export interface MongoClusterUpdate { properties?: MongoClusterUpdateProperties; } -export function mongoClusterUpdateSerializer(item: MongoClusterUpdate): Record { +export function mongoClusterUpdateSerializer(item: MongoClusterUpdate): any { return { - tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), - properties: !item.properties - ? item.properties - : mongoClusterUpdatePropertiesSerializer(item.properties), + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : mongoClusterUpdatePropertiesSerializer(item["properties"]), }; } @@ -697,21 +1226,33 @@ export interface MongoClusterUpdateProperties { export function mongoClusterUpdatePropertiesSerializer( item: MongoClusterUpdateProperties, -): Record { +): any { return { - administrator: !item.administrator - ? item.administrator - : administratorPropertiesSerializer(item.administrator), + administrator: !item["administrator"] + ? item["administrator"] + : administratorPropertiesSerializer(item["administrator"]), serverVersion: item["serverVersion"], publicNetworkAccess: item["publicNetworkAccess"], - 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), - previewFeatures: item["previewFeatures"], + 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"]), + previewFeatures: !item["previewFeatures"] + ? item["previewFeatures"] + : item["previewFeatures"].map((p: any) => { + return p; + }), }; } @@ -723,12 +1264,55 @@ export interface _MongoClusterListResult { nextLink?: string; } +export function _mongoClusterListResultDeserializer( + item: any, +): _MongoClusterListResult { + return { + value: mongoClusterArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function mongoClusterArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return mongoClusterSerializer(item); + }); +} + +export function mongoClusterArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return mongoClusterDeserializer(item); + }); +} + /** The connection strings for the given mongo cluster. */ export interface ListConnectionStringsResult { /** An array that contains the connection strings for a mongo cluster. */ readonly connectionStrings?: ConnectionString[]; } +export function listConnectionStringsResultDeserializer( + item: any, +): ListConnectionStringsResult { + return { + connectionStrings: !item["connectionStrings"] + ? item["connectionStrings"] + : connectionStringArrayDeserializer(item["connectionStrings"]), + }; +} + +export function connectionStringArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return connectionStringDeserializer(item); + }); +} + /** Connection string for the mongo cluster */ export interface ConnectionString { /** Value of the connection string */ @@ -739,6 +1323,14 @@ export interface ConnectionString { readonly name?: string; } +export function connectionStringDeserializer(item: any): ConnectionString { + return { + connectionString: item["connectionString"], + description: item["description"], + name: item["name"], + }; +} + /** The check availability request body. */ export interface CheckNameAvailabilityRequest { /** The name of the resource for which availability needs to be checked. */ @@ -749,11 +1341,8 @@ export interface CheckNameAvailabilityRequest { export function checkNameAvailabilityRequestSerializer( item: CheckNameAvailabilityRequest, -): Record { - return { - name: item["name"], - type: item["type"], - }; +): any { + return { name: item["name"], type: item["type"] }; } /** The check availability result. */ @@ -766,11 +1355,21 @@ export interface CheckNameAvailabilityResponse { message?: string; } -/** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */ +export function checkNameAvailabilityResponseDeserializer( + item: any, +): CheckNameAvailabilityResponse { + return { + nameAvailable: item["nameAvailable"], + reason: item["reason"], + message: item["message"], + }; +} + +/** Possible reasons for a name not being available. */ export enum KnownCheckNameAvailabilityReason { - /** Invalid */ + /** Name is invalid. */ Invalid = "Invalid", - /** AlreadyExists */ + /** Name already exists. */ AlreadyExists = "AlreadyExists", } @@ -779,8 +1378,8 @@ export enum KnownCheckNameAvailabilityReason { * {@link KnownCheckNameAvailabilityReason} can be used interchangeably with CheckNameAvailabilityReason, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Invalid** \ - * **AlreadyExists** + * **Invalid**: Name is invalid. \ + * **AlreadyExists**: Name already exists. */ export type CheckNameAvailabilityReason = string; @@ -794,16 +1393,13 @@ export interface PromoteReplicaRequest { export function promoteReplicaRequestSerializer( item: PromoteReplicaRequest, -): Record { - return { - promoteOption: item["promoteOption"], - mode: item["mode"], - }; +): any { + return { promoteOption: item["promoteOption"], mode: item["mode"] }; } -/** Known values of {@link PromoteOption} that the service accepts. */ +/** The option to apply to a promote operation. */ export enum KnownPromoteOption { - /** Forced */ + /** Promote option forces the promotion without waiting for the replica to be caught up to the primary. This can result in data-loss so should only be used during disaster recovery scenarios. */ Forced = "Forced", } @@ -812,13 +1408,13 @@ export enum KnownPromoteOption { * {@link KnownPromoteOption} can be used interchangeably with PromoteOption, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Forced** + * **Forced**: Promote option forces the promotion without waiting for the replica to be caught up to the primary. This can result in data-loss so should only be used during disaster recovery scenarios. */ export type PromoteOption = string; -/** Known values of {@link PromoteMode} that the service accepts. */ +/** The mode to apply to a promote operation. */ export enum KnownPromoteMode { - /** Switchover */ + /** Promotion will switch the current replica cluster to the primary role and the original primary will be switched to a replica role, maintaining the replication link. */ Switchover = "Switchover", } @@ -827,7 +1423,7 @@ export enum KnownPromoteMode { * {@link KnownPromoteMode} can be used interchangeably with PromoteMode, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Switchover** + * **Switchover**: Promotion will switch the current replica cluster to the primary role and the original primary will be switched to a replica role, maintaining the replication link. */ export type PromoteMode = string; @@ -839,6 +1435,21 @@ export interface _OperationListResult { nextLink?: string; } +export function _operationListResultDeserializer( + item: any, +): _OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + /** Details of a REST API operation, returned from the Resource Provider Operations API */ export interface Operation { /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ @@ -853,6 +1464,18 @@ export interface Operation { actionType?: ActionType; } +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] + ? item["display"] + : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + /** Localized display information for and operation. */ export interface OperationDisplay { /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ @@ -865,14 +1488,23 @@ export interface OperationDisplay { readonly description?: string; } -/** Known values of {@link Origin} that the service accepts. */ +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ export enum KnownOrigin { - /** user */ - User = "user", - /** system */ - System = "system", - /** user,system */ - UserSystem = "user,system", + /** Indicates the operation is initiated by a user. */ + user = "user", + /** Indicates the operation is initiated by a system. */ + system = "system", + /** Indicates the operation is initiated by a user or system. */ + "user,system" = "user,system", } /** @@ -880,15 +1512,15 @@ export enum KnownOrigin { * {@link KnownOrigin} can be used interchangeably with Origin, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **user** \ - * **system** \ - * **user,system** + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. */ export type Origin = string; -/** Known values of {@link ActionType} that the service accepts. */ +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ export enum KnownActionType { - /** Internal */ + /** Actions are for internal-only APIs. */ Internal = "Internal", } @@ -897,37 +1529,12 @@ export enum KnownActionType { * {@link KnownActionType} can be used interchangeably with ActionType, * this enum contains the known values that the service supports. * ### Known values supported by the service - * **Internal** + * **Internal**: Actions are for internal-only APIs. */ 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 available API versions. */ +export enum KnownVersions { + /** Azure Cosmos DB for Mongo vCore clusters api version 2024-07-01. */ + v2024_07_01 = "2024-07-01", } - -/** - * 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; diff --git a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts index 921a933f659d..efe2135defcf 100644 --- a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -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,18 +17,26 @@ 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, + MongoClusterManagementContext, MongoClusterManagementClientOptionalParams, } from "./api/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; export { MongoClusterManagementClientOptionalParams } from "./api/mongoClusterManagementContext.js"; export class MongoClusterManagementClient { - private _client: DocumentDBContext; + private _client: MongoClusterManagementContext; /** The pipeline used by this client to make requests */ public readonly pipeline: Pipeline; @@ -40,15 +49,21 @@ export class MongoClusterManagementClient { const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-client` - : "azsdk-js-client"; + : `azsdk-js-client`; this._client = createMongoClusterManagement(credential, { ...options, userAgentOptions: { userAgentPrefix }, }); 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..97a81e74e301 100644 --- a/sdk/mongocluster/arm-mongocluster/src/static-helpers/pagingHelpers.ts +++ b/sdk/mongocluster/arm-mongocluster/src/static-helpers/pagingHelpers.ts @@ -1,7 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; +import { + Client, + createRestError, + PathUncheckedResponse, +} from "@azure-rest/core-client"; import { RestError } from "@azure/core-rest-pipeline"; /** @@ -39,11 +43,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 +71,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 +152,9 @@ function getPagedAsyncIterator< >( pagedResult: PagedResult, ): PagedAsyncIterableIterator { - const iter = getItemAsyncIterator(pagedResult); + const iter = getItemAsyncIterator( + pagedResult, + ); return { next() { return iter.next(); @@ -157,7 +173,11 @@ function getPagedAsyncIterator< }; } -async function* getItemAsyncIterator( +async function* getItemAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( pagedResult: PagedResult, ): AsyncIterableIterator { const pages = getPageAsyncIterator(pagedResult); @@ -166,14 +186,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 +227,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 +261,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..2edbf783be53 100644 --- a/sdk/mongocluster/arm-mongocluster/src/static-helpers/pollingHelpers.ts +++ b/sdk/mongocluster/arm-mongocluster/src/static-helpers/pollingHelpers.ts @@ -10,7 +10,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 +42,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 +53,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.browser.config.json b/sdk/mongocluster/arm-mongocluster/tsconfig.browser.config.json index 1b37aebc5457..091177fcb991 100644 --- a/sdk/mongocluster/arm-mongocluster/tsconfig.browser.config.json +++ b/sdk/mongocluster/arm-mongocluster/tsconfig.browser.config.json @@ -1,7 +1,7 @@ { "extends": "./.tshy/build.json", - "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts"], - "exclude": ["./test/**/node/**/*.ts"], + "include": ["src/**/*.ts", "src/**/*.mts", "test/**/*.spec.ts"], + "exclude": ["test/**/node/**/*.ts"], "compilerOptions": { "outDir": "./dist-test/browser", "rootDir": ".", diff --git a/sdk/mongocluster/arm-mongocluster/tsconfig.json b/sdk/mongocluster/arm-mongocluster/tsconfig.json index 6977ffdba11d..72266609583d 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", + "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..8d6b055f01b3 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: 0246c93dcd1ed9c531790733ca709bae74cf5086 +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..da68c1d231aa 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts @@ -33,6 +33,6 @@ export default defineConfig({ reportsDirectory: "coverage-browser", }, testTimeout: 1200000, - hookTimeout: 1200000 + hookTimeout: 1200000, }, }); diff --git a/sdk/mongocluster/arm-mongocluster/vitest.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.config.ts index 11fcb98a3ab4..2cf5d0e02c2e 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.config.ts @@ -29,6 +29,6 @@ export default defineConfig({ reportsDirectory: "coverage", }, testTimeout: 1200000, - hookTimeout: 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