From f750d1d1193296bcff1b8b10daa4b9e90017c2c5 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:48:39 +0800 Subject: [PATCH 01/23] [mgmt] mongocluster release --- common/config/rush/pnpm-lock.yaml | 58 +- rush.json | 9 +- .../arm-mongocluster/CHANGELOG.md | 5 + sdk/mongocluster/arm-mongocluster/LICENSE | 21 + sdk/mongocluster/arm-mongocluster/README.md | 109 ++ sdk/mongocluster/arm-mongocluster/_meta.json | 8 + .../arm-mongocluster/api-extractor.json | 31 + sdk/mongocluster/arm-mongocluster/assets.json | 6 + .../arm-mongocluster/package.json | 118 ++ .../review/arm-mongocluster.api.md | 661 +++++++++ sdk/mongocluster/arm-mongocluster/sample.env | 4 + .../firewallRulesCreateOrUpdateSample.ts | 52 + .../samples-dev/firewallRulesDeleteSample.ts | 45 + .../samples-dev/firewallRulesGetSample.ts | 45 + .../firewallRulesListByMongoClusterSample.ts | 46 + ...ongoClustersCheckNameAvailabilitySample.ts | 73 + .../mongoClustersCreateOrUpdateSample.ts | 99 ++ .../samples-dev/mongoClustersDeleteSample.ts | 43 + .../samples-dev/mongoClustersGetSample.ts | 43 + .../mongoClustersListByResourceGroupSample.ts | 44 + ...ongoClustersListConnectionStringsSample.ts | 43 + .../samples-dev/mongoClustersListSample.ts | 40 + .../samples-dev/mongoClustersUpdateSample.ts | 118 ++ .../samples-dev/operationsListSample.ts | 40 + .../privateEndpointConnectionsCreateSample.ts | 57 + .../privateEndpointConnectionsDeleteSample.ts | 46 + .../privateEndpointConnectionsGetSample.ts | 46 + ...ointConnectionsListByMongoClusterSample.ts | 46 + .../privateLinksListByMongoClusterSample.ts | 46 + .../samples/v1-beta/javascript/README.md | 84 ++ .../firewallRulesCreateOrUpdateSample.js | 45 + .../javascript/firewallRulesDeleteSample.js | 41 + .../javascript/firewallRulesGetSample.js | 41 + .../firewallRulesListByMongoClusterSample.js | 42 + ...ongoClustersCheckNameAvailabilitySample.js | 60 + .../mongoClustersCreateOrUpdateSample.js | 90 ++ .../javascript/mongoClustersDeleteSample.js | 36 + .../javascript/mongoClustersGetSample.js | 36 + .../mongoClustersListByResourceGroupSample.js | 38 + ...ongoClustersListConnectionStringsSample.js | 39 + .../javascript/mongoClustersListSample.js | 37 + .../javascript/mongoClustersUpdateSample.js | 107 ++ .../javascript/operationsListSample.js | 37 + .../samples/v1-beta/javascript/package.json | 32 + .../privateEndpointConnectionsCreateSample.js | 50 + .../privateEndpointConnectionsDeleteSample.js | 41 + .../privateEndpointConnectionsGetSample.js | 41 + ...ointConnectionsListByMongoClusterSample.js | 42 + .../privateLinksListByMongoClusterSample.js | 42 + .../samples/v1-beta/javascript/sample.env | 4 + .../samples/v1-beta/typescript/README.md | 97 ++ .../samples/v1-beta/typescript/package.json | 41 + .../samples/v1-beta/typescript/sample.env | 4 + .../src/firewallRulesCreateOrUpdateSample.ts | 52 + .../src/firewallRulesDeleteSample.ts | 45 + .../typescript/src/firewallRulesGetSample.ts | 45 + .../firewallRulesListByMongoClusterSample.ts | 46 + ...ongoClustersCheckNameAvailabilitySample.ts | 73 + .../src/mongoClustersCreateOrUpdateSample.ts | 99 ++ .../src/mongoClustersDeleteSample.ts | 43 + .../typescript/src/mongoClustersGetSample.ts | 43 + .../mongoClustersListByResourceGroupSample.ts | 44 + ...ongoClustersListConnectionStringsSample.ts | 43 + .../typescript/src/mongoClustersListSample.ts | 40 + .../src/mongoClustersUpdateSample.ts | 118 ++ .../typescript/src/operationsListSample.ts | 40 + .../privateEndpointConnectionsCreateSample.ts | 57 + .../privateEndpointConnectionsDeleteSample.ts | 46 + .../privateEndpointConnectionsGetSample.ts | 46 + ...ointConnectionsListByMongoClusterSample.ts | 46 + .../privateLinksListByMongoClusterSample.ts | 46 + .../samples/v1-beta/typescript/tsconfig.json | 17 + .../arm-mongocluster/src/index.ts | 13 + .../arm-mongocluster/src/lroImpl.ts | 42 + .../arm-mongocluster/src/models/index.ts | 962 ++++++++++++++ .../arm-mongocluster/src/models/mappers.ts | 1184 +++++++++++++++++ .../arm-mongocluster/src/models/parameters.ts | 188 +++ .../src/mongoClusterManagementClient.ts | 161 +++ .../src/operations/firewallRules.ts | 519 ++++++++ .../arm-mongocluster/src/operations/index.ts | 13 + .../src/operations/mongoClusters.ts | 812 +++++++++++ .../src/operations/operations.ts | 149 +++ .../operations/privateEndpointConnections.ts | 536 ++++++++ .../src/operations/privateLinks.ts | 201 +++ .../src/operationsInterfaces/firewallRules.ts | 115 ++ .../src/operationsInterfaces/index.ts | 13 + .../src/operationsInterfaces/mongoClusters.ts | 177 +++ .../src/operationsInterfaces/operations.ts | 22 + .../privateEndpointConnections.ts | 120 ++ .../src/operationsInterfaces/privateLinks.ts | 29 + .../arm-mongocluster/src/pagingHelper.ts | 39 + .../test/mongocluster_operations_test.spec.ts | 112 ++ .../arm-mongocluster/tsconfig.json | 33 + sdk/mongocluster/ci.mgmt.yml | 38 + 94 files changed, 9582 insertions(+), 14 deletions(-) create mode 100644 sdk/mongocluster/arm-mongocluster/CHANGELOG.md create mode 100644 sdk/mongocluster/arm-mongocluster/LICENSE create mode 100644 sdk/mongocluster/arm-mongocluster/README.md create mode 100644 sdk/mongocluster/arm-mongocluster/_meta.json create mode 100644 sdk/mongocluster/arm-mongocluster/api-extractor.json create mode 100644 sdk/mongocluster/arm-mongocluster/assets.json create mode 100644 sdk/mongocluster/arm-mongocluster/package.json create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/sample.env create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesCreateOrUpdateSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesDeleteSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesGetSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesListByMongoClusterSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCheckNameAvailabilitySample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCreateOrUpdateSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersDeleteSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersGetSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListByResourceGroupSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListConnectionStringsSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersUpdateSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/operationsListSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsCreateSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsDeleteSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsGetSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsListByMongoClusterSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateLinksListByMongoClusterSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/README.md create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesCreateOrUpdateSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersUpdateSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/package.json create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.js create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/sample.env create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/README.md create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/package.json create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/sample.env create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersUpdateSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.ts create mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/tsconfig.json create mode 100644 sdk/mongocluster/arm-mongocluster/src/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/lroImpl.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/models/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/models/mappers.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/models/parameters.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/firewallRules.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/mongoClusters.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/operations.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/privateEndpointConnections.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/privateLinks.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/firewallRules.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/mongoClusters.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/operations.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateEndpointConnections.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateLinks.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/pagingHelper.ts create mode 100644 sdk/mongocluster/arm-mongocluster/test/mongocluster_operations_test.spec.ts create mode 100644 sdk/mongocluster/arm-mongocluster/tsconfig.json create mode 100644 sdk/mongocluster/ci.mgmt.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index f5c4bc768880..38c842d2e1dc 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -470,6 +470,9 @@ dependencies: '@rush-temp/arm-mobilenetwork': specifier: file:./projects/arm-mobilenetwork.tgz version: file:projects/arm-mobilenetwork.tgz + '@rush-temp/arm-mongocluster': + specifier: file:./projects/arm-mongocluster.tgz + version: file:projects/arm-mongocluster.tgz '@rush-temp/arm-monitor': specifier: file:./projects/arm-monitor.tgz version: file:projects/arm-monitor.tgz @@ -3344,7 +3347,7 @@ packages: resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==} dependencies: '@types/connect': 3.4.38 - '@types/node': 18.19.33 + '@types/node': 20.10.8 dev: false /@types/bunyan@1.8.9: @@ -3372,7 +3375,7 @@ packages: /@types/connect@3.4.38: resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} dependencies: - '@types/node': 18.19.33 + '@types/node': 20.10.8 dev: false /@types/cookie@0.4.1: @@ -3382,7 +3385,7 @@ packages: /@types/cors@2.8.17: resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==} dependencies: - '@types/node': 18.19.33 + '@types/node': 20.10.8 dev: false /@types/debug@4.1.12: @@ -3421,7 +3424,7 @@ packages: /@types/express-serve-static-core@4.19.0: resolution: {integrity: sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==} dependencies: - '@types/node': 18.19.33 + '@types/node': 20.10.8 '@types/qs': 6.9.15 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -3449,7 +3452,7 @@ packages: resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 18.19.33 + '@types/node': 20.10.8 dev: false /@types/fs-extra@8.1.5: @@ -3492,7 +3495,7 @@ packages: /@types/jsonfile@6.1.4: resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} dependencies: - '@types/node': 18.19.33 + '@types/node': 20.10.8 dev: false /@types/jsonwebtoken@9.0.6: @@ -3557,7 +3560,7 @@ packages: /@types/node-fetch@2.6.11: resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} dependencies: - '@types/node': 18.19.33 + '@types/node': 20.10.8 form-data: 4.0.0 dev: false @@ -3606,7 +3609,7 @@ packages: /@types/readdir-glob@1.1.5: resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==} dependencies: - '@types/node': 18.19.33 + '@types/node': 20.10.8 dev: false /@types/resolve@1.20.2: @@ -3632,7 +3635,7 @@ packages: resolution: {integrity: sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==} dependencies: '@types/http-errors': 2.0.4 - '@types/node': 18.19.33 + '@types/node': 20.10.8 '@types/send': 0.17.4 dev: false @@ -3673,7 +3676,7 @@ packages: /@types/tunnel@0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 18.19.33 + '@types/node': 20.10.8 dev: false /@types/underscore@1.11.15: @@ -3714,7 +3717,7 @@ packages: resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} requiresBuild: true dependencies: - '@types/node': 18.19.33 + '@types/node': 20.10.8 dev: false optional: true @@ -5483,7 +5486,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.17 - '@types/node': 18.19.33 + '@types/node': 20.10.8 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -15931,6 +15934,37 @@ packages: - supports-color dev: false + file:projects/arm-mongocluster.tgz: + resolution: {integrity: sha512-vNCbH+dzwEtIlgZEB0skAaufMggHpU1dkfowC3M0rxKAYm08e0BLJiQNxisSOtMfhEsmZc0ibuEv+fJ3fekurg==, tarball: file:projects/arm-mongocluster.tgz} + name: '@rush-temp/arm-mongocluster' + version: 0.0.0 + dependencies: + '@azure-tools/test-credential': 1.1.0 + '@azure-tools/test-recorder': 3.5.0 + '@azure/abort-controller': 1.1.0 + '@azure/core-lro': 2.7.2 + '@azure/identity': 4.2.0 + '@microsoft/api-extractor': 7.46.2(@types/node@18.19.33) + '@types/chai': 4.3.16 + '@types/mocha': 10.0.6 + '@types/node': 18.19.33 + chai: 4.3.10 + cross-env: 7.0.3 + dotenv: 16.4.5 + mkdirp: 3.0.1 + mocha: 10.4.0 + rimraf: 5.0.7 + ts-node: 10.9.2(@types/node@18.19.33)(typescript@5.4.5) + tslib: 2.6.2 + tsx: 4.11.2 + typescript: 5.4.5 + uglify-js: 3.17.4 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/arm-monitor-profile-2020-09-01-hybrid.tgz: resolution: {integrity: sha512-gYGqHxDXms9/ZY+T2PYwVCru7G3Cnqsx8Eo/GBLYU+LGJog0rDGzxap1krGfbahuVYASdQUSkRXHb2iqAfOBsA==, tarball: file:projects/arm-monitor-profile-2020-09-01-hybrid.tgz} name: '@rush-temp/arm-monitor-profile-2020-09-01-hybrid' diff --git a/rush.json b/rush.json index 49a830a989b9..1445cbaa8b46 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ { + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -2221,6 +2221,11 @@ "packageName": "@azure/arm-oracledatabase", "projectFolder": "sdk/oracledatabase/arm-oracledatabase", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-mongocluster", + "projectFolder": "sdk/mongocluster/arm-mongocluster", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md new file mode 100644 index 000000000000..59b2689760ec --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2024-06-06) + +The package of @azure/arm-mongocluster is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/mongocluster/arm-mongocluster/LICENSE b/sdk/mongocluster/arm-mongocluster/LICENSE new file mode 100644 index 000000000000..7d5934740965 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/README.md b/sdk/mongocluster/arm-mongocluster/README.md new file mode 100644 index 000000000000..6a44bd447e4e --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/README.md @@ -0,0 +1,109 @@ +# Azure MongoClusterManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MongoClusterManagement 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. + +[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) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-mongocluster` package + +Install the Azure MongoClusterManagement client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-mongocluster +``` + +### Create and authenticate a `MongoClusterManagementClient` + +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]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +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 { 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); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new MongoClusterManagementClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### MongoClusterManagementClient + +`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. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmongocluster%2Farm-mongocluster%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/mongocluster/arm-mongocluster/_meta.json b/sdk/mongocluster/arm-mongocluster/_meta.json new file mode 100644 index 000000000000..9f1c6141ae95 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "f98d676317c7ff430241ce16ba8d99142be3581d", + "readme": "specification/mongocluster/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\mongocluster\\resource-manager\\readme.md --use=@autorest/typescript@6.0.23 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.9", + "use": "@autorest/typescript@6.0.23" +} \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/api-extractor.json b/sdk/mongocluster/arm-mongocluster/api-extractor.json new file mode 100644 index 000000000000..b4e27a27969b --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-mongocluster.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/assets.json b/sdk/mongocluster/arm-mongocluster/assets.json new file mode 100644 index 000000000000..dff740fa0715 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "js", + "TagPrefix": "js/mongocluster/arm-mongocluster", + "Tag": "js/mongocluster/arm-mongocluster_6ce9a672f5" +} diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json new file mode 100644 index 000000000000..4757c99d08d8 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/package.json @@ -0,0 +1,118 @@ +{ + "name": "@azure/arm-mongocluster", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for MongoClusterManagementClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.14.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-mongocluster.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", + "uglify-js": "^3.4.9", + "rimraf": "^5.0.0", + "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/identity": "^4.0.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.1.0", + "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "tsx": "^4.7.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^18.0.0", + "ts-node": "^10.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "dev-tool run extract-api", + "lint": "echo skipped", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 4800000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/mongoClusterManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mongocluster/arm-mongocluster", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-mongocluster?view=azure-node-preview" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md new file mode 100644 index 000000000000..9ef828bc0874 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md @@ -0,0 +1,661 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; + +// @public +export type ActionType = string; + +// @public +export interface AzureResourceManagerPrivateEndpointConnection extends ProxyResource { + properties?: PrivateEndpointConnectionProperties; +} + +// @public +export type CheckNameAvailabilityReason = string; + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: CheckNameAvailabilityReason; +} + +// @public +export interface ConnectionString { + readonly connectionString?: string; + readonly description?: string; +} + +// @public +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; +} + +// @public +export interface FirewallRuleListResult { + nextLink?: string; + value: FirewallRule[]; +} + +// @public +export interface FirewallRuleProperties { + endIpAddress: string; + readonly provisioningState?: ProvisioningState; + startIpAddress: string; +} + +// @public +export interface FirewallRules { + beginCreateOrUpdate(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams): Promise, FirewallRulesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): Promise, FirewallRulesDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): Promise; + get(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; + listByMongoCluster(resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface FirewallRulesCreateOrUpdateHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface FirewallRulesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type FirewallRulesCreateOrUpdateResponse = FirewallRule; + +// @public +export interface FirewallRulesDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface FirewallRulesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type FirewallRulesDeleteResponse = FirewallRulesDeleteHeaders; + +// @public +export interface FirewallRulesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FirewallRulesGetResponse = FirewallRule; + +// @public +export interface FirewallRulesListByMongoClusterNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FirewallRulesListByMongoClusterNextResponse = FirewallRuleListResult; + +// @public +export interface FirewallRulesListByMongoClusterOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FirewallRulesListByMongoClusterResponse = FirewallRuleListResult; + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCheckNameAvailabilityReason { + AlreadyExists = "AlreadyExists", + Invalid = "Invalid" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownCreateMode { + Default = "Default", + PointInTimeRestore = "PointInTimeRestore" +} + +// @public +export enum KnownMongoClusterStatus { + Dropping = "Dropping", + Provisioning = "Provisioning", + Ready = "Ready", + Starting = "Starting", + Stopped = "Stopped", + Stopping = "Stopping", + Updating = "Updating" +} + +// @public +export enum KnownNodeKind { + Shard = "Shard" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownPrivateEndpointConnectionProvisioningState { + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownPrivateEndpointServiceConnectionStatus { + Approved = "Approved", + Pending = "Pending", + Rejected = "Rejected" +} + +// @public +export enum KnownProvisioningState { + Canceled = "Canceled", + Dropping = "Dropping", + Failed = "Failed", + InProgress = "InProgress", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownPublicNetworkAccess { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export interface ListConnectionStringsResult { + readonly connectionStrings?: ConnectionString[]; +} + +// @public +export interface MongoCluster extends TrackedResource { + properties?: MongoClusterProperties; +} + +// @public +export interface MongoClusterListResult { + nextLink?: string; + value: MongoCluster[]; +} + +// @public (undocumented) +export class MongoClusterManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MongoClusterManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + firewallRules: FirewallRules; + // (undocumented) + mongoClusters: MongoClusters; + // (undocumented) + operations: Operations; + // (undocumented) + privateEndpointConnections: PrivateEndpointConnections; + // (undocumented) + privateLinks: PrivateLinks; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface MongoClusterManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface MongoClusterProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + readonly clusterStatus?: MongoClusterStatus; + readonly connectionString?: string; + createMode?: CreateMode; + readonly earliestRestoreTime?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + readonly privateEndpointConnections?: AzureResourceManagerPrivateEndpointConnection[]; + readonly provisioningState?: ProvisioningState; + publicNetworkAccess?: PublicNetworkAccess; + restoreParameters?: MongoClusterRestoreParameters; + serverVersion?: string; +} + +// @public +export interface MongoClusterRestoreParameters { + pointInTimeUTC?: Date; + sourceResourceId?: string; +} + +// @public +export interface MongoClusters { + beginCreateOrUpdate(resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams): Promise, MongoClustersCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): Promise, MongoClustersDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams): Promise, MongoClustersUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams): Promise; + checkNameAvailability(location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams): Promise; + get(resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): Promise; + list(options?: MongoClustersListOptionalParams): PagedAsyncIterableIterator; + listByResourceGroup(resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listConnectionStrings(resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): Promise; +} + +// @public +export interface MongoClustersCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MongoClustersCheckNameAvailabilityResponse = CheckNameAvailabilityResponse; + +// @public +export interface MongoClustersCreateOrUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface MongoClustersCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MongoClustersCreateOrUpdateResponse = MongoCluster; + +// @public +export interface MongoClustersDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface MongoClustersDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MongoClustersDeleteResponse = MongoClustersDeleteHeaders; + +// @public +export interface MongoClustersGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MongoClustersGetResponse = MongoCluster; + +// @public +export interface MongoClustersListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MongoClustersListByResourceGroupNextResponse = MongoClusterListResult; + +// @public +export interface MongoClustersListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MongoClustersListByResourceGroupResponse = MongoClusterListResult; + +// @public +export interface MongoClustersListConnectionStringsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MongoClustersListConnectionStringsResponse = ListConnectionStringsResult; + +// @public +export interface MongoClustersListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MongoClustersListNextResponse = MongoClusterListResult; + +// @public +export interface MongoClustersListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MongoClustersListResponse = MongoClusterListResult; + +// @public +export type MongoClusterStatus = string; + +// @public +export interface MongoClustersUpdateHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface MongoClustersUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MongoClustersUpdateResponse = MongoCluster; + +// @public +export interface MongoClusterUpdate { + properties?: MongoClusterUpdateProperties; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface MongoClusterUpdateProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + publicNetworkAccess?: PublicNetworkAccess; + serverVersion?: string; +} + +// @public +export interface NodeGroupProperties { + diskSizeGB?: number; + enableHa?: boolean; + sku?: string; +} + +// @public +export interface NodeGroupSpec { + diskSizeGB?: number; + enableHa?: boolean; + kind?: NodeKind; + nodeCount?: number; + sku?: string; +} + +// @public +export type NodeKind = string; + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationListResult { + readonly nextLink?: string; + readonly value?: Operation[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export type Origin = string; + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export interface PrivateEndpointConnectionProperties { + readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export type PrivateEndpointConnectionProvisioningState = string; + +// @public +export interface PrivateEndpointConnectionResource extends ProxyResource { + properties?: PrivateEndpointConnectionProperties; +} + +// @public +export interface PrivateEndpointConnectionResourceListResult { + nextLink?: string; + value: PrivateEndpointConnectionResource[]; +} + +// @public +export interface PrivateEndpointConnections { + beginCreate(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams): Promise, PrivateEndpointConnectionsCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, PrivateEndpointConnectionsDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise; + get(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; + listByMongoCluster(resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface PrivateEndpointConnectionsCreateHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface PrivateEndpointConnectionsCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type PrivateEndpointConnectionsCreateResponse = PrivateEndpointConnectionResource; + +// @public +export interface PrivateEndpointConnectionsDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface PrivateEndpointConnectionsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type PrivateEndpointConnectionsDeleteResponse = PrivateEndpointConnectionsDeleteHeaders; + +// @public +export interface PrivateEndpointConnectionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnectionResource; + +// @public +export interface PrivateEndpointConnectionsListByMongoClusterNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateEndpointConnectionsListByMongoClusterNextResponse = PrivateEndpointConnectionResourceListResult; + +// @public +export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateEndpointConnectionsListByMongoClusterResponse = PrivateEndpointConnectionResourceListResult; + +// @public +export type PrivateEndpointServiceConnectionStatus = string; + +// @public +export interface PrivateLinkResource extends ProxyResource { + properties?: PrivateLinkResourceProperties; +} + +// @public +export interface PrivateLinkResourceListResult { + nextLink?: string; + value: PrivateLinkResource[]; +} + +// @public +export interface PrivateLinkResourceProperties { + readonly groupId?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; +} + +// @public +export interface PrivateLinks { + listByMongoCluster(resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateEndpointServiceConnectionStatus; +} + +// @public +export interface PrivateLinksListByMongoClusterNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateLinksListByMongoClusterNextResponse = PrivateLinkResourceListResult; + +// @public +export interface PrivateLinksListByMongoClusterOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateLinksListByMongoClusterResponse = PrivateLinkResourceListResult; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type PublicNetworkAccess = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: { + [propertyName: string]: string; + }; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/sample.env b/sdk/mongocluster/arm-mongocluster/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ 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 new file mode 100644 index 000000000000..7e774a982c6a --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesCreateOrUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + FirewallRule, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json + */ +async function createsAFirewallRuleOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const firewallRuleName = "rule1"; + const resource: FirewallRule = { + properties: { endIpAddress: "255.255.255.255", startIpAddress: "0.0.0.0" }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.firewallRules.beginCreateOrUpdateAndWait( + resourceGroupName, + mongoClusterName, + firewallRuleName, + resource, + ); + 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 new file mode 100644 index 000000000000..8cc184a2867f --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a mongo cluster firewall rule. + * + * @summary Deletes a mongo cluster firewall rule. + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json + */ +async function deletesAFirewallRuleOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const firewallRuleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.firewallRules.beginDeleteAndWait( + resourceGroupName, + mongoClusterName, + firewallRuleName, + ); + console.log(result); +} + +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 new file mode 100644 index 000000000000..6f5522e4bdc3 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json + */ +async function getsAFirewallRuleOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const firewallRuleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.firewallRules.get( + resourceGroupName, + mongoClusterName, + firewallRuleName, + ); + 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 new file mode 100644 index 000000000000..1f024bdfd870 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesListByMongoClusterSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json + */ +async function listTheFirewallRulesOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.firewallRules.listByMongoCluster( + resourceGroupName, + mongoClusterName, + )) { + 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 new file mode 100644 index 000000000000..8f1824f8cd28 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCheckNameAvailabilitySample.ts @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CheckNameAvailabilityRequest, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability.json + */ +async function checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const location = "westus2"; + const body: CheckNameAvailabilityRequest = { + name: "newmongocluster", + type: "Microsoft.DocumentDB/mongoClusters", + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.checkNameAvailability( + location, + body, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability_AlreadyExists.json + */ +async function checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const location = "westus2"; + const body: CheckNameAvailabilityRequest = { + name: "existingmongocluster", + type: "Microsoft.DocumentDB/mongoClusters", + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.checkNameAvailability( + location, + body, + ); + 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 new file mode 100644 index 000000000000..3394ecc21bcd --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCreateOrUpdateSample.ts @@ -0,0 +1,99 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MongoCluster, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json + */ +async function createsAMongoClusterResourceFromAPointInTimeRestore() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const resource: MongoCluster = { + 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", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + mongoClusterName, + resource, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Create.json + */ +async function createsANewMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const resource: MongoCluster = { + location: "westus2", + properties: { + administratorLogin: "mongoAdmin", + administratorLoginPassword: "password", + nodeGroupSpecs: [ + { + diskSizeGB: 128, + enableHa: true, + kind: "Shard", + nodeCount: 1, + sku: "M30", + }, + ], + serverVersion: "5.0", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + mongoClusterName, + resource, + ); + console.log(result); +} + +async function main() { + createsAMongoClusterResourceFromAPointInTimeRestore(); + createsANewMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersDeleteSample.ts new file mode 100644 index 000000000000..fe5d3e06e2f3 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a mongo cluster. + * + * @summary Deletes a mongo cluster. + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json + */ +async function deletesAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginDeleteAndWait( + resourceGroupName, + mongoClusterName, + ); + console.log(result); +} + +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 new file mode 100644 index 000000000000..98324242105b --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersGetSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets information about a mongo cluster. + * + * @summary Gets information about a mongo cluster. + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json + */ +async function getsAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.get( + resourceGroupName, + mongoClusterName, + ); + 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 new file mode 100644 index 000000000000..3ea27e3f6d72 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListByResourceGroupSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListByResourceGroup.json + */ +async function listsTheMongoClusterResourcesInAResourceGroup() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.mongoClusters.listByResourceGroup( + resourceGroupName, + )) { + 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 new file mode 100644 index 000000000000..636133e8155b --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListConnectionStringsSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json + */ +async function listTheAvailableConnectionStringsForTheMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.listConnectionStrings( + resourceGroupName, + mongoClusterName, + ); + 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 new file mode 100644 index 000000000000..6c5133e30a7c --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.json + */ +async function listsTheMongoClusterResourcesInASubscription() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const credential = new DefaultAzureCredential(); + 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/mongoClustersUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersUpdateSample.ts new file mode 100644 index 000000000000..84535a01b292 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersUpdateSample.ts @@ -0,0 +1,118 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MongoClusterUpdate, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json + */ +async function disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const properties: MongoClusterUpdate = { + properties: { publicNetworkAccess: "Disabled" }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginUpdateAndWait( + resourceGroupName, + mongoClusterName, + properties, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Update.json + */ +async function updatesAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const properties: MongoClusterUpdate = { + properties: { + administratorLogin: "mongoAdmin", + administratorLoginPassword: "password", + nodeGroupSpecs: [ + { + diskSizeGB: 256, + enableHa: true, + kind: "Shard", + nodeCount: 1, + sku: "M50", + }, + ], + publicNetworkAccess: "Enabled", + serverVersion: "5.0", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginUpdateAndWait( + resourceGroupName, + mongoClusterName, + properties, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchDiskSize.json + */ +async function updatesTheDiskSizeOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const properties: MongoClusterUpdate = { + properties: { nodeGroupSpecs: [{ diskSizeGB: 256, kind: "Shard" }] }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginUpdateAndWait( + resourceGroupName, + mongoClusterName, + properties, + ); + console.log(result); +} + +async function main() { + disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection(); + updatesAMongoClusterResource(); + updatesTheDiskSizeOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples-dev/operationsListSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..47b012b2e0a5 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + 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 new file mode 100644 index 000000000000..24b4f0372f45 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsCreateSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + PrivateEndpointConnectionResource, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create a Private endpoint connection + * + * @summary Create a Private endpoint connection + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json + */ +async function approvesAPrivateEndpointConnectionOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const privateEndpointConnectionName = "pecTest"; + const resource: PrivateEndpointConnectionResource = { + properties: { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginCreateAndWait( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + resource, + ); + 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 new file mode 100644 index 000000000000..e12539c18b1d --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsDeleteSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete the private endpoint connection + * + * @summary Delete the private endpoint connection + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json + */ +async function deleteAPrivateEndpointConnectionOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const privateEndpointConnectionName = + "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + ); + console.log(result); +} + +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 new file mode 100644 index 000000000000..62815d50b848 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsGetSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a specific private connection + * + * @summary Get a specific private connection + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json + */ +async function getAPrivateEndpointConnectionOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const privateEndpointConnectionName = + "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + ); + 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 new file mode 100644 index 000000000000..207827dd8e93 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsListByMongoClusterSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List existing private connections + * + * @summary List existing private connections + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json + */ +async function listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByMongoCluster( + resourceGroupName, + mongoClusterName, + )) { + 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 new file mode 100644 index 000000000000..538ac7a25abb --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples-dev/privateLinksListByMongoClusterSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to list private links on the given resource + * + * @summary list private links on the given resource + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json + */ +async function listsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinks.listByMongoCluster( + resourceGroupName, + mongoClusterName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsThePrivateLinkResourcesAvailableOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/README.md b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..82a958c28c69 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/README.md @@ -0,0 +1,84 @@ +# client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [firewallRulesCreateOrUpdateSample.js][firewallrulescreateorupdatesample] | Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json | +| [firewallRulesDeleteSample.js][firewallrulesdeletesample] | Deletes a mongo cluster firewall rule. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json | +| [firewallRulesGetSample.js][firewallrulesgetsample] | Gets information about a mongo cluster firewall rule. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json | +| [firewallRulesListByMongoClusterSample.js][firewallruleslistbymongoclustersample] | List all the firewall rules in a given mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json | +| [mongoClustersCheckNameAvailabilitySample.js][mongoclusterschecknameavailabilitysample] | Check if mongo cluster name is available for use. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json | +| [mongoClustersDeleteSample.js][mongoclustersdeletesample] | Deletes a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json | +| [mongoClustersGetSample.js][mongoclustersgetsample] | Gets information about a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json | +| [mongoClustersListByResourceGroupSample.js][mongoclusterslistbyresourcegroupsample] | List all the mongo clusters in a given resource group. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json | +| [mongoClustersListSample.js][mongoclusterslistsample] | List all the mongo clusters in a given subscription. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json | +| [operationsListSample.js][operationslistsample] | List the operations for the provider x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json | +| [privateEndpointConnectionsCreateSample.js][privateendpointconnectionscreatesample] | Create a Private endpoint connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json | +| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | Delete the private endpoint connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json | +| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | Get a specific private connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json | +| [privateEndpointConnectionsListByMongoClusterSample.js][privateendpointconnectionslistbymongoclustersample] | List existing private connections x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json | +| [privateLinksListByMongoClusterSample.js][privatelinkslistbymongoclustersample] | list private links on the given resource x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node firewallRulesCreateOrUpdateSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env MONGOCLUSTER_SUBSCRIPTION_ID="" MONGOCLUSTER_RESOURCE_GROUP="" 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-beta/javascript/firewallRulesCreateOrUpdateSample.js +[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js +[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js +[firewallruleslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js +[mongoclusterschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js +[mongoclusterscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js +[mongoclustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js +[mongoclustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js +[mongoclusterslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js +[mongoclusterslistconnectionstringssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js +[mongoclusterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js +[mongoclustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersUpdateSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js +[privateendpointconnectionscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js +[privateendpointconnectionslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js +[privatelinkslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.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-beta/javascript/firewallRulesCreateOrUpdateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..a440437ed92c --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesCreateOrUpdateSample.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json + */ +async function createsAFirewallRuleOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const firewallRuleName = "rule1"; + const resource = { + properties: { endIpAddress: "255.255.255.255", startIpAddress: "0.0.0.0" }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.firewallRules.beginCreateOrUpdateAndWait( + resourceGroupName, + mongoClusterName, + firewallRuleName, + resource, + ); + console.log(result); +} + +async function main() { + createsAFirewallRuleOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js new file mode 100644 index 000000000000..5a7aadc146d7 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a mongo cluster firewall rule. + * + * @summary Deletes a mongo cluster firewall rule. + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json + */ +async function deletesAFirewallRuleOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const firewallRuleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.firewallRules.beginDeleteAndWait( + resourceGroupName, + mongoClusterName, + firewallRuleName, + ); + console.log(result); +} + +async function main() { + deletesAFirewallRuleOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js new file mode 100644 index 000000000000..9121571b8014 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json + */ +async function getsAFirewallRuleOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const firewallRuleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.firewallRules.get( + resourceGroupName, + mongoClusterName, + firewallRuleName, + ); + console.log(result); +} + +async function main() { + getsAFirewallRuleOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js new file mode 100644 index 000000000000..4ef0f6bab354 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json + */ +async function listTheFirewallRulesOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.firewallRules.listByMongoCluster( + resourceGroupName, + mongoClusterName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listTheFirewallRulesOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..7fe909e4e311 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability.json + */ +async function checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const location = "westus2"; + const body = { + name: "newmongocluster", + type: "Microsoft.DocumentDB/mongoClusters", + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.checkNameAvailability(location, body); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability_AlreadyExists.json + */ +async function checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const location = "westus2"; + const body = { + name: "existingmongocluster", + type: "Microsoft.DocumentDB/mongoClusters", + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.checkNameAvailability(location, body); + console.log(result); +} + +async function main() { + checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse(); + checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js new file mode 100644 index 000000000000..81d7263e8afe --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js @@ -0,0 +1,90 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json + */ +async function createsAMongoClusterResourceFromAPointInTimeRestore() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const resource = { + 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", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + mongoClusterName, + resource, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Create.json + */ +async function createsANewMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const resource = { + location: "westus2", + properties: { + administratorLogin: "mongoAdmin", + administratorLoginPassword: "password", + nodeGroupSpecs: [ + { + diskSizeGB: 128, + enableHa: true, + kind: "Shard", + nodeCount: 1, + sku: "M30", + }, + ], + serverVersion: "5.0", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + mongoClusterName, + resource, + ); + console.log(result); +} + +async function main() { + createsAMongoClusterResourceFromAPointInTimeRestore(); + createsANewMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js new file mode 100644 index 000000000000..f4d3c11d4183 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a mongo cluster. + * + * @summary Deletes a mongo cluster. + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json + */ +async function deletesAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginDeleteAndWait(resourceGroupName, mongoClusterName); + console.log(result); +} + +async function main() { + deletesAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js new file mode 100644 index 000000000000..788ce24b4962 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets information about a mongo cluster. + * + * @summary Gets information about a mongo cluster. + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json + */ +async function getsAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.get(resourceGroupName, mongoClusterName); + console.log(result); +} + +async function main() { + getsAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js new file mode 100644 index 000000000000..c9abca9ac2ad --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListByResourceGroup.json + */ +async function listsTheMongoClusterResourcesInAResourceGroup() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.mongoClusters.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsTheMongoClusterResourcesInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js new file mode 100644 index 000000000000..f4f1a7f9364e --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json + */ +async function listTheAvailableConnectionStringsForTheMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.listConnectionStrings( + resourceGroupName, + mongoClusterName, + ); + console.log(result); +} + +async function main() { + listTheAvailableConnectionStringsForTheMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js new file mode 100644 index 000000000000..f426237e666c --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.json + */ +async function listsTheMongoClusterResourcesInASubscription() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const credential = new DefaultAzureCredential(); + 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-beta/javascript/mongoClustersUpdateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersUpdateSample.js new file mode 100644 index 000000000000..a61f2cd5d7b6 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersUpdateSample.js @@ -0,0 +1,107 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json + */ +async function disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const properties = { + properties: { publicNetworkAccess: "Disabled" }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginUpdateAndWait( + resourceGroupName, + mongoClusterName, + properties, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Update.json + */ +async function updatesAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const properties = { + properties: { + administratorLogin: "mongoAdmin", + administratorLoginPassword: "password", + nodeGroupSpecs: [ + { + diskSizeGB: 256, + enableHa: true, + kind: "Shard", + nodeCount: 1, + sku: "M50", + }, + ], + publicNetworkAccess: "Enabled", + serverVersion: "5.0", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginUpdateAndWait( + resourceGroupName, + mongoClusterName, + properties, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchDiskSize.json + */ +async function updatesTheDiskSizeOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const properties = { + properties: { nodeGroupSpecs: [{ diskSizeGB: 256, kind: "Shard" }] }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginUpdateAndWait( + resourceGroupName, + mongoClusterName, + properties, + ); + console.log(result); +} + +async function main() { + disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection(); + updatesAMongoClusterResource(); + updatesTheDiskSizeOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..ab9dce7ae27d --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + 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-beta/javascript/package.json b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..763aaef20942 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-mongocluster-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=18.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/mongocluster/arm-mongocluster" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mongocluster/arm-mongocluster", + "dependencies": { + "@azure/arm-mongocluster": "next", + "dotenv": "latest", + "@azure/identity": "^4.0.1" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js new file mode 100644 index 000000000000..643d481edc42 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create a Private endpoint connection + * + * @summary Create a Private endpoint connection + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json + */ +async function approvesAPrivateEndpointConnectionOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const privateEndpointConnectionName = "pecTest"; + const resource = { + properties: { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginCreateAndWait( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + resource, + ); + console.log(result); +} + +async function main() { + approvesAPrivateEndpointConnectionOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js new file mode 100644 index 000000000000..f81ec95f902b --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete the private endpoint connection + * + * @summary Delete the private endpoint connection + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json + */ +async function deleteAPrivateEndpointConnectionOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const privateEndpointConnectionName = "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + ); + console.log(result); +} + +async function main() { + deleteAPrivateEndpointConnectionOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js new file mode 100644 index 000000000000..5ded4e300eb9 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get a specific private connection + * + * @summary Get a specific private connection + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json + */ +async function getAPrivateEndpointConnectionOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const privateEndpointConnectionName = "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + ); + console.log(result); +} + +async function main() { + getAPrivateEndpointConnectionOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js new file mode 100644 index 000000000000..5d0abd64a89a --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List existing private connections + * + * @summary List existing private connections + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json + */ +async function listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByMongoCluster( + resourceGroupName, + mongoClusterName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.js new file mode 100644 index 000000000000..a89badeec4e6 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to list private links on the given resource + * + * @summary list private links on the given resource + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json + */ +async function listsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinks.listByMongoCluster( + resourceGroupName, + mongoClusterName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsThePrivateLinkResourcesAvailableOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/sample.env b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/README.md b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..ac99ab1ef19d --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/README.md @@ -0,0 +1,97 @@ +# client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [firewallRulesCreateOrUpdateSample.ts][firewallrulescreateorupdatesample] | Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json | +| [firewallRulesDeleteSample.ts][firewallrulesdeletesample] | Deletes a mongo cluster firewall rule. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json | +| [firewallRulesGetSample.ts][firewallrulesgetsample] | Gets information about a mongo cluster firewall rule. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json | +| [firewallRulesListByMongoClusterSample.ts][firewallruleslistbymongoclustersample] | List all the firewall rules in a given mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json | +| [mongoClustersCheckNameAvailabilitySample.ts][mongoclusterschecknameavailabilitysample] | Check if mongo cluster name is available for use. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json | +| [mongoClustersDeleteSample.ts][mongoclustersdeletesample] | Deletes a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json | +| [mongoClustersGetSample.ts][mongoclustersgetsample] | Gets information about a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json | +| [mongoClustersListByResourceGroupSample.ts][mongoclusterslistbyresourcegroupsample] | List all the mongo clusters in a given resource group. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json | +| [mongoClustersListSample.ts][mongoclusterslistsample] | List all the mongo clusters in a given subscription. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json | +| [operationsListSample.ts][operationslistsample] | List the operations for the provider x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json | +| [privateEndpointConnectionsCreateSample.ts][privateendpointconnectionscreatesample] | Create a Private endpoint connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json | +| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | Delete the private endpoint connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json | +| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | Get a specific private connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json | +| [privateEndpointConnectionsListByMongoClusterSample.ts][privateendpointconnectionslistbymongoclustersample] | List existing private connections x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json | +| [privateLinksListByMongoClusterSample.ts][privatelinkslistbymongoclustersample] | list private links on the given resource x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/firewallRulesCreateOrUpdateSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env MONGOCLUSTER_SUBSCRIPTION_ID="" MONGOCLUSTER_RESOURCE_GROUP="" 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-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts +[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts +[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts +[firewallruleslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts +[mongoclusterschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts +[mongoclusterscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts +[mongoclustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts +[mongoclustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts +[mongoclusterslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts +[mongoclusterslistconnectionstringssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts +[mongoclusterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts +[mongoclustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersUpdateSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts +[privateendpointconnectionscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateSample.ts +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts +[privateendpointconnectionslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts +[privatelinkslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.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-beta/typescript/package.json b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..2eccd45d4315 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-mongocluster-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=18.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/mongocluster/arm-mongocluster" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mongocluster/arm-mongocluster", + "dependencies": { + "@azure/arm-mongocluster": "next", + "dotenv": "latest", + "@azure/identity": "^4.0.1" + }, + "devDependencies": { + "@types/node": "^18.0.0", + "typescript": "~5.4.5", + "rimraf": "latest" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/sample.env b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..7e774a982c6a --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + FirewallRule, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json + */ +async function createsAFirewallRuleOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const firewallRuleName = "rule1"; + const resource: FirewallRule = { + properties: { endIpAddress: "255.255.255.255", startIpAddress: "0.0.0.0" }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.firewallRules.beginCreateOrUpdateAndWait( + resourceGroupName, + mongoClusterName, + firewallRuleName, + resource, + ); + console.log(result); +} + +async function main() { + createsAFirewallRuleOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts new file mode 100644 index 000000000000..8cc184a2867f --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a mongo cluster firewall rule. + * + * @summary Deletes a mongo cluster firewall rule. + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json + */ +async function deletesAFirewallRuleOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const firewallRuleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.firewallRules.beginDeleteAndWait( + resourceGroupName, + mongoClusterName, + firewallRuleName, + ); + console.log(result); +} + +async function main() { + deletesAFirewallRuleOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts new file mode 100644 index 000000000000..6f5522e4bdc3 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json + */ +async function getsAFirewallRuleOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const firewallRuleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.firewallRules.get( + resourceGroupName, + mongoClusterName, + firewallRuleName, + ); + console.log(result); +} + +async function main() { + getsAFirewallRuleOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts new file mode 100644 index 000000000000..1f024bdfd870 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json + */ +async function listTheFirewallRulesOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.firewallRules.listByMongoCluster( + resourceGroupName, + mongoClusterName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listTheFirewallRulesOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..8f1824f8cd28 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CheckNameAvailabilityRequest, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability.json + */ +async function checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const location = "westus2"; + const body: CheckNameAvailabilityRequest = { + name: "newmongocluster", + type: "Microsoft.DocumentDB/mongoClusters", + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.checkNameAvailability( + location, + body, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability_AlreadyExists.json + */ +async function checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const location = "westus2"; + const body: CheckNameAvailabilityRequest = { + name: "existingmongocluster", + type: "Microsoft.DocumentDB/mongoClusters", + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.checkNameAvailability( + location, + body, + ); + console.log(result); +} + +async function main() { + checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse(); + checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts new file mode 100644 index 000000000000..3394ecc21bcd --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts @@ -0,0 +1,99 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MongoCluster, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json + */ +async function createsAMongoClusterResourceFromAPointInTimeRestore() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const resource: MongoCluster = { + 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", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + mongoClusterName, + resource, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Create.json + */ +async function createsANewMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const resource: MongoCluster = { + location: "westus2", + properties: { + administratorLogin: "mongoAdmin", + administratorLoginPassword: "password", + nodeGroupSpecs: [ + { + diskSizeGB: 128, + enableHa: true, + kind: "Shard", + nodeCount: 1, + sku: "M30", + }, + ], + serverVersion: "5.0", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginCreateOrUpdateAndWait( + resourceGroupName, + mongoClusterName, + resource, + ); + console.log(result); +} + +async function main() { + createsAMongoClusterResourceFromAPointInTimeRestore(); + createsANewMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts new file mode 100644 index 000000000000..fe5d3e06e2f3 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a mongo cluster. + * + * @summary Deletes a mongo cluster. + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json + */ +async function deletesAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginDeleteAndWait( + resourceGroupName, + mongoClusterName, + ); + console.log(result); +} + +async function main() { + deletesAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts new file mode 100644 index 000000000000..98324242105b --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets information about a mongo cluster. + * + * @summary Gets information about a mongo cluster. + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json + */ +async function getsAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.get( + resourceGroupName, + mongoClusterName, + ); + console.log(result); +} + +async function main() { + getsAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts new file mode 100644 index 000000000000..3ea27e3f6d72 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListByResourceGroup.json + */ +async function listsTheMongoClusterResourcesInAResourceGroup() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.mongoClusters.listByResourceGroup( + resourceGroupName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsTheMongoClusterResourcesInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts new file mode 100644 index 000000000000..636133e8155b --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json + */ +async function listTheAvailableConnectionStringsForTheMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.listConnectionStrings( + resourceGroupName, + mongoClusterName, + ); + console.log(result); +} + +async function main() { + listTheAvailableConnectionStringsForTheMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts new file mode 100644 index 000000000000..6c5133e30a7c --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.json + */ +async function listsTheMongoClusterResourcesInASubscription() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const credential = new DefaultAzureCredential(); + 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-beta/typescript/src/mongoClustersUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersUpdateSample.ts new file mode 100644 index 000000000000..84535a01b292 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersUpdateSample.ts @@ -0,0 +1,118 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + MongoClusterUpdate, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json + */ +async function disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const properties: MongoClusterUpdate = { + properties: { publicNetworkAccess: "Disabled" }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginUpdateAndWait( + resourceGroupName, + mongoClusterName, + properties, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Update.json + */ +async function updatesAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const properties: MongoClusterUpdate = { + properties: { + administratorLogin: "mongoAdmin", + administratorLoginPassword: "password", + nodeGroupSpecs: [ + { + diskSizeGB: 256, + enableHa: true, + kind: "Shard", + nodeCount: 1, + sku: "M50", + }, + ], + publicNetworkAccess: "Enabled", + serverVersion: "5.0", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginUpdateAndWait( + resourceGroupName, + mongoClusterName, + properties, + ); + 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchDiskSize.json + */ +async function updatesTheDiskSizeOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; + const mongoClusterName = "myMongoCluster"; + const properties: MongoClusterUpdate = { + properties: { nodeGroupSpecs: [{ diskSizeGB: 256, kind: "Shard" }] }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.mongoClusters.beginUpdateAndWait( + resourceGroupName, + mongoClusterName, + properties, + ); + console.log(result); +} + +async function main() { + disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection(); + updatesAMongoClusterResource(); + updatesTheDiskSizeOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..47b012b2e0a5 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + 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-beta/typescript/src/privateEndpointConnectionsCreateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateSample.ts new file mode 100644 index 000000000000..24b4f0372f45 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateSample.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + PrivateEndpointConnectionResource, + MongoClusterManagementClient, +} from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create a Private endpoint connection + * + * @summary Create a Private endpoint connection + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json + */ +async function approvesAPrivateEndpointConnectionOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const privateEndpointConnectionName = "pecTest"; + const resource: PrivateEndpointConnectionResource = { + properties: { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginCreateAndWait( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + resource, + ); + console.log(result); +} + +async function main() { + approvesAPrivateEndpointConnectionOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts new file mode 100644 index 000000000000..e12539c18b1d --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete the private endpoint connection + * + * @summary Delete the private endpoint connection + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json + */ +async function deleteAPrivateEndpointConnectionOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const privateEndpointConnectionName = + "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + ); + console.log(result); +} + +async function main() { + deleteAPrivateEndpointConnectionOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts new file mode 100644 index 000000000000..62815d50b848 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get a specific private connection + * + * @summary Get a specific private connection + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json + */ +async function getAPrivateEndpointConnectionOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const privateEndpointConnectionName = + "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + ); + console.log(result); +} + +async function main() { + getAPrivateEndpointConnectionOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts new file mode 100644 index 000000000000..207827dd8e93 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List existing private connections + * + * @summary List existing private connections + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json + */ +async function listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByMongoCluster( + resourceGroupName, + mongoClusterName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.ts new file mode 100644 index 000000000000..538ac7a25abb --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to list private links on the given resource + * + * @summary list private links on the given resource + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json + */ +async function listsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { + const subscriptionId = + process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || + "ffffffff-ffff-ffff-ffff-ffffffffffff"; + const resourceGroupName = + process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; + const mongoClusterName = "myMongoCluster"; + const credential = new DefaultAzureCredential(); + const client = new MongoClusterManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinks.listByMongoCluster( + resourceGroupName, + mongoClusterName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsThePrivateLinkResourcesAvailableOnAMongoClusterResource(); +} + +main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/tsconfig.json b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "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/index.ts b/sdk/mongocluster/arm-mongocluster/src/index.ts new file mode 100644 index 000000000000..dec8a2e8c7e1 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { MongoClusterManagementClient } from "./mongoClusterManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/mongocluster/arm-mongocluster/src/lroImpl.ts b/sdk/mongocluster/arm-mongocluster/src/lroImpl.ts new file mode 100644 index 000000000000..b27f5ac7209b --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/lroImpl.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike }, + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal, + }); + }, + }; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/models/index.ts b/sdk/mongocluster/arm-mongocluster/src/models/index.ts new file mode 100644 index 000000000000..7ad28217f1a7 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/models/index.ts @@ -0,0 +1,962 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface OperationListResult { + /** + * List of operations supported by the resource provider + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Operation[]; + /** + * URL to get the next set of operation list results (if there are any). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** 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" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: Origin; + /** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly actionType?: ActionType; +} + +/** Localized display information for this particular operation. */ +export interface OperationDisplay { + /** + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** The check availability request body. */ +export interface CheckNameAvailabilityRequest { + /** The name of the resource for which availability needs to be checked. */ + name?: string; + /** The resource type. */ + type?: string; +} + +/** The check availability result. */ +export interface CheckNameAvailabilityResponse { + /** Indicates if the resource name is available. */ + nameAvailable?: boolean; + /** The reason why the given name is not available. */ + reason?: CheckNameAvailabilityReason; + /** Detailed reason why the given name is available. */ + message?: string; +} + +/** The response of a MongoCluster list operation. */ +export interface MongoClusterListResult { + /** The MongoCluster items on this page */ + value: MongoCluster[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** The properties of a mongo cluster. */ +export interface MongoClusterProperties { + /** The mode to create a mongo cluster. */ + createMode?: CreateMode; + /** The parameters to create a point-in-time restore mongo cluster. */ + restoreParameters?: MongoClusterRestoreParameters; + /** The administrator's login for the mongo cluster. */ + administratorLogin?: string; + /** + * The password of the administrator login. + * This value contains a credential. Consider obscuring before showing to users + */ + administratorLoginPassword?: string; + /** The Mongo DB server version. Defaults to the latest available version if not specified. */ + serverVersion?: string; + /** + * The default mongo connection string for the cluster. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly connectionString?: string; + /** + * Earliest restore timestamp in UTC ISO8601 format. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly earliestRestoreTime?: string; + /** + * The provisioning state of the mongo cluster. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * The status of the mongo cluster. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clusterStatus?: MongoClusterStatus; + /** Whether or not public endpoint access is allowed for this mongo cluster. */ + publicNetworkAccess?: PublicNetworkAccess; + /** The list of node group specs in the cluster. */ + nodeGroupSpecs?: NodeGroupSpec[]; + /** + * List of private endpoint connections. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly privateEndpointConnections?: AzureResourceManagerPrivateEndpointConnection[]; +} + +/** Parameters used for restore operations */ +export interface MongoClusterRestoreParameters { + /** UTC point in time to restore a mongo cluster */ + pointInTimeUTC?: Date; + /** Resource ID to locate the source cluster to restore */ + sourceResourceId?: string; +} + +/** Specification for a node group. */ +export interface NodeGroupSpec { + /** The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. */ + sku?: string; + /** The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. */ + diskSizeGB?: number; + /** Whether high availability is enabled on the node group. */ + enableHa?: boolean; + /** The node type deployed in the node group. */ + kind?: NodeKind; + /** The number of nodes in the node group. */ + nodeCount?: number; +} + +/** Properties of the private endpoint connection. */ +export interface PrivateEndpointConnectionProperties { + /** + * The group ids for the private endpoint resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly groupIds?: string[]; + /** The private endpoint resource. */ + privateEndpoint?: PrivateEndpoint; + /** A collection of information about the state of the connection between service consumer and provider. */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + /** + * The provisioning state of the private endpoint connection resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +/** The private endpoint resource. */ +export interface PrivateEndpoint { + /** + * The ARM identifier for private endpoint. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; +} + +/** A collection of information about the state of the connection between service consumer and provider. */ +export interface PrivateLinkServiceConnectionState { + /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ + status?: PrivateEndpointServiceConnectionStatus; + /** The reason for approval/rejection of the connection. */ + description?: string; + /** A message indicating if changes on the service provider require any updates on the consumer. */ + actionsRequired?: 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. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: 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; +} + +/** The type used for update operations of the MongoCluster. */ +export interface MongoClusterUpdate { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The updatable properties of the MongoCluster. */ + properties?: MongoClusterUpdateProperties; +} + +/** The updatable properties of the MongoCluster. */ +export interface MongoClusterUpdateProperties { + /** The administrator's login for the mongo cluster. */ + administratorLogin?: string; + /** + * The password of the administrator login. + * This value contains a credential. Consider obscuring before showing to users + */ + administratorLoginPassword?: string; + /** The Mongo DB server version. Defaults to the latest available version if not specified. */ + serverVersion?: string; + /** Whether or not public endpoint access is allowed for this mongo cluster. */ + publicNetworkAccess?: PublicNetworkAccess; + /** The list of node group specs in the cluster. */ + nodeGroupSpecs?: NodeGroupSpec[]; +} + +/** The response of a FirewallRule list operation. */ +export interface FirewallRuleListResult { + /** The FirewallRule items on this page */ + value: FirewallRule[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** The properties of a mongo cluster firewall rule. */ +export interface FirewallRuleProperties { + /** + * The provisioning state of the firewall rule. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** The start IP address of the mongo cluster firewall rule. Must be IPv4 format. */ + startIpAddress: string; + /** The end IP address of the mongo cluster firewall rule. Must be IPv4 format. */ + endIpAddress: string; +} + +/** The connection strings for the given mongo cluster. */ +export interface ListConnectionStringsResult { + /** + * An array that contains the connection strings for a mongo cluster. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly connectionStrings?: ConnectionString[]; +} + +/** Connection string for the mongo cluster */ +export interface ConnectionString { + /** + * Value of the connection string + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly connectionString?: string; + /** + * Description of the connection string + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** The response of a PrivateEndpointConnectionResource list operation. */ +export interface PrivateEndpointConnectionResourceListResult { + /** The PrivateEndpointConnectionResource items on this page */ + value: PrivateEndpointConnectionResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** The response of a PrivateLinkResource list operation. */ +export interface PrivateLinkResourceListResult { + /** The PrivateLinkResource items on this page */ + value: PrivateLinkResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Properties of a private link resource. */ +export interface PrivateLinkResourceProperties { + /** + * The private link resource group id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly groupId?: string; + /** + * The private link resource required member names. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly requiredMembers?: string[]; + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; +} + +/** The properties of the node group on a cluster. */ +export interface NodeGroupProperties { + /** The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. */ + sku?: string; + /** The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. */ + diskSizeGB?: number; + /** Whether high availability is enabled on the node group. */ + enableHa?: boolean; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +/** 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?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +} + +/** The private endpoint connection resource */ +export interface AzureResourceManagerPrivateEndpointConnection + extends ProxyResource { + /** The private endpoint connection properties */ + properties?: PrivateEndpointConnectionProperties; +} + +/** Represents a mongo cluster firewall rule. */ +export interface FirewallRule extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: FirewallRuleProperties; +} + +/** 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. */ + properties?: PrivateEndpointConnectionProperties; +} + +/** 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; +} + +/** Represents a mongo cluster resource. */ +export interface MongoCluster extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: MongoClusterProperties; +} + +/** Defines headers for MongoClusters_createOrUpdate operation. */ +export interface MongoClustersCreateOrUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for MongoClusters_update operation. */ +export interface MongoClustersUpdateHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for MongoClusters_delete operation. */ +export interface MongoClustersDeleteHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for FirewallRules_createOrUpdate operation. */ +export interface FirewallRulesCreateOrUpdateHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for FirewallRules_delete operation. */ +export interface FirewallRulesDeleteHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for PrivateEndpointConnections_create operation. */ +export interface PrivateEndpointConnectionsCreateHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for PrivateEndpointConnections_delete operation. */ +export interface PrivateEndpointConnectionsDeleteHeaders { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + /** User */ + User = "user", + /** System */ + System = "system", + /** UserSystem */ + UserSystem = "user,system", +} + +/** + * Defines values for Origin. \ + * {@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** + */ +export type Origin = string; + +/** Known values of {@link ActionType} that the service accepts. */ +export enum KnownActionType { + /** Internal */ + Internal = "Internal", +} + +/** + * Defines values for ActionType. \ + * {@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** + */ +export type ActionType = string; + +/** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */ +export enum KnownCheckNameAvailabilityReason { + /** Invalid */ + Invalid = "Invalid", + /** AlreadyExists */ + AlreadyExists = "AlreadyExists", +} + +/** + * Defines values for CheckNameAvailabilityReason. \ + * {@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** + */ +export type CheckNameAvailabilityReason = string; + +/** Known values of {@link CreateMode} that the service accepts. */ +export enum KnownCreateMode { + /** Create a new mongo cluster. */ + Default = "Default", + /** Create a mongo cluster from a restore point-in-time. */ + PointInTimeRestore = "PointInTimeRestore", +} + +/** + * Defines values for CreateMode. \ + * {@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**: Create a new mongo cluster. \ + * **PointInTimeRestore**: Create a mongo cluster from a restore point-in-time. + */ +export type CreateMode = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +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. */ + Updating = "Updating", + /** A drop operation is in-progress on the resource. */ + Dropping = "Dropping", +} + +/** + * Defines values for ProvisioningState. \ + * {@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. \ + * **Updating**: An update operation is in-progress on the resource. \ + * **Dropping**: A drop operation is in-progress on the resource. + */ +export type ProvisioningState = string; + +/** Known values of {@link MongoClusterStatus} that the service accepts. */ +export enum KnownMongoClusterStatus { + /** The mongo cluster resource is ready for use. */ + Ready = "Ready", + /** The mongo cluster resource is being provisioned. */ + Provisioning = "Provisioning", + /** The mongo cluster resource is being updated. */ + Updating = "Updating", + /** The mongo cluster resource is being started. */ + Starting = "Starting", + /** The mongo cluster resource is being stopped. */ + Stopping = "Stopping", + /** The mongo cluster resource is stopped. */ + Stopped = "Stopped", + /** The mongo cluster resource is being dropped. */ + Dropping = "Dropping", +} + +/** + * Defines values for MongoClusterStatus. \ + * {@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**: 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. */ +export enum KnownPublicNetworkAccess { + /** If set, mongo cluster can be accessed through private and public methods. */ + Enabled = "Enabled", + /** If set, the private endpoints are the exclusive access method. */ + Disabled = "Disabled", +} + +/** + * Defines values for PublicNetworkAccess. \ + * {@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**: 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; + +/** Known values of {@link NodeKind} that the service accepts. */ +export enum KnownNodeKind { + /** The node is a shard kind. */ + Shard = "Shard", +} + +/** + * Defines values for NodeKind. \ + * {@link KnownNodeKind} can be used interchangeably with NodeKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Shard**: The node is a shard kind. + */ +export type NodeKind = string; + +/** Known values of {@link PrivateEndpointServiceConnectionStatus} that the service accepts. */ +export enum KnownPrivateEndpointServiceConnectionStatus { + /** Pending */ + Pending = "Pending", + /** Approved */ + Approved = "Approved", + /** Rejected */ + Rejected = "Rejected", +} + +/** + * Defines values for PrivateEndpointServiceConnectionStatus. \ + * {@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** + */ +export type PrivateEndpointServiceConnectionStatus = string; + +/** Known values of {@link PrivateEndpointConnectionProvisioningState} that the service accepts. */ +export enum KnownPrivateEndpointConnectionProvisioningState { + /** Succeeded */ + Succeeded = "Succeeded", + /** Creating */ + Creating = "Creating", + /** Deleting */ + Deleting = "Deleting", + /** Failed */ + Failed = "Failed", +} + +/** + * Defines values for PrivateEndpointConnectionProvisioningState. \ + * {@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** + */ +export type PrivateEndpointConnectionProvisioningState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key", +} + +/** + * Defines values for CreatedByType. \ + * {@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; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface MongoClustersCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkNameAvailability operation. */ +export type MongoClustersCheckNameAvailabilityResponse = + CheckNameAvailabilityResponse; + +/** Optional parameters. */ +export interface MongoClustersListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type MongoClustersListResponse = MongoClusterListResult; + +/** Optional parameters. */ +export interface MongoClustersListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type MongoClustersListByResourceGroupResponse = MongoClusterListResult; + +/** Optional parameters. */ +export interface MongoClustersGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type MongoClustersGetResponse = MongoCluster; + +/** Optional parameters. */ +export interface MongoClustersCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type MongoClustersCreateOrUpdateResponse = MongoCluster; + +/** Optional parameters. */ +export interface MongoClustersUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type MongoClustersUpdateResponse = MongoCluster; + +/** Optional parameters. */ +export interface MongoClustersDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the delete operation. */ +export type MongoClustersDeleteResponse = MongoClustersDeleteHeaders; + +/** Optional parameters. */ +export interface MongoClustersListConnectionStringsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listConnectionStrings operation. */ +export type MongoClustersListConnectionStringsResponse = + ListConnectionStringsResult; + +/** Optional parameters. */ +export interface MongoClustersListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type MongoClustersListNextResponse = MongoClusterListResult; + +/** Optional parameters. */ +export interface MongoClustersListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type MongoClustersListByResourceGroupNextResponse = + MongoClusterListResult; + +/** Optional parameters. */ +export interface FirewallRulesListByMongoClusterOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMongoCluster operation. */ +export type FirewallRulesListByMongoClusterResponse = FirewallRuleListResult; + +/** Optional parameters. */ +export interface FirewallRulesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type FirewallRulesGetResponse = FirewallRule; + +/** Optional parameters. */ +export interface FirewallRulesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type FirewallRulesCreateOrUpdateResponse = FirewallRule; + +/** Optional parameters. */ +export interface FirewallRulesDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the delete operation. */ +export type FirewallRulesDeleteResponse = FirewallRulesDeleteHeaders; + +/** Optional parameters. */ +export interface FirewallRulesListByMongoClusterNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMongoClusterNext operation. */ +export type FirewallRulesListByMongoClusterNextResponse = + FirewallRuleListResult; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMongoCluster operation. */ +export type PrivateEndpointConnectionsListByMongoClusterResponse = + PrivateEndpointConnectionResourceListResult; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type PrivateEndpointConnectionsGetResponse = + PrivateEndpointConnectionResource; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type PrivateEndpointConnectionsCreateResponse = + PrivateEndpointConnectionResource; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the delete operation. */ +export type PrivateEndpointConnectionsDeleteResponse = + PrivateEndpointConnectionsDeleteHeaders; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsListByMongoClusterNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMongoClusterNext operation. */ +export type PrivateEndpointConnectionsListByMongoClusterNextResponse = + PrivateEndpointConnectionResourceListResult; + +/** Optional parameters. */ +export interface PrivateLinksListByMongoClusterOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMongoCluster operation. */ +export type PrivateLinksListByMongoClusterResponse = + PrivateLinkResourceListResult; + +/** Optional parameters. */ +export interface PrivateLinksListByMongoClusterNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByMongoClusterNext operation. */ +export type PrivateLinksListByMongoClusterNextResponse = + PrivateLinkResourceListResult; + +/** Optional parameters. */ +export interface MongoClusterManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/models/mappers.ts b/sdk/mongocluster/arm-mongocluster/src/models/mappers.ts new file mode 100644 index 000000000000..94a8968fe612 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/models/mappers.ts @@ -0,0 +1,1184 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String", + }, + }, + isDataAction: { + serializedName: "isDataAction", + readOnly: true, + type: { + name: "Boolean", + }, + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay", + }, + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String", + }, + }, + actionType: { + serializedName: "actionType", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String", + }, + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String", + }, + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + }, + }, +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String", + }, + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String", + }, + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String", + }, + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + }, + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + }, + }, + }, + }, + }, + }, +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String", + }, + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } }, + }, + }, + }, + }, +}; + +export const CheckNameAvailabilityRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityRequest", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + type: { + serializedName: "type", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const CheckNameAvailabilityResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityResponse", + modelProperties: { + nameAvailable: { + serializedName: "nameAvailable", + type: { + name: "Boolean", + }, + }, + reason: { + serializedName: "reason", + type: { + name: "String", + }, + }, + message: { + serializedName: "message", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const MongoClusterListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MongoClusterListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MongoCluster", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const MongoClusterProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MongoClusterProperties", + modelProperties: { + createMode: { + serializedName: "createMode", + type: { + name: "String", + }, + }, + restoreParameters: { + serializedName: "restoreParameters", + type: { + name: "Composite", + className: "MongoClusterRestoreParameters", + }, + }, + administratorLogin: { + serializedName: "administratorLogin", + type: { + name: "String", + }, + }, + administratorLoginPassword: { + serializedName: "administratorLoginPassword", + type: { + name: "String", + }, + }, + serverVersion: { + serializedName: "serverVersion", + type: { + name: "String", + }, + }, + connectionString: { + serializedName: "connectionString", + readOnly: true, + type: { + name: "String", + }, + }, + earliestRestoreTime: { + serializedName: "earliestRestoreTime", + readOnly: true, + type: { + name: "String", + }, + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + clusterStatus: { + serializedName: "clusterStatus", + readOnly: true, + type: { + name: "String", + }, + }, + publicNetworkAccess: { + serializedName: "publicNetworkAccess", + type: { + name: "String", + }, + }, + nodeGroupSpecs: { + serializedName: "nodeGroupSpecs", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "NodeGroupSpec", + }, + }, + }, + }, + privateEndpointConnections: { + serializedName: "privateEndpointConnections", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AzureResourceManagerPrivateEndpointConnection", + }, + }, + }, + }, + }, + }, +}; + +export const MongoClusterRestoreParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MongoClusterRestoreParameters", + modelProperties: { + pointInTimeUTC: { + serializedName: "pointInTimeUTC", + type: { + name: "DateTime", + }, + }, + sourceResourceId: { + serializedName: "sourceResourceId", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const NodeGroupSpec: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NodeGroupSpec", + modelProperties: { + sku: { + serializedName: "sku", + type: { + name: "String", + }, + }, + diskSizeGB: { + serializedName: "diskSizeGB", + type: { + name: "Number", + }, + }, + enableHa: { + serializedName: "enableHa", + type: { + name: "Boolean", + }, + }, + kind: { + serializedName: "kind", + type: { + name: "String", + }, + }, + nodeCount: { + serializedName: "nodeCount", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const PrivateEndpointConnectionProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnectionProperties", + modelProperties: { + groupIds: { + serializedName: "groupIds", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + privateEndpoint: { + serializedName: "privateEndpoint", + type: { + name: "Composite", + className: "PrivateEndpoint", + }, + }, + privateLinkServiceConnectionState: { + serializedName: "privateLinkServiceConnectionState", + type: { + name: "Composite", + className: "PrivateLinkServiceConnectionState", + }, + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const PrivateEndpoint: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpoint", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const PrivateLinkServiceConnectionState: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkServiceConnectionState", + modelProperties: { + status: { + serializedName: "status", + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + type: { + name: "String", + }, + }, + actionsRequired: { + serializedName: "actionsRequired", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String", + }, + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String", + }, + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String", + }, + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData", + }, + }, + }, + }, +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String", + }, + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String", + }, + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime", + }, + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String", + }, + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String", + }, + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime", + }, + }, + }, + }, +}; + +export const MongoClusterUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MongoClusterUpdate", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } }, + }, + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "MongoClusterUpdateProperties", + }, + }, + }, + }, +}; + +export const MongoClusterUpdateProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MongoClusterUpdateProperties", + modelProperties: { + administratorLogin: { + serializedName: "administratorLogin", + type: { + name: "String", + }, + }, + administratorLoginPassword: { + serializedName: "administratorLoginPassword", + type: { + name: "String", + }, + }, + serverVersion: { + serializedName: "serverVersion", + type: { + name: "String", + }, + }, + publicNetworkAccess: { + serializedName: "publicNetworkAccess", + type: { + name: "String", + }, + }, + nodeGroupSpecs: { + serializedName: "nodeGroupSpecs", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "NodeGroupSpec", + }, + }, + }, + }, + }, + }, +}; + +export const FirewallRuleListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FirewallRuleListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FirewallRule", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const FirewallRuleProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FirewallRuleProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + startIpAddress: { + constraints: { + Pattern: new RegExp( + "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", + ), + }, + serializedName: "startIpAddress", + required: true, + type: { + name: "String", + }, + }, + endIpAddress: { + constraints: { + Pattern: new RegExp( + "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", + ), + }, + serializedName: "endIpAddress", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ListConnectionStringsResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ListConnectionStringsResult", + modelProperties: { + connectionStrings: { + serializedName: "connectionStrings", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ConnectionString", + }, + }, + }, + }, + }, + }, +}; + +export const ConnectionString: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConnectionString", + modelProperties: { + connectionString: { + serializedName: "connectionString", + readOnly: true, + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const PrivateEndpointConnectionResourceListResult: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "PrivateEndpointConnectionResourceListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PrivateEndpointConnectionResource", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const PrivateLinkResourceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkResourceListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PrivateLinkResource", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const PrivateLinkResourceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkResourceProperties", + modelProperties: { + groupId: { + serializedName: "groupId", + readOnly: true, + type: { + name: "String", + }, + }, + requiredMembers: { + serializedName: "requiredMembers", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + requiredZoneNames: { + serializedName: "requiredZoneNames", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + }, + }, +}; + +export const NodeGroupProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NodeGroupProperties", + modelProperties: { + sku: { + serializedName: "sku", + type: { + name: "String", + }, + }, + diskSizeGB: { + serializedName: "diskSizeGB", + type: { + name: "Number", + }, + }, + enableHa: { + serializedName: "enableHa", + type: { + name: "Boolean", + }, + }, + }, + }, +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties, + }, + }, +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } }, + }, + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const AzureResourceManagerPrivateEndpointConnection: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "AzureResourceManagerPrivateEndpointConnection", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "PrivateEndpointConnectionProperties", + }, + }, + }, + }, + }; + +export const FirewallRule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FirewallRule", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "FirewallRuleProperties", + }, + }, + }, + }, +}; + +export const PrivateEndpointConnectionResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnectionResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "PrivateEndpointConnectionProperties", + }, + }, + }, + }, +}; + +export const PrivateLinkResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "PrivateLinkResourceProperties", + }, + }, + }, + }, +}; + +export const MongoCluster: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MongoCluster", + modelProperties: { + ...TrackedResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "MongoClusterProperties", + }, + }, + }, + }, +}; + +export const MongoClustersCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MongoClustersCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const MongoClustersUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MongoClustersUpdateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const MongoClustersDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MongoClustersDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const FirewallRulesCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FirewallRulesCreateOrUpdateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const FirewallRulesDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FirewallRulesDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const PrivateEndpointConnectionsCreateHeaders: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "PrivateEndpointConnectionsCreateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, + }; + +export const PrivateEndpointConnectionsDeleteHeaders: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "PrivateEndpointConnectionsDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, + }; diff --git a/sdk/mongocluster/arm-mongocluster/src/models/parameters.ts b/sdk/mongocluster/arm-mongocluster/src/models/parameters.ts new file mode 100644 index 000000000000..86190085944d --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/models/parameters.ts @@ -0,0 +1,188 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter, +} from "@azure/core-client"; +import { + CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper, + MongoCluster as MongoClusterMapper, + MongoClusterUpdate as MongoClusterUpdateMapper, + FirewallRule as FirewallRuleMapper, + PrivateEndpointConnectionResource as PrivateEndpointConnectionResourceMapper, +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String", + }, + }, +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String", + }, + }, + skipEncoding: true, +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2024-03-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String", + }, + }, +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String", + }, + }, + skipEncoding: true, +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String", + }, + }, +}; + +export const body: OperationParameter = { + parameterPath: "body", + mapper: CheckNameAvailabilityRequestMapper, +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "Uuid", + }, + }, +}; + +export const location: OperationURLParameter = { + parameterPath: "location", + mapper: { + constraints: { + MinLength: 1, + }, + serializedName: "location", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1, + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const mongoClusterName: OperationURLParameter = { + parameterPath: "mongoClusterName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z0-9]+(-[a-z0-9]+)*"), + MaxLength: 40, + MinLength: 3, + }, + serializedName: "mongoClusterName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resource: OperationParameter = { + parameterPath: "resource", + mapper: MongoClusterMapper, +}; + +export const properties: OperationParameter = { + parameterPath: "properties", + mapper: MongoClusterUpdateMapper, +}; + +export const firewallRuleName: OperationURLParameter = { + parameterPath: "firewallRuleName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9][-_.a-zA-Z0-9]*"), + MaxLength: 80, + MinLength: 1, + }, + serializedName: "firewallRuleName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resource1: OperationParameter = { + parameterPath: "resource", + mapper: FirewallRuleMapper, +}; + +export const privateEndpointConnectionName: OperationURLParameter = { + parameterPath: "privateEndpointConnectionName", + mapper: { + serializedName: "privateEndpointConnectionName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resource2: OperationParameter = { + parameterPath: "resource", + mapper: PrivateEndpointConnectionResourceMapper, +}; diff --git a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts new file mode 100644 index 000000000000..8057dc06566f --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts @@ -0,0 +1,161 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest, +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { + OperationsImpl, + MongoClustersImpl, + FirewallRulesImpl, + PrivateEndpointConnectionsImpl, + PrivateLinksImpl, +} from "./operations"; +import { + Operations, + MongoClusters, + FirewallRules, + PrivateEndpointConnections, + PrivateLinks, +} from "./operationsInterfaces"; +import { MongoClusterManagementClientOptionalParams } from "./models"; + +export class MongoClusterManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the MongoClusterManagementClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: MongoClusterManagementClientOptionalParams, + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: MongoClusterManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials, + }; + + const packageDetails = `azsdk-js-arm-mongocluster/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix, + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com", + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = + options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName, + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName, + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge, + }, + }), + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2024-03-01-preview"; + this.operations = new OperationsImpl(this); + this.mongoClusters = new MongoClustersImpl(this); + this.firewallRules = new FirewallRulesImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); + this.privateLinks = new PrivateLinksImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest, + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + }, + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + operations: Operations; + mongoClusters: MongoClusters; + firewallRules: FirewallRules; + privateEndpointConnections: PrivateEndpointConnections; + privateLinks: PrivateLinks; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/firewallRules.ts b/sdk/mongocluster/arm-mongocluster/src/operations/firewallRules.ts new file mode 100644 index 000000000000..2051a825c585 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operations/firewallRules.ts @@ -0,0 +1,519 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { FirewallRules } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + FirewallRule, + FirewallRulesListByMongoClusterNextOptionalParams, + FirewallRulesListByMongoClusterOptionalParams, + FirewallRulesListByMongoClusterResponse, + FirewallRulesGetOptionalParams, + FirewallRulesGetResponse, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesCreateOrUpdateResponse, + FirewallRulesDeleteOptionalParams, + FirewallRulesDeleteResponse, + FirewallRulesListByMongoClusterNextResponse, +} from "../models"; + +/// +/** Class containing FirewallRules operations. */ +export class FirewallRulesImpl implements FirewallRules { + private readonly client: MongoClusterManagementClient; + + /** + * Initialize a new instance of the class FirewallRules class. + * @param client Reference to the service client + */ + constructor(client: MongoClusterManagementClient) { + this.client = client; + } + + /** + * List all the firewall rules in a given mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + public listByMongoCluster( + resourceGroupName: string, + mongoClusterName: string, + options?: FirewallRulesListByMongoClusterOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listByMongoClusterPagingAll( + resourceGroupName, + mongoClusterName, + options, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByMongoClusterPagingPage( + resourceGroupName, + mongoClusterName, + options, + settings, + ); + }, + }; + } + + private async *listByMongoClusterPagingPage( + resourceGroupName: string, + mongoClusterName: string, + options?: FirewallRulesListByMongoClusterOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: FirewallRulesListByMongoClusterResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByMongoCluster( + resourceGroupName, + mongoClusterName, + options, + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByMongoClusterNext( + resourceGroupName, + mongoClusterName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByMongoClusterPagingAll( + resourceGroupName: string, + mongoClusterName: string, + options?: FirewallRulesListByMongoClusterOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listByMongoClusterPagingPage( + resourceGroupName, + mongoClusterName, + options, + )) { + yield* page; + } + } + + /** + * List all the firewall rules in a given mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + private _listByMongoCluster( + resourceGroupName: string, + mongoClusterName: string, + options?: FirewallRulesListByMongoClusterOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, mongoClusterName, options }, + listByMongoClusterOperationSpec, + ); + } + + /** + * Gets information about a mongo cluster firewall rule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, mongoClusterName, firewallRuleName, options }, + getOperationSpec, + ); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + resource: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + FirewallRulesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + mongoClusterName, + firewallRuleName, + resource, + options, + }, + spec: createOrUpdateOperationSpec, + }); + const poller = await createHttpPoller< + FirewallRulesCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + resource: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + mongoClusterName, + firewallRuleName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Deletes a mongo cluster firewall rule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + FirewallRulesDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, mongoClusterName, firewallRuleName, options }, + spec: deleteOperationSpec, + }); + const poller = await createHttpPoller< + FirewallRulesDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a mongo cluster firewall rule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + mongoClusterName, + firewallRuleName, + options, + ); + return poller.pollUntilDone(); + } + + /** + * ListByMongoClusterNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param nextLink The nextLink from the previous successful call to the ListByMongoCluster method. + * @param options The options parameters. + */ + private _listByMongoClusterNext( + resourceGroupName: string, + mongoClusterName: string, + nextLink: string, + options?: FirewallRulesListByMongoClusterNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, mongoClusterName, nextLink, options }, + listByMongoClusterNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByMongoClusterOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FirewallRuleListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FirewallRule, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + Parameters.firewallRuleName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.FirewallRule, + }, + 201: { + bodyMapper: Mappers.FirewallRule, + }, + 202: { + bodyMapper: Mappers.FirewallRule, + }, + 204: { + bodyMapper: Mappers.FirewallRule, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + Parameters.firewallRuleName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.FirewallRulesDeleteHeaders, + }, + 201: { + headersMapper: Mappers.FirewallRulesDeleteHeaders, + }, + 202: { + headersMapper: Mappers.FirewallRulesDeleteHeaders, + }, + 204: { + headersMapper: Mappers.FirewallRulesDeleteHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + Parameters.firewallRuleName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listByMongoClusterNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FirewallRuleListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/operations/index.ts new file mode 100644 index 000000000000..3382f99091c6 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operations/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./mongoClusters"; +export * from "./firewallRules"; +export * from "./privateEndpointConnections"; +export * from "./privateLinks"; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/mongoClusters.ts b/sdk/mongocluster/arm-mongocluster/src/operations/mongoClusters.ts new file mode 100644 index 000000000000..833b14b74dd6 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operations/mongoClusters.ts @@ -0,0 +1,812 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { MongoClusters } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + MongoCluster, + MongoClustersListNextOptionalParams, + MongoClustersListOptionalParams, + MongoClustersListResponse, + MongoClustersListByResourceGroupNextOptionalParams, + MongoClustersListByResourceGroupOptionalParams, + MongoClustersListByResourceGroupResponse, + CheckNameAvailabilityRequest, + MongoClustersCheckNameAvailabilityOptionalParams, + MongoClustersCheckNameAvailabilityResponse, + MongoClustersGetOptionalParams, + MongoClustersGetResponse, + MongoClustersCreateOrUpdateOptionalParams, + MongoClustersCreateOrUpdateResponse, + MongoClusterUpdate, + MongoClustersUpdateOptionalParams, + MongoClustersUpdateResponse, + MongoClustersDeleteOptionalParams, + MongoClustersDeleteResponse, + MongoClustersListConnectionStringsOptionalParams, + MongoClustersListConnectionStringsResponse, + MongoClustersListNextResponse, + MongoClustersListByResourceGroupNextResponse, +} from "../models"; + +/// +/** Class containing MongoClusters operations. */ +export class MongoClustersImpl implements MongoClusters { + private readonly client: MongoClusterManagementClient; + + /** + * Initialize a new instance of the class MongoClusters class. + * @param client Reference to the service client + */ + constructor(client: MongoClusterManagementClient) { + this.client = client; + } + + /** + * List all the mongo clusters in a given subscription. + * @param options The options parameters. + */ + public list( + options?: MongoClustersListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + }, + }; + } + + private async *listPagingPage( + options?: MongoClustersListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: MongoClustersListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: MongoClustersListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List all the mongo clusters in a given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: MongoClustersListByResourceGroupOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings, + ); + }, + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: MongoClustersListByResourceGroupOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: MongoClustersListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: MongoClustersListByResourceGroupOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options, + )) { + yield* page; + } + } + + /** + * Check if mongo cluster name is available for use. + * @param location The name of the Azure region. + * @param body The CheckAvailability request + * @param options The options parameters. + */ + checkNameAvailability( + location: string, + body: CheckNameAvailabilityRequest, + options?: MongoClustersCheckNameAvailabilityOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { location, body, options }, + checkNameAvailabilityOperationSpec, + ); + } + + /** + * List all the mongo clusters in a given subscription. + * @param options The options parameters. + */ + private _list( + options?: MongoClustersListOptionalParams, + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * List all the mongo clusters in a given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: MongoClustersListByResourceGroupOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec, + ); + } + + /** + * Gets information about a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, mongoClusterName, options }, + getOperationSpec, + ); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify + * some of the properties, use PATCH. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + mongoClusterName: string, + resource: MongoCluster, + options?: MongoClustersCreateOrUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MongoClustersCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, mongoClusterName, resource, options }, + spec: createOrUpdateOperationSpec, + }); + const poller = await createHttpPoller< + MongoClustersCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify + * some of the properties, use PATCH. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + mongoClusterName: string, + resource: MongoCluster, + options?: MongoClustersCreateOrUpdateOptionalParams, + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + mongoClusterName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties + * present in the normal mongo cluster definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + mongoClusterName: string, + properties: MongoClusterUpdate, + options?: MongoClustersUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MongoClustersUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, mongoClusterName, properties, options }, + spec: updateOperationSpec, + }); + const poller = await createHttpPoller< + MongoClustersUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties + * present in the normal mongo cluster definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + mongoClusterName: string, + properties: MongoClusterUpdate, + options?: MongoClustersUpdateOptionalParams, + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + mongoClusterName, + properties, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Deletes a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MongoClustersDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, mongoClusterName, options }, + spec: deleteOperationSpec, + }); + const poller = await createHttpPoller< + MongoClustersDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersDeleteOptionalParams, + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + mongoClusterName, + options, + ); + return poller.pollUntilDone(); + } + + /** + * 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. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + listConnectionStrings( + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersListConnectionStringsOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, mongoClusterName, options }, + listConnectionStringsOperationSpec, + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: MongoClustersListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec, + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: MongoClustersListByResourceGroupNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/checkMongoClusterNameAvailability", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CheckNameAvailabilityResponse, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.location, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MongoClusterListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer, +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MongoClusterListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MongoCluster, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.MongoCluster, + }, + 201: { + bodyMapper: Mappers.MongoCluster, + }, + 202: { + bodyMapper: Mappers.MongoCluster, + }, + 204: { + bodyMapper: Mappers.MongoCluster, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.MongoCluster, + }, + 201: { + bodyMapper: Mappers.MongoCluster, + }, + 202: { + bodyMapper: Mappers.MongoCluster, + }, + 204: { + bodyMapper: Mappers.MongoCluster, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.properties, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.MongoClustersDeleteHeaders, + }, + 201: { + headersMapper: Mappers.MongoClustersDeleteHeaders, + }, + 202: { + headersMapper: Mappers.MongoClustersDeleteHeaders, + }, + 204: { + headersMapper: Mappers.MongoClustersDeleteHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listConnectionStringsOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/listConnectionStrings", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ListConnectionStringsResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MongoClusterListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MongoClusterListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/operations.ts b/sdk/mongocluster/arm-mongocluster/src/operations/operations.ts new file mode 100644 index 000000000000..10e01a666348 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operations/operations.ts @@ -0,0 +1,149 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse, +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: MongoClusterManagementClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: MongoClusterManagementClient) { + this.client = client; + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + }, + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.DocumentDB/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/privateEndpointConnections.ts b/sdk/mongocluster/arm-mongocluster/src/operations/privateEndpointConnections.ts new file mode 100644 index 000000000000..fe57bdd69f27 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operations/privateEndpointConnections.ts @@ -0,0 +1,536 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { PrivateEndpointConnections } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + PrivateEndpointConnectionResource, + PrivateEndpointConnectionsListByMongoClusterNextOptionalParams, + PrivateEndpointConnectionsListByMongoClusterOptionalParams, + PrivateEndpointConnectionsListByMongoClusterResponse, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsGetResponse, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsCreateResponse, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsDeleteResponse, + PrivateEndpointConnectionsListByMongoClusterNextResponse, +} from "../models"; + +/// +/** Class containing PrivateEndpointConnections operations. */ +export class PrivateEndpointConnectionsImpl + implements PrivateEndpointConnections +{ + private readonly client: MongoClusterManagementClient; + + /** + * Initialize a new instance of the class PrivateEndpointConnections class. + * @param client Reference to the service client + */ + constructor(client: MongoClusterManagementClient) { + this.client = client; + } + + /** + * List existing private connections + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + public listByMongoCluster( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listByMongoClusterPagingAll( + resourceGroupName, + mongoClusterName, + options, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByMongoClusterPagingPage( + resourceGroupName, + mongoClusterName, + options, + settings, + ); + }, + }; + } + + private async *listByMongoClusterPagingPage( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: PrivateEndpointConnectionsListByMongoClusterResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByMongoCluster( + resourceGroupName, + mongoClusterName, + options, + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByMongoClusterNext( + resourceGroupName, + mongoClusterName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByMongoClusterPagingAll( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listByMongoClusterPagingPage( + resourceGroupName, + mongoClusterName, + options, + )) { + yield* page; + } + } + + /** + * List existing private connections + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + private _listByMongoCluster( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, mongoClusterName, options }, + listByMongoClusterOperationSpec, + ); + } + + /** + * Get a specific private connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + options, + }, + getOperationSpec, + ); + } + + /** + * Create a Private endpoint connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + resource: PrivateEndpointConnectionResource, + options?: PrivateEndpointConnectionsCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + PrivateEndpointConnectionsCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + resource, + options, + }, + spec: createOperationSpec, + }); + const poller = await createHttpPoller< + PrivateEndpointConnectionsCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Create a Private endpoint connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + resource: PrivateEndpointConnectionResource, + options?: PrivateEndpointConnectionsCreateOptionalParams, + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Delete the private endpoint connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + PrivateEndpointConnectionsDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + options, + }, + spec: deleteOperationSpec, + }); + const poller = await createHttpPoller< + PrivateEndpointConnectionsDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Delete the private endpoint connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + options, + ); + return poller.pollUntilDone(); + } + + /** + * ListByMongoClusterNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param nextLink The nextLink from the previous successful call to the ListByMongoCluster method. + * @param options The options parameters. + */ + private _listByMongoClusterNext( + resourceGroupName: string, + mongoClusterName: string, + nextLink: string, + options?: PrivateEndpointConnectionsListByMongoClusterNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, mongoClusterName, nextLink, options }, + listByMongoClusterNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByMongoClusterOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnectionResourceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnectionResource, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + Parameters.privateEndpointConnectionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnectionResource, + }, + 201: { + bodyMapper: Mappers.PrivateEndpointConnectionResource, + }, + 202: { + bodyMapper: Mappers.PrivateEndpointConnectionResource, + }, + 204: { + bodyMapper: Mappers.PrivateEndpointConnectionResource, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + Parameters.privateEndpointConnectionName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, + }, + 201: { + headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, + }, + 202: { + headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, + }, + 204: { + headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + Parameters.privateEndpointConnectionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listByMongoClusterNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnectionResourceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/privateLinks.ts b/sdk/mongocluster/arm-mongocluster/src/operations/privateLinks.ts new file mode 100644 index 000000000000..cbbfbb39cce5 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operations/privateLinks.ts @@ -0,0 +1,201 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { PrivateLinks } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; +import { + PrivateLinkResource, + PrivateLinksListByMongoClusterNextOptionalParams, + PrivateLinksListByMongoClusterOptionalParams, + PrivateLinksListByMongoClusterResponse, + PrivateLinksListByMongoClusterNextResponse, +} from "../models"; + +/// +/** Class containing PrivateLinks operations. */ +export class PrivateLinksImpl implements PrivateLinks { + private readonly client: MongoClusterManagementClient; + + /** + * Initialize a new instance of the class PrivateLinks class. + * @param client Reference to the service client + */ + constructor(client: MongoClusterManagementClient) { + this.client = client; + } + + /** + * list private links on the given resource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + public listByMongoCluster( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateLinksListByMongoClusterOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listByMongoClusterPagingAll( + resourceGroupName, + mongoClusterName, + options, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByMongoClusterPagingPage( + resourceGroupName, + mongoClusterName, + options, + settings, + ); + }, + }; + } + + private async *listByMongoClusterPagingPage( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateLinksListByMongoClusterOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: PrivateLinksListByMongoClusterResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByMongoCluster( + resourceGroupName, + mongoClusterName, + options, + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByMongoClusterNext( + resourceGroupName, + mongoClusterName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByMongoClusterPagingAll( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateLinksListByMongoClusterOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listByMongoClusterPagingPage( + resourceGroupName, + mongoClusterName, + options, + )) { + yield* page; + } + } + + /** + * list private links on the given resource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + private _listByMongoCluster( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateLinksListByMongoClusterOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, mongoClusterName, options }, + listByMongoClusterOperationSpec, + ); + } + + /** + * ListByMongoClusterNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param nextLink The nextLink from the previous successful call to the ListByMongoCluster method. + * @param options The options parameters. + */ + private _listByMongoClusterNext( + resourceGroupName: string, + mongoClusterName: string, + nextLink: string, + options?: PrivateLinksListByMongoClusterNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, mongoClusterName, nextLink, options }, + listByMongoClusterNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByMongoClusterOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateLinkResources", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateLinkResourceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listByMongoClusterNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateLinkResourceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.mongoClusterName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/firewallRules.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/firewallRules.ts new file mode 100644 index 000000000000..d64ea9176c90 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/firewallRules.ts @@ -0,0 +1,115 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + FirewallRule, + FirewallRulesListByMongoClusterOptionalParams, + FirewallRulesGetOptionalParams, + FirewallRulesGetResponse, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesCreateOrUpdateResponse, + FirewallRulesDeleteOptionalParams, + FirewallRulesDeleteResponse, +} from "../models"; + +/// +/** Interface representing a FirewallRules. */ +export interface FirewallRules { + /** + * List all the firewall rules in a given mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + listByMongoCluster( + resourceGroupName: string, + mongoClusterName: string, + options?: FirewallRulesListByMongoClusterOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets information about a mongo cluster firewall rule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesGetOptionalParams, + ): Promise; + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + resource: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + FirewallRulesCreateOrUpdateResponse + > + >; + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + resource: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ): Promise; + /** + * Deletes a mongo cluster firewall rule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + FirewallRulesDeleteResponse + > + >; + /** + * Deletes a mongo cluster firewall rule. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/index.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..3382f99091c6 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./mongoClusters"; +export * from "./firewallRules"; +export * from "./privateEndpointConnections"; +export * from "./privateLinks"; diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/mongoClusters.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/mongoClusters.ts new file mode 100644 index 000000000000..858dc96bea1c --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/mongoClusters.ts @@ -0,0 +1,177 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + MongoCluster, + MongoClustersListOptionalParams, + MongoClustersListByResourceGroupOptionalParams, + CheckNameAvailabilityRequest, + MongoClustersCheckNameAvailabilityOptionalParams, + MongoClustersCheckNameAvailabilityResponse, + MongoClustersGetOptionalParams, + MongoClustersGetResponse, + MongoClustersCreateOrUpdateOptionalParams, + MongoClustersCreateOrUpdateResponse, + MongoClusterUpdate, + MongoClustersUpdateOptionalParams, + MongoClustersUpdateResponse, + MongoClustersDeleteOptionalParams, + MongoClustersDeleteResponse, + MongoClustersListConnectionStringsOptionalParams, + MongoClustersListConnectionStringsResponse, +} from "../models"; + +/// +/** Interface representing a MongoClusters. */ +export interface MongoClusters { + /** + * List all the mongo clusters in a given subscription. + * @param options The options parameters. + */ + list( + options?: MongoClustersListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * List all the mongo clusters in a given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: MongoClustersListByResourceGroupOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Check if mongo cluster name is available for use. + * @param location The name of the Azure region. + * @param body The CheckAvailability request + * @param options The options parameters. + */ + checkNameAvailability( + location: string, + body: CheckNameAvailabilityRequest, + options?: MongoClustersCheckNameAvailabilityOptionalParams, + ): Promise; + /** + * Gets information about a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersGetOptionalParams, + ): Promise; + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify + * some of the properties, use PATCH. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + mongoClusterName: string, + resource: MongoCluster, + options?: MongoClustersCreateOrUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MongoClustersCreateOrUpdateResponse + > + >; + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify + * some of the properties, use PATCH. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + mongoClusterName: string, + resource: MongoCluster, + options?: MongoClustersCreateOrUpdateOptionalParams, + ): Promise; + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties + * present in the normal mongo cluster definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + mongoClusterName: string, + properties: MongoClusterUpdate, + options?: MongoClustersUpdateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MongoClustersUpdateResponse + > + >; + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties + * present in the normal mongo cluster definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + mongoClusterName: string, + properties: MongoClusterUpdate, + options?: MongoClustersUpdateOptionalParams, + ): Promise; + /** + * Deletes a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + MongoClustersDeleteResponse + > + >; + /** + * Deletes a mongo cluster. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersDeleteOptionalParams, + ): Promise; + /** + * 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. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + listConnectionStrings( + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersListConnectionStringsOptionalParams, + ): Promise; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/operations.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..251f5f582e64 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List the operations for the provider + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams, + ): PagedAsyncIterableIterator; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateEndpointConnections.ts new file mode 100644 index 000000000000..986583717249 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateEndpointConnections.ts @@ -0,0 +1,120 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + PrivateEndpointConnectionResource, + PrivateEndpointConnectionsListByMongoClusterOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsGetResponse, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsCreateResponse, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsDeleteResponse, +} from "../models"; + +/// +/** Interface representing a PrivateEndpointConnections. */ +export interface PrivateEndpointConnections { + /** + * List existing private connections + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + listByMongoCluster( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Get a specific private connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams, + ): Promise; + /** + * Create a Private endpoint connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + resource: PrivateEndpointConnectionResource, + options?: PrivateEndpointConnectionsCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + PrivateEndpointConnectionsCreateResponse + > + >; + /** + * Create a Private endpoint connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + resource: PrivateEndpointConnectionResource, + options?: PrivateEndpointConnectionsCreateOptionalParams, + ): Promise; + /** + * Delete the private endpoint connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + PrivateEndpointConnectionsDeleteResponse + > + >; + /** + * Delete the private endpoint connection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateLinks.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateLinks.ts new file mode 100644 index 000000000000..aaaac73ccc11 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateLinks.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + PrivateLinkResource, + PrivateLinksListByMongoClusterOptionalParams, +} from "../models"; + +/// +/** Interface representing a PrivateLinks. */ +export interface PrivateLinks { + /** + * list private links on the given resource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param options The options parameters. + */ + listByMongoCluster( + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateLinksListByMongoClusterOptionalParams, + ): PagedAsyncIterableIterator; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/pagingHelper.ts b/sdk/mongocluster/arm-mongocluster/src/pagingHelper.ts new file mode 100644 index 000000000000..205cccc26592 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined, +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/mongocluster/arm-mongocluster/test/mongocluster_operations_test.spec.ts b/sdk/mongocluster/arm-mongocluster/test/mongocluster_operations_test.spec.ts new file mode 100644 index 000000000000..a5ed44822215 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/test/mongocluster_operations_test.spec.ts @@ -0,0 +1,112 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + Recorder, + RecorderStartOptions, + delay, + isPlaybackMode, +} from "@azure-tools/test-recorder"; +import { createTestCredential } from "@azure-tools/test-credential"; +import { assert } from "chai"; +import { Context } from "mocha"; +import { MongoClusterManagementClient } from "../src/mongoClusterManagementClient" + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "88888888-8888-8888-8888-888888888888" +}; + +const recorderOptions: 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 + ], +}; + +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; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + 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 = "myjstest"; + resourcename = "resourcetest"; + + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("mongoClusters create test", async function () { + const res = await client.mongoClusters.beginCreateOrUpdateAndWait( + resourceGroup, + resourcename, + { + location, + properties: { + administratorLogin: "mongoAdmin", + administratorLoginPassword: "Password01!", + nodeGroupSpecs: [ + { + diskSizeGB: 128, + enableHa: true, + kind: "Shard", + nodeCount: 1, + sku: "M30", + }, + ], + serverVersion: "5.0", + }, + }, + testPollingOptions); + assert.equal(res.name, resourcename); + }); + + it("mongoClusters get test", async function () { + const res = await client.mongoClusters.get( + resourceGroup, + resourcename + ); + assert.equal(res.name, resourcename); + }); + + 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("mongoClusters delete test", async function () { + const resArray = new Array(); + const res = await client.mongoClusters.beginDeleteAndWait(resourceGroup, resourcename + ) + for await (let item of client.mongoClusters.listByResourceGroup(resourceGroup)) { + resArray.push(item); + } + assert.equal(resArray.length, 0); + }); +}) diff --git a/sdk/mongocluster/arm-mongocluster/tsconfig.json b/sdk/mongocluster/arm-mongocluster/tsconfig.json new file mode 100644 index 000000000000..48f31b9275c8 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { + "@azure/arm-mongocluster": [ + "./src/index" + ] + } + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/mongocluster/ci.mgmt.yml b/sdk/mongocluster/ci.mgmt.yml new file mode 100644 index 000000000000..9b07c486fba5 --- /dev/null +++ b/sdk/mongocluster/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/mongocluster/arm-mongocluster + - sdk/mongocluster/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/mongocluster/arm-mongocluster + - sdk/mongocluster/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: mongocluster + Artifacts: + - name: azure-arm-mongocluster + safeName: azurearmmongocluster + \ No newline at end of file From 7cc1e0c82bf11f350c21b399d6b28d12db79b271 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:01:39 +0800 Subject: [PATCH 02/23] update --- .github/CODEOWNERS | 3 +++ eng/ignore-links.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 57c8411ed70e..d17c8f920ff5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -636,6 +636,9 @@ # PRLabel: %Mgmt /sdk/monitor/arm-monitor/ @qiaozha @MaryGao +# PRLabel: %Mgmt +/sdk/mongocluster/arm-mongocluster/ @qiaozha @MaryGao + # PRLabel: %Mgmt /sdk/monitor/arm-monitor-profile-2020-09-01-hybrid/ @qiaozha @MaryGao diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index b2d5fc4d3900..baf8d8db8864 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -26,3 +26,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-standbypool?view=azure-node https://docs.microsoft.com/javascript/api/@azure/arm-devopsinfrastructure?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-informaticadatamanagement?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-oracledatabase?view=azure-node-preview +https://docs.microsoft.com/javascript/api/@azure/arm-mongocluster?view=azure-node-preview From 662b1ba1a88b99fdacc2b6a17b499a1f7e2990a6 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 19 Jun 2024 10:59:45 +0800 Subject: [PATCH 03/23] [mgmt] mongocluster with modular --- common/config/rush/pnpm-lock.yaml | 52 +- .../arm-mongocluster/.eslintrc.json | 14 + .../arm-mongocluster/.tshy/browser.json | 12 + .../arm-mongocluster/.tshy/build.json | 9 + .../arm-mongocluster/.tshy/commonjs.json | 14 + .../arm-mongocluster/.tshy/esm.json | 12 + .../arm-mongocluster/.tshy/react-native.json | 12 + sdk/mongocluster/arm-mongocluster/README.md | 94 +- .../arm-mongocluster/api-extractor.json | 27 +- sdk/mongocluster/arm-mongocluster/assets.json | 2 +- .../arm-mongocluster/karma.conf.js | 133 ++ .../arm-mongocluster/package.json | 235 ++-- .../review/arm-mongocluster-api.api.md | 88 ++ .../review/arm-mongocluster-models.api.md | 381 ++++++ .../review/arm-mongocluster.api.md | 525 +++----- .../arm-mongocluster/rollup.config.js | 118 ++ .../firewallRulesCreateOrUpdateSample.ts | 52 - .../samples-dev/firewallRulesDeleteSample.ts | 45 - .../samples-dev/firewallRulesGetSample.ts | 45 - .../firewallRulesListByMongoClusterSample.ts | 46 - ...ongoClustersCheckNameAvailabilitySample.ts | 73 - .../mongoClustersCreateOrUpdateSample.ts | 99 -- .../samples-dev/mongoClustersDeleteSample.ts | 43 - .../samples-dev/mongoClustersGetSample.ts | 43 - .../mongoClustersListByResourceGroupSample.ts | 44 - ...ongoClustersListConnectionStringsSample.ts | 43 - .../samples-dev/mongoClustersListSample.ts | 40 - .../samples-dev/mongoClustersUpdateSample.ts | 118 -- .../samples-dev/operationsListSample.ts | 40 - .../privateEndpointConnectionsCreateSample.ts | 57 - .../privateEndpointConnectionsDeleteSample.ts | 46 - .../privateEndpointConnectionsGetSample.ts | 46 - ...ointConnectionsListByMongoClusterSample.ts | 46 - .../privateLinksListByMongoClusterSample.ts | 46 - .../samples/v1-beta/javascript/README.md | 84 -- .../firewallRulesCreateOrUpdateSample.js | 45 - .../javascript/firewallRulesDeleteSample.js | 41 - .../javascript/firewallRulesGetSample.js | 41 - .../firewallRulesListByMongoClusterSample.js | 42 - ...ongoClustersCheckNameAvailabilitySample.js | 60 - .../mongoClustersCreateOrUpdateSample.js | 90 -- .../javascript/mongoClustersDeleteSample.js | 36 - .../javascript/mongoClustersGetSample.js | 36 - .../mongoClustersListByResourceGroupSample.js | 38 - ...ongoClustersListConnectionStringsSample.js | 39 - .../javascript/mongoClustersListSample.js | 37 - .../javascript/mongoClustersUpdateSample.js | 107 -- .../javascript/operationsListSample.js | 37 - .../samples/v1-beta/javascript/package.json | 32 - .../privateEndpointConnectionsCreateSample.js | 50 - .../privateEndpointConnectionsDeleteSample.js | 41 - .../privateEndpointConnectionsGetSample.js | 41 - ...ointConnectionsListByMongoClusterSample.js | 42 - .../privateLinksListByMongoClusterSample.js | 42 - .../samples/v1-beta/javascript/sample.env | 4 - .../samples/v1-beta/typescript/README.md | 97 -- .../samples/v1-beta/typescript/package.json | 41 - .../samples/v1-beta/typescript/sample.env | 4 - .../src/firewallRulesCreateOrUpdateSample.ts | 52 - .../src/firewallRulesDeleteSample.ts | 45 - .../typescript/src/firewallRulesGetSample.ts | 45 - .../firewallRulesListByMongoClusterSample.ts | 46 - ...ongoClustersCheckNameAvailabilitySample.ts | 73 - .../src/mongoClustersCreateOrUpdateSample.ts | 99 -- .../src/mongoClustersDeleteSample.ts | 43 - .../typescript/src/mongoClustersGetSample.ts | 43 - .../mongoClustersListByResourceGroupSample.ts | 44 - ...ongoClustersListConnectionStringsSample.ts | 43 - .../typescript/src/mongoClustersListSample.ts | 40 - .../src/mongoClustersUpdateSample.ts | 118 -- .../typescript/src/operationsListSample.ts | 40 - .../privateEndpointConnectionsCreateSample.ts | 57 - .../privateEndpointConnectionsDeleteSample.ts | 46 - .../privateEndpointConnectionsGetSample.ts | 46 - ...ointConnectionsListByMongoClusterSample.ts | 46 - .../privateLinksListByMongoClusterSample.ts | 46 - .../samples/v1-beta/typescript/tsconfig.json | 17 - .../src/api/firewallRules/index.ts | 348 +++++ .../arm-mongocluster/src/api/index.ts | 32 + .../src/api/mongoClusterManagementContext.ts | 23 + .../src/api/mongoClusters/index.ts | 1136 ++++++++++++++++ .../src/api/operations/index.ts | 66 + .../arm-mongocluster/src/api/pagingHelpers.ts | 191 +++ .../src/api/pollingHelpers.ts | 139 ++ .../api/privateEndpointConnections/index.ts | 409 ++++++ .../src/api/privateLinks/index.ts | 110 ++ .../src/classic/firewallRules/index.ts | 123 ++ .../arm-mongocluster/src/classic/index.ts | 8 + .../src/classic/mongoClusters/index.ts | 191 +++ .../src/classic/operations/index.ts | 29 + .../privateEndpointConnections/index.ts | 123 ++ .../src/classic/privateLinks/index.ts | 43 + .../arm-mongocluster/src/index.ts | 96 +- .../arm-mongocluster/src/logger.ts | 5 + .../arm-mongocluster/src/lroImpl.ts | 42 - .../arm-mongocluster/src/models/index.ts | 1039 ++------------- .../arm-mongocluster/src/models/mappers.ts | 1184 ----------------- .../arm-mongocluster/src/models/models.ts | 384 ++++++ .../arm-mongocluster/src/models/options.ts | 72 + .../src/models/pagingTypes.ts | 89 ++ .../arm-mongocluster/src/models/parameters.ts | 188 --- .../src/mongoClusterManagementClient.ts | 204 +-- .../src/operations/firewallRules.ts | 519 -------- .../arm-mongocluster/src/operations/index.ts | 13 - .../src/operations/mongoClusters.ts | 812 ----------- .../src/operations/operations.ts | 149 --- .../operations/privateEndpointConnections.ts | 536 -------- .../src/operations/privateLinks.ts | 201 --- .../src/operationsInterfaces/firewallRules.ts | 115 -- .../src/operationsInterfaces/index.ts | 13 - .../src/operationsInterfaces/mongoClusters.ts | 177 --- .../src/operationsInterfaces/operations.ts | 22 - .../privateEndpointConnections.ts | 120 -- .../src/operationsInterfaces/privateLinks.ts | 29 - .../arm-mongocluster/src/pagingHelper.ts | 39 - .../src/rest/clientDefinitions.ts | 312 +++++ .../src/rest/documentDBClient.ts | 46 + .../arm-mongocluster/src/rest/index.ts | 16 + .../arm-mongocluster/src/rest/isUnexpected.ts | 349 +++++ .../arm-mongocluster/src/rest/models.ts | 217 +++ .../arm-mongocluster/src/rest/outputModels.ts | 333 +++++ .../src/rest/paginateHelper.ts | 154 +++ .../arm-mongocluster/src/rest/parameters.ts | 66 + .../src/rest/pollingHelper.ts | 323 +++++ .../arm-mongocluster/src/rest/responses.ts | 380 ++++++ .../src/restorePollerHelpers.ts | 182 +++ .../mongocluster_operations_test.spec.ts | 56 +- .../test/public/utils/recordedClient.ts | 32 + .../tsconfig.browser.config.json | 10 + .../arm-mongocluster/tsconfig.json | 36 +- .../arm-mongocluster/vitest.browser.config.ts | 37 + .../arm-mongocluster/vitest.config.ts | 33 + sdk/test-utils/recorder/package.json | 4 + 133 files changed, 7454 insertions(+), 8967 deletions(-) create mode 100644 sdk/mongocluster/arm-mongocluster/.eslintrc.json create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/browser.json create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/build.json create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/esm.json create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/react-native.json create mode 100644 sdk/mongocluster/arm-mongocluster/karma.conf.js create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/rollup.config.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesCreateOrUpdateSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesDeleteSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesGetSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesListByMongoClusterSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCheckNameAvailabilitySample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCreateOrUpdateSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersDeleteSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersGetSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListByResourceGroupSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListConnectionStringsSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersUpdateSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/operationsListSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsCreateSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsDeleteSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsGetSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsListByMongoClusterSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples-dev/privateLinksListByMongoClusterSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/README.md delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesCreateOrUpdateSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersUpdateSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/package.json delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.js delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/sample.env delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/README.md delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/package.json delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/sample.env delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersUpdateSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/tsconfig.json create mode 100644 sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/api/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/api/pagingHelpers.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/api/pollingHelpers.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/classic/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/logger.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/lroImpl.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/models/mappers.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/models/models.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/models/options.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/models/pagingTypes.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/models/parameters.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/firewallRules.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/index.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/mongoClusters.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/operations.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/privateEndpointConnections.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operations/privateLinks.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/firewallRules.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/index.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/mongoClusters.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/operations.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateEndpointConnections.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateLinks.ts delete mode 100644 sdk/mongocluster/arm-mongocluster/src/pagingHelper.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/clientDefinitions.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/index.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/isUnexpected.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/models.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/outputModels.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/paginateHelper.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/parameters.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/pollingHelper.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/rest/responses.ts create mode 100644 sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts rename sdk/mongocluster/arm-mongocluster/test/{ => public}/mongocluster_operations_test.spec.ts (65%) create mode 100644 sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts create mode 100644 sdk/mongocluster/arm-mongocluster/tsconfig.browser.config.json create mode 100644 sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts create mode 100644 sdk/mongocluster/arm-mongocluster/vitest.config.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 83a835741820..75a92415dc8a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1475,6 +1475,16 @@ packages: tslib: 2.6.3 dev: false + /@azure/core-lro@3.0.0-beta.2: + resolution: {integrity: sha512-8WwZaYHwgp04oA4bnJcjgoHg9Aty4k/fu1EUhaC+r7OhiPwLNKchaY7NH4Z6KqSS8MpFOjmdUjCPcgyAvtweJQ==} + engines: {node: '>=18.0.0'} + dependencies: + '@azure/abort-controller': 2.1.2 + '@azure/core-util': 1.9.0 + '@azure/logger': 1.1.2 + tslib: 2.6.3 + dev: false + /@azure/core-paging@1.6.2: resolution: {integrity: sha512-YKWi9YuCU04B55h25cnOYZHxXYtEvQEbKST5vqRga7hWY9ydd3FZHdeQF8pyh+acWZvppw13M/LMGx0LABUVMA==} engines: {node: '>=18.0.0'} @@ -10548,6 +10558,23 @@ packages: strip-bom: 3.0.0 dev: false + /tshy@1.11.1: + resolution: {integrity: sha512-AzATR8weBaUW46Nh4B1k5cfxVuADKJTXe95xHh7BzcI1RjQQy6HeUXQDY+erGEGTLpiv6N6xMFmtEsMMc7x40Q==} + engines: {node: 16 >=16.17 || 18 >=18.15.0 || >=20.6.1} + hasBin: true + dependencies: + chalk: 5.3.0 + chokidar: 3.6.0 + foreground-child: 3.1.1 + mkdirp: 3.0.1 + polite-json: 4.0.1 + resolve-import: 1.4.5 + rimraf: 5.0.7 + sync-content: 1.0.2 + typescript: 5.3.3 + walk-up-path: 3.0.1 + dev: false + /tshy@1.15.1: resolution: {integrity: sha512-7p30vmXaNX7OL1yLy/MYUtO0SJOm9fQSnzk3DXaM+LmQosooCB4elVeHAGIIZdABhL2E8dx5t/5msR5lh0xnaQ==} engines: {node: 16 >=16.17 || 18 >=18.15.0 || >=20.6.1} @@ -16235,33 +16262,50 @@ packages: dev: false file:projects/arm-mongocluster.tgz: - resolution: {integrity: sha512-+JRls0GC+wQAFWr/5WUH9admadBeEg42hVP4bWhdVmbJGeP7IvlEqGLaNQTVW5GtWCBWOtf9DNAwBcDbGvg7Ww==, tarball: file:projects/arm-mongocluster.tgz} + resolution: {integrity: sha512-gNXxL7MLGz7U+LOjYJ5d0KBvLckQamCrUrLhol9XBg4GQcBChc2CQnN+0EDt+n3nQVndziqisTNsaMzhJ2nhmw==, tarball: file:projects/arm-mongocluster.tgz} name: '@rush-temp/arm-mongocluster' version: 0.0.0 dependencies: '@azure-tools/test-credential': 1.1.0 '@azure-tools/test-recorder': 3.5.1 '@azure/abort-controller': 1.1.0 - '@azure/core-lro': 2.7.2 + '@azure/core-lro': 3.0.0-beta.2 '@microsoft/api-extractor': 7.47.0(@types/node@18.19.34) '@types/chai': 4.3.16 '@types/mocha': 10.0.6 '@types/node': 18.19.34 + '@vitest/browser': 1.6.0(playwright@1.44.1)(vitest@1.6.0) + '@vitest/coverage-istanbul': 1.6.0(vitest@1.6.0) chai: 4.3.10 cross-env: 7.0.3 dotenv: 16.4.5 + eslint: 8.57.0 mkdirp: 3.0.1 mocha: 10.4.0 + playwright: 1.44.1 + prettier: 3.3.2 rimraf: 5.0.7 ts-node: 10.9.2(@types/node@18.19.34)(typescript@5.4.5) + tshy: 1.11.1 tslib: 2.6.3 tsx: 4.15.2 typescript: 5.4.5 uglify-js: 3.18.0 + vitest: 1.6.0(@types/node@18.19.34)(@vitest/browser@1.6.0) transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' + - '@edge-runtime/vm' + - '@vitest/ui' + - happy-dom + - jsdom + - less + - lightningcss + - safaridriver + - sass + - stylus + - sugarss - supports-color + - terser + - webdriverio dev: false file:projects/arm-monitor-profile-2020-09-01-hybrid.tgz: diff --git a/sdk/mongocluster/arm-mongocluster/.eslintrc.json b/sdk/mongocluster/arm-mongocluster/.eslintrc.json new file mode 100644 index 000000000000..8793fba07e9d --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.eslintrc.json @@ -0,0 +1,14 @@ +{ + "plugins": ["@azure/azure-sdk"], + "extends": ["plugin:@azure/azure-sdk/azure-sdk-base"], + "rules": { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-apiextractor-json-types": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "tsdoc/syntax": "warn", + "@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" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/browser.json b/sdk/mongocluster/arm-mongocluster/.tshy/browser.json new file mode 100644 index 000000000000..32e74e04ec62 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/browser.json @@ -0,0 +1,12 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.mts", + "../src/**/*.tsx" + ], + "exclude": [], + "compilerOptions": { + "outDir": "../.tshy-build/browser" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/build.json b/sdk/mongocluster/arm-mongocluster/.tshy/build.json new file mode 100644 index 000000000000..c51b7f53052c --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/build.json @@ -0,0 +1,9 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "target": "es2022", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json b/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json new file mode 100644 index 000000000000..5ace94d041f3 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json @@ -0,0 +1,14 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.cts", + "../src/**/*.tsx" + ], + "exclude": [ + "../src/**/*.mts" + ], + "compilerOptions": { + "outDir": "../.tshy-build/commonjs" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/esm.json b/sdk/mongocluster/arm-mongocluster/.tshy/esm.json new file mode 100644 index 000000000000..ff5264e692d1 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/esm.json @@ -0,0 +1,12 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.mts", + "../src/**/*.tsx" + ], + "exclude": [], + "compilerOptions": { + "outDir": "../.tshy-build/esm" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json b/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json new file mode 100644 index 000000000000..f431a06985d8 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json @@ -0,0 +1,12 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.mts", + "../src/**/*.tsx" + ], + "exclude": [], + "compilerOptions": { + "outDir": "../.tshy-build/react-native" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/README.md b/sdk/mongocluster/arm-mongocluster/README.md index 6a44bd447e4e..e0cc5eba9bf4 100644 --- a/sdk/mongocluster/arm-mongocluster/README.md +++ b/sdk/mongocluster/arm-mongocluster/README.md @@ -1,78 +1,46 @@ -# Azure MongoClusterManagement client library for JavaScript - -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MongoClusterManagement client. +# Azure MongoClusterManagement REST client library for JavaScript 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) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +**If you are not familiar with our REST client, please spend 5 minutes to take a look at our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library, the REST client provides a light-weighted & developer friendly way to call azure rest api + +Key links: + +- [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 ### Currently supported environments -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) -- Latest versions of Safari, Chrome, Edge and Firefox. - -See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. +- LTS versions of Node.js ### Prerequisites -- An [Azure subscription][azure_sub]. +- You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package. ### Install the `@azure/arm-mongocluster` package -Install the Azure MongoClusterManagement client library for JavaScript with `npm`: +Install the Azure MongoClusterManagement REST client REST client library for JavaScript with `npm`: ```bash 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]. +To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), +provide an instance of the desired credential type obtained from the +[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library. -You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). - -To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: - -```bash -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 { 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); - -// For client-side applications running in the browser, use this code instead: -// const credential = new InteractiveBrowserCredential({ -// tenantId: "", -// clientId: "" -// }); -// const client = new MongoClusterManagementClient(credential, subscriptionId); -``` +To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) +After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use. +As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) +can be used to authenticate the client. -### JavaScript Bundle -To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). - -## Key concepts - -### MongoClusterManagementClient - -`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. +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 ## Troubleshooting @@ -82,28 +50,8 @@ Enabling logging may help uncover useful information about failures. In order to ```javascript const { setLogLevel } = require("@azure/logger"); + setLogLevel("info"); ``` For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). - -## Next steps - -Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. - -## Contributing - -If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. - -## Related projects - -- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmongocluster%2Farm-mongocluster%2FREADME.png) - -[azure_cli]: https://docs.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ -[azure_sub]: https://azure.microsoft.com/free/ -[azure_portal]: https://portal.azure.com -[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity -[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/mongocluster/arm-mongocluster/api-extractor.json b/sdk/mongocluster/arm-mongocluster/api-extractor.json index b4e27a27969b..2e201623f120 100644 --- a/sdk/mongocluster/arm-mongocluster/api-extractor.json +++ b/sdk/mongocluster/arm-mongocluster/api-extractor.json @@ -1,31 +1,18 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", - "docModel": { - "enabled": true - }, - "apiReport": { - "enabled": true, - "reportFolder": "./review" - }, + "mainEntryPointFilePath": "./dist/esm/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-mongocluster.d.ts" }, "messages": { - "tsdocMessageReporting": { - "default": { - "logLevel": "none" - } - }, + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, "extractorMessageReporting": { - "ae-missing-release-tag": { - "logLevel": "none" - }, - "ae-unresolved-link": { - "logLevel": "none" - } + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } } } -} \ No newline at end of file +} diff --git a/sdk/mongocluster/arm-mongocluster/assets.json b/sdk/mongocluster/arm-mongocluster/assets.json index dff740fa0715..c0d7afa7aa32 100644 --- a/sdk/mongocluster/arm-mongocluster/assets.json +++ b/sdk/mongocluster/arm-mongocluster/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/mongocluster/arm-mongocluster", - "Tag": "js/mongocluster/arm-mongocluster_6ce9a672f5" + "Tag": "js/mongocluster/arm-mongocluster_e6df67d5f1" } diff --git a/sdk/mongocluster/arm-mongocluster/karma.conf.js b/sdk/mongocluster/arm-mongocluster/karma.conf.js new file mode 100644 index 000000000000..a9d5f1b5fc59 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/karma.conf.js @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// https://github.com/karma-runner/karma-chrome-launcher +process.env.CHROME_BIN = require("puppeteer").executablePath(); +require("dotenv").config(); +const { relativeRecordingsPath } = require("@azure-tools/test-recorder"); +process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); + +module.exports = function (config) { + config.set({ + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: "./", + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ["source-map-support", "mocha"], + + plugins: [ + "karma-mocha", + "karma-mocha-reporter", + "karma-chrome-launcher", + "karma-firefox-launcher", + "karma-env-preprocessor", + "karma-coverage", + "karma-sourcemap-loader", + "karma-junit-reporter", + "karma-source-map-support", + ], + + // list of files / patterns to load in the browser + files: [ + "dist-test/index.browser.js", + { + pattern: "dist-test/index.browser.js.map", + type: "html", + included: false, + served: true, + }, + ], + + // list of files / patterns to exclude + exclude: [], + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + "**/*.js": ["sourcemap", "env"], + // IMPORTANT: COMMENT following line if you want to debug in your browsers!! + // Preprocess source file to calculate code coverage, however this will make source file unreadable + // "dist-test/index.js": ["coverage"] + }, + + envPreprocessor: [ + "TEST_MODE", + "ENDPOINT", + "AZURE_CLIENT_SECRET", + "AZURE_CLIENT_ID", + "AZURE_TENANT_ID", + "SUBSCRIPTION_ID", + "RECORDINGS_RELATIVE_PATH", + ], + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ["mocha", "coverage", "junit"], + + coverageReporter: { + // specify a common output directory + dir: "coverage-browser/", + reporters: [ + { type: "json", subdir: ".", file: "coverage.json" }, + { type: "lcovonly", subdir: ".", file: "lcov.info" }, + { type: "html", subdir: "html" }, + { type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }, + ], + }, + + junitReporter: { + outputDir: "", // results will be saved as $outputDir/$browserName.xml + outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile + suite: "", // suite will become the package name attribute in xml testsuite element + useBrowserName: false, // add browser name to report and classes names + nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element + classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element + properties: {}, // key value pair of properties to add to the section of the report + }, + + // web server port + port: 9876, + + // enable / disable colors in the output (reporters and logs) + colors: true, + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + // --no-sandbox allows our tests to run in Linux without having to change the system. + // --disable-web-security allows us to authenticate from the browser without having to write tests using interactive auth, which would be far more complex. + browsers: ["ChromeHeadlessNoSandbox"], + customLaunchers: { + ChromeHeadlessNoSandbox: { + base: "ChromeHeadless", + flags: ["--no-sandbox", "--disable-web-security"], + }, + }, + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: 1, + + browserNoActivityTimeout: 60000000, + browserDisconnectTimeout: 10000, + browserDisconnectTolerance: 3, + + client: { + mocha: { + // change Karma's debug.html to the mocha web reporter + reporter: "html", + timeout: "600000", + }, + }, + }); +}; diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index 4757c99d08d8..5b8ebbb6a94b 100644 --- a/sdk/mongocluster/arm-mongocluster/package.json +++ b/sdk/mongocluster/arm-mongocluster/package.json @@ -1,118 +1,173 @@ { "name": "@azure/arm-mongocluster", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", - "description": "A generated SDK for MongoClusterManagementClient.", "version": "1.0.0-beta.1", + "description": "DocumentDB MongoCluster Service", "engines": { "node": ">=18.0.0" }, - "dependencies": { - "@azure/core-lro": "^2.5.4", - "@azure/abort-controller": "^1.0.0", - "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.7.0", - "@azure/core-auth": "^1.6.0", - "@azure/core-rest-pipeline": "^1.14.0", - "tslib": "^2.2.0" + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false }, + "type": "module", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/index.js", - "module": "./dist-esm/src/index.js", - "types": "./types/arm-mongocluster.d.ts", + "files": [ + "dist", + "README.md", + "LICENSE", + "review/*" + ], + "sdk-type": "client", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/rest/documentDBClient.ts", + "prefix": "package-version" + } + ] + }, + "dependencies": { + "@azure-rest/core-client": "^2.0.0", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.5.0", + "@azure/logger": "^1.0.0", + "tslib": "^2.6.2", + "@azure/core-lro": "3.0.0-beta.2", + "@azure/abort-controller": "^2.0.0", + "@azure/core-paging": "^1.5.0" + }, "devDependencies": { - "@microsoft/api-extractor": "^7.31.1", + "dotenv": "^16.0.0", + "@microsoft/api-extractor": "^7.40.3", + "@types/node": "^18.0.0", + "eslint": "^8.55.0", + "prettier": "^3.2.5", + "rimraf": "^5.0.5", "mkdirp": "^3.0.1", "typescript": "~5.4.5", - "uglify-js": "^3.4.9", - "rimraf": "^5.0.0", - "dotenv": "^16.0.0", + "tshy": "^1.11.1", + "@azure/core-util": "^1.0.0", + "@azure/identity": "^4.2.1", + "@vitest/browser": "^1.3.1", + "@vitest/coverage-istanbul": "^1.3.1", + "playwright": "^1.41.2", + "vitest": "^1.3.1", + "@azure-tools/test-credential": "^2.0.0", + "@azure-tools/test-recorder": "^4.0.0", "@azure/dev-tool": "^1.0.0", - "@azure/identity": "^4.0.1", - "@azure-tools/test-recorder": "^3.0.0", - "@azure-tools/test-credential": "^1.1.0", - "mocha": "^10.0.0", - "@types/mocha": "^10.0.0", - "tsx": "^4.7.1", - "@types/chai": "^4.2.8", - "chai": "^4.2.0", - "cross-env": "^7.0.2", - "@types/node": "^18.0.0", - "ts-node": "^10.0.0" - }, - "repository": { - "type": "git", - "url": "https://github.com/Azure/azure-sdk-for-js.git" - }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" + "@azure/eslint-plugin-azure-sdk": "^3.0.0" }, - "files": [ - "dist/**/*.js", - "dist/**/*.js.map", - "dist/**/*.d.ts", - "dist/**/*.d.ts.map", - "dist-esm/**/*.js", - "dist-esm/**/*.js.map", - "dist-esm/**/*.d.ts", - "dist-esm/**/*.d.ts.map", - "src/**/*.ts", - "README.md", - "LICENSE", - "tsconfig.json", - "review/*", - "CHANGELOG.md", - "types/*" - ], "scripts": { - "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", - "prepack": "npm run build", - "pack": "npm pack 2>&1", - "extract-api": "dev-tool run extract-api", - "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "build:node": "echo skipped", - "build:browser": "echo skipped", - "build:test": "echo skipped", - "build:samples": "echo skipped.", - "check-format": "echo skipped", - "execute:samples": "echo skipped", - "format": "echo skipped", - "test": "npm run integration-test", - "test:node": "echo skipped", - "test:browser": "echo skipped", + "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", + "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", - "unit-test:browser": "echo skipped", + "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:node": "dev-tool run test:node-ts-input -- --timeout 4800000 'test/*.ts'", - "integration-test:browser": "echo skipped" + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build:samples": "dev-tool samples publish --force", + "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": "dev-tool samples run samples-dev", + "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", + "generate:client": "echo skipped", + "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "build:test": "npm run clean && tshy && dev-tool run build-test", + "build": "npm run clean && tshy && mkdirp ./review && dev-tool run extract-api", + "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", + "test": "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test" }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/mongoClusterManagementClient.ts", - "prefix": "packageDetails" + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" } - ] + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + } }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mongocluster/arm-mongocluster", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-mongocluster?view=azure-node-preview" - } + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts" } diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md new file mode 100644 index 000000000000..10c665e13111 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md @@ -0,0 +1,88 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { Paged } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export function createMongoClusterManagement(credential: TokenCredential, options?: MongoClusterManagementClientOptions): DocumentDBContext; + +// @public (undocumented) +export type DocumentDBContext = Client & { + path: Routes; +}; + +// @public +export function firewallRulesCreateOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): PollerLike, void>; + +// @public +export function firewallRulesDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): PollerLike, void>; + +// @public +export function firewallRulesGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; + +// @public +export function firewallRulesListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public (undocumented) +export interface MongoClusterManagementClientOptions extends ClientOptions { + apiVersion?: string; +} + +// @public +export function mongoClustersCheckNameAvailability(context: DocumentDBContext, subscriptionId: string, location: string, body: CheckNameAvailabilityRequest_2, options?: MongoClustersCheckNameAvailabilityOptionalParams): Promise; + +// @public +export function mongoClustersCreateOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster_2, options?: MongoClustersCreateOrUpdateOptionalParams): PollerLike, MongoCluster_2>; + +// @public +export function mongoClustersDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): PollerLike, void>; + +// @public +export function mongoClustersGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): Promise; + +// @public +export function mongoClustersList(context: DocumentDBContext, subscriptionId: string, options?: MongoClustersListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function mongoClustersListByResourceGroup(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function mongoClustersListConnectionStrings(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): Promise; + +// @public +export function mongoClustersUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate_2, options?: MongoClustersUpdateOptionalParams): PollerLike, MongoCluster_2>; + +// @public +export function operationsList(context: DocumentDBContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function privateEndpointConnectionsCreate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, void>; + +// @public +export function privateEndpointConnectionsDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): PollerLike, void>; + +// @public +export function privateEndpointConnectionsGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; + +// @public +export function privateEndpointConnectionsListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public +export function privateLinksListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md new file mode 100644 index 000000000000..6b9d35bd71a2 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md @@ -0,0 +1,381 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { OperationOptions } from '@azure-rest/core-client'; + +// @public +export type ActionType = string; + +// @public +export interface ArmOperationStatus { + readonly endTime?: Date; + readonly error?: ErrorDetail; + readonly name?: string; + readonly percentComplete?: number; + readonly startTime?: Date; + status: ResourceProvisioningState; +} + +// @public +export type CheckNameAvailabilityReason = string; + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: CheckNameAvailabilityReason; +} + +// @public +export interface ConnectionString { + readonly connectionString?: string; + readonly description?: string; +} + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +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; +} + +// @public +export interface FirewallRuleListResult { + nextLink?: string; + value: FirewallRule[]; +} + +// @public +export interface FirewallRuleProperties { + endIpAddress: string; + readonly provisioningState?: ProvisioningState; + startIpAddress: string; +} + +// @public (undocumented) +export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface FirewallRulesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface FirewallRulesGetOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public +export interface ListConnectionStringsResult { + readonly connectionStrings?: ConnectionString[]; +} + +// @public +export interface MongoCluster extends TrackedResource { + properties?: MongoClusterProperties; +} + +// @public +export interface MongoClusterListResult { + nextLink?: string; + value: MongoCluster[]; +} + +// @public +export interface MongoClusterProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + readonly clusterStatus?: MongoClusterStatus; + readonly connectionString?: string; + createMode?: CreateMode; + readonly earliestRestoreTime?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly provisioningState?: ProvisioningState; + publicNetworkAccess?: PublicNetworkAccess; + restoreParameters?: MongoClusterRestoreParameters; + serverVersion?: string; +} + +// @public +export interface MongoClusterRestoreParameters { + pointInTimeUTC?: Date; + sourceResourceId?: string; +} + +// @public (undocumented) +export interface MongoClustersCheckNameAvailabilityOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface MongoClustersCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface MongoClustersDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface MongoClustersGetOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface MongoClustersListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface MongoClustersListConnectionStringsOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface MongoClustersListOptionalParams extends OperationOptions { +} + +// @public +export type MongoClusterStatus = string; + +// @public (undocumented) +export interface MongoClustersUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface MongoClusterUpdate { + // (undocumented) + properties?: MongoClusterUpdateProperties; + tags?: Record; +} + +// @public +export interface MongoClusterUpdateProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + publicNetworkAccess?: PublicNetworkAccess; + serverVersion?: string; +} + +// @public +export interface NodeGroupSpec { + diskSizeGB?: number; + enableHa?: boolean; + kind?: NodeKind; + nodeCount?: number; + sku?: string; +} + +// @public +export type NodeKind = string; + +// @public +export interface Operation { + actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public (undocumented) +export interface OperationsListOptionalParams extends OperationOptions { +} + +// @public +export type Origin = string; + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PagedOperation { + nextLink?: string; + value: Operation[]; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export interface PrivateEndpoint { + id?: string; +} + +// @public +export interface PrivateEndpointConnection extends ProxyResource { + properties?: PrivateEndpointConnectionProperties; +} + +// @public +export interface PrivateEndpointConnectionProperties { + readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export type PrivateEndpointConnectionProvisioningState = ResourceProvisioningState | "Creating" | "Deleting"; + +// @public +export interface PrivateEndpointConnectionResource extends ProxyResource { + properties?: PrivateEndpointConnectionProperties; +} + +// @public +export interface PrivateEndpointConnectionResourceListResult { + nextLink?: string; + value: PrivateEndpointConnectionResource[]; +} + +// @public (undocumented) +export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public +export type PrivateEndpointServiceConnectionStatus = string; + +// @public +export interface PrivateLinkResource extends ProxyResource { + properties?: PrivateLinkResourceProperties; +} + +// @public +export interface PrivateLinkResourceListResult { + nextLink?: string; + value: PrivateLinkResource[]; +} + +// @public +export interface PrivateLinkResourceProperties { + readonly groupId?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; +} + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateEndpointServiceConnectionStatus; +} + +// @public (undocumented) +export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public +export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type PublicNetworkAccess = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type ResourceProvisioningState = string; + +// @public +export interface SystemData { + readonly createdAt?: Date; + readonly createdBy?: string; + readonly createdByType?: CreatedByType; + readonly lastModifiedAt?: Date; + readonly lastModifiedBy?: string; + readonly lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public (undocumented) +export type Versions = "2024-03-01-preview"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md index 9ef828bc0874..2976cb97efd9 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md @@ -4,18 +4,32 @@ ```ts -import * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; +import { AbortSignalLike } from '@azure/abort-controller'; +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; import { OperationState } from '@azure/core-lro'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { SimplePollerLike } from '@azure/core-lro'; +import { Paged } from '@azure/core-paging'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { PollerLike } from '@azure/core-lro'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; // @public export type ActionType = string; // @public -export interface AzureResourceManagerPrivateEndpointConnection extends ProxyResource { - properties?: PrivateEndpointConnectionProperties; +export interface ArmOperationStatus { + readonly endTime?: Date; + readonly error?: ErrorDetail; + readonly name?: string; + readonly percentComplete?: number; + readonly startTime?: Date; + status: ResourceProvisioningState; } // @public @@ -40,6 +54,11 @@ export interface ConnectionString { readonly description?: string; } +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + // @public export type CreatedByType = string; @@ -48,7 +67,7 @@ export type CreateMode = string; // @public export interface ErrorAdditionalInfo { - readonly info?: Record; + readonly info?: Record; readonly type?: string; } @@ -84,147 +103,34 @@ export interface FirewallRuleProperties { startIpAddress: string; } -// @public -export interface FirewallRules { - beginCreateOrUpdate(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams): Promise, FirewallRulesCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): Promise, FirewallRulesDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): Promise; - get(resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; - listByMongoCluster(resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface FirewallRulesCreateOrUpdateHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface FirewallRulesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +// @public (undocumented) +export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type FirewallRulesCreateOrUpdateResponse = FirewallRule; - -// @public -export interface FirewallRulesDeleteHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface FirewallRulesDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +// @public (undocumented) +export interface FirewallRulesDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type FirewallRulesDeleteResponse = FirewallRulesDeleteHeaders; - -// @public -export interface FirewallRulesGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type FirewallRulesGetResponse = FirewallRule; - -// @public -export interface FirewallRulesListByMongoClusterNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type FirewallRulesListByMongoClusterNextResponse = FirewallRuleListResult; - -// @public -export interface FirewallRulesListByMongoClusterOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type FirewallRulesListByMongoClusterResponse = FirewallRuleListResult; - -// @public -export function getContinuationToken(page: unknown): string | undefined; - -// @public -export enum KnownActionType { - Internal = "Internal" -} - -// @public -export enum KnownCheckNameAvailabilityReason { - AlreadyExists = "AlreadyExists", - Invalid = "Invalid" -} - -// @public -export enum KnownCreatedByType { - Application = "Application", - Key = "Key", - ManagedIdentity = "ManagedIdentity", - User = "User" -} - -// @public -export enum KnownCreateMode { - Default = "Default", - PointInTimeRestore = "PointInTimeRestore" -} - -// @public -export enum KnownMongoClusterStatus { - Dropping = "Dropping", - Provisioning = "Provisioning", - Ready = "Ready", - Starting = "Starting", - Stopped = "Stopped", - Stopping = "Stopping", - Updating = "Updating" -} - -// @public -export enum KnownNodeKind { - Shard = "Shard" -} - -// @public -export enum KnownOrigin { - System = "system", - User = "user", - UserSystem = "user,system" -} - -// @public -export enum KnownPrivateEndpointConnectionProvisioningState { - Creating = "Creating", - Deleting = "Deleting", - Failed = "Failed", - Succeeded = "Succeeded" -} - -// @public -export enum KnownPrivateEndpointServiceConnectionStatus { - Approved = "Approved", - Pending = "Pending", - Rejected = "Rejected" +// @public (undocumented) +export interface FirewallRulesGetOptionalParams extends OperationOptions { } -// @public -export enum KnownProvisioningState { - Canceled = "Canceled", - Dropping = "Dropping", - Failed = "Failed", - InProgress = "InProgress", - Succeeded = "Succeeded", - Updating = "Updating" +// @public (undocumented) +export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { } -// @public -export enum KnownPublicNetworkAccess { - Disabled = "Disabled", - Enabled = "Enabled" +// @public (undocumented) +export interface FirewallRulesOperations { + // (undocumented) + createOrUpdate: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, void>; + // (undocumented) + delete: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => PollerLike, void>; + // (undocumented) + get: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams) => Promise; + // (undocumented) + listByMongoCluster: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; } // @public @@ -244,31 +150,19 @@ export interface MongoClusterListResult { } // @public (undocumented) -export class MongoClusterManagementClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MongoClusterManagementClientOptionalParams); - // (undocumented) - apiVersion: string; - // (undocumented) - firewallRules: FirewallRules; - // (undocumented) - mongoClusters: MongoClusters; - // (undocumented) - operations: Operations; - // (undocumented) - privateEndpointConnections: PrivateEndpointConnections; - // (undocumented) - privateLinks: PrivateLinks; - // (undocumented) - subscriptionId: string; +export class MongoClusterManagementClient { + constructor(credential: TokenCredential, options?: MongoClusterManagementClientOptions); + readonly firewallRules: FirewallRulesOperations; + readonly mongoClusters: MongoClustersOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + readonly privateLinks: PrivateLinksOperations; } -// @public -export interface MongoClusterManagementClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; +// @public (undocumented) +export interface MongoClusterManagementClientOptions extends ClientOptions { apiVersion?: string; - endpoint?: string; } // @public @@ -280,7 +174,7 @@ export interface MongoClusterProperties { createMode?: CreateMode; readonly earliestRestoreTime?: string; nodeGroupSpecs?: NodeGroupSpec[]; - readonly privateEndpointConnections?: AzureResourceManagerPrivateEndpointConnection[]; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; readonly provisioningState?: ProvisioningState; publicNetworkAccess?: PublicNetworkAccess; restoreParameters?: MongoClusterRestoreParameters; @@ -293,123 +187,69 @@ export interface MongoClusterRestoreParameters { sourceResourceId?: string; } -// @public -export interface MongoClusters { - beginCreateOrUpdate(resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams): Promise, MongoClustersCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): Promise, MongoClustersDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams): Promise, MongoClustersUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams): Promise; - checkNameAvailability(location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams): Promise; - get(resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): Promise; - list(options?: MongoClustersListOptionalParams): PagedAsyncIterableIterator; - listByResourceGroup(resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listConnectionStrings(resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): Promise; -} - -// @public -export interface MongoClustersCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MongoClustersCheckNameAvailabilityResponse = CheckNameAvailabilityResponse; - -// @public -export interface MongoClustersCreateOrUpdateHeaders { - retryAfter?: number; +// @public (undocumented) +export interface MongoClustersCheckNameAvailabilityOptionalParams extends OperationOptions { } -// @public -export interface MongoClustersCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +// @public (undocumented) +export interface MongoClustersCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type MongoClustersCreateOrUpdateResponse = MongoCluster; - -// @public -export interface MongoClustersDeleteHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface MongoClustersDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +// @public (undocumented) +export interface MongoClustersDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type MongoClustersDeleteResponse = MongoClustersDeleteHeaders; - -// @public -export interface MongoClustersGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type MongoClustersGetResponse = MongoCluster; - -// @public -export interface MongoClustersListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface MongoClustersGetOptionalParams extends OperationOptions { } -// @public -export type MongoClustersListByResourceGroupNextResponse = MongoClusterListResult; - -// @public -export interface MongoClustersListByResourceGroupOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface MongoClustersListByResourceGroupOptionalParams extends OperationOptions { } -// @public -export type MongoClustersListByResourceGroupResponse = MongoClusterListResult; - -// @public -export interface MongoClustersListConnectionStringsOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface MongoClustersListConnectionStringsOptionalParams extends OperationOptions { } -// @public -export type MongoClustersListConnectionStringsResponse = ListConnectionStringsResult; - -// @public -export interface MongoClustersListNextOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface MongoClustersListOptionalParams extends OperationOptions { } -// @public -export type MongoClustersListNextResponse = MongoClusterListResult; - -// @public -export interface MongoClustersListOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface MongoClustersOperations { + // (undocumented) + checkNameAvailability: (subscriptionId: string, location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams) => Promise; + // (undocumented) + createOrUpdate: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams) => PollerLike, MongoCluster>; + // (undocumented) + delete: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams) => PollerLike, void>; + // (undocumented) + get: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams) => Promise; + // (undocumented) + list: (subscriptionId: string, options?: MongoClustersListOptionalParams) => PagedAsyncIterableIterator; + // (undocumented) + listByResourceGroup: (subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + // (undocumented) + listConnectionStrings: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams) => Promise; + // (undocumented) + update: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams) => PollerLike, MongoCluster>; } -// @public -export type MongoClustersListResponse = MongoClusterListResult; - // @public export type MongoClusterStatus = string; -// @public -export interface MongoClustersUpdateHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface MongoClustersUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +// @public (undocumented) +export interface MongoClustersUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type MongoClustersUpdateResponse = MongoCluster; - // @public export interface MongoClusterUpdate { + // (undocumented) properties?: MongoClusterUpdateProperties; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public @@ -421,13 +261,6 @@ export interface MongoClusterUpdateProperties { serverVersion?: string; } -// @public -export interface NodeGroupProperties { - diskSizeGB?: number; - enableHa?: boolean; - sku?: string; -} - // @public export interface NodeGroupSpec { diskSizeGB?: number; @@ -442,7 +275,7 @@ export type NodeKind = string; // @public export interface Operation { - readonly actionType?: ActionType; + actionType?: ActionType; display?: OperationDisplay; readonly isDataAction?: boolean; readonly name?: string; @@ -451,43 +284,51 @@ export interface Operation { // @public export interface OperationDisplay { - readonly description?: string; - readonly operation?: string; - readonly provider?: string; - readonly resource?: string; + description?: string; + operation?: string; + provider?: string; + resource?: string; } -// @public -export interface OperationListResult { - readonly nextLink?: string; - readonly value?: Operation[]; +// @public (undocumented) +export interface OperationsListOptionalParams extends OperationOptions { } -// @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +// @public (undocumented) +export interface OperationsOperations { + // (undocumented) + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; } // @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { -} +export type Origin = string; // @public -export type OperationsListNextResponse = OperationListResult; +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} // @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { +export interface PagedOperation { + nextLink?: string; + value: Operation[]; } // @public -export type OperationsListResponse = OperationListResult; +export interface PageSettings { + continuationToken?: string; +} // @public -export type Origin = string; +export interface PrivateEndpoint { + id?: string; +} // @public -export interface PrivateEndpoint { - readonly id?: string; +export interface PrivateEndpointConnection extends ProxyResource { + properties?: PrivateEndpointConnectionProperties; } // @public @@ -495,11 +336,11 @@ export interface PrivateEndpointConnectionProperties { readonly groupIds?: string[]; privateEndpoint?: PrivateEndpoint; privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; - readonly provisioningState?: PrivateEndpointConnectionProvisioningState; + provisioningState?: PrivateEndpointConnectionProvisioningState; } // @public -export type PrivateEndpointConnectionProvisioningState = string; +export type PrivateEndpointConnectionProvisioningState = ResourceProvisioningState | "Creating" | "Deleting"; // @public export interface PrivateEndpointConnectionResource extends ProxyResource { @@ -512,67 +353,36 @@ export interface PrivateEndpointConnectionResourceListResult { value: PrivateEndpointConnectionResource[]; } -// @public -export interface PrivateEndpointConnections { - beginCreate(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams): Promise, PrivateEndpointConnectionsCreateResponse>>; - beginCreateAndWait(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams): Promise; - beginDelete(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, PrivateEndpointConnectionsDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise; - get(resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; - listByMongoCluster(resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface PrivateEndpointConnectionsCreateHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface PrivateEndpointConnectionsCreateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +// @public (undocumented) +export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type PrivateEndpointConnectionsCreateResponse = PrivateEndpointConnectionResource; - -// @public -export interface PrivateEndpointConnectionsDeleteHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface PrivateEndpointConnectionsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +// @public (undocumented) +export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type PrivateEndpointConnectionsDeleteResponse = PrivateEndpointConnectionsDeleteHeaders; - -// @public -export interface PrivateEndpointConnectionsGetOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { } -// @public -export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnectionResource; - -// @public -export interface PrivateEndpointConnectionsListByMongoClusterNextOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends OperationOptions { } -// @public -export type PrivateEndpointConnectionsListByMongoClusterNextResponse = PrivateEndpointConnectionResourceListResult; - -// @public -export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface PrivateEndpointConnectionsOperations { + // (undocumented) + create: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams) => PollerLike, void>; + // (undocumented) + delete: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, void>; + // (undocumented) + get: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams) => Promise; + // (undocumented) + listByMongoCluster: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type PrivateEndpointConnectionsListByMongoClusterResponse = PrivateEndpointConnectionResourceListResult; - // @public export type PrivateEndpointServiceConnectionStatus = string; @@ -594,11 +404,6 @@ export interface PrivateLinkResourceProperties { requiredZoneNames?: string[]; } -// @public -export interface PrivateLinks { - listByMongoCluster(resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): PagedAsyncIterableIterator; -} - // @public export interface PrivateLinkServiceConnectionState { actionsRequired?: string; @@ -606,22 +411,18 @@ export interface PrivateLinkServiceConnectionState { status?: PrivateEndpointServiceConnectionStatus; } -// @public -export interface PrivateLinksListByMongoClusterNextOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions { } -// @public -export type PrivateLinksListByMongoClusterNextResponse = PrivateLinkResourceListResult; - -// @public -export interface PrivateLinksListByMongoClusterOptionalParams extends coreClient.OperationOptions { +// @public (undocumented) +export interface PrivateLinksOperations { + // (undocumented) + listByMongoCluster: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; } // @public -export type PrivateLinksListByMongoClusterResponse = PrivateLinkResourceListResult; - -// @public -export type ProvisioningState = string; +export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; // @public export interface ProxyResource extends Resource { @@ -638,24 +439,40 @@ export interface Resource { readonly type?: string; } +// @public +export type ResourceProvisioningState = string; + +// Warning: (ae-forgotten-export) The symbol "DocumentDBContext" needs to be exported by the entry point index.d.ts +// +// @public +export function restorePoller(client: DocumentDBContext | MongoClusterManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + // @public export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; + readonly createdAt?: Date; + readonly createdBy?: string; + readonly createdByType?: CreatedByType; + readonly lastModifiedAt?: Date; + readonly lastModifiedBy?: string; + readonly lastModifiedByType?: CreatedByType; } // @public export interface TrackedResource extends Resource { location: string; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } +// @public (undocumented) +export type Versions = "2024-03-01-preview"; + // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/mongocluster/arm-mongocluster/rollup.config.js b/sdk/mongocluster/arm-mongocluster/rollup.config.js new file mode 100644 index 000000000000..61251d7a8d52 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/rollup.config.js @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && + warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"], + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true, + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"], + }), + cjs(), + json(), + sourcemaps(), + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false, + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false, +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}), + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies), + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()], + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); 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 7e774a982c6a..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesCreateOrUpdateSample.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - FirewallRule, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json - */ -async function createsAFirewallRuleOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const firewallRuleName = "rule1"; - const resource: FirewallRule = { - properties: { endIpAddress: "255.255.255.255", startIpAddress: "0.0.0.0" }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.beginCreateOrUpdateAndWait( - resourceGroupName, - mongoClusterName, - firewallRuleName, - resource, - ); - 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 8cc184a2867f..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesDeleteSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Deletes a mongo cluster firewall rule. - * - * @summary Deletes a mongo cluster firewall rule. - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json - */ -async function deletesAFirewallRuleOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const firewallRuleName = "rule1"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.beginDeleteAndWait( - resourceGroupName, - mongoClusterName, - firewallRuleName, - ); - console.log(result); -} - -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 6f5522e4bdc3..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesGetSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json - */ -async function getsAFirewallRuleOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const firewallRuleName = "rule1"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.get( - resourceGroupName, - mongoClusterName, - firewallRuleName, - ); - 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 1f024bdfd870..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/firewallRulesListByMongoClusterSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json - */ -async function listTheFirewallRulesOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.firewallRules.listByMongoCluster( - resourceGroupName, - mongoClusterName, - )) { - 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 8f1824f8cd28..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCheckNameAvailabilitySample.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - CheckNameAvailabilityRequest, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability.json - */ -async function checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const location = "westus2"; - const body: CheckNameAvailabilityRequest = { - name: "newmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability( - location, - body, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability_AlreadyExists.json - */ -async function checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const location = "westus2"; - const body: CheckNameAvailabilityRequest = { - name: "existingmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability( - location, - body, - ); - 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 3394ecc21bcd..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersCreateOrUpdateSample.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - MongoCluster, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json - */ -async function createsAMongoClusterResourceFromAPointInTimeRestore() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const resource: MongoCluster = { - 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", - }, - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginCreateOrUpdateAndWait( - resourceGroupName, - mongoClusterName, - resource, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Create.json - */ -async function createsANewMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const resource: MongoCluster = { - location: "westus2", - properties: { - administratorLogin: "mongoAdmin", - administratorLoginPassword: "password", - nodeGroupSpecs: [ - { - diskSizeGB: 128, - enableHa: true, - kind: "Shard", - nodeCount: 1, - sku: "M30", - }, - ], - serverVersion: "5.0", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginCreateOrUpdateAndWait( - resourceGroupName, - mongoClusterName, - resource, - ); - console.log(result); -} - -async function main() { - createsAMongoClusterResourceFromAPointInTimeRestore(); - createsANewMongoClusterResource(); -} - -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 fe5d3e06e2f3..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersDeleteSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Deletes a mongo cluster. - * - * @summary Deletes a mongo cluster. - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json - */ -async function deletesAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginDeleteAndWait( - resourceGroupName, - mongoClusterName, - ); - console.log(result); -} - -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 98324242105b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersGetSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Gets information about a mongo cluster. - * - * @summary Gets information about a mongo cluster. - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json - */ -async function getsAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.get( - resourceGroupName, - mongoClusterName, - ); - 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 3ea27e3f6d72..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListByResourceGroupSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListByResourceGroup.json - */ -async function listsTheMongoClusterResourcesInAResourceGroup() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.mongoClusters.listByResourceGroup( - resourceGroupName, - )) { - 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 636133e8155b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListConnectionStringsSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json - */ -async function listTheAvailableConnectionStringsForTheMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.listConnectionStrings( - resourceGroupName, - mongoClusterName, - ); - 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 6c5133e30a7c..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersListSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.json - */ -async function listsTheMongoClusterResourcesInASubscription() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const credential = new DefaultAzureCredential(); - 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/mongoClustersUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersUpdateSample.ts deleted file mode 100644 index 84535a01b292..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/mongoClustersUpdateSample.ts +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - MongoClusterUpdate, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json - */ -async function disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const properties: MongoClusterUpdate = { - properties: { publicNetworkAccess: "Disabled" }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginUpdateAndWait( - resourceGroupName, - mongoClusterName, - properties, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Update.json - */ -async function updatesAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const properties: MongoClusterUpdate = { - properties: { - administratorLogin: "mongoAdmin", - administratorLoginPassword: "password", - nodeGroupSpecs: [ - { - diskSizeGB: 256, - enableHa: true, - kind: "Shard", - nodeCount: 1, - sku: "M50", - }, - ], - publicNetworkAccess: "Enabled", - serverVersion: "5.0", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginUpdateAndWait( - resourceGroupName, - mongoClusterName, - properties, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchDiskSize.json - */ -async function updatesTheDiskSizeOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const properties: MongoClusterUpdate = { - properties: { nodeGroupSpecs: [{ diskSizeGB: 256, kind: "Shard" }] }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginUpdateAndWait( - resourceGroupName, - mongoClusterName, - properties, - ); - console.log(result); -} - -async function main() { - disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection(); - updatesAMongoClusterResource(); - updatesTheDiskSizeOnAMongoClusterResource(); -} - -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 47b012b2e0a5..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/operationsListSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json - */ -async function operationsList() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - 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 24b4f0372f45..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsCreateSample.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - PrivateEndpointConnectionResource, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Create a Private endpoint connection - * - * @summary Create a Private endpoint connection - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json - */ -async function approvesAPrivateEndpointConnectionOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const privateEndpointConnectionName = "pecTest"; - const resource: PrivateEndpointConnectionResource = { - properties: { - privateLinkServiceConnectionState: { - description: "Auto-Approved", - status: "Approved", - }, - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginCreateAndWait( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - resource, - ); - 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 e12539c18b1d..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsDeleteSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Delete the private endpoint connection - * - * @summary Delete the private endpoint connection - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json - */ -async function deleteAPrivateEndpointConnectionOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const privateEndpointConnectionName = - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginDeleteAndWait( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - ); - console.log(result); -} - -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 62815d50b848..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsGetSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get a specific private connection - * - * @summary Get a specific private connection - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json - */ -async function getAPrivateEndpointConnectionOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const privateEndpointConnectionName = - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.get( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - ); - 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 207827dd8e93..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateEndpointConnectionsListByMongoClusterSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List existing private connections - * - * @summary List existing private connections - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json - */ -async function listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateEndpointConnections.listByMongoCluster( - resourceGroupName, - mongoClusterName, - )) { - 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 538ac7a25abb..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples-dev/privateLinksListByMongoClusterSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to list private links on the given resource - * - * @summary list private links on the given resource - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json - */ -async function listsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateLinks.listByMongoCluster( - resourceGroupName, - mongoClusterName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listsThePrivateLinkResourcesAvailableOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/README.md b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/README.md deleted file mode 100644 index 82a958c28c69..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# client library samples for JavaScript (Beta) - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [firewallRulesCreateOrUpdateSample.js][firewallrulescreateorupdatesample] | Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json | -| [firewallRulesDeleteSample.js][firewallrulesdeletesample] | Deletes a mongo cluster firewall rule. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json | -| [firewallRulesGetSample.js][firewallrulesgetsample] | Gets information about a mongo cluster firewall rule. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json | -| [firewallRulesListByMongoClusterSample.js][firewallruleslistbymongoclustersample] | List all the firewall rules in a given mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json | -| [mongoClustersCheckNameAvailabilitySample.js][mongoclusterschecknameavailabilitysample] | Check if mongo cluster name is available for use. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json | -| [mongoClustersDeleteSample.js][mongoclustersdeletesample] | Deletes a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json | -| [mongoClustersGetSample.js][mongoclustersgetsample] | Gets information about a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json | -| [mongoClustersListByResourceGroupSample.js][mongoclusterslistbyresourcegroupsample] | List all the mongo clusters in a given resource group. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json | -| [mongoClustersListSample.js][mongoclusterslistsample] | List all the mongo clusters in a given subscription. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json | -| [operationsListSample.js][operationslistsample] | List the operations for the provider x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json | -| [privateEndpointConnectionsCreateSample.js][privateendpointconnectionscreatesample] | Create a Private endpoint connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json | -| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | Delete the private endpoint connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json | -| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | Get a specific private connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json | -| [privateEndpointConnectionsListByMongoClusterSample.js][privateendpointconnectionslistbymongoclustersample] | List existing private connections x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json | -| [privateLinksListByMongoClusterSample.js][privatelinkslistbymongoclustersample] | list private links on the given resource x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node firewallRulesCreateOrUpdateSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx cross-env MONGOCLUSTER_SUBSCRIPTION_ID="" MONGOCLUSTER_RESOURCE_GROUP="" 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-beta/javascript/firewallRulesCreateOrUpdateSample.js -[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js -[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js -[firewallruleslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js -[mongoclusterschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js -[mongoclusterscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js -[mongoclustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js -[mongoclustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js -[mongoclusterslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js -[mongoclusterslistconnectionstringssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js -[mongoclusterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js -[mongoclustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersUpdateSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js -[privateendpointconnectionscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js -[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js -[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js -[privateendpointconnectionslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js -[privatelinkslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.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-beta/javascript/firewallRulesCreateOrUpdateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesCreateOrUpdateSample.js deleted file mode 100644 index a440437ed92c..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesCreateOrUpdateSample.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json - */ -async function createsAFirewallRuleOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const firewallRuleName = "rule1"; - const resource = { - properties: { endIpAddress: "255.255.255.255", startIpAddress: "0.0.0.0" }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.beginCreateOrUpdateAndWait( - resourceGroupName, - mongoClusterName, - firewallRuleName, - resource, - ); - console.log(result); -} - -async function main() { - createsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js deleted file mode 100644 index 5a7aadc146d7..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesDeleteSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Deletes a mongo cluster firewall rule. - * - * @summary Deletes a mongo cluster firewall rule. - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json - */ -async function deletesAFirewallRuleOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const firewallRuleName = "rule1"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.beginDeleteAndWait( - resourceGroupName, - mongoClusterName, - firewallRuleName, - ); - console.log(result); -} - -async function main() { - deletesAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js deleted file mode 100644 index 9121571b8014..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesGetSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json - */ -async function getsAFirewallRuleOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const firewallRuleName = "rule1"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.get( - resourceGroupName, - mongoClusterName, - firewallRuleName, - ); - console.log(result); -} - -async function main() { - getsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js deleted file mode 100644 index 4ef0f6bab354..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/firewallRulesListByMongoClusterSample.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json - */ -async function listTheFirewallRulesOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.firewallRules.listByMongoCluster( - resourceGroupName, - mongoClusterName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listTheFirewallRulesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js deleted file mode 100644 index 7fe909e4e311..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCheckNameAvailabilitySample.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability.json - */ -async function checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const location = "westus2"; - const body = { - name: "newmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability(location, body); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability_AlreadyExists.json - */ -async function checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const location = "westus2"; - const body = { - name: "existingmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability(location, body); - console.log(result); -} - -async function main() { - checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse(); - checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js deleted file mode 100644 index 81d7263e8afe..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersCreateOrUpdateSample.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json - */ -async function createsAMongoClusterResourceFromAPointInTimeRestore() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const resource = { - 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", - }, - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginCreateOrUpdateAndWait( - resourceGroupName, - mongoClusterName, - resource, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Create.json - */ -async function createsANewMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const resource = { - location: "westus2", - properties: { - administratorLogin: "mongoAdmin", - administratorLoginPassword: "password", - nodeGroupSpecs: [ - { - diskSizeGB: 128, - enableHa: true, - kind: "Shard", - nodeCount: 1, - sku: "M30", - }, - ], - serverVersion: "5.0", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginCreateOrUpdateAndWait( - resourceGroupName, - mongoClusterName, - resource, - ); - console.log(result); -} - -async function main() { - createsAMongoClusterResourceFromAPointInTimeRestore(); - createsANewMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js deleted file mode 100644 index f4d3c11d4183..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersDeleteSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Deletes a mongo cluster. - * - * @summary Deletes a mongo cluster. - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json - */ -async function deletesAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginDeleteAndWait(resourceGroupName, mongoClusterName); - console.log(result); -} - -async function main() { - deletesAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js deleted file mode 100644 index 788ce24b4962..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersGetSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets information about a mongo cluster. - * - * @summary Gets information about a mongo cluster. - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json - */ -async function getsAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.get(resourceGroupName, mongoClusterName); - console.log(result); -} - -async function main() { - getsAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js deleted file mode 100644 index c9abca9ac2ad..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListByResourceGroupSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListByResourceGroup.json - */ -async function listsTheMongoClusterResourcesInAResourceGroup() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.mongoClusters.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listsTheMongoClusterResourcesInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js deleted file mode 100644 index f4f1a7f9364e..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListConnectionStringsSample.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json - */ -async function listTheAvailableConnectionStringsForTheMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.listConnectionStrings( - resourceGroupName, - mongoClusterName, - ); - console.log(result); -} - -async function main() { - listTheAvailableConnectionStringsForTheMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js deleted file mode 100644 index f426237e666c..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersListSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.json - */ -async function listsTheMongoClusterResourcesInASubscription() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const credential = new DefaultAzureCredential(); - 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-beta/javascript/mongoClustersUpdateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersUpdateSample.js deleted file mode 100644 index a61f2cd5d7b6..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/mongoClustersUpdateSample.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json - */ -async function disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const properties = { - properties: { publicNetworkAccess: "Disabled" }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginUpdateAndWait( - resourceGroupName, - mongoClusterName, - properties, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Update.json - */ -async function updatesAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const properties = { - properties: { - administratorLogin: "mongoAdmin", - administratorLoginPassword: "password", - nodeGroupSpecs: [ - { - diskSizeGB: 256, - enableHa: true, - kind: "Shard", - nodeCount: 1, - sku: "M50", - }, - ], - publicNetworkAccess: "Enabled", - serverVersion: "5.0", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginUpdateAndWait( - resourceGroupName, - mongoClusterName, - properties, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchDiskSize.json - */ -async function updatesTheDiskSizeOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const properties = { - properties: { nodeGroupSpecs: [{ diskSizeGB: 256, kind: "Shard" }] }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginUpdateAndWait( - resourceGroupName, - mongoClusterName, - properties, - ); - console.log(result); -} - -async function main() { - disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection(); - updatesAMongoClusterResource(); - updatesTheDiskSizeOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js deleted file mode 100644 index ab9dce7ae27d..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/operationsListSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json - */ -async function operationsList() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - 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-beta/javascript/package.json b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/package.json deleted file mode 100644 index 763aaef20942..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@azure-samples/arm-mongocluster-js-beta", - "private": true, - "version": "1.0.0", - "description": " client library samples for JavaScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/mongocluster/arm-mongocluster" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mongocluster/arm-mongocluster", - "dependencies": { - "@azure/arm-mongocluster": "next", - "dotenv": "latest", - "@azure/identity": "^4.0.1" - } -} diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js deleted file mode 100644 index 643d481edc42..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsCreateSample.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create a Private endpoint connection - * - * @summary Create a Private endpoint connection - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json - */ -async function approvesAPrivateEndpointConnectionOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const privateEndpointConnectionName = "pecTest"; - const resource = { - properties: { - privateLinkServiceConnectionState: { - description: "Auto-Approved", - status: "Approved", - }, - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginCreateAndWait( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - resource, - ); - console.log(result); -} - -async function main() { - approvesAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js deleted file mode 100644 index f81ec95f902b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete the private endpoint connection - * - * @summary Delete the private endpoint connection - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json - */ -async function deleteAPrivateEndpointConnectionOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const privateEndpointConnectionName = "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginDeleteAndWait( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - ); - console.log(result); -} - -async function main() { - deleteAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js deleted file mode 100644 index 5ded4e300eb9..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a specific private connection - * - * @summary Get a specific private connection - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json - */ -async function getAPrivateEndpointConnectionOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const privateEndpointConnectionName = "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.get( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - ); - console.log(result); -} - -async function main() { - getAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js deleted file mode 100644 index 5d0abd64a89a..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateEndpointConnectionsListByMongoClusterSample.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List existing private connections - * - * @summary List existing private connections - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json - */ -async function listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateEndpointConnections.listByMongoCluster( - resourceGroupName, - mongoClusterName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.js b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.js deleted file mode 100644 index a89badeec4e6..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/privateLinksListByMongoClusterSample.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { MongoClusterManagementClient } = require("@azure/arm-mongocluster"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to list private links on the given resource - * - * @summary list private links on the given resource - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json - */ -async function listsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateLinks.listByMongoCluster( - resourceGroupName, - mongoClusterName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listsThePrivateLinkResourcesAvailableOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/sample.env b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/README.md b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/README.md deleted file mode 100644 index ac99ab1ef19d..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# client library samples for TypeScript (Beta) - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [firewallRulesCreateOrUpdateSample.ts][firewallrulescreateorupdatesample] | Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json | -| [firewallRulesDeleteSample.ts][firewallrulesdeletesample] | Deletes a mongo cluster firewall rule. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json | -| [firewallRulesGetSample.ts][firewallrulesgetsample] | Gets information about a mongo cluster firewall rule. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json | -| [firewallRulesListByMongoClusterSample.ts][firewallruleslistbymongoclustersample] | List all the firewall rules in a given mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json | -| [mongoClustersCheckNameAvailabilitySample.ts][mongoclusterschecknameavailabilitysample] | Check if mongo cluster name is available for use. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json | -| [mongoClustersDeleteSample.ts][mongoclustersdeletesample] | Deletes a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json | -| [mongoClustersGetSample.ts][mongoclustersgetsample] | Gets information about a mongo cluster. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json | -| [mongoClustersListByResourceGroupSample.ts][mongoclusterslistbyresourcegroupsample] | List all the mongo clusters in a given resource group. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json | -| [mongoClustersListSample.ts][mongoclusterslistsample] | List all the mongo clusters in a given subscription. x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json | -| [operationsListSample.ts][operationslistsample] | List the operations for the provider x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json | -| [privateEndpointConnectionsCreateSample.ts][privateendpointconnectionscreatesample] | Create a Private endpoint connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json | -| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | Delete the private endpoint connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json | -| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | Get a specific private connection x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json | -| [privateEndpointConnectionsListByMongoClusterSample.ts][privateendpointconnectionslistbymongoclustersample] | List existing private connections x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json | -| [privateLinksListByMongoClusterSample.ts][privatelinkslistbymongoclustersample] | list private links on the given resource x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/firewallRulesCreateOrUpdateSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx cross-env MONGOCLUSTER_SUBSCRIPTION_ID="" MONGOCLUSTER_RESOURCE_GROUP="" 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-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts -[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts -[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts -[firewallruleslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts -[mongoclusterschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts -[mongoclusterscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts -[mongoclustersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts -[mongoclustersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts -[mongoclusterslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts -[mongoclusterslistconnectionstringssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts -[mongoclusterslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts -[mongoclustersupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersUpdateSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts -[privateendpointconnectionscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateSample.ts -[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts -[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts -[privateendpointconnectionslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts -[privatelinkslistbymongoclustersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.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-beta/typescript/package.json b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/package.json deleted file mode 100644 index 2eccd45d4315..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@azure-samples/arm-mongocluster-ts-beta", - "private": true, - "version": "1.0.0", - "description": " client library samples for TypeScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/mongocluster/arm-mongocluster" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mongocluster/arm-mongocluster", - "dependencies": { - "@azure/arm-mongocluster": "next", - "dotenv": "latest", - "@azure/identity": "^4.0.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.4.5", - "rimraf": "latest" - } -} diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/sample.env b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts deleted file mode 100644 index 7e774a982c6a..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesCreateOrUpdateSample.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - FirewallRule, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json - */ -async function createsAFirewallRuleOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const firewallRuleName = "rule1"; - const resource: FirewallRule = { - properties: { endIpAddress: "255.255.255.255", startIpAddress: "0.0.0.0" }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.beginCreateOrUpdateAndWait( - resourceGroupName, - mongoClusterName, - firewallRuleName, - resource, - ); - console.log(result); -} - -async function main() { - createsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts deleted file mode 100644 index 8cc184a2867f..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesDeleteSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Deletes a mongo cluster firewall rule. - * - * @summary Deletes a mongo cluster firewall rule. - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json - */ -async function deletesAFirewallRuleOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const firewallRuleName = "rule1"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.beginDeleteAndWait( - resourceGroupName, - mongoClusterName, - firewallRuleName, - ); - console.log(result); -} - -async function main() { - deletesAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts deleted file mode 100644 index 6f5522e4bdc3..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesGetSample.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json - */ -async function getsAFirewallRuleOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const firewallRuleName = "rule1"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.firewallRules.get( - resourceGroupName, - mongoClusterName, - firewallRuleName, - ); - console.log(result); -} - -async function main() { - getsAFirewallRuleOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts deleted file mode 100644 index 1f024bdfd870..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/firewallRulesListByMongoClusterSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json - */ -async function listTheFirewallRulesOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.firewallRules.listByMongoCluster( - resourceGroupName, - mongoClusterName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listTheFirewallRulesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts deleted file mode 100644 index 8f1824f8cd28..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCheckNameAvailabilitySample.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - CheckNameAvailabilityRequest, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability.json - */ -async function checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const location = "westus2"; - const body: CheckNameAvailabilityRequest = { - name: "newmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability( - location, - body, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability_AlreadyExists.json - */ -async function checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const location = "westus2"; - const body: CheckNameAvailabilityRequest = { - name: "existingmongocluster", - type: "Microsoft.DocumentDB/mongoClusters", - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.checkNameAvailability( - location, - body, - ); - console.log(result); -} - -async function main() { - checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse(); - checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts deleted file mode 100644 index 3394ecc21bcd..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersCreateOrUpdateSample.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - MongoCluster, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json - */ -async function createsAMongoClusterResourceFromAPointInTimeRestore() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const resource: MongoCluster = { - 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", - }, - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginCreateOrUpdateAndWait( - resourceGroupName, - mongoClusterName, - resource, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Create.json - */ -async function createsANewMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const resource: MongoCluster = { - location: "westus2", - properties: { - administratorLogin: "mongoAdmin", - administratorLoginPassword: "password", - nodeGroupSpecs: [ - { - diskSizeGB: 128, - enableHa: true, - kind: "Shard", - nodeCount: 1, - sku: "M30", - }, - ], - serverVersion: "5.0", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginCreateOrUpdateAndWait( - resourceGroupName, - mongoClusterName, - resource, - ); - console.log(result); -} - -async function main() { - createsAMongoClusterResourceFromAPointInTimeRestore(); - createsANewMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts deleted file mode 100644 index fe5d3e06e2f3..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersDeleteSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Deletes a mongo cluster. - * - * @summary Deletes a mongo cluster. - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json - */ -async function deletesAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginDeleteAndWait( - resourceGroupName, - mongoClusterName, - ); - console.log(result); -} - -async function main() { - deletesAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts deleted file mode 100644 index 98324242105b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersGetSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Gets information about a mongo cluster. - * - * @summary Gets information about a mongo cluster. - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json - */ -async function getsAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.get( - resourceGroupName, - mongoClusterName, - ); - console.log(result); -} - -async function main() { - getsAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts deleted file mode 100644 index 3ea27e3f6d72..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListByResourceGroupSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListByResourceGroup.json - */ -async function listsTheMongoClusterResourcesInAResourceGroup() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.mongoClusters.listByResourceGroup( - resourceGroupName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listsTheMongoClusterResourcesInAResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts deleted file mode 100644 index 636133e8155b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListConnectionStringsSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json - */ -async function listTheAvailableConnectionStringsForTheMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.listConnectionStrings( - resourceGroupName, - mongoClusterName, - ); - console.log(result); -} - -async function main() { - listTheAvailableConnectionStringsForTheMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts deleted file mode 100644 index 6c5133e30a7c..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersListSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.json - */ -async function listsTheMongoClusterResourcesInASubscription() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const credential = new DefaultAzureCredential(); - 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-beta/typescript/src/mongoClustersUpdateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersUpdateSample.ts deleted file mode 100644 index 84535a01b292..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/mongoClustersUpdateSample.ts +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - MongoClusterUpdate, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json - */ -async function disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const properties: MongoClusterUpdate = { - properties: { publicNetworkAccess: "Disabled" }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginUpdateAndWait( - resourceGroupName, - mongoClusterName, - properties, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Update.json - */ -async function updatesAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const properties: MongoClusterUpdate = { - properties: { - administratorLogin: "mongoAdmin", - administratorLoginPassword: "password", - nodeGroupSpecs: [ - { - diskSizeGB: 256, - enableHa: true, - kind: "Shard", - nodeCount: 1, - sku: "M50", - }, - ], - publicNetworkAccess: "Enabled", - serverVersion: "5.0", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginUpdateAndWait( - resourceGroupName, - mongoClusterName, - properties, - ); - 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: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchDiskSize.json - */ -async function updatesTheDiskSizeOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestResourceGroup"; - const mongoClusterName = "myMongoCluster"; - const properties: MongoClusterUpdate = { - properties: { nodeGroupSpecs: [{ diskSizeGB: 256, kind: "Shard" }] }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.mongoClusters.beginUpdateAndWait( - resourceGroupName, - mongoClusterName, - properties, - ); - console.log(result); -} - -async function main() { - disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection(); - updatesAMongoClusterResource(); - updatesTheDiskSizeOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts deleted file mode 100644 index 47b012b2e0a5..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json - */ -async function operationsList() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - 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-beta/typescript/src/privateEndpointConnectionsCreateSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateSample.ts deleted file mode 100644 index 24b4f0372f45..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateSample.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - PrivateEndpointConnectionResource, - MongoClusterManagementClient, -} from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Create a Private endpoint connection - * - * @summary Create a Private endpoint connection - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json - */ -async function approvesAPrivateEndpointConnectionOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const privateEndpointConnectionName = "pecTest"; - const resource: PrivateEndpointConnectionResource = { - properties: { - privateLinkServiceConnectionState: { - description: "Auto-Approved", - status: "Approved", - }, - }, - }; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginCreateAndWait( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - resource, - ); - console.log(result); -} - -async function main() { - approvesAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts deleted file mode 100644 index e12539c18b1d..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Delete the private endpoint connection - * - * @summary Delete the private endpoint connection - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json - */ -async function deleteAPrivateEndpointConnectionOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const privateEndpointConnectionName = - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.beginDeleteAndWait( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - ); - console.log(result); -} - -async function main() { - deleteAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts deleted file mode 100644 index 62815d50b848..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get a specific private connection - * - * @summary Get a specific private connection - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json - */ -async function getAPrivateEndpointConnectionOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const privateEndpointConnectionName = - "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const result = await client.privateEndpointConnections.get( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - ); - console.log(result); -} - -async function main() { - getAPrivateEndpointConnectionOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts deleted file mode 100644 index 207827dd8e93..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateEndpointConnectionsListByMongoClusterSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List existing private connections - * - * @summary List existing private connections - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json - */ -async function listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateEndpointConnections.listByMongoCluster( - resourceGroupName, - mongoClusterName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.ts b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.ts deleted file mode 100644 index 538ac7a25abb..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/src/privateLinksListByMongoClusterSample.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { MongoClusterManagementClient } from "@azure/arm-mongocluster"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to list private links on the given resource - * - * @summary list private links on the given resource - * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json - */ -async function listsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { - const subscriptionId = - process.env["MONGOCLUSTER_SUBSCRIPTION_ID"] || - "ffffffff-ffff-ffff-ffff-ffffffffffff"; - const resourceGroupName = - process.env["MONGOCLUSTER_RESOURCE_GROUP"] || "TestGroup"; - const mongoClusterName = "myMongoCluster"; - const credential = new DefaultAzureCredential(); - const client = new MongoClusterManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.privateLinks.listByMongoCluster( - resourceGroupName, - mongoClusterName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - listsThePrivateLinkResourcesAvailableOnAMongoClusterResource(); -} - -main().catch(console.error); diff --git a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/tsconfig.json b/sdk/mongocluster/arm-mongocluster/samples/v1-beta/typescript/tsconfig.json deleted file mode 100644 index e26ce2a6d8f7..000000000000 --- a/sdk/mongocluster/arm-mongocluster/samples/v1-beta/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 new file mode 100644 index 000000000000..bd7b5cd037e2 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getLongRunningPoller } from "../pollingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { FirewallRule, FirewallRuleListResult } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { buildPagedAsyncIterator } from "../pagingHelpers.js"; +import { + isUnexpected, + DocumentDBContext as Client, + FirewallRulesCreateOrUpdate200Response, + FirewallRulesCreateOrUpdate201Response, + FirewallRulesCreateOrUpdate202Response, + FirewallRulesCreateOrUpdateDefaultResponse, + FirewallRulesCreateOrUpdateLogicalResponse, + FirewallRulesDelete202Response, + FirewallRulesDelete204Response, + FirewallRulesDeleteDefaultResponse, + FirewallRulesDeleteLogicalResponse, + FirewallRulesGet200Response, + FirewallRulesGetDefaultResponse, + FirewallRulesListByMongoCluster200Response, + FirewallRulesListByMongoClusterDefaultResponse, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + FirewallRulesGetOptionalParams, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesListByMongoClusterOptionalParams, +} from "../../models/options.js"; + +export function _firewallRulesGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options: FirewallRulesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod< + FirewallRulesGet200Response | FirewallRulesGetDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _firewallRulesGetDeserialize( + result: FirewallRulesGet200Response | FirewallRulesGetDefaultResponse, +): Promise { + if (isUnexpected(result)) { + 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"], + }, + }; +} + +/** Gets information about a mongo cluster firewall rule. */ +export async function firewallRulesGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options: FirewallRulesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _firewallRulesGetSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + options, + ); + return _firewallRulesGetDeserialize(result); +} + +export function _firewallRulesCreateOrUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + resource: FirewallRule, + options: FirewallRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod< + | FirewallRulesCreateOrUpdate200Response + | FirewallRulesCreateOrUpdate201Response + | FirewallRulesCreateOrUpdate202Response + | FirewallRulesCreateOrUpdateDefaultResponse + | FirewallRulesCreateOrUpdateLogicalResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: { + properties: !resource.properties + ? undefined + : { + startIpAddress: resource.properties?.["startIpAddress"], + endIpAddress: resource.properties?.["endIpAddress"], + }, + }, + }); +} + +export async function _firewallRulesCreateOrUpdateDeserialize( + result: + | FirewallRulesCreateOrUpdate200Response + | FirewallRulesCreateOrUpdate201Response + | FirewallRulesCreateOrUpdate202Response + | FirewallRulesCreateOrUpdateDefaultResponse + | FirewallRulesCreateOrUpdateLogicalResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + result = result as FirewallRulesCreateOrUpdateLogicalResponse; + return; +} + +/** Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. */ +export function firewallRulesCreateOrUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + resource: FirewallRule, + options: FirewallRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _firewallRulesCreateOrUpdateDeserialize, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _firewallRulesCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + resource, + options, + ), + }, + ) as PollerLike, void>; +} + +export function _firewallRulesDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options: FirewallRulesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod< + | FirewallRulesDelete202Response + | FirewallRulesDelete204Response + | FirewallRulesDeleteDefaultResponse + | FirewallRulesDeleteLogicalResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _firewallRulesDeleteDeserialize( + result: + | FirewallRulesDelete202Response + | FirewallRulesDelete204Response + | FirewallRulesDeleteDefaultResponse + | FirewallRulesDeleteLogicalResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + result = result as FirewallRulesDeleteLogicalResponse; + return; +} + +/** Deletes a mongo cluster firewall rule. */ +export function firewallRulesDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options: FirewallRulesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _firewallRulesDeleteDeserialize, { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _firewallRulesDeleteSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + options, + ), + }) as PollerLike, void>; +} + +export function _firewallRulesListByMongoClusterSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: FirewallRulesListByMongoClusterOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | FirewallRulesListByMongoCluster200Response + | FirewallRulesListByMongoClusterDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules", + subscriptionId, + resourceGroupName, + mongoClusterName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _firewallRulesListByMongoClusterDeserialize( + result: + | FirewallRulesListByMongoCluster200Response + | FirewallRulesListByMongoClusterDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + value: result.body["value"].map((p) => ({ + 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"], + }; +} + +/** List all the firewall rules in a given mongo cluster. */ +export function firewallRulesListByMongoCluster( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: FirewallRulesListByMongoClusterOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _firewallRulesListByMongoClusterSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + _firewallRulesListByMongoClusterDeserialize, + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/mongocluster/arm-mongocluster/src/api/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/index.ts new file mode 100644 index 000000000000..bd5bfb1769b5 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/api/index.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + createMongoClusterManagement, + MongoClusterManagementClientOptions, + DocumentDBContext, +} from "./mongoClusterManagementContext.js"; +export { + firewallRulesGet, + firewallRulesCreateOrUpdate, + firewallRulesDelete, + firewallRulesListByMongoCluster, +} from "./firewallRules/index.js"; +export { + mongoClustersGet, + mongoClustersCreateOrUpdate, + mongoClustersUpdate, + mongoClustersDelete, + mongoClustersListByResourceGroup, + mongoClustersList, + mongoClustersListConnectionStrings, + mongoClustersCheckNameAvailability, +} from "./mongoClusters/index.js"; +export { operationsList } from "./operations/index.js"; +export { + privateEndpointConnectionsListByMongoCluster, + privateEndpointConnectionsGet, + privateEndpointConnectionsCreate, + privateEndpointConnectionsDelete, +} from "./privateEndpointConnections/index.js"; +export { privateLinksListByMongoCluster } from "./privateLinks/index.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts new file mode 100644 index 000000000000..5f1309baa7d0 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { TokenCredential } from "@azure/core-auth"; +import { ClientOptions } from "@azure-rest/core-client"; +import { DocumentDBContext } from "../rest/index.js"; +import getClient from "../rest/index.js"; + +export interface MongoClusterManagementClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} + +export { DocumentDBContext } from "../rest/index.js"; + +/** 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 function createMongoClusterManagement( + credential: TokenCredential, + options: MongoClusterManagementClientOptions = {}, +): DocumentDBContext { + const clientContext = getClient(credential, options); + return clientContext; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts new file mode 100644 index 000000000000..cbe2b362b813 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts @@ -0,0 +1,1136 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getLongRunningPoller } from "../pollingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + MongoCluster, + MongoClusterUpdate, + MongoClusterListResult, + ListConnectionStringsResult, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { buildPagedAsyncIterator } from "../pagingHelpers.js"; +import { + isUnexpected, + DocumentDBContext as Client, + MongoClustersCheckNameAvailability200Response, + MongoClustersCheckNameAvailabilityDefaultResponse, + MongoClustersCreateOrUpdate200Response, + MongoClustersCreateOrUpdate201Response, + MongoClustersCreateOrUpdateDefaultResponse, + MongoClustersCreateOrUpdateLogicalResponse, + MongoClustersDelete202Response, + MongoClustersDelete204Response, + MongoClustersDeleteDefaultResponse, + MongoClustersDeleteLogicalResponse, + MongoClustersGet200Response, + MongoClustersGetDefaultResponse, + MongoClustersList200Response, + MongoClustersListByResourceGroup200Response, + MongoClustersListByResourceGroupDefaultResponse, + MongoClustersListConnectionStrings200Response, + MongoClustersListConnectionStringsDefaultResponse, + MongoClustersListDefaultResponse, + MongoClustersUpdate200Response, + MongoClustersUpdate202Response, + MongoClustersUpdateDefaultResponse, + MongoClustersUpdateLogicalResponse, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + MongoClustersGetOptionalParams, + MongoClustersCreateOrUpdateOptionalParams, + MongoClustersUpdateOptionalParams, + MongoClustersDeleteOptionalParams, + MongoClustersListByResourceGroupOptionalParams, + MongoClustersListOptionalParams, + MongoClustersListConnectionStringsOptionalParams, + MongoClustersCheckNameAvailabilityOptionalParams, +} from "../../models/options.js"; + +export function _mongoClustersGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: MongoClustersGetOptionalParams = { requestOptions: {} }, +): StreamableMethod< + MongoClustersGet200Response | MongoClustersGetDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _mongoClustersGetDeserialize( + result: MongoClustersGet200Response | MongoClustersGetDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + location: result.body["location"], + tags: result.body["tags"], + 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" + ], + }, + administratorLogin: result.body.properties?.["administratorLogin"], + administratorLoginPassword: + result.body.properties?.["administratorLoginPassword"], + serverVersion: result.body.properties?.["serverVersion"], + connectionString: result.body.properties?.["connectionString"], + earliestRestoreTime: result.body.properties?.["earliestRestoreTime"], + provisioningState: result.body.properties?.["provisioningState"], + clusterStatus: result.body.properties?.["clusterStatus"], + publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], + nodeGroupSpecs: + result.body.properties?.["nodeGroupSpecs"] === undefined + ? result.body.properties?.["nodeGroupSpecs"] + : result.body.properties?.["nodeGroupSpecs"].map((p) => ({ + sku: p["sku"], + diskSizeGB: p["diskSizeGB"], + enableHa: p["enableHa"], + kind: p["kind"], + nodeCount: p["nodeCount"], + })), + privateEndpointConnections: + result.body.properties?.["privateEndpointConnections"] === undefined + ? result.body.properties?.["privateEndpointConnections"] + : result.body.properties?.["privateEndpointConnections"].map( + (p) => ({ + 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"], + }, + }), + ), + }, + }; +} + +/** Gets information about a mongo cluster. */ +export async function mongoClustersGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: MongoClustersGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _mongoClustersGetSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ); + return _mongoClustersGetDeserialize(result); +} + +export function _mongoClustersCreateOrUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + resource: MongoCluster, + options: MongoClustersCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod< + | MongoClustersCreateOrUpdate200Response + | MongoClustersCreateOrUpdate201Response + | MongoClustersCreateOrUpdateDefaultResponse + | MongoClustersCreateOrUpdateLogicalResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: { + location: resource["location"], + tags: resource["tags"], + properties: !resource.properties + ? undefined + : { + createMode: resource.properties?.["createMode"], + restoreParameters: !resource.properties?.restoreParameters + ? undefined + : { + pointInTimeUTC: + resource.properties?.restoreParameters?.[ + "pointInTimeUTC" + ]?.toISOString(), + sourceResourceId: + resource.properties?.restoreParameters?.[ + "sourceResourceId" + ], + }, + administratorLogin: resource.properties?.["administratorLogin"], + administratorLoginPassword: + resource.properties?.["administratorLoginPassword"], + serverVersion: resource.properties?.["serverVersion"], + publicNetworkAccess: resource.properties?.["publicNetworkAccess"], + nodeGroupSpecs: + resource.properties?.["nodeGroupSpecs"] === undefined + ? resource.properties?.["nodeGroupSpecs"] + : resource.properties?.["nodeGroupSpecs"].map((p) => ({ + sku: p["sku"], + diskSizeGB: p["diskSizeGB"], + enableHa: p["enableHa"], + kind: p["kind"], + nodeCount: p["nodeCount"], + })), + }, + }, + }); +} + +export async function _mongoClustersCreateOrUpdateDeserialize( + result: + | MongoClustersCreateOrUpdate200Response + | MongoClustersCreateOrUpdate201Response + | MongoClustersCreateOrUpdateDefaultResponse + | MongoClustersCreateOrUpdateLogicalResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + result = result as MongoClustersCreateOrUpdateLogicalResponse; + return { + location: result.body["location"], + tags: result.body["tags"], + 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" + ], + }, + administratorLogin: result.body.properties?.["administratorLogin"], + administratorLoginPassword: + result.body.properties?.["administratorLoginPassword"], + serverVersion: result.body.properties?.["serverVersion"], + connectionString: result.body.properties?.["connectionString"], + earliestRestoreTime: result.body.properties?.["earliestRestoreTime"], + provisioningState: result.body.properties?.["provisioningState"], + clusterStatus: result.body.properties?.["clusterStatus"], + publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], + nodeGroupSpecs: + result.body.properties?.["nodeGroupSpecs"] === undefined + ? result.body.properties?.["nodeGroupSpecs"] + : result.body.properties?.["nodeGroupSpecs"].map((p) => ({ + sku: p["sku"], + diskSizeGB: p["diskSizeGB"], + enableHa: p["enableHa"], + kind: p["kind"], + nodeCount: p["nodeCount"], + })), + privateEndpointConnections: + result.body.properties?.["privateEndpointConnections"] === undefined + ? result.body.properties?.["privateEndpointConnections"] + : result.body.properties?.["privateEndpointConnections"].map( + (p) => ({ + 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"], + }, + }), + ), + }, + }; +} + +/** Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. */ +export function mongoClustersCreateOrUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + resource: MongoCluster, + options: MongoClustersCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, MongoCluster> { + return getLongRunningPoller( + context, + _mongoClustersCreateOrUpdateDeserialize, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _mongoClustersCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + resource, + options, + ), + }, + ) as PollerLike, MongoCluster>; +} + +export function _mongoClustersUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + properties: MongoClusterUpdate, + options: MongoClustersUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod< + | MongoClustersUpdate200Response + | MongoClustersUpdate202Response + | MongoClustersUpdateDefaultResponse + | MongoClustersUpdateLogicalResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + body: { + tags: properties["tags"], + properties: !properties.properties + ? undefined + : { + administratorLogin: properties.properties?.["administratorLogin"], + administratorLoginPassword: + properties.properties?.["administratorLoginPassword"], + serverVersion: properties.properties?.["serverVersion"], + publicNetworkAccess: + properties.properties?.["publicNetworkAccess"], + nodeGroupSpecs: + properties.properties?.["nodeGroupSpecs"] === undefined + ? properties.properties?.["nodeGroupSpecs"] + : properties.properties?.["nodeGroupSpecs"].map((p) => ({ + sku: p["sku"], + diskSizeGB: p["diskSizeGB"], + enableHa: p["enableHa"], + kind: p["kind"], + nodeCount: p["nodeCount"], + })), + }, + }, + }); +} + +export async function _mongoClustersUpdateDeserialize( + result: + | MongoClustersUpdate200Response + | MongoClustersUpdate202Response + | MongoClustersUpdateDefaultResponse + | MongoClustersUpdateLogicalResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + result = result as MongoClustersUpdateLogicalResponse; + return { + location: result.body["location"], + tags: result.body["tags"], + 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" + ], + }, + administratorLogin: result.body.properties?.["administratorLogin"], + administratorLoginPassword: + result.body.properties?.["administratorLoginPassword"], + serverVersion: result.body.properties?.["serverVersion"], + connectionString: result.body.properties?.["connectionString"], + earliestRestoreTime: result.body.properties?.["earliestRestoreTime"], + provisioningState: result.body.properties?.["provisioningState"], + clusterStatus: result.body.properties?.["clusterStatus"], + publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], + nodeGroupSpecs: + result.body.properties?.["nodeGroupSpecs"] === undefined + ? result.body.properties?.["nodeGroupSpecs"] + : result.body.properties?.["nodeGroupSpecs"].map((p) => ({ + sku: p["sku"], + diskSizeGB: p["diskSizeGB"], + enableHa: p["enableHa"], + kind: p["kind"], + nodeCount: p["nodeCount"], + })), + privateEndpointConnections: + result.body.properties?.["privateEndpointConnections"] === undefined + ? result.body.properties?.["privateEndpointConnections"] + : result.body.properties?.["privateEndpointConnections"].map( + (p) => ({ + 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"], + }, + }), + ), + }, + }; +} + +/** Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. */ +export function mongoClustersUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + properties: MongoClusterUpdate, + options: MongoClustersUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, MongoCluster> { + return getLongRunningPoller(context, _mongoClustersUpdateDeserialize, { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _mongoClustersUpdateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + properties, + options, + ), + }) as PollerLike, MongoCluster>; +} + +export function _mongoClustersDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: MongoClustersDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod< + | MongoClustersDelete202Response + | MongoClustersDelete204Response + | MongoClustersDeleteDefaultResponse + | MongoClustersDeleteLogicalResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _mongoClustersDeleteDeserialize( + result: + | MongoClustersDelete202Response + | MongoClustersDelete204Response + | MongoClustersDeleteDefaultResponse + | MongoClustersDeleteLogicalResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + result = result as MongoClustersDeleteLogicalResponse; + return; +} + +/** Deletes a mongo cluster. */ +export function mongoClustersDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: MongoClustersDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _mongoClustersDeleteDeserialize, { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _mongoClustersDeleteSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + }) as PollerLike, void>; +} + +export function _mongoClustersListByResourceGroupSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: MongoClustersListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | MongoClustersListByResourceGroup200Response + | MongoClustersListByResourceGroupDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters", + subscriptionId, + resourceGroupName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _mongoClustersListByResourceGroupDeserialize( + result: + | MongoClustersListByResourceGroup200Response + | MongoClustersListByResourceGroupDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + value: result.body["value"].map((p) => ({ + location: p["location"], + tags: p["tags"], + 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"], + }, + administratorLogin: p.properties?.["administratorLogin"], + administratorLoginPassword: + p.properties?.["administratorLoginPassword"], + serverVersion: p.properties?.["serverVersion"], + connectionString: p.properties?.["connectionString"], + earliestRestoreTime: p.properties?.["earliestRestoreTime"], + provisioningState: p.properties?.["provisioningState"], + clusterStatus: p.properties?.["clusterStatus"], + publicNetworkAccess: p.properties?.["publicNetworkAccess"], + nodeGroupSpecs: + p.properties?.["nodeGroupSpecs"] === undefined + ? p.properties?.["nodeGroupSpecs"] + : p.properties?.["nodeGroupSpecs"].map((p) => ({ + sku: p["sku"], + diskSizeGB: p["diskSizeGB"], + enableHa: p["enableHa"], + kind: p["kind"], + nodeCount: p["nodeCount"], + })), + privateEndpointConnections: + p.properties?.["privateEndpointConnections"] === undefined + ? p.properties?.["privateEndpointConnections"] + : p.properties?.["privateEndpointConnections"].map((p) => ({ + 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"], + }; +} + +/** List all the mongo clusters in a given resource group. */ +export function mongoClustersListByResourceGroup( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: MongoClustersListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _mongoClustersListByResourceGroupSend( + context, + subscriptionId, + resourceGroupName, + options, + ), + _mongoClustersListByResourceGroupDeserialize, + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _mongoClustersListSend( + context: Client, + subscriptionId: string, + options: MongoClustersListOptionalParams = { requestOptions: {} }, +): StreamableMethod< + MongoClustersList200Response | MongoClustersListDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters", + subscriptionId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _mongoClustersListDeserialize( + result: MongoClustersList200Response | MongoClustersListDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + value: result.body["value"].map((p) => ({ + location: p["location"], + tags: p["tags"], + 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"], + }, + administratorLogin: p.properties?.["administratorLogin"], + administratorLoginPassword: + p.properties?.["administratorLoginPassword"], + serverVersion: p.properties?.["serverVersion"], + connectionString: p.properties?.["connectionString"], + earliestRestoreTime: p.properties?.["earliestRestoreTime"], + provisioningState: p.properties?.["provisioningState"], + clusterStatus: p.properties?.["clusterStatus"], + publicNetworkAccess: p.properties?.["publicNetworkAccess"], + nodeGroupSpecs: + p.properties?.["nodeGroupSpecs"] === undefined + ? p.properties?.["nodeGroupSpecs"] + : p.properties?.["nodeGroupSpecs"].map((p) => ({ + sku: p["sku"], + diskSizeGB: p["diskSizeGB"], + enableHa: p["enableHa"], + kind: p["kind"], + nodeCount: p["nodeCount"], + })), + privateEndpointConnections: + p.properties?.["privateEndpointConnections"] === undefined + ? p.properties?.["privateEndpointConnections"] + : p.properties?.["privateEndpointConnections"].map((p) => ({ + 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"], + }; +} + +/** List all the mongo clusters in a given subscription. */ +export function mongoClustersList( + context: Client, + subscriptionId: string, + options: MongoClustersListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _mongoClustersListSend(context, subscriptionId, options), + _mongoClustersListDeserialize, + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _mongoClustersListConnectionStringsSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: MongoClustersListConnectionStringsOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | MongoClustersListConnectionStrings200Response + | MongoClustersListConnectionStringsDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/listConnectionStrings", + subscriptionId, + resourceGroupName, + mongoClusterName, + ) + .post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _mongoClustersListConnectionStringsDeserialize( + result: + | MongoClustersListConnectionStrings200Response + | MongoClustersListConnectionStringsDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + connectionStrings: + result.body["connectionStrings"] === undefined + ? result.body["connectionStrings"] + : result.body["connectionStrings"].map((p) => ({ + connectionString: p["connectionString"], + description: p["description"], + })), + }; +} + +/** 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. */ +export async function mongoClustersListConnectionStrings( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: MongoClustersListConnectionStringsOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _mongoClustersListConnectionStringsSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ); + return _mongoClustersListConnectionStringsDeserialize(result); +} + +export function _mongoClustersCheckNameAvailabilitySend( + context: Client, + subscriptionId: string, + location: string, + body: CheckNameAvailabilityRequest, + options: MongoClustersCheckNameAvailabilityOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | MongoClustersCheckNameAvailability200Response + | MongoClustersCheckNameAvailabilityDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/checkMongoClusterNameAvailability", + subscriptionId, + location, + ) + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"], type: body["type"] }, + }); +} + +export async function _mongoClustersCheckNameAvailabilityDeserialize( + result: + | MongoClustersCheckNameAvailability200Response + | MongoClustersCheckNameAvailabilityDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + nameAvailable: result.body["nameAvailable"], + reason: result.body["reason"], + message: result.body["message"], + }; +} + +/** Check if mongo cluster name is available for use. */ +export async function mongoClustersCheckNameAvailability( + context: Client, + subscriptionId: string, + location: string, + body: CheckNameAvailabilityRequest, + options: MongoClustersCheckNameAvailabilityOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _mongoClustersCheckNameAvailabilitySend( + context, + subscriptionId, + location, + body, + options, + ); + return _mongoClustersCheckNameAvailabilityDeserialize(result); +} diff --git a/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts new file mode 100644 index 000000000000..38af7e9bf502 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { PagedOperation, Operation } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { buildPagedAsyncIterator } from "../pagingHelpers.js"; +import { + isUnexpected, + DocumentDBContext as Client, + OperationsList200Response, + OperationsListDefaultResponse, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { OperationsListOptionalParams } from "../../models/options.js"; + +export function _operationsListSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/providers/Microsoft.DocumentDB/operations") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsListDeserialize( + result: OperationsList200Response | OperationsListDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + value: result.body["value"].map((p) => ({ + 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"], + }; +} + +/** List the operations for the provider */ +export function operationsList( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _operationsListSend(context, options), + _operationsListDeserialize, + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/mongocluster/arm-mongocluster/src/api/pagingHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/api/pagingHelpers.ts new file mode 100644 index 000000000000..9780e76e04a6 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/api/pagingHelpers.ts @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + Client, + createRestError, + PathUncheckedResponse, +} from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; +import { + BuildPagedAsyncIteratorOptions, + ContinuablePage, + PageSettings, + PagedAsyncIterableIterator, + PagedResult, +} from "../models/pagingTypes.js"; +import { isUnexpected } from "../rest/index.js"; + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator( + pagedResult, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +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, + ); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + 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}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse): void { + if (isUnexpected(response)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/sdk/mongocluster/arm-mongocluster/src/api/pollingHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/api/pollingHelpers.ts new file mode 100644 index 000000000000..f3bd59e41b4f --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/api/pollingHelpers.ts @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { + Client, + PathUncheckedResponse, + createRestError, +} from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { isUnexpected } from "../rest/index.js"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; +} +export function getLongRunningPoller< + TResponse extends PathUncheckedResponse, + TResult = void, +>( + client: Client, + processResponseBody: (result: TResponse) => Promise, + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = options; + if (!restoreFrom && !getInitialResponse) { + 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", + ); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client.pathUnchecked(path).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + if (options.initialRequestUrl || initialResponse) { + response.headers["x-ms-original-url"] = + options.initialRequestUrl ?? initialResponse!.request.url; + } + + return getLroResponse(response as TResponse); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, +): OperationResponse { + if (isUnexpected(response as PathUncheckedResponse)) { + throw createRestError(response); + } + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts new file mode 100644 index 000000000000..ec24f6ec0def --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getLongRunningPoller } from "../pollingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + PrivateEndpointConnectionResourceListResult, + PrivateEndpointConnectionResource, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { buildPagedAsyncIterator } from "../pagingHelpers.js"; +import { + isUnexpected, + DocumentDBContext as Client, + PrivateEndpointConnectionsCreate200Response, + PrivateEndpointConnectionsCreate201Response, + PrivateEndpointConnectionsCreate202Response, + PrivateEndpointConnectionsCreateDefaultResponse, + PrivateEndpointConnectionsCreateLogicalResponse, + PrivateEndpointConnectionsDelete202Response, + PrivateEndpointConnectionsDelete204Response, + PrivateEndpointConnectionsDeleteDefaultResponse, + PrivateEndpointConnectionsDeleteLogicalResponse, + PrivateEndpointConnectionsGet200Response, + PrivateEndpointConnectionsGetDefaultResponse, + PrivateEndpointConnectionsListByMongoCluster200Response, + PrivateEndpointConnectionsListByMongoClusterDefaultResponse, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + PrivateEndpointConnectionsListByMongoClusterOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, +} from "../../models/options.js"; + +export function _privateEndpointConnectionsListByMongoClusterSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: PrivateEndpointConnectionsListByMongoClusterOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | PrivateEndpointConnectionsListByMongoCluster200Response + | PrivateEndpointConnectionsListByMongoClusterDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections", + subscriptionId, + resourceGroupName, + mongoClusterName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateEndpointConnectionsListByMongoClusterDeserialize( + result: + | PrivateEndpointConnectionsListByMongoCluster200Response + | PrivateEndpointConnectionsListByMongoClusterDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + value: result.body["value"].map((p) => ({ + 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"], + }; +} + +/** List existing private connections */ +export function privateEndpointConnectionsListByMongoCluster( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: PrivateEndpointConnectionsListByMongoClusterOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _privateEndpointConnectionsListByMongoClusterSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + _privateEndpointConnectionsListByMongoClusterDeserialize, + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _privateEndpointConnectionsGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod< + | PrivateEndpointConnectionsGet200Response + | PrivateEndpointConnectionsGetDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateEndpointConnectionsGetDeserialize( + result: + | PrivateEndpointConnectionsGet200Response + | PrivateEndpointConnectionsGetDefaultResponse, +): Promise { + if (isUnexpected(result)) { + 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"], + }, + }; +} + +/** Get a specific private connection */ +export async function privateEndpointConnectionsGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _privateEndpointConnectionsGetSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + options, + ); + return _privateEndpointConnectionsGetDeserialize(result); +} + +export function _privateEndpointConnectionsCreateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + resource: PrivateEndpointConnectionResource, + options: PrivateEndpointConnectionsCreateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | PrivateEndpointConnectionsCreate200Response + | PrivateEndpointConnectionsCreate201Response + | PrivateEndpointConnectionsCreate202Response + | PrivateEndpointConnectionsCreateDefaultResponse + | PrivateEndpointConnectionsCreateLogicalResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: { + properties: !resource.properties + ? undefined + : { + privateEndpoint: !resource.properties?.privateEndpoint + ? undefined + : { id: resource.properties?.privateEndpoint?.["id"] }, + privateLinkServiceConnectionState: { + status: + resource.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + resource.properties?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + resource.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: resource.properties?.["provisioningState"], + }, + }, + }); +} + +export async function _privateEndpointConnectionsCreateDeserialize( + result: + | PrivateEndpointConnectionsCreate200Response + | PrivateEndpointConnectionsCreate201Response + | PrivateEndpointConnectionsCreate202Response + | PrivateEndpointConnectionsCreateDefaultResponse + | PrivateEndpointConnectionsCreateLogicalResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + result = result as PrivateEndpointConnectionsCreateLogicalResponse; + return; +} + +/** Create a Private endpoint connection */ +export function privateEndpointConnectionsCreate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + resource: PrivateEndpointConnectionResource, + options: PrivateEndpointConnectionsCreateOptionalParams = { + requestOptions: {}, + }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _privateEndpointConnectionsCreateDeserialize, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateEndpointConnectionsCreateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + resource, + options, + ), + }, + ) as PollerLike, void>; +} + +export function _privateEndpointConnectionsDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsDeleteOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | PrivateEndpointConnectionsDelete202Response + | PrivateEndpointConnectionsDelete204Response + | PrivateEndpointConnectionsDeleteDefaultResponse + | PrivateEndpointConnectionsDeleteLogicalResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateEndpointConnectionsDeleteDeserialize( + result: + | PrivateEndpointConnectionsDelete202Response + | PrivateEndpointConnectionsDelete204Response + | PrivateEndpointConnectionsDeleteDefaultResponse + | PrivateEndpointConnectionsDeleteLogicalResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + result = result as PrivateEndpointConnectionsDeleteLogicalResponse; + return; +} + +/** Delete the private endpoint connection */ +export function privateEndpointConnectionsDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options: PrivateEndpointConnectionsDeleteOptionalParams = { + requestOptions: {}, + }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _privateEndpointConnectionsDeleteDeserialize, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateEndpointConnectionsDeleteSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + options, + ), + }, + ) as PollerLike, void>; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts new file mode 100644 index 000000000000..e34c596c8963 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + PrivateLinkResourceListResult, + PrivateLinkResource, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { buildPagedAsyncIterator } from "../pagingHelpers.js"; +import { + isUnexpected, + DocumentDBContext as Client, + PrivateLinksListByMongoCluster200Response, + PrivateLinksListByMongoClusterDefaultResponse, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { PrivateLinksListByMongoClusterOptionalParams } from "../../models/options.js"; + +export function _privateLinksListByMongoClusterSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: PrivateLinksListByMongoClusterOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | PrivateLinksListByMongoCluster200Response + | PrivateLinksListByMongoClusterDefaultResponse +> { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateLinkResources", + subscriptionId, + resourceGroupName, + mongoClusterName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _privateLinksListByMongoClusterDeserialize( + result: + | PrivateLinksListByMongoCluster200Response + | PrivateLinksListByMongoClusterDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + value: result.body["value"].map((p) => ({ + 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"], + }; +} + +/** list private links on the given resource */ +export function privateLinksListByMongoCluster( + context: Client, + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options: PrivateLinksListByMongoClusterOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _privateLinksListByMongoClusterSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + _privateLinksListByMongoClusterDeserialize, + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts new file mode 100644 index 000000000000..e400da624ba6 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { FirewallRule } from "../../models/models.js"; +import { + firewallRulesGet, + firewallRulesCreateOrUpdate, + firewallRulesDelete, + firewallRulesListByMongoCluster, +} from "../../api/firewallRules/index.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + FirewallRulesGetOptionalParams, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesListByMongoClusterOptionalParams, +} from "../../models/options.js"; + +export interface FirewallRulesOperations { + get: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesGetOptionalParams, + ) => Promise; + createOrUpdate: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + resource: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ) => PollerLike, void>; + delete: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ) => PollerLike, void>; + listByMongoCluster: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: FirewallRulesListByMongoClusterOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getFirewallRules(context: DocumentDBContext) { + return { + get: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesGetOptionalParams, + ) => + firewallRulesGet( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + options, + ), + createOrUpdate: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + resource: FirewallRule, + options?: FirewallRulesCreateOrUpdateOptionalParams, + ) => + firewallRulesCreateOrUpdate( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + resource, + options, + ), + delete: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + options?: FirewallRulesDeleteOptionalParams, + ) => + firewallRulesDelete( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + options, + ), + listByMongoCluster: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: FirewallRulesListByMongoClusterOptionalParams, + ) => + firewallRulesListByMongoCluster( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + }; +} + +export function getFirewallRulesOperations( + context: DocumentDBContext, +): FirewallRulesOperations { + return { + ...getFirewallRules(context), + }; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/index.ts new file mode 100644 index 000000000000..d1346c8aa74d --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/classic/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { FirewallRulesOperations } from "./firewallRules/index.js"; +export { MongoClustersOperations } from "./mongoClusters/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { PrivateEndpointConnectionsOperations } from "./privateEndpointConnections/index.js"; +export { PrivateLinksOperations } from "./privateLinks/index.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts new file mode 100644 index 000000000000..5626a597486b --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { + MongoCluster, + MongoClusterUpdate, + ListConnectionStringsResult, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, +} from "../../models/models.js"; +import { + mongoClustersGet, + mongoClustersCreateOrUpdate, + mongoClustersUpdate, + mongoClustersDelete, + mongoClustersListByResourceGroup, + mongoClustersList, + mongoClustersListConnectionStrings, + mongoClustersCheckNameAvailability, +} from "../../api/mongoClusters/index.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + MongoClustersGetOptionalParams, + MongoClustersCreateOrUpdateOptionalParams, + MongoClustersUpdateOptionalParams, + MongoClustersDeleteOptionalParams, + MongoClustersListByResourceGroupOptionalParams, + MongoClustersListOptionalParams, + MongoClustersListConnectionStringsOptionalParams, + MongoClustersCheckNameAvailabilityOptionalParams, +} from "../../models/options.js"; + +export interface MongoClustersOperations { + get: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersGetOptionalParams, + ) => Promise; + createOrUpdate: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + resource: MongoCluster, + options?: MongoClustersCreateOrUpdateOptionalParams, + ) => PollerLike, MongoCluster>; + update: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + properties: MongoClusterUpdate, + options?: MongoClustersUpdateOptionalParams, + ) => PollerLike, MongoCluster>; + delete: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersDeleteOptionalParams, + ) => PollerLike, void>; + listByResourceGroup: ( + subscriptionId: string, + resourceGroupName: string, + options?: MongoClustersListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + list: ( + subscriptionId: string, + options?: MongoClustersListOptionalParams, + ) => PagedAsyncIterableIterator; + listConnectionStrings: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersListConnectionStringsOptionalParams, + ) => Promise; + checkNameAvailability: ( + subscriptionId: string, + location: string, + body: CheckNameAvailabilityRequest, + options?: MongoClustersCheckNameAvailabilityOptionalParams, + ) => Promise; +} + +export function getMongoClusters(context: DocumentDBContext) { + return { + get: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersGetOptionalParams, + ) => + mongoClustersGet( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + createOrUpdate: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + resource: MongoCluster, + options?: MongoClustersCreateOrUpdateOptionalParams, + ) => + mongoClustersCreateOrUpdate( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + resource, + options, + ), + update: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + properties: MongoClusterUpdate, + options?: MongoClustersUpdateOptionalParams, + ) => + mongoClustersUpdate( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + properties, + options, + ), + delete: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersDeleteOptionalParams, + ) => + mongoClustersDelete( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + listByResourceGroup: ( + subscriptionId: string, + resourceGroupName: string, + options?: MongoClustersListByResourceGroupOptionalParams, + ) => + mongoClustersListByResourceGroup( + context, + subscriptionId, + resourceGroupName, + options, + ), + list: (subscriptionId: string, options?: MongoClustersListOptionalParams) => + mongoClustersList(context, subscriptionId, options), + listConnectionStrings: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: MongoClustersListConnectionStringsOptionalParams, + ) => + mongoClustersListConnectionStrings( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + checkNameAvailability: ( + subscriptionId: string, + location: string, + body: CheckNameAvailabilityRequest, + options?: MongoClustersCheckNameAvailabilityOptionalParams, + ) => + mongoClustersCheckNameAvailability( + context, + subscriptionId, + location, + body, + options, + ), + }; +} + +export function getMongoClustersOperations( + context: DocumentDBContext, +): MongoClustersOperations { + return { + ...getMongoClusters(context), + }; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts new file mode 100644 index 000000000000..c01e370891bf --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { Operation } from "../../models/models.js"; +import { operationsList } from "../../api/operations/index.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { OperationsListOptionalParams } from "../../models/options.js"; + +export interface OperationsOperations { + list: ( + options?: OperationsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getOperations(context: DocumentDBContext) { + return { + list: (options?: OperationsListOptionalParams) => + operationsList(context, options), + }; +} + +export function getOperationsOperations( + context: DocumentDBContext, +): OperationsOperations { + return { + ...getOperations(context), + }; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts new file mode 100644 index 000000000000..13662aacdd27 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { PrivateEndpointConnectionResource } from "../../models/models.js"; +import { + privateEndpointConnectionsListByMongoCluster, + privateEndpointConnectionsGet, + privateEndpointConnectionsCreate, + privateEndpointConnectionsDelete, +} from "../../api/privateEndpointConnections/index.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + PrivateEndpointConnectionsListByMongoClusterOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, +} from "../../models/options.js"; + +export interface PrivateEndpointConnectionsOperations { + listByMongoCluster: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, + ) => PagedAsyncIterableIterator; + get: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams, + ) => Promise; + create: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + resource: PrivateEndpointConnectionResource, + options?: PrivateEndpointConnectionsCreateOptionalParams, + ) => PollerLike, void>; + delete: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => PollerLike, void>; +} + +export function getPrivateEndpointConnections(context: DocumentDBContext) { + return { + listByMongoCluster: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, + ) => + privateEndpointConnectionsListByMongoCluster( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + get: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams, + ) => + privateEndpointConnectionsGet( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + options, + ), + create: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + resource: PrivateEndpointConnectionResource, + options?: PrivateEndpointConnectionsCreateOptionalParams, + ) => + privateEndpointConnectionsCreate( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + resource, + options, + ), + delete: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams, + ) => + privateEndpointConnectionsDelete( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + options, + ), + }; +} + +export function getPrivateEndpointConnectionsOperations( + context: DocumentDBContext, +): PrivateEndpointConnectionsOperations { + return { + ...getPrivateEndpointConnections(context), + }; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts new file mode 100644 index 000000000000..20521771c679 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { PrivateLinkResource } from "../../models/models.js"; +import { privateLinksListByMongoCluster } from "../../api/privateLinks/index.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { PrivateLinksListByMongoClusterOptionalParams } from "../../models/options.js"; + +export interface PrivateLinksOperations { + listByMongoCluster: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateLinksListByMongoClusterOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getPrivateLinks(context: DocumentDBContext) { + return { + listByMongoCluster: ( + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + options?: PrivateLinksListByMongoClusterOptionalParams, + ) => + privateLinksListByMongoCluster( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + options, + ), + }; +} + +export function getPrivateLinksOperations( + context: DocumentDBContext, +): PrivateLinksOperations { + return { + ...getPrivateLinks(context), + }; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/index.ts b/sdk/mongocluster/arm-mongocluster/src/index.ts index dec8a2e8c7e1..d8e1321a655d 100644 --- a/sdk/mongocluster/arm-mongocluster/src/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/index.ts @@ -1,13 +1,85 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. -/// -export { getContinuationToken } from "./pagingHelper"; -export * from "./models"; -export { MongoClusterManagementClient } from "./mongoClusterManagementClient"; -export * from "./operationsInterfaces"; +export { + MongoClusterManagementClient, + MongoClusterManagementClientOptions, +} from "./mongoClusterManagementClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + PrivateLinkResourceListResult, + Resource, + SystemData, + CreatedByType, + ProxyResource, + PrivateLinkResource, + PrivateLinkResourceProperties, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + PrivateEndpointConnectionResourceListResult, + PrivateEndpointConnectionResource, + PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + PrivateEndpointServiceConnectionStatus, + ResourceProvisioningState, + ArmOperationStatus, + FirewallRule, + FirewallRuleProperties, + FirewallRuleListResult, + TrackedResource, + MongoCluster, + MongoClusterProperties, + CreateMode, + MongoClusterRestoreParameters, + MongoClusterStatus, + PublicNetworkAccess, + NodeGroupSpec, + NodeKind, + PrivateEndpointConnection, + MongoClusterUpdate, + MongoClusterUpdateProperties, + MongoClusterListResult, + ListConnectionStringsResult, + ConnectionString, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, + CheckNameAvailabilityReason, + PagedOperation, + Operation, + OperationDisplay, + Origin, + ActionType, + Versions, + PrivateEndpointConnectionProvisioningState, + ProvisioningState, + OperationsListOptionalParams, + MongoClustersGetOptionalParams, + MongoClustersCreateOrUpdateOptionalParams, + MongoClustersUpdateOptionalParams, + MongoClustersDeleteOptionalParams, + MongoClustersListByResourceGroupOptionalParams, + MongoClustersListOptionalParams, + MongoClustersListConnectionStringsOptionalParams, + MongoClustersCheckNameAvailabilityOptionalParams, + FirewallRulesGetOptionalParams, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesListByMongoClusterOptionalParams, + PrivateEndpointConnectionsListByMongoClusterOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateLinksListByMongoClusterOptionalParams, + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./models/index.js"; +export { + FirewallRulesOperations, + MongoClustersOperations, + OperationsOperations, + PrivateEndpointConnectionsOperations, + PrivateLinksOperations, +} from "./classic/index.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/logger.ts b/sdk/mongocluster/arm-mongocluster/src/logger.ts new file mode 100644 index 000000000000..daf5a3b92a66 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-mongocluster"); diff --git a/sdk/mongocluster/arm-mongocluster/src/lroImpl.ts b/sdk/mongocluster/arm-mongocluster/src/lroImpl.ts deleted file mode 100644 index b27f5ac7209b..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/lroImpl.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { AbortSignalLike } from "@azure/abort-controller"; -import { LongRunningOperation, LroResponse } from "@azure/core-lro"; - -export function createLroSpec(inputs: { - sendOperationFn: (args: any, spec: any) => Promise>; - args: Record; - spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record; -}): LongRunningOperation { - const { args, spec, sendOperationFn } = inputs; - return { - requestMethod: spec.httpMethod, - requestPath: spec.path!, - sendInitialRequest: () => sendOperationFn(args, spec), - sendPollRequest: ( - path: string, - options?: { abortSignal?: AbortSignalLike }, - ) => { - const { requestBody, ...restSpec } = spec; - return sendOperationFn(args, { - ...restSpec, - httpMethod: "GET", - path, - abortSignal: options?.abortSignal, - }); - }, - }; -} diff --git a/sdk/mongocluster/arm-mongocluster/src/models/index.ts b/sdk/mongocluster/arm-mongocluster/src/models/index.ts index 7ad28217f1a7..d22ec96f80d0 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/index.ts @@ -1,962 +1,77 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -export interface OperationListResult { - /** - * List of operations supported by the resource provider - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Operation[]; - /** - * URL to get the next set of operation list results (if there are any). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** 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" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isDataAction?: boolean; - /** Localized display information for this particular operation. */ - display?: OperationDisplay; - /** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly origin?: Origin; - /** - * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly actionType?: ActionType; -} - -/** Localized display information for this particular operation. */ -export interface OperationDisplay { - /** - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provider?: string; - /** - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resource?: string; - /** - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly operation?: string; - /** - * The short, localized friendly description of the operation; suitable for tool tips and detailed views. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; -} - -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ -export interface ErrorResponse { - /** The error object. */ - error?: ErrorDetail; -} - -/** The error detail. */ -export interface ErrorDetail { - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; - /** - * The error target. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly target?: string; - /** - * The error details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: ErrorDetail[]; - /** - * The error additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfo { - /** - * The additional info type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * The additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly info?: Record; -} - -/** The check availability request body. */ -export interface CheckNameAvailabilityRequest { - /** The name of the resource for which availability needs to be checked. */ - name?: string; - /** The resource type. */ - type?: string; -} - -/** The check availability result. */ -export interface CheckNameAvailabilityResponse { - /** Indicates if the resource name is available. */ - nameAvailable?: boolean; - /** The reason why the given name is not available. */ - reason?: CheckNameAvailabilityReason; - /** Detailed reason why the given name is available. */ - message?: string; -} - -/** The response of a MongoCluster list operation. */ -export interface MongoClusterListResult { - /** The MongoCluster items on this page */ - value: MongoCluster[]; - /** The link to the next page of items */ - nextLink?: string; -} - -/** The properties of a mongo cluster. */ -export interface MongoClusterProperties { - /** The mode to create a mongo cluster. */ - createMode?: CreateMode; - /** The parameters to create a point-in-time restore mongo cluster. */ - restoreParameters?: MongoClusterRestoreParameters; - /** The administrator's login for the mongo cluster. */ - administratorLogin?: string; - /** - * The password of the administrator login. - * This value contains a credential. Consider obscuring before showing to users - */ - administratorLoginPassword?: string; - /** The Mongo DB server version. Defaults to the latest available version if not specified. */ - serverVersion?: string; - /** - * The default mongo connection string for the cluster. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly connectionString?: string; - /** - * Earliest restore timestamp in UTC ISO8601 format. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly earliestRestoreTime?: string; - /** - * The provisioning state of the mongo cluster. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; - /** - * The status of the mongo cluster. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly clusterStatus?: MongoClusterStatus; - /** Whether or not public endpoint access is allowed for this mongo cluster. */ - publicNetworkAccess?: PublicNetworkAccess; - /** The list of node group specs in the cluster. */ - nodeGroupSpecs?: NodeGroupSpec[]; - /** - * List of private endpoint connections. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly privateEndpointConnections?: AzureResourceManagerPrivateEndpointConnection[]; -} - -/** Parameters used for restore operations */ -export interface MongoClusterRestoreParameters { - /** UTC point in time to restore a mongo cluster */ - pointInTimeUTC?: Date; - /** Resource ID to locate the source cluster to restore */ - sourceResourceId?: string; -} - -/** Specification for a node group. */ -export interface NodeGroupSpec { - /** The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. */ - sku?: string; - /** The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. */ - diskSizeGB?: number; - /** Whether high availability is enabled on the node group. */ - enableHa?: boolean; - /** The node type deployed in the node group. */ - kind?: NodeKind; - /** The number of nodes in the node group. */ - nodeCount?: number; -} - -/** Properties of the private endpoint connection. */ -export interface PrivateEndpointConnectionProperties { - /** - * The group ids for the private endpoint resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly groupIds?: string[]; - /** The private endpoint resource. */ - privateEndpoint?: PrivateEndpoint; - /** A collection of information about the state of the connection between service consumer and provider. */ - privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; - /** - * The provisioning state of the private endpoint connection resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: PrivateEndpointConnectionProvisioningState; -} - -/** The private endpoint resource. */ -export interface PrivateEndpoint { - /** - * The ARM identifier for private endpoint. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; -} - -/** A collection of information about the state of the connection between service consumer and provider. */ -export interface PrivateLinkServiceConnectionState { - /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ - status?: PrivateEndpointServiceConnectionStatus; - /** The reason for approval/rejection of the connection. */ - description?: string; - /** A message indicating if changes on the service provider require any updates on the consumer. */ - actionsRequired?: 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. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: 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; -} - -/** The type used for update operations of the MongoCluster. */ -export interface MongoClusterUpdate { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The updatable properties of the MongoCluster. */ - properties?: MongoClusterUpdateProperties; -} - -/** The updatable properties of the MongoCluster. */ -export interface MongoClusterUpdateProperties { - /** The administrator's login for the mongo cluster. */ - administratorLogin?: string; - /** - * The password of the administrator login. - * This value contains a credential. Consider obscuring before showing to users - */ - administratorLoginPassword?: string; - /** The Mongo DB server version. Defaults to the latest available version if not specified. */ - serverVersion?: string; - /** Whether or not public endpoint access is allowed for this mongo cluster. */ - publicNetworkAccess?: PublicNetworkAccess; - /** The list of node group specs in the cluster. */ - nodeGroupSpecs?: NodeGroupSpec[]; -} - -/** The response of a FirewallRule list operation. */ -export interface FirewallRuleListResult { - /** The FirewallRule items on this page */ - value: FirewallRule[]; - /** The link to the next page of items */ - nextLink?: string; -} - -/** The properties of a mongo cluster firewall rule. */ -export interface FirewallRuleProperties { - /** - * The provisioning state of the firewall rule. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; - /** The start IP address of the mongo cluster firewall rule. Must be IPv4 format. */ - startIpAddress: string; - /** The end IP address of the mongo cluster firewall rule. Must be IPv4 format. */ - endIpAddress: string; -} - -/** The connection strings for the given mongo cluster. */ -export interface ListConnectionStringsResult { - /** - * An array that contains the connection strings for a mongo cluster. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly connectionStrings?: ConnectionString[]; -} - -/** Connection string for the mongo cluster */ -export interface ConnectionString { - /** - * Value of the connection string - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly connectionString?: string; - /** - * Description of the connection string - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; -} - -/** The response of a PrivateEndpointConnectionResource list operation. */ -export interface PrivateEndpointConnectionResourceListResult { - /** The PrivateEndpointConnectionResource items on this page */ - value: PrivateEndpointConnectionResource[]; - /** The link to the next page of items */ - nextLink?: string; -} - -/** The response of a PrivateLinkResource list operation. */ -export interface PrivateLinkResourceListResult { - /** The PrivateLinkResource items on this page */ - value: PrivateLinkResource[]; - /** The link to the next page of items */ - nextLink?: string; -} - -/** Properties of a private link resource. */ -export interface PrivateLinkResourceProperties { - /** - * The private link resource group id. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly groupId?: string; - /** - * The private link resource required member names. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly requiredMembers?: string[]; - /** The private link resource private link DNS zone name. */ - requiredZoneNames?: string[]; -} - -/** The properties of the node group on a cluster. */ -export interface NodeGroupProperties { - /** The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. */ - sku?: string; - /** The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. */ - diskSizeGB?: number; - /** Whether high availability is enabled on the node group. */ - enableHa?: boolean; -} - -/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export interface ProxyResource extends Resource {} - -/** 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?: { [propertyName: string]: string }; - /** The geo-location where the resource lives */ - location: string; -} - -/** The private endpoint connection resource */ -export interface AzureResourceManagerPrivateEndpointConnection - extends ProxyResource { - /** The private endpoint connection properties */ - properties?: PrivateEndpointConnectionProperties; -} - -/** Represents a mongo cluster firewall rule. */ -export interface FirewallRule extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: FirewallRuleProperties; -} - -/** 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. */ - properties?: PrivateEndpointConnectionProperties; -} - -/** 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; -} - -/** Represents a mongo cluster resource. */ -export interface MongoCluster extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: MongoClusterProperties; -} - -/** Defines headers for MongoClusters_createOrUpdate operation. */ -export interface MongoClustersCreateOrUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for MongoClusters_update operation. */ -export interface MongoClustersUpdateHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for MongoClusters_delete operation. */ -export interface MongoClustersDeleteHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for FirewallRules_createOrUpdate operation. */ -export interface FirewallRulesCreateOrUpdateHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for FirewallRules_delete operation. */ -export interface FirewallRulesDeleteHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for PrivateEndpointConnections_create operation. */ -export interface PrivateEndpointConnectionsCreateHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for PrivateEndpointConnections_delete operation. */ -export interface PrivateEndpointConnectionsDeleteHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Known values of {@link Origin} that the service accepts. */ -export enum KnownOrigin { - /** User */ - User = "user", - /** System */ - System = "system", - /** UserSystem */ - UserSystem = "user,system", -} - -/** - * Defines values for Origin. \ - * {@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** - */ -export type Origin = string; - -/** Known values of {@link ActionType} that the service accepts. */ -export enum KnownActionType { - /** Internal */ - Internal = "Internal", -} - -/** - * Defines values for ActionType. \ - * {@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** - */ -export type ActionType = string; - -/** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */ -export enum KnownCheckNameAvailabilityReason { - /** Invalid */ - Invalid = "Invalid", - /** AlreadyExists */ - AlreadyExists = "AlreadyExists", -} - -/** - * Defines values for CheckNameAvailabilityReason. \ - * {@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** - */ -export type CheckNameAvailabilityReason = string; - -/** Known values of {@link CreateMode} that the service accepts. */ -export enum KnownCreateMode { - /** Create a new mongo cluster. */ - Default = "Default", - /** Create a mongo cluster from a restore point-in-time. */ - PointInTimeRestore = "PointInTimeRestore", -} - -/** - * Defines values for CreateMode. \ - * {@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**: Create a new mongo cluster. \ - * **PointInTimeRestore**: Create a mongo cluster from a restore point-in-time. - */ -export type CreateMode = string; - -/** Known values of {@link ProvisioningState} that the service accepts. */ -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. */ - Updating = "Updating", - /** A drop operation is in-progress on the resource. */ - Dropping = "Dropping", -} - -/** - * Defines values for ProvisioningState. \ - * {@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. \ - * **Updating**: An update operation is in-progress on the resource. \ - * **Dropping**: A drop operation is in-progress on the resource. - */ -export type ProvisioningState = string; - -/** Known values of {@link MongoClusterStatus} that the service accepts. */ -export enum KnownMongoClusterStatus { - /** The mongo cluster resource is ready for use. */ - Ready = "Ready", - /** The mongo cluster resource is being provisioned. */ - Provisioning = "Provisioning", - /** The mongo cluster resource is being updated. */ - Updating = "Updating", - /** The mongo cluster resource is being started. */ - Starting = "Starting", - /** The mongo cluster resource is being stopped. */ - Stopping = "Stopping", - /** The mongo cluster resource is stopped. */ - Stopped = "Stopped", - /** The mongo cluster resource is being dropped. */ - Dropping = "Dropping", -} - -/** - * Defines values for MongoClusterStatus. \ - * {@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**: 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. */ -export enum KnownPublicNetworkAccess { - /** If set, mongo cluster can be accessed through private and public methods. */ - Enabled = "Enabled", - /** If set, the private endpoints are the exclusive access method. */ - Disabled = "Disabled", -} - -/** - * Defines values for PublicNetworkAccess. \ - * {@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**: 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; - -/** Known values of {@link NodeKind} that the service accepts. */ -export enum KnownNodeKind { - /** The node is a shard kind. */ - Shard = "Shard", -} - -/** - * Defines values for NodeKind. \ - * {@link KnownNodeKind} can be used interchangeably with NodeKind, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Shard**: The node is a shard kind. - */ -export type NodeKind = string; - -/** Known values of {@link PrivateEndpointServiceConnectionStatus} that the service accepts. */ -export enum KnownPrivateEndpointServiceConnectionStatus { - /** Pending */ - Pending = "Pending", - /** Approved */ - Approved = "Approved", - /** Rejected */ - Rejected = "Rejected", -} - -/** - * Defines values for PrivateEndpointServiceConnectionStatus. \ - * {@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** - */ -export type PrivateEndpointServiceConnectionStatus = string; - -/** Known values of {@link PrivateEndpointConnectionProvisioningState} that the service accepts. */ -export enum KnownPrivateEndpointConnectionProvisioningState { - /** Succeeded */ - Succeeded = "Succeeded", - /** Creating */ - Creating = "Creating", - /** Deleting */ - Deleting = "Deleting", - /** Failed */ - Failed = "Failed", -} - -/** - * Defines values for PrivateEndpointConnectionProvisioningState. \ - * {@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** - */ -export type PrivateEndpointConnectionProvisioningState = string; - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key", -} - -/** - * Defines values for CreatedByType. \ - * {@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; - -/** Optional parameters. */ -export interface OperationsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type OperationsListResponse = OperationListResult; - -/** Optional parameters. */ -export interface OperationsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type OperationsListNextResponse = OperationListResult; - -/** Optional parameters. */ -export interface MongoClustersCheckNameAvailabilityOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the checkNameAvailability operation. */ -export type MongoClustersCheckNameAvailabilityResponse = - CheckNameAvailabilityResponse; - -/** Optional parameters. */ -export interface MongoClustersListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type MongoClustersListResponse = MongoClusterListResult; - -/** Optional parameters. */ -export interface MongoClustersListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type MongoClustersListByResourceGroupResponse = MongoClusterListResult; - -/** Optional parameters. */ -export interface MongoClustersGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type MongoClustersGetResponse = MongoCluster; - -/** Optional parameters. */ -export interface MongoClustersCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type MongoClustersCreateOrUpdateResponse = MongoCluster; - -/** Optional parameters. */ -export interface MongoClustersUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type MongoClustersUpdateResponse = MongoCluster; - -/** Optional parameters. */ -export interface MongoClustersDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type MongoClustersDeleteResponse = MongoClustersDeleteHeaders; - -/** Optional parameters. */ -export interface MongoClustersListConnectionStringsOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listConnectionStrings operation. */ -export type MongoClustersListConnectionStringsResponse = - ListConnectionStringsResult; - -/** Optional parameters. */ -export interface MongoClustersListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type MongoClustersListNextResponse = MongoClusterListResult; - -/** Optional parameters. */ -export interface MongoClustersListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type MongoClustersListByResourceGroupNextResponse = - MongoClusterListResult; - -/** Optional parameters. */ -export interface FirewallRulesListByMongoClusterOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByMongoCluster operation. */ -export type FirewallRulesListByMongoClusterResponse = FirewallRuleListResult; - -/** Optional parameters. */ -export interface FirewallRulesGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type FirewallRulesGetResponse = FirewallRule; - -/** Optional parameters. */ -export interface FirewallRulesCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type FirewallRulesCreateOrUpdateResponse = FirewallRule; - -/** Optional parameters. */ -export interface FirewallRulesDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type FirewallRulesDeleteResponse = FirewallRulesDeleteHeaders; - -/** Optional parameters. */ -export interface FirewallRulesListByMongoClusterNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByMongoClusterNext operation. */ -export type FirewallRulesListByMongoClusterNextResponse = - FirewallRuleListResult; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByMongoCluster operation. */ -export type PrivateEndpointConnectionsListByMongoClusterResponse = - PrivateEndpointConnectionResourceListResult; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type PrivateEndpointConnectionsGetResponse = - PrivateEndpointConnectionResource; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsCreateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the create operation. */ -export type PrivateEndpointConnectionsCreateResponse = - PrivateEndpointConnectionResource; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the delete operation. */ -export type PrivateEndpointConnectionsDeleteResponse = - PrivateEndpointConnectionsDeleteHeaders; - -/** Optional parameters. */ -export interface PrivateEndpointConnectionsListByMongoClusterNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByMongoClusterNext operation. */ -export type PrivateEndpointConnectionsListByMongoClusterNextResponse = - PrivateEndpointConnectionResourceListResult; - -/** Optional parameters. */ -export interface PrivateLinksListByMongoClusterOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByMongoCluster operation. */ -export type PrivateLinksListByMongoClusterResponse = - PrivateLinkResourceListResult; - -/** Optional parameters. */ -export interface PrivateLinksListByMongoClusterNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByMongoClusterNext operation. */ -export type PrivateLinksListByMongoClusterNextResponse = - PrivateLinkResourceListResult; - -/** Optional parameters. */ -export interface MongoClusterManagementClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + PrivateLinkResourceListResult, + Resource, + SystemData, + CreatedByType, + ProxyResource, + PrivateLinkResource, + PrivateLinkResourceProperties, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + PrivateEndpointConnectionResourceListResult, + PrivateEndpointConnectionResource, + PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + PrivateEndpointServiceConnectionStatus, + ResourceProvisioningState, + ArmOperationStatus, + FirewallRule, + FirewallRuleProperties, + FirewallRuleListResult, + TrackedResource, + MongoCluster, + MongoClusterProperties, + CreateMode, + MongoClusterRestoreParameters, + MongoClusterStatus, + PublicNetworkAccess, + NodeGroupSpec, + NodeKind, + PrivateEndpointConnection, + MongoClusterUpdate, + MongoClusterUpdateProperties, + MongoClusterListResult, + ListConnectionStringsResult, + ConnectionString, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, + CheckNameAvailabilityReason, + PagedOperation, + Operation, + OperationDisplay, + Origin, + ActionType, + Versions, + PrivateEndpointConnectionProvisioningState, + ProvisioningState, +} from "./models.js"; +export { + OperationsListOptionalParams, + MongoClustersGetOptionalParams, + MongoClustersCreateOrUpdateOptionalParams, + MongoClustersUpdateOptionalParams, + MongoClustersDeleteOptionalParams, + MongoClustersListByResourceGroupOptionalParams, + MongoClustersListOptionalParams, + MongoClustersListConnectionStringsOptionalParams, + MongoClustersCheckNameAvailabilityOptionalParams, + FirewallRulesGetOptionalParams, + FirewallRulesCreateOrUpdateOptionalParams, + FirewallRulesDeleteOptionalParams, + FirewallRulesListByMongoClusterOptionalParams, + PrivateEndpointConnectionsListByMongoClusterOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateLinksListByMongoClusterOptionalParams, +} from "./options.js"; +export { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./pagingTypes.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/models/mappers.ts b/sdk/mongocluster/arm-mongocluster/src/models/mappers.ts deleted file mode 100644 index 94a8968fe612..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/models/mappers.ts +++ /dev/null @@ -1,1184 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import * as coreClient from "@azure/core-client"; - -export const OperationListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Operation", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Operation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - isDataAction: { - serializedName: "isDataAction", - readOnly: true, - type: { - name: "Boolean", - }, - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay", - }, - }, - origin: { - serializedName: "origin", - readOnly: true, - type: { - name: "String", - }, - }, - actionType: { - serializedName: "actionType", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - readOnly: true, - type: { - name: "String", - }, - }, - resource: { - serializedName: "resource", - readOnly: true, - type: { - name: "String", - }, - }, - operation: { - serializedName: "operation", - readOnly: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, -}; - -export const ErrorDetail: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorDetail", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String", - }, - }, - target: { - serializedName: "target", - readOnly: true, - type: { - name: "String", - }, - }, - details: { - serializedName: "details", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, - additionalInfo: { - serializedName: "additionalInfo", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - }, - }, - }, - }, - }, - }, -}; - -export const ErrorAdditionalInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - modelProperties: { - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - info: { - serializedName: "info", - readOnly: true, - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - }, - }, -}; - -export const CheckNameAvailabilityRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CheckNameAvailabilityRequest", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CheckNameAvailabilityResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CheckNameAvailabilityResponse", - modelProperties: { - nameAvailable: { - serializedName: "nameAvailable", - type: { - name: "Boolean", - }, - }, - reason: { - serializedName: "reason", - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MongoClusterListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MongoClusterListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MongoCluster", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const MongoClusterProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MongoClusterProperties", - modelProperties: { - createMode: { - serializedName: "createMode", - type: { - name: "String", - }, - }, - restoreParameters: { - serializedName: "restoreParameters", - type: { - name: "Composite", - className: "MongoClusterRestoreParameters", - }, - }, - administratorLogin: { - serializedName: "administratorLogin", - type: { - name: "String", - }, - }, - administratorLoginPassword: { - serializedName: "administratorLoginPassword", - type: { - name: "String", - }, - }, - serverVersion: { - serializedName: "serverVersion", - type: { - name: "String", - }, - }, - connectionString: { - serializedName: "connectionString", - readOnly: true, - type: { - name: "String", - }, - }, - earliestRestoreTime: { - serializedName: "earliestRestoreTime", - readOnly: true, - type: { - name: "String", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - clusterStatus: { - serializedName: "clusterStatus", - readOnly: true, - type: { - name: "String", - }, - }, - publicNetworkAccess: { - serializedName: "publicNetworkAccess", - type: { - name: "String", - }, - }, - nodeGroupSpecs: { - serializedName: "nodeGroupSpecs", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NodeGroupSpec", - }, - }, - }, - }, - privateEndpointConnections: { - serializedName: "privateEndpointConnections", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AzureResourceManagerPrivateEndpointConnection", - }, - }, - }, - }, - }, - }, -}; - -export const MongoClusterRestoreParameters: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MongoClusterRestoreParameters", - modelProperties: { - pointInTimeUTC: { - serializedName: "pointInTimeUTC", - type: { - name: "DateTime", - }, - }, - sourceResourceId: { - serializedName: "sourceResourceId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const NodeGroupSpec: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NodeGroupSpec", - modelProperties: { - sku: { - serializedName: "sku", - type: { - name: "String", - }, - }, - diskSizeGB: { - serializedName: "diskSizeGB", - type: { - name: "Number", - }, - }, - enableHa: { - serializedName: "enableHa", - type: { - name: "Boolean", - }, - }, - kind: { - serializedName: "kind", - type: { - name: "String", - }, - }, - nodeCount: { - serializedName: "nodeCount", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnectionProperties", - modelProperties: { - groupIds: { - serializedName: "groupIds", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - privateEndpoint: { - serializedName: "privateEndpoint", - type: { - name: "Composite", - className: "PrivateEndpoint", - }, - }, - privateLinkServiceConnectionState: { - serializedName: "privateLinkServiceConnectionState", - type: { - name: "Composite", - className: "PrivateLinkServiceConnectionState", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpoint: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpoint", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateLinkServiceConnectionState: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateLinkServiceConnectionState", - modelProperties: { - status: { - serializedName: "status", - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - type: { - name: "String", - }, - }, - actionsRequired: { - serializedName: "actionsRequired", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - }, - }, -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String", - }, - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String", - }, - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime", - }, - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String", - }, - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String", - }, - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const MongoClusterUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MongoClusterUpdate", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "MongoClusterUpdateProperties", - }, - }, - }, - }, -}; - -export const MongoClusterUpdateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MongoClusterUpdateProperties", - modelProperties: { - administratorLogin: { - serializedName: "administratorLogin", - type: { - name: "String", - }, - }, - administratorLoginPassword: { - serializedName: "administratorLoginPassword", - type: { - name: "String", - }, - }, - serverVersion: { - serializedName: "serverVersion", - type: { - name: "String", - }, - }, - publicNetworkAccess: { - serializedName: "publicNetworkAccess", - type: { - name: "String", - }, - }, - nodeGroupSpecs: { - serializedName: "nodeGroupSpecs", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NodeGroupSpec", - }, - }, - }, - }, - }, - }, -}; - -export const FirewallRuleListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FirewallRuleListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "FirewallRule", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const FirewallRuleProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FirewallRuleProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - startIpAddress: { - constraints: { - Pattern: new RegExp( - "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", - ), - }, - serializedName: "startIpAddress", - required: true, - type: { - name: "String", - }, - }, - endIpAddress: { - constraints: { - Pattern: new RegExp( - "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", - ), - }, - serializedName: "endIpAddress", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ListConnectionStringsResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ListConnectionStringsResult", - modelProperties: { - connectionStrings: { - serializedName: "connectionStrings", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ConnectionString", - }, - }, - }, - }, - }, - }, -}; - -export const ConnectionString: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ConnectionString", - modelProperties: { - connectionString: { - serializedName: "connectionString", - readOnly: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionResourceListResult: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "PrivateEndpointConnectionResourceListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PrivateEndpointConnectionResource", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, - }; - -export const PrivateLinkResourceListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateLinkResourceListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PrivateLinkResource", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PrivateLinkResourceProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateLinkResourceProperties", - modelProperties: { - groupId: { - serializedName: "groupId", - readOnly: true, - type: { - name: "String", - }, - }, - requiredMembers: { - serializedName: "requiredMembers", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - requiredZoneNames: { - serializedName: "requiredZoneNames", - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const NodeGroupProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "NodeGroupProperties", - modelProperties: { - sku: { - serializedName: "sku", - type: { - name: "String", - }, - }, - diskSizeGB: { - serializedName: "diskSizeGB", - type: { - name: "Number", - }, - }, - enableHa: { - serializedName: "enableHa", - type: { - name: "Boolean", - }, - }, - }, - }, -}; - -export const ProxyResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProxyResource", - modelProperties: { - ...Resource.type.modelProperties, - }, - }, -}; - -export const TrackedResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TrackedResource", - modelProperties: { - ...Resource.type.modelProperties, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - location: { - serializedName: "location", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AzureResourceManagerPrivateEndpointConnection: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "AzureResourceManagerPrivateEndpointConnection", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "PrivateEndpointConnectionProperties", - }, - }, - }, - }, - }; - -export const FirewallRule: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FirewallRule", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "FirewallRuleProperties", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateEndpointConnectionResource", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "PrivateEndpointConnectionProperties", - }, - }, - }, - }, -}; - -export const PrivateLinkResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PrivateLinkResource", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "PrivateLinkResourceProperties", - }, - }, - }, - }, -}; - -export const MongoCluster: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MongoCluster", - modelProperties: { - ...TrackedResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "MongoClusterProperties", - }, - }, - }, - }, -}; - -export const MongoClustersCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MongoClustersCreateOrUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const MongoClustersUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MongoClustersUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const MongoClustersDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "MongoClustersDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const FirewallRulesCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FirewallRulesCreateOrUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const FirewallRulesDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FirewallRulesDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const PrivateEndpointConnectionsCreateHeaders: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "PrivateEndpointConnectionsCreateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, - }; - -export const PrivateEndpointConnectionsDeleteHeaders: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "PrivateEndpointConnectionsDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, - }; diff --git a/sdk/mongocluster/arm-mongocluster/src/models/models.ts b/sdk/mongocluster/arm-mongocluster/src/models/models.ts new file mode 100644 index 000000000000..c987060c3109 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/models/models.ts @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** The response of a PrivateLinkResource list operation. */ +export interface PrivateLinkResourceListResult { + /** The PrivateLinkResource items on this page */ + value: PrivateLinkResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Common properties 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; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + readonly createdBy?: string; + /** The type of identity that created the resource. */ + readonly createdByType?: CreatedByType; + /** The type of identity that created the resource. */ + readonly createdAt?: Date; + /** The identity that last modified the resource. */ + readonly lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + readonly lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + readonly lastModifiedAt?: Date; +} + +/** The kind of entity that created the resource. */ +/** "User", "Application", "ManagedIdentity", "Key" */ +export type CreatedByType = string; + +/** The base proxy resource. */ +export interface ProxyResource extends Resource {} + +/** 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; +} + +/** Properties of a private link resource. */ +export interface PrivateLinkResourceProperties { + /** The private link resource group id. */ + readonly groupId?: string; + /** The private link resource required member names. */ + readonly requiredMembers?: string[]; + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: Record; +} + +/** The response of a PrivateEndpointConnectionResource list operation. */ +export interface PrivateEndpointConnectionResourceListResult { + /** The PrivateEndpointConnectionResource items on this page */ + value: PrivateEndpointConnectionResource[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** 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. */ + properties?: PrivateEndpointConnectionProperties; +} + +/** Properties of he private endpoint connection resource */ +export interface PrivateEndpointConnectionProperties { + /** The group identifiers for the private endpoint resource */ + readonly groupIds?: string[]; + /** The private endpoint resource */ + privateEndpoint?: PrivateEndpoint; + /** A collection of information about the state of the connection between service consumer and provider. */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + /** The provisioning state of the private endpoint connection resource. */ + provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +/** The private endpoint resource */ +export interface PrivateEndpoint { + /** The resource identifier for private endpoint */ + id?: string; +} + +/** A collection of information about the state of the connection between service consumer and provider. */ +export interface PrivateLinkServiceConnectionState { + /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ + status?: PrivateEndpointServiceConnectionStatus; + /** The reason for approval/rejection of the connection. */ + description?: string; + /** A message indicating if changes on the service provider require any updates on the consumer. */ + actionsRequired?: string; +} + +/** The private endpoint connection status */ +/** "Pending", "Approved", "Rejected" */ +export type PrivateEndpointServiceConnectionStatus = string; +/** The provisioning state of a resource type. */ +/** "Succeeded", "Failed", "Canceled" */ +export type ResourceProvisioningState = string; + +/** Standard Azure Resource Manager operation status response */ +export interface ArmOperationStatus { + /** The operation status */ + status: ResourceProvisioningState; + /** The name of the operationStatus resource */ + readonly name?: string; + /** Operation start time */ + readonly startTime?: Date; + /** Operation complete time */ + readonly endTime?: Date; + /** The progress made toward completing the operation */ + readonly percentComplete?: number; + /** Errors that occurred if the operation ended with Canceled or Failed status */ + readonly error?: ErrorDetail; +} + +/** Represents a mongo cluster firewall rule. */ +export interface FirewallRule extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: FirewallRuleProperties; +} + +/** The properties of a mongo cluster firewall rule. */ +export interface FirewallRuleProperties { + /** The provisioning state of the firewall rule. */ + readonly provisioningState?: ProvisioningState; + /** The start IP address of the mongo cluster firewall rule. Must be IPv4 format. */ + startIpAddress: string; + /** The end IP address of the mongo cluster firewall rule. Must be IPv4 format. */ + endIpAddress: string; +} + +/** The response of a FirewallRule list operation. */ +export interface FirewallRuleListResult { + /** The FirewallRule items on this page */ + value: FirewallRule[]; + /** The link to the next page of items */ + 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 { + /** The geo-location where the resource lives */ + location: string; + /** Resource tags. */ + tags?: Record; +} + +/** Represents a mongo cluster resource. */ +export interface MongoCluster extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: MongoClusterProperties; +} + +/** The properties of a mongo cluster. */ +export interface MongoClusterProperties { + /** The mode to create a mongo cluster. */ + createMode?: CreateMode; + /** The parameters to create a point-in-time restore mongo cluster. */ + restoreParameters?: MongoClusterRestoreParameters; + /** The administrator's login for the mongo cluster. */ + administratorLogin?: string; + /** The password of the administrator login. */ + administratorLoginPassword?: string; + /** The Mongo DB server version. Defaults to the latest available version if not specified. */ + serverVersion?: string; + /** The default mongo connection string for the cluster. */ + readonly connectionString?: string; + /** Earliest restore timestamp in UTC ISO8601 format. */ + readonly earliestRestoreTime?: string; + /** The provisioning state of the mongo cluster. */ + readonly provisioningState?: ProvisioningState; + /** The status of the mongo cluster. */ + readonly clusterStatus?: MongoClusterStatus; + /** Whether or not public endpoint access is allowed for this mongo cluster. */ + publicNetworkAccess?: PublicNetworkAccess; + /** The list of node group specs in the cluster. */ + nodeGroupSpecs?: NodeGroupSpec[]; + /** List of private endpoint connections. */ + readonly privateEndpointConnections?: PrivateEndpointConnection[]; +} + +/** The mode that the Mongo Cluster is created with. */ +/** "Default", "PointInTimeRestore" */ +export type CreateMode = string; + +/** Parameters used for restore operations */ +export interface MongoClusterRestoreParameters { + /** UTC point in time to restore a mongo cluster */ + pointInTimeUTC?: Date; + /** Resource ID to locate the source cluster to restore */ + sourceResourceId?: string; +} + +/** The status of the Mongo cluster resource. */ +/** "Ready", "Provisioning", "Updating", "Starting", "Stopping", "Stopped", "Dropping" */ +export type MongoClusterStatus = string; +/** Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is 'Enabled' */ +/** "Enabled", "Disabled" */ +export type PublicNetworkAccess = string; + +/** Specification for a node group. */ +export interface NodeGroupSpec { + /** The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. */ + sku?: string; + /** The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. */ + diskSizeGB?: number; + /** Whether high availability is enabled on the node group. */ + enableHa?: boolean; + /** The node type deployed in the node group. */ + kind?: NodeKind; + /** The number of nodes in the node group. */ + nodeCount?: number; +} + +/** The kind of the node on the cluster. */ +/** "Shard" */ +export type NodeKind = string; + +/** The private endpoint connection resource */ +export interface PrivateEndpointConnection extends ProxyResource { + /** The private endpoint connection properties */ + properties?: PrivateEndpointConnectionProperties; +} + +/** The type used for update operations of the MongoCluster. */ +export interface MongoClusterUpdate { + /** Resource tags. */ + tags?: Record; + properties?: MongoClusterUpdateProperties; +} + +/** The updatable properties of the MongoCluster. */ +export interface MongoClusterUpdateProperties { + /** The administrator's login for the mongo cluster. */ + administratorLogin?: string; + /** The password of the administrator login. */ + administratorLoginPassword?: string; + /** The Mongo DB server version. Defaults to the latest available version if not specified. */ + serverVersion?: string; + /** Whether or not public endpoint access is allowed for this mongo cluster. */ + publicNetworkAccess?: PublicNetworkAccess; + /** The list of node group specs in the cluster. */ + nodeGroupSpecs?: NodeGroupSpec[]; +} + +/** The response of a MongoCluster list operation. */ +export interface MongoClusterListResult { + /** The MongoCluster items on this page */ + value: MongoCluster[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** 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[]; +} + +/** Connection string for the mongo cluster */ +export interface ConnectionString { + /** Value of the connection string */ + readonly connectionString?: string; + /** Description of the connection string */ + readonly description?: string; +} + +/** The check availability request body. */ +export interface CheckNameAvailabilityRequest { + /** The name of the resource for which availability needs to be checked. */ + name?: string; + /** The resource type. */ + type?: string; +} + +/** The check availability result. */ +export interface CheckNameAvailabilityResponse { + /** Indicates if the resource name is available. */ + nameAvailable?: boolean; + /** The reason why the given name is not available. */ + reason?: CheckNameAvailabilityReason; + /** Detailed reason why the given name is not available. */ + message?: string; +} + +/** Possible reasons for a name not being available. */ +/** "Invalid", "AlreadyExists" */ +export type CheckNameAvailabilityReason = string; + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface PagedOperation { + /** The Operation items on this page */ + value: Operation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** 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" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + actionType?: 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". */ + provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + description?: string; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +/** "user", "system", "user,system" */ +export type Origin = string; +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +/** "Internal" */ +export type ActionType = string; +/** The available API versions. */ +/** */ +export type Versions = "2024-03-01-preview"; +/** Alias for PrivateEndpointConnectionProvisioningState */ +export type PrivateEndpointConnectionProvisioningState = + | ResourceProvisioningState + | "Creating" + | "Deleting"; +/** Alias for ProvisioningState */ +export type ProvisioningState = + | string + | ResourceProvisioningState + | "InProgress" + | "Updating" + | "Dropping"; diff --git a/sdk/mongocluster/arm-mongocluster/src/models/options.ts b/sdk/mongocluster/arm-mongocluster/src/models/options.ts new file mode 100644 index 000000000000..205f9fa8a99d --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/models/options.ts @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { OperationOptions } from "@azure-rest/core-client"; + +export interface OperationsListOptionalParams extends OperationOptions {} + +export interface MongoClustersGetOptionalParams extends OperationOptions {} + +export interface MongoClustersCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +export interface MongoClustersUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +export interface MongoClustersDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +export interface MongoClustersListByResourceGroupOptionalParams + extends OperationOptions {} + +export interface MongoClustersListOptionalParams extends OperationOptions {} + +export interface MongoClustersListConnectionStringsOptionalParams + extends OperationOptions {} + +export interface MongoClustersCheckNameAvailabilityOptionalParams + extends OperationOptions {} + +export interface FirewallRulesGetOptionalParams extends OperationOptions {} + +export interface FirewallRulesCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +export interface FirewallRulesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +export interface FirewallRulesListByMongoClusterOptionalParams + extends OperationOptions {} + +export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams + extends OperationOptions {} + +export interface PrivateEndpointConnectionsGetOptionalParams + extends OperationOptions {} + +export interface PrivateEndpointConnectionsCreateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +export interface PrivateEndpointConnectionsDeleteOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +export interface PrivateLinksListByMongoClusterOptionalParams + extends OperationOptions {} diff --git a/sdk/mongocluster/arm-mongocluster/src/models/pagingTypes.ts b/sdk/mongocluster/arm-mongocluster/src/models/pagingTypes.ts new file mode 100644 index 000000000000..f734b48e62f9 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/models/pagingTypes.ts @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator< + TElement, + TPage, + TPageSettings + >; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + 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>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/models/parameters.ts b/sdk/mongocluster/arm-mongocluster/src/models/parameters.ts deleted file mode 100644 index 86190085944d..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/models/parameters.ts +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - OperationParameter, - OperationURLParameter, - OperationQueryParameter, -} from "@azure/core-client"; -import { - CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper, - MongoCluster as MongoClusterMapper, - MongoClusterUpdate as MongoClusterUpdateMapper, - FirewallRule as FirewallRuleMapper, - PrivateEndpointConnectionResource as PrivateEndpointConnectionResourceMapper, -} from "../models/mappers"; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String", - }, - }, -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2024-03-01-preview", - isConstant: true, - serializedName: "api-version", - type: { - name: "String", - }, - }, -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String", - }, - }, -}; - -export const body: OperationParameter = { - parameterPath: "body", - mapper: CheckNameAvailabilityRequestMapper, -}; - -export const subscriptionId: OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - serializedName: "subscriptionId", - required: true, - type: { - name: "Uuid", - }, - }, -}; - -export const location: OperationURLParameter = { - parameterPath: "location", - mapper: { - constraints: { - MinLength: 1, - }, - serializedName: "location", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resourceGroupName: OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - constraints: { - MaxLength: 90, - MinLength: 1, - }, - serializedName: "resourceGroupName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const mongoClusterName: OperationURLParameter = { - parameterPath: "mongoClusterName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-z0-9]+(-[a-z0-9]+)*"), - MaxLength: 40, - MinLength: 3, - }, - serializedName: "mongoClusterName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resource: OperationParameter = { - parameterPath: "resource", - mapper: MongoClusterMapper, -}; - -export const properties: OperationParameter = { - parameterPath: "properties", - mapper: MongoClusterUpdateMapper, -}; - -export const firewallRuleName: OperationURLParameter = { - parameterPath: "firewallRuleName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9][-_.a-zA-Z0-9]*"), - MaxLength: 80, - MinLength: 1, - }, - serializedName: "firewallRuleName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resource1: OperationParameter = { - parameterPath: "resource", - mapper: FirewallRuleMapper, -}; - -export const privateEndpointConnectionName: OperationURLParameter = { - parameterPath: "privateEndpointConnectionName", - mapper: { - serializedName: "privateEndpointConnectionName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resource2: OperationParameter = { - parameterPath: "resource", - mapper: PrivateEndpointConnectionResourceMapper, -}; diff --git a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts index 8057dc06566f..f16dbe574694 100644 --- a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts @@ -1,161 +1,65 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. -import * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; +import { Pipeline } from "@azure/core-rest-pipeline"; import { - PipelineRequest, - PipelineResponse, - SendRequest, -} from "@azure/core-rest-pipeline"; -import * as coreAuth from "@azure/core-auth"; + getOperationsOperations, + OperationsOperations, +} from "./classic/operations/index.js"; import { - OperationsImpl, - MongoClustersImpl, - FirewallRulesImpl, - PrivateEndpointConnectionsImpl, - PrivateLinksImpl, -} from "./operations"; + getMongoClustersOperations, + MongoClustersOperations, +} from "./classic/mongoClusters/index.js"; import { - Operations, - MongoClusters, - FirewallRules, - PrivateEndpointConnections, - PrivateLinks, -} from "./operationsInterfaces"; -import { MongoClusterManagementClientOptionalParams } from "./models"; + getFirewallRulesOperations, + FirewallRulesOperations, +} from "./classic/firewallRules/index.js"; +import { + getPrivateEndpointConnectionsOperations, + PrivateEndpointConnectionsOperations, +} from "./classic/privateEndpointConnections/index.js"; +import { + getPrivateLinksOperations, + PrivateLinksOperations, +} from "./classic/privateLinks/index.js"; +import { + createMongoClusterManagement, + MongoClusterManagementClientOptions, + DocumentDBContext, +} from "./api/index.js"; -export class MongoClusterManagementClient extends coreClient.ServiceClient { - $host: string; - apiVersion: string; - subscriptionId: string; +export { MongoClusterManagementClientOptions } from "./api/mongoClusterManagementContext.js"; - /** - * Initializes a new instance of the MongoClusterManagementClient class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param options The parameter options - */ +export class MongoClusterManagementClient { + private _client: DocumentDBContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** 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. */ constructor( - credentials: coreAuth.TokenCredential, - subscriptionId: string, - options?: MongoClusterManagementClientOptionalParams, + credential: TokenCredential, + options: MongoClusterManagementClientOptions = {}, ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } - if (subscriptionId === undefined) { - throw new Error("'subscriptionId' cannot be null"); - } - - // Initializing default values for options - if (!options) { - options = {}; - } - const defaults: MongoClusterManagementClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials, - }; - - const packageDetails = `azsdk-js-arm-mongocluster/1.0.0-beta.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, - ...options, - userAgentOptions: { - userAgentPrefix, - }, - endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com", - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = - options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName, - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName, - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? - `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge, - }, - }), - ); - } - // Parameter assignments - this.subscriptionId = subscriptionId; - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2024-03-01-preview"; - this.operations = new OperationsImpl(this); - this.mongoClusters = new MongoClustersImpl(this); - this.firewallRules = new FirewallRulesImpl(this); - this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); - this.privateLinks = new PrivateLinksImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest( - request: PipelineRequest, - next: SendRequest, - ): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - }, - }; - this.pipeline.addPolicy(apiVersionPolicy); + this._client = createMongoClusterManagement(credential, options); + this.pipeline = this._client.pipeline; + this.operations = getOperationsOperations(this._client); + this.mongoClusters = getMongoClustersOperations(this._client); + this.firewallRules = getFirewallRulesOperations(this._client); + this.privateEndpointConnections = getPrivateEndpointConnectionsOperations( + this._client, + ); + this.privateLinks = getPrivateLinksOperations(this._client); } - operations: Operations; - mongoClusters: MongoClusters; - firewallRules: FirewallRules; - privateEndpointConnections: PrivateEndpointConnections; - privateLinks: PrivateLinks; + /** The operation groups for Operations */ + public readonly operations: OperationsOperations; + /** The operation groups for MongoClusters */ + public readonly mongoClusters: MongoClustersOperations; + /** The operation groups for FirewallRules */ + public readonly firewallRules: FirewallRulesOperations; + /** The operation groups for PrivateEndpointConnections */ + public readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + /** The operation groups for PrivateLinks */ + public readonly privateLinks: PrivateLinksOperations; } diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/firewallRules.ts b/sdk/mongocluster/arm-mongocluster/src/operations/firewallRules.ts deleted file mode 100644 index 2051a825c585..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operations/firewallRules.ts +++ /dev/null @@ -1,519 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { FirewallRules } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl"; -import { - FirewallRule, - FirewallRulesListByMongoClusterNextOptionalParams, - FirewallRulesListByMongoClusterOptionalParams, - FirewallRulesListByMongoClusterResponse, - FirewallRulesGetOptionalParams, - FirewallRulesGetResponse, - FirewallRulesCreateOrUpdateOptionalParams, - FirewallRulesCreateOrUpdateResponse, - FirewallRulesDeleteOptionalParams, - FirewallRulesDeleteResponse, - FirewallRulesListByMongoClusterNextResponse, -} from "../models"; - -/// -/** Class containing FirewallRules operations. */ -export class FirewallRulesImpl implements FirewallRules { - private readonly client: MongoClusterManagementClient; - - /** - * Initialize a new instance of the class FirewallRules class. - * @param client Reference to the service client - */ - constructor(client: MongoClusterManagementClient) { - this.client = client; - } - - /** - * List all the firewall rules in a given mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - public listByMongoCluster( - resourceGroupName: string, - mongoClusterName: string, - options?: FirewallRulesListByMongoClusterOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByMongoClusterPagingAll( - resourceGroupName, - mongoClusterName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByMongoClusterPagingPage( - resourceGroupName, - mongoClusterName, - options, - settings, - ); - }, - }; - } - - private async *listByMongoClusterPagingPage( - resourceGroupName: string, - mongoClusterName: string, - options?: FirewallRulesListByMongoClusterOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: FirewallRulesListByMongoClusterResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByMongoCluster( - resourceGroupName, - mongoClusterName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByMongoClusterNext( - resourceGroupName, - mongoClusterName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByMongoClusterPagingAll( - resourceGroupName: string, - mongoClusterName: string, - options?: FirewallRulesListByMongoClusterOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByMongoClusterPagingPage( - resourceGroupName, - mongoClusterName, - options, - )) { - yield* page; - } - } - - /** - * List all the firewall rules in a given mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - private _listByMongoCluster( - resourceGroupName: string, - mongoClusterName: string, - options?: FirewallRulesListByMongoClusterOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, mongoClusterName, options }, - listByMongoClusterOperationSpec, - ); - } - - /** - * Gets information about a mongo cluster firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - options?: FirewallRulesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, mongoClusterName, firewallRuleName, options }, - getOperationSpec, - ); - } - - /** - * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - resource: FirewallRule, - options?: FirewallRulesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - FirewallRulesCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - mongoClusterName, - firewallRuleName, - resource, - options, - }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - FirewallRulesCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - resource: FirewallRule, - options?: FirewallRulesCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - mongoClusterName, - firewallRuleName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Deletes a mongo cluster firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - options?: FirewallRulesDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - FirewallRulesDeleteResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, mongoClusterName, firewallRuleName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - FirewallRulesDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Deletes a mongo cluster firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - options?: FirewallRulesDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - mongoClusterName, - firewallRuleName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * ListByMongoClusterNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param nextLink The nextLink from the previous successful call to the ListByMongoCluster method. - * @param options The options parameters. - */ - private _listByMongoClusterNext( - resourceGroupName: string, - mongoClusterName: string, - nextLink: string, - options?: FirewallRulesListByMongoClusterNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, mongoClusterName, nextLink, options }, - listByMongoClusterNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByMongoClusterOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.FirewallRuleListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.FirewallRule, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - Parameters.firewallRuleName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.FirewallRule, - }, - 201: { - bodyMapper: Mappers.FirewallRule, - }, - 202: { - bodyMapper: Mappers.FirewallRule, - }, - 204: { - bodyMapper: Mappers.FirewallRule, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - Parameters.firewallRuleName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.FirewallRulesDeleteHeaders, - }, - 201: { - headersMapper: Mappers.FirewallRulesDeleteHeaders, - }, - 202: { - headersMapper: Mappers.FirewallRulesDeleteHeaders, - }, - 204: { - headersMapper: Mappers.FirewallRulesDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - Parameters.firewallRuleName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByMongoClusterNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.FirewallRuleListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/operations/index.ts deleted file mode 100644 index 3382f99091c6..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operations/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./operations"; -export * from "./mongoClusters"; -export * from "./firewallRules"; -export * from "./privateEndpointConnections"; -export * from "./privateLinks"; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/mongoClusters.ts b/sdk/mongocluster/arm-mongocluster/src/operations/mongoClusters.ts deleted file mode 100644 index 833b14b74dd6..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operations/mongoClusters.ts +++ /dev/null @@ -1,812 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { MongoClusters } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl"; -import { - MongoCluster, - MongoClustersListNextOptionalParams, - MongoClustersListOptionalParams, - MongoClustersListResponse, - MongoClustersListByResourceGroupNextOptionalParams, - MongoClustersListByResourceGroupOptionalParams, - MongoClustersListByResourceGroupResponse, - CheckNameAvailabilityRequest, - MongoClustersCheckNameAvailabilityOptionalParams, - MongoClustersCheckNameAvailabilityResponse, - MongoClustersGetOptionalParams, - MongoClustersGetResponse, - MongoClustersCreateOrUpdateOptionalParams, - MongoClustersCreateOrUpdateResponse, - MongoClusterUpdate, - MongoClustersUpdateOptionalParams, - MongoClustersUpdateResponse, - MongoClustersDeleteOptionalParams, - MongoClustersDeleteResponse, - MongoClustersListConnectionStringsOptionalParams, - MongoClustersListConnectionStringsResponse, - MongoClustersListNextResponse, - MongoClustersListByResourceGroupNextResponse, -} from "../models"; - -/// -/** Class containing MongoClusters operations. */ -export class MongoClustersImpl implements MongoClusters { - private readonly client: MongoClusterManagementClient; - - /** - * Initialize a new instance of the class MongoClusters class. - * @param client Reference to the service client - */ - constructor(client: MongoClusterManagementClient) { - this.client = client; - } - - /** - * List all the mongo clusters in a given subscription. - * @param options The options parameters. - */ - public list( - options?: MongoClustersListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - }, - }; - } - - private async *listPagingPage( - options?: MongoClustersListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: MongoClustersListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: MongoClustersListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * List all the mongo clusters in a given resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - public listByResourceGroup( - resourceGroupName: string, - options?: MongoClustersListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByResourceGroupPagingPage( - resourceGroupName, - options, - settings, - ); - }, - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroupName: string, - options?: MongoClustersListByResourceGroupOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: MongoClustersListByResourceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByResourceGroup(resourceGroupName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByResourceGroupNext( - resourceGroupName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByResourceGroupPagingAll( - resourceGroupName: string, - options?: MongoClustersListByResourceGroupOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage( - resourceGroupName, - options, - )) { - yield* page; - } - } - - /** - * Check if mongo cluster name is available for use. - * @param location The name of the Azure region. - * @param body The CheckAvailability request - * @param options The options parameters. - */ - checkNameAvailability( - location: string, - body: CheckNameAvailabilityRequest, - options?: MongoClustersCheckNameAvailabilityOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { location, body, options }, - checkNameAvailabilityOperationSpec, - ); - } - - /** - * List all the mongo clusters in a given subscription. - * @param options The options parameters. - */ - private _list( - options?: MongoClustersListOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * List all the mongo clusters in a given resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - private _listByResourceGroup( - resourceGroupName: string, - options?: MongoClustersListByResourceGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec, - ); - } - - /** - * Gets information about a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - mongoClusterName: string, - options?: MongoClustersGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, mongoClusterName, options }, - getOperationSpec, - ); - } - - /** - * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify - * some of the properties, use PATCH. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - mongoClusterName: string, - resource: MongoCluster, - options?: MongoClustersCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - MongoClustersCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, mongoClusterName, resource, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - MongoClustersCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify - * some of the properties, use PATCH. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - mongoClusterName: string, - resource: MongoCluster, - options?: MongoClustersCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - mongoClusterName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Updates an existing mongo cluster. The request body can contain one to many of the properties - * present in the normal mongo cluster definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - mongoClusterName: string, - properties: MongoClusterUpdate, - options?: MongoClustersUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - MongoClustersUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, mongoClusterName, properties, options }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - MongoClustersUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Updates an existing mongo cluster. The request body can contain one to many of the properties - * present in the normal mongo cluster definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - mongoClusterName: string, - properties: MongoClusterUpdate, - options?: MongoClustersUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - mongoClusterName, - properties, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Deletes a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - mongoClusterName: string, - options?: MongoClustersDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - MongoClustersDeleteResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, mongoClusterName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - MongoClustersDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Deletes a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - mongoClusterName: string, - options?: MongoClustersDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - mongoClusterName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * 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. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - listConnectionStrings( - resourceGroupName: string, - mongoClusterName: string, - options?: MongoClustersListConnectionStringsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, mongoClusterName, options }, - listConnectionStringsOperationSpec, - ); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: MongoClustersListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec, - ); - } - - /** - * ListByResourceGroupNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. - * @param options The options parameters. - */ - private _listByResourceGroupNext( - resourceGroupName: string, - nextLink: string, - options?: MongoClustersListByResourceGroupNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/checkMongoClusterNameAvailability", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CheckNameAvailabilityResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.body, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.location, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MongoClusterListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MongoClusterListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MongoCluster, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.MongoCluster, - }, - 201: { - bodyMapper: Mappers.MongoCluster, - }, - 202: { - bodyMapper: Mappers.MongoCluster, - }, - 204: { - bodyMapper: Mappers.MongoCluster, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.MongoCluster, - }, - 201: { - bodyMapper: Mappers.MongoCluster, - }, - 202: { - bodyMapper: Mappers.MongoCluster, - }, - 204: { - bodyMapper: Mappers.MongoCluster, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.properties, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.MongoClustersDeleteHeaders, - }, - 201: { - headersMapper: Mappers.MongoClustersDeleteHeaders, - }, - 202: { - headersMapper: Mappers.MongoClustersDeleteHeaders, - }, - 204: { - headersMapper: Mappers.MongoClustersDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listConnectionStringsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/listConnectionStrings", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.ListConnectionStringsResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MongoClusterListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.MongoClusterListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/operations.ts b/sdk/mongocluster/arm-mongocluster/src/operations/operations.ts deleted file mode 100644 index 10e01a666348..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operations/operations.ts +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { Operations } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; -import { - Operation, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse, -} from "../models"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: MongoClusterManagementClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: MongoClusterManagementClient) { - this.client = client; - } - - /** - * List the operations for the provider - * @param options The options parameters. - */ - public list( - options?: OperationsListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - }, - }; - } - - private async *listPagingPage( - options?: OperationsListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: OperationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: OperationsListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * List the operations for the provider - * @param options The options parameters. - */ - private _list( - options?: OperationsListOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: OperationsListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.DocumentDB/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/privateEndpointConnections.ts b/sdk/mongocluster/arm-mongocluster/src/operations/privateEndpointConnections.ts deleted file mode 100644 index fe57bdd69f27..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operations/privateEndpointConnections.ts +++ /dev/null @@ -1,536 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { PrivateEndpointConnections } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl"; -import { - PrivateEndpointConnectionResource, - PrivateEndpointConnectionsListByMongoClusterNextOptionalParams, - PrivateEndpointConnectionsListByMongoClusterOptionalParams, - PrivateEndpointConnectionsListByMongoClusterResponse, - PrivateEndpointConnectionsGetOptionalParams, - PrivateEndpointConnectionsGetResponse, - PrivateEndpointConnectionsCreateOptionalParams, - PrivateEndpointConnectionsCreateResponse, - PrivateEndpointConnectionsDeleteOptionalParams, - PrivateEndpointConnectionsDeleteResponse, - PrivateEndpointConnectionsListByMongoClusterNextResponse, -} from "../models"; - -/// -/** Class containing PrivateEndpointConnections operations. */ -export class PrivateEndpointConnectionsImpl - implements PrivateEndpointConnections -{ - private readonly client: MongoClusterManagementClient; - - /** - * Initialize a new instance of the class PrivateEndpointConnections class. - * @param client Reference to the service client - */ - constructor(client: MongoClusterManagementClient) { - this.client = client; - } - - /** - * List existing private connections - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - public listByMongoCluster( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByMongoClusterPagingAll( - resourceGroupName, - mongoClusterName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByMongoClusterPagingPage( - resourceGroupName, - mongoClusterName, - options, - settings, - ); - }, - }; - } - - private async *listByMongoClusterPagingPage( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: PrivateEndpointConnectionsListByMongoClusterResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByMongoCluster( - resourceGroupName, - mongoClusterName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByMongoClusterNext( - resourceGroupName, - mongoClusterName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByMongoClusterPagingAll( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByMongoClusterPagingPage( - resourceGroupName, - mongoClusterName, - options, - )) { - yield* page; - } - } - - /** - * List existing private connections - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - private _listByMongoCluster( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, mongoClusterName, options }, - listByMongoClusterOperationSpec, - ); - } - - /** - * Get a specific private connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - options, - }, - getOperationSpec, - ); - } - - /** - * Create a Private endpoint connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreate( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - resource: PrivateEndpointConnectionResource, - options?: PrivateEndpointConnectionsCreateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsCreateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - resource, - options, - }, - spec: createOperationSpec, - }); - const poller = await createHttpPoller< - PrivateEndpointConnectionsCreateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create a Private endpoint connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateAndWait( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - resource: PrivateEndpointConnectionResource, - options?: PrivateEndpointConnectionsCreateOptionalParams, - ): Promise { - const poller = await this.beginCreate( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete the private endpoint connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsDeleteResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ) => { - let currentRawResponse: coreClient.FullOperationResponse | undefined = - undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown, - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback, - }, - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON(), - }, - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - options, - }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - PrivateEndpointConnectionsDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete the private endpoint connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * ListByMongoClusterNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param nextLink The nextLink from the previous successful call to the ListByMongoCluster method. - * @param options The options parameters. - */ - private _listByMongoClusterNext( - resourceGroupName: string, - mongoClusterName: string, - nextLink: string, - options?: PrivateEndpointConnectionsListByMongoClusterNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, mongoClusterName, nextLink, options }, - listByMongoClusterNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByMongoClusterOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnectionResourceListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnectionResource, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - Parameters.privateEndpointConnectionName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnectionResource, - }, - 201: { - bodyMapper: Mappers.PrivateEndpointConnectionResource, - }, - 202: { - bodyMapper: Mappers.PrivateEndpointConnectionResource, - }, - 204: { - bodyMapper: Mappers.PrivateEndpointConnectionResource, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource2, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - Parameters.privateEndpointConnectionName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, - }, - 201: { - headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, - }, - 202: { - headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, - }, - 204: { - headersMapper: Mappers.PrivateEndpointConnectionsDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - Parameters.privateEndpointConnectionName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByMongoClusterNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateEndpointConnectionResourceListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operations/privateLinks.ts b/sdk/mongocluster/arm-mongocluster/src/operations/privateLinks.ts deleted file mode 100644 index cbbfbb39cce5..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operations/privateLinks.ts +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { PrivateLinks } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { MongoClusterManagementClient } from "../mongoClusterManagementClient"; -import { - PrivateLinkResource, - PrivateLinksListByMongoClusterNextOptionalParams, - PrivateLinksListByMongoClusterOptionalParams, - PrivateLinksListByMongoClusterResponse, - PrivateLinksListByMongoClusterNextResponse, -} from "../models"; - -/// -/** Class containing PrivateLinks operations. */ -export class PrivateLinksImpl implements PrivateLinks { - private readonly client: MongoClusterManagementClient; - - /** - * Initialize a new instance of the class PrivateLinks class. - * @param client Reference to the service client - */ - constructor(client: MongoClusterManagementClient) { - this.client = client; - } - - /** - * list private links on the given resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - public listByMongoCluster( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateLinksListByMongoClusterOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByMongoClusterPagingAll( - resourceGroupName, - mongoClusterName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByMongoClusterPagingPage( - resourceGroupName, - mongoClusterName, - options, - settings, - ); - }, - }; - } - - private async *listByMongoClusterPagingPage( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateLinksListByMongoClusterOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: PrivateLinksListByMongoClusterResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByMongoCluster( - resourceGroupName, - mongoClusterName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByMongoClusterNext( - resourceGroupName, - mongoClusterName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByMongoClusterPagingAll( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateLinksListByMongoClusterOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByMongoClusterPagingPage( - resourceGroupName, - mongoClusterName, - options, - )) { - yield* page; - } - } - - /** - * list private links on the given resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - private _listByMongoCluster( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateLinksListByMongoClusterOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, mongoClusterName, options }, - listByMongoClusterOperationSpec, - ); - } - - /** - * ListByMongoClusterNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param nextLink The nextLink from the previous successful call to the ListByMongoCluster method. - * @param options The options parameters. - */ - private _listByMongoClusterNext( - resourceGroupName: string, - mongoClusterName: string, - nextLink: string, - options?: PrivateLinksListByMongoClusterNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, mongoClusterName, nextLink, options }, - listByMongoClusterNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByMongoClusterOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateLinkResources", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateLinkResourceListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByMongoClusterNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PrivateLinkResourceListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.mongoClusterName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/firewallRules.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/firewallRules.ts deleted file mode 100644 index d64ea9176c90..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/firewallRules.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - FirewallRule, - FirewallRulesListByMongoClusterOptionalParams, - FirewallRulesGetOptionalParams, - FirewallRulesGetResponse, - FirewallRulesCreateOrUpdateOptionalParams, - FirewallRulesCreateOrUpdateResponse, - FirewallRulesDeleteOptionalParams, - FirewallRulesDeleteResponse, -} from "../models"; - -/// -/** Interface representing a FirewallRules. */ -export interface FirewallRules { - /** - * List all the firewall rules in a given mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - listByMongoCluster( - resourceGroupName: string, - mongoClusterName: string, - options?: FirewallRulesListByMongoClusterOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Gets information about a mongo cluster firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - options?: FirewallRulesGetOptionalParams, - ): Promise; - /** - * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - resource: FirewallRule, - options?: FirewallRulesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - FirewallRulesCreateOrUpdateResponse - > - >; - /** - * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - resource: FirewallRule, - options?: FirewallRulesCreateOrUpdateOptionalParams, - ): Promise; - /** - * Deletes a mongo cluster firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - options?: FirewallRulesDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - FirewallRulesDeleteResponse - > - >; - /** - * Deletes a mongo cluster firewall rule. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param firewallRuleName The name of the mongo cluster firewall rule. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - mongoClusterName: string, - firewallRuleName: string, - options?: FirewallRulesDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/index.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/index.ts deleted file mode 100644 index 3382f99091c6..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./operations"; -export * from "./mongoClusters"; -export * from "./firewallRules"; -export * from "./privateEndpointConnections"; -export * from "./privateLinks"; diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/mongoClusters.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/mongoClusters.ts deleted file mode 100644 index 858dc96bea1c..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/mongoClusters.ts +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - MongoCluster, - MongoClustersListOptionalParams, - MongoClustersListByResourceGroupOptionalParams, - CheckNameAvailabilityRequest, - MongoClustersCheckNameAvailabilityOptionalParams, - MongoClustersCheckNameAvailabilityResponse, - MongoClustersGetOptionalParams, - MongoClustersGetResponse, - MongoClustersCreateOrUpdateOptionalParams, - MongoClustersCreateOrUpdateResponse, - MongoClusterUpdate, - MongoClustersUpdateOptionalParams, - MongoClustersUpdateResponse, - MongoClustersDeleteOptionalParams, - MongoClustersDeleteResponse, - MongoClustersListConnectionStringsOptionalParams, - MongoClustersListConnectionStringsResponse, -} from "../models"; - -/// -/** Interface representing a MongoClusters. */ -export interface MongoClusters { - /** - * List all the mongo clusters in a given subscription. - * @param options The options parameters. - */ - list( - options?: MongoClustersListOptionalParams, - ): PagedAsyncIterableIterator; - /** - * List all the mongo clusters in a given resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - listByResourceGroup( - resourceGroupName: string, - options?: MongoClustersListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Check if mongo cluster name is available for use. - * @param location The name of the Azure region. - * @param body The CheckAvailability request - * @param options The options parameters. - */ - checkNameAvailability( - location: string, - body: CheckNameAvailabilityRequest, - options?: MongoClustersCheckNameAvailabilityOptionalParams, - ): Promise; - /** - * Gets information about a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - mongoClusterName: string, - options?: MongoClustersGetOptionalParams, - ): Promise; - /** - * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify - * some of the properties, use PATCH. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - mongoClusterName: string, - resource: MongoCluster, - options?: MongoClustersCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - MongoClustersCreateOrUpdateResponse - > - >; - /** - * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify - * some of the properties, use PATCH. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - mongoClusterName: string, - resource: MongoCluster, - options?: MongoClustersCreateOrUpdateOptionalParams, - ): Promise; - /** - * Updates an existing mongo cluster. The request body can contain one to many of the properties - * present in the normal mongo cluster definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - mongoClusterName: string, - properties: MongoClusterUpdate, - options?: MongoClustersUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - MongoClustersUpdateResponse - > - >; - /** - * Updates an existing mongo cluster. The request body can contain one to many of the properties - * present in the normal mongo cluster definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - mongoClusterName: string, - properties: MongoClusterUpdate, - options?: MongoClustersUpdateOptionalParams, - ): Promise; - /** - * Deletes a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - mongoClusterName: string, - options?: MongoClustersDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - MongoClustersDeleteResponse - > - >; - /** - * Deletes a mongo cluster. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - mongoClusterName: string, - options?: MongoClustersDeleteOptionalParams, - ): Promise; - /** - * 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. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - listConnectionStrings( - resourceGroupName: string, - mongoClusterName: string, - options?: MongoClustersListConnectionStringsOptionalParams, - ): Promise; -} diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/operations.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/operations.ts deleted file mode 100644 index 251f5f582e64..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { Operation, OperationsListOptionalParams } from "../models"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * List the operations for the provider - * @param options The options parameters. - */ - list( - options?: OperationsListOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateEndpointConnections.ts deleted file mode 100644 index 986583717249..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateEndpointConnections.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - PrivateEndpointConnectionResource, - PrivateEndpointConnectionsListByMongoClusterOptionalParams, - PrivateEndpointConnectionsGetOptionalParams, - PrivateEndpointConnectionsGetResponse, - PrivateEndpointConnectionsCreateOptionalParams, - PrivateEndpointConnectionsCreateResponse, - PrivateEndpointConnectionsDeleteOptionalParams, - PrivateEndpointConnectionsDeleteResponse, -} from "../models"; - -/// -/** Interface representing a PrivateEndpointConnections. */ -export interface PrivateEndpointConnections { - /** - * List existing private connections - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - listByMongoCluster( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a specific private connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsGetOptionalParams, - ): Promise; - /** - * Create a Private endpoint connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreate( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - resource: PrivateEndpointConnectionResource, - options?: PrivateEndpointConnectionsCreateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsCreateResponse - > - >; - /** - * Create a Private endpoint connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateAndWait( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - resource: PrivateEndpointConnectionResource, - options?: PrivateEndpointConnectionsCreateOptionalParams, - ): Promise; - /** - * Delete the private endpoint connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - PrivateEndpointConnectionsDeleteResponse - > - >; - /** - * Delete the private endpoint connection - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param privateEndpointConnectionName The name of the private endpoint connection associated with the - * Azure resource. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - mongoClusterName: string, - privateEndpointConnectionName: string, - options?: PrivateEndpointConnectionsDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateLinks.ts b/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateLinks.ts deleted file mode 100644 index aaaac73ccc11..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/operationsInterfaces/privateLinks.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - PrivateLinkResource, - PrivateLinksListByMongoClusterOptionalParams, -} from "../models"; - -/// -/** Interface representing a PrivateLinks. */ -export interface PrivateLinks { - /** - * list private links on the given resource - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. - * @param options The options parameters. - */ - listByMongoCluster( - resourceGroupName: string, - mongoClusterName: string, - options?: PrivateLinksListByMongoClusterOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/mongocluster/arm-mongocluster/src/pagingHelper.ts b/sdk/mongocluster/arm-mongocluster/src/pagingHelper.ts deleted file mode 100644 index 205cccc26592..000000000000 --- a/sdk/mongocluster/arm-mongocluster/src/pagingHelper.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken( - page: unknown, - continuationToken: string | undefined, -): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/clientDefinitions.ts b/sdk/mongocluster/arm-mongocluster/src/rest/clientDefinitions.ts new file mode 100644 index 000000000000..46836515deba --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/clientDefinitions.ts @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + OperationsListParameters, + MongoClustersGetParameters, + MongoClustersCreateOrUpdateParameters, + MongoClustersUpdateParameters, + MongoClustersDeleteParameters, + MongoClustersListByResourceGroupParameters, + MongoClustersListParameters, + MongoClustersListConnectionStringsParameters, + MongoClustersCheckNameAvailabilityParameters, + FirewallRulesGetParameters, + FirewallRulesCreateOrUpdateParameters, + FirewallRulesDeleteParameters, + FirewallRulesListByMongoClusterParameters, + PrivateEndpointConnectionsListByMongoClusterParameters, + PrivateEndpointConnectionsGetParameters, + PrivateEndpointConnectionsCreateParameters, + PrivateEndpointConnectionsDeleteParameters, + PrivateLinksListByMongoClusterParameters, +} from "./parameters.js"; +import { + OperationsList200Response, + OperationsListDefaultResponse, + MongoClustersGet200Response, + MongoClustersGetDefaultResponse, + MongoClustersCreateOrUpdate200Response, + MongoClustersCreateOrUpdate201Response, + MongoClustersCreateOrUpdateDefaultResponse, + MongoClustersUpdate200Response, + MongoClustersUpdate202Response, + MongoClustersUpdateDefaultResponse, + MongoClustersDelete202Response, + MongoClustersDelete204Response, + MongoClustersDeleteDefaultResponse, + MongoClustersListByResourceGroup200Response, + MongoClustersListByResourceGroupDefaultResponse, + MongoClustersList200Response, + MongoClustersListDefaultResponse, + MongoClustersListConnectionStrings200Response, + MongoClustersListConnectionStringsDefaultResponse, + MongoClustersCheckNameAvailability200Response, + MongoClustersCheckNameAvailabilityDefaultResponse, + FirewallRulesGet200Response, + FirewallRulesGetDefaultResponse, + FirewallRulesCreateOrUpdate200Response, + FirewallRulesCreateOrUpdate201Response, + FirewallRulesCreateOrUpdate202Response, + FirewallRulesCreateOrUpdateDefaultResponse, + FirewallRulesDelete202Response, + FirewallRulesDelete204Response, + FirewallRulesDeleteDefaultResponse, + FirewallRulesListByMongoCluster200Response, + FirewallRulesListByMongoClusterDefaultResponse, + PrivateEndpointConnectionsListByMongoCluster200Response, + PrivateEndpointConnectionsListByMongoClusterDefaultResponse, + PrivateEndpointConnectionsGet200Response, + PrivateEndpointConnectionsGetDefaultResponse, + PrivateEndpointConnectionsCreate200Response, + PrivateEndpointConnectionsCreate201Response, + PrivateEndpointConnectionsCreate202Response, + PrivateEndpointConnectionsCreateDefaultResponse, + PrivateEndpointConnectionsDelete202Response, + PrivateEndpointConnectionsDelete204Response, + PrivateEndpointConnectionsDeleteDefaultResponse, + PrivateLinksListByMongoCluster200Response, + PrivateLinksListByMongoClusterDefaultResponse, +} from "./responses.js"; +import { Client, StreamableMethod } from "@azure-rest/core-client"; + +export interface OperationsList { + /** List the operations for the provider */ + get( + options?: OperationsListParameters, + ): StreamableMethod< + OperationsList200Response | OperationsListDefaultResponse + >; +} + +export interface MongoClustersGet { + /** Gets information about a mongo cluster. */ + get( + options?: MongoClustersGetParameters, + ): StreamableMethod< + MongoClustersGet200Response | MongoClustersGetDefaultResponse + >; + /** Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. */ + put( + options: MongoClustersCreateOrUpdateParameters, + ): StreamableMethod< + | MongoClustersCreateOrUpdate200Response + | MongoClustersCreateOrUpdate201Response + | MongoClustersCreateOrUpdateDefaultResponse + >; + /** Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. */ + patch( + options: MongoClustersUpdateParameters, + ): StreamableMethod< + | MongoClustersUpdate200Response + | MongoClustersUpdate202Response + | MongoClustersUpdateDefaultResponse + >; + /** Deletes a mongo cluster. */ + delete( + options?: MongoClustersDeleteParameters, + ): StreamableMethod< + | MongoClustersDelete202Response + | MongoClustersDelete204Response + | MongoClustersDeleteDefaultResponse + >; +} + +export interface MongoClustersListByResourceGroup { + /** List all the mongo clusters in a given resource group. */ + get( + options?: MongoClustersListByResourceGroupParameters, + ): StreamableMethod< + | MongoClustersListByResourceGroup200Response + | MongoClustersListByResourceGroupDefaultResponse + >; +} + +export interface MongoClustersList { + /** List all the mongo clusters in a given subscription. */ + get( + options?: MongoClustersListParameters, + ): StreamableMethod< + MongoClustersList200Response | MongoClustersListDefaultResponse + >; +} + +export interface MongoClustersListConnectionStrings { + /** 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. */ + post( + options: MongoClustersListConnectionStringsParameters, + ): StreamableMethod< + | MongoClustersListConnectionStrings200Response + | MongoClustersListConnectionStringsDefaultResponse + >; +} + +export interface MongoClustersCheckNameAvailability { + /** Check if mongo cluster name is available for use. */ + post( + options: MongoClustersCheckNameAvailabilityParameters, + ): StreamableMethod< + | MongoClustersCheckNameAvailability200Response + | MongoClustersCheckNameAvailabilityDefaultResponse + >; +} + +export interface FirewallRulesGet { + /** Gets information about a mongo cluster firewall rule. */ + get( + options?: FirewallRulesGetParameters, + ): StreamableMethod< + FirewallRulesGet200Response | FirewallRulesGetDefaultResponse + >; + /** Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. */ + put( + options: FirewallRulesCreateOrUpdateParameters, + ): StreamableMethod< + | FirewallRulesCreateOrUpdate200Response + | FirewallRulesCreateOrUpdate201Response + | FirewallRulesCreateOrUpdate202Response + | FirewallRulesCreateOrUpdateDefaultResponse + >; + /** Deletes a mongo cluster firewall rule. */ + delete( + options?: FirewallRulesDeleteParameters, + ): StreamableMethod< + | FirewallRulesDelete202Response + | FirewallRulesDelete204Response + | FirewallRulesDeleteDefaultResponse + >; +} + +export interface FirewallRulesListByMongoCluster { + /** List all the firewall rules in a given mongo cluster. */ + get( + options?: FirewallRulesListByMongoClusterParameters, + ): StreamableMethod< + | FirewallRulesListByMongoCluster200Response + | FirewallRulesListByMongoClusterDefaultResponse + >; +} + +export interface PrivateEndpointConnectionsListByMongoCluster { + /** List existing private connections */ + get( + options?: PrivateEndpointConnectionsListByMongoClusterParameters, + ): StreamableMethod< + | PrivateEndpointConnectionsListByMongoCluster200Response + | PrivateEndpointConnectionsListByMongoClusterDefaultResponse + >; +} + +export interface PrivateEndpointConnectionsGet { + /** Get a specific private connection */ + get( + options?: PrivateEndpointConnectionsGetParameters, + ): StreamableMethod< + | PrivateEndpointConnectionsGet200Response + | PrivateEndpointConnectionsGetDefaultResponse + >; + /** Create a Private endpoint connection */ + put( + options: PrivateEndpointConnectionsCreateParameters, + ): StreamableMethod< + | PrivateEndpointConnectionsCreate200Response + | PrivateEndpointConnectionsCreate201Response + | PrivateEndpointConnectionsCreate202Response + | PrivateEndpointConnectionsCreateDefaultResponse + >; + /** Delete the private endpoint connection */ + delete( + options?: PrivateEndpointConnectionsDeleteParameters, + ): StreamableMethod< + | PrivateEndpointConnectionsDelete202Response + | PrivateEndpointConnectionsDelete204Response + | PrivateEndpointConnectionsDeleteDefaultResponse + >; +} + +export interface PrivateLinksListByMongoCluster { + /** list private links on the given resource */ + get( + options?: PrivateLinksListByMongoClusterParameters, + ): StreamableMethod< + | PrivateLinksListByMongoCluster200Response + | PrivateLinksListByMongoClusterDefaultResponse + >; +} + +export interface Routes { + /** Resource for '/providers/Microsoft.DocumentDB/operations' has methods for the following verbs: get */ + (path: "/providers/Microsoft.DocumentDB/operations"): OperationsList; + /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.DocumentDB/mongoClusters/\{mongoClusterName\}' has methods for the following verbs: get, put, patch, delete */ + ( + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}", + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + ): MongoClustersGet; + /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.DocumentDB/mongoClusters' has methods for the following verbs: get */ + ( + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters", + subscriptionId: string, + resourceGroupName: string, + ): MongoClustersListByResourceGroup; + /** Resource for '/subscriptions/\{subscriptionId\}/providers/Microsoft.DocumentDB/mongoClusters' has methods for the following verbs: get */ + ( + path: "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters", + subscriptionId: string, + ): MongoClustersList; + /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.DocumentDB/mongoClusters/\{mongoClusterName\}/listConnectionStrings' has methods for the following verbs: post */ + ( + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/listConnectionStrings", + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + ): MongoClustersListConnectionStrings; + /** Resource for '/subscriptions/\{subscriptionId\}/providers/Microsoft.DocumentDB/locations/\{location\}/checkMongoClusterNameAvailability' has methods for the following verbs: post */ + ( + path: "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/checkMongoClusterNameAvailability", + subscriptionId: string, + location: string, + ): MongoClustersCheckNameAvailability; + /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.DocumentDB/mongoClusters/\{mongoClusterName\}/firewallRules/\{firewallRuleName\}' has methods for the following verbs: get, put, delete */ + ( + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}", + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + firewallRuleName: string, + ): FirewallRulesGet; + /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.DocumentDB/mongoClusters/\{mongoClusterName\}/firewallRules' has methods for the following verbs: get */ + ( + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules", + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + ): FirewallRulesListByMongoCluster; + /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.DocumentDB/mongoClusters/\{mongoClusterName\}/privateEndpointConnections' has methods for the following verbs: get */ + ( + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections", + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + ): PrivateEndpointConnectionsListByMongoCluster; + /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.DocumentDB/mongoClusters/\{mongoClusterName\}/privateEndpointConnections/\{privateEndpointConnectionName\}' has methods for the following verbs: get, put, delete */ + ( + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}", + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + privateEndpointConnectionName: string, + ): PrivateEndpointConnectionsGet; + /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.DocumentDB/mongoClusters/\{mongoClusterName\}/privateLinkResources' has methods for the following verbs: get */ + ( + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateLinkResources", + subscriptionId: string, + resourceGroupName: string, + mongoClusterName: string, + ): PrivateLinksListByMongoCluster; +} + +export type DocumentDBContext = Client & { + path: Routes; +}; diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts b/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts new file mode 100644 index 000000000000..1bb10a682dfa --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; +import { TokenCredential } from "@azure/core-auth"; +import { DocumentDBContext } from "./clientDefinitions.js"; + +/** + * Initialize a new instance of `DocumentDBContext` + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ +export default function createClient( + credentials: TokenCredential, + options: ClientOptions = {}, +): DocumentDBContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; + options.apiVersion = options.apiVersion ?? "2024-03-01-preview"; + const userAgentInfo = `azsdk-js-arm-mongocluster-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + + const client = getClient( + endpointUrl, + credentials, + options, + ) as DocumentDBContext; + + return client; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/index.ts b/sdk/mongocluster/arm-mongocluster/src/rest/index.ts new file mode 100644 index 000000000000..1e93ef0cbc8a --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/index.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import DocumentDBClient from "./documentDBClient.js"; + +export * from "./documentDBClient.js"; +export * from "./parameters.js"; +export * from "./responses.js"; +export * from "./clientDefinitions.js"; +export * from "./isUnexpected.js"; +export * from "./models.js"; +export * from "./outputModels.js"; +export * from "./paginateHelper.js"; +export * from "./pollingHelper.js"; + +export default DocumentDBClient; diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/isUnexpected.ts b/sdk/mongocluster/arm-mongocluster/src/rest/isUnexpected.ts new file mode 100644 index 000000000000..8b33bc12ff07 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/isUnexpected.ts @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + OperationsList200Response, + OperationsListDefaultResponse, + MongoClustersGet200Response, + MongoClustersGetDefaultResponse, + MongoClustersCreateOrUpdate200Response, + MongoClustersCreateOrUpdate201Response, + MongoClustersCreateOrUpdateLogicalResponse, + MongoClustersCreateOrUpdateDefaultResponse, + MongoClustersUpdate200Response, + MongoClustersUpdate202Response, + MongoClustersUpdateLogicalResponse, + MongoClustersUpdateDefaultResponse, + MongoClustersDelete202Response, + MongoClustersDelete204Response, + MongoClustersDeleteLogicalResponse, + MongoClustersDeleteDefaultResponse, + MongoClustersListByResourceGroup200Response, + MongoClustersListByResourceGroupDefaultResponse, + MongoClustersList200Response, + MongoClustersListDefaultResponse, + MongoClustersListConnectionStrings200Response, + MongoClustersListConnectionStringsDefaultResponse, + MongoClustersCheckNameAvailability200Response, + MongoClustersCheckNameAvailabilityDefaultResponse, + FirewallRulesGet200Response, + FirewallRulesGetDefaultResponse, + FirewallRulesCreateOrUpdate200Response, + FirewallRulesCreateOrUpdate201Response, + FirewallRulesCreateOrUpdate202Response, + FirewallRulesCreateOrUpdateLogicalResponse, + FirewallRulesCreateOrUpdateDefaultResponse, + FirewallRulesDelete202Response, + FirewallRulesDelete204Response, + FirewallRulesDeleteLogicalResponse, + FirewallRulesDeleteDefaultResponse, + FirewallRulesListByMongoCluster200Response, + FirewallRulesListByMongoClusterDefaultResponse, + PrivateEndpointConnectionsListByMongoCluster200Response, + PrivateEndpointConnectionsListByMongoClusterDefaultResponse, + PrivateEndpointConnectionsGet200Response, + PrivateEndpointConnectionsGetDefaultResponse, + PrivateEndpointConnectionsCreate200Response, + PrivateEndpointConnectionsCreate201Response, + PrivateEndpointConnectionsCreate202Response, + PrivateEndpointConnectionsCreateLogicalResponse, + PrivateEndpointConnectionsCreateDefaultResponse, + PrivateEndpointConnectionsDelete202Response, + PrivateEndpointConnectionsDelete204Response, + PrivateEndpointConnectionsDeleteLogicalResponse, + PrivateEndpointConnectionsDeleteDefaultResponse, + PrivateLinksListByMongoCluster200Response, + PrivateLinksListByMongoClusterDefaultResponse, +} from "./responses.js"; + +const responseMap: Record = { + "GET /providers/Microsoft.DocumentDB/operations": ["200"], + "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": + ["200"], + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": + ["200", "201"], + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": + ["200", "202"], + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": + ["202", "204"], + "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters": + ["200"], + "GET /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters": + ["200"], + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/listConnectionStrings": + ["200"], + "POST /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/checkMongoClusterNameAvailability": + ["200"], + "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}": + ["200"], + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}": + ["200", "201", "202"], + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}": + ["202", "204"], + "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules": + ["200"], + "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections": + ["200"], + "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}": + ["200"], + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}": + ["200", "201", "202"], + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}": + ["202", "204"], + "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateLinkResources": + ["200"], +}; + +export function isUnexpected( + response: OperationsList200Response | OperationsListDefaultResponse, +): response is OperationsListDefaultResponse; +export function isUnexpected( + response: MongoClustersGet200Response | MongoClustersGetDefaultResponse, +): response is MongoClustersGetDefaultResponse; +export function isUnexpected( + response: + | MongoClustersCreateOrUpdate200Response + | MongoClustersCreateOrUpdate201Response + | MongoClustersCreateOrUpdateLogicalResponse + | MongoClustersCreateOrUpdateDefaultResponse, +): response is MongoClustersCreateOrUpdateDefaultResponse; +export function isUnexpected( + response: + | MongoClustersUpdate200Response + | MongoClustersUpdate202Response + | MongoClustersUpdateLogicalResponse + | MongoClustersUpdateDefaultResponse, +): response is MongoClustersUpdateDefaultResponse; +export function isUnexpected( + response: + | MongoClustersDelete202Response + | MongoClustersDelete204Response + | MongoClustersDeleteLogicalResponse + | MongoClustersDeleteDefaultResponse, +): response is MongoClustersDeleteDefaultResponse; +export function isUnexpected( + response: + | MongoClustersListByResourceGroup200Response + | MongoClustersListByResourceGroupDefaultResponse, +): response is MongoClustersListByResourceGroupDefaultResponse; +export function isUnexpected( + response: MongoClustersList200Response | MongoClustersListDefaultResponse, +): response is MongoClustersListDefaultResponse; +export function isUnexpected( + response: + | MongoClustersListConnectionStrings200Response + | MongoClustersListConnectionStringsDefaultResponse, +): response is MongoClustersListConnectionStringsDefaultResponse; +export function isUnexpected( + response: + | MongoClustersCheckNameAvailability200Response + | MongoClustersCheckNameAvailabilityDefaultResponse, +): response is MongoClustersCheckNameAvailabilityDefaultResponse; +export function isUnexpected( + response: FirewallRulesGet200Response | FirewallRulesGetDefaultResponse, +): response is FirewallRulesGetDefaultResponse; +export function isUnexpected( + response: + | FirewallRulesCreateOrUpdate200Response + | FirewallRulesCreateOrUpdate201Response + | FirewallRulesCreateOrUpdate202Response + | FirewallRulesCreateOrUpdateLogicalResponse + | FirewallRulesCreateOrUpdateDefaultResponse, +): response is FirewallRulesCreateOrUpdateDefaultResponse; +export function isUnexpected( + response: + | FirewallRulesDelete202Response + | FirewallRulesDelete204Response + | FirewallRulesDeleteLogicalResponse + | FirewallRulesDeleteDefaultResponse, +): response is FirewallRulesDeleteDefaultResponse; +export function isUnexpected( + response: + | FirewallRulesListByMongoCluster200Response + | FirewallRulesListByMongoClusterDefaultResponse, +): response is FirewallRulesListByMongoClusterDefaultResponse; +export function isUnexpected( + response: + | PrivateEndpointConnectionsListByMongoCluster200Response + | PrivateEndpointConnectionsListByMongoClusterDefaultResponse, +): response is PrivateEndpointConnectionsListByMongoClusterDefaultResponse; +export function isUnexpected( + response: + | PrivateEndpointConnectionsGet200Response + | PrivateEndpointConnectionsGetDefaultResponse, +): response is PrivateEndpointConnectionsGetDefaultResponse; +export function isUnexpected( + response: + | PrivateEndpointConnectionsCreate200Response + | PrivateEndpointConnectionsCreate201Response + | PrivateEndpointConnectionsCreate202Response + | PrivateEndpointConnectionsCreateLogicalResponse + | PrivateEndpointConnectionsCreateDefaultResponse, +): response is PrivateEndpointConnectionsCreateDefaultResponse; +export function isUnexpected( + response: + | PrivateEndpointConnectionsDelete202Response + | PrivateEndpointConnectionsDelete204Response + | PrivateEndpointConnectionsDeleteLogicalResponse + | PrivateEndpointConnectionsDeleteDefaultResponse, +): response is PrivateEndpointConnectionsDeleteDefaultResponse; +export function isUnexpected( + response: + | PrivateLinksListByMongoCluster200Response + | PrivateLinksListByMongoClusterDefaultResponse, +): response is PrivateLinksListByMongoClusterDefaultResponse; +export function isUnexpected( + response: + | OperationsList200Response + | OperationsListDefaultResponse + | MongoClustersGet200Response + | MongoClustersGetDefaultResponse + | MongoClustersCreateOrUpdate200Response + | MongoClustersCreateOrUpdate201Response + | MongoClustersCreateOrUpdateLogicalResponse + | MongoClustersCreateOrUpdateDefaultResponse + | MongoClustersUpdate200Response + | MongoClustersUpdate202Response + | MongoClustersUpdateLogicalResponse + | MongoClustersUpdateDefaultResponse + | MongoClustersDelete202Response + | MongoClustersDelete204Response + | MongoClustersDeleteLogicalResponse + | MongoClustersDeleteDefaultResponse + | MongoClustersListByResourceGroup200Response + | MongoClustersListByResourceGroupDefaultResponse + | MongoClustersList200Response + | MongoClustersListDefaultResponse + | MongoClustersListConnectionStrings200Response + | MongoClustersListConnectionStringsDefaultResponse + | MongoClustersCheckNameAvailability200Response + | MongoClustersCheckNameAvailabilityDefaultResponse + | FirewallRulesGet200Response + | FirewallRulesGetDefaultResponse + | FirewallRulesCreateOrUpdate200Response + | FirewallRulesCreateOrUpdate201Response + | FirewallRulesCreateOrUpdate202Response + | FirewallRulesCreateOrUpdateLogicalResponse + | FirewallRulesCreateOrUpdateDefaultResponse + | FirewallRulesDelete202Response + | FirewallRulesDelete204Response + | FirewallRulesDeleteLogicalResponse + | FirewallRulesDeleteDefaultResponse + | FirewallRulesListByMongoCluster200Response + | FirewallRulesListByMongoClusterDefaultResponse + | PrivateEndpointConnectionsListByMongoCluster200Response + | PrivateEndpointConnectionsListByMongoClusterDefaultResponse + | PrivateEndpointConnectionsGet200Response + | PrivateEndpointConnectionsGetDefaultResponse + | PrivateEndpointConnectionsCreate200Response + | PrivateEndpointConnectionsCreate201Response + | PrivateEndpointConnectionsCreate202Response + | PrivateEndpointConnectionsCreateLogicalResponse + | PrivateEndpointConnectionsCreateDefaultResponse + | PrivateEndpointConnectionsDelete202Response + | PrivateEndpointConnectionsDelete204Response + | PrivateEndpointConnectionsDeleteLogicalResponse + | PrivateEndpointConnectionsDeleteDefaultResponse + | PrivateLinksListByMongoCluster200Response + | PrivateLinksListByMongoClusterDefaultResponse, +): response is + | OperationsListDefaultResponse + | MongoClustersGetDefaultResponse + | MongoClustersCreateOrUpdateDefaultResponse + | MongoClustersUpdateDefaultResponse + | MongoClustersDeleteDefaultResponse + | MongoClustersListByResourceGroupDefaultResponse + | MongoClustersListDefaultResponse + | MongoClustersListConnectionStringsDefaultResponse + | MongoClustersCheckNameAvailabilityDefaultResponse + | FirewallRulesGetDefaultResponse + | FirewallRulesCreateOrUpdateDefaultResponse + | FirewallRulesDeleteDefaultResponse + | FirewallRulesListByMongoClusterDefaultResponse + | PrivateEndpointConnectionsListByMongoClusterDefaultResponse + | PrivateEndpointConnectionsGetDefaultResponse + | PrivateEndpointConnectionsCreateDefaultResponse + | PrivateEndpointConnectionsDeleteDefaultResponse + | PrivateLinksListByMongoClusterDefaultResponse { + const lroOriginal = response.headers["x-ms-original-url"]; + const url = new URL(lroOriginal ?? response.request.url); + const method = response.request.method; + let pathDetails = responseMap[`${method} ${url.pathname}`]; + if (!pathDetails) { + pathDetails = getParametrizedPathSuccess(method, url.pathname); + } + return !pathDetails.includes(response.status); +} + +function getParametrizedPathSuccess(method: string, path: string): string[] { + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: string[] = []; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(responseMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // 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 + ) { + 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] || ""); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/models.ts b/sdk/mongocluster/arm-mongocluster/src/rest/models.ts new file mode 100644 index 000000000000..7567eb88a4af --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/models.ts @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Represents a mongo cluster resource. */ +export interface MongoCluster extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: MongoClusterProperties; +} + +/** The properties of a mongo cluster. */ +export interface MongoClusterProperties { + /** The mode to create a mongo cluster. */ + createMode?: CreateMode; + /** The parameters to create a point-in-time restore mongo cluster. */ + restoreParameters?: MongoClusterRestoreParameters; + /** The administrator's login for the mongo cluster. */ + administratorLogin?: string; + /** The password of the administrator login. */ + administratorLoginPassword?: string; + /** The Mongo DB server version. Defaults to the latest available version if not specified. */ + serverVersion?: string; + /** Whether or not public endpoint access is allowed for this mongo cluster. */ + publicNetworkAccess?: PublicNetworkAccess; + /** The list of node group specs in the cluster. */ + nodeGroupSpecs?: Array; +} + +/** Parameters used for restore operations */ +export interface MongoClusterRestoreParameters { + /** UTC point in time to restore a mongo cluster */ + pointInTimeUTC?: Date | string; + /** Resource ID to locate the source cluster to restore */ + sourceResourceId?: string; +} + +/** Specification for a node group. */ +export interface NodeGroupSpec { + /** The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. */ + sku?: string; + /** The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. */ + diskSizeGB?: number; + /** Whether high availability is enabled on the node group. */ + enableHa?: boolean; + /** The node type deployed in the node group. */ + kind?: NodeKind; + /** The number of nodes in the node group. */ + nodeCount?: number; +} + +/** The private endpoint connection resource */ +export interface PrivateEndpointConnection extends ProxyResource { + /** The private endpoint connection properties */ + properties?: PrivateEndpointConnectionProperties; +} + +/** Properties of he private endpoint connection resource */ +export interface PrivateEndpointConnectionProperties { + /** The private endpoint resource */ + privateEndpoint?: PrivateEndpoint; + /** A collection of information about the state of the connection between service consumer and provider. */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + /** The provisioning state of the private endpoint connection resource. */ + provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +/** The private endpoint resource */ +export interface PrivateEndpoint { + /** The resource identifier for private endpoint */ + id?: string; +} + +/** A collection of information about the state of the connection between service consumer and provider. */ +export interface PrivateLinkServiceConnectionState { + /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ + status?: PrivateEndpointServiceConnectionStatus; + /** The reason for approval/rejection of the connection. */ + description?: string; + /** A message indicating if changes on the service provider require any updates on the consumer. */ + actionsRequired?: string; +} + +/** The base proxy resource. */ +export interface ProxyResource extends Resource {} + +/** Common properties for all Azure Resource Manager resources. */ +export interface Resource {} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData {} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** The geo-location where the resource lives */ + location: string; + /** Resource tags. */ + tags?: Record; +} + +/** The base extension resource. */ +export interface ExtensionResource extends Resource {} + +/** The resource model definition for an Azure Resource Manager resource with an etag. */ +export interface AzureEntityResource extends Resource {} + +export interface PrivateLinkResource extends ProxyResource { + /** Properties of the private link resource. */ + properties?: PrivateLinkResourceProperties; +} + +/** Properties of a private link resource. */ +export interface PrivateLinkResourceProperties { + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; +} + +/** Represents a mongo cluster firewall rule. */ +export interface FirewallRule extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: FirewallRuleProperties; +} + +/** The properties of a mongo cluster firewall rule. */ +export interface FirewallRuleProperties { + /** The start IP address of the mongo cluster firewall rule. Must be IPv4 format. */ + startIpAddress: string; + /** The end IP address of the mongo cluster firewall rule. Must be IPv4 format. */ + endIpAddress: string; +} + +/** 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. */ + properties?: PrivateEndpointConnectionProperties; +} + +/** 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; +} + +/** The type used for update operations of the MongoCluster. */ +export interface MongoClusterUpdate { + /** Resource tags. */ + tags?: Record; + properties?: MongoClusterUpdateProperties; +} + +/** The updatable properties of the MongoCluster. */ +export interface MongoClusterUpdateProperties { + /** The administrator's login for the mongo cluster. */ + administratorLogin?: string; + /** The password of the administrator login. */ + administratorLoginPassword?: string; + /** The Mongo DB server version. Defaults to the latest available version if not specified. */ + serverVersion?: string; + /** Whether or not public endpoint access is allowed for this mongo cluster. */ + publicNetworkAccess?: PublicNetworkAccess; + /** The list of node group specs in the cluster. */ + nodeGroupSpecs?: Array; +} + +/** The check availability request body. */ +export interface CheckNameAvailabilityRequest { + /** The name of the resource for which availability needs to be checked. */ + name?: string; + /** The resource type. */ + type?: string; +} + +/** Alias for CreateMode */ +export type CreateMode = string | "Default" | "PointInTimeRestore"; +/** Alias for ResourceProvisioningState */ +export type ResourceProvisioningState = + | "Succeeded" + | "Failed" + | "Canceled" + | string; +/** Alias for ProvisioningState */ +export type ProvisioningState = + | string + | ResourceProvisioningState + | "InProgress" + | "Updating" + | "Dropping"; +/** Alias for MongoClusterStatus */ +export type MongoClusterStatus = + | string + | "Ready" + | "Provisioning" + | "Updating" + | "Starting" + | "Stopping" + | "Stopped" + | "Dropping"; +/** Alias for PublicNetworkAccess */ +export type PublicNetworkAccess = string | "Enabled" | "Disabled"; +/** Alias for NodeKind */ +export type NodeKind = string | "Shard"; +/** Alias for PrivateEndpointServiceConnectionStatus */ +export type PrivateEndpointServiceConnectionStatus = + | "Pending" + | "Approved" + | "Rejected" + | string; +/** Alias for PrivateEndpointConnectionProvisioningState */ +export type PrivateEndpointConnectionProvisioningState = + | ResourceProvisioningState + | "Creating" + | "Deleting"; +/** Alias for CreatedByType */ +export type CreatedByType = + | "User" + | "Application" + | "ManagedIdentity" + | "Key" + | string; diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/outputModels.ts b/sdk/mongocluster/arm-mongocluster/src/rest/outputModels.ts new file mode 100644 index 000000000000..4e03f5c1a24f --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/outputModels.ts @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Paged } from "@azure/core-paging"; + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface OperationOutput { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplayOutput; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: OriginOutput; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + actionType?: ActionTypeOutput; +} + +/** Localized display information for and operation. */ +export interface OperationDisplayOutput { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + description?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponseOutput { + /** The error object. */ + error?: ErrorDetailOutput; +} + +/** The error detail. */ +export interface ErrorDetailOutput { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: Array; + /** The error additional info. */ + readonly additionalInfo?: Array; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfoOutput { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: Record; +} + +/** Represents a mongo cluster resource. */ +export interface MongoClusterOutput extends TrackedResourceOutput { + /** The resource-specific properties for this resource. */ + properties?: MongoClusterPropertiesOutput; +} + +/** The properties of a mongo cluster. */ +export interface MongoClusterPropertiesOutput { + /** The mode to create a mongo cluster. */ + createMode?: CreateModeOutput; + /** The parameters to create a point-in-time restore mongo cluster. */ + restoreParameters?: MongoClusterRestoreParametersOutput; + /** The administrator's login for the mongo cluster. */ + administratorLogin?: string; + /** The password of the administrator login. */ + administratorLoginPassword?: string; + /** The Mongo DB server version. Defaults to the latest available version if not specified. */ + serverVersion?: string; + /** The default mongo connection string for the cluster. */ + readonly connectionString?: string; + /** Earliest restore timestamp in UTC ISO8601 format. */ + readonly earliestRestoreTime?: string; + /** The provisioning state of the mongo cluster. */ + readonly provisioningState?: ProvisioningStateOutput; + /** The status of the mongo cluster. */ + readonly clusterStatus?: MongoClusterStatusOutput; + /** Whether or not public endpoint access is allowed for this mongo cluster. */ + publicNetworkAccess?: PublicNetworkAccessOutput; + /** The list of node group specs in the cluster. */ + nodeGroupSpecs?: Array; + /** List of private endpoint connections. */ + readonly privateEndpointConnections?: Array; +} + +/** Parameters used for restore operations */ +export interface MongoClusterRestoreParametersOutput { + /** UTC point in time to restore a mongo cluster */ + pointInTimeUTC?: string; + /** Resource ID to locate the source cluster to restore */ + sourceResourceId?: string; +} + +/** Specification for a node group. */ +export interface NodeGroupSpecOutput { + /** The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. */ + sku?: string; + /** The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. */ + diskSizeGB?: number; + /** Whether high availability is enabled on the node group. */ + enableHa?: boolean; + /** The node type deployed in the node group. */ + kind?: NodeKindOutput; + /** The number of nodes in the node group. */ + nodeCount?: number; +} + +/** The private endpoint connection resource */ +export interface PrivateEndpointConnectionOutput extends ProxyResourceOutput { + /** The private endpoint connection properties */ + properties?: PrivateEndpointConnectionPropertiesOutput; +} + +/** Properties of he private endpoint connection resource */ +export interface PrivateEndpointConnectionPropertiesOutput { + /** The group identifiers for the private endpoint resource */ + readonly groupIds?: string[]; + /** The private endpoint resource */ + privateEndpoint?: PrivateEndpointOutput; + /** A collection of information about the state of the connection between service consumer and provider. */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionStateOutput; + /** The provisioning state of the private endpoint connection resource. */ + provisioningState?: PrivateEndpointConnectionProvisioningStateOutput; +} + +/** The private endpoint resource */ +export interface PrivateEndpointOutput { + /** The resource identifier for private endpoint */ + id?: string; +} + +/** A collection of information about the state of the connection between service consumer and provider. */ +export interface PrivateLinkServiceConnectionStateOutput { + /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ + status?: PrivateEndpointServiceConnectionStatusOutput; + /** The reason for approval/rejection of the connection. */ + description?: string; + /** A message indicating if changes on the service provider require any updates on the consumer. */ + actionsRequired?: string; +} + +/** The base proxy resource. */ +export interface ProxyResourceOutput extends ResourceOutput {} + +/** Common properties for all Azure Resource Manager resources. */ +export interface ResourceOutput { + /** 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?: SystemDataOutput; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemDataOutput { + /** The identity that created the resource. */ + readonly createdBy?: string; + /** The type of identity that created the resource. */ + readonly createdByType?: CreatedByTypeOutput; + /** The type of identity that created the resource. */ + readonly createdAt?: string; + /** The identity that last modified the resource. */ + readonly lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + readonly lastModifiedByType?: CreatedByTypeOutput; + /** The timestamp of resource last modification (UTC) */ + readonly lastModifiedAt?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResourceOutput extends ResourceOutput { + /** The geo-location where the resource lives */ + location: string; + /** Resource tags. */ + tags?: Record; +} + +/** The base extension resource. */ +export interface ExtensionResourceOutput extends ResourceOutput {} + +/** The resource model definition for an Azure Resource Manager resource with an etag. */ +export interface AzureEntityResourceOutput extends ResourceOutput { + /** Resource Etag. */ + readonly etag: string; +} + +export interface PrivateLinkResourceOutput extends ProxyResourceOutput { + /** Properties of the private link resource. */ + properties?: PrivateLinkResourcePropertiesOutput; +} + +/** Properties of a private link resource. */ +export interface PrivateLinkResourcePropertiesOutput { + /** The private link resource group id. */ + readonly groupId?: string; + /** The private link resource required member names. */ + readonly requiredMembers?: string[]; + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; +} + +/** Represents a mongo cluster firewall rule. */ +export interface FirewallRuleOutput extends ProxyResourceOutput { + /** The resource-specific properties for this resource. */ + properties?: FirewallRulePropertiesOutput; +} + +/** The properties of a mongo cluster firewall rule. */ +export interface FirewallRulePropertiesOutput { + /** The provisioning state of the firewall rule. */ + readonly provisioningState?: ProvisioningStateOutput; + /** The start IP address of the mongo cluster firewall rule. Must be IPv4 format. */ + startIpAddress: string; + /** The end IP address of the mongo cluster firewall rule. Must be IPv4 format. */ + endIpAddress: string; +} + +/** Concrete proxy resource types can be created by aliasing this type using a specific property type. */ +export interface PrivateEndpointConnectionResourceOutput + extends ProxyResourceOutput { + /** The resource-specific properties for this resource. */ + properties?: PrivateEndpointConnectionPropertiesOutput; +} + +/** Concrete proxy resource types can be created by aliasing this type using a specific property type. */ +export interface PrivateLinkResourceOutput extends ProxyResourceOutput { + /** The resource-specific properties for this resource. */ + properties?: PrivateLinkResourcePropertiesOutput; +} + +/** The connection strings for the given mongo cluster. */ +export interface ListConnectionStringsResultOutput { + /** An array that contains the connection strings for a mongo cluster. */ + readonly connectionStrings?: Array; +} + +/** Connection string for the mongo cluster */ +export interface ConnectionStringOutput { + /** Value of the connection string */ + readonly connectionString?: string; + /** Description of the connection string */ + readonly description?: string; +} + +/** The check availability result. */ +export interface CheckNameAvailabilityResponseOutput { + /** Indicates if the resource name is available. */ + nameAvailable?: boolean; + /** The reason why the given name is not available. */ + reason?: CheckNameAvailabilityReasonOutput; + /** Detailed reason why the given name is not available. */ + message?: string; +} + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export type PagedOperationOutput = Paged; +/** Alias for OriginOutput */ +export type OriginOutput = "user" | "system" | "user,system" | string; +/** Alias for ActionTypeOutput */ +export type ActionTypeOutput = "Internal" | string; +/** Alias for CreateModeOutput */ +export type CreateModeOutput = string | "Default" | "PointInTimeRestore"; +/** Alias for ResourceProvisioningStateOutput */ +export type ResourceProvisioningStateOutput = + | "Succeeded" + | "Failed" + | "Canceled" + | string; +/** Alias for ProvisioningStateOutput */ +export type ProvisioningStateOutput = + | string + | ResourceProvisioningStateOutput + | "InProgress" + | "Updating" + | "Dropping"; +/** Alias for MongoClusterStatusOutput */ +export type MongoClusterStatusOutput = + | string + | "Ready" + | "Provisioning" + | "Updating" + | "Starting" + | "Stopping" + | "Stopped" + | "Dropping"; +/** Alias for PublicNetworkAccessOutput */ +export type PublicNetworkAccessOutput = string | "Enabled" | "Disabled"; +/** Alias for NodeKindOutput */ +export type NodeKindOutput = string | "Shard"; +/** Alias for PrivateEndpointServiceConnectionStatusOutput */ +export type PrivateEndpointServiceConnectionStatusOutput = + | "Pending" + | "Approved" + | "Rejected" + | string; +/** Alias for PrivateEndpointConnectionProvisioningStateOutput */ +export type PrivateEndpointConnectionProvisioningStateOutput = + | ResourceProvisioningStateOutput + | "Creating" + | "Deleting"; +/** Alias for CreatedByTypeOutput */ +export type CreatedByTypeOutput = + | "User" + | "Application" + | "ManagedIdentity" + | "Key" + | string; +/** The response of a MongoCluster list operation. */ +export type MongoClusterListResultOutput = Paged; +/** Alias for CheckNameAvailabilityReasonOutput */ +export type CheckNameAvailabilityReasonOutput = + | "Invalid" + | "AlreadyExists" + | string; +/** The response of a FirewallRule list operation. */ +export type FirewallRuleListResultOutput = Paged; +/** The response of a PrivateEndpointConnectionResource list operation. */ +export type PrivateEndpointConnectionResourceListResultOutput = + Paged; +/** The response of a PrivateLinkResource list operation. */ +export type PrivateLinkResourceListResultOutput = + Paged; diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/paginateHelper.ts b/sdk/mongocluster/arm-mongocluster/src/rest/paginateHelper.ts new file mode 100644 index 000000000000..3aac141db0e7 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/paginateHelper.ts @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + getPagedAsyncIterator, + PagedAsyncIterableIterator, + PagedResult, +} from "@azure/core-paging"; +import { + Client, + createRestError, + PathUncheckedResponse, +} from "@azure-rest/core-client"; + +/** + * Helper type to extract the type of an array + */ +export type GetArrayType = T extends Array ? TData : never; + +/** + * The type of a custom function that defines how to get a page and a link to the next one if any. + */ +export type GetPage = ( + pageLink: string, + maxPageSize?: number, +) => Promise<{ + page: TPage; + nextPageLink?: string; +}>; + +/** + * Options for the paging helper + */ +export interface PagingOptions { + /** + * Custom function to extract pagination details for crating the PagedAsyncIterableIterator + */ + customGetPage?: GetPage[]>; +} + +/** + * Helper type to infer the Type of the paged elements from the response type + * This type is generated based on the swagger information for x-ms-pageable + * specifically on the itemName property which indicates the property of the response + * where the page items are found. The default value is `value`. + * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter + */ +export type PaginateReturn = TResult extends { + body: { value?: infer TPage }; +} + ? GetArrayType + : Array; + +/** + * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension + * @param client - Client to use for sending the next page requests + * @param initialResponse - Initial response containing the nextLink and current page of elements + * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results + * @returns - PagedAsyncIterableIterator to iterate the elements + */ +export function paginate( + client: Client, + initialResponse: TResponse, + options: PagingOptions = {}, +): PagedAsyncIterableIterator> { + // Extract element type from initial response + type TElement = PaginateReturn; + let firstRun = true; + const itemName = "value"; + const nextLinkName = "nextLink"; + const { customGetPage } = options; + const pagedResult: PagedResult = { + firstPageLink: "", + getPage: + typeof customGetPage === "function" + ? customGetPage + : async (pageLink: string) => { + const result = firstRun + ? initialResponse + : await client.pathUnchecked(pageLink).get(); + firstRun = false; + checkPagingRequest(result); + const nextLink = getNextLink(result.body, nextLinkName); + const values = getElements(result.body, itemName); + return { + page: values, + nextPageLink: nextLink, + }; + }, + }; + + return getPagedAsyncIterator(pagedResult); +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined") { + throw new Error( + `Body Property ${nextLinkName} should be a string or undefined`, + ); + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + + // value has to be an array according to the x-ms-pageable extension. + // The fact that this must be an array is used above to calculate the + // type of elements in the page in PaginateReturn + if (!Array.isArray(value)) { + throw new Error( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse): void { + const Http2xxStatusCodes = [ + "200", + "201", + "202", + "203", + "204", + "205", + "206", + "207", + "208", + "226", + ]; + if (!Http2xxStatusCodes.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/parameters.ts b/sdk/mongocluster/arm-mongocluster/src/rest/parameters.ts new file mode 100644 index 000000000000..34f6f29bdbc5 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/parameters.ts @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { RequestParameters } from "@azure-rest/core-client"; +import { + MongoCluster, + MongoClusterUpdate, + CheckNameAvailabilityRequest, + FirewallRule, + PrivateEndpointConnectionResource, +} from "./models.js"; + +export type OperationsListParameters = RequestParameters; +export type MongoClustersGetParameters = RequestParameters; + +export interface MongoClustersCreateOrUpdateBodyParam { + /** Resource create parameters. */ + body: MongoCluster; +} + +export type MongoClustersCreateOrUpdateParameters = + MongoClustersCreateOrUpdateBodyParam & RequestParameters; + +export interface MongoClustersUpdateBodyParam { + /** The resource properties to be updated. */ + body: MongoClusterUpdate; +} + +export type MongoClustersUpdateParameters = MongoClustersUpdateBodyParam & + RequestParameters; +export type MongoClustersDeleteParameters = RequestParameters; +export type MongoClustersListByResourceGroupParameters = RequestParameters; +export type MongoClustersListParameters = RequestParameters; +export type MongoClustersListConnectionStringsParameters = RequestParameters; + +export interface MongoClustersCheckNameAvailabilityBodyParam { + /** The CheckAvailability request */ + body: CheckNameAvailabilityRequest; +} + +export type MongoClustersCheckNameAvailabilityParameters = + MongoClustersCheckNameAvailabilityBodyParam & RequestParameters; +export type FirewallRulesGetParameters = RequestParameters; + +export interface FirewallRulesCreateOrUpdateBodyParam { + /** Resource create parameters. */ + body: FirewallRule; +} + +export type FirewallRulesCreateOrUpdateParameters = + FirewallRulesCreateOrUpdateBodyParam & RequestParameters; +export type FirewallRulesDeleteParameters = RequestParameters; +export type FirewallRulesListByMongoClusterParameters = RequestParameters; +export type PrivateEndpointConnectionsListByMongoClusterParameters = + RequestParameters; +export type PrivateEndpointConnectionsGetParameters = RequestParameters; + +export interface PrivateEndpointConnectionsCreateBodyParam { + /** Resource create parameters. */ + body: PrivateEndpointConnectionResource; +} + +export type PrivateEndpointConnectionsCreateParameters = + PrivateEndpointConnectionsCreateBodyParam & RequestParameters; +export type PrivateEndpointConnectionsDeleteParameters = RequestParameters; +export type PrivateLinksListByMongoClusterParameters = RequestParameters; diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/pollingHelper.ts b/sdk/mongocluster/arm-mongocluster/src/rest/pollingHelper.ts new file mode 100644 index 000000000000..5bcdfc88cabb --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/pollingHelper.ts @@ -0,0 +1,323 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Client, HttpResponse } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { + CancelOnProgress, + CreateHttpPollerOptions, + RunningOperation, + OperationResponse, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { + MongoClustersCreateOrUpdate200Response, + MongoClustersCreateOrUpdate201Response, + MongoClustersCreateOrUpdateDefaultResponse, + MongoClustersCreateOrUpdateLogicalResponse, + MongoClustersUpdate200Response, + MongoClustersUpdate202Response, + MongoClustersUpdateDefaultResponse, + MongoClustersUpdateLogicalResponse, + MongoClustersDelete202Response, + MongoClustersDelete204Response, + MongoClustersDeleteDefaultResponse, + MongoClustersDeleteLogicalResponse, + FirewallRulesCreateOrUpdate200Response, + FirewallRulesCreateOrUpdate201Response, + FirewallRulesCreateOrUpdate202Response, + FirewallRulesCreateOrUpdateDefaultResponse, + FirewallRulesCreateOrUpdateLogicalResponse, + FirewallRulesDelete202Response, + FirewallRulesDelete204Response, + FirewallRulesDeleteDefaultResponse, + FirewallRulesDeleteLogicalResponse, + PrivateEndpointConnectionsCreate200Response, + PrivateEndpointConnectionsCreate201Response, + PrivateEndpointConnectionsCreate202Response, + PrivateEndpointConnectionsCreateDefaultResponse, + PrivateEndpointConnectionsCreateLogicalResponse, + PrivateEndpointConnectionsDelete202Response, + PrivateEndpointConnectionsDelete204Response, + PrivateEndpointConnectionsDeleteDefaultResponse, + PrivateEndpointConnectionsDeleteLogicalResponse, +} from "./responses.js"; + +/** + * A simple poller that can be used to poll a long running operation. + */ +export interface SimplePollerLike< + TState extends OperationState, + TResult, +> { + /** + * Returns true if the poller has finished polling. + */ + isDone(): boolean; + /** + * Returns the state of the operation. + */ + getOperationState(): TState; + /** + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. + */ + getResult(): TResult | undefined; + /** + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + */ + poll(options?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Returns a promise that will resolve once the underlying operation is completed. + */ + pollUntilDone(pollOptions?: { + abortSignal?: AbortSignalLike; + }): Promise; + /** + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. + */ + onProgress(callback: (state: TState) => void): CancelOnProgress; + + /** + * Returns a promise that could be used for serialized version of the poller's operation + * by invoking the operation's serialize method. + */ + serialize(): Promise; + + /** + * Wait the poller to be submitted. + */ + submitted(): Promise; + + /** + * Returns a string representation of the poller's operation. Similar to serialize but returns a string. + * @deprecated Use serialize() instead. + */ + toString(): string; + + /** + * Stops the poller from continuing to poll. Please note this will only stop the client-side polling + * @deprecated Use abortSignal to stop polling instead. + */ + stopPolling(): void; + + /** + * Returns true if the poller is stopped. + * @deprecated Use abortSignal status to track this instead. + */ + isStopped(): boolean; +} + +/** + * Helper function that builds a Poller object to help polling a long running operation. + * @param client - Client to use for sending the request to get additional pages. + * @param initialResponse - The initial response. + * @param options - Options to set a resume state or custom polling interval. + * @returns - A poller object to poll for operation state updates and eventually get the final response. + */ +export async function getLongRunningPoller< + TResult extends + | MongoClustersCreateOrUpdateLogicalResponse + | MongoClustersCreateOrUpdateDefaultResponse, +>( + client: Client, + initialResponse: + | MongoClustersCreateOrUpdate200Response + | MongoClustersCreateOrUpdate201Response + | MongoClustersCreateOrUpdateDefaultResponse, + options?: CreateHttpPollerOptions>, +): Promise, TResult>>; +export async function getLongRunningPoller< + TResult extends + | MongoClustersUpdateLogicalResponse + | MongoClustersUpdateDefaultResponse, +>( + client: Client, + initialResponse: + | MongoClustersUpdate200Response + | MongoClustersUpdate202Response + | MongoClustersUpdateDefaultResponse, + options?: CreateHttpPollerOptions>, +): Promise, TResult>>; +export async function getLongRunningPoller< + TResult extends + | MongoClustersDeleteLogicalResponse + | MongoClustersDeleteDefaultResponse, +>( + client: Client, + initialResponse: + | MongoClustersDelete202Response + | MongoClustersDelete204Response + | MongoClustersDeleteDefaultResponse, + options?: CreateHttpPollerOptions>, +): Promise, TResult>>; +export async function getLongRunningPoller< + TResult extends + | FirewallRulesCreateOrUpdateLogicalResponse + | FirewallRulesCreateOrUpdateDefaultResponse, +>( + client: Client, + initialResponse: + | FirewallRulesCreateOrUpdate200Response + | FirewallRulesCreateOrUpdate201Response + | FirewallRulesCreateOrUpdate202Response + | FirewallRulesCreateOrUpdateDefaultResponse, + options?: CreateHttpPollerOptions>, +): Promise, TResult>>; +export async function getLongRunningPoller< + TResult extends + | FirewallRulesDeleteLogicalResponse + | FirewallRulesDeleteDefaultResponse, +>( + client: Client, + initialResponse: + | FirewallRulesDelete202Response + | FirewallRulesDelete204Response + | FirewallRulesDeleteDefaultResponse, + options?: CreateHttpPollerOptions>, +): Promise, TResult>>; +export async function getLongRunningPoller< + TResult extends + | PrivateEndpointConnectionsCreateLogicalResponse + | PrivateEndpointConnectionsCreateDefaultResponse, +>( + client: Client, + initialResponse: + | PrivateEndpointConnectionsCreate200Response + | PrivateEndpointConnectionsCreate201Response + | PrivateEndpointConnectionsCreate202Response + | PrivateEndpointConnectionsCreateDefaultResponse, + options?: CreateHttpPollerOptions>, +): Promise, TResult>>; +export async function getLongRunningPoller< + TResult extends + | PrivateEndpointConnectionsDeleteLogicalResponse + | PrivateEndpointConnectionsDeleteDefaultResponse, +>( + client: Client, + initialResponse: + | PrivateEndpointConnectionsDelete202Response + | PrivateEndpointConnectionsDelete204Response + | PrivateEndpointConnectionsDeleteDefaultResponse, + options?: CreateHttpPollerOptions>, +): Promise, TResult>>; +export async function getLongRunningPoller( + client: Client, + initialResponse: TResult, + options: CreateHttpPollerOptions> = {}, +): Promise, TResult>> { + const abortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + // In the case of Rest Clients we are building the LRO poller object from a response that's the reason + // we are not triggering the initial request here, just extracting the information from the + // response we were provided. + return getLroResponse(initialResponse); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { abortSignal?: AbortSignalLike }, + ) => { + // This is the callback that is going to be called to poll the service + // to get the latest status. We use the client provided and the polling path + // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location + // depending on the lro pattern that the service implements. If non is provided we default to the initial path. + function abortListener(): void { + abortController.abort(); + } + const inputAbortSignal = pollOptions?.abortSignal; + const abortSignal = abortController.signal; + if (inputAbortSignal?.aborted) { + abortController.abort(); + } else if (!abortSignal.aborted) { + inputAbortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client + .pathUnchecked(path ?? initialResponse.request.url) + .get({ abortSignal }); + } finally { + inputAbortSignal?.removeEventListener("abort", abortListener); + } + const lroResponse = getLroResponse(response as TResult); + lroResponse.rawResponse.headers["x-ms-original-url"] = + initialResponse.request.url; + return lroResponse; + }, + }; + + options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true; + const httpPoller = createHttpPoller(poller, options); + const simplePoller: SimplePollerLike, TResult> = { + isDone() { + return httpPoller.isDone; + }, + isStopped() { + return abortController.signal.aborted; + }, + getOperationState() { + if (!httpPoller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return httpPoller.operationState; + }, + getResult() { + return httpPoller.result; + }, + toString() { + if (!httpPoller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return JSON.stringify({ + state: httpPoller.operationState, + }); + }, + stopPolling() { + abortController.abort(); + }, + onProgress: httpPoller.onProgress, + poll: httpPoller.poll, + pollUntilDone: httpPoller.pollUntilDone, + serialize: httpPoller.serialize, + submitted: httpPoller.submitted, + }; + return simplePoller; +} + +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResult, +): OperationResponse { + if (Number.isNaN(response.status)) { + throw new TypeError( + `Status code of the response is not a number. Value: ${response.status}`, + ); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/responses.ts b/sdk/mongocluster/arm-mongocluster/src/rest/responses.ts new file mode 100644 index 000000000000..a734fc537de1 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/rest/responses.ts @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import { HttpResponse } from "@azure-rest/core-client"; +import { + PagedOperationOutput, + ErrorResponseOutput, + MongoClusterOutput, + MongoClusterListResultOutput, + ListConnectionStringsResultOutput, + CheckNameAvailabilityResponseOutput, + FirewallRuleOutput, + FirewallRuleListResultOutput, + PrivateEndpointConnectionResourceListResultOutput, + PrivateEndpointConnectionResourceOutput, + PrivateLinkResourceListResultOutput, +} from "./outputModels.js"; + +/** Azure operation completed successfully. */ +export interface OperationsList200Response extends HttpResponse { + status: "200"; + body: PagedOperationOutput; +} + +export interface OperationsListDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** Azure operation completed successfully. */ +export interface MongoClustersGet200Response extends HttpResponse { + status: "200"; + body: MongoClusterOutput; +} + +export interface MongoClustersGetDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** Resource 'MongoCluster' update operation succeeded */ +export interface MongoClustersCreateOrUpdate200Response extends HttpResponse { + status: "200"; + body: MongoClusterOutput; +} + +export interface MongoClustersCreateOrUpdate201Headers { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + "retry-after"?: number; +} + +/** Resource 'MongoCluster' create operation succeeded */ +export interface MongoClustersCreateOrUpdate201Response extends HttpResponse { + status: "201"; + body: MongoClusterOutput; + headers: RawHttpHeaders & MongoClustersCreateOrUpdate201Headers; +} + +export interface MongoClustersCreateOrUpdateDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** The final response for long-running createOrUpdate operation */ +export interface MongoClustersCreateOrUpdateLogicalResponse + extends HttpResponse { + status: "200"; + body: MongoClusterOutput; +} + +/** Azure operation completed successfully. */ +export interface MongoClustersUpdate200Response extends HttpResponse { + status: "200"; + body: MongoClusterOutput; +} + +export interface MongoClustersUpdate202Headers { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + "retry-after"?: number; +} + +/** Resource update request accepted. */ +export interface MongoClustersUpdate202Response extends HttpResponse { + status: "202"; + headers: RawHttpHeaders & MongoClustersUpdate202Headers; +} + +export interface MongoClustersUpdateDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** The final response for long-running update operation */ +export interface MongoClustersUpdateLogicalResponse extends HttpResponse { + status: "200"; + body: MongoClusterOutput; +} + +export interface MongoClustersDelete202Headers { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + "retry-after"?: number; +} + +/** Resource deletion accepted. */ +export interface MongoClustersDelete202Response extends HttpResponse { + status: "202"; + headers: RawHttpHeaders & MongoClustersDelete202Headers; +} + +/** Resource does not exist. */ +export interface MongoClustersDelete204Response extends HttpResponse { + status: "204"; +} + +export interface MongoClustersDeleteDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** The final response for long-running delete operation */ +export interface MongoClustersDeleteLogicalResponse extends HttpResponse { + status: "200"; +} + +/** Azure operation completed successfully. */ +export interface MongoClustersListByResourceGroup200Response + extends HttpResponse { + status: "200"; + body: MongoClusterListResultOutput; +} + +export interface MongoClustersListByResourceGroupDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** Azure operation completed successfully. */ +export interface MongoClustersList200Response extends HttpResponse { + status: "200"; + body: MongoClusterListResultOutput; +} + +export interface MongoClustersListDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** Azure operation completed successfully. */ +export interface MongoClustersListConnectionStrings200Response + extends HttpResponse { + status: "200"; + body: ListConnectionStringsResultOutput; +} + +export interface MongoClustersListConnectionStringsDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** The request has succeeded. */ +export interface MongoClustersCheckNameAvailability200Response + extends HttpResponse { + status: "200"; + body: CheckNameAvailabilityResponseOutput; +} + +export interface MongoClustersCheckNameAvailabilityDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** Azure operation completed successfully. */ +export interface FirewallRulesGet200Response extends HttpResponse { + status: "200"; + body: FirewallRuleOutput; +} + +export interface FirewallRulesGetDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** Resource 'FirewallRule' update operation succeeded */ +export interface FirewallRulesCreateOrUpdate200Response extends HttpResponse { + status: "200"; + body: FirewallRuleOutput; +} + +/** Resource 'FirewallRule' create operation succeeded */ +export interface FirewallRulesCreateOrUpdate201Response extends HttpResponse { + status: "201"; + body: FirewallRuleOutput; +} + +export interface FirewallRulesCreateOrUpdate202Headers { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + "retry-after"?: number; +} + +/** Resource operation accepted. */ +export interface FirewallRulesCreateOrUpdate202Response extends HttpResponse { + status: "202"; + headers: RawHttpHeaders & FirewallRulesCreateOrUpdate202Headers; +} + +export interface FirewallRulesCreateOrUpdateDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** The final response for long-running createOrUpdate operation */ +export interface FirewallRulesCreateOrUpdateLogicalResponse + extends HttpResponse { + status: "200"; + body: FirewallRuleOutput; +} + +export interface FirewallRulesDelete202Headers { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + "retry-after"?: number; +} + +/** Resource deletion accepted. */ +export interface FirewallRulesDelete202Response extends HttpResponse { + status: "202"; + headers: RawHttpHeaders & FirewallRulesDelete202Headers; +} + +/** Resource does not exist. */ +export interface FirewallRulesDelete204Response extends HttpResponse { + status: "204"; +} + +export interface FirewallRulesDeleteDefaultResponse extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** The final response for long-running delete operation */ +export interface FirewallRulesDeleteLogicalResponse extends HttpResponse { + status: "200"; +} + +/** Azure operation completed successfully. */ +export interface FirewallRulesListByMongoCluster200Response + extends HttpResponse { + status: "200"; + body: FirewallRuleListResultOutput; +} + +export interface FirewallRulesListByMongoClusterDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** Azure operation completed successfully. */ +export interface PrivateEndpointConnectionsListByMongoCluster200Response + extends HttpResponse { + status: "200"; + body: PrivateEndpointConnectionResourceListResultOutput; +} + +export interface PrivateEndpointConnectionsListByMongoClusterDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** Azure operation completed successfully. */ +export interface PrivateEndpointConnectionsGet200Response extends HttpResponse { + status: "200"; + body: PrivateEndpointConnectionResourceOutput; +} + +export interface PrivateEndpointConnectionsGetDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** Resource 'PrivateEndpointConnectionResource' update operation succeeded */ +export interface PrivateEndpointConnectionsCreate200Response + extends HttpResponse { + status: "200"; + body: PrivateEndpointConnectionResourceOutput; +} + +/** Resource 'PrivateEndpointConnectionResource' create operation succeeded */ +export interface PrivateEndpointConnectionsCreate201Response + extends HttpResponse { + status: "201"; + body: PrivateEndpointConnectionResourceOutput; +} + +export interface PrivateEndpointConnectionsCreate202Headers { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + "retry-after"?: number; +} + +/** Resource operation accepted. */ +export interface PrivateEndpointConnectionsCreate202Response + extends HttpResponse { + status: "202"; + headers: RawHttpHeaders & PrivateEndpointConnectionsCreate202Headers; +} + +export interface PrivateEndpointConnectionsCreateDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** The final response for long-running create operation */ +export interface PrivateEndpointConnectionsCreateLogicalResponse + extends HttpResponse { + status: "200"; + body: PrivateEndpointConnectionResourceOutput; +} + +export interface PrivateEndpointConnectionsDelete202Headers { + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + "retry-after"?: number; +} + +/** Resource deletion accepted. */ +export interface PrivateEndpointConnectionsDelete202Response + extends HttpResponse { + status: "202"; + headers: RawHttpHeaders & PrivateEndpointConnectionsDelete202Headers; +} + +/** Resource does not exist. */ +export interface PrivateEndpointConnectionsDelete204Response + extends HttpResponse { + status: "204"; +} + +export interface PrivateEndpointConnectionsDeleteDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} + +/** The final response for long-running delete operation */ +export interface PrivateEndpointConnectionsDeleteLogicalResponse + extends HttpResponse { + status: "200"; +} + +/** Azure operation completed successfully. */ +export interface PrivateLinksListByMongoCluster200Response + extends HttpResponse { + status: "200"; + body: PrivateLinkResourceListResultOutput; +} + +export interface PrivateLinksListByMongoClusterDefaultResponse + extends HttpResponse { + status: string; + body: ErrorResponseOutput; +} diff --git a/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..8db3303286f2 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} from "@azure/core-lro"; +import { DocumentDBContext } from "./api/mongoClusterManagementContext.js"; +import { MongoClusterManagementClient } from "./mongoClusterManagementClient.js"; +import { getLongRunningPoller } from "./api/pollingHelpers.js"; +import { + _mongoClustersCreateOrUpdateDeserialize, + _mongoClustersUpdateDeserialize, + _mongoClustersDeleteDeserialize, +} from "./api/mongoClusters/index.js"; +import { + _firewallRulesCreateOrUpdateDeserialize, + _firewallRulesDeleteDeserialize, +} from "./api/firewallRules/index.js"; +import { + _privateEndpointConnectionsCreateDeserialize, + _privateEndpointConnectionsDeleteDeserialize, +} from "./api/privateEndpointConnections/index.js"; +import { + PathUncheckedResponse, + OperationOptions, +} from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: DocumentDBContext | MongoClusterManagementClient, + serializedState: string, + sourceOperation: ( + ...args: any[] + ) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const deserializeHelper = + options?.processResponseBody ?? + getDeserializationHelper(initialRequestUrl, requestMethod); + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +const deserializeMap: Record = { + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": + _mongoClustersCreateOrUpdateDeserialize, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": + _mongoClustersUpdateDeserialize, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": + _mongoClustersDeleteDeserialize, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}": + _firewallRulesCreateOrUpdateDeserialize, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}": + _firewallRulesDeleteDeserialize, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}": + _privateEndpointConnectionsCreateDeserialize, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}": + _privateEndpointConnectionsDeleteDeserialize, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): ((result: unknown) => Promise) | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: ((result: unknown) => Promise) | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // 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 + ) { + 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] || ""); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value as (result: unknown) => Promise; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/mongocluster/arm-mongocluster/test/mongocluster_operations_test.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts similarity index 65% rename from sdk/mongocluster/arm-mongocluster/test/mongocluster_operations_test.spec.ts rename to sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts index a5ed44822215..bce44c469d65 100644 --- a/sdk/mongocluster/arm-mongocluster/test/mongocluster_operations_test.spec.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts @@ -9,26 +9,12 @@ import { env, Recorder, - RecorderStartOptions, - delay, isPlaybackMode, } from "@azure-tools/test-recorder"; import { createTestCredential } from "@azure-tools/test-credential"; -import { assert } from "chai"; -import { Context } from "mocha"; -import { MongoClusterManagementClient } from "../src/mongoClusterManagementClient" - -const replaceableVariables: Record = { - SUBSCRIPTION_ID: "88888888-8888-8888-8888-888888888888" -}; - -const recorderOptions: 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 - ], -}; +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, @@ -42,25 +28,28 @@ describe("MongoCluster test", () => { let resourceGroup: string; let resourcename: string; - beforeEach(async function (this: Context) { - recorder = new Recorder(this.currentTest); - await recorder.start(recorderOptions); + 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({})); + client = new MongoClusterManagementClient(credential, recorder.configureClientOptions({})); location = "eastus"; resourceGroup = "myjstest"; - resourcename = "resourcetest"; + resourcename = "resourcetest1"; }); afterEach(async function () { - await recorder.stop(); + if (recorder?.recordingId) { + await recorder.stop(); + } }); it("mongoClusters create test", async function () { - const res = await client.mongoClusters.beginCreateOrUpdateAndWait( + const res = await client.mongoClusters.createOrUpdate( + subscriptionId, resourceGroup, resourcename, { @@ -86,6 +75,7 @@ describe("MongoCluster test", () => { it("mongoClusters get test", async function () { const res = await client.mongoClusters.get( + subscriptionId, resourceGroup, resourcename ); @@ -94,17 +84,29 @@ describe("MongoCluster test", () => { it("mongoClusters list test", async function () { const resArray = new Array(); - for await (let item of client.mongoClusters.listByResourceGroup(resourceGroup)) { + for await (let item of client.mongoClusters.listByResourceGroup(subscriptionId, resourceGroup)) { resArray.push(item); } assert.equal(resArray.length, 1); }); + it("mongoClusters update test", async function () { + const res = await client.mongoClusters.update( + subscriptionId, + resourceGroup, + resourcename, + { + tags: {} + } + ) + assert.equal(res.name, resourcename); + }); + it("mongoClusters delete test", async function () { const resArray = new Array(); - const res = await client.mongoClusters.beginDeleteAndWait(resourceGroup, resourcename + const res = await client.mongoClusters.delete(subscriptionId, resourceGroup, resourcename ) - for await (let item of client.mongoClusters.listByResourceGroup(resourceGroup)) { + for await (let item of client.mongoClusters.listByResourceGroup(subscriptionId, resourceGroup)) { resArray.push(item); } assert.equal(resArray.length, 0); diff --git a/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts b/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..a0b689456cb9 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + Recorder, + RecorderStartOptions, + VitestTestContext, +} from "@azure-tools/test-recorder"; + + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +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 + ], +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * 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 { + 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 new file mode 100644 index 000000000000..1b37aebc5457 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/tsconfig.browser.config.json @@ -0,0 +1,10 @@ +{ + "extends": "./.tshy/build.json", + "include": ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts"], + "exclude": ["./test/**/node/**/*.ts"], + "compilerOptions": { + "outDir": "./dist-test/browser", + "rootDir": ".", + "skipLibCheck": true + } +} diff --git a/sdk/mongocluster/arm-mongocluster/tsconfig.json b/sdk/mongocluster/arm-mongocluster/tsconfig.json index 48f31b9275c8..7483ff677600 100644 --- a/sdk/mongocluster/arm-mongocluster/tsconfig.json +++ b/sdk/mongocluster/arm-mongocluster/tsconfig.json @@ -1,33 +1,15 @@ { + "extends": "../../../tsconfig.package", "compilerOptions": { - "module": "es6", - "moduleResolution": "node", - "strict": true, - "target": "es6", - "sourceMap": true, - "declarationMap": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "lib": [ - "es6", - "dom" - ], - "declaration": true, - "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-mongocluster": [ - "./src/index" - ] - } + "module": "NodeNext", + "moduleResolution": "NodeNext", + "rootDir": "." }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" - ], - "exclude": [ - "node_modules" + "./src/**/*.mts", + "./src/**/*.cts", + "test/**/*.ts", + "./test/**/*.ts" ] -} \ No newline at end of file +} diff --git a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts new file mode 100644 index 000000000000..eda90c3ea96b --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { defineConfig } from "vitest/config"; +import { relativeRecordingsPath } from "@azure-tools/test-recorder"; + +process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); + +export default defineConfig({ + define: { + "process.env": process.env, + }, + test: { + reporters: ["basic", "junit"], + outputFile: { + junit: "test-results.browser.xml", + }, + browser: { + enabled: true, + headless: true, + name: "chromium", + provider: "playwright", + }, + fakeTimers: { + toFake: ["setTimeout", "Date"], + }, + watch: false, + include: ["dist-test/browser/**/*.spec.js"], + coverage: { + include: ["dist-test/browser/**/*.spec.js"], + provider: "istanbul", + reporter: ["text", "json", "html"], + reportsDirectory: "coverage-browser", + }, + testTimeout: 1200000, + }, +}); diff --git a/sdk/mongocluster/arm-mongocluster/vitest.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.config.ts new file mode 100644 index 000000000000..7928f980b01c --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/vitest.config.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { defineConfig } from "vitest/config"; +import { relativeRecordingsPath } from "@azure-tools/test-recorder"; + +export default defineConfig({ + test: { + reporters: ["basic", "junit"], + outputFile: { + junit: "test-results.browser.xml", + }, + fakeTimers: { + toFake: ["setTimeout", "Date"], + }, + watch: false, + include: ["test/**/*.spec.ts"], + exclude: ["test/**/browser/*.spec.ts"], + coverage: { + include: ["src/**/*.ts"], + exclude: [ + "src/**/*-browser.mts", + "src/**/*-react-native.mts", + "vitest*.config.ts", + "samples-dev/**/*.ts", + ], + provider: "istanbul", + reporter: ["text", "json", "html"], + reportsDirectory: "coverage", + }, + testTimeout: 1200000, + }, +}); diff --git a/sdk/test-utils/recorder/package.json b/sdk/test-utils/recorder/package.json index 9af6db673b2f..cd7ebb4db07b 100644 --- a/sdk/test-utils/recorder/package.json +++ b/sdk/test-utils/recorder/package.json @@ -103,18 +103,22 @@ "./package.json": "./package.json", ".": { "browser": { + "source": "./src/index.ts", "types": "./dist/browser/index.d.ts", "default": "./dist/browser/index.js" }, "react-native": { + "source": "./src/index.ts", "types": "./dist/react-native/index.d.ts", "default": "./dist/react-native/index.js" }, "import": { + "source": "./src/index.ts", "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.js" }, "require": { + "source": "./src/index.ts", "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } From f4403687ee8a617e5f731918d9ad197532ebd54d Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 20 Jun 2024 11:34:55 +0800 Subject: [PATCH 04/23] update --- sdk/mongocluster/arm-mongocluster/assets.json | 2 +- .../mongocluster_operations_test.spec.ts | 21 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/assets.json b/sdk/mongocluster/arm-mongocluster/assets.json index c0d7afa7aa32..36e84e849325 100644 --- a/sdk/mongocluster/arm-mongocluster/assets.json +++ b/sdk/mongocluster/arm-mongocluster/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/mongocluster/arm-mongocluster", - "Tag": "js/mongocluster/arm-mongocluster_e6df67d5f1" + "Tag": "js/mongocluster/arm-mongocluster_ab7b76d9b1" } diff --git a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts index bce44c469d65..3695e0e33c7b 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts @@ -36,8 +36,8 @@ describe("MongoCluster test", () => { const credential = createTestCredential(); client = new MongoClusterManagementClient(credential, recorder.configureClientOptions({})); location = "eastus"; - resourceGroup = "myjstest"; - resourcename = "resourcetest1"; + resourceGroup = "czwjstest"; + resourcename = "resourcetest"; }); @@ -73,6 +73,23 @@ describe("MongoCluster test", () => { assert.equal(res.name, resourcename); }); + it.only("firerules create test", async function () { + const res = await client.firewallRules.createOrUpdate( + subscriptionId, + resourceGroup, + resourcename, + "testfilerule", + { + properties: { + startIpAddress: "0.0.0.0", + endIpAddress: "255.255.255.255" + }, + }, + testPollingOptions); + console.log(res) + // assert.equal(res.name, resourcename); + }); + it("mongoClusters get test", async function () { const res = await client.mongoClusters.get( subscriptionId, From 4f76ab5ac4f2dc205f2f6eb363f9ef6a456d3250 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 28 Jun 2024 16:57:59 +0800 Subject: [PATCH 05/23] update --- sdk/mongocluster/arm-mongocluster/assets.json | 2 +- .../arm-mongocluster/package.json | 99 +++- .../review/arm-mongo-cluster.api.md | 538 ++++++++++++++++++ .../arm-mongocluster-api-firewallRules.api.md | 55 ++ .../arm-mongocluster-api-mongoClusters.api.md | 91 +++ .../arm-mongocluster-api-operations.api.md | 26 + ...ster-api-privateEndpointConnections.api.md | 55 ++ .../arm-mongocluster-api-privateLinks.api.md | 26 + .../review/arm-mongocluster-api.api.md | 57 -- .../review/arm-mongocluster-models.api.md | 170 ++++-- .../review/arm-mongocluster.api.md | 216 ++++--- .../src/api/firewallRules/index.ts | 88 +-- .../arm-mongocluster/src/api/index.ts | 24 - .../src/api/mongoClusters/index.ts | 192 +++---- .../src/api/operations/index.ts | 14 +- .../api/privateEndpointConnections/index.ts | 127 ++--- .../src/api/privateLinks/index.ts | 14 +- .../src/classic/firewallRules/index.ts | 32 +- .../src/classic/mongoClusters/index.ts | 68 +-- .../src/classic/operations/index.ts | 5 +- .../privateEndpointConnections/index.ts | 32 +- .../src/classic/privateLinks/index.ts | 14 +- .../src/helpers/serializerHelpers.ts | 40 ++ .../arm-mongocluster/src/index.ts | 21 +- .../arm-mongocluster/src/models/index.ts | 21 +- .../arm-mongocluster/src/models/models.ts | 326 +++++++++-- .../src/mongoClusterManagementClient.ts | 14 +- .../src/rest/documentDBClient.ts | 29 +- .../arm-mongocluster/src/rest/models.ts | 173 +++--- .../arm-mongocluster/src/rest/outputModels.ts | 199 ++++--- .../arm-mongocluster/src/rest/responses.ts | 4 +- .../src/restorePollerHelpers.ts | 31 +- .../mongocluster_operations_test.spec.ts | 16 +- 33 files changed, 2016 insertions(+), 803 deletions(-) create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongo-cluster.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-mongoClusters.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-operations.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateLinks.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/src/helpers/serializerHelpers.ts diff --git a/sdk/mongocluster/arm-mongocluster/assets.json b/sdk/mongocluster/arm-mongocluster/assets.json index 36e84e849325..5c6202b15f7f 100644 --- a/sdk/mongocluster/arm-mongocluster/assets.json +++ b/sdk/mongocluster/arm-mongocluster/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/mongocluster/arm-mongocluster", - "Tag": "js/mongocluster/arm-mongocluster_ab7b76d9b1" + "Tag": "js/mongocluster/arm-mongocluster_04a66e31c1" } diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index 5b8ebbb6a94b..9fd146bbdf24 100644 --- a/sdk/mongocluster/arm-mongocluster/package.json +++ b/sdk/mongocluster/arm-mongocluster/package.json @@ -12,7 +12,12 @@ "./package.json": "./package.json", ".": "./src/index.ts", "./api": "./src/api/index.ts", - "./models": "./src/models/index.ts" + "./models": "./src/models/index.ts", + "./api/operations": "./src/api/operations/index.ts", + "./api/mongoClusters": "./src/api/mongoClusters/index.ts", + "./api/firewallRules": "./src/api/firewallRules/index.ts", + "./api/privateEndpointConnections": "./src/api/privateEndpointConnections/index.ts", + "./api/privateLinks": "./src/api/privateLinks/index.ts" }, "dialects": [ "esm", @@ -62,7 +67,7 @@ "@azure/logger": "^1.0.0", "tslib": "^2.6.2", "@azure/core-lro": "3.0.0-beta.2", - "@azure/abort-controller": "^2.0.0", + "@azure/abort-controller": "^2.1.2", "@azure/core-paging": "^1.5.0" }, "devDependencies": { @@ -166,6 +171,96 @@ "types": "./dist/commonjs/models/index.d.ts", "default": "./dist/commonjs/models/index.js" } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/operations/index.d.ts", + "default": "./dist/react-native/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" + } + }, + "./api/mongoClusters": { + "browser": { + "types": "./dist/browser/api/mongoClusters/index.d.ts", + "default": "./dist/browser/api/mongoClusters/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/mongoClusters/index.d.ts", + "default": "./dist/react-native/api/mongoClusters/index.js" + }, + "import": { + "types": "./dist/esm/api/mongoClusters/index.d.ts", + "default": "./dist/esm/api/mongoClusters/index.js" + }, + "require": { + "types": "./dist/commonjs/api/mongoClusters/index.d.ts", + "default": "./dist/commonjs/api/mongoClusters/index.js" + } + }, + "./api/firewallRules": { + "browser": { + "types": "./dist/browser/api/firewallRules/index.d.ts", + "default": "./dist/browser/api/firewallRules/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/firewallRules/index.d.ts", + "default": "./dist/react-native/api/firewallRules/index.js" + }, + "import": { + "types": "./dist/esm/api/firewallRules/index.d.ts", + "default": "./dist/esm/api/firewallRules/index.js" + }, + "require": { + "types": "./dist/commonjs/api/firewallRules/index.d.ts", + "default": "./dist/commonjs/api/firewallRules/index.js" + } + }, + "./api/privateEndpointConnections": { + "browser": { + "types": "./dist/browser/api/privateEndpointConnections/index.d.ts", + "default": "./dist/browser/api/privateEndpointConnections/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/privateEndpointConnections/index.d.ts", + "default": "./dist/react-native/api/privateEndpointConnections/index.js" + }, + "import": { + "types": "./dist/esm/api/privateEndpointConnections/index.d.ts", + "default": "./dist/esm/api/privateEndpointConnections/index.js" + }, + "require": { + "types": "./dist/commonjs/api/privateEndpointConnections/index.d.ts", + "default": "./dist/commonjs/api/privateEndpointConnections/index.js" + } + }, + "./api/privateLinks": { + "browser": { + "types": "./dist/browser/api/privateLinks/index.d.ts", + "default": "./dist/browser/api/privateLinks/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/privateLinks/index.d.ts", + "default": "./dist/react-native/api/privateLinks/index.js" + }, + "import": { + "types": "./dist/esm/api/privateLinks/index.d.ts", + "default": "./dist/esm/api/privateLinks/index.js" + }, + "require": { + "types": "./dist/commonjs/api/privateLinks/index.d.ts", + "default": "./dist/commonjs/api/privateLinks/index.js" + } } }, "main": "./dist/commonjs/index.js", diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongo-cluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongo-cluster.api.md new file mode 100644 index 000000000000..097249b1d107 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongo-cluster.api.md @@ -0,0 +1,538 @@ +## API Report File for "@azure/arm-mongo-cluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { AbortSignalLike } from '@azure/abort-controller'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { PollerLike } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export type ActionType = string; + +// @public +export type CheckNameAvailabilityReason = string; + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: CheckNameAvailabilityReason; +} + +// @public +export interface ConnectionString { + readonly connectionString?: string; + readonly description?: string; +} + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +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; +} + +// @public +export interface FirewallRuleProperties { + endIpAddress: string; + readonly provisioningState?: ProvisioningState; + startIpAddress: string; +} + +// @public (undocumented) +export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface FirewallRulesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface FirewallRulesGetOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface FirewallRulesOperations { + // (undocumented) + createOrUpdate: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, void>; + // (undocumented) + delete: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => PollerLike, void>; + // (undocumented) + get: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams) => Promise; + // (undocumented) + listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; +} + +// @public (undocumented) +export enum KnownActionType { + // (undocumented) + Internal = "Internal" +} + +// @public (undocumented) +export enum KnownCheckNameAvailabilityReason { + // (undocumented) + AlreadyExists = "AlreadyExists", + // (undocumented) + Invalid = "Invalid" +} + +// @public (undocumented) +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public (undocumented) +export enum KnownCreateMode { + // (undocumented) + Default = "Default", + // (undocumented) + PointInTimeRestore = "PointInTimeRestore" +} + +// @public (undocumented) +export enum KnownMongoClusterStatus { + // (undocumented) + Dropping = "Dropping", + // (undocumented) + Provisioning = "Provisioning", + // (undocumented) + Ready = "Ready", + // (undocumented) + Starting = "Starting", + // (undocumented) + Stopped = "Stopped", + // (undocumented) + Stopping = "Stopping", + // (undocumented) + Updating = "Updating" +} + +// @public (undocumented) +export enum KnownNodeKind { + // (undocumented) + Shard = "Shard" +} + +// @public (undocumented) +export enum KnownOrigin { + // (undocumented) + "user,system" = "user,system", + // (undocumented) + system = "system", + // (undocumented) + user = "user" +} + +// @public (undocumented) +export enum KnownPrivateEndpointConnectionProvisioningState { + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public (undocumented) +export enum KnownPrivateEndpointServiceConnectionStatus { + // (undocumented) + Approved = "Approved", + // (undocumented) + Pending = "Pending", + // (undocumented) + Rejected = "Rejected" +} + +// @public (undocumented) +export enum KnownPublicNetworkAccess { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + +// @public (undocumented) +export enum KnownResourceProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export interface ListConnectionStringsResult { + readonly connectionStrings?: ConnectionString[]; +} + +// @public +export interface MongoCluster extends TrackedResource { + properties?: MongoClusterProperties; +} + +// @public (undocumented) +export class MongoClusterManagementClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: MongoClusterManagementClientOptions); + readonly firewallRules: FirewallRulesOperations; + readonly mongoClusters: MongoClustersOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + readonly privateLinks: PrivateLinksOperations; +} + +// @public (undocumented) +export interface MongoClusterManagementClientOptions extends ClientOptions { + apiVersion?: string; +} + +// @public +export interface MongoClusterProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + readonly clusterStatus?: MongoClusterStatus; + readonly connectionString?: string; + createMode?: CreateMode; + readonly earliestRestoreTime?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly provisioningState?: ProvisioningState; + publicNetworkAccess?: PublicNetworkAccess; + restoreParameters?: MongoClusterRestoreParameters; + serverVersion?: string; +} + +// @public +export interface MongoClusterRestoreParameters { + pointInTimeUTC?: Date; + sourceResourceId?: string; +} + +// @public (undocumented) +export interface MongoClustersCheckNameAvailabilityOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface MongoClustersCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface MongoClustersDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface MongoClustersGetOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface MongoClustersListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface MongoClustersListConnectionStringsOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface MongoClustersListOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface MongoClustersOperations { + // (undocumented) + checkNameAvailability: (location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams) => Promise; + // (undocumented) + createOrUpdate: (resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams) => PollerLike, MongoCluster>; + // (undocumented) + delete: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams) => PollerLike, void>; + // (undocumented) + get: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams) => Promise; + // (undocumented) + list: (options?: MongoClustersListOptionalParams) => PagedAsyncIterableIterator; + // (undocumented) + listByResourceGroup: (resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + // (undocumented) + listConnectionStrings: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams) => Promise; + // (undocumented) + update: (resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams) => PollerLike, MongoCluster>; +} + +// @public +export type MongoClusterStatus = string; + +// @public (undocumented) +export interface MongoClustersUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface MongoClusterUpdate { + // (undocumented) + properties?: MongoClusterUpdateProperties; + tags?: Record; +} + +// @public +export interface MongoClusterUpdateProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + publicNetworkAccess?: PublicNetworkAccess; + serverVersion?: string; +} + +// @public +export interface NodeGroupSpec { + diskSizeGB?: number; + enableHa?: boolean; + kind?: NodeKind; + nodeCount?: number; + sku?: string; +} + +// @public +export type NodeKind = string; + +// @public +export interface Operation { + actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public (undocumented) +export interface OperationsListOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface OperationsOperations { + // (undocumented) + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type Origin = string; + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export interface PrivateEndpointConnection extends Resource { + properties?: PrivateEndpointConnectionProperties; +} + +// @public +export interface PrivateEndpointConnectionProperties { + readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export type PrivateEndpointConnectionProvisioningState = string; + +// @public +export interface PrivateEndpointConnectionResource extends ProxyResource { + properties?: PrivateEndpointConnectionProperties; +} + +// @public (undocumented) +export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface PrivateEndpointConnectionsOperations { + // (undocumented) + create: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams) => PollerLike, void>; + // (undocumented) + delete: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, void>; + // (undocumented) + get: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams) => Promise; + // (undocumented) + listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type PrivateEndpointServiceConnectionStatus = string; + +// @public +export interface PrivateLinkResource extends ProxyResource { + properties?: PrivateLinkResourceProperties; +} + +// @public +export interface PrivateLinkResourceProperties { + readonly groupId?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; +} + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateEndpointServiceConnectionStatus; +} + +// @public (undocumented) +export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public (undocumented) +export interface PrivateLinksOperations { + // (undocumented) + listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type PublicNetworkAccess = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type ResourceProvisioningState = string; + +// @public +export function restorePoller(client: MongoClusterManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export type Versions = "2024-03-01-preview"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md new file mode 100644 index 000000000000..56271314d5bb --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md @@ -0,0 +1,55 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { Paged } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; + +// @public +export function $delete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): PollerLike, void>; + +// @public (undocumented) +export function _$deleteDeserialize(result: FirewallRulesDelete202Response | FirewallRulesDelete204Response | FirewallRulesDeleteDefaultResponse | FirewallRulesDeleteLogicalResponse): Promise; + +// @public (undocumented) +export function _$deleteSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): StreamableMethod; + +// @public +export function createOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): PollerLike, void>; + +// @public (undocumented) +export function _createOrUpdateDeserialize(result: FirewallRulesCreateOrUpdate200Response | FirewallRulesCreateOrUpdate201Response | FirewallRulesCreateOrUpdate202Response | FirewallRulesCreateOrUpdateDefaultResponse | FirewallRulesCreateOrUpdateLogicalResponse): Promise; + +// @public (undocumented) +export function _createOrUpdateSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): StreamableMethod; + +// @public +export function get(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; + +// @public (undocumented) +export function _getDeserialize(result: FirewallRulesGet200Response | FirewallRulesGetDefaultResponse): Promise; + +// @public (undocumented) +export function _getSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): StreamableMethod; + +// @public +export function listByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public (undocumented) +export function _listByMongoClusterDeserialize(result: FirewallRulesListByMongoCluster200Response | FirewallRulesListByMongoClusterDefaultResponse): Promise<_FirewallRuleListResult>; + +// @public (undocumented) +export function _listByMongoClusterSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): StreamableMethod; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-mongoClusters.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-mongoClusters.api.md new file mode 100644 index 000000000000..5e32356e6c9e --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-mongoClusters.api.md @@ -0,0 +1,91 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { Paged } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; + +// @public +export function $delete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): PollerLike, void>; + +// @public (undocumented) +export function _$deleteDeserialize(result: MongoClustersDelete202Response | MongoClustersDelete204Response | MongoClustersDeleteDefaultResponse | MongoClustersDeleteLogicalResponse): Promise; + +// @public (undocumented) +export function _$deleteSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): StreamableMethod; + +// @public +export function checkNameAvailability(context: DocumentDBContext, subscriptionId: string, location: string, body: CheckNameAvailabilityRequest_2, options?: MongoClustersCheckNameAvailabilityOptionalParams): Promise; + +// @public (undocumented) +export function _checkNameAvailabilityDeserialize(result: MongoClustersCheckNameAvailability200Response | MongoClustersCheckNameAvailabilityDefaultResponse): Promise; + +// @public (undocumented) +export function _checkNameAvailabilitySend(context: DocumentDBContext, subscriptionId: string, location: string, body: CheckNameAvailabilityRequest_2, options?: MongoClustersCheckNameAvailabilityOptionalParams): StreamableMethod; + +// @public +export function createOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster_2, options?: MongoClustersCreateOrUpdateOptionalParams): PollerLike, MongoCluster_2>; + +// @public (undocumented) +export function _createOrUpdateDeserialize(result: MongoClustersCreateOrUpdate200Response | MongoClustersCreateOrUpdate201Response | MongoClustersCreateOrUpdateDefaultResponse | MongoClustersCreateOrUpdateLogicalResponse): Promise; + +// @public (undocumented) +export function _createOrUpdateSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster_2, options?: MongoClustersCreateOrUpdateOptionalParams): StreamableMethod; + +// @public +export function get(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): Promise; + +// @public (undocumented) +export function _getDeserialize(result: MongoClustersGet200Response | MongoClustersGetDefaultResponse): Promise; + +// @public (undocumented) +export function _getSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): StreamableMethod; + +// @public +export function list(context: DocumentDBContext, subscriptionId: string, options?: MongoClustersListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listByResourceGroup(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public (undocumented) +export function _listByResourceGroupDeserialize(result: MongoClustersListByResourceGroup200Response | MongoClustersListByResourceGroupDefaultResponse): Promise<_MongoClusterListResult>; + +// @public (undocumented) +export function _listByResourceGroupSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): StreamableMethod; + +// @public +export function listConnectionStrings(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): Promise; + +// @public (undocumented) +export function _listConnectionStringsDeserialize(result: MongoClustersListConnectionStrings200Response | MongoClustersListConnectionStringsDefaultResponse): Promise; + +// @public (undocumented) +export function _listConnectionStringsSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): StreamableMethod; + +// @public (undocumented) +export function _listDeserialize(result: MongoClustersList200Response | MongoClustersListDefaultResponse): Promise<_MongoClusterListResult>; + +// @public (undocumented) +export function _listSend(context: DocumentDBContext, subscriptionId: string, options?: MongoClustersListOptionalParams): StreamableMethod; + +// @public +export function update(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate_2, options?: MongoClustersUpdateOptionalParams): PollerLike, MongoCluster_2>; + +// @public (undocumented) +export function _updateDeserialize(result: MongoClustersUpdate200Response | MongoClustersUpdate202Response | MongoClustersUpdateDefaultResponse | MongoClustersUpdateLogicalResponse): Promise; + +// @public (undocumented) +export function _updateSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate_2, options?: MongoClustersUpdateOptionalParams): StreamableMethod; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-operations.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-operations.api.md new file mode 100644 index 000000000000..c6d36bde3d95 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-operations.api.md @@ -0,0 +1,26 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Paged } from '@azure/core-paging'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; + +// @public +export function list(context: DocumentDBContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; + +// @public (undocumented) +export function _listDeserialize(result: OperationsList200Response | OperationsListDefaultResponse): Promise<_OperationListResult>; + +// @public (undocumented) +export function _listSend(context: DocumentDBContext, options?: OperationsListOptionalParams): StreamableMethod; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md new file mode 100644 index 000000000000..3f5cd7cb173e --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md @@ -0,0 +1,55 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { Paged } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; + +// @public +export function $delete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): PollerLike, void>; + +// @public (undocumented) +export function _$deleteDeserialize(result: PrivateEndpointConnectionsDelete202Response | PrivateEndpointConnectionsDelete204Response | PrivateEndpointConnectionsDeleteDefaultResponse | PrivateEndpointConnectionsDeleteLogicalResponse): Promise; + +// @public (undocumented) +export function _$deleteSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): StreamableMethod; + +// @public +export function create(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, void>; + +// @public (undocumented) +export function _createDeserialize(result: PrivateEndpointConnectionsCreate200Response | PrivateEndpointConnectionsCreate201Response | PrivateEndpointConnectionsCreate202Response | PrivateEndpointConnectionsCreateDefaultResponse | PrivateEndpointConnectionsCreateLogicalResponse): Promise; + +// @public (undocumented) +export function _createSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): StreamableMethod; + +// @public +export function get(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; + +// @public (undocumented) +export function _getDeserialize(result: PrivateEndpointConnectionsGet200Response | PrivateEndpointConnectionsGetDefaultResponse): Promise; + +// @public (undocumented) +export function _getSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): StreamableMethod; + +// @public +export function listByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public (undocumented) +export function _listByMongoClusterDeserialize(result: PrivateEndpointConnectionsListByMongoCluster200Response | PrivateEndpointConnectionsListByMongoClusterDefaultResponse): Promise<_PrivateEndpointConnectionResourceListResult>; + +// @public (undocumented) +export function _listByMongoClusterSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): StreamableMethod; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateLinks.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateLinks.api.md new file mode 100644 index 000000000000..b412225b8fa8 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateLinks.api.md @@ -0,0 +1,26 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Paged } from '@azure/core-paging'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; + +// @public +export function listByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public (undocumented) +export function _listByMongoClusterDeserialize(result: PrivateLinksListByMongoCluster200Response | PrivateLinksListByMongoClusterDefaultResponse): Promise<_PrivateLinkResourceListResult>; + +// @public (undocumented) +export function _listByMongoClusterSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): StreamableMethod; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md index 10c665e13111..168aa800c9a8 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md @@ -7,10 +7,7 @@ import { Client } from '@azure-rest/core-client'; import { ClientOptions } from '@azure-rest/core-client'; import { HttpResponse } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { OperationState } from '@azure/core-lro'; import { Paged } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; import { RawHttpHeaders } from '@azure/core-rest-pipeline'; import { RequestParameters } from '@azure-rest/core-client'; import { StreamableMethod } from '@azure-rest/core-client'; @@ -24,65 +21,11 @@ export type DocumentDBContext = Client & { path: Routes; }; -// @public -export function firewallRulesCreateOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): PollerLike, void>; - -// @public -export function firewallRulesDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): PollerLike, void>; - -// @public -export function firewallRulesGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; - -// @public -export function firewallRulesListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; - // @public (undocumented) export interface MongoClusterManagementClientOptions extends ClientOptions { apiVersion?: string; } -// @public -export function mongoClustersCheckNameAvailability(context: DocumentDBContext, subscriptionId: string, location: string, body: CheckNameAvailabilityRequest_2, options?: MongoClustersCheckNameAvailabilityOptionalParams): Promise; - -// @public -export function mongoClustersCreateOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster_2, options?: MongoClustersCreateOrUpdateOptionalParams): PollerLike, MongoCluster_2>; - -// @public -export function mongoClustersDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): PollerLike, void>; - -// @public -export function mongoClustersGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): Promise; - -// @public -export function mongoClustersList(context: DocumentDBContext, subscriptionId: string, options?: MongoClustersListOptionalParams): PagedAsyncIterableIterator; - -// @public -export function mongoClustersListByResourceGroup(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - -// @public -export function mongoClustersListConnectionStrings(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): Promise; - -// @public -export function mongoClustersUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate_2, options?: MongoClustersUpdateOptionalParams): PollerLike, MongoCluster_2>; - -// @public -export function operationsList(context: DocumentDBContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; - -// @public -export function privateEndpointConnectionsCreate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, void>; - -// @public -export function privateEndpointConnectionsDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): PollerLike, void>; - -// @public -export function privateEndpointConnectionsGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; - -// @public -export function privateEndpointConnectionsListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): PagedAsyncIterableIterator; - -// @public -export function privateLinksListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): PagedAsyncIterableIterator; - // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md index 6b9d35bd71a2..1742e398e914 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md @@ -9,16 +9,6 @@ import { OperationOptions } from '@azure-rest/core-client'; // @public export type ActionType = string; -// @public -export interface ArmOperationStatus { - readonly endTime?: Date; - readonly error?: ErrorDetail; - readonly name?: string; - readonly percentComplete?: number; - readonly startTime?: Date; - status: ResourceProvisioningState; -} - // @public export type CheckNameAvailabilityReason = string; @@ -77,12 +67,6 @@ export interface FirewallRule extends ProxyResource { properties?: FirewallRuleProperties; } -// @public -export interface FirewallRuleListResult { - nextLink?: string; - value: FirewallRule[]; -} - // @public export interface FirewallRuleProperties { endIpAddress: string; @@ -108,6 +92,114 @@ export interface FirewallRulesGetOptionalParams extends OperationOptions { export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { } +// @public (undocumented) +export enum KnownActionType { + // (undocumented) + Internal = "Internal" +} + +// @public (undocumented) +export enum KnownCheckNameAvailabilityReason { + // (undocumented) + AlreadyExists = "AlreadyExists", + // (undocumented) + Invalid = "Invalid" +} + +// @public (undocumented) +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public (undocumented) +export enum KnownCreateMode { + // (undocumented) + Default = "Default", + // (undocumented) + PointInTimeRestore = "PointInTimeRestore" +} + +// @public (undocumented) +export enum KnownMongoClusterStatus { + // (undocumented) + Dropping = "Dropping", + // (undocumented) + Provisioning = "Provisioning", + // (undocumented) + Ready = "Ready", + // (undocumented) + Starting = "Starting", + // (undocumented) + Stopped = "Stopped", + // (undocumented) + Stopping = "Stopping", + // (undocumented) + Updating = "Updating" +} + +// @public (undocumented) +export enum KnownNodeKind { + // (undocumented) + Shard = "Shard" +} + +// @public (undocumented) +export enum KnownOrigin { + // (undocumented) + "user,system" = "user,system", + // (undocumented) + system = "system", + // (undocumented) + user = "user" +} + +// @public (undocumented) +export enum KnownPrivateEndpointConnectionProvisioningState { + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public (undocumented) +export enum KnownPrivateEndpointServiceConnectionStatus { + // (undocumented) + Approved = "Approved", + // (undocumented) + Pending = "Pending", + // (undocumented) + Rejected = "Rejected" +} + +// @public (undocumented) +export enum KnownPublicNetworkAccess { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + +// @public (undocumented) +export enum KnownResourceProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" +} + // @public export interface ListConnectionStringsResult { readonly connectionStrings?: ConnectionString[]; @@ -118,12 +210,6 @@ export interface MongoCluster extends TrackedResource { properties?: MongoClusterProperties; } -// @public -export interface MongoClusterListResult { - nextLink?: string; - value: MongoCluster[]; -} - // @public export interface MongoClusterProperties { administratorLogin?: string; @@ -243,12 +329,6 @@ export interface PagedAsyncIterableIterator>; } -// @public -export interface PagedOperation { - nextLink?: string; - value: Operation[]; -} - // @public export interface PageSettings { continuationToken?: string; @@ -256,11 +336,11 @@ export interface PageSettings { // @public export interface PrivateEndpoint { - id?: string; + readonly id?: string; } // @public -export interface PrivateEndpointConnection extends ProxyResource { +export interface PrivateEndpointConnection extends Resource { properties?: PrivateEndpointConnectionProperties; } @@ -269,23 +349,17 @@ export interface PrivateEndpointConnectionProperties { readonly groupIds?: string[]; privateEndpoint?: PrivateEndpoint; privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; - provisioningState?: PrivateEndpointConnectionProvisioningState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; } // @public -export type PrivateEndpointConnectionProvisioningState = ResourceProvisioningState | "Creating" | "Deleting"; +export type PrivateEndpointConnectionProvisioningState = string; // @public export interface PrivateEndpointConnectionResource extends ProxyResource { properties?: PrivateEndpointConnectionProperties; } -// @public -export interface PrivateEndpointConnectionResourceListResult { - nextLink?: string; - value: PrivateEndpointConnectionResource[]; -} - // @public (undocumented) export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { updateIntervalInMs?: number; @@ -312,12 +386,6 @@ export interface PrivateLinkResource extends ProxyResource { properties?: PrivateLinkResourceProperties; } -// @public -export interface PrivateLinkResourceListResult { - nextLink?: string; - value: PrivateLinkResource[]; -} - // @public export interface PrivateLinkResourceProperties { readonly groupId?: string; @@ -359,12 +427,12 @@ export type ResourceProvisioningState = string; // @public export interface SystemData { - readonly createdAt?: Date; - readonly createdBy?: string; - readonly createdByType?: CreatedByType; - readonly lastModifiedAt?: Date; - readonly lastModifiedBy?: string; - readonly lastModifiedByType?: CreatedByType; + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; } // @public @@ -373,7 +441,7 @@ export interface TrackedResource extends Resource { tags?: Record; } -// @public (undocumented) +// @public export type Versions = "2024-03-01-preview"; // (No @packageDocumentation comment for this package) diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md index 2976cb97efd9..cbc32ebb9f47 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md @@ -5,33 +5,17 @@ ```ts import { AbortSignalLike } from '@azure/abort-controller'; -import { Client } from '@azure-rest/core-client'; import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; import { OperationOptions } from '@azure-rest/core-client'; import { OperationState } from '@azure/core-lro'; -import { Paged } from '@azure/core-paging'; import { PathUncheckedResponse } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; import { PollerLike } from '@azure/core-lro'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; import { TokenCredential } from '@azure/core-auth'; // @public export type ActionType = string; -// @public -export interface ArmOperationStatus { - readonly endTime?: Date; - readonly error?: ErrorDetail; - readonly name?: string; - readonly percentComplete?: number; - readonly startTime?: Date; - status: ResourceProvisioningState; -} - // @public export type CheckNameAvailabilityReason = string; @@ -90,12 +74,6 @@ export interface FirewallRule extends ProxyResource { properties?: FirewallRuleProperties; } -// @public -export interface FirewallRuleListResult { - nextLink?: string; - value: FirewallRule[]; -} - // @public export interface FirewallRuleProperties { endIpAddress: string; @@ -124,13 +102,121 @@ export interface FirewallRulesListByMongoClusterOptionalParams extends Operation // @public (undocumented) export interface FirewallRulesOperations { // (undocumented) - createOrUpdate: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, void>; + createOrUpdate: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, void>; + // (undocumented) + delete: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => PollerLike, void>; + // (undocumented) + get: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams) => Promise; + // (undocumented) + listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; +} + +// @public (undocumented) +export enum KnownActionType { + // (undocumented) + Internal = "Internal" +} + +// @public (undocumented) +export enum KnownCheckNameAvailabilityReason { + // (undocumented) + AlreadyExists = "AlreadyExists", + // (undocumented) + Invalid = "Invalid" +} + +// @public (undocumented) +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public (undocumented) +export enum KnownCreateMode { + // (undocumented) + Default = "Default", + // (undocumented) + PointInTimeRestore = "PointInTimeRestore" +} + +// @public (undocumented) +export enum KnownMongoClusterStatus { + // (undocumented) + Dropping = "Dropping", + // (undocumented) + Provisioning = "Provisioning", // (undocumented) - delete: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => PollerLike, void>; + Ready = "Ready", // (undocumented) - get: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams) => Promise; + Starting = "Starting", // (undocumented) - listByMongoCluster: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; + Stopped = "Stopped", + // (undocumented) + Stopping = "Stopping", + // (undocumented) + Updating = "Updating" +} + +// @public (undocumented) +export enum KnownNodeKind { + // (undocumented) + Shard = "Shard" +} + +// @public (undocumented) +export enum KnownOrigin { + // (undocumented) + "user,system" = "user,system", + // (undocumented) + system = "system", + // (undocumented) + user = "user" +} + +// @public (undocumented) +export enum KnownPrivateEndpointConnectionProvisioningState { + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public (undocumented) +export enum KnownPrivateEndpointServiceConnectionStatus { + // (undocumented) + Approved = "Approved", + // (undocumented) + Pending = "Pending", + // (undocumented) + Rejected = "Rejected" +} + +// @public (undocumented) +export enum KnownPublicNetworkAccess { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + +// @public (undocumented) +export enum KnownResourceProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" } // @public @@ -143,15 +229,9 @@ export interface MongoCluster extends TrackedResource { properties?: MongoClusterProperties; } -// @public -export interface MongoClusterListResult { - nextLink?: string; - value: MongoCluster[]; -} - // @public (undocumented) export class MongoClusterManagementClient { - constructor(credential: TokenCredential, options?: MongoClusterManagementClientOptions); + constructor(credential: TokenCredential, subscriptionId: string, options?: MongoClusterManagementClientOptions); readonly firewallRules: FirewallRulesOperations; readonly mongoClusters: MongoClustersOperations; readonly operations: OperationsOperations; @@ -220,21 +300,21 @@ export interface MongoClustersListOptionalParams extends OperationOptions { // @public (undocumented) export interface MongoClustersOperations { // (undocumented) - checkNameAvailability: (subscriptionId: string, location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams) => Promise; + checkNameAvailability: (location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams) => Promise; // (undocumented) - createOrUpdate: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams) => PollerLike, MongoCluster>; + createOrUpdate: (resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams) => PollerLike, MongoCluster>; // (undocumented) - delete: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams) => PollerLike, void>; + delete: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams) => PollerLike, void>; // (undocumented) - get: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams) => Promise; + get: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams) => Promise; // (undocumented) - list: (subscriptionId: string, options?: MongoClustersListOptionalParams) => PagedAsyncIterableIterator; + list: (options?: MongoClustersListOptionalParams) => PagedAsyncIterableIterator; // (undocumented) - listByResourceGroup: (subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listByResourceGroup: (resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; // (undocumented) - listConnectionStrings: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams) => Promise; + listConnectionStrings: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams) => Promise; // (undocumented) - update: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams) => PollerLike, MongoCluster>; + update: (resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams) => PollerLike, MongoCluster>; } // @public @@ -310,12 +390,6 @@ export interface PagedAsyncIterableIterator>; } -// @public -export interface PagedOperation { - nextLink?: string; - value: Operation[]; -} - // @public export interface PageSettings { continuationToken?: string; @@ -323,11 +397,11 @@ export interface PageSettings { // @public export interface PrivateEndpoint { - id?: string; + readonly id?: string; } // @public -export interface PrivateEndpointConnection extends ProxyResource { +export interface PrivateEndpointConnection extends Resource { properties?: PrivateEndpointConnectionProperties; } @@ -336,23 +410,17 @@ export interface PrivateEndpointConnectionProperties { readonly groupIds?: string[]; privateEndpoint?: PrivateEndpoint; privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; - provisioningState?: PrivateEndpointConnectionProvisioningState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; } // @public -export type PrivateEndpointConnectionProvisioningState = ResourceProvisioningState | "Creating" | "Deleting"; +export type PrivateEndpointConnectionProvisioningState = string; // @public export interface PrivateEndpointConnectionResource extends ProxyResource { properties?: PrivateEndpointConnectionProperties; } -// @public -export interface PrivateEndpointConnectionResourceListResult { - nextLink?: string; - value: PrivateEndpointConnectionResource[]; -} - // @public (undocumented) export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { updateIntervalInMs?: number; @@ -374,13 +442,13 @@ export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams exte // @public (undocumented) export interface PrivateEndpointConnectionsOperations { // (undocumented) - create: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams) => PollerLike, void>; + create: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams) => PollerLike, void>; // (undocumented) - delete: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, void>; + delete: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, void>; // (undocumented) - get: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams) => Promise; + get: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams) => Promise; // (undocumented) - listByMongoCluster: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; + listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; } // @public @@ -391,12 +459,6 @@ export interface PrivateLinkResource extends ProxyResource { properties?: PrivateLinkResourceProperties; } -// @public -export interface PrivateLinkResourceListResult { - nextLink?: string; - value: PrivateLinkResource[]; -} - // @public export interface PrivateLinkResourceProperties { readonly groupId?: string; @@ -418,7 +480,7 @@ export interface PrivateLinksListByMongoClusterOptionalParams extends OperationO // @public (undocumented) export interface PrivateLinksOperations { // (undocumented) - listByMongoCluster: (subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; + listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; } // @public @@ -442,10 +504,8 @@ export interface Resource { // @public export type ResourceProvisioningState = string; -// Warning: (ae-forgotten-export) The symbol "DocumentDBContext" needs to be exported by the entry point index.d.ts -// // @public -export function restorePoller(client: DocumentDBContext | MongoClusterManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; +export function restorePoller(client: MongoClusterManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; // @public (undocumented) export interface RestorePollerOptions extends OperationOptions { @@ -456,12 +516,12 @@ export interface RestorePollerOptions; } -// @public (undocumented) +// @public export type Versions = "2024-03-01-preview"; // (No @packageDocumentation comment for this package) diff --git a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts index bd7b5cd037e2..57bf17336c06 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts @@ -3,7 +3,11 @@ import { getLongRunningPoller } from "../pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; -import { FirewallRule, FirewallRuleListResult } from "../../models/models.js"; +import { + firewallRulePropertiesSerializer, + FirewallRule, + _FirewallRuleListResult, +} from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "../pagingHelpers.js"; import { @@ -35,7 +39,7 @@ import { FirewallRulesListByMongoClusterOptionalParams, } from "../../models/options.js"; -export function _firewallRulesGetSend( +export function _getSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -56,7 +60,7 @@ export function _firewallRulesGetSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _firewallRulesGetDeserialize( +export async function _getDeserialize( result: FirewallRulesGet200Response | FirewallRulesGetDefaultResponse, ): Promise { if (isUnexpected(result)) { @@ -94,7 +98,7 @@ export async function _firewallRulesGetDeserialize( } /** Gets information about a mongo cluster firewall rule. */ -export async function firewallRulesGet( +export async function get( context: Client, subscriptionId: string, resourceGroupName: string, @@ -102,7 +106,7 @@ export async function firewallRulesGet( firewallRuleName: string, options: FirewallRulesGetOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _firewallRulesGetSend( + const result = await _getSend( context, subscriptionId, resourceGroupName, @@ -110,10 +114,10 @@ export async function firewallRulesGet( firewallRuleName, options, ); - return _firewallRulesGetDeserialize(result); + return _getDeserialize(result); } -export function _firewallRulesCreateOrUpdateSend( +export function _createOrUpdateSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -140,16 +144,13 @@ export function _firewallRulesCreateOrUpdateSend( ...operationOptionsToRequestParameters(options), body: { properties: !resource.properties - ? undefined - : { - startIpAddress: resource.properties?.["startIpAddress"], - endIpAddress: resource.properties?.["endIpAddress"], - }, + ? resource.properties + : firewallRulePropertiesSerializer(resource.properties), }, }); } -export async function _firewallRulesCreateOrUpdateDeserialize( +export async function _createOrUpdateDeserialize( result: | FirewallRulesCreateOrUpdate200Response | FirewallRulesCreateOrUpdate201Response @@ -166,7 +167,7 @@ export async function _firewallRulesCreateOrUpdateDeserialize( } /** Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. */ -export function firewallRulesCreateOrUpdate( +export function createOrUpdate( context: Client, subscriptionId: string, resourceGroupName: string, @@ -175,27 +176,23 @@ export function firewallRulesCreateOrUpdate( resource: FirewallRule, options: FirewallRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller( - context, - _firewallRulesCreateOrUpdateDeserialize, - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _firewallRulesCreateOrUpdateSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - firewallRuleName, - resource, - options, - ), - }, - ) as PollerLike, void>; + return getLongRunningPoller(context, _createOrUpdateDeserialize, { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + resource, + options, + ), + }) as PollerLike, void>; } -export function _firewallRulesDeleteSend( +export function _$deleteSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -219,7 +216,7 @@ export function _firewallRulesDeleteSend( .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _firewallRulesDeleteDeserialize( +export async function _$deleteDeserialize( result: | FirewallRulesDelete202Response | FirewallRulesDelete204Response @@ -235,7 +232,12 @@ export async function _firewallRulesDeleteDeserialize( } /** Deletes a mongo cluster firewall rule. */ -export function firewallRulesDelete( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( context: Client, subscriptionId: string, resourceGroupName: string, @@ -243,11 +245,11 @@ export function firewallRulesDelete( firewallRuleName: string, options: FirewallRulesDeleteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller(context, _firewallRulesDeleteDeserialize, { + return getLongRunningPoller(context, _$deleteDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, getInitialResponse: () => - _firewallRulesDeleteSend( + _$deleteSend( context, subscriptionId, resourceGroupName, @@ -258,7 +260,7 @@ export function firewallRulesDelete( }) as PollerLike, void>; } -export function _firewallRulesListByMongoClusterSend( +export function _listByMongoClusterSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -280,11 +282,11 @@ export function _firewallRulesListByMongoClusterSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _firewallRulesListByMongoClusterDeserialize( +export async function _listByMongoClusterDeserialize( result: | FirewallRulesListByMongoCluster200Response | FirewallRulesListByMongoClusterDefaultResponse, -): Promise { +): Promise<_FirewallRuleListResult> { if (isUnexpected(result)) { throw createRestError(result); } @@ -323,7 +325,7 @@ export async function _firewallRulesListByMongoClusterDeserialize( } /** List all the firewall rules in a given mongo cluster. */ -export function firewallRulesListByMongoCluster( +export function listByMongoCluster( context: Client, subscriptionId: string, resourceGroupName: string, @@ -335,14 +337,14 @@ export function firewallRulesListByMongoCluster( return buildPagedAsyncIterator( context, () => - _firewallRulesListByMongoClusterSend( + _listByMongoClusterSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ), - _firewallRulesListByMongoClusterDeserialize, + _listByMongoClusterDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/index.ts index bd5bfb1769b5..eee53a2abe0f 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/index.ts @@ -6,27 +6,3 @@ export { MongoClusterManagementClientOptions, DocumentDBContext, } from "./mongoClusterManagementContext.js"; -export { - firewallRulesGet, - firewallRulesCreateOrUpdate, - firewallRulesDelete, - firewallRulesListByMongoCluster, -} from "./firewallRules/index.js"; -export { - mongoClustersGet, - mongoClustersCreateOrUpdate, - mongoClustersUpdate, - mongoClustersDelete, - mongoClustersListByResourceGroup, - mongoClustersList, - mongoClustersListConnectionStrings, - mongoClustersCheckNameAvailability, -} from "./mongoClusters/index.js"; -export { operationsList } from "./operations/index.js"; -export { - privateEndpointConnectionsListByMongoCluster, - privateEndpointConnectionsGet, - privateEndpointConnectionsCreate, - privateEndpointConnectionsDelete, -} from "./privateEndpointConnections/index.js"; -export { privateLinksListByMongoCluster } from "./privateLinks/index.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts index cbe2b362b813..becce903a6aa 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts @@ -4,12 +4,14 @@ import { getLongRunningPoller } from "../pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { + mongoClusterPropertiesSerializer, + mongoClusterUpdatePropertiesSerializer, MongoCluster, MongoClusterUpdate, - MongoClusterListResult, ListConnectionStringsResult, CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, + _MongoClusterListResult, } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "../pagingHelpers.js"; @@ -44,6 +46,7 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; +import { serializeRecord } from "../../helpers/serializerHelpers.js"; import { MongoClustersGetOptionalParams, MongoClustersCreateOrUpdateOptionalParams, @@ -55,7 +58,7 @@ import { MongoClustersCheckNameAvailabilityOptionalParams, } from "../../models/options.js"; -export function _mongoClustersGetSend( +export function _getSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -74,7 +77,7 @@ export function _mongoClustersGetSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _mongoClustersGetDeserialize( +export async function _getDeserialize( result: MongoClustersGet200Response | MongoClustersGetDefaultResponse, ): Promise { if (isUnexpected(result)) { @@ -82,8 +85,8 @@ export async function _mongoClustersGetDeserialize( } return { - location: result.body["location"], tags: result.body["tags"], + location: result.body["location"], id: result.body["id"], name: result.body["name"], type: result.body["type"], @@ -200,24 +203,24 @@ export async function _mongoClustersGetDeserialize( } /** Gets information about a mongo cluster. */ -export async function mongoClustersGet( +export async function get( context: Client, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options: MongoClustersGetOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _mongoClustersGetSend( + const result = await _getSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ); - return _mongoClustersGetDeserialize(result); + return _getDeserialize(result); } -export function _mongoClustersCreateOrUpdateSend( +export function _createOrUpdateSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -240,45 +243,18 @@ export function _mongoClustersCreateOrUpdateSend( .put({ ...operationOptionsToRequestParameters(options), body: { + tags: !resource.tags + ? resource.tags + : (serializeRecord(resource.tags as any) as any), location: resource["location"], - tags: resource["tags"], properties: !resource.properties - ? undefined - : { - createMode: resource.properties?.["createMode"], - restoreParameters: !resource.properties?.restoreParameters - ? undefined - : { - pointInTimeUTC: - resource.properties?.restoreParameters?.[ - "pointInTimeUTC" - ]?.toISOString(), - sourceResourceId: - resource.properties?.restoreParameters?.[ - "sourceResourceId" - ], - }, - administratorLogin: resource.properties?.["administratorLogin"], - administratorLoginPassword: - resource.properties?.["administratorLoginPassword"], - serverVersion: resource.properties?.["serverVersion"], - publicNetworkAccess: resource.properties?.["publicNetworkAccess"], - nodeGroupSpecs: - resource.properties?.["nodeGroupSpecs"] === undefined - ? resource.properties?.["nodeGroupSpecs"] - : resource.properties?.["nodeGroupSpecs"].map((p) => ({ - sku: p["sku"], - diskSizeGB: p["diskSizeGB"], - enableHa: p["enableHa"], - kind: p["kind"], - nodeCount: p["nodeCount"], - })), - }, + ? resource.properties + : mongoClusterPropertiesSerializer(resource.properties), }, }); } -export async function _mongoClustersCreateOrUpdateDeserialize( +export async function _createOrUpdateDeserialize( result: | MongoClustersCreateOrUpdate200Response | MongoClustersCreateOrUpdate201Response @@ -291,8 +267,8 @@ export async function _mongoClustersCreateOrUpdateDeserialize( result = result as MongoClustersCreateOrUpdateLogicalResponse; return { - location: result.body["location"], tags: result.body["tags"], + location: result.body["location"], id: result.body["id"], name: result.body["name"], type: result.body["type"], @@ -409,7 +385,7 @@ export async function _mongoClustersCreateOrUpdateDeserialize( } /** Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. */ -export function mongoClustersCreateOrUpdate( +export function createOrUpdate( context: Client, subscriptionId: string, resourceGroupName: string, @@ -417,26 +393,22 @@ export function mongoClustersCreateOrUpdate( resource: MongoCluster, options: MongoClustersCreateOrUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, MongoCluster> { - return getLongRunningPoller( - context, - _mongoClustersCreateOrUpdateDeserialize, - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _mongoClustersCreateOrUpdateSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - resource, - options, - ), - }, - ) as PollerLike, MongoCluster>; + return getLongRunningPoller(context, _createOrUpdateDeserialize, { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + resource, + options, + ), + }) as PollerLike, MongoCluster>; } -export function _mongoClustersUpdateSend( +export function _updateSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -459,32 +431,17 @@ export function _mongoClustersUpdateSend( .patch({ ...operationOptionsToRequestParameters(options), body: { - tags: properties["tags"], + tags: !properties.tags + ? properties.tags + : (serializeRecord(properties.tags as any) as any), properties: !properties.properties - ? undefined - : { - administratorLogin: properties.properties?.["administratorLogin"], - administratorLoginPassword: - properties.properties?.["administratorLoginPassword"], - serverVersion: properties.properties?.["serverVersion"], - publicNetworkAccess: - properties.properties?.["publicNetworkAccess"], - nodeGroupSpecs: - properties.properties?.["nodeGroupSpecs"] === undefined - ? properties.properties?.["nodeGroupSpecs"] - : properties.properties?.["nodeGroupSpecs"].map((p) => ({ - sku: p["sku"], - diskSizeGB: p["diskSizeGB"], - enableHa: p["enableHa"], - kind: p["kind"], - nodeCount: p["nodeCount"], - })), - }, + ? properties.properties + : mongoClusterUpdatePropertiesSerializer(properties.properties), }, }); } -export async function _mongoClustersUpdateDeserialize( +export async function _updateDeserialize( result: | MongoClustersUpdate200Response | MongoClustersUpdate202Response @@ -497,8 +454,8 @@ export async function _mongoClustersUpdateDeserialize( result = result as MongoClustersUpdateLogicalResponse; return { - location: result.body["location"], tags: result.body["tags"], + location: result.body["location"], id: result.body["id"], name: result.body["name"], type: result.body["type"], @@ -615,7 +572,7 @@ export async function _mongoClustersUpdateDeserialize( } /** Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. */ -export function mongoClustersUpdate( +export function update( context: Client, subscriptionId: string, resourceGroupName: string, @@ -623,11 +580,11 @@ export function mongoClustersUpdate( properties: MongoClusterUpdate, options: MongoClustersUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, MongoCluster> { - return getLongRunningPoller(context, _mongoClustersUpdateDeserialize, { + return getLongRunningPoller(context, _updateDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, getInitialResponse: () => - _mongoClustersUpdateSend( + _updateSend( context, subscriptionId, resourceGroupName, @@ -638,7 +595,7 @@ export function mongoClustersUpdate( }) as PollerLike, MongoCluster>; } -export function _mongoClustersDeleteSend( +export function _$deleteSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -660,7 +617,7 @@ export function _mongoClustersDeleteSend( .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _mongoClustersDeleteDeserialize( +export async function _$deleteDeserialize( result: | MongoClustersDelete202Response | MongoClustersDelete204Response @@ -676,18 +633,23 @@ export async function _mongoClustersDeleteDeserialize( } /** Deletes a mongo cluster. */ -export function mongoClustersDelete( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( context: Client, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options: MongoClustersDeleteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller(context, _mongoClustersDeleteDeserialize, { + return getLongRunningPoller(context, _$deleteDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, getInitialResponse: () => - _mongoClustersDeleteSend( + _$deleteSend( context, subscriptionId, resourceGroupName, @@ -697,7 +659,7 @@ export function mongoClustersDelete( }) as PollerLike, void>; } -export function _mongoClustersListByResourceGroupSend( +export function _listByResourceGroupSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -717,19 +679,19 @@ export function _mongoClustersListByResourceGroupSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _mongoClustersListByResourceGroupDeserialize( +export async function _listByResourceGroupDeserialize( result: | MongoClustersListByResourceGroup200Response | MongoClustersListByResourceGroupDefaultResponse, -): Promise { +): Promise<_MongoClusterListResult> { if (isUnexpected(result)) { throw createRestError(result); } return { value: result.body["value"].map((p) => ({ - location: p["location"], tags: p["tags"], + location: p["location"], id: p["id"], name: p["name"], type: p["type"], @@ -841,7 +803,7 @@ export async function _mongoClustersListByResourceGroupDeserialize( } /** List all the mongo clusters in a given resource group. */ -export function mongoClustersListByResourceGroup( +export function listByResourceGroup( context: Client, subscriptionId: string, resourceGroupName: string, @@ -852,18 +814,18 @@ export function mongoClustersListByResourceGroup( return buildPagedAsyncIterator( context, () => - _mongoClustersListByResourceGroupSend( + _listByResourceGroupSend( context, subscriptionId, resourceGroupName, options, ), - _mongoClustersListByResourceGroupDeserialize, + _listByResourceGroupDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } -export function _mongoClustersListSend( +export function _listSend( context: Client, subscriptionId: string, options: MongoClustersListOptionalParams = { requestOptions: {} }, @@ -878,17 +840,17 @@ export function _mongoClustersListSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _mongoClustersListDeserialize( +export async function _listDeserialize( result: MongoClustersList200Response | MongoClustersListDefaultResponse, -): Promise { +): Promise<_MongoClusterListResult> { if (isUnexpected(result)) { throw createRestError(result); } return { value: result.body["value"].map((p) => ({ - location: p["location"], tags: p["tags"], + location: p["location"], id: p["id"], name: p["name"], type: p["type"], @@ -1000,20 +962,20 @@ export async function _mongoClustersListDeserialize( } /** List all the mongo clusters in a given subscription. */ -export function mongoClustersList( +export function list( context: Client, subscriptionId: string, options: MongoClustersListOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _mongoClustersListSend(context, subscriptionId, options), - _mongoClustersListDeserialize, + () => _listSend(context, subscriptionId, options), + _listDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } -export function _mongoClustersListConnectionStringsSend( +export function _listConnectionStringsSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -1035,7 +997,7 @@ export function _mongoClustersListConnectionStringsSend( .post({ ...operationOptionsToRequestParameters(options) }); } -export async function _mongoClustersListConnectionStringsDeserialize( +export async function _listConnectionStringsDeserialize( result: | MongoClustersListConnectionStrings200Response | MongoClustersListConnectionStringsDefaultResponse, @@ -1056,7 +1018,7 @@ export async function _mongoClustersListConnectionStringsDeserialize( } /** 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. */ -export async function mongoClustersListConnectionStrings( +export async function listConnectionStrings( context: Client, subscriptionId: string, resourceGroupName: string, @@ -1065,17 +1027,17 @@ export async function mongoClustersListConnectionStrings( requestOptions: {}, }, ): Promise { - const result = await _mongoClustersListConnectionStringsSend( + const result = await _listConnectionStringsSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ); - return _mongoClustersListConnectionStringsDeserialize(result); + return _listConnectionStringsDeserialize(result); } -export function _mongoClustersCheckNameAvailabilitySend( +export function _checkNameAvailabilitySend( context: Client, subscriptionId: string, location: string, @@ -1099,7 +1061,7 @@ export function _mongoClustersCheckNameAvailabilitySend( }); } -export async function _mongoClustersCheckNameAvailabilityDeserialize( +export async function _checkNameAvailabilityDeserialize( result: | MongoClustersCheckNameAvailability200Response | MongoClustersCheckNameAvailabilityDefaultResponse, @@ -1116,7 +1078,7 @@ export async function _mongoClustersCheckNameAvailabilityDeserialize( } /** Check if mongo cluster name is available for use. */ -export async function mongoClustersCheckNameAvailability( +export async function checkNameAvailability( context: Client, subscriptionId: string, location: string, @@ -1125,12 +1087,12 @@ export async function mongoClustersCheckNameAvailability( requestOptions: {}, }, ): Promise { - const result = await _mongoClustersCheckNameAvailabilitySend( + const result = await _checkNameAvailabilitySend( context, subscriptionId, location, body, options, ); - return _mongoClustersCheckNameAvailabilityDeserialize(result); + return _checkNameAvailabilityDeserialize(result); } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts index 38af7e9bf502..56fa5c9787d6 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PagedOperation, Operation } from "../../models/models.js"; +import { Operation, _OperationListResult } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "../pagingHelpers.js"; import { @@ -17,7 +17,7 @@ import { } from "@azure-rest/core-client"; import { OperationsListOptionalParams } from "../../models/options.js"; -export function _operationsListSend( +export function _listSend( context: Client, options: OperationsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { @@ -26,9 +26,9 @@ export function _operationsListSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _operationsListDeserialize( +export async function _listDeserialize( result: OperationsList200Response | OperationsListDefaultResponse, -): Promise { +): Promise<_OperationListResult> { if (isUnexpected(result)) { throw createRestError(result); } @@ -53,14 +53,14 @@ export async function _operationsListDeserialize( } /** List the operations for the provider */ -export function operationsList( +export function list( context: Client, options: OperationsListOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _operationsListSend(context, options), - _operationsListDeserialize, + () => _listSend(context, options), + _listDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts index ec24f6ec0def..543a2758275b 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts @@ -4,8 +4,9 @@ import { getLongRunningPoller } from "../pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { - PrivateEndpointConnectionResourceListResult, + privateEndpointConnectionPropertiesSerializer, PrivateEndpointConnectionResource, + _PrivateEndpointConnectionResourceListResult, } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "../pagingHelpers.js"; @@ -38,7 +39,7 @@ import { PrivateEndpointConnectionsDeleteOptionalParams, } from "../../models/options.js"; -export function _privateEndpointConnectionsListByMongoClusterSend( +export function _listByMongoClusterSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -60,11 +61,11 @@ export function _privateEndpointConnectionsListByMongoClusterSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _privateEndpointConnectionsListByMongoClusterDeserialize( +export async function _listByMongoClusterDeserialize( result: | PrivateEndpointConnectionsListByMongoCluster200Response | PrivateEndpointConnectionsListByMongoClusterDefaultResponse, -): Promise { +): Promise<_PrivateEndpointConnectionResourceListResult> { if (isUnexpected(result)) { throw createRestError(result); } @@ -114,7 +115,7 @@ export async function _privateEndpointConnectionsListByMongoClusterDeserialize( } /** List existing private connections */ -export function privateEndpointConnectionsListByMongoCluster( +export function listByMongoCluster( context: Client, subscriptionId: string, resourceGroupName: string, @@ -126,19 +127,19 @@ export function privateEndpointConnectionsListByMongoCluster( return buildPagedAsyncIterator( context, () => - _privateEndpointConnectionsListByMongoClusterSend( + _listByMongoClusterSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ), - _privateEndpointConnectionsListByMongoClusterDeserialize, + _listByMongoClusterDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } -export function _privateEndpointConnectionsGetSend( +export function _getSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -160,7 +161,7 @@ export function _privateEndpointConnectionsGetSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _privateEndpointConnectionsGetDeserialize( +export async function _getDeserialize( result: | PrivateEndpointConnectionsGet200Response | PrivateEndpointConnectionsGetDefaultResponse, @@ -216,7 +217,7 @@ export async function _privateEndpointConnectionsGetDeserialize( } /** Get a specific private connection */ -export async function privateEndpointConnectionsGet( +export async function get( context: Client, subscriptionId: string, resourceGroupName: string, @@ -224,7 +225,7 @@ export async function privateEndpointConnectionsGet( privateEndpointConnectionName: string, options: PrivateEndpointConnectionsGetOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _privateEndpointConnectionsGetSend( + const result = await _getSend( context, subscriptionId, resourceGroupName, @@ -232,10 +233,10 @@ export async function privateEndpointConnectionsGet( privateEndpointConnectionName, options, ); - return _privateEndpointConnectionsGetDeserialize(result); + return _getDeserialize(result); } -export function _privateEndpointConnectionsCreateSend( +export function _createSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -264,32 +265,13 @@ export function _privateEndpointConnectionsCreateSend( ...operationOptionsToRequestParameters(options), body: { properties: !resource.properties - ? undefined - : { - privateEndpoint: !resource.properties?.privateEndpoint - ? undefined - : { id: resource.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: - resource.properties?.privateLinkServiceConnectionState[ - "status" - ], - description: - resource.properties?.privateLinkServiceConnectionState[ - "description" - ], - actionsRequired: - resource.properties?.privateLinkServiceConnectionState[ - "actionsRequired" - ], - }, - provisioningState: resource.properties?.["provisioningState"], - }, + ? resource.properties + : privateEndpointConnectionPropertiesSerializer(resource.properties), }, }); } -export async function _privateEndpointConnectionsCreateDeserialize( +export async function _createDeserialize( result: | PrivateEndpointConnectionsCreate200Response | PrivateEndpointConnectionsCreate201Response @@ -306,7 +288,7 @@ export async function _privateEndpointConnectionsCreateDeserialize( } /** Create a Private endpoint connection */ -export function privateEndpointConnectionsCreate( +export function create( context: Client, subscriptionId: string, resourceGroupName: string, @@ -317,27 +299,23 @@ export function privateEndpointConnectionsCreate( requestOptions: {}, }, ): PollerLike, void> { - return getLongRunningPoller( - context, - _privateEndpointConnectionsCreateDeserialize, - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _privateEndpointConnectionsCreateSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - resource, - options, - ), - }, - ) as PollerLike, void>; + return getLongRunningPoller(context, _createDeserialize, { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + resource, + options, + ), + }) as PollerLike, void>; } -export function _privateEndpointConnectionsDeleteSend( +export function _$deleteSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -363,7 +341,7 @@ export function _privateEndpointConnectionsDeleteSend( .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _privateEndpointConnectionsDeleteDeserialize( +export async function _$deleteDeserialize( result: | PrivateEndpointConnectionsDelete202Response | PrivateEndpointConnectionsDelete204Response @@ -379,7 +357,12 @@ export async function _privateEndpointConnectionsDeleteDeserialize( } /** Delete the private endpoint connection */ -export function privateEndpointConnectionsDelete( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( context: Client, subscriptionId: string, resourceGroupName: string, @@ -389,21 +372,17 @@ export function privateEndpointConnectionsDelete( requestOptions: {}, }, ): PollerLike, void> { - return getLongRunningPoller( - context, - _privateEndpointConnectionsDeleteDeserialize, - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _privateEndpointConnectionsDeleteSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - options, - ), - }, - ) as PollerLike, void>; + return getLongRunningPoller(context, _$deleteDeserialize, { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + options, + ), + }) as PollerLike, void>; } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts index e34c596c8963..03261181f0bf 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts @@ -2,8 +2,8 @@ // Licensed under the MIT license. import { - PrivateLinkResourceListResult, PrivateLinkResource, + _PrivateLinkResourceListResult, } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "../pagingHelpers.js"; @@ -20,7 +20,7 @@ import { } from "@azure-rest/core-client"; import { PrivateLinksListByMongoClusterOptionalParams } from "../../models/options.js"; -export function _privateLinksListByMongoClusterSend( +export function _listByMongoClusterSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -42,11 +42,11 @@ export function _privateLinksListByMongoClusterSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _privateLinksListByMongoClusterDeserialize( +export async function _listByMongoClusterDeserialize( result: | PrivateLinksListByMongoCluster200Response | PrivateLinksListByMongoClusterDefaultResponse, -): Promise { +): Promise<_PrivateLinkResourceListResult> { if (isUnexpected(result)) { throw createRestError(result); } @@ -85,7 +85,7 @@ export async function _privateLinksListByMongoClusterDeserialize( } /** list private links on the given resource */ -export function privateLinksListByMongoCluster( +export function listByMongoCluster( context: Client, subscriptionId: string, resourceGroupName: string, @@ -97,14 +97,14 @@ export function privateLinksListByMongoCluster( return buildPagedAsyncIterator( context, () => - _privateLinksListByMongoClusterSend( + _listByMongoClusterSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ), - _privateLinksListByMongoClusterDeserialize, + _listByMongoClusterDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts index e400da624ba6..b8507d8950b2 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts @@ -4,10 +4,10 @@ import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; import { FirewallRule } from "../../models/models.js"; import { - firewallRulesGet, - firewallRulesCreateOrUpdate, - firewallRulesDelete, - firewallRulesListByMongoCluster, + get, + createOrUpdate, + $delete, + listByMongoCluster, } from "../../api/firewallRules/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PollerLike, OperationState } from "@azure/core-lro"; @@ -20,14 +20,12 @@ import { export interface FirewallRulesOperations { get: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams, ) => Promise; createOrUpdate: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, @@ -35,30 +33,30 @@ export interface FirewallRulesOperations { options?: FirewallRulesCreateOrUpdateOptionalParams, ) => PollerLike, void>; delete: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams, ) => PollerLike, void>; listByMongoCluster: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams, ) => PagedAsyncIterableIterator; } -export function getFirewallRules(context: DocumentDBContext) { +export function getFirewallRules( + context: DocumentDBContext, + subscriptionId: string, +) { return { get: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams, ) => - firewallRulesGet( + get( context, subscriptionId, resourceGroupName, @@ -67,14 +65,13 @@ export function getFirewallRules(context: DocumentDBContext) { options, ), createOrUpdate: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams, ) => - firewallRulesCreateOrUpdate( + createOrUpdate( context, subscriptionId, resourceGroupName, @@ -84,13 +81,12 @@ export function getFirewallRules(context: DocumentDBContext) { options, ), delete: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams, ) => - firewallRulesDelete( + $delete( context, subscriptionId, resourceGroupName, @@ -99,12 +95,11 @@ export function getFirewallRules(context: DocumentDBContext) { options, ), listByMongoCluster: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams, ) => - firewallRulesListByMongoCluster( + listByMongoCluster( context, subscriptionId, resourceGroupName, @@ -116,8 +111,9 @@ export function getFirewallRules(context: DocumentDBContext) { export function getFirewallRulesOperations( context: DocumentDBContext, + subscriptionId: string, ): FirewallRulesOperations { return { - ...getFirewallRules(context), + ...getFirewallRules(context, subscriptionId), }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts index 5626a597486b..68853a17d94e 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts @@ -10,14 +10,14 @@ import { CheckNameAvailabilityResponse, } from "../../models/models.js"; import { - mongoClustersGet, - mongoClustersCreateOrUpdate, - mongoClustersUpdate, - mongoClustersDelete, - mongoClustersListByResourceGroup, - mongoClustersList, - mongoClustersListConnectionStrings, - mongoClustersCheckNameAvailability, + get, + createOrUpdate, + update, + $delete, + listByResourceGroup, + list, + listConnectionStrings, + checkNameAvailability, } from "../../api/mongoClusters/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PollerLike, OperationState } from "@azure/core-lro"; @@ -34,63 +34,57 @@ import { export interface MongoClustersOperations { get: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams, ) => Promise; createOrUpdate: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams, ) => PollerLike, MongoCluster>; update: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams, ) => PollerLike, MongoCluster>; delete: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams, ) => PollerLike, void>; listByResourceGroup: ( - subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams, ) => PagedAsyncIterableIterator; list: ( - subscriptionId: string, options?: MongoClustersListOptionalParams, ) => PagedAsyncIterableIterator; listConnectionStrings: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams, ) => Promise; checkNameAvailability: ( - subscriptionId: string, location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams, ) => Promise; } -export function getMongoClusters(context: DocumentDBContext) { +export function getMongoClusters( + context: DocumentDBContext, + subscriptionId: string, +) { return { get: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams, ) => - mongoClustersGet( + get( context, subscriptionId, resourceGroupName, @@ -98,13 +92,12 @@ export function getMongoClusters(context: DocumentDBContext) { options, ), createOrUpdate: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams, ) => - mongoClustersCreateOrUpdate( + createOrUpdate( context, subscriptionId, resourceGroupName, @@ -113,13 +106,12 @@ export function getMongoClusters(context: DocumentDBContext) { options, ), update: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams, ) => - mongoClustersUpdate( + update( context, subscriptionId, resourceGroupName, @@ -128,12 +120,11 @@ export function getMongoClusters(context: DocumentDBContext) { options, ), delete: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams, ) => - mongoClustersDelete( + $delete( context, subscriptionId, resourceGroupName, @@ -141,25 +132,18 @@ export function getMongoClusters(context: DocumentDBContext) { options, ), listByResourceGroup: ( - subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams, ) => - mongoClustersListByResourceGroup( - context, - subscriptionId, - resourceGroupName, - options, - ), - list: (subscriptionId: string, options?: MongoClustersListOptionalParams) => - mongoClustersList(context, subscriptionId, options), + listByResourceGroup(context, subscriptionId, resourceGroupName, options), + list: (options?: MongoClustersListOptionalParams) => + list(context, subscriptionId, options), listConnectionStrings: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams, ) => - mongoClustersListConnectionStrings( + listConnectionStrings( context, subscriptionId, resourceGroupName, @@ -167,25 +151,19 @@ export function getMongoClusters(context: DocumentDBContext) { options, ), checkNameAvailability: ( - subscriptionId: string, location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams, ) => - mongoClustersCheckNameAvailability( - context, - subscriptionId, - location, - body, - options, - ), + checkNameAvailability(context, subscriptionId, location, body, options), }; } export function getMongoClustersOperations( context: DocumentDBContext, + subscriptionId: string, ): MongoClustersOperations { return { - ...getMongoClusters(context), + ...getMongoClusters(context, subscriptionId), }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts index c01e370891bf..41331cc0ca56 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts @@ -3,7 +3,7 @@ import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; import { Operation } from "../../models/models.js"; -import { operationsList } from "../../api/operations/index.js"; +import { list } from "../../api/operations/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { OperationsListOptionalParams } from "../../models/options.js"; @@ -15,8 +15,7 @@ export interface OperationsOperations { export function getOperations(context: DocumentDBContext) { return { - list: (options?: OperationsListOptionalParams) => - operationsList(context, options), + list: (options?: OperationsListOptionalParams) => list(context, options), }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts index 13662aacdd27..33984f3dbca5 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts @@ -4,10 +4,10 @@ import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; import { PrivateEndpointConnectionResource } from "../../models/models.js"; import { - privateEndpointConnectionsListByMongoCluster, - privateEndpointConnectionsGet, - privateEndpointConnectionsCreate, - privateEndpointConnectionsDelete, + listByMongoCluster, + get, + create, + $delete, } from "../../api/privateEndpointConnections/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PollerLike, OperationState } from "@azure/core-lro"; @@ -20,20 +20,17 @@ import { export interface PrivateEndpointConnectionsOperations { listByMongoCluster: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, ) => PagedAsyncIterableIterator; get: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams, ) => Promise; create: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, @@ -41,7 +38,6 @@ export interface PrivateEndpointConnectionsOperations { options?: PrivateEndpointConnectionsCreateOptionalParams, ) => PollerLike, void>; delete: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, @@ -49,15 +45,17 @@ export interface PrivateEndpointConnectionsOperations { ) => PollerLike, void>; } -export function getPrivateEndpointConnections(context: DocumentDBContext) { +export function getPrivateEndpointConnections( + context: DocumentDBContext, + subscriptionId: string, +) { return { listByMongoCluster: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, ) => - privateEndpointConnectionsListByMongoCluster( + listByMongoCluster( context, subscriptionId, resourceGroupName, @@ -65,13 +63,12 @@ export function getPrivateEndpointConnections(context: DocumentDBContext) { options, ), get: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams, ) => - privateEndpointConnectionsGet( + get( context, subscriptionId, resourceGroupName, @@ -80,14 +77,13 @@ export function getPrivateEndpointConnections(context: DocumentDBContext) { options, ), create: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams, ) => - privateEndpointConnectionsCreate( + create( context, subscriptionId, resourceGroupName, @@ -97,13 +93,12 @@ export function getPrivateEndpointConnections(context: DocumentDBContext) { options, ), delete: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams, ) => - privateEndpointConnectionsDelete( + $delete( context, subscriptionId, resourceGroupName, @@ -116,8 +111,9 @@ export function getPrivateEndpointConnections(context: DocumentDBContext) { export function getPrivateEndpointConnectionsOperations( context: DocumentDBContext, + subscriptionId: string, ): PrivateEndpointConnectionsOperations { return { - ...getPrivateEndpointConnections(context), + ...getPrivateEndpointConnections(context, subscriptionId), }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts index 20521771c679..5ba1f2c558fa 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts @@ -3,28 +3,29 @@ import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; import { PrivateLinkResource } from "../../models/models.js"; -import { privateLinksListByMongoCluster } from "../../api/privateLinks/index.js"; +import { listByMongoCluster } from "../../api/privateLinks/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PrivateLinksListByMongoClusterOptionalParams } from "../../models/options.js"; export interface PrivateLinksOperations { listByMongoCluster: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams, ) => PagedAsyncIterableIterator; } -export function getPrivateLinks(context: DocumentDBContext) { +export function getPrivateLinks( + context: DocumentDBContext, + subscriptionId: string, +) { return { listByMongoCluster: ( - subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams, ) => - privateLinksListByMongoCluster( + listByMongoCluster( context, subscriptionId, resourceGroupName, @@ -36,8 +37,9 @@ export function getPrivateLinks(context: DocumentDBContext) { export function getPrivateLinksOperations( context: DocumentDBContext, + subscriptionId: string, ): PrivateLinksOperations { return { - ...getPrivateLinks(context), + ...getPrivateLinks(context, subscriptionId), }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/helpers/serializerHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/helpers/serializerHelpers.ts new file mode 100644 index 000000000000..332381cdb695 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/src/helpers/serializerHelpers.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export function serializeRecord< + T extends string | number | boolean | Date | null, + R, +>(item: Record): Record; +export function serializeRecord( + item: Record, + serializer: (item: T) => R, +): Record; +export function serializeRecord( + item: Record, + serializer?: (item: T) => R, +): Record { + return Object.keys(item).reduce( + (acc, key) => { + if (isSupportedRecordType(item[key])) { + acc[key] = item[key] as any; + } else if (serializer) { + const value = item[key]; + if (value !== undefined) { + acc[key] = serializer(value); + } + } else { + console.warn(`Don't know how to serialize ${item[key]}`); + acc[key] = item[key] as any; + } + return acc; + }, + {} as Record, + ); +} + +function isSupportedRecordType(t: any) { + 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 d8e1321a655d..45663932cd23 100644 --- a/sdk/mongocluster/arm-mongocluster/src/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/index.ts @@ -7,52 +7,57 @@ export { } from "./mongoClusterManagementClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { - PrivateLinkResourceListResult, Resource, SystemData, CreatedByType, + KnownCreatedByType, ProxyResource, PrivateLinkResource, PrivateLinkResourceProperties, ErrorResponse, ErrorDetail, ErrorAdditionalInfo, - PrivateEndpointConnectionResourceListResult, PrivateEndpointConnectionResource, PrivateEndpointConnectionProperties, PrivateEndpoint, PrivateLinkServiceConnectionState, PrivateEndpointServiceConnectionStatus, - ResourceProvisioningState, - ArmOperationStatus, + KnownPrivateEndpointServiceConnectionStatus, + PrivateEndpointConnectionProvisioningState, + KnownPrivateEndpointConnectionProvisioningState, FirewallRule, FirewallRuleProperties, - FirewallRuleListResult, + ResourceProvisioningState, + KnownResourceProvisioningState, TrackedResource, MongoCluster, MongoClusterProperties, CreateMode, + KnownCreateMode, MongoClusterRestoreParameters, MongoClusterStatus, + KnownMongoClusterStatus, PublicNetworkAccess, + KnownPublicNetworkAccess, NodeGroupSpec, NodeKind, + KnownNodeKind, PrivateEndpointConnection, MongoClusterUpdate, MongoClusterUpdateProperties, - MongoClusterListResult, ListConnectionStringsResult, ConnectionString, CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, CheckNameAvailabilityReason, - PagedOperation, + KnownCheckNameAvailabilityReason, Operation, OperationDisplay, Origin, + KnownOrigin, ActionType, + KnownActionType, Versions, - PrivateEndpointConnectionProvisioningState, ProvisioningState, OperationsListOptionalParams, MongoClustersGetOptionalParams, diff --git a/sdk/mongocluster/arm-mongocluster/src/models/index.ts b/sdk/mongocluster/arm-mongocluster/src/models/index.ts index d22ec96f80d0..fb147a608cd4 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/index.ts @@ -2,52 +2,57 @@ // Licensed under the MIT license. export { - PrivateLinkResourceListResult, Resource, SystemData, CreatedByType, + KnownCreatedByType, ProxyResource, PrivateLinkResource, PrivateLinkResourceProperties, ErrorResponse, ErrorDetail, ErrorAdditionalInfo, - PrivateEndpointConnectionResourceListResult, PrivateEndpointConnectionResource, PrivateEndpointConnectionProperties, PrivateEndpoint, PrivateLinkServiceConnectionState, PrivateEndpointServiceConnectionStatus, - ResourceProvisioningState, - ArmOperationStatus, + KnownPrivateEndpointServiceConnectionStatus, + PrivateEndpointConnectionProvisioningState, + KnownPrivateEndpointConnectionProvisioningState, FirewallRule, FirewallRuleProperties, - FirewallRuleListResult, + ResourceProvisioningState, + KnownResourceProvisioningState, TrackedResource, MongoCluster, MongoClusterProperties, CreateMode, + KnownCreateMode, MongoClusterRestoreParameters, MongoClusterStatus, + KnownMongoClusterStatus, PublicNetworkAccess, + KnownPublicNetworkAccess, NodeGroupSpec, NodeKind, + KnownNodeKind, PrivateEndpointConnection, MongoClusterUpdate, MongoClusterUpdateProperties, - MongoClusterListResult, ListConnectionStringsResult, ConnectionString, CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, CheckNameAvailabilityReason, - PagedOperation, + KnownCheckNameAvailabilityReason, Operation, OperationDisplay, Origin, + KnownOrigin, ActionType, + KnownActionType, Versions, - PrivateEndpointConnectionProvisioningState, ProvisioningState, } from "./models.js"; export { diff --git a/sdk/mongocluster/arm-mongocluster/src/models/models.ts b/sdk/mongocluster/arm-mongocluster/src/models/models.ts index c987060c3109..d0e25ec95136 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/models.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/models.ts @@ -1,15 +1,32 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +import { serializeRecord } from "../helpers/serializerHelpers.js"; +import { + PrivateEndpointConnectionResource as PrivateEndpointConnectionResourceRest, + PrivateEndpointConnectionProperties as PrivateEndpointConnectionPropertiesRest, + PrivateLinkServiceConnectionState as PrivateLinkServiceConnectionStateRest, + FirewallRule as FirewallRuleRest, + FirewallRuleProperties as FirewallRulePropertiesRest, + TrackedResource as TrackedResourceRest, + MongoCluster as MongoClusterRest, + MongoClusterProperties as MongoClusterPropertiesRest, + MongoClusterRestoreParameters as MongoClusterRestoreParametersRest, + NodeGroupSpec as NodeGroupSpecRest, + MongoClusterUpdate as MongoClusterUpdateRest, + MongoClusterUpdateProperties as MongoClusterUpdatePropertiesRest, + CheckNameAvailabilityRequest as CheckNameAvailabilityRequestRest, +} from "../rest/index.js"; + /** The response of a PrivateLinkResource list operation. */ -export interface PrivateLinkResourceListResult { +export interface _PrivateLinkResourceListResult { /** The PrivateLinkResource items on this page */ value: PrivateLinkResource[]; /** The link to the next page of items */ nextLink?: string; } -/** Common properties for all Azure Resource Manager resources. */ +/** 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; @@ -21,29 +38,43 @@ export interface Resource { 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. */ - readonly createdBy?: string; + createdBy?: string; /** The type of identity that created the resource. */ - readonly createdByType?: CreatedByType; - /** The type of identity that created the resource. */ - readonly createdAt?: Date; + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; /** The identity that last modified the resource. */ - readonly lastModifiedBy?: string; + lastModifiedBy?: string; /** The type of identity that last modified the resource. */ - readonly lastModifiedByType?: CreatedByType; + lastModifiedByType?: CreatedByType; /** The timestamp of resource last modification (UTC) */ - readonly lastModifiedAt?: Date; + lastModifiedAt?: Date; } /** The kind of entity that created the resource. */ -/** "User", "Application", "ManagedIdentity", "Key" */ export type CreatedByType = string; -/** The base proxy resource. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key", +} + +/** 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; +} + /** 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. */ @@ -89,7 +120,7 @@ export interface ErrorAdditionalInfo { } /** The response of a PrivateEndpointConnectionResource list operation. */ -export interface PrivateEndpointConnectionResourceListResult { +export interface _PrivateEndpointConnectionResourceListResult { /** The PrivateEndpointConnectionResource items on this page */ value: PrivateEndpointConnectionResource[]; /** The link to the next page of items */ @@ -102,22 +133,50 @@ export interface PrivateEndpointConnectionResource extends ProxyResource { properties?: PrivateEndpointConnectionProperties; } -/** Properties of he private endpoint connection resource */ +export function privateEndpointConnectionResourceSerializer( + item: PrivateEndpointConnectionResource, +): PrivateEndpointConnectionResourceRest { + return { + properties: !item.properties + ? item.properties + : privateEndpointConnectionPropertiesSerializer(item.properties), + }; +} + +/** Properties of the private endpoint connection. */ export interface PrivateEndpointConnectionProperties { - /** The group identifiers for the private endpoint resource */ + /** The group ids for the private endpoint resource. */ readonly groupIds?: string[]; - /** The private endpoint resource */ + /** The private endpoint resource. */ privateEndpoint?: PrivateEndpoint; /** A collection of information about the state of the connection between service consumer and provider. */ privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; /** The provisioning state of the private endpoint connection resource. */ - provisioningState?: PrivateEndpointConnectionProvisioningState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +export function privateEndpointConnectionPropertiesSerializer( + item: PrivateEndpointConnectionProperties, +): PrivateEndpointConnectionPropertiesRest { + return { + privateEndpoint: !item.privateEndpoint + ? item.privateEndpoint + : privateEndpointSerializer(item.privateEndpoint), + privateLinkServiceConnectionState: + privateLinkServiceConnectionStateSerializer( + item.privateLinkServiceConnectionState, + ), + }; } -/** The private endpoint resource */ +/** The Private Endpoint resource. */ export interface PrivateEndpoint { /** The resource identifier for private endpoint */ - id?: string; + readonly id?: string; +} + +export function privateEndpointSerializer(item: PrivateEndpoint) { + return item as any; } /** A collection of information about the state of the connection between service consumer and provider. */ @@ -130,27 +189,33 @@ export interface PrivateLinkServiceConnectionState { actionsRequired?: string; } -/** The private endpoint connection status */ -/** "Pending", "Approved", "Rejected" */ +export function privateLinkServiceConnectionStateSerializer( + item: PrivateLinkServiceConnectionState, +): PrivateLinkServiceConnectionStateRest { + return { + status: item["status"], + description: item["description"], + actionsRequired: item["actionsRequired"], + }; +} + +/** The private endpoint connection status. */ export type PrivateEndpointServiceConnectionStatus = string; -/** The provisioning state of a resource type. */ -/** "Succeeded", "Failed", "Canceled" */ -export type ResourceProvisioningState = string; -/** Standard Azure Resource Manager operation status response */ -export interface ArmOperationStatus { - /** The operation status */ - status: ResourceProvisioningState; - /** The name of the operationStatus resource */ - readonly name?: string; - /** Operation start time */ - readonly startTime?: Date; - /** Operation complete time */ - readonly endTime?: Date; - /** The progress made toward completing the operation */ - readonly percentComplete?: number; - /** Errors that occurred if the operation ended with Canceled or Failed status */ - readonly error?: ErrorDetail; +export enum KnownPrivateEndpointServiceConnectionStatus { + Pending = "Pending", + Approved = "Approved", + Rejected = "Rejected", +} + +/** The current provisioning state. */ +export type PrivateEndpointConnectionProvisioningState = string; + +export enum KnownPrivateEndpointConnectionProvisioningState { + Succeeded = "Succeeded", + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", } /** Represents a mongo cluster firewall rule. */ @@ -159,6 +224,14 @@ export interface FirewallRule extends ProxyResource { properties?: FirewallRuleProperties; } +export function firewallRuleSerializer(item: FirewallRule): FirewallRuleRest { + return { + properties: !item.properties + ? item.properties + : firewallRulePropertiesSerializer(item.properties), + }; +} + /** The properties of a mongo cluster firewall rule. */ export interface FirewallRuleProperties { /** The provisioning state of the firewall rule. */ @@ -169,8 +242,26 @@ export interface FirewallRuleProperties { endIpAddress: string; } +export function firewallRulePropertiesSerializer( + item: FirewallRuleProperties, +): FirewallRulePropertiesRest { + return { + startIpAddress: item["startIpAddress"], + endIpAddress: item["endIpAddress"], + }; +} + +/** The provisioning state of a resource type. */ +export type ResourceProvisioningState = string; + +export enum KnownResourceProvisioningState { + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", +} + /** The response of a FirewallRule list operation. */ -export interface FirewallRuleListResult { +export interface _FirewallRuleListResult { /** The FirewallRule items on this page */ value: FirewallRule[]; /** The link to the next page of items */ @@ -179,10 +270,19 @@ export interface FirewallRuleListResult { /** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ export interface TrackedResource extends Resource { - /** The geo-location where the resource lives */ - location: string; /** Resource tags. */ tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer( + item: TrackedResource, +): TrackedResourceRest { + return { + tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), + location: item["location"], + }; } /** Represents a mongo cluster resource. */ @@ -191,6 +291,16 @@ export interface MongoCluster extends TrackedResource { properties?: MongoClusterProperties; } +export function mongoClusterSerializer(item: MongoCluster): MongoClusterRest { + return { + tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), + location: item["location"], + properties: !item.properties + ? item.properties + : mongoClusterPropertiesSerializer(item.properties), + }; +} + /** The properties of a mongo cluster. */ export interface MongoClusterProperties { /** The mode to create a mongo cluster. */ @@ -219,10 +329,33 @@ export interface MongoClusterProperties { readonly privateEndpointConnections?: PrivateEndpointConnection[]; } +export function mongoClusterPropertiesSerializer( + item: MongoClusterProperties, +): MongoClusterPropertiesRest { + return { + createMode: item["createMode"], + restoreParameters: !item.restoreParameters + ? item.restoreParameters + : mongoClusterRestoreParametersSerializer(item.restoreParameters), + administratorLogin: item["administratorLogin"], + administratorLoginPassword: item["administratorLoginPassword"], + serverVersion: item["serverVersion"], + publicNetworkAccess: item["publicNetworkAccess"], + nodeGroupSpecs: + item["nodeGroupSpecs"] === undefined + ? item["nodeGroupSpecs"] + : item["nodeGroupSpecs"].map(nodeGroupSpecSerializer), + }; +} + /** The mode that the Mongo Cluster is created with. */ -/** "Default", "PointInTimeRestore" */ export type CreateMode = string; +export enum KnownCreateMode { + Default = "Default", + PointInTimeRestore = "PointInTimeRestore", +} + /** Parameters used for restore operations */ export interface MongoClusterRestoreParameters { /** UTC point in time to restore a mongo cluster */ @@ -231,13 +364,36 @@ export interface MongoClusterRestoreParameters { sourceResourceId?: string; } +export function mongoClusterRestoreParametersSerializer( + item: MongoClusterRestoreParameters, +): MongoClusterRestoreParametersRest { + return { + pointInTimeUTC: item["pointInTimeUTC"]?.toISOString(), + sourceResourceId: item["sourceResourceId"], + }; +} + /** The status of the Mongo cluster resource. */ -/** "Ready", "Provisioning", "Updating", "Starting", "Stopping", "Stopped", "Dropping" */ export type MongoClusterStatus = string; + +export enum KnownMongoClusterStatus { + Ready = "Ready", + Provisioning = "Provisioning", + Updating = "Updating", + Starting = "Starting", + Stopping = "Stopping", + Stopped = "Stopped", + Dropping = "Dropping", +} + /** Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is 'Enabled' */ -/** "Enabled", "Disabled" */ export type PublicNetworkAccess = string; +export enum KnownPublicNetworkAccess { + Enabled = "Enabled", + Disabled = "Disabled", +} + /** Specification for a node group. */ export interface NodeGroupSpec { /** The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. */ @@ -252,12 +408,27 @@ export interface NodeGroupSpec { nodeCount?: number; } +export function nodeGroupSpecSerializer( + item: NodeGroupSpec, +): NodeGroupSpecRest { + return { + sku: item["sku"], + diskSizeGB: item["diskSizeGB"], + enableHa: item["enableHa"], + kind: item["kind"], + nodeCount: item["nodeCount"], + }; +} + /** The kind of the node on the cluster. */ -/** "Shard" */ export type NodeKind = string; +export enum KnownNodeKind { + Shard = "Shard", +} + /** The private endpoint connection resource */ -export interface PrivateEndpointConnection extends ProxyResource { +export interface PrivateEndpointConnection extends Resource { /** The private endpoint connection properties */ properties?: PrivateEndpointConnectionProperties; } @@ -269,6 +440,17 @@ export interface MongoClusterUpdate { properties?: MongoClusterUpdateProperties; } +export function mongoClusterUpdateSerializer( + item: MongoClusterUpdate, +): MongoClusterUpdateRest { + return { + tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), + properties: !item.properties + ? item.properties + : mongoClusterUpdatePropertiesSerializer(item.properties), + }; +} + /** The updatable properties of the MongoCluster. */ export interface MongoClusterUpdateProperties { /** The administrator's login for the mongo cluster. */ @@ -283,8 +465,23 @@ export interface MongoClusterUpdateProperties { nodeGroupSpecs?: NodeGroupSpec[]; } +export function mongoClusterUpdatePropertiesSerializer( + item: MongoClusterUpdateProperties, +): MongoClusterUpdatePropertiesRest { + return { + administratorLogin: item["administratorLogin"], + administratorLoginPassword: item["administratorLoginPassword"], + serverVersion: item["serverVersion"], + publicNetworkAccess: item["publicNetworkAccess"], + nodeGroupSpecs: + item["nodeGroupSpecs"] === undefined + ? item["nodeGroupSpecs"] + : item["nodeGroupSpecs"].map(nodeGroupSpecSerializer), + }; +} + /** The response of a MongoCluster list operation. */ -export interface MongoClusterListResult { +export interface _MongoClusterListResult { /** The MongoCluster items on this page */ value: MongoCluster[]; /** The link to the next page of items */ @@ -313,6 +510,15 @@ export interface CheckNameAvailabilityRequest { type?: string; } +export function checkNameAvailabilityRequestSerializer( + item: CheckNameAvailabilityRequest, +): CheckNameAvailabilityRequestRest { + return { + name: item["name"], + type: item["type"], + }; +} + /** The check availability result. */ export interface CheckNameAvailabilityResponse { /** Indicates if the resource name is available. */ @@ -324,11 +530,15 @@ export interface CheckNameAvailabilityResponse { } /** Possible reasons for a name not being available. */ -/** "Invalid", "AlreadyExists" */ export type CheckNameAvailabilityReason = string; +export enum KnownCheckNameAvailabilityReason { + Invalid = "Invalid", + AlreadyExists = "AlreadyExists", +} + /** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -export interface PagedOperation { +export interface _OperationListResult { /** The Operation items on this page */ value: Operation[]; /** The link to the next page of items */ @@ -362,19 +572,23 @@ export interface OperationDisplay { } /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ -/** "user", "system", "user,system" */ export type Origin = string; + +export enum KnownOrigin { + user = "user", + system = "system", + "user,system" = "user,system", +} + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ -/** "Internal" */ export type ActionType = string; + +export enum KnownActionType { + Internal = "Internal", +} + /** The available API versions. */ -/** */ export type Versions = "2024-03-01-preview"; -/** Alias for PrivateEndpointConnectionProvisioningState */ -export type PrivateEndpointConnectionProvisioningState = - | ResourceProvisioningState - | "Creating" - | "Deleting"; /** Alias for ProvisioningState */ export type ProvisioningState = | string diff --git a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts index f16dbe574694..02e55c5ebc5d 100644 --- a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts @@ -39,17 +39,25 @@ export class MongoClusterManagementClient { /** 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. */ constructor( credential: TokenCredential, + subscriptionId: string, options: MongoClusterManagementClientOptions = {}, ) { this._client = createMongoClusterManagement(credential, options); this.pipeline = this._client.pipeline; this.operations = getOperationsOperations(this._client); - this.mongoClusters = getMongoClustersOperations(this._client); - this.firewallRules = getFirewallRulesOperations(this._client); + this.mongoClusters = getMongoClustersOperations( + this._client, + subscriptionId, + ); + this.firewallRules = getFirewallRulesOperations( + this._client, + subscriptionId, + ); this.privateEndpointConnections = getPrivateEndpointConnectionsOperations( this._client, + subscriptionId, ); - this.privateLinks = getPrivateLinksOperations(this._client); + this.privateLinks = getPrivateLinksOperations(this._client, subscriptionId); } /** The operation groups for Operations */ diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts b/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts index 1bb10a682dfa..6853103b5134 100644 --- a/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts @@ -6,6 +6,12 @@ import { logger } from "../logger.js"; import { TokenCredential } from "@azure/core-auth"; import { DocumentDBContext } from "./clientDefinitions.js"; +/** The optional parameters for the client */ +export interface DocumentDBContextOptions extends ClientOptions { + /** The api version option of the client */ + apiVersion?: string; +} + /** * Initialize a new instance of `DocumentDBContext` * @param credentials - uniquely identify client credential @@ -13,11 +19,13 @@ import { DocumentDBContext } from "./clientDefinitions.js"; */ export default function createClient( credentials: TokenCredential, - options: ClientOptions = {}, + { + apiVersion = "2024-03-01-preview", + ...options + }: DocumentDBContextOptions = {}, ): DocumentDBContext { const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; - options.apiVersion = options.apiVersion ?? "2024-03-01-preview"; const userAgentInfo = `azsdk-js-arm-mongocluster-rest/1.0.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix @@ -35,12 +43,27 @@ export default function createClient( scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], }, }; - const client = getClient( endpointUrl, credentials, options, ) as DocumentDBContext; + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + client.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && apiVersion) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); return client; } diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/models.ts b/sdk/mongocluster/arm-mongocluster/src/rest/models.ts index 7567eb88a4af..cb9086ebbf51 100644 --- a/sdk/mongocluster/arm-mongocluster/src/rest/models.ts +++ b/sdk/mongocluster/arm-mongocluster/src/rest/models.ts @@ -48,26 +48,21 @@ export interface NodeGroupSpec { } /** The private endpoint connection resource */ -export interface PrivateEndpointConnection extends ProxyResource { +export interface PrivateEndpointConnection extends Resource { /** The private endpoint connection properties */ properties?: PrivateEndpointConnectionProperties; } -/** Properties of he private endpoint connection resource */ +/** Properties of the private endpoint connection. */ export interface PrivateEndpointConnectionProperties { - /** The private endpoint resource */ + /** The private endpoint resource. */ privateEndpoint?: PrivateEndpoint; /** A collection of information about the state of the connection between service consumer and provider. */ privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; - /** The provisioning state of the private endpoint connection resource. */ - provisioningState?: PrivateEndpointConnectionProvisioningState; } -/** The private endpoint resource */ -export interface PrivateEndpoint { - /** The resource identifier for private endpoint */ - id?: string; -} +/** The Private Endpoint resource. */ +export interface PrivateEndpoint {} /** A collection of information about the state of the connection between service consumer and provider. */ export interface PrivateLinkServiceConnectionState { @@ -79,40 +74,93 @@ export interface PrivateLinkServiceConnectionState { actionsRequired?: string; } -/** The base proxy resource. */ -export interface ProxyResource extends Resource {} - -/** Common properties for all Azure Resource Manager resources. */ +/** Common fields that are returned in the response for all Azure Resource Manager resources */ export interface Resource {} /** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData {} +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 | string; + /** 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 | 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 { - /** The geo-location where the resource lives */ - location: string; /** Resource tags. */ tags?: Record; + /** The geo-location where the resource lives */ + location: string; } -/** The base extension resource. */ -export interface ExtensionResource extends Resource {} +/** The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. */ +export interface ResourceModelWithAllowedPropertySet extends TrackedResource { + /** + * The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. + * If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + */ + managedBy?: string; + /** + * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. + * If supported, the resource provider must validate and persist this value. + */ + kind?: string; + /** + * The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. + * Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), + * If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + */ + eTag?: string; + identity?: Identity; + sku?: Sku; + plan?: Plan; +} -/** The resource model definition for an Azure Resource Manager resource with an etag. */ -export interface AzureEntityResource extends Resource {} +/** Identity for the resource. */ +export interface Identity { + /** The identity type. */ + type?: ResourceIdentityType; +} -export interface PrivateLinkResource extends ProxyResource { - /** Properties of the private link resource. */ - properties?: PrivateLinkResourceProperties; +/** The resource model definition representing SKU */ +export interface Sku { + /** The name of the SKU. Ex - P3. It is typically a letter+number code */ + name: string; + /** This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. */ + tier?: SkuTier; + /** The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. */ + size?: string; + /** If the service has different generations of hardware, for the same SKU, then that can be captured here. */ + family?: string; + /** If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. */ + capacity?: number; } -/** Properties of a private link resource. */ -export interface PrivateLinkResourceProperties { - /** The private link resource private link DNS zone name. */ - requiredZoneNames?: string[]; +/** Plan for the resource. */ +export interface Plan { + /** A user defined name of the 3rd Party Artifact that is being procured. */ + name: string; + /** The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic */ + publisher: string; + /** The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. */ + product: string; + /** A publisher provided promotion code as provisioned in Data Market for the said product/artifact. */ + promotionCode?: string; + /** The version of the desired product/artifact. */ + version?: 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 {} + /** Represents a mongo cluster firewall rule. */ export interface FirewallRule extends ProxyResource { /** The resource-specific properties for this resource. */ @@ -139,6 +187,24 @@ export interface PrivateLinkResource extends ProxyResource { properties?: PrivateLinkResourceProperties; } +/** Properties of a private link resource. */ +export interface PrivateLinkResourceProperties { + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; +} + +/** The base extension resource. */ +export interface ExtensionResource extends Resource {} + +/** The resource model definition for an Azure Resource Manager resource with an etag. */ +export interface AzureEntityResource extends Resource {} + +/** A private link resource. */ +export interface PrivateLinkResource extends Resource { + /** Resource properties. */ + properties?: PrivateLinkResourceProperties; +} + /** The type used for update operations of the MongoCluster. */ export interface MongoClusterUpdate { /** Resource tags. */ @@ -169,49 +235,24 @@ export interface CheckNameAvailabilityRequest { } /** Alias for CreateMode */ -export type CreateMode = string | "Default" | "PointInTimeRestore"; +export type CreateMode = string; /** Alias for ResourceProvisioningState */ -export type ResourceProvisioningState = - | "Succeeded" - | "Failed" - | "Canceled" - | string; +export type ResourceProvisioningState = string; /** Alias for ProvisioningState */ -export type ProvisioningState = - | string - | ResourceProvisioningState - | "InProgress" - | "Updating" - | "Dropping"; +export type ProvisioningState = string; /** Alias for MongoClusterStatus */ -export type MongoClusterStatus = - | string - | "Ready" - | "Provisioning" - | "Updating" - | "Starting" - | "Stopping" - | "Stopped" - | "Dropping"; +export type MongoClusterStatus = string; /** Alias for PublicNetworkAccess */ -export type PublicNetworkAccess = string | "Enabled" | "Disabled"; +export type PublicNetworkAccess = string; /** Alias for NodeKind */ -export type NodeKind = string | "Shard"; +export type NodeKind = string; /** Alias for PrivateEndpointServiceConnectionStatus */ -export type PrivateEndpointServiceConnectionStatus = - | "Pending" - | "Approved" - | "Rejected" - | string; +export type PrivateEndpointServiceConnectionStatus = string; /** Alias for PrivateEndpointConnectionProvisioningState */ -export type PrivateEndpointConnectionProvisioningState = - | ResourceProvisioningState - | "Creating" - | "Deleting"; +export type PrivateEndpointConnectionProvisioningState = string; /** Alias for CreatedByType */ -export type CreatedByType = - | "User" - | "Application" - | "ManagedIdentity" - | "Key" - | string; +export type CreatedByType = string; +/** Alias for ResourceIdentityType */ +export type ResourceIdentityType = "SystemAssigned"; +/** Alias for SkuTier */ +export type SkuTier = "Free" | "Basic" | "Standard" | "Premium"; diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/outputModels.ts b/sdk/mongocluster/arm-mongocluster/src/rest/outputModels.ts index 4e03f5c1a24f..0d906537b222 100644 --- a/sdk/mongocluster/arm-mongocluster/src/rest/outputModels.ts +++ b/sdk/mongocluster/arm-mongocluster/src/rest/outputModels.ts @@ -114,27 +114,27 @@ export interface NodeGroupSpecOutput { } /** The private endpoint connection resource */ -export interface PrivateEndpointConnectionOutput extends ProxyResourceOutput { +export interface PrivateEndpointConnectionOutput extends ResourceOutput { /** The private endpoint connection properties */ properties?: PrivateEndpointConnectionPropertiesOutput; } -/** Properties of he private endpoint connection resource */ +/** Properties of the private endpoint connection. */ export interface PrivateEndpointConnectionPropertiesOutput { - /** The group identifiers for the private endpoint resource */ + /** The group ids for the private endpoint resource. */ readonly groupIds?: string[]; - /** The private endpoint resource */ + /** The private endpoint resource. */ privateEndpoint?: PrivateEndpointOutput; /** A collection of information about the state of the connection between service consumer and provider. */ privateLinkServiceConnectionState: PrivateLinkServiceConnectionStateOutput; /** The provisioning state of the private endpoint connection resource. */ - provisioningState?: PrivateEndpointConnectionProvisioningStateOutput; + readonly provisioningState?: PrivateEndpointConnectionProvisioningStateOutput; } -/** The private endpoint resource */ +/** The Private Endpoint resource. */ export interface PrivateEndpointOutput { /** The resource identifier for private endpoint */ - id?: string; + readonly id?: string; } /** A collection of information about the state of the connection between service consumer and provider. */ @@ -147,10 +147,7 @@ export interface PrivateLinkServiceConnectionStateOutput { actionsRequired?: string; } -/** The base proxy resource. */ -export interface ProxyResourceOutput extends ResourceOutput {} - -/** Common properties for all Azure Resource Manager resources. */ +/** Common fields that are returned in the response for all Azure Resource Manager resources */ export interface ResourceOutput { /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ readonly id?: string; @@ -165,51 +162,92 @@ export interface ResourceOutput { /** Metadata pertaining to creation and last modification of the resource. */ export interface SystemDataOutput { /** The identity that created the resource. */ - readonly createdBy?: string; + createdBy?: string; /** The type of identity that created the resource. */ - readonly createdByType?: CreatedByTypeOutput; - /** The type of identity that created the resource. */ - readonly createdAt?: string; + createdByType?: CreatedByTypeOutput; + /** The timestamp of resource creation (UTC). */ + createdAt?: string; /** The identity that last modified the resource. */ - readonly lastModifiedBy?: string; + lastModifiedBy?: string; /** The type of identity that last modified the resource. */ - readonly lastModifiedByType?: CreatedByTypeOutput; + lastModifiedByType?: CreatedByTypeOutput; /** The timestamp of resource last modification (UTC) */ - readonly lastModifiedAt?: string; + lastModifiedAt?: string; } /** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ export interface TrackedResourceOutput extends ResourceOutput { - /** The geo-location where the resource lives */ - location: string; /** Resource tags. */ tags?: Record; + /** The geo-location where the resource lives */ + location: string; } -/** The base extension resource. */ -export interface ExtensionResourceOutput extends ResourceOutput {} +/** The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. */ +export interface ResourceModelWithAllowedPropertySetOutput + extends TrackedResourceOutput { + /** + * The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. + * If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + */ + managedBy?: string; + /** + * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. + * If supported, the resource provider must validate and persist this value. + */ + kind?: string; + /** + * The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. + * Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), + * If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + */ + eTag?: string; + identity?: IdentityOutput; + sku?: SkuOutput; + plan?: PlanOutput; +} -/** The resource model definition for an Azure Resource Manager resource with an etag. */ -export interface AzureEntityResourceOutput extends ResourceOutput { - /** Resource Etag. */ - readonly etag: string; +/** Identity for the resource. */ +export interface IdentityOutput { + /** The principal ID of resource identity. The value must be an UUID. */ + readonly principalId?: string; + /** The tenant ID of resource. The value must be an UUID. */ + readonly tenantId?: string; + /** The identity type. */ + type?: ResourceIdentityTypeOutput; } -export interface PrivateLinkResourceOutput extends ProxyResourceOutput { - /** Properties of the private link resource. */ - properties?: PrivateLinkResourcePropertiesOutput; +/** The resource model definition representing SKU */ +export interface SkuOutput { + /** The name of the SKU. Ex - P3. It is typically a letter+number code */ + name: string; + /** This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. */ + tier?: SkuTierOutput; + /** The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. */ + size?: string; + /** If the service has different generations of hardware, for the same SKU, then that can be captured here. */ + family?: string; + /** If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. */ + capacity?: number; } -/** Properties of a private link resource. */ -export interface PrivateLinkResourcePropertiesOutput { - /** The private link resource group id. */ - readonly groupId?: string; - /** The private link resource required member names. */ - readonly requiredMembers?: string[]; - /** The private link resource private link DNS zone name. */ - requiredZoneNames?: string[]; +/** Plan for the resource. */ +export interface PlanOutput { + /** A user defined name of the 3rd Party Artifact that is being procured. */ + name: string; + /** The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic */ + publisher: string; + /** The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. */ + product: string; + /** A publisher provided promotion code as provisioned in Data Market for the said product/artifact. */ + promotionCode?: string; + /** The version of the desired product/artifact. */ + version?: string; } +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResourceOutput extends ResourceOutput {} + /** Represents a mongo cluster firewall rule. */ export interface FirewallRuleOutput extends ProxyResourceOutput { /** The resource-specific properties for this resource. */ @@ -239,6 +277,31 @@ export interface PrivateLinkResourceOutput extends ProxyResourceOutput { properties?: PrivateLinkResourcePropertiesOutput; } +/** Properties of a private link resource. */ +export interface PrivateLinkResourcePropertiesOutput { + /** The private link resource group id. */ + readonly groupId?: string; + /** The private link resource required member names. */ + readonly requiredMembers?: string[]; + /** The private link resource private link DNS zone name. */ + requiredZoneNames?: string[]; +} + +/** The base extension resource. */ +export interface ExtensionResourceOutput extends ResourceOutput {} + +/** The resource model definition for an Azure Resource Manager resource with an etag. */ +export interface AzureEntityResourceOutput extends ResourceOutput { + /** Resource Etag. */ + readonly etag?: string; +} + +/** A private link resource. */ +export interface PrivateLinkResourceOutput extends ResourceOutput { + /** Resource properties. */ + properties?: PrivateLinkResourcePropertiesOutput; +} + /** The connection strings for the given mongo cluster. */ export interface ListConnectionStringsResultOutput { /** An array that contains the connection strings for a mongo cluster. */ @@ -264,65 +327,37 @@ export interface CheckNameAvailabilityResponseOutput { } /** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -export type PagedOperationOutput = Paged; +export type OperationListResultOutput = Paged; /** Alias for OriginOutput */ -export type OriginOutput = "user" | "system" | "user,system" | string; +export type OriginOutput = string; /** Alias for ActionTypeOutput */ -export type ActionTypeOutput = "Internal" | string; +export type ActionTypeOutput = string; /** Alias for CreateModeOutput */ -export type CreateModeOutput = string | "Default" | "PointInTimeRestore"; +export type CreateModeOutput = string; /** Alias for ResourceProvisioningStateOutput */ -export type ResourceProvisioningStateOutput = - | "Succeeded" - | "Failed" - | "Canceled" - | string; +export type ResourceProvisioningStateOutput = string; /** Alias for ProvisioningStateOutput */ -export type ProvisioningStateOutput = - | string - | ResourceProvisioningStateOutput - | "InProgress" - | "Updating" - | "Dropping"; +export type ProvisioningStateOutput = string; /** Alias for MongoClusterStatusOutput */ -export type MongoClusterStatusOutput = - | string - | "Ready" - | "Provisioning" - | "Updating" - | "Starting" - | "Stopping" - | "Stopped" - | "Dropping"; +export type MongoClusterStatusOutput = string; /** Alias for PublicNetworkAccessOutput */ -export type PublicNetworkAccessOutput = string | "Enabled" | "Disabled"; +export type PublicNetworkAccessOutput = string; /** Alias for NodeKindOutput */ -export type NodeKindOutput = string | "Shard"; +export type NodeKindOutput = string; /** Alias for PrivateEndpointServiceConnectionStatusOutput */ -export type PrivateEndpointServiceConnectionStatusOutput = - | "Pending" - | "Approved" - | "Rejected" - | string; +export type PrivateEndpointServiceConnectionStatusOutput = string; /** Alias for PrivateEndpointConnectionProvisioningStateOutput */ -export type PrivateEndpointConnectionProvisioningStateOutput = - | ResourceProvisioningStateOutput - | "Creating" - | "Deleting"; +export type PrivateEndpointConnectionProvisioningStateOutput = string; /** Alias for CreatedByTypeOutput */ -export type CreatedByTypeOutput = - | "User" - | "Application" - | "ManagedIdentity" - | "Key" - | string; +export type CreatedByTypeOutput = string; +/** Alias for ResourceIdentityTypeOutput */ +export type ResourceIdentityTypeOutput = "SystemAssigned"; +/** Alias for SkuTierOutput */ +export type SkuTierOutput = "Free" | "Basic" | "Standard" | "Premium"; /** The response of a MongoCluster list operation. */ export type MongoClusterListResultOutput = Paged; /** Alias for CheckNameAvailabilityReasonOutput */ -export type CheckNameAvailabilityReasonOutput = - | "Invalid" - | "AlreadyExists" - | string; +export type CheckNameAvailabilityReasonOutput = string; /** The response of a FirewallRule list operation. */ export type FirewallRuleListResultOutput = Paged; /** The response of a PrivateEndpointConnectionResource list operation. */ diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/responses.ts b/sdk/mongocluster/arm-mongocluster/src/rest/responses.ts index a734fc537de1..22b99527b618 100644 --- a/sdk/mongocluster/arm-mongocluster/src/rest/responses.ts +++ b/sdk/mongocluster/arm-mongocluster/src/rest/responses.ts @@ -4,7 +4,7 @@ import { RawHttpHeaders } from "@azure/core-rest-pipeline"; import { HttpResponse } from "@azure-rest/core-client"; import { - PagedOperationOutput, + OperationListResultOutput, ErrorResponseOutput, MongoClusterOutput, MongoClusterListResultOutput, @@ -20,7 +20,7 @@ import { /** Azure operation completed successfully. */ export interface OperationsList200Response extends HttpResponse { status: "200"; - body: PagedOperationOutput; + body: OperationListResultOutput; } export interface OperationsListDefaultResponse extends HttpResponse { diff --git a/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts index 8db3303286f2..81a8f25156b1 100644 --- a/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts +++ b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts @@ -7,21 +7,20 @@ import { deserializeState, ResourceLocationConfig, } from "@azure/core-lro"; -import { DocumentDBContext } from "./api/mongoClusterManagementContext.js"; import { MongoClusterManagementClient } from "./mongoClusterManagementClient.js"; import { getLongRunningPoller } from "./api/pollingHelpers.js"; import { - _mongoClustersCreateOrUpdateDeserialize, - _mongoClustersUpdateDeserialize, - _mongoClustersDeleteDeserialize, + _createOrUpdateDeserialize, + _updateDeserialize, + _$deleteDeserialize, } from "./api/mongoClusters/index.js"; import { - _firewallRulesCreateOrUpdateDeserialize, - _firewallRulesDeleteDeserialize, + _createOrUpdateDeserialize as _createOrUpdateDeserializeFirewallRules, + _$deleteDeserialize as _$deleteDeserializeFirewallRules, } from "./api/firewallRules/index.js"; import { - _privateEndpointConnectionsCreateDeserialize, - _privateEndpointConnectionsDeleteDeserialize, + _createDeserialize, + _$deleteDeserialize as _$deleteDeserializePrivateEndpointConnections, } from "./api/privateEndpointConnections/index.js"; import { PathUncheckedResponse, @@ -49,7 +48,7 @@ export interface RestorePollerOptions< * needs to be constructed after the original one is not in scope. */ export function restorePoller( - client: DocumentDBContext | MongoClusterManagementClient, + client: MongoClusterManagementClient, serializedState: string, sourceOperation: ( ...args: any[] @@ -89,19 +88,19 @@ export function restorePoller( const deserializeMap: Record = { "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": - _mongoClustersCreateOrUpdateDeserialize, + _createOrUpdateDeserialize, "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": - _mongoClustersUpdateDeserialize, + _updateDeserialize, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": - _mongoClustersDeleteDeserialize, + _$deleteDeserialize, "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}": - _firewallRulesCreateOrUpdateDeserialize, + _createOrUpdateDeserializeFirewallRules, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}": - _firewallRulesDeleteDeserialize, + _$deleteDeserializeFirewallRules, "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}": - _privateEndpointConnectionsCreateDeserialize, + _createDeserialize, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}": - _privateEndpointConnectionsDeleteDeserialize, + _$deleteDeserializePrivateEndpointConnections, }; function getDeserializationHelper( diff --git a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts index 3695e0e33c7b..982f9885b24b 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts @@ -34,9 +34,9 @@ describe("MongoCluster test", () => { subscriptionId = env.SUBSCRIPTION_ID || ''; // This is an example of how the environment variables are used const credential = createTestCredential(); - client = new MongoClusterManagementClient(credential, recorder.configureClientOptions({})); + client = new MongoClusterManagementClient(credential, subscriptionId, recorder.configureClientOptions({})); location = "eastus"; - resourceGroup = "czwjstest"; + resourceGroup = "myjstest"; resourcename = "resourcetest"; }); @@ -49,7 +49,6 @@ describe("MongoCluster test", () => { it("mongoClusters create test", async function () { const res = await client.mongoClusters.createOrUpdate( - subscriptionId, resourceGroup, resourcename, { @@ -73,9 +72,8 @@ describe("MongoCluster test", () => { assert.equal(res.name, resourcename); }); - it.only("firerules create test", async function () { + it("firerules create test", async function () { const res = await client.firewallRules.createOrUpdate( - subscriptionId, resourceGroup, resourcename, "testfilerule", @@ -92,7 +90,6 @@ describe("MongoCluster test", () => { it("mongoClusters get test", async function () { const res = await client.mongoClusters.get( - subscriptionId, resourceGroup, resourcename ); @@ -101,7 +98,7 @@ describe("MongoCluster test", () => { it("mongoClusters list test", async function () { const resArray = new Array(); - for await (let item of client.mongoClusters.listByResourceGroup(subscriptionId, resourceGroup)) { + for await (let item of client.mongoClusters.listByResourceGroup(resourceGroup)) { resArray.push(item); } assert.equal(resArray.length, 1); @@ -109,7 +106,6 @@ describe("MongoCluster test", () => { it("mongoClusters update test", async function () { const res = await client.mongoClusters.update( - subscriptionId, resourceGroup, resourcename, { @@ -121,9 +117,9 @@ describe("MongoCluster test", () => { it("mongoClusters delete test", async function () { const resArray = new Array(); - const res = await client.mongoClusters.delete(subscriptionId, resourceGroup, resourcename + const res = await client.mongoClusters.delete(resourceGroup, resourcename ) - for await (let item of client.mongoClusters.listByResourceGroup(subscriptionId, resourceGroup)) { + for await (let item of client.mongoClusters.listByResourceGroup(resourceGroup)) { resArray.push(item); } assert.equal(resArray.length, 0); From 90af18e6b29b234aed6b81f5661dce864df770ce Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:31:50 +0800 Subject: [PATCH 06/23] update --- .../src/api/firewallRules/index.ts | 35 ++++++++++-- .../api/privateEndpointConnections/index.ts | 57 +++++++++++++++++-- .../src/classic/firewallRules/index.ts | 2 +- .../privateEndpointConnections/index.ts | 5 +- 4 files changed, 89 insertions(+), 10 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts index 57bf17336c06..6491514b692d 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts @@ -157,13 +157,40 @@ export async function _createOrUpdateDeserialize( | FirewallRulesCreateOrUpdate202Response | FirewallRulesCreateOrUpdateDefaultResponse | FirewallRulesCreateOrUpdateLogicalResponse, -): Promise { +): Promise { if (isUnexpected(result)) { throw createRestError(result); } result = result as FirewallRulesCreateOrUpdateLogicalResponse; - return; + 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"], + }, + }; } /** Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. */ @@ -175,7 +202,7 @@ export function createOrUpdate( firewallRuleName: string, resource: FirewallRule, options: FirewallRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, -): PollerLike, void> { +): PollerLike, FirewallRule> { return getLongRunningPoller(context, _createOrUpdateDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, @@ -189,7 +216,7 @@ export function createOrUpdate( resource, options, ), - }) as PollerLike, void>; + }) as PollerLike, FirewallRule>; } export function _$deleteSend( diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts index 543a2758275b..bedeec197622 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts @@ -278,13 +278,56 @@ export async function _createDeserialize( | PrivateEndpointConnectionsCreate202Response | PrivateEndpointConnectionsCreateDefaultResponse | PrivateEndpointConnectionsCreateLogicalResponse, -): Promise { +): Promise { if (isUnexpected(result)) { throw createRestError(result); } result = result as PrivateEndpointConnectionsCreateLogicalResponse; - return; + 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"], + }, + }; } /** Create a Private endpoint connection */ @@ -298,7 +341,10 @@ export function create( options: PrivateEndpointConnectionsCreateOptionalParams = { requestOptions: {}, }, -): PollerLike, void> { +): PollerLike< + OperationState, + PrivateEndpointConnectionResource +> { return getLongRunningPoller(context, _createDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, @@ -312,7 +358,10 @@ export function create( resource, options, ), - }) as PollerLike, void>; + }) as PollerLike< + OperationState, + PrivateEndpointConnectionResource + >; } export function _$deleteSend( diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts index b8507d8950b2..2ec4598dde99 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts @@ -31,7 +31,7 @@ export interface FirewallRulesOperations { firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams, - ) => PollerLike, void>; + ) => PollerLike, FirewallRule>; delete: ( resourceGroupName: string, mongoClusterName: string, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts index 33984f3dbca5..7e67c5eec0cb 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts @@ -36,7 +36,10 @@ export interface PrivateEndpointConnectionsOperations { privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams, - ) => PollerLike, void>; + ) => PollerLike< + OperationState, + PrivateEndpointConnectionResource + >; delete: ( resourceGroupName: string, mongoClusterName: string, From 4348ca25b234a96efff9d93511ca524723922899 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:53:28 +0800 Subject: [PATCH 07/23] update --- .../review/arm-mongocluster-api-firewallRules.api.md | 4 ++-- .../arm-mongocluster-api-privateEndpointConnections.api.md | 4 ++-- .../arm-mongocluster/review/arm-mongocluster.api.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md index 56271314d5bb..f200f5221888 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md @@ -24,10 +24,10 @@ export function _$deleteDeserialize(result: FirewallRulesDelete202Response | Fir export function _$deleteSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): StreamableMethod; // @public -export function createOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): PollerLike, void>; +export function createOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): PollerLike, FirewallRule_2>; // @public (undocumented) -export function _createOrUpdateDeserialize(result: FirewallRulesCreateOrUpdate200Response | FirewallRulesCreateOrUpdate201Response | FirewallRulesCreateOrUpdate202Response | FirewallRulesCreateOrUpdateDefaultResponse | FirewallRulesCreateOrUpdateLogicalResponse): Promise; +export function _createOrUpdateDeserialize(result: FirewallRulesCreateOrUpdate200Response | FirewallRulesCreateOrUpdate201Response | FirewallRulesCreateOrUpdate202Response | FirewallRulesCreateOrUpdateDefaultResponse | FirewallRulesCreateOrUpdateLogicalResponse): Promise; // @public (undocumented) export function _createOrUpdateSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): StreamableMethod; diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md index 3f5cd7cb173e..a4fa34e136c9 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md @@ -24,10 +24,10 @@ export function _$deleteDeserialize(result: PrivateEndpointConnectionsDelete202R export function _$deleteSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): StreamableMethod; // @public -export function create(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, void>; +export function create(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, PrivateEndpointConnectionResource_2>; // @public (undocumented) -export function _createDeserialize(result: PrivateEndpointConnectionsCreate200Response | PrivateEndpointConnectionsCreate201Response | PrivateEndpointConnectionsCreate202Response | PrivateEndpointConnectionsCreateDefaultResponse | PrivateEndpointConnectionsCreateLogicalResponse): Promise; +export function _createDeserialize(result: PrivateEndpointConnectionsCreate200Response | PrivateEndpointConnectionsCreate201Response | PrivateEndpointConnectionsCreate202Response | PrivateEndpointConnectionsCreateDefaultResponse | PrivateEndpointConnectionsCreateLogicalResponse): Promise; // @public (undocumented) export function _createSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): StreamableMethod; diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md index cbc32ebb9f47..df71e1caf7f0 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md @@ -102,7 +102,7 @@ export interface FirewallRulesListByMongoClusterOptionalParams extends Operation // @public (undocumented) export interface FirewallRulesOperations { // (undocumented) - createOrUpdate: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, void>; + createOrUpdate: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, FirewallRule>; // (undocumented) delete: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => PollerLike, void>; // (undocumented) @@ -442,7 +442,7 @@ export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams exte // @public (undocumented) export interface PrivateEndpointConnectionsOperations { // (undocumented) - create: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams) => PollerLike, void>; + create: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams) => PollerLike, PrivateEndpointConnectionResource>; // (undocumented) delete: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, void>; // (undocumented) From 7954cc1e50ca1275867e2d675f41d79757c03f15 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:27:54 +0800 Subject: [PATCH 08/23] regen with script --- .../arm-mongocluster/.tshy/browser.json | 12 - .../arm-mongocluster/.tshy/build.json | 9 - .../arm-mongocluster/.tshy/commonjs.json | 14 - .../arm-mongocluster/.tshy/esm.json | 12 - .../arm-mongocluster/.tshy/react-native.json | 12 - .../arm-mongocluster/CHANGELOG.md | 5 - sdk/mongocluster/arm-mongocluster/LICENSE | 21 - sdk/mongocluster/arm-mongocluster/_meta.json | 8 - sdk/mongocluster/arm-mongocluster/assets.json | 6 - .../arm-mongocluster/package.json | 188 +----- .../review/arm-mongo-cluster.api.md | 538 ------------------ .../arm-mongocluster-api-firewallRules.api.md | 55 -- .../arm-mongocluster-api-mongoClusters.api.md | 91 --- .../arm-mongocluster-api-operations.api.md | 26 - ...ster-api-privateEndpointConnections.api.md | 55 -- .../arm-mongocluster-api-privateLinks.api.md | 26 - .../review/arm-mongocluster-api.api.md | 31 - .../review/arm-mongocluster-models.api.md | 449 --------------- .../review/arm-mongocluster.api.md | 538 ------------------ .../arm-mongocluster/rollup.config.js | 118 ---- sdk/mongocluster/arm-mongocluster/sample.env | 4 - ...agementContext.ts => documentDBContext.ts} | 7 +- .../src/api/firewallRules/index.ts | 96 ++-- .../arm-mongocluster/src/api/index.ts | 30 +- .../src/api/mongoClusters/index.ts | 327 ++++++----- .../src/api/operations/index.ts | 21 +- .../api/privateEndpointConnections/index.ts | 154 ++--- .../src/api/privateLinks/index.ts | 17 +- .../src/classic/firewallRules/index.ts | 23 +- .../src/classic/mongoClusters/index.ts | 54 +- .../src/classic/operations/index.ts | 9 +- .../privateEndpointConnections/index.ts | 23 +- .../src/classic/privateLinks/index.ts | 8 +- ...anagementClient.ts => documentDBClient.ts} | 12 +- .../arm-mongocluster/src/index.ts | 17 +- .../arm-mongocluster/src/models/index.ts | 11 - .../arm-mongocluster/src/models/models.ts | 105 +--- .../arm-mongocluster/src/models/options.ts | 18 + .../src/restorePollerHelpers.ts | 32 +- .../test/public/sampleTest.spec.ts | 21 + .../test/public/utils/recordedClient.ts | 26 +- .../arm-mongocluster/tsp-location.yaml | 3 + .../arm-mongocluster/vitest.browser.config.ts | 1 - .../arm-mongocluster/vitest.config.ts | 1 - 44 files changed, 577 insertions(+), 2657 deletions(-) delete mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/browser.json delete mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/build.json delete mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json delete mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/esm.json delete mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/react-native.json delete mode 100644 sdk/mongocluster/arm-mongocluster/CHANGELOG.md delete mode 100644 sdk/mongocluster/arm-mongocluster/LICENSE delete mode 100644 sdk/mongocluster/arm-mongocluster/_meta.json delete mode 100644 sdk/mongocluster/arm-mongocluster/assets.json delete mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongo-cluster.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-mongoClusters.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-operations.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateLinks.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/rollup.config.js delete mode 100644 sdk/mongocluster/arm-mongocluster/sample.env rename sdk/mongocluster/arm-mongocluster/src/api/{mongoClusterManagementContext.ts => documentDBContext.ts} (80%) rename sdk/mongocluster/arm-mongocluster/src/{mongoClusterManagementClient.ts => documentDBClient.ts} (87%) create mode 100644 sdk/mongocluster/arm-mongocluster/test/public/sampleTest.spec.ts create mode 100644 sdk/mongocluster/arm-mongocluster/tsp-location.yaml diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/browser.json b/sdk/mongocluster/arm-mongocluster/.tshy/browser.json deleted file mode 100644 index 32e74e04ec62..000000000000 --- a/sdk/mongocluster/arm-mongocluster/.tshy/browser.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "./build.json", - "include": [ - "../src/**/*.ts", - "../src/**/*.mts", - "../src/**/*.tsx" - ], - "exclude": [], - "compilerOptions": { - "outDir": "../.tshy-build/browser" - } -} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/build.json b/sdk/mongocluster/arm-mongocluster/.tshy/build.json deleted file mode 100644 index c51b7f53052c..000000000000 --- a/sdk/mongocluster/arm-mongocluster/.tshy/build.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "rootDir": "../src", - "target": "es2022", - "module": "nodenext", - "moduleResolution": "nodenext" - } -} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json b/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json deleted file mode 100644 index 5ace94d041f3..000000000000 --- a/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "./build.json", - "include": [ - "../src/**/*.ts", - "../src/**/*.cts", - "../src/**/*.tsx" - ], - "exclude": [ - "../src/**/*.mts" - ], - "compilerOptions": { - "outDir": "../.tshy-build/commonjs" - } -} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/esm.json b/sdk/mongocluster/arm-mongocluster/.tshy/esm.json deleted file mode 100644 index ff5264e692d1..000000000000 --- a/sdk/mongocluster/arm-mongocluster/.tshy/esm.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "./build.json", - "include": [ - "../src/**/*.ts", - "../src/**/*.mts", - "../src/**/*.tsx" - ], - "exclude": [], - "compilerOptions": { - "outDir": "../.tshy-build/esm" - } -} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json b/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json deleted file mode 100644 index f431a06985d8..000000000000 --- a/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "./build.json", - "include": [ - "../src/**/*.ts", - "../src/**/*.mts", - "../src/**/*.tsx" - ], - "exclude": [], - "compilerOptions": { - "outDir": "../.tshy-build/react-native" - } -} diff --git a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md deleted file mode 100644 index 59b2689760ec..000000000000 --- a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release History - -## 1.0.0-beta.1 (2024-06-06) - -The package of @azure/arm-mongocluster is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/mongocluster/arm-mongocluster/LICENSE b/sdk/mongocluster/arm-mongocluster/LICENSE deleted file mode 100644 index 7d5934740965..000000000000 --- a/sdk/mongocluster/arm-mongocluster/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2024 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/_meta.json b/sdk/mongocluster/arm-mongocluster/_meta.json deleted file mode 100644 index 9f1c6141ae95..000000000000 --- a/sdk/mongocluster/arm-mongocluster/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "f98d676317c7ff430241ce16ba8d99142be3581d", - "readme": "specification/mongocluster/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\mongocluster\\resource-manager\\readme.md --use=@autorest/typescript@6.0.23 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.9", - "use": "@autorest/typescript@6.0.23" -} \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/assets.json b/sdk/mongocluster/arm-mongocluster/assets.json deleted file mode 100644 index 5c6202b15f7f..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_04a66e31c1" -} diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index 9fd146bbdf24..e173200bed68 100644 --- a/sdk/mongocluster/arm-mongocluster/package.json +++ b/sdk/mongocluster/arm-mongocluster/package.json @@ -12,40 +12,17 @@ "./package.json": "./package.json", ".": "./src/index.ts", "./api": "./src/api/index.ts", - "./models": "./src/models/index.ts", - "./api/operations": "./src/api/operations/index.ts", - "./api/mongoClusters": "./src/api/mongoClusters/index.ts", - "./api/firewallRules": "./src/api/firewallRules/index.ts", - "./api/privateEndpointConnections": "./src/api/privateEndpointConnections/index.ts", - "./api/privateLinks": "./src/api/privateLinks/index.ts" + "./models": "./src/models/index.ts" }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], + "dialects": ["esm", "commonjs"], + "esmDialects": ["browser", "react-native"], "selfLink": false }, "type": "module", - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], "author": "Microsoft Corporation", "license": "MIT", - "files": [ - "dist", - "README.md", - "LICENSE", - "review/*" - ], + "files": ["dist", "README.md", "LICENSE", "review/*"], "sdk-type": "client", "repository": "github:Azure/azure-sdk-for-js", "bugs": { @@ -61,12 +38,12 @@ ] }, "dependencies": { - "@azure-rest/core-client": "^2.0.0", + "@azure-rest/core-client": "^2.1.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", "tslib": "^2.6.2", - "@azure/core-lro": "3.0.0-beta.2", + "@azure/core-lro": "3.0.0", "@azure/abort-controller": "^2.1.2", "@azure/core-paging": "^1.5.0" }, @@ -115,154 +92,5 @@ "build": "npm run clean && tshy && mkdirp ./review && dev-tool run extract-api", "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", "test": "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test" - }, - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "react-native": { - "types": "./dist/react-native/index.d.ts", - "default": "./dist/react-native/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - }, - "./api": { - "browser": { - "types": "./dist/browser/api/index.d.ts", - "default": "./dist/browser/api/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/index.d.ts", - "default": "./dist/react-native/api/index.js" - }, - "import": { - "types": "./dist/esm/api/index.d.ts", - "default": "./dist/esm/api/index.js" - }, - "require": { - "types": "./dist/commonjs/api/index.d.ts", - "default": "./dist/commonjs/api/index.js" - } - }, - "./models": { - "browser": { - "types": "./dist/browser/models/index.d.ts", - "default": "./dist/browser/models/index.js" - }, - "react-native": { - "types": "./dist/react-native/models/index.d.ts", - "default": "./dist/react-native/models/index.js" - }, - "import": { - "types": "./dist/esm/models/index.d.ts", - "default": "./dist/esm/models/index.js" - }, - "require": { - "types": "./dist/commonjs/models/index.d.ts", - "default": "./dist/commonjs/models/index.js" - } - }, - "./api/operations": { - "browser": { - "types": "./dist/browser/api/operations/index.d.ts", - "default": "./dist/browser/api/operations/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/operations/index.d.ts", - "default": "./dist/react-native/api/operations/index.js" - }, - "import": { - "types": "./dist/esm/api/operations/index.d.ts", - "default": "./dist/esm/api/operations/index.js" - }, - "require": { - "types": "./dist/commonjs/api/operations/index.d.ts", - "default": "./dist/commonjs/api/operations/index.js" - } - }, - "./api/mongoClusters": { - "browser": { - "types": "./dist/browser/api/mongoClusters/index.d.ts", - "default": "./dist/browser/api/mongoClusters/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/mongoClusters/index.d.ts", - "default": "./dist/react-native/api/mongoClusters/index.js" - }, - "import": { - "types": "./dist/esm/api/mongoClusters/index.d.ts", - "default": "./dist/esm/api/mongoClusters/index.js" - }, - "require": { - "types": "./dist/commonjs/api/mongoClusters/index.d.ts", - "default": "./dist/commonjs/api/mongoClusters/index.js" - } - }, - "./api/firewallRules": { - "browser": { - "types": "./dist/browser/api/firewallRules/index.d.ts", - "default": "./dist/browser/api/firewallRules/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/firewallRules/index.d.ts", - "default": "./dist/react-native/api/firewallRules/index.js" - }, - "import": { - "types": "./dist/esm/api/firewallRules/index.d.ts", - "default": "./dist/esm/api/firewallRules/index.js" - }, - "require": { - "types": "./dist/commonjs/api/firewallRules/index.d.ts", - "default": "./dist/commonjs/api/firewallRules/index.js" - } - }, - "./api/privateEndpointConnections": { - "browser": { - "types": "./dist/browser/api/privateEndpointConnections/index.d.ts", - "default": "./dist/browser/api/privateEndpointConnections/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/privateEndpointConnections/index.d.ts", - "default": "./dist/react-native/api/privateEndpointConnections/index.js" - }, - "import": { - "types": "./dist/esm/api/privateEndpointConnections/index.d.ts", - "default": "./dist/esm/api/privateEndpointConnections/index.js" - }, - "require": { - "types": "./dist/commonjs/api/privateEndpointConnections/index.d.ts", - "default": "./dist/commonjs/api/privateEndpointConnections/index.js" - } - }, - "./api/privateLinks": { - "browser": { - "types": "./dist/browser/api/privateLinks/index.d.ts", - "default": "./dist/browser/api/privateLinks/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/privateLinks/index.d.ts", - "default": "./dist/react-native/api/privateLinks/index.js" - }, - "import": { - "types": "./dist/esm/api/privateLinks/index.d.ts", - "default": "./dist/esm/api/privateLinks/index.js" - }, - "require": { - "types": "./dist/commonjs/api/privateLinks/index.d.ts", - "default": "./dist/commonjs/api/privateLinks/index.js" - } - } - }, - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts" + } } diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongo-cluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongo-cluster.api.md deleted file mode 100644 index 097249b1d107..000000000000 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongo-cluster.api.md +++ /dev/null @@ -1,538 +0,0 @@ -## API Report File for "@azure/arm-mongo-cluster" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { AbortSignalLike } from '@azure/abort-controller'; -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { OperationState } from '@azure/core-lro'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { PollerLike } from '@azure/core-lro'; -import { TokenCredential } from '@azure/core-auth'; - -// @public -export type ActionType = string; - -// @public -export type CheckNameAvailabilityReason = string; - -// @public -export interface CheckNameAvailabilityRequest { - name?: string; - type?: string; -} - -// @public -export interface CheckNameAvailabilityResponse { - message?: string; - nameAvailable?: boolean; - reason?: CheckNameAvailabilityReason; -} - -// @public -export interface ConnectionString { - readonly connectionString?: string; - readonly description?: string; -} - -// @public -export type ContinuablePage = TPage & { - continuationToken?: string; -}; - -// @public -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; -} - -// @public -export interface FirewallRuleProperties { - endIpAddress: string; - readonly provisioningState?: ProvisioningState; - startIpAddress: string; -} - -// @public (undocumented) -export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface FirewallRulesDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface FirewallRulesGetOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface FirewallRulesOperations { - // (undocumented) - createOrUpdate: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, void>; - // (undocumented) - delete: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => PollerLike, void>; - // (undocumented) - get: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams) => Promise; - // (undocumented) - listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; -} - -// @public (undocumented) -export enum KnownActionType { - // (undocumented) - Internal = "Internal" -} - -// @public (undocumented) -export enum KnownCheckNameAvailabilityReason { - // (undocumented) - AlreadyExists = "AlreadyExists", - // (undocumented) - Invalid = "Invalid" -} - -// @public (undocumented) -export enum KnownCreatedByType { - // (undocumented) - Application = "Application", - // (undocumented) - Key = "Key", - // (undocumented) - ManagedIdentity = "ManagedIdentity", - // (undocumented) - User = "User" -} - -// @public (undocumented) -export enum KnownCreateMode { - // (undocumented) - Default = "Default", - // (undocumented) - PointInTimeRestore = "PointInTimeRestore" -} - -// @public (undocumented) -export enum KnownMongoClusterStatus { - // (undocumented) - Dropping = "Dropping", - // (undocumented) - Provisioning = "Provisioning", - // (undocumented) - Ready = "Ready", - // (undocumented) - Starting = "Starting", - // (undocumented) - Stopped = "Stopped", - // (undocumented) - Stopping = "Stopping", - // (undocumented) - Updating = "Updating" -} - -// @public (undocumented) -export enum KnownNodeKind { - // (undocumented) - Shard = "Shard" -} - -// @public (undocumented) -export enum KnownOrigin { - // (undocumented) - "user,system" = "user,system", - // (undocumented) - system = "system", - // (undocumented) - user = "user" -} - -// @public (undocumented) -export enum KnownPrivateEndpointConnectionProvisioningState { - // (undocumented) - Creating = "Creating", - // (undocumented) - Deleting = "Deleting", - // (undocumented) - Failed = "Failed", - // (undocumented) - Succeeded = "Succeeded" -} - -// @public (undocumented) -export enum KnownPrivateEndpointServiceConnectionStatus { - // (undocumented) - Approved = "Approved", - // (undocumented) - Pending = "Pending", - // (undocumented) - Rejected = "Rejected" -} - -// @public (undocumented) -export enum KnownPublicNetworkAccess { - // (undocumented) - Disabled = "Disabled", - // (undocumented) - Enabled = "Enabled" -} - -// @public (undocumented) -export enum KnownResourceProvisioningState { - // (undocumented) - Canceled = "Canceled", - // (undocumented) - Failed = "Failed", - // (undocumented) - Succeeded = "Succeeded" -} - -// @public -export interface ListConnectionStringsResult { - readonly connectionStrings?: ConnectionString[]; -} - -// @public -export interface MongoCluster extends TrackedResource { - properties?: MongoClusterProperties; -} - -// @public (undocumented) -export class MongoClusterManagementClient { - constructor(credential: TokenCredential, subscriptionId: string, options?: MongoClusterManagementClientOptions); - readonly firewallRules: FirewallRulesOperations; - readonly mongoClusters: MongoClustersOperations; - readonly operations: OperationsOperations; - readonly pipeline: Pipeline; - readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; - readonly privateLinks: PrivateLinksOperations; -} - -// @public (undocumented) -export interface MongoClusterManagementClientOptions extends ClientOptions { - apiVersion?: string; -} - -// @public -export interface MongoClusterProperties { - administratorLogin?: string; - administratorLoginPassword?: string; - readonly clusterStatus?: MongoClusterStatus; - readonly connectionString?: string; - createMode?: CreateMode; - readonly earliestRestoreTime?: string; - nodeGroupSpecs?: NodeGroupSpec[]; - readonly privateEndpointConnections?: PrivateEndpointConnection[]; - readonly provisioningState?: ProvisioningState; - publicNetworkAccess?: PublicNetworkAccess; - restoreParameters?: MongoClusterRestoreParameters; - serverVersion?: string; -} - -// @public -export interface MongoClusterRestoreParameters { - pointInTimeUTC?: Date; - sourceResourceId?: string; -} - -// @public (undocumented) -export interface MongoClustersCheckNameAvailabilityOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface MongoClustersDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface MongoClustersGetOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersListByResourceGroupOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersListConnectionStringsOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersListOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersOperations { - // (undocumented) - checkNameAvailability: (location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams) => Promise; - // (undocumented) - createOrUpdate: (resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams) => PollerLike, MongoCluster>; - // (undocumented) - delete: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams) => PollerLike, void>; - // (undocumented) - get: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams) => Promise; - // (undocumented) - list: (options?: MongoClustersListOptionalParams) => PagedAsyncIterableIterator; - // (undocumented) - listByResourceGroup: (resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; - // (undocumented) - listConnectionStrings: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams) => Promise; - // (undocumented) - update: (resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams) => PollerLike, MongoCluster>; -} - -// @public -export type MongoClusterStatus = string; - -// @public (undocumented) -export interface MongoClustersUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface MongoClusterUpdate { - // (undocumented) - properties?: MongoClusterUpdateProperties; - tags?: Record; -} - -// @public -export interface MongoClusterUpdateProperties { - administratorLogin?: string; - administratorLoginPassword?: string; - nodeGroupSpecs?: NodeGroupSpec[]; - publicNetworkAccess?: PublicNetworkAccess; - serverVersion?: string; -} - -// @public -export interface NodeGroupSpec { - diskSizeGB?: number; - enableHa?: boolean; - kind?: NodeKind; - nodeCount?: number; - sku?: string; -} - -// @public -export type NodeKind = string; - -// @public -export interface Operation { - actionType?: ActionType; - display?: OperationDisplay; - readonly isDataAction?: boolean; - readonly name?: string; - readonly origin?: Origin; -} - -// @public -export interface OperationDisplay { - description?: string; - operation?: string; - provider?: string; - resource?: string; -} - -// @public (undocumented) -export interface OperationsListOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface OperationsOperations { - // (undocumented) - list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; -} - -// @public -export type Origin = string; - -// @public -export interface PagedAsyncIterableIterator { - [Symbol.asyncIterator](): PagedAsyncIterableIterator; - byPage: (settings?: TPageSettings) => AsyncIterableIterator>; - next(): Promise>; -} - -// @public -export interface PageSettings { - continuationToken?: string; -} - -// @public -export interface PrivateEndpoint { - readonly id?: string; -} - -// @public -export interface PrivateEndpointConnection extends Resource { - properties?: PrivateEndpointConnectionProperties; -} - -// @public -export interface PrivateEndpointConnectionProperties { - readonly groupIds?: string[]; - privateEndpoint?: PrivateEndpoint; - privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; - readonly provisioningState?: PrivateEndpointConnectionProvisioningState; -} - -// @public -export type PrivateEndpointConnectionProvisioningState = string; - -// @public -export interface PrivateEndpointConnectionResource extends ProxyResource { - properties?: PrivateEndpointConnectionProperties; -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsOperations { - // (undocumented) - create: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams) => PollerLike, void>; - // (undocumented) - delete: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, void>; - // (undocumented) - get: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams) => Promise; - // (undocumented) - listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; -} - -// @public -export type PrivateEndpointServiceConnectionStatus = string; - -// @public -export interface PrivateLinkResource extends ProxyResource { - properties?: PrivateLinkResourceProperties; -} - -// @public -export interface PrivateLinkResourceProperties { - readonly groupId?: string; - readonly requiredMembers?: string[]; - requiredZoneNames?: string[]; -} - -// @public -export interface PrivateLinkServiceConnectionState { - actionsRequired?: string; - description?: string; - status?: PrivateEndpointServiceConnectionStatus; -} - -// @public (undocumented) -export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface PrivateLinksOperations { - // (undocumented) - listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; -} - -// @public -export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; - -// @public -export interface ProxyResource extends Resource { -} - -// @public -export type PublicNetworkAccess = string; - -// @public -export interface Resource { - readonly id?: string; - readonly name?: string; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public -export type ResourceProvisioningState = string; - -// @public -export function restorePoller(client: MongoClusterManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; - -// @public (undocumented) -export interface RestorePollerOptions extends OperationOptions { - abortSignal?: AbortSignalLike; - processResponseBody?: (result: TResponse) => Promise; - updateIntervalInMs?: number; -} - -// @public -export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; -} - -// @public -export interface TrackedResource extends Resource { - location: string; - tags?: Record; -} - -// @public -export type Versions = "2024-03-01-preview"; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md deleted file mode 100644 index f200f5221888..000000000000 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-firewallRules.api.md +++ /dev/null @@ -1,55 +0,0 @@ -## API Report File for "@azure/arm-mongocluster" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { Client } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { OperationState } from '@azure/core-lro'; -import { Paged } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; - -// @public -export function $delete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): PollerLike, void>; - -// @public (undocumented) -export function _$deleteDeserialize(result: FirewallRulesDelete202Response | FirewallRulesDelete204Response | FirewallRulesDeleteDefaultResponse | FirewallRulesDeleteLogicalResponse): Promise; - -// @public (undocumented) -export function _$deleteSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): StreamableMethod; - -// @public -export function createOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): PollerLike, FirewallRule_2>; - -// @public (undocumented) -export function _createOrUpdateDeserialize(result: FirewallRulesCreateOrUpdate200Response | FirewallRulesCreateOrUpdate201Response | FirewallRulesCreateOrUpdate202Response | FirewallRulesCreateOrUpdateDefaultResponse | FirewallRulesCreateOrUpdateLogicalResponse): Promise; - -// @public (undocumented) -export function _createOrUpdateSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): StreamableMethod; - -// @public -export function get(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; - -// @public (undocumented) -export function _getDeserialize(result: FirewallRulesGet200Response | FirewallRulesGetDefaultResponse): Promise; - -// @public (undocumented) -export function _getSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): StreamableMethod; - -// @public -export function listByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; - -// @public (undocumented) -export function _listByMongoClusterDeserialize(result: FirewallRulesListByMongoCluster200Response | FirewallRulesListByMongoClusterDefaultResponse): Promise<_FirewallRuleListResult>; - -// @public (undocumented) -export function _listByMongoClusterSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): StreamableMethod; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-mongoClusters.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-mongoClusters.api.md deleted file mode 100644 index 5e32356e6c9e..000000000000 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-mongoClusters.api.md +++ /dev/null @@ -1,91 +0,0 @@ -## API Report File for "@azure/arm-mongocluster" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { Client } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { OperationState } from '@azure/core-lro'; -import { Paged } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; - -// @public -export function $delete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): PollerLike, void>; - -// @public (undocumented) -export function _$deleteDeserialize(result: MongoClustersDelete202Response | MongoClustersDelete204Response | MongoClustersDeleteDefaultResponse | MongoClustersDeleteLogicalResponse): Promise; - -// @public (undocumented) -export function _$deleteSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): StreamableMethod; - -// @public -export function checkNameAvailability(context: DocumentDBContext, subscriptionId: string, location: string, body: CheckNameAvailabilityRequest_2, options?: MongoClustersCheckNameAvailabilityOptionalParams): Promise; - -// @public (undocumented) -export function _checkNameAvailabilityDeserialize(result: MongoClustersCheckNameAvailability200Response | MongoClustersCheckNameAvailabilityDefaultResponse): Promise; - -// @public (undocumented) -export function _checkNameAvailabilitySend(context: DocumentDBContext, subscriptionId: string, location: string, body: CheckNameAvailabilityRequest_2, options?: MongoClustersCheckNameAvailabilityOptionalParams): StreamableMethod; - -// @public -export function createOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster_2, options?: MongoClustersCreateOrUpdateOptionalParams): PollerLike, MongoCluster_2>; - -// @public (undocumented) -export function _createOrUpdateDeserialize(result: MongoClustersCreateOrUpdate200Response | MongoClustersCreateOrUpdate201Response | MongoClustersCreateOrUpdateDefaultResponse | MongoClustersCreateOrUpdateLogicalResponse): Promise; - -// @public (undocumented) -export function _createOrUpdateSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster_2, options?: MongoClustersCreateOrUpdateOptionalParams): StreamableMethod; - -// @public -export function get(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): Promise; - -// @public (undocumented) -export function _getDeserialize(result: MongoClustersGet200Response | MongoClustersGetDefaultResponse): Promise; - -// @public (undocumented) -export function _getSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): StreamableMethod; - -// @public -export function list(context: DocumentDBContext, subscriptionId: string, options?: MongoClustersListOptionalParams): PagedAsyncIterableIterator; - -// @public -export function listByResourceGroup(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - -// @public (undocumented) -export function _listByResourceGroupDeserialize(result: MongoClustersListByResourceGroup200Response | MongoClustersListByResourceGroupDefaultResponse): Promise<_MongoClusterListResult>; - -// @public (undocumented) -export function _listByResourceGroupSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): StreamableMethod; - -// @public -export function listConnectionStrings(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): Promise; - -// @public (undocumented) -export function _listConnectionStringsDeserialize(result: MongoClustersListConnectionStrings200Response | MongoClustersListConnectionStringsDefaultResponse): Promise; - -// @public (undocumented) -export function _listConnectionStringsSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): StreamableMethod; - -// @public (undocumented) -export function _listDeserialize(result: MongoClustersList200Response | MongoClustersListDefaultResponse): Promise<_MongoClusterListResult>; - -// @public (undocumented) -export function _listSend(context: DocumentDBContext, subscriptionId: string, options?: MongoClustersListOptionalParams): StreamableMethod; - -// @public -export function update(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate_2, options?: MongoClustersUpdateOptionalParams): PollerLike, MongoCluster_2>; - -// @public (undocumented) -export function _updateDeserialize(result: MongoClustersUpdate200Response | MongoClustersUpdate202Response | MongoClustersUpdateDefaultResponse | MongoClustersUpdateLogicalResponse): Promise; - -// @public (undocumented) -export function _updateSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate_2, options?: MongoClustersUpdateOptionalParams): StreamableMethod; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-operations.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-operations.api.md deleted file mode 100644 index c6d36bde3d95..000000000000 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-operations.api.md +++ /dev/null @@ -1,26 +0,0 @@ -## API Report File for "@azure/arm-mongocluster" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { Client } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Paged } from '@azure/core-paging'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; - -// @public -export function list(context: DocumentDBContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; - -// @public (undocumented) -export function _listDeserialize(result: OperationsList200Response | OperationsListDefaultResponse): Promise<_OperationListResult>; - -// @public (undocumented) -export function _listSend(context: DocumentDBContext, options?: OperationsListOptionalParams): StreamableMethod; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md deleted file mode 100644 index a4fa34e136c9..000000000000 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateEndpointConnections.api.md +++ /dev/null @@ -1,55 +0,0 @@ -## API Report File for "@azure/arm-mongocluster" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { Client } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { OperationState } from '@azure/core-lro'; -import { Paged } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; - -// @public -export function $delete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): PollerLike, void>; - -// @public (undocumented) -export function _$deleteDeserialize(result: PrivateEndpointConnectionsDelete202Response | PrivateEndpointConnectionsDelete204Response | PrivateEndpointConnectionsDeleteDefaultResponse | PrivateEndpointConnectionsDeleteLogicalResponse): Promise; - -// @public (undocumented) -export function _$deleteSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): StreamableMethod; - -// @public -export function create(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, PrivateEndpointConnectionResource_2>; - -// @public (undocumented) -export function _createDeserialize(result: PrivateEndpointConnectionsCreate200Response | PrivateEndpointConnectionsCreate201Response | PrivateEndpointConnectionsCreate202Response | PrivateEndpointConnectionsCreateDefaultResponse | PrivateEndpointConnectionsCreateLogicalResponse): Promise; - -// @public (undocumented) -export function _createSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): StreamableMethod; - -// @public -export function get(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; - -// @public (undocumented) -export function _getDeserialize(result: PrivateEndpointConnectionsGet200Response | PrivateEndpointConnectionsGetDefaultResponse): Promise; - -// @public (undocumented) -export function _getSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): StreamableMethod; - -// @public -export function listByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): PagedAsyncIterableIterator; - -// @public (undocumented) -export function _listByMongoClusterDeserialize(result: PrivateEndpointConnectionsListByMongoCluster200Response | PrivateEndpointConnectionsListByMongoClusterDefaultResponse): Promise<_PrivateEndpointConnectionResourceListResult>; - -// @public (undocumented) -export function _listByMongoClusterSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): StreamableMethod; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateLinks.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateLinks.api.md deleted file mode 100644 index b412225b8fa8..000000000000 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api-privateLinks.api.md +++ /dev/null @@ -1,26 +0,0 @@ -## API Report File for "@azure/arm-mongocluster" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { Client } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Paged } from '@azure/core-paging'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; - -// @public -export function listByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): PagedAsyncIterableIterator; - -// @public (undocumented) -export function _listByMongoClusterDeserialize(result: PrivateLinksListByMongoCluster200Response | PrivateLinksListByMongoClusterDefaultResponse): Promise<_PrivateLinkResourceListResult>; - -// @public (undocumented) -export function _listByMongoClusterSend(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): StreamableMethod; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md deleted file mode 100644 index 168aa800c9a8..000000000000 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md +++ /dev/null @@ -1,31 +0,0 @@ -## API Report File for "@azure/arm-mongocluster" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { Client } from '@azure-rest/core-client'; -import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { Paged } from '@azure/core-paging'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; -import { TokenCredential } from '@azure/core-auth'; - -// @public -export function createMongoClusterManagement(credential: TokenCredential, options?: MongoClusterManagementClientOptions): DocumentDBContext; - -// @public (undocumented) -export type DocumentDBContext = Client & { - path: Routes; -}; - -// @public (undocumented) -export interface MongoClusterManagementClientOptions extends ClientOptions { - apiVersion?: string; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md deleted file mode 100644 index 1742e398e914..000000000000 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md +++ /dev/null @@ -1,449 +0,0 @@ -## API Report File for "@azure/arm-mongocluster" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { OperationOptions } from '@azure-rest/core-client'; - -// @public -export type ActionType = string; - -// @public -export type CheckNameAvailabilityReason = string; - -// @public -export interface CheckNameAvailabilityRequest { - name?: string; - type?: string; -} - -// @public -export interface CheckNameAvailabilityResponse { - message?: string; - nameAvailable?: boolean; - reason?: CheckNameAvailabilityReason; -} - -// @public -export interface ConnectionString { - readonly connectionString?: string; - readonly description?: string; -} - -// @public -export type ContinuablePage = TPage & { - continuationToken?: string; -}; - -// @public -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; -} - -// @public -export interface FirewallRuleProperties { - endIpAddress: string; - readonly provisioningState?: ProvisioningState; - startIpAddress: string; -} - -// @public (undocumented) -export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface FirewallRulesDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface FirewallRulesGetOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export enum KnownActionType { - // (undocumented) - Internal = "Internal" -} - -// @public (undocumented) -export enum KnownCheckNameAvailabilityReason { - // (undocumented) - AlreadyExists = "AlreadyExists", - // (undocumented) - Invalid = "Invalid" -} - -// @public (undocumented) -export enum KnownCreatedByType { - // (undocumented) - Application = "Application", - // (undocumented) - Key = "Key", - // (undocumented) - ManagedIdentity = "ManagedIdentity", - // (undocumented) - User = "User" -} - -// @public (undocumented) -export enum KnownCreateMode { - // (undocumented) - Default = "Default", - // (undocumented) - PointInTimeRestore = "PointInTimeRestore" -} - -// @public (undocumented) -export enum KnownMongoClusterStatus { - // (undocumented) - Dropping = "Dropping", - // (undocumented) - Provisioning = "Provisioning", - // (undocumented) - Ready = "Ready", - // (undocumented) - Starting = "Starting", - // (undocumented) - Stopped = "Stopped", - // (undocumented) - Stopping = "Stopping", - // (undocumented) - Updating = "Updating" -} - -// @public (undocumented) -export enum KnownNodeKind { - // (undocumented) - Shard = "Shard" -} - -// @public (undocumented) -export enum KnownOrigin { - // (undocumented) - "user,system" = "user,system", - // (undocumented) - system = "system", - // (undocumented) - user = "user" -} - -// @public (undocumented) -export enum KnownPrivateEndpointConnectionProvisioningState { - // (undocumented) - Creating = "Creating", - // (undocumented) - Deleting = "Deleting", - // (undocumented) - Failed = "Failed", - // (undocumented) - Succeeded = "Succeeded" -} - -// @public (undocumented) -export enum KnownPrivateEndpointServiceConnectionStatus { - // (undocumented) - Approved = "Approved", - // (undocumented) - Pending = "Pending", - // (undocumented) - Rejected = "Rejected" -} - -// @public (undocumented) -export enum KnownPublicNetworkAccess { - // (undocumented) - Disabled = "Disabled", - // (undocumented) - Enabled = "Enabled" -} - -// @public (undocumented) -export enum KnownResourceProvisioningState { - // (undocumented) - Canceled = "Canceled", - // (undocumented) - Failed = "Failed", - // (undocumented) - Succeeded = "Succeeded" -} - -// @public -export interface ListConnectionStringsResult { - readonly connectionStrings?: ConnectionString[]; -} - -// @public -export interface MongoCluster extends TrackedResource { - properties?: MongoClusterProperties; -} - -// @public -export interface MongoClusterProperties { - administratorLogin?: string; - administratorLoginPassword?: string; - readonly clusterStatus?: MongoClusterStatus; - readonly connectionString?: string; - createMode?: CreateMode; - readonly earliestRestoreTime?: string; - nodeGroupSpecs?: NodeGroupSpec[]; - readonly privateEndpointConnections?: PrivateEndpointConnection[]; - readonly provisioningState?: ProvisioningState; - publicNetworkAccess?: PublicNetworkAccess; - restoreParameters?: MongoClusterRestoreParameters; - serverVersion?: string; -} - -// @public -export interface MongoClusterRestoreParameters { - pointInTimeUTC?: Date; - sourceResourceId?: string; -} - -// @public (undocumented) -export interface MongoClustersCheckNameAvailabilityOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface MongoClustersDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface MongoClustersGetOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersListByResourceGroupOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersListConnectionStringsOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersListOptionalParams extends OperationOptions { -} - -// @public -export type MongoClusterStatus = string; - -// @public (undocumented) -export interface MongoClustersUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface MongoClusterUpdate { - // (undocumented) - properties?: MongoClusterUpdateProperties; - tags?: Record; -} - -// @public -export interface MongoClusterUpdateProperties { - administratorLogin?: string; - administratorLoginPassword?: string; - nodeGroupSpecs?: NodeGroupSpec[]; - publicNetworkAccess?: PublicNetworkAccess; - serverVersion?: string; -} - -// @public -export interface NodeGroupSpec { - diskSizeGB?: number; - enableHa?: boolean; - kind?: NodeKind; - nodeCount?: number; - sku?: string; -} - -// @public -export type NodeKind = string; - -// @public -export interface Operation { - actionType?: ActionType; - display?: OperationDisplay; - readonly isDataAction?: boolean; - readonly name?: string; - readonly origin?: Origin; -} - -// @public -export interface OperationDisplay { - description?: string; - operation?: string; - provider?: string; - resource?: string; -} - -// @public (undocumented) -export interface OperationsListOptionalParams extends OperationOptions { -} - -// @public -export type Origin = string; - -// @public -export interface PagedAsyncIterableIterator { - [Symbol.asyncIterator](): PagedAsyncIterableIterator; - byPage: (settings?: TPageSettings) => AsyncIterableIterator>; - next(): Promise>; -} - -// @public -export interface PageSettings { - continuationToken?: string; -} - -// @public -export interface PrivateEndpoint { - readonly id?: string; -} - -// @public -export interface PrivateEndpointConnection extends Resource { - properties?: PrivateEndpointConnectionProperties; -} - -// @public -export interface PrivateEndpointConnectionProperties { - readonly groupIds?: string[]; - privateEndpoint?: PrivateEndpoint; - privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; - readonly provisioningState?: PrivateEndpointConnectionProvisioningState; -} - -// @public -export type PrivateEndpointConnectionProvisioningState = string; - -// @public -export interface PrivateEndpointConnectionResource extends ProxyResource { - properties?: PrivateEndpointConnectionProperties; -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends OperationOptions { -} - -// @public -export type PrivateEndpointServiceConnectionStatus = string; - -// @public -export interface PrivateLinkResource extends ProxyResource { - properties?: PrivateLinkResourceProperties; -} - -// @public -export interface PrivateLinkResourceProperties { - readonly groupId?: string; - readonly requiredMembers?: string[]; - requiredZoneNames?: string[]; -} - -// @public -export interface PrivateLinkServiceConnectionState { - actionsRequired?: string; - description?: string; - status?: PrivateEndpointServiceConnectionStatus; -} - -// @public (undocumented) -export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions { -} - -// @public -export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; - -// @public -export interface ProxyResource extends Resource { -} - -// @public -export type PublicNetworkAccess = string; - -// @public -export interface Resource { - readonly id?: string; - readonly name?: string; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public -export type ResourceProvisioningState = string; - -// @public -export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; -} - -// @public -export interface TrackedResource extends Resource { - location: string; - tags?: Record; -} - -// @public -export type Versions = "2024-03-01-preview"; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md deleted file mode 100644 index df71e1caf7f0..000000000000 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md +++ /dev/null @@ -1,538 +0,0 @@ -## API Report File for "@azure/arm-mongocluster" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { AbortSignalLike } from '@azure/abort-controller'; -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { OperationState } from '@azure/core-lro'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { PollerLike } from '@azure/core-lro'; -import { TokenCredential } from '@azure/core-auth'; - -// @public -export type ActionType = string; - -// @public -export type CheckNameAvailabilityReason = string; - -// @public -export interface CheckNameAvailabilityRequest { - name?: string; - type?: string; -} - -// @public -export interface CheckNameAvailabilityResponse { - message?: string; - nameAvailable?: boolean; - reason?: CheckNameAvailabilityReason; -} - -// @public -export interface ConnectionString { - readonly connectionString?: string; - readonly description?: string; -} - -// @public -export type ContinuablePage = TPage & { - continuationToken?: string; -}; - -// @public -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; -} - -// @public -export interface FirewallRuleProperties { - endIpAddress: string; - readonly provisioningState?: ProvisioningState; - startIpAddress: string; -} - -// @public (undocumented) -export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface FirewallRulesDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface FirewallRulesGetOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface FirewallRulesOperations { - // (undocumented) - createOrUpdate: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, FirewallRule>; - // (undocumented) - delete: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => PollerLike, void>; - // (undocumented) - get: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams) => Promise; - // (undocumented) - listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; -} - -// @public (undocumented) -export enum KnownActionType { - // (undocumented) - Internal = "Internal" -} - -// @public (undocumented) -export enum KnownCheckNameAvailabilityReason { - // (undocumented) - AlreadyExists = "AlreadyExists", - // (undocumented) - Invalid = "Invalid" -} - -// @public (undocumented) -export enum KnownCreatedByType { - // (undocumented) - Application = "Application", - // (undocumented) - Key = "Key", - // (undocumented) - ManagedIdentity = "ManagedIdentity", - // (undocumented) - User = "User" -} - -// @public (undocumented) -export enum KnownCreateMode { - // (undocumented) - Default = "Default", - // (undocumented) - PointInTimeRestore = "PointInTimeRestore" -} - -// @public (undocumented) -export enum KnownMongoClusterStatus { - // (undocumented) - Dropping = "Dropping", - // (undocumented) - Provisioning = "Provisioning", - // (undocumented) - Ready = "Ready", - // (undocumented) - Starting = "Starting", - // (undocumented) - Stopped = "Stopped", - // (undocumented) - Stopping = "Stopping", - // (undocumented) - Updating = "Updating" -} - -// @public (undocumented) -export enum KnownNodeKind { - // (undocumented) - Shard = "Shard" -} - -// @public (undocumented) -export enum KnownOrigin { - // (undocumented) - "user,system" = "user,system", - // (undocumented) - system = "system", - // (undocumented) - user = "user" -} - -// @public (undocumented) -export enum KnownPrivateEndpointConnectionProvisioningState { - // (undocumented) - Creating = "Creating", - // (undocumented) - Deleting = "Deleting", - // (undocumented) - Failed = "Failed", - // (undocumented) - Succeeded = "Succeeded" -} - -// @public (undocumented) -export enum KnownPrivateEndpointServiceConnectionStatus { - // (undocumented) - Approved = "Approved", - // (undocumented) - Pending = "Pending", - // (undocumented) - Rejected = "Rejected" -} - -// @public (undocumented) -export enum KnownPublicNetworkAccess { - // (undocumented) - Disabled = "Disabled", - // (undocumented) - Enabled = "Enabled" -} - -// @public (undocumented) -export enum KnownResourceProvisioningState { - // (undocumented) - Canceled = "Canceled", - // (undocumented) - Failed = "Failed", - // (undocumented) - Succeeded = "Succeeded" -} - -// @public -export interface ListConnectionStringsResult { - readonly connectionStrings?: ConnectionString[]; -} - -// @public -export interface MongoCluster extends TrackedResource { - properties?: MongoClusterProperties; -} - -// @public (undocumented) -export class MongoClusterManagementClient { - constructor(credential: TokenCredential, subscriptionId: string, options?: MongoClusterManagementClientOptions); - readonly firewallRules: FirewallRulesOperations; - readonly mongoClusters: MongoClustersOperations; - readonly operations: OperationsOperations; - readonly pipeline: Pipeline; - readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; - readonly privateLinks: PrivateLinksOperations; -} - -// @public (undocumented) -export interface MongoClusterManagementClientOptions extends ClientOptions { - apiVersion?: string; -} - -// @public -export interface MongoClusterProperties { - administratorLogin?: string; - administratorLoginPassword?: string; - readonly clusterStatus?: MongoClusterStatus; - readonly connectionString?: string; - createMode?: CreateMode; - readonly earliestRestoreTime?: string; - nodeGroupSpecs?: NodeGroupSpec[]; - readonly privateEndpointConnections?: PrivateEndpointConnection[]; - readonly provisioningState?: ProvisioningState; - publicNetworkAccess?: PublicNetworkAccess; - restoreParameters?: MongoClusterRestoreParameters; - serverVersion?: string; -} - -// @public -export interface MongoClusterRestoreParameters { - pointInTimeUTC?: Date; - sourceResourceId?: string; -} - -// @public (undocumented) -export interface MongoClustersCheckNameAvailabilityOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface MongoClustersDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface MongoClustersGetOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersListByResourceGroupOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersListConnectionStringsOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersListOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface MongoClustersOperations { - // (undocumented) - checkNameAvailability: (location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams) => Promise; - // (undocumented) - createOrUpdate: (resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams) => PollerLike, MongoCluster>; - // (undocumented) - delete: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams) => PollerLike, void>; - // (undocumented) - get: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams) => Promise; - // (undocumented) - list: (options?: MongoClustersListOptionalParams) => PagedAsyncIterableIterator; - // (undocumented) - listByResourceGroup: (resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; - // (undocumented) - listConnectionStrings: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams) => Promise; - // (undocumented) - update: (resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams) => PollerLike, MongoCluster>; -} - -// @public -export type MongoClusterStatus = string; - -// @public (undocumented) -export interface MongoClustersUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface MongoClusterUpdate { - // (undocumented) - properties?: MongoClusterUpdateProperties; - tags?: Record; -} - -// @public -export interface MongoClusterUpdateProperties { - administratorLogin?: string; - administratorLoginPassword?: string; - nodeGroupSpecs?: NodeGroupSpec[]; - publicNetworkAccess?: PublicNetworkAccess; - serverVersion?: string; -} - -// @public -export interface NodeGroupSpec { - diskSizeGB?: number; - enableHa?: boolean; - kind?: NodeKind; - nodeCount?: number; - sku?: string; -} - -// @public -export type NodeKind = string; - -// @public -export interface Operation { - actionType?: ActionType; - display?: OperationDisplay; - readonly isDataAction?: boolean; - readonly name?: string; - readonly origin?: Origin; -} - -// @public -export interface OperationDisplay { - description?: string; - operation?: string; - provider?: string; - resource?: string; -} - -// @public (undocumented) -export interface OperationsListOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface OperationsOperations { - // (undocumented) - list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; -} - -// @public -export type Origin = string; - -// @public -export interface PagedAsyncIterableIterator { - [Symbol.asyncIterator](): PagedAsyncIterableIterator; - byPage: (settings?: TPageSettings) => AsyncIterableIterator>; - next(): Promise>; -} - -// @public -export interface PageSettings { - continuationToken?: string; -} - -// @public -export interface PrivateEndpoint { - readonly id?: string; -} - -// @public -export interface PrivateEndpointConnection extends Resource { - properties?: PrivateEndpointConnectionProperties; -} - -// @public -export interface PrivateEndpointConnectionProperties { - readonly groupIds?: string[]; - privateEndpoint?: PrivateEndpoint; - privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; - readonly provisioningState?: PrivateEndpointConnectionProvisioningState; -} - -// @public -export type PrivateEndpointConnectionProvisioningState = string; - -// @public -export interface PrivateEndpointConnectionResource extends ProxyResource { - properties?: PrivateEndpointConnectionProperties; -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface PrivateEndpointConnectionsOperations { - // (undocumented) - create: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams) => PollerLike, PrivateEndpointConnectionResource>; - // (undocumented) - delete: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, void>; - // (undocumented) - get: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams) => Promise; - // (undocumented) - listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; -} - -// @public -export type PrivateEndpointServiceConnectionStatus = string; - -// @public -export interface PrivateLinkResource extends ProxyResource { - properties?: PrivateLinkResourceProperties; -} - -// @public -export interface PrivateLinkResourceProperties { - readonly groupId?: string; - readonly requiredMembers?: string[]; - requiredZoneNames?: string[]; -} - -// @public -export interface PrivateLinkServiceConnectionState { - actionsRequired?: string; - description?: string; - status?: PrivateEndpointServiceConnectionStatus; -} - -// @public (undocumented) -export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions { -} - -// @public (undocumented) -export interface PrivateLinksOperations { - // (undocumented) - listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; -} - -// @public -export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; - -// @public -export interface ProxyResource extends Resource { -} - -// @public -export type PublicNetworkAccess = string; - -// @public -export interface Resource { - readonly id?: string; - readonly name?: string; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public -export type ResourceProvisioningState = string; - -// @public -export function restorePoller(client: MongoClusterManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; - -// @public (undocumented) -export interface RestorePollerOptions extends OperationOptions { - abortSignal?: AbortSignalLike; - processResponseBody?: (result: TResponse) => Promise; - updateIntervalInMs?: number; -} - -// @public -export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; -} - -// @public -export interface TrackedResource extends Resource { - location: string; - tags?: Record; -} - -// @public -export type Versions = "2024-03-01-preview"; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/mongocluster/arm-mongocluster/rollup.config.js b/sdk/mongocluster/arm-mongocluster/rollup.config.js deleted file mode 100644 index 61251d7a8d52..000000000000 --- a/sdk/mongocluster/arm-mongocluster/rollup.config.js +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import nodeResolve from "@rollup/plugin-node-resolve"; -import cjs from "@rollup/plugin-commonjs"; -import sourcemaps from "rollup-plugin-sourcemaps"; -import multiEntry from "@rollup/plugin-multi-entry"; -import json from "@rollup/plugin-json"; - -import nodeBuiltins from "builtin-modules"; - -// #region Warning Handler - -/** - * A function that can determine whether a rollup warning should be ignored. If - * the function returns `true`, then the warning will not be displayed. - */ - -function ignoreNiseSinonEval(warning) { - return ( - warning.code === "EVAL" && - warning.id && - (warning.id.includes("node_modules/nise") || - warning.id.includes("node_modules/sinon")) === true - ); -} - -function ignoreChaiCircularDependency(warning) { - return ( - warning.code === "CIRCULAR_DEPENDENCY" && - warning.importer && - warning.importer.includes("node_modules/chai") === true - ); -} - -const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; - -/** - * Construct a warning handler for the shared rollup configuration - * that ignores certain warnings that are not relevant to testing. - */ -function makeOnWarnForTesting() { - return (warning, warn) => { - // If every inhibitor returns false (i.e. no inhibitors), then show the warning - if (warningInhibitors.every((inhib) => !inhib(warning))) { - warn(warning); - } - }; -} - -// #endregion - -function makeBrowserTestConfig() { - const config = { - input: { - include: ["dist-esm/test/**/*.spec.js"], - exclude: ["dist-esm/test/**/node/**"], - }, - output: { - file: `dist-test/index.browser.js`, - format: "umd", - sourcemap: true, - }, - preserveSymlinks: false, - plugins: [ - multiEntry({ exports: false }), - nodeResolve({ - mainFields: ["module", "browser"], - }), - cjs(), - json(), - sourcemaps(), - //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) - ], - onwarn: makeOnWarnForTesting(), - // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, - // rollup started respecting the "sideEffects" field in package.json. Since - // our package.json sets "sideEffects=false", this also applies to test - // code, which causes all tests to be removed by tree-shaking. - treeshake: false, - }; - - return config; -} - -const defaultConfigurationOptions = { - disableBrowserBundle: false, -}; - -export function makeConfig(pkg, options) { - options = { - ...defaultConfigurationOptions, - ...(options || {}), - }; - - const baseConfig = { - // Use the package's module field if it has one - input: pkg["module"] || "dist-esm/src/index.js", - external: [ - ...nodeBuiltins, - ...Object.keys(pkg.dependencies), - ...Object.keys(pkg.devDependencies), - ], - output: { file: "dist/index.js", format: "cjs", sourcemap: true }, - preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve()], - }; - - const config = [baseConfig]; - - if (!options.disableBrowserBundle) { - config.push(makeBrowserTestConfig()); - } - - return config; -} - -export default makeConfig(require("./package.json")); diff --git a/sdk/mongocluster/arm-mongocluster/sample.env b/sdk/mongocluster/arm-mongocluster/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/mongocluster/arm-mongocluster/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts b/sdk/mongocluster/arm-mongocluster/src/api/documentDBContext.ts similarity index 80% rename from sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts rename to sdk/mongocluster/arm-mongocluster/src/api/documentDBContext.ts index 5f1309baa7d0..e29e675a088b 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/documentDBContext.ts @@ -6,7 +6,8 @@ import { ClientOptions } from "@azure-rest/core-client"; import { DocumentDBContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface MongoClusterManagementClientOptions extends ClientOptions { +/** Optional parameters for the client. */ +export interface DocumentDBClientOptions extends ClientOptions { /** The API version to use for this operation. */ apiVersion?: string; } @@ -14,9 +15,9 @@ export interface MongoClusterManagementClientOptions extends ClientOptions { export { DocumentDBContext } from "../rest/index.js"; /** 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 function createMongoClusterManagement( +export function createDocumentDB( credential: TokenCredential, - options: MongoClusterManagementClientOptions = {}, + options: DocumentDBClientOptions = {}, ): DocumentDBContext { const clientContext = getClient(credential, options); return clientContext; diff --git a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts index 6491514b692d..33217e79f686 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts @@ -5,6 +5,7 @@ import { getLongRunningPoller } from "../pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { firewallRulePropertiesSerializer, + CreatedByType, FirewallRule, _FirewallRuleListResult, } from "../../models/models.js"; @@ -39,7 +40,7 @@ import { FirewallRulesListByMongoClusterOptionalParams, } from "../../models/options.js"; -export function _getSend( +export function _firewallRulesGetSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -60,7 +61,7 @@ export function _getSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _getDeserialize( +export async function _firewallRulesGetDeserialize( result: FirewallRulesGet200Response | FirewallRulesGetDefaultResponse, ): Promise { if (isUnexpected(result)) { @@ -75,13 +76,17 @@ export async function _getDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], + createdByType: result.body.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: result.body.systemData?.["createdAt"] !== undefined ? new Date(result.body.systemData?.["createdAt"]) : undefined, lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], + lastModifiedByType: result.body.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -98,7 +103,7 @@ export async function _getDeserialize( } /** Gets information about a mongo cluster firewall rule. */ -export async function get( +export async function firewallRulesGet( context: Client, subscriptionId: string, resourceGroupName: string, @@ -106,7 +111,7 @@ export async function get( firewallRuleName: string, options: FirewallRulesGetOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getSend( + const result = await _firewallRulesGetSend( context, subscriptionId, resourceGroupName, @@ -114,10 +119,10 @@ export async function get( firewallRuleName, options, ); - return _getDeserialize(result); + return _firewallRulesGetDeserialize(result); } -export function _createOrUpdateSend( +export function _firewallRulesCreateOrUpdateSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -150,7 +155,7 @@ export function _createOrUpdateSend( }); } -export async function _createOrUpdateDeserialize( +export async function _firewallRulesCreateOrUpdateDeserialize( result: | FirewallRulesCreateOrUpdate200Response | FirewallRulesCreateOrUpdate201Response @@ -171,13 +176,17 @@ export async function _createOrUpdateDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], + createdByType: result.body.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: result.body.systemData?.["createdAt"] !== undefined ? new Date(result.body.systemData?.["createdAt"]) : undefined, lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], + lastModifiedByType: result.body.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -194,7 +203,7 @@ export async function _createOrUpdateDeserialize( } /** Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. */ -export function createOrUpdate( +export function firewallRulesCreateOrUpdate( context: Client, subscriptionId: string, resourceGroupName: string, @@ -203,23 +212,27 @@ export function createOrUpdate( resource: FirewallRule, options: FirewallRulesCreateOrUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, FirewallRule> { - return getLongRunningPoller(context, _createOrUpdateDeserialize, { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _createOrUpdateSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - firewallRuleName, - resource, - options, - ), - }) as PollerLike, FirewallRule>; + return getLongRunningPoller( + context, + _firewallRulesCreateOrUpdateDeserialize, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _firewallRulesCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + firewallRuleName, + resource, + options, + ), + }, + ) as PollerLike, FirewallRule>; } -export function _$deleteSend( +export function _firewallRulesDeleteSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -243,7 +256,7 @@ export function _$deleteSend( .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _$deleteDeserialize( +export async function _firewallRulesDeleteDeserialize( result: | FirewallRulesDelete202Response | FirewallRulesDelete204Response @@ -259,12 +272,7 @@ export async function _$deleteDeserialize( } /** Deletes a mongo cluster firewall rule. */ -/** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ -export function $delete( +export function firewallRulesDelete( context: Client, subscriptionId: string, resourceGroupName: string, @@ -272,11 +280,11 @@ export function $delete( firewallRuleName: string, options: FirewallRulesDeleteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller(context, _$deleteDeserialize, { + return getLongRunningPoller(context, _firewallRulesDeleteDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, getInitialResponse: () => - _$deleteSend( + _firewallRulesDeleteSend( context, subscriptionId, resourceGroupName, @@ -287,7 +295,7 @@ export function $delete( }) as PollerLike, void>; } -export function _listByMongoClusterSend( +export function _firewallRulesListByMongoClusterSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -309,7 +317,7 @@ export function _listByMongoClusterSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _listByMongoClusterDeserialize( +export async function _firewallRulesListByMongoClusterDeserialize( result: | FirewallRulesListByMongoCluster200Response | FirewallRulesListByMongoClusterDefaultResponse, @@ -327,13 +335,15 @@ export async function _listByMongoClusterDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.["createdByType"] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -352,7 +362,7 @@ export async function _listByMongoClusterDeserialize( } /** List all the firewall rules in a given mongo cluster. */ -export function listByMongoCluster( +export function firewallRulesListByMongoCluster( context: Client, subscriptionId: string, resourceGroupName: string, @@ -364,14 +374,14 @@ export function listByMongoCluster( return buildPagedAsyncIterator( context, () => - _listByMongoClusterSend( + _firewallRulesListByMongoClusterSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ), - _listByMongoClusterDeserialize, + _firewallRulesListByMongoClusterDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/index.ts index eee53a2abe0f..501b0e175444 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/index.ts @@ -2,7 +2,31 @@ // Licensed under the MIT license. export { - createMongoClusterManagement, - MongoClusterManagementClientOptions, + createDocumentDB, + DocumentDBClientOptions, DocumentDBContext, -} from "./mongoClusterManagementContext.js"; +} from "./documentDBContext.js"; +export { + firewallRulesGet, + firewallRulesCreateOrUpdate, + firewallRulesDelete, + firewallRulesListByMongoCluster, +} from "./firewallRules/index.js"; +export { + mongoClustersGet, + mongoClustersCreateOrUpdate, + mongoClustersUpdate, + mongoClustersDelete, + mongoClustersListByResourceGroup, + mongoClustersList, + mongoClustersListConnectionStrings, + mongoClustersCheckNameAvailability, +} from "./mongoClusters/index.js"; +export { operationsList } from "./operations/index.js"; +export { + privateEndpointConnectionsListByMongoCluster, + privateEndpointConnectionsGet, + privateEndpointConnectionsCreate, + privateEndpointConnectionsDelete, +} from "./privateEndpointConnections/index.js"; +export { privateLinksListByMongoCluster } from "./privateLinks/index.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts index becce903a6aa..2cdc6c7e0238 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts @@ -6,11 +6,19 @@ import { PollerLike, OperationState } from "@azure/core-lro"; import { mongoClusterPropertiesSerializer, mongoClusterUpdatePropertiesSerializer, + CreatedByType, + PrivateEndpointServiceConnectionStatus, + PrivateEndpointConnectionProvisioningState, MongoCluster, + CreateMode, + MongoClusterStatus, + PublicNetworkAccess, + NodeKind, MongoClusterUpdate, ListConnectionStringsResult, CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, + CheckNameAvailabilityReason, _MongoClusterListResult, } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; @@ -58,7 +66,7 @@ import { MongoClustersCheckNameAvailabilityOptionalParams, } from "../../models/options.js"; -export function _getSend( +export function _mongoClustersGetSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -77,7 +85,7 @@ export function _getSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _getDeserialize( +export async function _mongoClustersGetDeserialize( result: MongoClustersGet200Response | MongoClustersGetDefaultResponse, ): Promise { if (isUnexpected(result)) { @@ -94,13 +102,17 @@ export async function _getDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], + createdByType: result.body.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: result.body.systemData?.["createdAt"] !== undefined ? new Date(result.body.systemData?.["createdAt"]) : undefined, lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], + lastModifiedByType: result.body.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -109,7 +121,7 @@ export async function _getDeserialize( properties: !result.body.properties ? undefined : { - createMode: result.body.properties?.["createMode"], + createMode: result.body.properties?.["createMode"] as CreateMode, restoreParameters: !result.body.properties?.restoreParameters ? undefined : { @@ -135,8 +147,12 @@ export async function _getDeserialize( connectionString: result.body.properties?.["connectionString"], earliestRestoreTime: result.body.properties?.["earliestRestoreTime"], provisioningState: result.body.properties?.["provisioningState"], - clusterStatus: result.body.properties?.["clusterStatus"], - publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], + clusterStatus: result.body.properties?.[ + "clusterStatus" + ] as MongoClusterStatus, + publicNetworkAccess: result.body.properties?.[ + "publicNetworkAccess" + ] as PublicNetworkAccess, nodeGroupSpecs: result.body.properties?.["nodeGroupSpecs"] === undefined ? result.body.properties?.["nodeGroupSpecs"] @@ -144,7 +160,7 @@ export async function _getDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"], + kind: p["kind"] as NodeKind, nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -159,14 +175,17 @@ export async function _getDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: - p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -180,10 +199,10 @@ export async function _getDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: - p.properties?.privateLinkServiceConnectionState[ - "status" - ], + status: p.properties + ?.privateLinkServiceConnectionState[ + "status" + ] as PrivateEndpointServiceConnectionStatus, description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -193,8 +212,9 @@ export async function _getDeserialize( "actionsRequired" ], }, - provisioningState: - p.properties?.["provisioningState"], + provisioningState: p.properties?.[ + "provisioningState" + ] as PrivateEndpointConnectionProvisioningState, }, }), ), @@ -203,24 +223,24 @@ export async function _getDeserialize( } /** Gets information about a mongo cluster. */ -export async function get( +export async function mongoClustersGet( context: Client, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options: MongoClustersGetOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getSend( + const result = await _mongoClustersGetSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ); - return _getDeserialize(result); + return _mongoClustersGetDeserialize(result); } -export function _createOrUpdateSend( +export function _mongoClustersCreateOrUpdateSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -254,7 +274,7 @@ export function _createOrUpdateSend( }); } -export async function _createOrUpdateDeserialize( +export async function _mongoClustersCreateOrUpdateDeserialize( result: | MongoClustersCreateOrUpdate200Response | MongoClustersCreateOrUpdate201Response @@ -276,13 +296,17 @@ export async function _createOrUpdateDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], + createdByType: result.body.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: result.body.systemData?.["createdAt"] !== undefined ? new Date(result.body.systemData?.["createdAt"]) : undefined, lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], + lastModifiedByType: result.body.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -291,7 +315,7 @@ export async function _createOrUpdateDeserialize( properties: !result.body.properties ? undefined : { - createMode: result.body.properties?.["createMode"], + createMode: result.body.properties?.["createMode"] as CreateMode, restoreParameters: !result.body.properties?.restoreParameters ? undefined : { @@ -317,8 +341,12 @@ export async function _createOrUpdateDeserialize( connectionString: result.body.properties?.["connectionString"], earliestRestoreTime: result.body.properties?.["earliestRestoreTime"], provisioningState: result.body.properties?.["provisioningState"], - clusterStatus: result.body.properties?.["clusterStatus"], - publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], + clusterStatus: result.body.properties?.[ + "clusterStatus" + ] as MongoClusterStatus, + publicNetworkAccess: result.body.properties?.[ + "publicNetworkAccess" + ] as PublicNetworkAccess, nodeGroupSpecs: result.body.properties?.["nodeGroupSpecs"] === undefined ? result.body.properties?.["nodeGroupSpecs"] @@ -326,7 +354,7 @@ export async function _createOrUpdateDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"], + kind: p["kind"] as NodeKind, nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -341,14 +369,17 @@ export async function _createOrUpdateDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: - p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -362,10 +393,10 @@ export async function _createOrUpdateDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: - p.properties?.privateLinkServiceConnectionState[ - "status" - ], + status: p.properties + ?.privateLinkServiceConnectionState[ + "status" + ] as PrivateEndpointServiceConnectionStatus, description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -375,8 +406,9 @@ export async function _createOrUpdateDeserialize( "actionsRequired" ], }, - provisioningState: - p.properties?.["provisioningState"], + provisioningState: p.properties?.[ + "provisioningState" + ] as PrivateEndpointConnectionProvisioningState, }, }), ), @@ -385,7 +417,7 @@ export async function _createOrUpdateDeserialize( } /** Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. */ -export function createOrUpdate( +export function mongoClustersCreateOrUpdate( context: Client, subscriptionId: string, resourceGroupName: string, @@ -393,22 +425,26 @@ export function createOrUpdate( resource: MongoCluster, options: MongoClustersCreateOrUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, MongoCluster> { - return getLongRunningPoller(context, _createOrUpdateDeserialize, { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _createOrUpdateSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - resource, - options, - ), - }) as PollerLike, MongoCluster>; + return getLongRunningPoller( + context, + _mongoClustersCreateOrUpdateDeserialize, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _mongoClustersCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + resource, + options, + ), + }, + ) as PollerLike, MongoCluster>; } -export function _updateSend( +export function _mongoClustersUpdateSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -441,7 +477,7 @@ export function _updateSend( }); } -export async function _updateDeserialize( +export async function _mongoClustersUpdateDeserialize( result: | MongoClustersUpdate200Response | MongoClustersUpdate202Response @@ -463,13 +499,17 @@ export async function _updateDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], + createdByType: result.body.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: result.body.systemData?.["createdAt"] !== undefined ? new Date(result.body.systemData?.["createdAt"]) : undefined, lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], + lastModifiedByType: result.body.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -478,7 +518,7 @@ export async function _updateDeserialize( properties: !result.body.properties ? undefined : { - createMode: result.body.properties?.["createMode"], + createMode: result.body.properties?.["createMode"] as CreateMode, restoreParameters: !result.body.properties?.restoreParameters ? undefined : { @@ -504,8 +544,12 @@ export async function _updateDeserialize( connectionString: result.body.properties?.["connectionString"], earliestRestoreTime: result.body.properties?.["earliestRestoreTime"], provisioningState: result.body.properties?.["provisioningState"], - clusterStatus: result.body.properties?.["clusterStatus"], - publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], + clusterStatus: result.body.properties?.[ + "clusterStatus" + ] as MongoClusterStatus, + publicNetworkAccess: result.body.properties?.[ + "publicNetworkAccess" + ] as PublicNetworkAccess, nodeGroupSpecs: result.body.properties?.["nodeGroupSpecs"] === undefined ? result.body.properties?.["nodeGroupSpecs"] @@ -513,7 +557,7 @@ export async function _updateDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"], + kind: p["kind"] as NodeKind, nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -528,14 +572,17 @@ export async function _updateDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: - p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -549,10 +596,10 @@ export async function _updateDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: - p.properties?.privateLinkServiceConnectionState[ - "status" - ], + status: p.properties + ?.privateLinkServiceConnectionState[ + "status" + ] as PrivateEndpointServiceConnectionStatus, description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -562,8 +609,9 @@ export async function _updateDeserialize( "actionsRequired" ], }, - provisioningState: - p.properties?.["provisioningState"], + provisioningState: p.properties?.[ + "provisioningState" + ] as PrivateEndpointConnectionProvisioningState, }, }), ), @@ -572,7 +620,7 @@ export async function _updateDeserialize( } /** Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. */ -export function update( +export function mongoClustersUpdate( context: Client, subscriptionId: string, resourceGroupName: string, @@ -580,11 +628,11 @@ export function update( properties: MongoClusterUpdate, options: MongoClustersUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, MongoCluster> { - return getLongRunningPoller(context, _updateDeserialize, { + return getLongRunningPoller(context, _mongoClustersUpdateDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, getInitialResponse: () => - _updateSend( + _mongoClustersUpdateSend( context, subscriptionId, resourceGroupName, @@ -595,7 +643,7 @@ export function update( }) as PollerLike, MongoCluster>; } -export function _$deleteSend( +export function _mongoClustersDeleteSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -617,7 +665,7 @@ export function _$deleteSend( .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _$deleteDeserialize( +export async function _mongoClustersDeleteDeserialize( result: | MongoClustersDelete202Response | MongoClustersDelete204Response @@ -633,23 +681,18 @@ export async function _$deleteDeserialize( } /** Deletes a mongo cluster. */ -/** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ -export function $delete( +export function mongoClustersDelete( context: Client, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options: MongoClustersDeleteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller(context, _$deleteDeserialize, { + return getLongRunningPoller(context, _mongoClustersDeleteDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, getInitialResponse: () => - _$deleteSend( + _mongoClustersDeleteSend( context, subscriptionId, resourceGroupName, @@ -659,7 +702,7 @@ export function $delete( }) as PollerLike, void>; } -export function _listByResourceGroupSend( +export function _mongoClustersListByResourceGroupSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -679,7 +722,7 @@ export function _listByResourceGroupSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _listByResourceGroupDeserialize( +export async function _mongoClustersListByResourceGroupDeserialize( result: | MongoClustersListByResourceGroup200Response | MongoClustersListByResourceGroupDefaultResponse, @@ -699,13 +742,15 @@ export async function _listByResourceGroupDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.["createdByType"] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -714,7 +759,7 @@ export async function _listByResourceGroupDeserialize( properties: !p.properties ? undefined : { - createMode: p.properties?.["createMode"], + createMode: p.properties?.["createMode"] as CreateMode, restoreParameters: !p.properties?.restoreParameters ? undefined : { @@ -735,8 +780,12 @@ export async function _listByResourceGroupDeserialize( connectionString: p.properties?.["connectionString"], earliestRestoreTime: p.properties?.["earliestRestoreTime"], provisioningState: p.properties?.["provisioningState"], - clusterStatus: p.properties?.["clusterStatus"], - publicNetworkAccess: p.properties?.["publicNetworkAccess"], + clusterStatus: p.properties?.[ + "clusterStatus" + ] as MongoClusterStatus, + publicNetworkAccess: p.properties?.[ + "publicNetworkAccess" + ] as PublicNetworkAccess, nodeGroupSpecs: p.properties?.["nodeGroupSpecs"] === undefined ? p.properties?.["nodeGroupSpecs"] @@ -744,7 +793,7 @@ export async function _listByResourceGroupDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"], + kind: p["kind"] as NodeKind, nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -758,14 +807,17 @@ export async function _listByResourceGroupDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: - p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -779,10 +831,10 @@ export async function _listByResourceGroupDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: - p.properties?.privateLinkServiceConnectionState[ - "status" - ], + status: p.properties + ?.privateLinkServiceConnectionState[ + "status" + ] as PrivateEndpointServiceConnectionStatus, description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -792,8 +844,9 @@ export async function _listByResourceGroupDeserialize( "actionsRequired" ], }, - provisioningState: - p.properties?.["provisioningState"], + provisioningState: p.properties?.[ + "provisioningState" + ] as PrivateEndpointConnectionProvisioningState, }, })), }, @@ -803,7 +856,7 @@ export async function _listByResourceGroupDeserialize( } /** List all the mongo clusters in a given resource group. */ -export function listByResourceGroup( +export function mongoClustersListByResourceGroup( context: Client, subscriptionId: string, resourceGroupName: string, @@ -814,18 +867,18 @@ export function listByResourceGroup( return buildPagedAsyncIterator( context, () => - _listByResourceGroupSend( + _mongoClustersListByResourceGroupSend( context, subscriptionId, resourceGroupName, options, ), - _listByResourceGroupDeserialize, + _mongoClustersListByResourceGroupDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } -export function _listSend( +export function _mongoClustersListSend( context: Client, subscriptionId: string, options: MongoClustersListOptionalParams = { requestOptions: {} }, @@ -840,7 +893,7 @@ export function _listSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _listDeserialize( +export async function _mongoClustersListDeserialize( result: MongoClustersList200Response | MongoClustersListDefaultResponse, ): Promise<_MongoClusterListResult> { if (isUnexpected(result)) { @@ -858,13 +911,15 @@ export async function _listDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.["createdByType"] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -873,7 +928,7 @@ export async function _listDeserialize( properties: !p.properties ? undefined : { - createMode: p.properties?.["createMode"], + createMode: p.properties?.["createMode"] as CreateMode, restoreParameters: !p.properties?.restoreParameters ? undefined : { @@ -894,8 +949,12 @@ export async function _listDeserialize( connectionString: p.properties?.["connectionString"], earliestRestoreTime: p.properties?.["earliestRestoreTime"], provisioningState: p.properties?.["provisioningState"], - clusterStatus: p.properties?.["clusterStatus"], - publicNetworkAccess: p.properties?.["publicNetworkAccess"], + clusterStatus: p.properties?.[ + "clusterStatus" + ] as MongoClusterStatus, + publicNetworkAccess: p.properties?.[ + "publicNetworkAccess" + ] as PublicNetworkAccess, nodeGroupSpecs: p.properties?.["nodeGroupSpecs"] === undefined ? p.properties?.["nodeGroupSpecs"] @@ -903,7 +962,7 @@ export async function _listDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"], + kind: p["kind"] as NodeKind, nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -917,14 +976,17 @@ export async function _listDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: - p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -938,10 +1000,10 @@ export async function _listDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: - p.properties?.privateLinkServiceConnectionState[ - "status" - ], + status: p.properties + ?.privateLinkServiceConnectionState[ + "status" + ] as PrivateEndpointServiceConnectionStatus, description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -951,8 +1013,9 @@ export async function _listDeserialize( "actionsRequired" ], }, - provisioningState: - p.properties?.["provisioningState"], + provisioningState: p.properties?.[ + "provisioningState" + ] as PrivateEndpointConnectionProvisioningState, }, })), }, @@ -962,20 +1025,20 @@ export async function _listDeserialize( } /** List all the mongo clusters in a given subscription. */ -export function list( +export function mongoClustersList( context: Client, subscriptionId: string, options: MongoClustersListOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listSend(context, subscriptionId, options), - _listDeserialize, + () => _mongoClustersListSend(context, subscriptionId, options), + _mongoClustersListDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } -export function _listConnectionStringsSend( +export function _mongoClustersListConnectionStringsSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -997,7 +1060,7 @@ export function _listConnectionStringsSend( .post({ ...operationOptionsToRequestParameters(options) }); } -export async function _listConnectionStringsDeserialize( +export async function _mongoClustersListConnectionStringsDeserialize( result: | MongoClustersListConnectionStrings200Response | MongoClustersListConnectionStringsDefaultResponse, @@ -1018,7 +1081,7 @@ export async function _listConnectionStringsDeserialize( } /** 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. */ -export async function listConnectionStrings( +export async function mongoClustersListConnectionStrings( context: Client, subscriptionId: string, resourceGroupName: string, @@ -1027,17 +1090,17 @@ export async function listConnectionStrings( requestOptions: {}, }, ): Promise { - const result = await _listConnectionStringsSend( + const result = await _mongoClustersListConnectionStringsSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ); - return _listConnectionStringsDeserialize(result); + return _mongoClustersListConnectionStringsDeserialize(result); } -export function _checkNameAvailabilitySend( +export function _mongoClustersCheckNameAvailabilitySend( context: Client, subscriptionId: string, location: string, @@ -1061,7 +1124,7 @@ export function _checkNameAvailabilitySend( }); } -export async function _checkNameAvailabilityDeserialize( +export async function _mongoClustersCheckNameAvailabilityDeserialize( result: | MongoClustersCheckNameAvailability200Response | MongoClustersCheckNameAvailabilityDefaultResponse, @@ -1072,13 +1135,13 @@ export async function _checkNameAvailabilityDeserialize( return { nameAvailable: result.body["nameAvailable"], - reason: result.body["reason"], + reason: result.body["reason"] as CheckNameAvailabilityReason, message: result.body["message"], }; } /** Check if mongo cluster name is available for use. */ -export async function checkNameAvailability( +export async function mongoClustersCheckNameAvailability( context: Client, subscriptionId: string, location: string, @@ -1087,12 +1150,12 @@ export async function checkNameAvailability( requestOptions: {}, }, ): Promise { - const result = await _checkNameAvailabilitySend( + const result = await _mongoClustersCheckNameAvailabilitySend( context, subscriptionId, location, body, options, ); - return _checkNameAvailabilityDeserialize(result); + return _mongoClustersCheckNameAvailabilityDeserialize(result); } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts index 56fa5c9787d6..d33b67beafd5 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts @@ -1,7 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { Operation, _OperationListResult } from "../../models/models.js"; +import { + Operation, + Origin, + ActionType, + _OperationListResult, +} from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "../pagingHelpers.js"; import { @@ -17,7 +22,7 @@ import { } from "@azure-rest/core-client"; import { OperationsListOptionalParams } from "../../models/options.js"; -export function _listSend( +export function _operationsListSend( context: Client, options: OperationsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { @@ -26,7 +31,7 @@ export function _listSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _listDeserialize( +export async function _operationsListDeserialize( result: OperationsList200Response | OperationsListDefaultResponse, ): Promise<_OperationListResult> { if (isUnexpected(result)) { @@ -45,22 +50,22 @@ export async function _listDeserialize( operation: p.display?.["operation"], description: p.display?.["description"], }, - origin: p["origin"], - actionType: p["actionType"], + origin: p["origin"] as Origin, + actionType: p["actionType"] as ActionType, })), nextLink: result.body["nextLink"], }; } /** List the operations for the provider */ -export function list( +export function operationsList( context: Client, options: OperationsListOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _listSend(context, options), - _listDeserialize, + () => _operationsListSend(context, options), + _operationsListDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts index bedeec197622..0ce5830176a5 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts @@ -5,7 +5,10 @@ import { getLongRunningPoller } from "../pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { privateEndpointConnectionPropertiesSerializer, + CreatedByType, PrivateEndpointConnectionResource, + PrivateEndpointServiceConnectionStatus, + PrivateEndpointConnectionProvisioningState, _PrivateEndpointConnectionResourceListResult, } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; @@ -39,7 +42,7 @@ import { PrivateEndpointConnectionsDeleteOptionalParams, } from "../../models/options.js"; -export function _listByMongoClusterSend( +export function _privateEndpointConnectionsListByMongoClusterSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -61,7 +64,7 @@ export function _listByMongoClusterSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _listByMongoClusterDeserialize( +export async function _privateEndpointConnectionsListByMongoClusterDeserialize( result: | PrivateEndpointConnectionsListByMongoCluster200Response | PrivateEndpointConnectionsListByMongoClusterDefaultResponse, @@ -79,13 +82,15 @@ export async function _listByMongoClusterDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.["createdByType"] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -99,7 +104,9 @@ export async function _listByMongoClusterDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], + status: p.properties?.privateLinkServiceConnectionState[ + "status" + ] as PrivateEndpointServiceConnectionStatus, description: p.properties?.privateLinkServiceConnectionState["description"], actionsRequired: @@ -107,7 +114,9 @@ export async function _listByMongoClusterDeserialize( "actionsRequired" ], }, - provisioningState: p.properties?.["provisioningState"], + provisioningState: p.properties?.[ + "provisioningState" + ] as PrivateEndpointConnectionProvisioningState, }, })), nextLink: result.body["nextLink"], @@ -115,7 +124,7 @@ export async function _listByMongoClusterDeserialize( } /** List existing private connections */ -export function listByMongoCluster( +export function privateEndpointConnectionsListByMongoCluster( context: Client, subscriptionId: string, resourceGroupName: string, @@ -127,19 +136,19 @@ export function listByMongoCluster( return buildPagedAsyncIterator( context, () => - _listByMongoClusterSend( + _privateEndpointConnectionsListByMongoClusterSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ), - _listByMongoClusterDeserialize, + _privateEndpointConnectionsListByMongoClusterDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } -export function _getSend( +export function _privateEndpointConnectionsGetSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -161,7 +170,7 @@ export function _getSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _getDeserialize( +export async function _privateEndpointConnectionsGetDeserialize( result: | PrivateEndpointConnectionsGet200Response | PrivateEndpointConnectionsGetDefaultResponse, @@ -178,13 +187,17 @@ export async function _getDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], + createdByType: result.body.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: result.body.systemData?.["createdAt"] !== undefined ? new Date(result.body.systemData?.["createdAt"]) : undefined, lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], + lastModifiedByType: result.body.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -198,10 +211,9 @@ export async function _getDeserialize( ? undefined : { id: result.body.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: - result.body.properties?.privateLinkServiceConnectionState[ - "status" - ], + status: result.body.properties?.privateLinkServiceConnectionState[ + "status" + ] as PrivateEndpointServiceConnectionStatus, description: result.body.properties?.privateLinkServiceConnectionState[ "description" @@ -211,13 +223,15 @@ export async function _getDeserialize( "actionsRequired" ], }, - provisioningState: result.body.properties?.["provisioningState"], + provisioningState: result.body.properties?.[ + "provisioningState" + ] as PrivateEndpointConnectionProvisioningState, }, }; } /** Get a specific private connection */ -export async function get( +export async function privateEndpointConnectionsGet( context: Client, subscriptionId: string, resourceGroupName: string, @@ -225,7 +239,7 @@ export async function get( privateEndpointConnectionName: string, options: PrivateEndpointConnectionsGetOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getSend( + const result = await _privateEndpointConnectionsGetSend( context, subscriptionId, resourceGroupName, @@ -233,10 +247,10 @@ export async function get( privateEndpointConnectionName, options, ); - return _getDeserialize(result); + return _privateEndpointConnectionsGetDeserialize(result); } -export function _createSend( +export function _privateEndpointConnectionsCreateSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -271,7 +285,7 @@ export function _createSend( }); } -export async function _createDeserialize( +export async function _privateEndpointConnectionsCreateDeserialize( result: | PrivateEndpointConnectionsCreate200Response | PrivateEndpointConnectionsCreate201Response @@ -292,13 +306,17 @@ export async function _createDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.["createdByType"], + createdByType: result.body.systemData?.[ + "createdByType" + ] as CreatedByType, createdAt: result.body.systemData?.["createdAt"] !== undefined ? new Date(result.body.systemData?.["createdAt"]) : undefined, lastModifiedBy: result.body.systemData?.["lastModifiedBy"], - lastModifiedByType: result.body.systemData?.["lastModifiedByType"], + lastModifiedByType: result.body.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -312,10 +330,9 @@ export async function _createDeserialize( ? undefined : { id: result.body.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: - result.body.properties?.privateLinkServiceConnectionState[ - "status" - ], + status: result.body.properties?.privateLinkServiceConnectionState[ + "status" + ] as PrivateEndpointServiceConnectionStatus, description: result.body.properties?.privateLinkServiceConnectionState[ "description" @@ -325,13 +342,15 @@ export async function _createDeserialize( "actionsRequired" ], }, - provisioningState: result.body.properties?.["provisioningState"], + provisioningState: result.body.properties?.[ + "provisioningState" + ] as PrivateEndpointConnectionProvisioningState, }, }; } /** Create a Private endpoint connection */ -export function create( +export function privateEndpointConnectionsCreate( context: Client, subscriptionId: string, resourceGroupName: string, @@ -345,26 +364,30 @@ export function create( OperationState, PrivateEndpointConnectionResource > { - return getLongRunningPoller(context, _createDeserialize, { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _createSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - resource, - options, - ), - }) as PollerLike< + return getLongRunningPoller( + context, + _privateEndpointConnectionsCreateDeserialize, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateEndpointConnectionsCreateSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + resource, + options, + ), + }, + ) as PollerLike< OperationState, PrivateEndpointConnectionResource >; } -export function _$deleteSend( +export function _privateEndpointConnectionsDeleteSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -390,7 +413,7 @@ export function _$deleteSend( .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _$deleteDeserialize( +export async function _privateEndpointConnectionsDeleteDeserialize( result: | PrivateEndpointConnectionsDelete202Response | PrivateEndpointConnectionsDelete204Response @@ -406,12 +429,7 @@ export async function _$deleteDeserialize( } /** Delete the private endpoint connection */ -/** - * @fixme delete is a reserved word that cannot be used as an operation name. - * Please add @clientName("clientName") or @clientName("", "javascript") - * to the operation to override the generated name. - */ -export function $delete( +export function privateEndpointConnectionsDelete( context: Client, subscriptionId: string, resourceGroupName: string, @@ -421,17 +439,21 @@ export function $delete( requestOptions: {}, }, ): PollerLike, void> { - return getLongRunningPoller(context, _$deleteDeserialize, { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _$deleteSend( - context, - subscriptionId, - resourceGroupName, - mongoClusterName, - privateEndpointConnectionName, - options, - ), - }) as PollerLike, void>; + return getLongRunningPoller( + context, + _privateEndpointConnectionsDeleteDeserialize, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateEndpointConnectionsDeleteSend( + context, + subscriptionId, + resourceGroupName, + mongoClusterName, + privateEndpointConnectionName, + options, + ), + }, + ) as PollerLike, void>; } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts index 03261181f0bf..cd2896bef76d 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. import { + CreatedByType, PrivateLinkResource, _PrivateLinkResourceListResult, } from "../../models/models.js"; @@ -20,7 +21,7 @@ import { } from "@azure-rest/core-client"; import { PrivateLinksListByMongoClusterOptionalParams } from "../../models/options.js"; -export function _listByMongoClusterSend( +export function _privateLinksListByMongoClusterSend( context: Client, subscriptionId: string, resourceGroupName: string, @@ -42,7 +43,7 @@ export function _listByMongoClusterSend( .get({ ...operationOptionsToRequestParameters(options) }); } -export async function _listByMongoClusterDeserialize( +export async function _privateLinksListByMongoClusterDeserialize( result: | PrivateLinksListByMongoCluster200Response | PrivateLinksListByMongoClusterDefaultResponse, @@ -60,13 +61,15 @@ export async function _listByMongoClusterDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], + createdByType: p.systemData?.["createdByType"] as CreatedByType, createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], + lastModifiedByType: p.systemData?.[ + "lastModifiedByType" + ] as CreatedByType, lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -85,7 +88,7 @@ export async function _listByMongoClusterDeserialize( } /** list private links on the given resource */ -export function listByMongoCluster( +export function privateLinksListByMongoCluster( context: Client, subscriptionId: string, resourceGroupName: string, @@ -97,14 +100,14 @@ export function listByMongoCluster( return buildPagedAsyncIterator( context, () => - _listByMongoClusterSend( + _privateLinksListByMongoClusterSend( context, subscriptionId, resourceGroupName, mongoClusterName, options, ), - _listByMongoClusterDeserialize, + _privateLinksListByMongoClusterDeserialize, { itemName: "value", nextLinkName: "nextLink" }, ); } diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts index 2ec4598dde99..bebce9a4bf3f 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { DocumentDBContext } from "../../api/documentDBContext.js"; import { FirewallRule } from "../../models/models.js"; import { - get, - createOrUpdate, - $delete, - listByMongoCluster, + firewallRulesGet, + firewallRulesCreateOrUpdate, + firewallRulesDelete, + firewallRulesListByMongoCluster, } from "../../api/firewallRules/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PollerLike, OperationState } from "@azure/core-lro"; @@ -18,13 +18,16 @@ import { FirewallRulesListByMongoClusterOptionalParams, } from "../../models/options.js"; +/** Interface representing a FirewallRules operations. */ export interface FirewallRulesOperations { + /** Gets information about a mongo cluster firewall rule. */ get: ( resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams, ) => Promise; + /** Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. */ createOrUpdate: ( resourceGroupName: string, mongoClusterName: string, @@ -32,12 +35,14 @@ export interface FirewallRulesOperations { resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams, ) => PollerLike, FirewallRule>; + /** Deletes a mongo cluster firewall rule. */ delete: ( resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams, ) => PollerLike, void>; + /** List all the firewall rules in a given mongo cluster. */ listByMongoCluster: ( resourceGroupName: string, mongoClusterName: string, @@ -56,7 +61,7 @@ export function getFirewallRules( firewallRuleName: string, options?: FirewallRulesGetOptionalParams, ) => - get( + firewallRulesGet( context, subscriptionId, resourceGroupName, @@ -71,7 +76,7 @@ export function getFirewallRules( resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams, ) => - createOrUpdate( + firewallRulesCreateOrUpdate( context, subscriptionId, resourceGroupName, @@ -86,7 +91,7 @@ export function getFirewallRules( firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams, ) => - $delete( + firewallRulesDelete( context, subscriptionId, resourceGroupName, @@ -99,7 +104,7 @@ export function getFirewallRules( mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams, ) => - listByMongoCluster( + firewallRulesListByMongoCluster( context, subscriptionId, resourceGroupName, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts index 68853a17d94e..fe0aaa38335e 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { DocumentDBContext } from "../../api/documentDBContext.js"; import { MongoCluster, MongoClusterUpdate, @@ -10,14 +10,14 @@ import { CheckNameAvailabilityResponse, } from "../../models/models.js"; import { - get, - createOrUpdate, - update, - $delete, - listByResourceGroup, - list, - listConnectionStrings, - checkNameAvailability, + mongoClustersGet, + mongoClustersCreateOrUpdate, + mongoClustersUpdate, + mongoClustersDelete, + mongoClustersListByResourceGroup, + mongoClustersList, + mongoClustersListConnectionStrings, + mongoClustersCheckNameAvailability, } from "../../api/mongoClusters/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PollerLike, OperationState } from "@azure/core-lro"; @@ -32,41 +32,50 @@ import { MongoClustersCheckNameAvailabilityOptionalParams, } from "../../models/options.js"; +/** Interface representing a MongoClusters operations. */ export interface MongoClustersOperations { + /** Gets information about a mongo cluster. */ get: ( resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams, ) => Promise; + /** Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the properties, use PATCH. */ createOrUpdate: ( resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams, ) => PollerLike, MongoCluster>; + /** Updates an existing mongo cluster. The request body can contain one to many of the properties present in the normal mongo cluster definition. */ update: ( resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams, ) => PollerLike, MongoCluster>; + /** Deletes a mongo cluster. */ delete: ( resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams, ) => PollerLike, void>; + /** List all the mongo clusters in a given resource group. */ listByResourceGroup: ( resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams, ) => PagedAsyncIterableIterator; + /** List all the mongo clusters in a given subscription. */ 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, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams, ) => Promise; + /** Check if mongo cluster name is available for use. */ checkNameAvailability: ( location: string, body: CheckNameAvailabilityRequest, @@ -84,7 +93,7 @@ export function getMongoClusters( mongoClusterName: string, options?: MongoClustersGetOptionalParams, ) => - get( + mongoClustersGet( context, subscriptionId, resourceGroupName, @@ -97,7 +106,7 @@ export function getMongoClusters( resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams, ) => - createOrUpdate( + mongoClustersCreateOrUpdate( context, subscriptionId, resourceGroupName, @@ -111,7 +120,7 @@ export function getMongoClusters( properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams, ) => - update( + mongoClustersUpdate( context, subscriptionId, resourceGroupName, @@ -124,7 +133,7 @@ export function getMongoClusters( mongoClusterName: string, options?: MongoClustersDeleteOptionalParams, ) => - $delete( + mongoClustersDelete( context, subscriptionId, resourceGroupName, @@ -135,15 +144,20 @@ export function getMongoClusters( resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams, ) => - listByResourceGroup(context, subscriptionId, resourceGroupName, options), + mongoClustersListByResourceGroup( + context, + subscriptionId, + resourceGroupName, + options, + ), list: (options?: MongoClustersListOptionalParams) => - list(context, subscriptionId, options), + mongoClustersList(context, subscriptionId, options), listConnectionStrings: ( resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams, ) => - listConnectionStrings( + mongoClustersListConnectionStrings( context, subscriptionId, resourceGroupName, @@ -155,7 +169,13 @@ export function getMongoClusters( body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams, ) => - checkNameAvailability(context, subscriptionId, location, body, options), + mongoClustersCheckNameAvailability( + context, + subscriptionId, + location, + body, + options, + ), }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts index 41331cc0ca56..c19335274c10 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts @@ -1,13 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { DocumentDBContext } from "../../api/documentDBContext.js"; import { Operation } from "../../models/models.js"; -import { list } from "../../api/operations/index.js"; +import { operationsList } from "../../api/operations/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.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; @@ -15,7 +17,8 @@ export interface OperationsOperations { export function getOperations(context: DocumentDBContext) { return { - list: (options?: OperationsListOptionalParams) => list(context, options), + list: (options?: OperationsListOptionalParams) => + operationsList(context, options), }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts index 7e67c5eec0cb..85ec6a3e4cc9 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { DocumentDBContext } from "../../api/documentDBContext.js"; import { PrivateEndpointConnectionResource } from "../../models/models.js"; import { - listByMongoCluster, - get, - create, - $delete, + privateEndpointConnectionsListByMongoCluster, + privateEndpointConnectionsGet, + privateEndpointConnectionsCreate, + privateEndpointConnectionsDelete, } from "../../api/privateEndpointConnections/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PollerLike, OperationState } from "@azure/core-lro"; @@ -18,18 +18,22 @@ import { PrivateEndpointConnectionsDeleteOptionalParams, } from "../../models/options.js"; +/** Interface representing a PrivateEndpointConnections operations. */ export interface PrivateEndpointConnectionsOperations { + /** List existing private connections */ listByMongoCluster: ( resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, ) => PagedAsyncIterableIterator; + /** Get a specific private connection */ get: ( resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams, ) => Promise; + /** Create a Private endpoint connection */ create: ( resourceGroupName: string, mongoClusterName: string, @@ -40,6 +44,7 @@ export interface PrivateEndpointConnectionsOperations { OperationState, PrivateEndpointConnectionResource >; + /** Delete the private endpoint connection */ delete: ( resourceGroupName: string, mongoClusterName: string, @@ -58,7 +63,7 @@ export function getPrivateEndpointConnections( mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams, ) => - listByMongoCluster( + privateEndpointConnectionsListByMongoCluster( context, subscriptionId, resourceGroupName, @@ -71,7 +76,7 @@ export function getPrivateEndpointConnections( privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams, ) => - get( + privateEndpointConnectionsGet( context, subscriptionId, resourceGroupName, @@ -86,7 +91,7 @@ export function getPrivateEndpointConnections( resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams, ) => - create( + privateEndpointConnectionsCreate( context, subscriptionId, resourceGroupName, @@ -101,7 +106,7 @@ export function getPrivateEndpointConnections( privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams, ) => - $delete( + privateEndpointConnectionsDelete( context, subscriptionId, resourceGroupName, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts index 5ba1f2c558fa..0537d8f6ca29 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts @@ -1,13 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; +import { DocumentDBContext } from "../../api/documentDBContext.js"; import { PrivateLinkResource } from "../../models/models.js"; -import { listByMongoCluster } from "../../api/privateLinks/index.js"; +import { privateLinksListByMongoCluster } from "../../api/privateLinks/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PrivateLinksListByMongoClusterOptionalParams } from "../../models/options.js"; +/** Interface representing a PrivateLinks operations. */ export interface PrivateLinksOperations { + /** list private links on the given resource */ listByMongoCluster: ( resourceGroupName: string, mongoClusterName: string, @@ -25,7 +27,7 @@ export function getPrivateLinks( mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams, ) => - listByMongoCluster( + privateLinksListByMongoCluster( context, subscriptionId, resourceGroupName, diff --git a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts b/sdk/mongocluster/arm-mongocluster/src/documentDBClient.ts similarity index 87% rename from sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts rename to sdk/mongocluster/arm-mongocluster/src/documentDBClient.ts index 02e55c5ebc5d..11cdcb12d889 100644 --- a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/documentDBClient.ts @@ -24,14 +24,14 @@ import { PrivateLinksOperations, } from "./classic/privateLinks/index.js"; import { - createMongoClusterManagement, - MongoClusterManagementClientOptions, + createDocumentDB, + DocumentDBClientOptions, DocumentDBContext, } from "./api/index.js"; -export { MongoClusterManagementClientOptions } from "./api/mongoClusterManagementContext.js"; +export { DocumentDBClientOptions } from "./api/documentDBContext.js"; -export class MongoClusterManagementClient { +export class DocumentDBClient { private _client: DocumentDBContext; /** The pipeline used by this client to make requests */ public readonly pipeline: Pipeline; @@ -40,9 +40,9 @@ export class MongoClusterManagementClient { constructor( credential: TokenCredential, subscriptionId: string, - options: MongoClusterManagementClientOptions = {}, + options: DocumentDBClientOptions = {}, ) { - this._client = createMongoClusterManagement(credential, options); + this._client = createDocumentDB(credential, options); this.pipeline = this._client.pipeline; this.operations = getOperationsOperations(this._client); this.mongoClusters = getMongoClustersOperations( diff --git a/sdk/mongocluster/arm-mongocluster/src/index.ts b/sdk/mongocluster/arm-mongocluster/src/index.ts index 45663932cd23..ce1e63bc17c9 100644 --- a/sdk/mongocluster/arm-mongocluster/src/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/index.ts @@ -2,15 +2,14 @@ // Licensed under the MIT license. export { - MongoClusterManagementClient, - MongoClusterManagementClientOptions, -} from "./mongoClusterManagementClient.js"; + DocumentDBClient, + DocumentDBClientOptions, +} from "./documentDBClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { Resource, SystemData, CreatedByType, - KnownCreatedByType, ProxyResource, PrivateLinkResource, PrivateLinkResourceProperties, @@ -22,26 +21,19 @@ export { PrivateEndpoint, PrivateLinkServiceConnectionState, PrivateEndpointServiceConnectionStatus, - KnownPrivateEndpointServiceConnectionStatus, PrivateEndpointConnectionProvisioningState, - KnownPrivateEndpointConnectionProvisioningState, FirewallRule, FirewallRuleProperties, ResourceProvisioningState, - KnownResourceProvisioningState, TrackedResource, MongoCluster, MongoClusterProperties, CreateMode, - KnownCreateMode, MongoClusterRestoreParameters, MongoClusterStatus, - KnownMongoClusterStatus, PublicNetworkAccess, - KnownPublicNetworkAccess, NodeGroupSpec, NodeKind, - KnownNodeKind, PrivateEndpointConnection, MongoClusterUpdate, MongoClusterUpdateProperties, @@ -50,13 +42,10 @@ export { CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, CheckNameAvailabilityReason, - KnownCheckNameAvailabilityReason, Operation, OperationDisplay, Origin, - KnownOrigin, ActionType, - KnownActionType, Versions, ProvisioningState, OperationsListOptionalParams, diff --git a/sdk/mongocluster/arm-mongocluster/src/models/index.ts b/sdk/mongocluster/arm-mongocluster/src/models/index.ts index fb147a608cd4..b120b670af80 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/index.ts @@ -5,7 +5,6 @@ export { Resource, SystemData, CreatedByType, - KnownCreatedByType, ProxyResource, PrivateLinkResource, PrivateLinkResourceProperties, @@ -17,26 +16,19 @@ export { PrivateEndpoint, PrivateLinkServiceConnectionState, PrivateEndpointServiceConnectionStatus, - KnownPrivateEndpointServiceConnectionStatus, PrivateEndpointConnectionProvisioningState, - KnownPrivateEndpointConnectionProvisioningState, FirewallRule, FirewallRuleProperties, ResourceProvisioningState, - KnownResourceProvisioningState, TrackedResource, MongoCluster, MongoClusterProperties, CreateMode, - KnownCreateMode, MongoClusterRestoreParameters, MongoClusterStatus, - KnownMongoClusterStatus, PublicNetworkAccess, - KnownPublicNetworkAccess, NodeGroupSpec, NodeKind, - KnownNodeKind, PrivateEndpointConnection, MongoClusterUpdate, MongoClusterUpdateProperties, @@ -45,13 +37,10 @@ export { CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, CheckNameAvailabilityReason, - KnownCheckNameAvailabilityReason, Operation, OperationDisplay, Origin, - KnownOrigin, ActionType, - KnownActionType, Versions, ProvisioningState, } from "./models.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/models/models.ts b/sdk/mongocluster/arm-mongocluster/src/models/models.ts index d0e25ec95136..9563faaffdf9 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/models.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/models.ts @@ -59,14 +59,7 @@ export interface SystemData { } /** The kind of entity that created the resource. */ -export type CreatedByType = string; - -export enum KnownCreatedByType { - User = "User", - Application = "Application", - ManagedIdentity = "ManagedIdentity", - Key = "Key", -} +export type CreatedByType = "User" | "Application" | "ManagedIdentity" | "Key"; /** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ export interface ProxyResource extends Resource {} @@ -200,23 +193,16 @@ export function privateLinkServiceConnectionStateSerializer( } /** The private endpoint connection status. */ -export type PrivateEndpointServiceConnectionStatus = string; - -export enum KnownPrivateEndpointServiceConnectionStatus { - Pending = "Pending", - Approved = "Approved", - Rejected = "Rejected", -} - +export type PrivateEndpointServiceConnectionStatus = + | "Pending" + | "Approved" + | "Rejected"; /** The current provisioning state. */ -export type PrivateEndpointConnectionProvisioningState = string; - -export enum KnownPrivateEndpointConnectionProvisioningState { - Succeeded = "Succeeded", - Creating = "Creating", - Deleting = "Deleting", - Failed = "Failed", -} +export type PrivateEndpointConnectionProvisioningState = + | "Succeeded" + | "Creating" + | "Deleting" + | "Failed"; /** Represents a mongo cluster firewall rule. */ export interface FirewallRule extends ProxyResource { @@ -252,13 +238,7 @@ export function firewallRulePropertiesSerializer( } /** The provisioning state of a resource type. */ -export type ResourceProvisioningState = string; - -export enum KnownResourceProvisioningState { - Succeeded = "Succeeded", - Failed = "Failed", - Canceled = "Canceled", -} +export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; /** The response of a FirewallRule list operation. */ export interface _FirewallRuleListResult { @@ -349,12 +329,7 @@ export function mongoClusterPropertiesSerializer( } /** The mode that the Mongo Cluster is created with. */ -export type CreateMode = string; - -export enum KnownCreateMode { - Default = "Default", - PointInTimeRestore = "PointInTimeRestore", -} +export type CreateMode = "Default" | "PointInTimeRestore"; /** Parameters used for restore operations */ export interface MongoClusterRestoreParameters { @@ -374,25 +349,16 @@ export function mongoClusterRestoreParametersSerializer( } /** The status of the Mongo cluster resource. */ -export type MongoClusterStatus = string; - -export enum KnownMongoClusterStatus { - Ready = "Ready", - Provisioning = "Provisioning", - Updating = "Updating", - Starting = "Starting", - Stopping = "Stopping", - Stopped = "Stopped", - Dropping = "Dropping", -} - +export type MongoClusterStatus = + | "Ready" + | "Provisioning" + | "Updating" + | "Starting" + | "Stopping" + | "Stopped" + | "Dropping"; /** Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is 'Enabled' */ -export type PublicNetworkAccess = string; - -export enum KnownPublicNetworkAccess { - Enabled = "Enabled", - Disabled = "Disabled", -} +export type PublicNetworkAccess = "Enabled" | "Disabled"; /** Specification for a node group. */ export interface NodeGroupSpec { @@ -421,11 +387,7 @@ export function nodeGroupSpecSerializer( } /** The kind of the node on the cluster. */ -export type NodeKind = string; - -export enum KnownNodeKind { - Shard = "Shard", -} +export type NodeKind = "Shard"; /** The private endpoint connection resource */ export interface PrivateEndpointConnection extends Resource { @@ -530,12 +492,7 @@ export interface CheckNameAvailabilityResponse { } /** Possible reasons for a name not being available. */ -export type CheckNameAvailabilityReason = string; - -export enum KnownCheckNameAvailabilityReason { - Invalid = "Invalid", - AlreadyExists = "AlreadyExists", -} +export type CheckNameAvailabilityReason = "Invalid" | "AlreadyExists"; /** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ export interface _OperationListResult { @@ -572,21 +529,9 @@ export interface OperationDisplay { } /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ -export type Origin = string; - -export enum KnownOrigin { - user = "user", - system = "system", - "user,system" = "user,system", -} - +export type Origin = "user" | "system" | "user,system"; /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ -export type ActionType = string; - -export enum KnownActionType { - Internal = "Internal", -} - +export type ActionType = "Internal"; /** The available API versions. */ export type Versions = "2024-03-01-preview"; /** Alias for ProvisioningState */ diff --git a/sdk/mongocluster/arm-mongocluster/src/models/options.ts b/sdk/mongocluster/arm-mongocluster/src/models/options.ts index 205f9fa8a99d..fe9a7516bfd9 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/options.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/options.ts @@ -3,70 +3,88 @@ import { OperationOptions } from "@azure-rest/core-client"; +/** Optional parameters. */ export interface OperationsListOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface MongoClustersGetOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface MongoClustersCreateOrUpdateOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } +/** Optional parameters. */ export interface MongoClustersUpdateOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } +/** Optional parameters. */ export interface MongoClustersDeleteOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } +/** Optional parameters. */ export interface MongoClustersListByResourceGroupOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface MongoClustersListOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface MongoClustersListConnectionStringsOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface MongoClustersCheckNameAvailabilityOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface FirewallRulesGetOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } +/** Optional parameters. */ export interface FirewallRulesDeleteOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } +/** Optional parameters. */ export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions {} +/** Optional parameters. */ export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } +/** Optional parameters. */ export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } +/** Optional parameters. */ export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions {} diff --git a/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts index 81a8f25156b1..1e66269db0bc 100644 --- a/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts +++ b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts @@ -7,20 +7,20 @@ import { deserializeState, ResourceLocationConfig, } from "@azure/core-lro"; -import { MongoClusterManagementClient } from "./mongoClusterManagementClient.js"; +import { DocumentDBClient } from "./documentDBClient.js"; import { getLongRunningPoller } from "./api/pollingHelpers.js"; import { - _createOrUpdateDeserialize, - _updateDeserialize, - _$deleteDeserialize, + _mongoClustersCreateOrUpdateDeserialize, + _mongoClustersUpdateDeserialize, + _mongoClustersDeleteDeserialize, } from "./api/mongoClusters/index.js"; import { - _createOrUpdateDeserialize as _createOrUpdateDeserializeFirewallRules, - _$deleteDeserialize as _$deleteDeserializeFirewallRules, + _firewallRulesCreateOrUpdateDeserialize, + _firewallRulesDeleteDeserialize, } from "./api/firewallRules/index.js"; import { - _createDeserialize, - _$deleteDeserialize as _$deleteDeserializePrivateEndpointConnections, + _privateEndpointConnectionsCreateDeserialize, + _privateEndpointConnectionsDeleteDeserialize, } from "./api/privateEndpointConnections/index.js"; import { PathUncheckedResponse, @@ -48,7 +48,7 @@ export interface RestorePollerOptions< * needs to be constructed after the original one is not in scope. */ export function restorePoller( - client: MongoClusterManagementClient, + client: DocumentDBClient, serializedState: string, sourceOperation: ( ...args: any[] @@ -88,19 +88,19 @@ export function restorePoller( const deserializeMap: Record = { "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": - _createOrUpdateDeserialize, + _mongoClustersCreateOrUpdateDeserialize, "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": - _updateDeserialize, + _mongoClustersUpdateDeserialize, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}": - _$deleteDeserialize, + _mongoClustersDeleteDeserialize, "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}": - _createOrUpdateDeserializeFirewallRules, + _firewallRulesCreateOrUpdateDeserialize, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}": - _$deleteDeserializeFirewallRules, + _firewallRulesDeleteDeserialize, "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}": - _createDeserialize, + _privateEndpointConnectionsCreateDeserialize, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}": - _$deleteDeserializePrivateEndpointConnections, + _privateEndpointConnectionsDeleteDeserialize, }; function getDeserializationHelper( 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..344657d6f17e --- /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 a0b689456cb9..231e0b7c22fa 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts @@ -1,23 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { - Recorder, - RecorderStartOptions, - VitestTestContext, -} from "@azure-tools/test-recorder"; +import { Context } from "mocha"; +import { Recorder, RecorderStartOptions } from "@azure-tools/test-recorder"; - -const replaceableVariables: Record = { - SUBSCRIPTION_ID: "azure_subscription_id" +const envSetupForPlayback: Record = { + ENDPOINT: "https://endpoint", + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id", }; 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 - ], + envSetupForPlayback, }; /** @@ -25,8 +21,8 @@ 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 { - const recorder = new Recorder(context); +export async function createRecorder(context: Context): Promise { + const recorder = new Recorder(context.currentTest); await recorder.start(recorderEnvSetup); return recorder; } diff --git a/sdk/mongocluster/arm-mongocluster/tsp-location.yaml b/sdk/mongocluster/arm-mongocluster/tsp-location.yaml new file mode 100644 index 000000000000..42a3e3cc15ee --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/tsp-location.yaml @@ -0,0 +1,3 @@ +directory: specification/mongocluster/DocumentDB.MongoCluster.Management +commit: abad0096677005817d2c19df2364663e5583c8fc +repo: Azure/azure-rest-api-specs diff --git a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts index eda90c3ea96b..cc2bbfc362c0 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts @@ -32,6 +32,5 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage-browser", }, - testTimeout: 1200000, }, }); diff --git a/sdk/mongocluster/arm-mongocluster/vitest.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.config.ts index 7928f980b01c..367c90fa4e72 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.config.ts @@ -28,6 +28,5 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage", }, - testTimeout: 1200000, }, }); From deaecdacbf03c538b953574c6592c3d3aeea4d0e Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:28:21 +0800 Subject: [PATCH 09/23] Update README.md --- sdk/mongocluster/arm-mongocluster/README.md | 94 ++++++++++++++++----- 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/README.md b/sdk/mongocluster/arm-mongocluster/README.md index e0cc5eba9bf4..6a44bd447e4e 100644 --- a/sdk/mongocluster/arm-mongocluster/README.md +++ b/sdk/mongocluster/arm-mongocluster/README.md @@ -1,46 +1,78 @@ -# Azure MongoClusterManagement REST client library for JavaScript +# Azure MongoClusterManagement client library for JavaScript -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. - -**If you are not familiar with our REST client, please spend 5 minutes to take a look at our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library, the REST client provides a light-weighted & developer friendly way to call azure rest api +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MongoClusterManagement client. -Key links: +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. -- [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) +[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) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started ### Currently supported environments -- LTS versions of Node.js +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. ### Prerequisites -- You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package. +- An [Azure subscription][azure_sub]. ### Install the `@azure/arm-mongocluster` package -Install the Azure MongoClusterManagement REST client REST client library for JavaScript with `npm`: +Install the Azure MongoClusterManagement client library for JavaScript with `npm`: ```bash npm install @azure/arm-mongocluster ``` -### Create and authenticate a `DocumentDBClient` +### Create and authenticate a `MongoClusterManagementClient` -To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), -provide an instance of the desired credential type obtained from the -[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library. +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]. -To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +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 { 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); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new MongoClusterManagementClient(credential, subscriptionId); +``` -After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use. -As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) -can be used to authenticate the client. -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 +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### MongoClusterManagementClient + +`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. ## Troubleshooting @@ -50,8 +82,28 @@ Enabling logging may help uncover useful information about failures. In order to ```javascript const { setLogLevel } = require("@azure/logger"); - setLogLevel("info"); ``` For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmongocluster%2Farm-mongocluster%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential From db3b91aa38ebacc959b775212d853e489e259122 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:36:03 +0800 Subject: [PATCH 10/23] ypdate --- common/config/rush/pnpm-lock.yaml | 12 +- .../arm-mongocluster/.tshy/browser.json | 12 + .../arm-mongocluster/.tshy/build.json | 8 + .../arm-mongocluster/.tshy/commonjs.json | 14 + .../arm-mongocluster/.tshy/esm.json | 12 + .../arm-mongocluster/.tshy/react-native.json | 12 + .../arm-mongocluster/CHANGELOG.md | 5 + sdk/mongocluster/arm-mongocluster/assets.json | 6 + .../arm-mongocluster/package.json | 101 ++++- .../review/arm-mongocluster-api.api.md | 88 ++++ .../review/arm-mongocluster-models.api.md | 341 +++++++++++++++ .../review/arm-mongocluster.api.md | 412 ++++++++++++++++++ .../test/public/sampleTest.spec.ts | 21 - .../test/public/utils/recordedClient.ts | 26 +- 14 files changed, 1026 insertions(+), 44 deletions(-) create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/browser.json create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/build.json create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/esm.json create mode 100644 sdk/mongocluster/arm-mongocluster/.tshy/react-native.json create mode 100644 sdk/mongocluster/arm-mongocluster/CHANGELOG.md create mode 100644 sdk/mongocluster/arm-mongocluster/assets.json create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md create mode 100644 sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md delete mode 100644 sdk/mongocluster/arm-mongocluster/test/public/sampleTest.spec.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index b3303f0352a1..7fad2288928e 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1471,8 +1471,8 @@ packages: tslib: 2.6.3 dev: false - /@azure/core-lro@3.0.0-beta.1: - resolution: {integrity: sha512-KbkVHWhLnlDQRtIZGCPQFB6y2xgeL7p5iICRYTCDjHBpWX9W/I3HkkvbvK4SordNsKwWbLKfPLrOJKJdsJocEQ==} + /@azure/core-lro@3.0.0: + resolution: {integrity: sha512-t46lsD0jDJ1o71hIGzoUfT9jH+rIkNJAJLhhPqW8XLbPueHBnP4x5PNJ2szXlLoztH/00OcUUH3FbFnAntOSWA==} engines: {node: '>=18.0.0'} dependencies: '@azure/abort-controller': 2.1.2 @@ -1481,8 +1481,8 @@ packages: tslib: 2.6.3 dev: false - /@azure/core-lro@3.0.0-beta.2: - resolution: {integrity: sha512-8WwZaYHwgp04oA4bnJcjgoHg9Aty4k/fu1EUhaC+r7OhiPwLNKchaY7NH4Z6KqSS8MpFOjmdUjCPcgyAvtweJQ==} + /@azure/core-lro@3.0.0-beta.1: + resolution: {integrity: sha512-KbkVHWhLnlDQRtIZGCPQFB6y2xgeL7p5iICRYTCDjHBpWX9W/I3HkkvbvK4SordNsKwWbLKfPLrOJKJdsJocEQ==} engines: {node: '>=18.0.0'} dependencies: '@azure/abort-controller': 2.1.2 @@ -16043,11 +16043,11 @@ packages: dev: false file:projects/arm-mongocluster.tgz: - resolution: {integrity: sha512-VJleC60ppgS9axs4zfzjpIEqk00hyCGB8ncEaSnI80AMCkKDysH8MGNP+cIY6SvHV+/k6h/H6Dvr/wHLvoRgFw==, tarball: file:projects/arm-mongocluster.tgz} + resolution: {integrity: sha512-L8p3L1XXqyZdjf1wAFxkm0exRmusKT5K2YONRLTprcW3fGOIZDg+0oPvgRdQEPztctrSUunflmW7XY/T4EN3yw==, tarball: file:projects/arm-mongocluster.tgz} name: '@rush-temp/arm-mongocluster' version: 0.0.0 dependencies: - '@azure/core-lro': 3.0.0-beta.2 + '@azure/core-lro': 3.0.0 '@microsoft/api-extractor': 7.47.0(@types/node@18.19.39) '@types/node': 18.19.39 '@vitest/browser': 1.6.0(playwright@1.44.1)(vitest@1.6.0) diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/browser.json b/sdk/mongocluster/arm-mongocluster/.tshy/browser.json new file mode 100644 index 000000000000..32e74e04ec62 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/browser.json @@ -0,0 +1,12 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.mts", + "../src/**/*.tsx" + ], + "exclude": [], + "compilerOptions": { + "outDir": "../.tshy-build/browser" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/build.json b/sdk/mongocluster/arm-mongocluster/.tshy/build.json new file mode 100644 index 000000000000..aea1a9e93b5d --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/build.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "rootDir": "../src", + "module": "nodenext", + "moduleResolution": "nodenext" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json b/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json new file mode 100644 index 000000000000..5ace94d041f3 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json @@ -0,0 +1,14 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.cts", + "../src/**/*.tsx" + ], + "exclude": [ + "../src/**/*.mts" + ], + "compilerOptions": { + "outDir": "../.tshy-build/commonjs" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/esm.json b/sdk/mongocluster/arm-mongocluster/.tshy/esm.json new file mode 100644 index 000000000000..ff5264e692d1 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/esm.json @@ -0,0 +1,12 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.mts", + "../src/**/*.tsx" + ], + "exclude": [], + "compilerOptions": { + "outDir": "../.tshy-build/esm" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json b/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json new file mode 100644 index 000000000000..f431a06985d8 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json @@ -0,0 +1,12 @@ +{ + "extends": "./build.json", + "include": [ + "../src/**/*.ts", + "../src/**/*.mts", + "../src/**/*.tsx" + ], + "exclude": [], + "compilerOptions": { + "outDir": "../.tshy-build/react-native" + } +} diff --git a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md new file mode 100644 index 000000000000..e6d4d7a2134a --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (2024-07-01) + +The package of @azure/arm-mongocluster is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/mongocluster/arm-mongocluster/assets.json b/sdk/mongocluster/arm-mongocluster/assets.json new file mode 100644 index 000000000000..5c6202b15f7f --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "js", + "TagPrefix": "js/mongocluster/arm-mongocluster", + "Tag": "js/mongocluster/arm-mongocluster_04a66e31c1" +} diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index e173200bed68..2457c5ea514b 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.0-beta.1", + "version": "1.0.0", "description": "DocumentDB MongoCluster Service", "engines": { "node": ">=18.0.0" @@ -14,15 +14,33 @@ "./api": "./src/api/index.ts", "./models": "./src/models/index.ts" }, - "dialects": ["esm", "commonjs"], - "esmDialects": ["browser", "react-native"], + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], "selfLink": false }, "type": "module", - "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], + "keywords": [ + "node", + "azure", + "cloud", + "typescript", + "browser", + "isomorphic" + ], "author": "Microsoft Corporation", "license": "MIT", - "files": ["dist", "README.md", "LICENSE", "review/*"], + "files": [ + "dist", + "README.md", + "LICENSE", + "review/*" + ], "sdk-type": "client", "repository": "github:Azure/azure-sdk-for-js", "bugs": { @@ -92,5 +110,76 @@ "build": "npm run clean && tshy && mkdirp ./review && dev-tool run extract-api", "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", "test": "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test" - } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "source": "./src/index.ts", + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "source": "./src/index.ts", + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "source": "./src/index.ts", + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "source": "./src/index.ts", + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./api": { + "browser": { + "source": "./src/api/index.ts", + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "source": "./src/api/index.ts", + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "source": "./src/api/index.ts", + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "source": "./src/api/index.ts", + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./models": { + "browser": { + "source": "./src/models/index.ts", + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "source": "./src/models/index.ts", + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "source": "./src/models/index.ts", + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "source": "./src/models/index.ts", + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts" } diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md new file mode 100644 index 000000000000..7260e25e996f --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md @@ -0,0 +1,88 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; +import { HttpResponse } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { Paged } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import { RequestParameters } from '@azure-rest/core-client'; +import { StreamableMethod } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export function createDocumentDB(credential: TokenCredential, options?: DocumentDBClientOptions): DocumentDBContext; + +// @public +export interface DocumentDBClientOptions extends ClientOptions { + apiVersion?: string; +} + +// @public (undocumented) +export type DocumentDBContext = Client & { + path: Routes; +}; + +// @public +export function firewallRulesCreateOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule_2, options?: FirewallRulesCreateOrUpdateOptionalParams): PollerLike, FirewallRule_2>; + +// @public +export function firewallRulesDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams): PollerLike, void>; + +// @public +export function firewallRulesGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams): Promise; + +// @public +export function firewallRulesListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public +export function mongoClustersCheckNameAvailability(context: DocumentDBContext, subscriptionId: string, location: string, body: CheckNameAvailabilityRequest_2, options?: MongoClustersCheckNameAvailabilityOptionalParams): Promise; + +// @public +export function mongoClustersCreateOrUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, resource: MongoCluster_2, options?: MongoClustersCreateOrUpdateOptionalParams): PollerLike, MongoCluster_2>; + +// @public +export function mongoClustersDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams): PollerLike, void>; + +// @public +export function mongoClustersGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams): Promise; + +// @public +export function mongoClustersList(context: DocumentDBContext, subscriptionId: string, options?: MongoClustersListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function mongoClustersListByResourceGroup(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function mongoClustersListConnectionStrings(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams): Promise; + +// @public +export function mongoClustersUpdate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate_2, options?: MongoClustersUpdateOptionalParams): PollerLike, MongoCluster_2>; + +// @public +export function operationsList(context: DocumentDBContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function privateEndpointConnectionsCreate(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, PrivateEndpointConnectionResource_2>; + +// @public +export function privateEndpointConnectionsDelete(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): PollerLike, void>; + +// @public +export function privateEndpointConnectionsGet(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; + +// @public +export function privateEndpointConnectionsListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// @public +export function privateLinksListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md new file mode 100644 index 000000000000..3161ea40f2e4 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md @@ -0,0 +1,341 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { OperationOptions } from '@azure-rest/core-client'; + +// @public +export type ActionType = "Internal"; + +// @public +export type CheckNameAvailabilityReason = "Invalid" | "AlreadyExists"; + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: CheckNameAvailabilityReason; +} + +// @public +export interface ConnectionString { + readonly connectionString?: string; + readonly description?: string; +} + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +export type CreatedByType = "User" | "Application" | "ManagedIdentity" | "Key"; + +// @public +export type CreateMode = "Default" | "PointInTimeRestore"; + +// @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; +} + +// @public +export interface FirewallRuleProperties { + endIpAddress: string; + readonly provisioningState?: ProvisioningState; + startIpAddress: string; +} + +// @public +export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface FirewallRulesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface FirewallRulesGetOptionalParams extends OperationOptions { +} + +// @public +export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public +export interface ListConnectionStringsResult { + readonly connectionStrings?: ConnectionString[]; +} + +// @public +export interface MongoCluster extends TrackedResource { + properties?: MongoClusterProperties; +} + +// @public +export interface MongoClusterProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + readonly clusterStatus?: MongoClusterStatus; + readonly connectionString?: string; + createMode?: CreateMode; + readonly earliestRestoreTime?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly provisioningState?: ProvisioningState; + publicNetworkAccess?: PublicNetworkAccess; + restoreParameters?: MongoClusterRestoreParameters; + serverVersion?: string; +} + +// @public +export interface MongoClusterRestoreParameters { + pointInTimeUTC?: Date; + 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 type MongoClusterStatus = "Ready" | "Provisioning" | "Updating" | "Starting" | "Stopping" | "Stopped" | "Dropping"; + +// @public +export interface MongoClustersUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface MongoClusterUpdate { + // (undocumented) + properties?: MongoClusterUpdateProperties; + tags?: Record; +} + +// @public +export interface MongoClusterUpdateProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + publicNetworkAccess?: PublicNetworkAccess; + serverVersion?: string; +} + +// @public +export interface NodeGroupSpec { + diskSizeGB?: number; + enableHa?: boolean; + kind?: NodeKind; + nodeCount?: number; + sku?: string; +} + +// @public +export type NodeKind = "Shard"; + +// @public +export interface Operation { + actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationsListOptionalParams extends OperationOptions { +} + +// @public +export type Origin = "user" | "system" | "user,system"; + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export interface PrivateEndpointConnection extends Resource { + properties?: PrivateEndpointConnectionProperties; +} + +// @public +export interface PrivateEndpointConnectionProperties { + readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export type PrivateEndpointConnectionProvisioningState = "Succeeded" | "Creating" | "Deleting" | "Failed"; + +// @public +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 = "Pending" | "Approved" | "Rejected"; + +// @public +export interface PrivateLinkResource extends ProxyResource { + properties?: PrivateLinkResourceProperties; +} + +// @public +export interface PrivateLinkResourceProperties { + readonly groupId?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; +} + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateEndpointServiceConnectionStatus; +} + +// @public +export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public +export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type PublicNetworkAccess = "Enabled" | "Disabled"; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export type Versions = "2024-03-01-preview"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md new file mode 100644 index 000000000000..84a773163091 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md @@ -0,0 +1,412 @@ +## API Report File for "@azure/arm-mongocluster" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { AbortSignalLike } from '@azure/abort-controller'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { PollerLike } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export type ActionType = "Internal"; + +// @public +export type CheckNameAvailabilityReason = "Invalid" | "AlreadyExists"; + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: CheckNameAvailabilityReason; +} + +// @public +export interface ConnectionString { + readonly connectionString?: string; + readonly description?: string; +} + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +export type CreatedByType = "User" | "Application" | "ManagedIdentity" | "Key"; + +// @public +export type CreateMode = "Default" | "PointInTimeRestore"; + +// @public (undocumented) +export class DocumentDBClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: DocumentDBClientOptions); + readonly firewallRules: FirewallRulesOperations; + readonly mongoClusters: MongoClustersOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + readonly privateLinks: PrivateLinksOperations; +} + +// @public +export interface DocumentDBClientOptions extends ClientOptions { + apiVersion?: 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; +} + +// @public +export interface FirewallRuleProperties { + endIpAddress: string; + readonly provisioningState?: ProvisioningState; + startIpAddress: string; +} + +// @public +export interface FirewallRulesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface FirewallRulesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface FirewallRulesGetOptionalParams extends OperationOptions { +} + +// @public +export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public +export interface FirewallRulesOperations { + createOrUpdate: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, resource: FirewallRule, options?: FirewallRulesCreateOrUpdateOptionalParams) => PollerLike, FirewallRule>; + delete: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, mongoClusterName: string, firewallRuleName: string, options?: FirewallRulesGetOptionalParams) => Promise; + listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export interface ListConnectionStringsResult { + readonly connectionStrings?: ConnectionString[]; +} + +// @public +export interface MongoCluster extends TrackedResource { + properties?: MongoClusterProperties; +} + +// @public +export interface MongoClusterProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + readonly clusterStatus?: MongoClusterStatus; + readonly connectionString?: string; + createMode?: CreateMode; + readonly earliestRestoreTime?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly provisioningState?: ProvisioningState; + publicNetworkAccess?: PublicNetworkAccess; + restoreParameters?: MongoClusterRestoreParameters; + serverVersion?: string; +} + +// @public +export interface MongoClusterRestoreParameters { + pointInTimeUTC?: Date; + 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 MongoClustersOperations { + checkNameAvailability: (location: string, body: CheckNameAvailabilityRequest, options?: MongoClustersCheckNameAvailabilityOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, mongoClusterName: string, resource: MongoCluster, options?: MongoClustersCreateOrUpdateOptionalParams) => PollerLike, MongoCluster>; + delete: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersGetOptionalParams) => Promise; + list: (options?: MongoClustersListOptionalParams) => PagedAsyncIterableIterator; + listByResourceGroup: (resourceGroupName: string, options?: MongoClustersListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listConnectionStrings: (resourceGroupName: string, mongoClusterName: string, options?: MongoClustersListConnectionStringsOptionalParams) => Promise; + update: (resourceGroupName: string, mongoClusterName: string, properties: MongoClusterUpdate, options?: MongoClustersUpdateOptionalParams) => PollerLike, MongoCluster>; +} + +// @public +export type MongoClusterStatus = "Ready" | "Provisioning" | "Updating" | "Starting" | "Stopping" | "Stopped" | "Dropping"; + +// @public +export interface MongoClustersUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface MongoClusterUpdate { + // (undocumented) + properties?: MongoClusterUpdateProperties; + tags?: Record; +} + +// @public +export interface MongoClusterUpdateProperties { + administratorLogin?: string; + administratorLoginPassword?: string; + nodeGroupSpecs?: NodeGroupSpec[]; + publicNetworkAccess?: PublicNetworkAccess; + serverVersion?: string; +} + +// @public +export interface NodeGroupSpec { + diskSizeGB?: number; + enableHa?: boolean; + kind?: NodeKind; + nodeCount?: number; + sku?: string; +} + +// @public +export type NodeKind = "Shard"; + +// @public +export interface Operation { + actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationsListOptionalParams extends OperationOptions { +} + +// @public +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type Origin = "user" | "system" | "user,system"; + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export interface PrivateEndpointConnection extends Resource { + properties?: PrivateEndpointConnectionProperties; +} + +// @public +export interface PrivateEndpointConnectionProperties { + readonly groupIds?: string[]; + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export type PrivateEndpointConnectionProvisioningState = "Succeeded" | "Creating" | "Deleting" | "Failed"; + +// @public +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 interface PrivateEndpointConnectionsOperations { + create: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams) => PollerLike, PrivateEndpointConnectionResource>; + delete: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, mongoClusterName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams) => Promise; + listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateEndpointConnectionsListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type PrivateEndpointServiceConnectionStatus = "Pending" | "Approved" | "Rejected"; + +// @public +export interface PrivateLinkResource extends ProxyResource { + properties?: PrivateLinkResourceProperties; +} + +// @public +export interface PrivateLinkResourceProperties { + readonly groupId?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; +} + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateEndpointServiceConnectionStatus; +} + +// @public +export interface PrivateLinksListByMongoClusterOptionalParams extends OperationOptions { +} + +// @public +export interface PrivateLinksOperations { + listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: PrivateLinksListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type ProvisioningState = string | ResourceProvisioningState | "InProgress" | "Updating" | "Dropping"; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type PublicNetworkAccess = "Enabled" | "Disabled"; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; + +// @public +export function restorePoller(client: DocumentDBClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export type Versions = "2024-03-01-preview"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/mongocluster/arm-mongocluster/test/public/sampleTest.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/sampleTest.spec.ts deleted file mode 100644 index 344657d6f17e..000000000000 --- a/sdk/mongocluster/arm-mongocluster/test/public/sampleTest.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -// 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 231e0b7c22fa..a0b689456cb9 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/utils/recordedClient.ts @@ -1,19 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { Context } from "mocha"; -import { Recorder, RecorderStartOptions } from "@azure-tools/test-recorder"; +import { + Recorder, + RecorderStartOptions, + VitestTestContext, +} from "@azure-tools/test-recorder"; -const envSetupForPlayback: Record = { - ENDPOINT: "https://endpoint", - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id", + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id" }; const recorderEnvSetup: RecorderStartOptions = { - envSetupForPlayback, + 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 + ], }; /** @@ -21,8 +25,8 @@ 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: Context): Promise { - const recorder = new Recorder(context.currentTest); +export async function createRecorder(context: VitestTestContext): Promise { + const recorder = new Recorder(context); await recorder.start(recorderEnvSetup); return recorder; } From d2617c71b4f275f94c90d97a8769594e29bef450 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:44:37 +0800 Subject: [PATCH 11/23] add timeout --- sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts | 1 + sdk/mongocluster/arm-mongocluster/vitest.config.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts index cc2bbfc362c0..eda90c3ea96b 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts @@ -32,5 +32,6 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage-browser", }, + testTimeout: 1200000, }, }); diff --git a/sdk/mongocluster/arm-mongocluster/vitest.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.config.ts index 367c90fa4e72..7928f980b01c 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.config.ts @@ -28,5 +28,6 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage", }, + testTimeout: 1200000, }, }); From 13df5ae52cb2b176a620f7177f8a8e0d3bc33184 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:06:36 +0800 Subject: [PATCH 12/23] update code with experimentalExtensibleEnums: true --- sdk/mongocluster/arm-mongocluster/README.md | 94 ++----- .../arm-mongocluster/package.json | 2 +- .../review/arm-mongocluster-api.api.md | 12 +- .../review/arm-mongocluster-models.api.md | 98 ++++++- .../review/arm-mongocluster.api.md | 132 +++++++-- .../src/api/firewallRules/index.ts | 23 +- .../arm-mongocluster/src/api/index.ts | 6 +- ...xt.ts => mongoClusterManagementContext.ts} | 6 +- .../src/api/mongoClusters/index.ts | 216 ++++++--------- .../src/api/operations/index.ts | 11 +- .../api/privateEndpointConnections/index.ts | 55 ++-- .../src/api/privateLinks/index.ts | 7 +- .../src/classic/firewallRules/index.ts | 2 +- .../src/classic/mongoClusters/index.ts | 2 +- .../src/classic/operations/index.ts | 2 +- .../privateEndpointConnections/index.ts | 2 +- .../src/classic/privateLinks/index.ts | 2 +- .../arm-mongocluster/src/index.ts | 17 +- .../arm-mongocluster/src/models/index.ts | 11 + .../arm-mongocluster/src/models/models.ts | 256 +++++++++++++++--- ...ent.ts => mongoClusterManagementClient.ts} | 12 +- .../src/restorePollerHelpers.ts | 4 +- .../mongocluster_operations_test.spec.ts | 2 +- .../arm-mongocluster/vitest.browser.config.ts | 1 - .../arm-mongocluster/vitest.config.ts | 1 - 25 files changed, 589 insertions(+), 387 deletions(-) rename sdk/mongocluster/arm-mongocluster/src/api/{documentDBContext.ts => mongoClusterManagementContext.ts} (81%) rename sdk/mongocluster/arm-mongocluster/src/{documentDBClient.ts => mongoClusterManagementClient.ts} (87%) diff --git a/sdk/mongocluster/arm-mongocluster/README.md b/sdk/mongocluster/arm-mongocluster/README.md index 6a44bd447e4e..e0cc5eba9bf4 100644 --- a/sdk/mongocluster/arm-mongocluster/README.md +++ b/sdk/mongocluster/arm-mongocluster/README.md @@ -1,78 +1,46 @@ -# Azure MongoClusterManagement client library for JavaScript - -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MongoClusterManagement client. +# Azure MongoClusterManagement REST client library for JavaScript 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) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +**If you are not familiar with our REST client, please spend 5 minutes to take a look at our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library, the REST client provides a light-weighted & developer friendly way to call azure rest api + +Key links: + +- [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 ### Currently supported environments -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) -- Latest versions of Safari, Chrome, Edge and Firefox. - -See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. +- LTS versions of Node.js ### Prerequisites -- An [Azure subscription][azure_sub]. +- You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package. ### Install the `@azure/arm-mongocluster` package -Install the Azure MongoClusterManagement client library for JavaScript with `npm`: +Install the Azure MongoClusterManagement REST client REST client library for JavaScript with `npm`: ```bash 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]. +To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), +provide an instance of the desired credential type obtained from the +[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library. -You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). - -To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: - -```bash -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 { 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); - -// For client-side applications running in the browser, use this code instead: -// const credential = new InteractiveBrowserCredential({ -// tenantId: "", -// clientId: "" -// }); -// const client = new MongoClusterManagementClient(credential, subscriptionId); -``` +To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) +After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use. +As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) +can be used to authenticate the client. -### JavaScript Bundle -To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). - -## Key concepts - -### MongoClusterManagementClient - -`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. +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 ## Troubleshooting @@ -82,28 +50,8 @@ Enabling logging may help uncover useful information about failures. In order to ```javascript const { setLogLevel } = require("@azure/logger"); + setLogLevel("info"); ``` For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). - -## Next steps - -Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. - -## Contributing - -If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. - -## Related projects - -- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmongocluster%2Farm-mongocluster%2FREADME.png) - -[azure_cli]: https://docs.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ -[azure_sub]: https://azure.microsoft.com/free/ -[azure_portal]: https://portal.azure.com -[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity -[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index 2457c5ea514b..015cc29a3bca 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.0", + "version": "1.0.0-beta.1", "description": "DocumentDB MongoCluster Service", "engines": { "node": ">=18.0.0" diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md index 7260e25e996f..9a29fa4ab178 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md @@ -17,12 +17,7 @@ import { StreamableMethod } from '@azure-rest/core-client'; import { TokenCredential } from '@azure/core-auth'; // @public -export function createDocumentDB(credential: TokenCredential, options?: DocumentDBClientOptions): DocumentDBContext; - -// @public -export interface DocumentDBClientOptions extends ClientOptions { - apiVersion?: string; -} +export function createMongoClusterManagement(credential: TokenCredential, options?: MongoClusterManagementClientOptions): DocumentDBContext; // @public (undocumented) export type DocumentDBContext = Client & { @@ -41,6 +36,11 @@ export function firewallRulesGet(context: DocumentDBContext, subscriptionId: str // @public export function firewallRulesListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; +// @public +export interface MongoClusterManagementClientOptions extends ClientOptions { + apiVersion?: string; +} + // @public export function mongoClustersCheckNameAvailability(context: DocumentDBContext, subscriptionId: string, location: string, body: CheckNameAvailabilityRequest_2, options?: MongoClustersCheckNameAvailabilityOptionalParams): Promise; 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 3161ea40f2e4..58c737d81839 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-models.api.md @@ -7,10 +7,10 @@ import { OperationOptions } from '@azure-rest/core-client'; // @public -export type ActionType = "Internal"; +export type ActionType = string; // @public -export type CheckNameAvailabilityReason = "Invalid" | "AlreadyExists"; +export type CheckNameAvailabilityReason = string; // @public export interface CheckNameAvailabilityRequest { @@ -37,10 +37,10 @@ export type ContinuablePage = TPage & { }; // @public -export type CreatedByType = "User" | "Application" | "ManagedIdentity" | "Key"; +export type CreatedByType = string; // @public -export type CreateMode = "Default" | "PointInTimeRestore"; +export type CreateMode = string; // @public export interface ErrorAdditionalInfo { @@ -92,6 +92,82 @@ export interface FirewallRulesGetOptionalParams extends OperationOptions { export interface FirewallRulesListByMongoClusterOptionalParams extends OperationOptions { } +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCheckNameAvailabilityReason { + AlreadyExists = "AlreadyExists", + Invalid = "Invalid" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownCreateMode { + Default = "Default", + PointInTimeRestore = "PointInTimeRestore" +} + +// @public +export enum KnownMongoClusterStatus { + Dropping = "Dropping", + Provisioning = "Provisioning", + Ready = "Ready", + Starting = "Starting", + Stopped = "Stopped", + Stopping = "Stopping", + Updating = "Updating" +} + +// @public +export enum KnownNodeKind { + Shard = "Shard" +} + +// @public +export enum KnownOrigin { + "user,system" = "user,system", + system = "system", + user = "user" +} + +// @public +export enum KnownPrivateEndpointConnectionProvisioningState { + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownPrivateEndpointServiceConnectionStatus { + Approved = "Approved", + Pending = "Pending", + Rejected = "Rejected" +} + +// @public +export enum KnownPublicNetworkAccess { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownResourceProvisioningState { + Canceled = "Canceled", + Failed = "Failed", + Succeeded = "Succeeded" +} + // @public export interface ListConnectionStringsResult { readonly connectionStrings?: ConnectionString[]; @@ -155,7 +231,7 @@ export interface MongoClustersListOptionalParams extends OperationOptions { } // @public -export type MongoClusterStatus = "Ready" | "Provisioning" | "Updating" | "Starting" | "Stopping" | "Stopped" | "Dropping"; +export type MongoClusterStatus = string; // @public export interface MongoClustersUpdateOptionalParams extends OperationOptions { @@ -188,7 +264,7 @@ export interface NodeGroupSpec { } // @public -export type NodeKind = "Shard"; +export type NodeKind = string; // @public export interface Operation { @@ -212,7 +288,7 @@ export interface OperationsListOptionalParams extends OperationOptions { } // @public -export type Origin = "user" | "system" | "user,system"; +export type Origin = string; // @public export interface PagedAsyncIterableIterator { @@ -245,7 +321,7 @@ export interface PrivateEndpointConnectionProperties { } // @public -export type PrivateEndpointConnectionProvisioningState = "Succeeded" | "Creating" | "Deleting" | "Failed"; +export type PrivateEndpointConnectionProvisioningState = string; // @public export interface PrivateEndpointConnectionResource extends ProxyResource { @@ -271,7 +347,7 @@ export interface PrivateEndpointConnectionsListByMongoClusterOptionalParams exte } // @public -export type PrivateEndpointServiceConnectionStatus = "Pending" | "Approved" | "Rejected"; +export type PrivateEndpointServiceConnectionStatus = string; // @public export interface PrivateLinkResource extends ProxyResource { @@ -304,7 +380,7 @@ export interface ProxyResource extends Resource { } // @public -export type PublicNetworkAccess = "Enabled" | "Disabled"; +export type PublicNetworkAccess = string; // @public export interface Resource { @@ -315,7 +391,7 @@ export interface Resource { } // @public -export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; +export type ResourceProvisioningState = string; // @public export interface SystemData { diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md index 84a773163091..1675f87cdf3d 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md @@ -14,10 +14,10 @@ import { PollerLike } from '@azure/core-lro'; import { TokenCredential } from '@azure/core-auth'; // @public -export type ActionType = "Internal"; +export type ActionType = string; // @public -export type CheckNameAvailabilityReason = "Invalid" | "AlreadyExists"; +export type CheckNameAvailabilityReason = string; // @public export interface CheckNameAvailabilityRequest { @@ -44,26 +44,10 @@ export type ContinuablePage = TPage & { }; // @public -export type CreatedByType = "User" | "Application" | "ManagedIdentity" | "Key"; +export type CreatedByType = string; // @public -export type CreateMode = "Default" | "PointInTimeRestore"; - -// @public (undocumented) -export class DocumentDBClient { - constructor(credential: TokenCredential, subscriptionId: string, options?: DocumentDBClientOptions); - readonly firewallRules: FirewallRulesOperations; - readonly mongoClusters: MongoClustersOperations; - readonly operations: OperationsOperations; - readonly pipeline: Pipeline; - readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; - readonly privateLinks: PrivateLinksOperations; -} - -// @public -export interface DocumentDBClientOptions extends ClientOptions { - apiVersion?: string; -} +export type CreateMode = string; // @public export interface ErrorAdditionalInfo { @@ -123,6 +107,82 @@ export interface FirewallRulesOperations { listByMongoCluster: (resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams) => PagedAsyncIterableIterator; } +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCheckNameAvailabilityReason { + AlreadyExists = "AlreadyExists", + Invalid = "Invalid" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownCreateMode { + Default = "Default", + PointInTimeRestore = "PointInTimeRestore" +} + +// @public +export enum KnownMongoClusterStatus { + Dropping = "Dropping", + Provisioning = "Provisioning", + Ready = "Ready", + Starting = "Starting", + Stopped = "Stopped", + Stopping = "Stopping", + Updating = "Updating" +} + +// @public +export enum KnownNodeKind { + Shard = "Shard" +} + +// @public +export enum KnownOrigin { + "user,system" = "user,system", + system = "system", + user = "user" +} + +// @public +export enum KnownPrivateEndpointConnectionProvisioningState { + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownPrivateEndpointServiceConnectionStatus { + Approved = "Approved", + Pending = "Pending", + Rejected = "Rejected" +} + +// @public +export enum KnownPublicNetworkAccess { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownResourceProvisioningState { + Canceled = "Canceled", + Failed = "Failed", + Succeeded = "Succeeded" +} + // @public export interface ListConnectionStringsResult { readonly connectionStrings?: ConnectionString[]; @@ -133,6 +193,22 @@ export interface MongoCluster extends TrackedResource { properties?: MongoClusterProperties; } +// @public (undocumented) +export class MongoClusterManagementClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: MongoClusterManagementClientOptions); + readonly firewallRules: FirewallRulesOperations; + readonly mongoClusters: MongoClustersOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly privateEndpointConnections: PrivateEndpointConnectionsOperations; + readonly privateLinks: PrivateLinksOperations; +} + +// @public +export interface MongoClusterManagementClientOptions extends ClientOptions { + apiVersion?: string; +} + // @public export interface MongoClusterProperties { administratorLogin?: string; @@ -198,7 +274,7 @@ export interface MongoClustersOperations { } // @public -export type MongoClusterStatus = "Ready" | "Provisioning" | "Updating" | "Starting" | "Stopping" | "Stopped" | "Dropping"; +export type MongoClusterStatus = string; // @public export interface MongoClustersUpdateOptionalParams extends OperationOptions { @@ -231,7 +307,7 @@ export interface NodeGroupSpec { } // @public -export type NodeKind = "Shard"; +export type NodeKind = string; // @public export interface Operation { @@ -260,7 +336,7 @@ export interface OperationsOperations { } // @public -export type Origin = "user" | "system" | "user,system"; +export type Origin = string; // @public export interface PagedAsyncIterableIterator { @@ -293,7 +369,7 @@ export interface PrivateEndpointConnectionProperties { } // @public -export type PrivateEndpointConnectionProvisioningState = "Succeeded" | "Creating" | "Deleting" | "Failed"; +export type PrivateEndpointConnectionProvisioningState = string; // @public export interface PrivateEndpointConnectionResource extends ProxyResource { @@ -327,7 +403,7 @@ export interface PrivateEndpointConnectionsOperations { } // @public -export type PrivateEndpointServiceConnectionStatus = "Pending" | "Approved" | "Rejected"; +export type PrivateEndpointServiceConnectionStatus = string; // @public export interface PrivateLinkResource extends ProxyResource { @@ -365,7 +441,7 @@ export interface ProxyResource extends Resource { } // @public -export type PublicNetworkAccess = "Enabled" | "Disabled"; +export type PublicNetworkAccess = string; // @public export interface Resource { @@ -376,10 +452,10 @@ export interface Resource { } // @public -export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; +export type ResourceProvisioningState = string; // @public -export function restorePoller(client: DocumentDBClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; +export function restorePoller(client: MongoClusterManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; // @public (undocumented) export interface RestorePollerOptions extends OperationOptions { diff --git a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts index 33217e79f686..fd091b8cd3cd 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/firewallRules/index.ts @@ -5,7 +5,6 @@ import { getLongRunningPoller } from "../pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { firewallRulePropertiesSerializer, - CreatedByType, FirewallRule, _FirewallRuleListResult, } from "../../models/models.js"; @@ -76,17 +75,13 @@ export async function _firewallRulesGetDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.[ - "createdByType" - ] as CreatedByType, + 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" - ] as CreatedByType, + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -176,17 +171,13 @@ export async function _firewallRulesCreateOrUpdateDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.[ - "createdByType" - ] as CreatedByType, + 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" - ] as CreatedByType, + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -335,15 +326,13 @@ export async function _firewallRulesListByMongoClusterDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) diff --git a/sdk/mongocluster/arm-mongocluster/src/api/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/index.ts index 501b0e175444..bd5bfb1769b5 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/index.ts @@ -2,10 +2,10 @@ // Licensed under the MIT license. export { - createDocumentDB, - DocumentDBClientOptions, + createMongoClusterManagement, + MongoClusterManagementClientOptions, DocumentDBContext, -} from "./documentDBContext.js"; +} from "./mongoClusterManagementContext.js"; export { firewallRulesGet, firewallRulesCreateOrUpdate, diff --git a/sdk/mongocluster/arm-mongocluster/src/api/documentDBContext.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts similarity index 81% rename from sdk/mongocluster/arm-mongocluster/src/api/documentDBContext.ts rename to sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts index e29e675a088b..b4c7b0642771 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/documentDBContext.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts @@ -7,7 +7,7 @@ import { DocumentDBContext } from "../rest/index.js"; import getClient from "../rest/index.js"; /** Optional parameters for the client. */ -export interface DocumentDBClientOptions extends ClientOptions { +export interface MongoClusterManagementClientOptions extends ClientOptions { /** The API version to use for this operation. */ apiVersion?: string; } @@ -15,9 +15,9 @@ export interface DocumentDBClientOptions extends ClientOptions { export { DocumentDBContext } from "../rest/index.js"; /** 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 function createDocumentDB( +export function createMongoClusterManagement( credential: TokenCredential, - options: DocumentDBClientOptions = {}, + options: MongoClusterManagementClientOptions = {}, ): DocumentDBContext { const clientContext = getClient(credential, options); return clientContext; diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts index 2cdc6c7e0238..2a33b7cff46b 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusters/index.ts @@ -6,19 +6,11 @@ import { PollerLike, OperationState } from "@azure/core-lro"; import { mongoClusterPropertiesSerializer, mongoClusterUpdatePropertiesSerializer, - CreatedByType, - PrivateEndpointServiceConnectionStatus, - PrivateEndpointConnectionProvisioningState, MongoCluster, - CreateMode, - MongoClusterStatus, - PublicNetworkAccess, - NodeKind, MongoClusterUpdate, ListConnectionStringsResult, CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, - CheckNameAvailabilityReason, _MongoClusterListResult, } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; @@ -102,17 +94,13 @@ export async function _mongoClustersGetDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.[ - "createdByType" - ] as CreatedByType, + 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" - ] as CreatedByType, + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -121,7 +109,7 @@ export async function _mongoClustersGetDeserialize( properties: !result.body.properties ? undefined : { - createMode: result.body.properties?.["createMode"] as CreateMode, + createMode: result.body.properties?.["createMode"], restoreParameters: !result.body.properties?.restoreParameters ? undefined : { @@ -147,12 +135,8 @@ export async function _mongoClustersGetDeserialize( connectionString: result.body.properties?.["connectionString"], earliestRestoreTime: result.body.properties?.["earliestRestoreTime"], provisioningState: result.body.properties?.["provisioningState"], - clusterStatus: result.body.properties?.[ - "clusterStatus" - ] as MongoClusterStatus, - publicNetworkAccess: result.body.properties?.[ - "publicNetworkAccess" - ] as PublicNetworkAccess, + clusterStatus: result.body.properties?.["clusterStatus"], + publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], nodeGroupSpecs: result.body.properties?.["nodeGroupSpecs"] === undefined ? result.body.properties?.["nodeGroupSpecs"] @@ -160,7 +144,7 @@ export async function _mongoClustersGetDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"] as NodeKind, + kind: p["kind"], nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -175,17 +159,14 @@ export async function _mongoClustersGetDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.[ - "createdByType" - ] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: + p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -199,10 +180,10 @@ export async function _mongoClustersGetDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: p.properties - ?.privateLinkServiceConnectionState[ - "status" - ] as PrivateEndpointServiceConnectionStatus, + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -212,9 +193,8 @@ export async function _mongoClustersGetDeserialize( "actionsRequired" ], }, - provisioningState: p.properties?.[ - "provisioningState" - ] as PrivateEndpointConnectionProvisioningState, + provisioningState: + p.properties?.["provisioningState"], }, }), ), @@ -296,17 +276,13 @@ export async function _mongoClustersCreateOrUpdateDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.[ - "createdByType" - ] as CreatedByType, + 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" - ] as CreatedByType, + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -315,7 +291,7 @@ export async function _mongoClustersCreateOrUpdateDeserialize( properties: !result.body.properties ? undefined : { - createMode: result.body.properties?.["createMode"] as CreateMode, + createMode: result.body.properties?.["createMode"], restoreParameters: !result.body.properties?.restoreParameters ? undefined : { @@ -341,12 +317,8 @@ export async function _mongoClustersCreateOrUpdateDeserialize( connectionString: result.body.properties?.["connectionString"], earliestRestoreTime: result.body.properties?.["earliestRestoreTime"], provisioningState: result.body.properties?.["provisioningState"], - clusterStatus: result.body.properties?.[ - "clusterStatus" - ] as MongoClusterStatus, - publicNetworkAccess: result.body.properties?.[ - "publicNetworkAccess" - ] as PublicNetworkAccess, + clusterStatus: result.body.properties?.["clusterStatus"], + publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], nodeGroupSpecs: result.body.properties?.["nodeGroupSpecs"] === undefined ? result.body.properties?.["nodeGroupSpecs"] @@ -354,7 +326,7 @@ export async function _mongoClustersCreateOrUpdateDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"] as NodeKind, + kind: p["kind"], nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -369,17 +341,14 @@ export async function _mongoClustersCreateOrUpdateDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.[ - "createdByType" - ] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: + p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -393,10 +362,10 @@ export async function _mongoClustersCreateOrUpdateDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: p.properties - ?.privateLinkServiceConnectionState[ - "status" - ] as PrivateEndpointServiceConnectionStatus, + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -406,9 +375,8 @@ export async function _mongoClustersCreateOrUpdateDeserialize( "actionsRequired" ], }, - provisioningState: p.properties?.[ - "provisioningState" - ] as PrivateEndpointConnectionProvisioningState, + provisioningState: + p.properties?.["provisioningState"], }, }), ), @@ -499,17 +467,13 @@ export async function _mongoClustersUpdateDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.[ - "createdByType" - ] as CreatedByType, + 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" - ] as CreatedByType, + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -518,7 +482,7 @@ export async function _mongoClustersUpdateDeserialize( properties: !result.body.properties ? undefined : { - createMode: result.body.properties?.["createMode"] as CreateMode, + createMode: result.body.properties?.["createMode"], restoreParameters: !result.body.properties?.restoreParameters ? undefined : { @@ -544,12 +508,8 @@ export async function _mongoClustersUpdateDeserialize( connectionString: result.body.properties?.["connectionString"], earliestRestoreTime: result.body.properties?.["earliestRestoreTime"], provisioningState: result.body.properties?.["provisioningState"], - clusterStatus: result.body.properties?.[ - "clusterStatus" - ] as MongoClusterStatus, - publicNetworkAccess: result.body.properties?.[ - "publicNetworkAccess" - ] as PublicNetworkAccess, + clusterStatus: result.body.properties?.["clusterStatus"], + publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], nodeGroupSpecs: result.body.properties?.["nodeGroupSpecs"] === undefined ? result.body.properties?.["nodeGroupSpecs"] @@ -557,7 +517,7 @@ export async function _mongoClustersUpdateDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"] as NodeKind, + kind: p["kind"], nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -572,17 +532,14 @@ export async function _mongoClustersUpdateDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.[ - "createdByType" - ] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: + p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -596,10 +553,10 @@ export async function _mongoClustersUpdateDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: p.properties - ?.privateLinkServiceConnectionState[ - "status" - ] as PrivateEndpointServiceConnectionStatus, + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -609,9 +566,8 @@ export async function _mongoClustersUpdateDeserialize( "actionsRequired" ], }, - provisioningState: p.properties?.[ - "provisioningState" - ] as PrivateEndpointConnectionProvisioningState, + provisioningState: + p.properties?.["provisioningState"], }, }), ), @@ -742,15 +698,13 @@ export async function _mongoClustersListByResourceGroupDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -759,7 +713,7 @@ export async function _mongoClustersListByResourceGroupDeserialize( properties: !p.properties ? undefined : { - createMode: p.properties?.["createMode"] as CreateMode, + createMode: p.properties?.["createMode"], restoreParameters: !p.properties?.restoreParameters ? undefined : { @@ -780,12 +734,8 @@ export async function _mongoClustersListByResourceGroupDeserialize( connectionString: p.properties?.["connectionString"], earliestRestoreTime: p.properties?.["earliestRestoreTime"], provisioningState: p.properties?.["provisioningState"], - clusterStatus: p.properties?.[ - "clusterStatus" - ] as MongoClusterStatus, - publicNetworkAccess: p.properties?.[ - "publicNetworkAccess" - ] as PublicNetworkAccess, + clusterStatus: p.properties?.["clusterStatus"], + publicNetworkAccess: p.properties?.["publicNetworkAccess"], nodeGroupSpecs: p.properties?.["nodeGroupSpecs"] === undefined ? p.properties?.["nodeGroupSpecs"] @@ -793,7 +743,7 @@ export async function _mongoClustersListByResourceGroupDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"] as NodeKind, + kind: p["kind"], nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -807,17 +757,14 @@ export async function _mongoClustersListByResourceGroupDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.[ - "createdByType" - ] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: + p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -831,10 +778,10 @@ export async function _mongoClustersListByResourceGroupDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: p.properties - ?.privateLinkServiceConnectionState[ - "status" - ] as PrivateEndpointServiceConnectionStatus, + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -844,9 +791,8 @@ export async function _mongoClustersListByResourceGroupDeserialize( "actionsRequired" ], }, - provisioningState: p.properties?.[ - "provisioningState" - ] as PrivateEndpointConnectionProvisioningState, + provisioningState: + p.properties?.["provisioningState"], }, })), }, @@ -911,15 +857,13 @@ export async function _mongoClustersListDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -928,7 +872,7 @@ export async function _mongoClustersListDeserialize( properties: !p.properties ? undefined : { - createMode: p.properties?.["createMode"] as CreateMode, + createMode: p.properties?.["createMode"], restoreParameters: !p.properties?.restoreParameters ? undefined : { @@ -949,12 +893,8 @@ export async function _mongoClustersListDeserialize( connectionString: p.properties?.["connectionString"], earliestRestoreTime: p.properties?.["earliestRestoreTime"], provisioningState: p.properties?.["provisioningState"], - clusterStatus: p.properties?.[ - "clusterStatus" - ] as MongoClusterStatus, - publicNetworkAccess: p.properties?.[ - "publicNetworkAccess" - ] as PublicNetworkAccess, + clusterStatus: p.properties?.["clusterStatus"], + publicNetworkAccess: p.properties?.["publicNetworkAccess"], nodeGroupSpecs: p.properties?.["nodeGroupSpecs"] === undefined ? p.properties?.["nodeGroupSpecs"] @@ -962,7 +902,7 @@ export async function _mongoClustersListDeserialize( sku: p["sku"], diskSizeGB: p["diskSizeGB"], enableHa: p["enableHa"], - kind: p["kind"] as NodeKind, + kind: p["kind"], nodeCount: p["nodeCount"], })), privateEndpointConnections: @@ -976,17 +916,14 @@ export async function _mongoClustersListDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.[ - "createdByType" - ] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: + p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -1000,10 +937,10 @@ export async function _mongoClustersListDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: p.properties - ?.privateLinkServiceConnectionState[ - "status" - ] as PrivateEndpointServiceConnectionStatus, + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], description: p.properties?.privateLinkServiceConnectionState[ "description" @@ -1013,9 +950,8 @@ export async function _mongoClustersListDeserialize( "actionsRequired" ], }, - provisioningState: p.properties?.[ - "provisioningState" - ] as PrivateEndpointConnectionProvisioningState, + provisioningState: + p.properties?.["provisioningState"], }, })), }, @@ -1135,7 +1071,7 @@ export async function _mongoClustersCheckNameAvailabilityDeserialize( return { nameAvailable: result.body["nameAvailable"], - reason: result.body["reason"] as CheckNameAvailabilityReason, + reason: result.body["reason"], message: result.body["message"], }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts index d33b67beafd5..2283aeabb7a2 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/operations/index.ts @@ -1,12 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { - Operation, - Origin, - ActionType, - _OperationListResult, -} from "../../models/models.js"; +import { Operation, _OperationListResult } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "../pagingHelpers.js"; import { @@ -50,8 +45,8 @@ export async function _operationsListDeserialize( operation: p.display?.["operation"], description: p.display?.["description"], }, - origin: p["origin"] as Origin, - actionType: p["actionType"] as ActionType, + origin: p["origin"], + actionType: p["actionType"], })), nextLink: result.body["nextLink"], }; diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts index 0ce5830176a5..d6356caf7574 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateEndpointConnections/index.ts @@ -5,10 +5,7 @@ import { getLongRunningPoller } from "../pollingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { privateEndpointConnectionPropertiesSerializer, - CreatedByType, PrivateEndpointConnectionResource, - PrivateEndpointServiceConnectionStatus, - PrivateEndpointConnectionProvisioningState, _PrivateEndpointConnectionResourceListResult, } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; @@ -82,15 +79,13 @@ export async function _privateEndpointConnectionsListByMongoClusterDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) @@ -104,9 +99,7 @@ export async function _privateEndpointConnectionsListByMongoClusterDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState[ - "status" - ] as PrivateEndpointServiceConnectionStatus, + status: p.properties?.privateLinkServiceConnectionState["status"], description: p.properties?.privateLinkServiceConnectionState["description"], actionsRequired: @@ -114,9 +107,7 @@ export async function _privateEndpointConnectionsListByMongoClusterDeserialize( "actionsRequired" ], }, - provisioningState: p.properties?.[ - "provisioningState" - ] as PrivateEndpointConnectionProvisioningState, + provisioningState: p.properties?.["provisioningState"], }, })), nextLink: result.body["nextLink"], @@ -187,17 +178,13 @@ export async function _privateEndpointConnectionsGetDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.[ - "createdByType" - ] as CreatedByType, + 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" - ] as CreatedByType, + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -211,9 +198,10 @@ export async function _privateEndpointConnectionsGetDeserialize( ? undefined : { id: result.body.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: result.body.properties?.privateLinkServiceConnectionState[ - "status" - ] as PrivateEndpointServiceConnectionStatus, + status: + result.body.properties?.privateLinkServiceConnectionState[ + "status" + ], description: result.body.properties?.privateLinkServiceConnectionState[ "description" @@ -223,9 +211,7 @@ export async function _privateEndpointConnectionsGetDeserialize( "actionsRequired" ], }, - provisioningState: result.body.properties?.[ - "provisioningState" - ] as PrivateEndpointConnectionProvisioningState, + provisioningState: result.body.properties?.["provisioningState"], }, }; } @@ -306,17 +292,13 @@ export async function _privateEndpointConnectionsCreateDeserialize( ? undefined : { createdBy: result.body.systemData?.["createdBy"], - createdByType: result.body.systemData?.[ - "createdByType" - ] as CreatedByType, + 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" - ] as CreatedByType, + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: result.body.systemData?.["lastModifiedAt"] !== undefined ? new Date(result.body.systemData?.["lastModifiedAt"]) @@ -330,9 +312,10 @@ export async function _privateEndpointConnectionsCreateDeserialize( ? undefined : { id: result.body.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: result.body.properties?.privateLinkServiceConnectionState[ - "status" - ] as PrivateEndpointServiceConnectionStatus, + status: + result.body.properties?.privateLinkServiceConnectionState[ + "status" + ], description: result.body.properties?.privateLinkServiceConnectionState[ "description" @@ -342,9 +325,7 @@ export async function _privateEndpointConnectionsCreateDeserialize( "actionsRequired" ], }, - provisioningState: result.body.properties?.[ - "provisioningState" - ] as PrivateEndpointConnectionProvisioningState, + provisioningState: result.body.properties?.["provisioningState"], }, }; } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts index cd2896bef76d..99c6aa631e25 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/privateLinks/index.ts @@ -2,7 +2,6 @@ // Licensed under the MIT license. import { - CreatedByType, PrivateLinkResource, _PrivateLinkResourceListResult, } from "../../models/models.js"; @@ -61,15 +60,13 @@ export async function _privateLinksListByMongoClusterDeserialize( ? undefined : { createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"] as CreatedByType, + createdByType: p.systemData?.["createdByType"], createdAt: p.systemData?.["createdAt"] !== undefined ? new Date(p.systemData?.["createdAt"]) : undefined, lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.[ - "lastModifiedByType" - ] as CreatedByType, + lastModifiedByType: p.systemData?.["lastModifiedByType"], lastModifiedAt: p.systemData?.["lastModifiedAt"] !== undefined ? new Date(p.systemData?.["lastModifiedAt"]) diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts index bebce9a4bf3f..6ff337f450ec 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/firewallRules/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/documentDBContext.js"; +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; import { FirewallRule } from "../../models/models.js"; import { firewallRulesGet, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts index fe0aaa38335e..706e8e1492e7 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/mongoClusters/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/documentDBContext.js"; +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; import { MongoCluster, MongoClusterUpdate, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts index c19335274c10..f2380312152b 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/operations/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/documentDBContext.js"; +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; import { Operation } from "../../models/models.js"; import { operationsList } from "../../api/operations/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts index 85ec6a3e4cc9..10814cea2ead 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateEndpointConnections/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/documentDBContext.js"; +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; import { PrivateEndpointConnectionResource } from "../../models/models.js"; import { privateEndpointConnectionsListByMongoCluster, diff --git a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts index 0537d8f6ca29..0e993017854a 100644 --- a/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/classic/privateLinks/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DocumentDBContext } from "../../api/documentDBContext.js"; +import { DocumentDBContext } from "../../api/mongoClusterManagementContext.js"; import { PrivateLinkResource } from "../../models/models.js"; import { privateLinksListByMongoCluster } from "../../api/privateLinks/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; diff --git a/sdk/mongocluster/arm-mongocluster/src/index.ts b/sdk/mongocluster/arm-mongocluster/src/index.ts index ce1e63bc17c9..3e234d5677f6 100644 --- a/sdk/mongocluster/arm-mongocluster/src/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/index.ts @@ -2,13 +2,14 @@ // Licensed under the MIT license. export { - DocumentDBClient, - DocumentDBClientOptions, -} from "./documentDBClient.js"; + MongoClusterManagementClient, + MongoClusterManagementClientOptions, +} from "./mongoClusterManagementClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { Resource, SystemData, + KnownCreatedByType, CreatedByType, ProxyResource, PrivateLinkResource, @@ -20,19 +21,26 @@ export { PrivateEndpointConnectionProperties, PrivateEndpoint, PrivateLinkServiceConnectionState, + KnownPrivateEndpointServiceConnectionStatus, PrivateEndpointServiceConnectionStatus, + KnownPrivateEndpointConnectionProvisioningState, PrivateEndpointConnectionProvisioningState, FirewallRule, FirewallRuleProperties, + KnownResourceProvisioningState, ResourceProvisioningState, TrackedResource, MongoCluster, MongoClusterProperties, + KnownCreateMode, CreateMode, MongoClusterRestoreParameters, + KnownMongoClusterStatus, MongoClusterStatus, + KnownPublicNetworkAccess, PublicNetworkAccess, NodeGroupSpec, + KnownNodeKind, NodeKind, PrivateEndpointConnection, MongoClusterUpdate, @@ -41,10 +49,13 @@ export { ConnectionString, CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, + KnownCheckNameAvailabilityReason, CheckNameAvailabilityReason, Operation, OperationDisplay, + KnownOrigin, Origin, + KnownActionType, ActionType, Versions, ProvisioningState, diff --git a/sdk/mongocluster/arm-mongocluster/src/models/index.ts b/sdk/mongocluster/arm-mongocluster/src/models/index.ts index b120b670af80..1a7acb51b8ec 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/index.ts @@ -4,6 +4,7 @@ export { Resource, SystemData, + KnownCreatedByType, CreatedByType, ProxyResource, PrivateLinkResource, @@ -15,19 +16,26 @@ export { PrivateEndpointConnectionProperties, PrivateEndpoint, PrivateLinkServiceConnectionState, + KnownPrivateEndpointServiceConnectionStatus, PrivateEndpointServiceConnectionStatus, + KnownPrivateEndpointConnectionProvisioningState, PrivateEndpointConnectionProvisioningState, FirewallRule, FirewallRuleProperties, + KnownResourceProvisioningState, ResourceProvisioningState, TrackedResource, MongoCluster, MongoClusterProperties, + KnownCreateMode, CreateMode, MongoClusterRestoreParameters, + KnownMongoClusterStatus, MongoClusterStatus, + KnownPublicNetworkAccess, PublicNetworkAccess, NodeGroupSpec, + KnownNodeKind, NodeKind, PrivateEndpointConnection, MongoClusterUpdate, @@ -36,10 +44,13 @@ export { ConnectionString, CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, + KnownCheckNameAvailabilityReason, CheckNameAvailabilityReason, Operation, OperationDisplay, + KnownOrigin, Origin, + KnownActionType, ActionType, Versions, ProvisioningState, diff --git a/sdk/mongocluster/arm-mongocluster/src/models/models.ts b/sdk/mongocluster/arm-mongocluster/src/models/models.ts index 9563faaffdf9..b06a814c81a1 100644 --- a/sdk/mongocluster/arm-mongocluster/src/models/models.ts +++ b/sdk/mongocluster/arm-mongocluster/src/models/models.ts @@ -58,8 +58,29 @@ export interface SystemData { lastModifiedAt?: Date; } -/** The kind of entity that created the resource. */ -export type CreatedByType = "User" | "Application" | "ManagedIdentity" | "Key"; +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** 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** \ + * **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 {} @@ -192,17 +213,50 @@ export function privateLinkServiceConnectionStateSerializer( }; } -/** The private endpoint connection status. */ -export type PrivateEndpointServiceConnectionStatus = - | "Pending" - | "Approved" - | "Rejected"; -/** The current provisioning state. */ -export type PrivateEndpointConnectionProvisioningState = - | "Succeeded" - | "Creating" - | "Deleting" - | "Failed"; +/** Known values of {@link PrivateEndpointServiceConnectionStatus} that the service accepts. */ +export enum KnownPrivateEndpointServiceConnectionStatus { + /** Pending */ + Pending = "Pending", + /** Approved */ + Approved = "Approved", + /** Rejected */ + Rejected = "Rejected", +} + +/** + * The private endpoint connection status. \ + * {@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** + */ +export type PrivateEndpointServiceConnectionStatus = string; + +/** Known values of {@link PrivateEndpointConnectionProvisioningState} that the service accepts. */ +export enum KnownPrivateEndpointConnectionProvisioningState { + /** Succeeded */ + Succeeded = "Succeeded", + /** Creating */ + Creating = "Creating", + /** Deleting */ + Deleting = "Deleting", + /** Failed */ + Failed = "Failed", +} + +/** + * The current provisioning state. \ + * {@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** + */ +export type PrivateEndpointConnectionProvisioningState = string; /** Represents a mongo cluster firewall rule. */ export interface FirewallRule extends ProxyResource { @@ -237,8 +291,26 @@ export function firewallRulePropertiesSerializer( }; } -/** The provisioning state of a resource type. */ -export type ResourceProvisioningState = "Succeeded" | "Failed" | "Canceled"; +/** Known values of {@link ResourceProvisioningState} that the service accepts. */ +export enum KnownResourceProvisioningState { + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed", + /** Canceled */ + Canceled = "Canceled", +} + +/** + * The provisioning state of a resource type. \ + * {@link KnownResourceProvisioningState} can be used interchangeably with ResourceProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Canceled** + */ +export type ResourceProvisioningState = string; /** The response of a FirewallRule list operation. */ export interface _FirewallRuleListResult { @@ -328,8 +400,23 @@ export function mongoClusterPropertiesSerializer( }; } -/** The mode that the Mongo Cluster is created with. */ -export type CreateMode = "Default" | "PointInTimeRestore"; +/** Known values of {@link CreateMode} that the service accepts. */ +export enum KnownCreateMode { + /** Default */ + Default = "Default", + /** PointInTimeRestore */ + PointInTimeRestore = "PointInTimeRestore", +} + +/** + * The mode that the Mongo Cluster is created with. \ + * {@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** + */ +export type CreateMode = string; /** Parameters used for restore operations */ export interface MongoClusterRestoreParameters { @@ -348,17 +435,56 @@ export function mongoClusterRestoreParametersSerializer( }; } -/** The status of the Mongo cluster resource. */ -export type MongoClusterStatus = - | "Ready" - | "Provisioning" - | "Updating" - | "Starting" - | "Stopping" - | "Stopped" - | "Dropping"; -/** Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is 'Enabled' */ -export type PublicNetworkAccess = "Enabled" | "Disabled"; +/** Known values of {@link MongoClusterStatus} that the service accepts. */ +export enum KnownMongoClusterStatus { + /** Ready */ + Ready = "Ready", + /** Provisioning */ + Provisioning = "Provisioning", + /** Updating */ + Updating = "Updating", + /** Starting */ + Starting = "Starting", + /** Stopping */ + Stopping = "Stopping", + /** Stopped */ + Stopped = "Stopped", + /** Dropping */ + Dropping = "Dropping", +} + +/** + * The status of the Mongo cluster resource. \ + * {@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** + */ +export type MongoClusterStatus = string; + +/** Known values of {@link PublicNetworkAccess} that the service accepts. */ +export enum KnownPublicNetworkAccess { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled", +} + +/** + * Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is 'Enabled' \ + * {@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** + */ +export type PublicNetworkAccess = string; /** Specification for a node group. */ export interface NodeGroupSpec { @@ -386,8 +512,20 @@ export function nodeGroupSpecSerializer( }; } -/** The kind of the node on the cluster. */ -export type NodeKind = "Shard"; +/** Known values of {@link NodeKind} that the service accepts. */ +export enum KnownNodeKind { + /** Shard */ + Shard = "Shard", +} + +/** + * The kind of the node on the cluster. \ + * {@link KnownNodeKind} can be used interchangeably with NodeKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Shard** + */ +export type NodeKind = string; /** The private endpoint connection resource */ export interface PrivateEndpointConnection extends Resource { @@ -491,8 +629,23 @@ export interface CheckNameAvailabilityResponse { message?: string; } -/** Possible reasons for a name not being available. */ -export type CheckNameAvailabilityReason = "Invalid" | "AlreadyExists"; +/** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */ +export enum KnownCheckNameAvailabilityReason { + /** Invalid */ + Invalid = "Invalid", + /** AlreadyExists */ + AlreadyExists = "AlreadyExists", +} + +/** + * Possible reasons for a name not being available. \ + * {@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** + */ +export type CheckNameAvailabilityReason = string; /** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ export interface _OperationListResult { @@ -528,10 +681,41 @@ export interface OperationDisplay { description?: string; } -/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ -export type Origin = "user" | "system" | "user,system"; -/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ -export type ActionType = "Internal"; +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + /** user */ + user = "user", + /** system */ + system = "system", + /** user,system */ + "user,system" = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@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** + */ +export type Origin = string; + +/** Known values of {@link ActionType} that the service accepts. */ +export enum KnownActionType { + /** Internal */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@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** + */ +export type ActionType = string; /** The available API versions. */ export type Versions = "2024-03-01-preview"; /** Alias for ProvisioningState */ diff --git a/sdk/mongocluster/arm-mongocluster/src/documentDBClient.ts b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts similarity index 87% rename from sdk/mongocluster/arm-mongocluster/src/documentDBClient.ts rename to sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts index 11cdcb12d889..02e55c5ebc5d 100644 --- a/sdk/mongocluster/arm-mongocluster/src/documentDBClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts @@ -24,14 +24,14 @@ import { PrivateLinksOperations, } from "./classic/privateLinks/index.js"; import { - createDocumentDB, - DocumentDBClientOptions, + createMongoClusterManagement, + MongoClusterManagementClientOptions, DocumentDBContext, } from "./api/index.js"; -export { DocumentDBClientOptions } from "./api/documentDBContext.js"; +export { MongoClusterManagementClientOptions } from "./api/mongoClusterManagementContext.js"; -export class DocumentDBClient { +export class MongoClusterManagementClient { private _client: DocumentDBContext; /** The pipeline used by this client to make requests */ public readonly pipeline: Pipeline; @@ -40,9 +40,9 @@ export class DocumentDBClient { constructor( credential: TokenCredential, subscriptionId: string, - options: DocumentDBClientOptions = {}, + options: MongoClusterManagementClientOptions = {}, ) { - this._client = createDocumentDB(credential, options); + this._client = createMongoClusterManagement(credential, options); this.pipeline = this._client.pipeline; this.operations = getOperationsOperations(this._client); this.mongoClusters = getMongoClustersOperations( diff --git a/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts index 1e66269db0bc..cb2b06a03337 100644 --- a/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts +++ b/sdk/mongocluster/arm-mongocluster/src/restorePollerHelpers.ts @@ -7,7 +7,7 @@ import { deserializeState, ResourceLocationConfig, } from "@azure/core-lro"; -import { DocumentDBClient } from "./documentDBClient.js"; +import { MongoClusterManagementClient } from "./mongoClusterManagementClient.js"; import { getLongRunningPoller } from "./api/pollingHelpers.js"; import { _mongoClustersCreateOrUpdateDeserialize, @@ -48,7 +48,7 @@ export interface RestorePollerOptions< * needs to be constructed after the original one is not in scope. */ export function restorePoller( - client: DocumentDBClient, + client: MongoClusterManagementClient, serializedState: string, sourceOperation: ( ...args: any[] diff --git a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts index 982f9885b24b..7a03722d7549 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts @@ -85,7 +85,7 @@ describe("MongoCluster test", () => { }, testPollingOptions); console.log(res) - // assert.equal(res.name, resourcename); + assert.equal(res.name, resourcename); }); it("mongoClusters get test", async function () { diff --git a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts index eda90c3ea96b..cc2bbfc362c0 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts @@ -32,6 +32,5 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage-browser", }, - testTimeout: 1200000, }, }); diff --git a/sdk/mongocluster/arm-mongocluster/vitest.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.config.ts index 7928f980b01c..367c90fa4e72 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.config.ts @@ -28,6 +28,5 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage", }, - testTimeout: 1200000, }, }); From a22e76301e35489069334de364682821d6dc351e Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:13:01 +0800 Subject: [PATCH 13/23] Add LICENSE manually --- sdk/mongocluster/arm-mongocluster/LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 sdk/mongocluster/arm-mongocluster/LICENSE diff --git a/sdk/mongocluster/arm-mongocluster/LICENSE b/sdk/mongocluster/arm-mongocluster/LICENSE new file mode 100644 index 000000000000..fd1f95e88239 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 01014621eb55645919a865ec4c02877c2216a91f Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:17:06 +0800 Subject: [PATCH 14/23] update --- sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts | 1 + sdk/mongocluster/arm-mongocluster/vitest.config.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts index cc2bbfc362c0..eda90c3ea96b 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts @@ -32,5 +32,6 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage-browser", }, + testTimeout: 1200000, }, }); diff --git a/sdk/mongocluster/arm-mongocluster/vitest.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.config.ts index 367c90fa4e72..7928f980b01c 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.config.ts @@ -28,5 +28,6 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage", }, + testTimeout: 1200000, }, }); From ae1487461cb03dcde6ed5ef456cd6756ee83cc4f Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:36:42 +0800 Subject: [PATCH 15/23] update ClientOptions to ClientOptionalParams manually --- sdk/mongocluster/arm-mongocluster/src/api/index.ts | 2 +- .../src/api/mongoClusterManagementContext.ts | 4 ++-- sdk/mongocluster/arm-mongocluster/src/index.ts | 2 +- .../arm-mongocluster/src/mongoClusterManagementClient.ts | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/src/api/index.ts b/sdk/mongocluster/arm-mongocluster/src/api/index.ts index bd5bfb1769b5..f0ef42ebc82e 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/index.ts @@ -3,7 +3,7 @@ export { createMongoClusterManagement, - MongoClusterManagementClientOptions, + MongoClusterManagementClientOptionalParams, DocumentDBContext, } from "./mongoClusterManagementContext.js"; export { diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts index b4c7b0642771..8bbbbbf28e9d 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts @@ -7,7 +7,7 @@ import { DocumentDBContext } from "../rest/index.js"; import getClient from "../rest/index.js"; /** Optional parameters for the client. */ -export interface MongoClusterManagementClientOptions extends ClientOptions { +export interface MongoClusterManagementClientOptionalParams extends ClientOptions { /** The API version to use for this operation. */ apiVersion?: string; } @@ -17,7 +17,7 @@ export { DocumentDBContext } from "../rest/index.js"; /** 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 function createMongoClusterManagement( credential: TokenCredential, - options: MongoClusterManagementClientOptions = {}, + options: MongoClusterManagementClientOptionalParams = {}, ): DocumentDBContext { const clientContext = getClient(credential, options); return clientContext; diff --git a/sdk/mongocluster/arm-mongocluster/src/index.ts b/sdk/mongocluster/arm-mongocluster/src/index.ts index 3e234d5677f6..ad8c9b8dde82 100644 --- a/sdk/mongocluster/arm-mongocluster/src/index.ts +++ b/sdk/mongocluster/arm-mongocluster/src/index.ts @@ -3,7 +3,7 @@ export { MongoClusterManagementClient, - MongoClusterManagementClientOptions, + MongoClusterManagementClientOptionalParams, } from "./mongoClusterManagementClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { diff --git a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts index 02e55c5ebc5d..c3140fc02bfc 100644 --- a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts @@ -25,11 +25,11 @@ import { } from "./classic/privateLinks/index.js"; import { createMongoClusterManagement, - MongoClusterManagementClientOptions, + MongoClusterManagementClientOptionalParams, DocumentDBContext, } from "./api/index.js"; -export { MongoClusterManagementClientOptions } from "./api/mongoClusterManagementContext.js"; +export { MongoClusterManagementClientOptionalParams } from "./api/mongoClusterManagementContext.js"; export class MongoClusterManagementClient { private _client: DocumentDBContext; @@ -40,7 +40,7 @@ export class MongoClusterManagementClient { constructor( credential: TokenCredential, subscriptionId: string, - options: MongoClusterManagementClientOptions = {}, + options: MongoClusterManagementClientOptionalParams = {}, ) { this._client = createMongoClusterManagement(credential, options); this.pipeline = this._client.pipeline; From 7c8eb82edaee77cf2b458d2951b12bbc63ff005a Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:55:50 +0800 Subject: [PATCH 16/23] Update mongocluster_operations_test.spec.ts --- .../test/public/mongocluster_operations_test.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts index 7a03722d7549..a2caf3fc8d4c 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts @@ -85,7 +85,7 @@ describe("MongoCluster test", () => { }, testPollingOptions); console.log(res) - assert.equal(res.name, resourcename); + assert.equal(res.name, "testfilerule"); }); it("mongoClusters get test", async function () { From 8949f9005b8349e4821f96ce7c9e7be5f3e14504 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:33:58 +0800 Subject: [PATCH 17/23] Update README.md --- sdk/mongocluster/arm-mongocluster/README.md | 94 ++++++++++++++++----- 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/README.md b/sdk/mongocluster/arm-mongocluster/README.md index e0cc5eba9bf4..6a44bd447e4e 100644 --- a/sdk/mongocluster/arm-mongocluster/README.md +++ b/sdk/mongocluster/arm-mongocluster/README.md @@ -1,46 +1,78 @@ -# Azure MongoClusterManagement REST client library for JavaScript +# Azure MongoClusterManagement client library for JavaScript -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. - -**If you are not familiar with our REST client, please spend 5 minutes to take a look at our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library, the REST client provides a light-weighted & developer friendly way to call azure rest api +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MongoClusterManagement client. -Key links: +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. -- [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) +[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) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started ### Currently supported environments -- LTS versions of Node.js +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. ### Prerequisites -- You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package. +- An [Azure subscription][azure_sub]. ### Install the `@azure/arm-mongocluster` package -Install the Azure MongoClusterManagement REST client REST client library for JavaScript with `npm`: +Install the Azure MongoClusterManagement client library for JavaScript with `npm`: ```bash npm install @azure/arm-mongocluster ``` -### Create and authenticate a `DocumentDBClient` +### Create and authenticate a `MongoClusterManagementClient` -To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), -provide an instance of the desired credential type obtained from the -[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library. +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]. -To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +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 { 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); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new MongoClusterManagementClient(credential, subscriptionId); +``` -After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use. -As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) -can be used to authenticate the client. -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 +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### MongoClusterManagementClient + +`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. ## Troubleshooting @@ -50,8 +82,28 @@ Enabling logging may help uncover useful information about failures. In order to ```javascript const { setLogLevel } = require("@azure/logger"); - setLogLevel("info"); ``` For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmongocluster%2Farm-mongocluster%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential From c990758c58b55f3f5e9caacc2c6d0d9be3651c3b Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:20:43 +0800 Subject: [PATCH 18/23] update --- sdk/mongocluster/arm-mongocluster/.tshy/browser.json | 7 +++++-- sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json | 6 ++++-- sdk/mongocluster/arm-mongocluster/.tshy/esm.json | 7 +++++-- sdk/mongocluster/arm-mongocluster/.tshy/react-native.json | 7 +++++-- sdk/mongocluster/arm-mongocluster/CHANGELOG.md | 2 +- sdk/mongocluster/arm-mongocluster/package.json | 2 +- .../arm-mongocluster/review/arm-mongocluster-api.api.md | 4 ++-- .../arm-mongocluster/review/arm-mongocluster.api.md | 4 ++-- 8 files changed, 25 insertions(+), 14 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/browser.json b/sdk/mongocluster/arm-mongocluster/.tshy/browser.json index 32e74e04ec62..144e29682df7 100644 --- a/sdk/mongocluster/arm-mongocluster/.tshy/browser.json +++ b/sdk/mongocluster/arm-mongocluster/.tshy/browser.json @@ -3,9 +3,12 @@ "include": [ "../src/**/*.ts", "../src/**/*.mts", - "../src/**/*.tsx" + "../src/**/*.tsx", + "../src/**/*.json" + ], + "exclude": [ + "../src/package.json" ], - "exclude": [], "compilerOptions": { "outDir": "../.tshy-build/browser" } diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json b/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json index 5ace94d041f3..7c9db50b6a5c 100644 --- a/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json +++ b/sdk/mongocluster/arm-mongocluster/.tshy/commonjs.json @@ -3,10 +3,12 @@ "include": [ "../src/**/*.ts", "../src/**/*.cts", - "../src/**/*.tsx" + "../src/**/*.tsx", + "../src/**/*.json" ], "exclude": [ - "../src/**/*.mts" + "../src/**/*.mts", + "../src/package.json" ], "compilerOptions": { "outDir": "../.tshy-build/commonjs" diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/esm.json b/sdk/mongocluster/arm-mongocluster/.tshy/esm.json index ff5264e692d1..959294a84294 100644 --- a/sdk/mongocluster/arm-mongocluster/.tshy/esm.json +++ b/sdk/mongocluster/arm-mongocluster/.tshy/esm.json @@ -3,9 +3,12 @@ "include": [ "../src/**/*.ts", "../src/**/*.mts", - "../src/**/*.tsx" + "../src/**/*.tsx", + "../src/**/*.json" + ], + "exclude": [ + "../src/package.json" ], - "exclude": [], "compilerOptions": { "outDir": "../.tshy-build/esm" } diff --git a/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json b/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json index f431a06985d8..e3a9d50023d6 100644 --- a/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json +++ b/sdk/mongocluster/arm-mongocluster/.tshy/react-native.json @@ -3,9 +3,12 @@ "include": [ "../src/**/*.ts", "../src/**/*.mts", - "../src/**/*.tsx" + "../src/**/*.tsx", + "../src/**/*.json" + ], + "exclude": [ + "../src/package.json" ], - "exclude": [], "compilerOptions": { "outDir": "../.tshy-build/react-native" } diff --git a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md index e6d4d7a2134a..fb062cb8d076 100644 --- a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md +++ b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md @@ -1,5 +1,5 @@ # Release History -## 1.0.0 (2024-07-01) +## 1.0.0-beta.1 (2024-07-02) The package of @azure/arm-mongocluster is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index 015cc29a3bca..34a0d2b3de4f 100644 --- a/sdk/mongocluster/arm-mongocluster/package.json +++ b/sdk/mongocluster/arm-mongocluster/package.json @@ -41,7 +41,7 @@ "LICENSE", "review/*" ], - "sdk-type": "client", + "sdk-type": "mgmt", "repository": "github:Azure/azure-sdk-for-js", "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md index 9a29fa4ab178..4383840fa91e 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster-api.api.md @@ -17,7 +17,7 @@ import { StreamableMethod } from '@azure-rest/core-client'; import { TokenCredential } from '@azure/core-auth'; // @public -export function createMongoClusterManagement(credential: TokenCredential, options?: MongoClusterManagementClientOptions): DocumentDBContext; +export function createMongoClusterManagement(credential: TokenCredential, options?: MongoClusterManagementClientOptionalParams): DocumentDBContext; // @public (undocumented) export type DocumentDBContext = Client & { @@ -37,7 +37,7 @@ export function firewallRulesGet(context: DocumentDBContext, subscriptionId: str export function firewallRulesListByMongoCluster(context: DocumentDBContext, subscriptionId: string, resourceGroupName: string, mongoClusterName: string, options?: FirewallRulesListByMongoClusterOptionalParams): PagedAsyncIterableIterator; // @public -export interface MongoClusterManagementClientOptions extends ClientOptions { +export interface MongoClusterManagementClientOptionalParams extends ClientOptions { apiVersion?: string; } diff --git a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md index 1675f87cdf3d..6e8b7f81f4d6 100644 --- a/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md +++ b/sdk/mongocluster/arm-mongocluster/review/arm-mongocluster.api.md @@ -195,7 +195,7 @@ export interface MongoCluster extends TrackedResource { // @public (undocumented) export class MongoClusterManagementClient { - constructor(credential: TokenCredential, subscriptionId: string, options?: MongoClusterManagementClientOptions); + constructor(credential: TokenCredential, subscriptionId: string, options?: MongoClusterManagementClientOptionalParams); readonly firewallRules: FirewallRulesOperations; readonly mongoClusters: MongoClustersOperations; readonly operations: OperationsOperations; @@ -205,7 +205,7 @@ export class MongoClusterManagementClient { } // @public -export interface MongoClusterManagementClientOptions extends ClientOptions { +export interface MongoClusterManagementClientOptionalParams extends ClientOptions { apiVersion?: string; } From 06a0b63f423814eab7258cbda2b4ae026373da16 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 4 Jul 2024 12:11:42 +0800 Subject: [PATCH 19/23] update test case --- .../arm-mongocluster/package.json | 7 +- .../mongocluster_operations_test.spec.ts | 168 +++++++++++++++++- 2 files changed, 167 insertions(+), 8 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index 34a0d2b3de4f..588c93e57ea9 100644 --- a/sdk/mongocluster/arm-mongocluster/package.json +++ b/sdk/mongocluster/arm-mongocluster/package.json @@ -84,7 +84,8 @@ "@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" + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/arm-network": "^33.2.0" }, "scripts": { "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", @@ -99,9 +100,9 @@ "integration-test:browser": "echo skipped", "integration-test:node": "echo skipped", "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", - "build:samples": "dev-tool samples publish --force", + "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": "dev-tool samples run samples-dev", + "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", diff --git a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts index a2caf3fc8d4c..2bf03e13d3ad 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts @@ -10,11 +10,13 @@ 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, @@ -24,9 +26,14 @@ 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 fireWallName: string; + let connectionName: string; + let virtualNetworkName: string; + let privateEndpointName: string; beforeEach(async (context) => { process.env.SystemRoot = process.env.SystemRoot || "C:\\Windows"; @@ -35,10 +42,13 @@ describe("MongoCluster test", () => { // 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"; + resourceGroup = "czwjstest"; resourcename = "resourcetest"; - + fireWallName = "testfilerule"; + virtualNetworkName = "testvn"; + privateEndpointName = "testPEC"; }); afterEach(async function () { @@ -47,7 +57,7 @@ describe("MongoCluster test", () => { } }); - it("mongoClusters create test", async function () { + it.only("mongoClusters create test", async function () { const res = await client.mongoClusters.createOrUpdate( resourceGroup, resourcename, @@ -72,11 +82,58 @@ describe("MongoCluster test", () => { 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); + + const result = 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/myjstest/providers/Microsoft.Network/virtualNetworks/" + virtualNetworkName + "/subnets/testsubnet", + }, + }, + testPollingOptions); + assert.equal(res.name, privateEndpointName); + }); + it("firerules create test", async function () { const res = await client.firewallRules.createOrUpdate( resourceGroup, resourcename, - "testfilerule", + fireWallName, { properties: { startIpAddress: "0.0.0.0", @@ -85,7 +142,28 @@ describe("MongoCluster test", () => { }, testPollingOptions); console.log(res) - assert.equal(res.name, "testfilerule"); + assert.equal(res.name, fireWallName); + }); + + //need create a mongocluster first then create a private endpoint named testPEC with the mongocluster. + it("privateEndpointConnections 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("mongoClusters get test", async function () { @@ -96,6 +174,24 @@ describe("MongoCluster test", () => { 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("privateEndpointConnections get test", async function () { + const res = await client.privateEndpointConnections.get( + resourceGroup, + resourcename, + connectionName); + console.log(res) + assert.equal(res.name, connectionName); + }); + it("mongoClusters list test", async function () { const resArray = new Array(); for await (let item of client.mongoClusters.listByResourceGroup(resourceGroup)) { @@ -104,6 +200,23 @@ describe("MongoCluster test", () => { assert.equal(resArray.length, 1); }); + it("privateEndpointConnections 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("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, @@ -115,6 +228,49 @@ describe("MongoCluster test", () => { assert.equal(res.name, resourcename); }); + it("privateEndpointConnections delete test", async function () { + for await (let item of client.privateEndpointConnections.listByMongoCluster(resourceGroup, resourcename)) { + connectionName = String(item.name); + } + const resArray = new Array(); + const res = 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(); + const res = 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(); + const res = await networkClient.virtualNetworks.beginDeleteAndWait(resourceGroup, virtualNetworkName, + ) + for await (let item of networkClient.virtualNetworks.list(resourceGroup)) { + resArray.push(item); + } + assert.equal(resArray.length, 0); + }); + + it("firewallRules delete test", async function () { + const resArray = new Array(); + const res = 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(); const res = await client.mongoClusters.delete(resourceGroup, resourcename @@ -123,5 +279,7 @@ describe("MongoCluster test", () => { resArray.push(item); } assert.equal(resArray.length, 0); + + await delay(isPlaybackMode() ? 1000 : 60000) }); }) From 19dac609ce50171fe28011015debbbab64685f36 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:53:09 +0800 Subject: [PATCH 20/23] update --- sdk/mongocluster/arm-mongocluster/package.json | 2 +- .../test/public/mongocluster_operations_test.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index 588c93e57ea9..02e49e09f333 100644 --- a/sdk/mongocluster/arm-mongocluster/package.json +++ b/sdk/mongocluster/arm-mongocluster/package.json @@ -61,7 +61,7 @@ "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", "tslib": "^2.6.2", - "@azure/core-lro": "3.0.0", + "@azure/core-lro": "^3.0.0", "@azure/abort-controller": "^2.1.2", "@azure/core-paging": "^1.5.0" }, diff --git a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts index 2bf03e13d3ad..5682120c8fff 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts @@ -57,7 +57,7 @@ describe("MongoCluster test", () => { } }); - it.only("mongoClusters create test", async function () { + it("mongoClusters create test", async function () { const res = await client.mongoClusters.createOrUpdate( resourceGroup, resourcename, From b6bf2d8d7a4a293b0de2259cf16d6464feb4ac61 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Thu, 4 Jul 2024 15:11:02 +0800 Subject: [PATCH 21/23] Update the cases for node only --- .../public/mongoclusterOperations.spec.ts | 160 ++++++++++++++++++ .../privateEndpointConnections.spec.ts} | 125 +------------- 2 files changed, 167 insertions(+), 118 deletions(-) create mode 100644 sdk/mongocluster/arm-mongocluster/test/public/mongoclusterOperations.spec.ts rename sdk/mongocluster/arm-mongocluster/test/public/{mongocluster_operations_test.spec.ts => node/privateEndpointConnections.spec.ts} (60%) diff --git a/sdk/mongocluster/arm-mongocluster/test/public/mongoclusterOperations.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/mongoclusterOperations.spec.ts new file mode 100644 index 000000000000..ff2f981909d1 --- /dev/null +++ b/sdk/mongocluster/arm-mongocluster/test/public/mongoclusterOperations.spec.ts @@ -0,0 +1,160 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +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 = "resourcetest"; + fireWallName = "testfilerule"; + }); + + afterEach(async function () { + if (recorder?.recordingId) { + await recorder.stop(); + } + }); + + it("mongoClusters create test", async function () { + const res = await client.mongoClusters.createOrUpdate( + resourceGroup, + resourcename, + { + location, + properties: { + administratorLogin: "mongoAdmin", + administratorLoginPassword: "Password01!", + nodeGroupSpecs: [ + { + diskSizeGB: 128, + enableHa: true, + kind: "Shard", + nodeCount: 1, + sku: "M30", + }, + ], + serverVersion: "5.0", + }, + }, + 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); + }); + + it("firewallRules delete test", async function () { + const resArray = new Array(); + const res = 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(); + const res = 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/mongocluster_operations_test.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts similarity index 60% rename from sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts rename to sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts index 5682120c8fff..eb2b6bd05529 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/mongocluster_operations_test.spec.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts @@ -10,12 +10,11 @@ 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 { MongoClusterManagementClient } from "../../../src/mongoClusterManagementClient.js" +import { createRecorder } from "../utils/recordedClient.js"; import { NetworkManagementClient } from "@azure/arm-network" export const testPollingOptions = { @@ -30,7 +29,6 @@ describe("MongoCluster test", () => { let location: string; let resourceGroup: string; let resourcename: string; - let fireWallName: string; let connectionName: string; let virtualNetworkName: string; let privateEndpointName: string; @@ -46,7 +44,6 @@ describe("MongoCluster test", () => { location = "eastus"; resourceGroup = "czwjstest"; resourcename = "resourcetest"; - fireWallName = "testfilerule"; virtualNetworkName = "testvn"; privateEndpointName = "testPEC"; }); @@ -57,30 +54,6 @@ describe("MongoCluster test", () => { } }); - it("mongoClusters create test", async function () { - const res = await client.mongoClusters.createOrUpdate( - resourceGroup, - resourcename, - { - location, - properties: { - administratorLogin: "mongoAdmin", - administratorLoginPassword: "Password01!", - nodeGroupSpecs: [ - { - diskSizeGB: 128, - enableHa: true, - kind: "Shard", - nodeCount: 1, - sku: "M30", - }, - ], - serverVersion: "5.0", - }, - }, - testPollingOptions); - assert.equal(res.name, resourcename); - }); it("virtual network create test", async function () { const res = await networkClient.virtualNetworks.beginCreateOrUpdateAndWait( @@ -129,24 +102,8 @@ describe("MongoCluster test", () => { assert.equal(res.name, privateEndpointName); }); - 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); - }); - - //need create a mongocluster first then create a private endpoint named testPEC with the mongocluster. - it("privateEndpointConnections create test", async function () { + // 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); } @@ -166,24 +123,7 @@ describe("MongoCluster test", () => { assert.equal(res.name, connectionName); }); - 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("privateEndpointConnections get test", async function () { + it("private endpoint connection get test", async function () { const res = await client.privateEndpointConnections.get( resourceGroup, resourcename, @@ -191,16 +131,7 @@ describe("MongoCluster test", () => { console.log(res) assert.equal(res.name, connectionName); }); - - 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("privateEndpointConnections list test", async function () { + 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); @@ -208,27 +139,7 @@ describe("MongoCluster test", () => { 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); - }); - - it("privateEndpointConnections delete test", async function () { + it("private endpoint connection delete test", async function () { for await (let item of client.privateEndpointConnections.listByMongoCluster(resourceGroup, resourcename)) { connectionName = String(item.name); } @@ -260,26 +171,4 @@ describe("MongoCluster test", () => { } assert.equal(resArray.length, 0); }); - - it("firewallRules delete test", async function () { - const resArray = new Array(); - const res = 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(); - const res = 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) - }); }) From 2d699e0280880c5e5f0aab5f7711ce5a73c0b91d Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:47:35 +0800 Subject: [PATCH 22/23] update --- sdk/mongocluster/arm-mongocluster/assets.json | 2 +- .../node/privateEndpointConnections.spec.ts | 44 +++++++++++++++++-- .../arm-mongocluster/vitest.browser.config.ts | 2 +- .../arm-mongocluster/vitest.config.ts | 2 +- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/assets.json b/sdk/mongocluster/arm-mongocluster/assets.json index 5c6202b15f7f..68dd7eb189ad 100644 --- a/sdk/mongocluster/arm-mongocluster/assets.json +++ b/sdk/mongocluster/arm-mongocluster/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/mongocluster/arm-mongocluster", - "Tag": "js/mongocluster/arm-mongocluster_04a66e31c1" + "Tag": "js/mongocluster/arm-mongocluster_c6236b1752" } diff --git a/sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts b/sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts index eb2b6bd05529..5c4f6212efaa 100644 --- a/sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts +++ b/sdk/mongocluster/arm-mongocluster/test/public/node/privateEndpointConnections.spec.ts @@ -10,6 +10,7 @@ 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"; @@ -42,8 +43,8 @@ describe("MongoCluster test", () => { client = new MongoClusterManagementClient(credential, subscriptionId, recorder.configureClientOptions({})); networkClient = new NetworkManagementClient(credential, subscriptionId, recorder.configureClientOptions({})); location = "eastus"; - resourceGroup = "czwjstest"; - resourcename = "resourcetest"; + resourceGroup = "myjstest"; + resourcename = "resourcetest1"; virtualNetworkName = "testvn"; privateEndpointName = "testPEC"; }); @@ -54,6 +55,31 @@ describe("MongoCluster test", () => { } }); + it("mongoClusters for private endpoint create test", async function () { + const res = await client.mongoClusters.createOrUpdate( + resourceGroup, + resourcename, + { + location, + properties: { + administratorLogin: "mongoAdmin", + administratorLoginPassword: "Password01!", + nodeGroupSpecs: [ + { + diskSizeGB: 128, + enableHa: true, + kind: "Shard", + nodeCount: 1, + sku: "M30", + }, + ], + serverVersion: "5.0", + }, + }, + testPollingOptions); + assert.equal(res.name, resourcename); + }); + it("virtual network create test", async function () { const res = await networkClient.virtualNetworks.beginCreateOrUpdateAndWait( @@ -95,7 +121,7 @@ describe("MongoCluster test", () => { }, ], subnet: { - id: "/subscriptions/" + subscriptionId + "/resourceGroups/myjstest/providers/Microsoft.Network/virtualNetworks/" + virtualNetworkName + "/subnets/testsubnet", + id: "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroup + "/providers/Microsoft.Network/virtualNetworks/" + virtualNetworkName + "/subnets/testsubnet", }, }, testPollingOptions); @@ -171,4 +197,16 @@ describe("MongoCluster test", () => { } assert.equal(resArray.length, 0); }); + + it("mongoClusters for private endpoint delete test", async function () { + const resArray = new Array(); + const res = 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/vitest.browser.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts index eda90c3ea96b..68e57a10e36f 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.browser.config.ts @@ -32,6 +32,6 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage-browser", }, - testTimeout: 1200000, + testTimeout: 2400000, }, }); diff --git a/sdk/mongocluster/arm-mongocluster/vitest.config.ts b/sdk/mongocluster/arm-mongocluster/vitest.config.ts index 7928f980b01c..f175c6aa9a77 100644 --- a/sdk/mongocluster/arm-mongocluster/vitest.config.ts +++ b/sdk/mongocluster/arm-mongocluster/vitest.config.ts @@ -28,6 +28,6 @@ export default defineConfig({ reporter: ["text", "json", "html"], reportsDirectory: "coverage", }, - testTimeout: 1200000, + testTimeout: 2400000, }, }); From 12b3c89e68be7f9900a7492f4c8c2bdaaed8f918 Mon Sep 17 00:00:00 2001 From: qiaozha Date: Fri, 5 Jul 2024 15:04:39 +0800 Subject: [PATCH 23/23] resolve comments --- sdk/mongocluster/arm-mongocluster/CHANGELOG.md | 6 ++++-- sdk/mongocluster/arm-mongocluster/package.json | 11 ++++++----- .../src/api/mongoClusterManagementContext.ts | 10 +++++++++- .../src/mongoClusterManagementClient.ts | 10 +++++++++- .../arm-mongocluster/src/rest/documentDBClient.ts | 2 +- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md index fb062cb8d076..8e209ef8d4e2 100644 --- a/sdk/mongocluster/arm-mongocluster/CHANGELOG.md +++ b/sdk/mongocluster/arm-mongocluster/CHANGELOG.md @@ -1,5 +1,7 @@ # Release History -## 1.0.0-beta.1 (2024-07-02) +## 1.0.0-beta.1 (2024-07-05) -The package of @azure/arm-mongocluster is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart). +### Features Added + +Initial release of the Azure MongoCluster package diff --git a/sdk/mongocluster/arm-mongocluster/package.json b/sdk/mongocluster/arm-mongocluster/package.json index 02e49e09f333..e45c0c2e79dc 100644 --- a/sdk/mongocluster/arm-mongocluster/package.json +++ b/sdk/mongocluster/arm-mongocluster/package.json @@ -91,8 +91,8 @@ "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api", "pack": "npm pack 2>&1", - "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", - "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", + "lint": "echo skipped", + "lint:fix": "echo skipped", "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", @@ -101,9 +101,9 @@ "integration-test:node": "echo skipped", "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "echo skipped", - "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", + "check-format": "echo skipped", "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}\"", + "format": "echo skipped", "generate:client": "echo skipped", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", @@ -182,5 +182,6 @@ } }, "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts" + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts index 8bbbbbf28e9d..3e2901972fff 100644 --- a/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts +++ b/sdk/mongocluster/arm-mongocluster/src/api/mongoClusterManagementContext.ts @@ -19,6 +19,14 @@ export function createMongoClusterManagement( credential: TokenCredential, options: MongoClusterManagementClientOptionalParams = {}, ): DocumentDBContext { - const clientContext = getClient(credential, options); + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api` + : "azsdk-js-api"; + + const clientContext = getClient(credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); return clientContext; } diff --git a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts index c3140fc02bfc..280e6b383ab3 100644 --- a/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/mongoClusterManagementClient.ts @@ -42,7 +42,15 @@ export class MongoClusterManagementClient { subscriptionId: string, options: MongoClusterManagementClientOptionalParams = {}, ) { - this._client = createMongoClusterManagement(credential, options); + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} 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( diff --git a/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts b/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts index 6853103b5134..d2952d1acbf2 100644 --- a/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts +++ b/sdk/mongocluster/arm-mongocluster/src/rest/documentDBClient.ts @@ -26,7 +26,7 @@ export default function createClient( ): DocumentDBContext { const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; - const userAgentInfo = `azsdk-js-arm-mongocluster-rest/1.0.0-beta.1`; + const userAgentInfo = `azsdk-js-arm-mongocluster/1.0.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`