From f7df4d4d8841a19de3735717c45f79b8a627c0e2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sat, 9 Apr 2022 08:45:59 +0000 Subject: [PATCH] CodeGen from PR 18087 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.DocumentDB to add version preview/2022-02-15-preview (#18087) * Adds base for updating Microsoft.DocumentDB from version preview/2021-11-15-preview to version 2022-02-15-preview * Updates readme * Updates API version in new specs and examples * Partition Merge RP API changes * fix spec to reflect the returned value * fix serialization of merge response * Add mongodb API * prettier fix * fixed Linter and Prettier errors * prettier fixes * fix linter errors * address CR feedback * semantic validation fixes * fix mongodb merge example * support for pitr basic/lite * fix pretty and add mongo 4.2 * Adding Support for Client Encryption Policy in swagger spec * Update cosmos-db.json * Update cosmos-db.json * Update CosmosDBSqlContainerCreateUpdate.json * Fixed prettier checl * Fixed prettier check Co-authored-by: Vinh Trinh Co-authored-by: Santosh Kulkarni <66682828+kr-santosh@users.noreply.github.com> --- common/config/rush/pnpm-lock.yaml | 17 +- sdk/cosmosdb/arm-cosmosdb/CHANGELOG.md | 39 ++-- sdk/cosmosdb/arm-cosmosdb/README.md | 11 -- sdk/cosmosdb/arm-cosmosdb/_meta.json | 7 +- sdk/cosmosdb/arm-cosmosdb/package.json | 24 +-- .../arm-cosmosdb/review/arm-cosmosdb.api.md | 74 ++++++++ sdk/cosmosdb/arm-cosmosdb/rollup.config.js | 78 +++++++- .../src/cosmosDBManagementClient.ts | 4 +- sdk/cosmosdb/arm-cosmosdb/src/models/index.ts | 109 ++++++++++- .../arm-cosmosdb/src/models/mappers.ts | 169 +++++++++++++++++- .../arm-cosmosdb/src/models/parameters.ts | 8 +- .../src/operations/mongoDBResources.ts | 148 +++++++++++++++ .../src/operations/sqlResources.ts | 146 +++++++++++++++ .../operationsInterfaces/mongoDBResources.ts | 44 +++++ .../src/operationsInterfaces/sqlResources.ts | 42 +++++ sdk/cosmosdb/arm-cosmosdb/test/sampleTest.ts | 48 +++++ sdk/cosmosdb/ci.mgmt.yml | 10 +- sdk/cosmosdb/ci.yml | 8 +- 18 files changed, 909 insertions(+), 77 deletions(-) create mode 100644 sdk/cosmosdb/arm-cosmosdb/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index c6e83a5d8690..5f05e172e52e 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -10028,28 +10028,27 @@ packages: dev: false file:projects/arm-cosmosdb.tgz: - resolution: {integrity: sha512-OP4+f3Ecd0Ix+6YOLUhueJClbVOWRncbHN4VmJ5b2BzW64Ui/j9m3chqAAQHUyYNBNBsbiKSM7Fva1SLmCpfCQ==, tarball: file:projects/arm-cosmosdb.tgz} + resolution: {integrity: sha512-o/KwRF7UF3AKt9/9f+iRRwUSZOMLdzX7dW9nBYxeQ1GZtMYqMNC+fQiuNrxh1KrXQ44xznjC/lku+RBbgAujWA==, tarball: file:projects/arm-cosmosdb.tgz} name: '@rush-temp/arm-cosmosdb' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 '@azure/identity': 2.0.4 '@microsoft/api-extractor': 7.19.4 - '@rollup/plugin-commonjs': 21.0.2_rollup@2.70.0 - '@rollup/plugin-json': 4.1.0_rollup@2.70.0 - '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.0 - '@rollup/plugin-node-resolve': 13.1.3_rollup@2.70.0 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 - rollup: 2.70.0 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.0 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.2 transitivePeerDependencies: - - '@types/node' - debug - encoding - supports-color @@ -17419,7 +17418,7 @@ packages: dev: false file:projects/test-recorder.tgz: - resolution: {integrity: sha512-Xer6XFqtF+++PkuM8klXusuoFnbtFT0MYT+SSptHozyW84/FdCf2V5t0VZJmqSYF7AM42GVSnRMbl6KF/pzevA==, tarball: file:projects/test-recorder.tgz} + resolution: {integrity: sha512-I+6cy62A3fZO0CejOz4sYIld1JLcBtqgNxuBofi2ah7SuKDSXGYfPDk726RlCYb7thvK4JpXIm7Wh1J1DxQTYA==, tarball: file:projects/test-recorder.tgz} name: '@rush-temp/test-recorder' version: 0.0.0 dependencies: diff --git a/sdk/cosmosdb/arm-cosmosdb/CHANGELOG.md b/sdk/cosmosdb/arm-cosmosdb/CHANGELOG.md index f0957a37b431..a0206e1eeecf 100644 --- a/sdk/cosmosdb/arm-cosmosdb/CHANGELOG.md +++ b/sdk/cosmosdb/arm-cosmosdb/CHANGELOG.md @@ -1,16 +1,6 @@ # Release History - -## 16.0.0-beta.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 16.0.0-beta.1 (2022-02-21) + +## 15.1.0-beta.1 (2022-04-09) **Features** @@ -47,12 +37,16 @@ - Added operation MongoDBResources.beginDeleteMongoRoleDefinitionAndWait - Added operation MongoDBResources.beginDeleteMongoUserDefinition - Added operation MongoDBResources.beginDeleteMongoUserDefinitionAndWait + - Added operation MongoDBResources.beginListMongoDBCollectionPartitionMerge + - Added operation MongoDBResources.beginListMongoDBCollectionPartitionMergeAndWait - Added operation MongoDBResources.getMongoRoleDefinition - Added operation MongoDBResources.getMongoUserDefinition - Added operation MongoDBResources.listMongoRoleDefinitions - Added operation MongoDBResources.listMongoUserDefinitions - Added operation SqlResources.beginCreateUpdateClientEncryptionKey - Added operation SqlResources.beginCreateUpdateClientEncryptionKeyAndWait + - Added operation SqlResources.beginListSqlContainerPartitionMerge + - Added operation SqlResources.beginListSqlContainerPartitionMergeAndWait - Added operation SqlResources.getClientEncryptionKey - Added operation SqlResources.listClientEncryptionKeys - Added operation TableResources.beginRetrieveContinuousBackupInformation @@ -71,9 +65,12 @@ - Added Interface CassandraResourcesUpdateCassandraViewThroughputOptionalParams - Added Interface CassandraViewListResult - Added Interface CassandraViewResource + - Added Interface ClientEncryptionIncludedPath - Added Interface ClientEncryptionKeyCreateUpdateParameters - Added Interface ClientEncryptionKeyResource - Added Interface ClientEncryptionKeysListResult + - Added Interface ClientEncryptionPolicy + - Added Interface ContinuousModeProperties - Added Interface DataTransferDataSourceSink - Added Interface DataTransferJobFeedResults - Added Interface DataTransferJobProperties @@ -95,18 +92,22 @@ - Added Interface KeyWrapMetadata - Added Interface ListBackups - Added Interface MaterializedViewsBuilderServiceResource + - Added Interface MergeParameters - Added Interface MongoDBResourcesCreateUpdateMongoRoleDefinitionOptionalParams - Added Interface MongoDBResourcesCreateUpdateMongoUserDefinitionOptionalParams - Added Interface MongoDBResourcesDeleteMongoRoleDefinitionOptionalParams - Added Interface MongoDBResourcesDeleteMongoUserDefinitionOptionalParams - Added Interface MongoDBResourcesGetMongoRoleDefinitionOptionalParams - Added Interface MongoDBResourcesGetMongoUserDefinitionOptionalParams + - Added Interface MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams - Added Interface MongoDBResourcesListMongoRoleDefinitionsOptionalParams - Added Interface MongoDBResourcesListMongoUserDefinitionsOptionalParams - Added Interface MongoRoleDefinitionCreateUpdateParameters - Added Interface MongoRoleDefinitionListResult - Added Interface MongoUserDefinitionCreateUpdateParameters - Added Interface MongoUserDefinitionListResult + - Added Interface PhysicalPartitionStorageInfo + - Added Interface PhysicalPartitionStorageInfoCollection - Added Interface Privilege - Added Interface PrivilegeResource - Added Interface RegionalServiceResource @@ -138,6 +139,7 @@ - Added Interface SqlResourcesCreateUpdateClientEncryptionKeyOptionalParams - Added Interface SqlResourcesGetClientEncryptionKeyOptionalParams - Added Interface SqlResourcesListClientEncryptionKeysOptionalParams + - Added Interface SqlResourcesListSqlContainerPartitionMergeOptionalParams - Added Interface TableResourcesRetrieveContinuousBackupInformationOptionalParams - Added Type Alias AzureBlobDataTransferDataSourceSink - Added Type Alias BackupResource @@ -156,6 +158,7 @@ - Added Type Alias CassandraViewGetResults - Added Type Alias ClientEncryptionKeyGetPropertiesResource - Added Type Alias ClientEncryptionKeyGetResults + - Added Type Alias ContinuousTier - Added Type Alias CosmosCassandraDataTransferDataSourceSink - Added Type Alias CosmosSqlDataTransferDataSourceSink - Added Type Alias CreateJobRequest @@ -185,6 +188,7 @@ - Added Type Alias MongoDBResourcesCreateUpdateMongoUserDefinitionResponse - Added Type Alias MongoDBResourcesGetMongoRoleDefinitionResponse - Added Type Alias MongoDBResourcesGetMongoUserDefinitionResponse + - Added Type Alias MongoDBResourcesListMongoDBCollectionPartitionMergeResponse - Added Type Alias MongoDBResourcesListMongoRoleDefinitionsResponse - Added Type Alias MongoDBResourcesListMongoUserDefinitionsResponse - Added Type Alias MongoRoleDefinitionGetResults @@ -208,16 +212,19 @@ - Added Type Alias SqlResourcesCreateUpdateClientEncryptionKeyResponse - Added Type Alias SqlResourcesGetClientEncryptionKeyResponse - Added Type Alias SqlResourcesListClientEncryptionKeysResponse + - Added Type Alias SqlResourcesListSqlContainerPartitionMergeResponse - Added Type Alias TableResourcesRetrieveContinuousBackupInformationResponse - Interface ARMResourceProperties has a new optional parameter identity - Interface DatabaseAccountUpdateParameters has a new optional parameter diagnosticLogSettings - Interface DatabaseAccountUpdateParameters has a new optional parameter enableMaterializedViews - Interface DataCenterResourceProperties has a new optional parameter authenticationMethodLdapProperties - Interface LocationProperties has a new optional parameter status + - Interface RestorableDatabaseAccountGetResult has a new optional parameter oldestRestorableTime - Interface RestorableMongodbCollectionsListOptionalParams has a new optional parameter endTime - Interface RestorableMongodbCollectionsListOptionalParams has a new optional parameter startTime - Interface RestoreParameters has a new optional parameter gremlinDatabasesToRestore - Interface RestoreParameters has a new optional parameter tablesToRestore + - Interface SqlContainerResource has a new optional parameter clientEncryptionPolicy - Class CosmosDBManagementClient has a new parameter dataTransferJobs - Class CosmosDBManagementClient has a new parameter graphResources - Class CosmosDBManagementClient has a new parameter restorableGremlinDatabases @@ -226,20 +233,18 @@ - Class CosmosDBManagementClient has a new parameter restorableTableResources - Class CosmosDBManagementClient has a new parameter restorableTables - Class CosmosDBManagementClient has a new parameter service + - Type Alias ContinuousModeBackupPolicy has a new parameter continuousModeProperties - Type Alias DatabaseAccountCreateUpdateParameters has a new parameter diagnosticLogSettings - Type Alias DatabaseAccountCreateUpdateParameters has a new parameter enableMaterializedViews - Type Alias DatabaseAccountGetResults has a new parameter diagnosticLogSettings - Type Alias DatabaseAccountGetResults has a new parameter enableMaterializedViews + - Added Enum KnownContinuousTier - Added Enum KnownDataTransferComponent - Added Enum KnownServiceSize - Added Enum KnownServiceStatus - Added Enum KnownServiceType - Enum KnownAuthenticationMethod has a new value Ldap - -**Breaking Changes** - - - Type Alias DatabaseAccountCreateUpdateParameters no longer has parameter identity - - Type Alias DatabaseAccountGetResults no longer has parameter identity + - Enum KnownServerVersion has a new value Four2 ## 15.0.0 (2021-12-09) diff --git a/sdk/cosmosdb/arm-cosmosdb/README.md b/sdk/cosmosdb/arm-cosmosdb/README.md index e0995ed3c9b6..5a8556c2e0a8 100644 --- a/sdk/cosmosdb/arm-cosmosdb/README.md +++ b/sdk/cosmosdb/arm-cosmosdb/README.md @@ -16,8 +16,6 @@ Azure Cosmos DB Database Service Resource Provider REST API - [LTS versions of Node.js](https://nodejs.org/about/releases/) - 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]. @@ -51,17 +49,8 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { CosmosDBManagementClient } = require("@azure/arm-cosmosdb"); 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 CosmosDBManagementClient(new DefaultAzureCredential(), subscriptionId); - -// For client-side applications running in the browser, use this code instead: -// const credential = new InteractiveBrowserCredential({ -// tenantId: "", -// clientId: "" -// }); -// const client = new CosmosDBManagementClient(credential, subscriptionId); ``` diff --git a/sdk/cosmosdb/arm-cosmosdb/_meta.json b/sdk/cosmosdb/arm-cosmosdb/_meta.json index a8daca9976c0..0ec0db6abea2 100644 --- a/sdk/cosmosdb/arm-cosmosdb/_meta.json +++ b/sdk/cosmosdb/arm-cosmosdb/_meta.json @@ -1,7 +1,8 @@ { - "commit": "bb9f1204f9a337404ff7e7b73b4c7b4ddde7f8f1", + "commit": "74ca59fc8cb6563d5a9d66fb533b8622522143eb", "readme": "specification/cosmos-db/resource-manager/readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220217.1", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220105.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20220217.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", + "use": "@autorest/typescript@6.0.0-alpha.16.20220105.1" } \ No newline at end of file diff --git a/sdk/cosmosdb/arm-cosmosdb/package.json b/sdk/cosmosdb/arm-cosmosdb/package.json index ece41872ed7a..9bf45a6d0f0a 100644 --- a/sdk/cosmosdb/arm-cosmosdb/package.json +++ b/sdk/cosmosdb/arm-cosmosdb/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for CosmosDBManagementClient.", - "version": "16.0.0-beta.2", + "version": "15.1.0-beta.1", "engines": { "node": ">=12.0.0" }, @@ -29,13 +29,13 @@ "types": "./types/arm-cosmosdb.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.18.11", - "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-multi-entry": "^4.1.0", - "@rollup/plugin-node-resolve": "^13.1.3", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", "mkdirp": "^1.0.4", - "rollup": "^2.66.1", - "rollup-plugin-sourcemaps": "^0.6.3", + "rollup": "^1.16.3", + "rollup-plugin-sourcemaps": "^0.4.2", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -98,13 +98,5 @@ "docs": "echo skipped" }, "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/cosmosDBManagementClient.ts", - "prefix": "packageDetails" - } - ] - }, "autoPublish": true -} +} \ No newline at end of file diff --git a/sdk/cosmosdb/arm-cosmosdb/review/arm-cosmosdb.api.md b/sdk/cosmosdb/arm-cosmosdb/review/arm-cosmosdb.api.md index 0857e2bb1d5e..a9993d4f6da3 100644 --- a/sdk/cosmosdb/arm-cosmosdb/review/arm-cosmosdb.api.md +++ b/sdk/cosmosdb/arm-cosmosdb/review/arm-cosmosdb.api.md @@ -648,6 +648,14 @@ export interface Certificate { pem?: string; } +// @public (undocumented) +export interface ClientEncryptionIncludedPath { + clientEncryptionKeyId: string; + encryptionAlgorithm: string; + encryptionType: string; + path: string; +} + // @public export interface ClientEncryptionKeyCreateUpdateParameters { resource: ClientEncryptionKeyResource; @@ -674,6 +682,12 @@ export interface ClientEncryptionKeysListResult { readonly value?: ClientEncryptionKeyGetResults[]; } +// @public +export interface ClientEncryptionPolicy { + includedPaths: ClientEncryptionIncludedPath[]; + policyFormatVersion?: number; +} + // @public export interface CloudError { error?: ErrorResponse; @@ -897,8 +911,17 @@ export interface ContinuousBackupRestoreLocation { // @public export type ContinuousModeBackupPolicy = BackupPolicy & { type: "Continuous"; + continuousModeProperties?: ContinuousModeProperties; }; +// @public +export interface ContinuousModeProperties { + tier?: ContinuousTier; +} + +// @public +export type ContinuousTier = string; + // @public export interface CorsPolicy { allowedHeaders?: string; @@ -1899,6 +1922,7 @@ export type KeyKind = string; // @public export interface KeyWrapMetadata { + algorithm?: string; name?: string; type?: string; value?: string; @@ -2006,6 +2030,14 @@ export enum KnownConnectorOffer { Small = "Small" } +// @public +export enum KnownContinuousTier { + // (undocumented) + Continuous30Days = "Continuous30Days", + // (undocumented) + Continuous7Days = "Continuous7Days" +} + // @public export enum KnownCreatedByType { // (undocumented) @@ -2203,6 +2235,8 @@ export enum KnownServerVersion { // (undocumented) Four0 = "4.0", // (undocumented) + Four2 = "4.2", + // (undocumented) Three2 = "3.2", // (undocumented) Three6 = "3.6" @@ -2423,6 +2457,11 @@ export type MaterializedViewsBuilderServiceResourceProperties = ServiceResourceP readonly locations?: MaterializedViewsBuilderRegionalServiceResource[]; }; +// @public +export interface MergeParameters { + isDryRun?: boolean; +} + // @public export interface Metric { readonly endTime?: Date; @@ -2553,6 +2592,8 @@ export interface MongoDBResources { beginDeleteMongoRoleDefinitionAndWait(mongoRoleDefinitionId: string, resourceGroupName: string, accountName: string, options?: MongoDBResourcesDeleteMongoRoleDefinitionOptionalParams): Promise; beginDeleteMongoUserDefinition(mongoUserDefinitionId: string, resourceGroupName: string, accountName: string, options?: MongoDBResourcesDeleteMongoUserDefinitionOptionalParams): Promise, void>>; beginDeleteMongoUserDefinitionAndWait(mongoUserDefinitionId: string, resourceGroupName: string, accountName: string, options?: MongoDBResourcesDeleteMongoUserDefinitionOptionalParams): Promise; + beginListMongoDBCollectionPartitionMerge(resourceGroupName: string, accountName: string, databaseName: string, collectionName: string, mergeParameters: MergeParameters, options?: MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams): Promise, MongoDBResourcesListMongoDBCollectionPartitionMergeResponse>>; + beginListMongoDBCollectionPartitionMergeAndWait(resourceGroupName: string, accountName: string, databaseName: string, collectionName: string, mergeParameters: MergeParameters, options?: MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams): Promise; beginMigrateMongoDBCollectionToAutoscale(resourceGroupName: string, accountName: string, databaseName: string, collectionName: string, options?: MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOptionalParams): Promise, MongoDBResourcesMigrateMongoDBCollectionToAutoscaleResponse>>; beginMigrateMongoDBCollectionToAutoscaleAndWait(resourceGroupName: string, accountName: string, databaseName: string, collectionName: string, options?: MongoDBResourcesMigrateMongoDBCollectionToAutoscaleOptionalParams): Promise; beginMigrateMongoDBCollectionToManualThroughput(resourceGroupName: string, accountName: string, databaseName: string, collectionName: string, options?: MongoDBResourcesMigrateMongoDBCollectionToManualThroughputOptionalParams): Promise, MongoDBResourcesMigrateMongoDBCollectionToManualThroughputResponse>>; @@ -2681,6 +2722,15 @@ export interface MongoDBResourcesGetMongoUserDefinitionOptionalParams extends co // @public export type MongoDBResourcesGetMongoUserDefinitionResponse = MongoUserDefinitionGetResults; +// @public +export interface MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MongoDBResourcesListMongoDBCollectionPartitionMergeResponse = PhysicalPartitionStorageInfoCollection; + // @public export interface MongoDBResourcesListMongoDBCollectionsOptionalParams extends coreClient.OperationOptions { } @@ -3113,6 +3163,17 @@ export interface Permission { notDataActions?: string[]; } +// @public +export interface PhysicalPartitionStorageInfo { + readonly id?: string; + readonly storageInKB?: number; +} + +// @public +export interface PhysicalPartitionStorageInfoCollection { + readonly physicalPartitionStorageInfoCollection?: PhysicalPartitionStorageInfo[]; +} + // @public export type PrimaryAggregationType = string; @@ -3261,6 +3322,7 @@ export interface RestorableDatabaseAccountGetResult { readonly id?: string; location?: string; readonly name?: string; + oldestRestorableTime?: Date; readonly restorableLocations?: RestorableLocationResource[]; readonly type?: string; } @@ -3788,6 +3850,7 @@ export interface SqlContainerListResult { // @public export interface SqlContainerResource { analyticalStorageTtl?: number; + clientEncryptionPolicy?: ClientEncryptionPolicy; conflictResolutionPolicy?: ConflictResolutionPolicy; defaultTtl?: number; id: string; @@ -3876,6 +3939,8 @@ export interface SqlResources { beginDeleteSqlTriggerAndWait(resourceGroupName: string, accountName: string, databaseName: string, containerName: string, triggerName: string, options?: SqlResourcesDeleteSqlTriggerOptionalParams): Promise; beginDeleteSqlUserDefinedFunction(resourceGroupName: string, accountName: string, databaseName: string, containerName: string, userDefinedFunctionName: string, options?: SqlResourcesDeleteSqlUserDefinedFunctionOptionalParams): Promise, void>>; beginDeleteSqlUserDefinedFunctionAndWait(resourceGroupName: string, accountName: string, databaseName: string, containerName: string, userDefinedFunctionName: string, options?: SqlResourcesDeleteSqlUserDefinedFunctionOptionalParams): Promise; + beginListSqlContainerPartitionMerge(resourceGroupName: string, accountName: string, databaseName: string, containerName: string, mergeParameters: MergeParameters, options?: SqlResourcesListSqlContainerPartitionMergeOptionalParams): Promise, SqlResourcesListSqlContainerPartitionMergeResponse>>; + beginListSqlContainerPartitionMergeAndWait(resourceGroupName: string, accountName: string, databaseName: string, containerName: string, mergeParameters: MergeParameters, options?: SqlResourcesListSqlContainerPartitionMergeOptionalParams): Promise; beginMigrateSqlContainerToAutoscale(resourceGroupName: string, accountName: string, databaseName: string, containerName: string, options?: SqlResourcesMigrateSqlContainerToAutoscaleOptionalParams): Promise, SqlResourcesMigrateSqlContainerToAutoscaleResponse>>; beginMigrateSqlContainerToAutoscaleAndWait(resourceGroupName: string, accountName: string, databaseName: string, containerName: string, options?: SqlResourcesMigrateSqlContainerToAutoscaleOptionalParams): Promise; beginMigrateSqlContainerToManualThroughput(resourceGroupName: string, accountName: string, databaseName: string, containerName: string, options?: SqlResourcesMigrateSqlContainerToManualThroughputOptionalParams): Promise, SqlResourcesMigrateSqlContainerToManualThroughputResponse>>; @@ -4101,6 +4166,15 @@ export interface SqlResourcesListClientEncryptionKeysOptionalParams extends core // @public export type SqlResourcesListClientEncryptionKeysResponse = ClientEncryptionKeysListResult; +// @public +export interface SqlResourcesListSqlContainerPartitionMergeOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type SqlResourcesListSqlContainerPartitionMergeResponse = PhysicalPartitionStorageInfoCollection; + // @public export interface SqlResourcesListSqlContainersOptionalParams extends coreClient.OperationOptions { } diff --git a/sdk/cosmosdb/arm-cosmosdb/rollup.config.js b/sdk/cosmosdb/arm-cosmosdb/rollup.config.js index 3f89d7309da5..9be1955eb7f1 100644 --- a/sdk/cosmosdb/arm-cosmosdb/rollup.config.js +++ b/sdk/cosmosdb/arm-cosmosdb/rollup.config.js @@ -14,14 +14,62 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + // #region Warning Handler /** - * A function that can determine whether a rollup warning should be ignored. If + * A function that can determine whether a rollupwarning should be ignored. If * the function returns `true`, then the warning will not be displayed. */ -function ignoreNiseSinonEval(warning) { +function ignoreNiseSinonEvalWarnings(warning) { return ( warning.code === "EVAL" && warning.id && @@ -30,14 +78,17 @@ function ignoreNiseSinonEval(warning) { ); } -function ignoreChaiCircularDependency(warning) { +function ignoreChaiCircularDependencyWarnings(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; /** * Construct a warning handler for the shared rollup configuration @@ -71,7 +122,22 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs(), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -107,7 +173,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve()] + plugins: [sourcemaps(), nodeResolve(), cjs()] }; const config = [baseConfig]; diff --git a/sdk/cosmosdb/arm-cosmosdb/src/cosmosDBManagementClient.ts b/sdk/cosmosdb/arm-cosmosdb/src/cosmosDBManagementClient.ts index 519978c2e531..33b963aeaaad 100644 --- a/sdk/cosmosdb/arm-cosmosdb/src/cosmosDBManagementClient.ts +++ b/sdk/cosmosdb/arm-cosmosdb/src/cosmosDBManagementClient.ts @@ -124,7 +124,7 @@ export class CosmosDBManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-cosmosdb/16.0.0-beta.2`; + const packageDetails = `azsdk-js-arm-cosmosdb/15.1.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -147,7 +147,7 @@ export class CosmosDBManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-11-15-preview"; + this.apiVersion = options.apiVersion || "2022-02-15-preview"; this.databaseAccounts = new DatabaseAccountsImpl(this); this.operations = new OperationsImpl(this); this.database = new DatabaseImpl(this); diff --git a/sdk/cosmosdb/arm-cosmosdb/src/models/index.ts b/sdk/cosmosdb/arm-cosmosdb/src/models/index.ts index bf19273468a1..731366d023e3 100644 --- a/sdk/cosmosdb/arm-cosmosdb/src/models/index.ts +++ b/sdk/cosmosdb/arm-cosmosdb/src/models/index.ts @@ -842,6 +842,8 @@ export interface KeyWrapMetadata { type?: string; /** Reference / link to the KeyEncryptionKey. */ value?: string; + /** Algorithm used in wrapping and unwrapping of the data encryption key. */ + algorithm?: string; } /** The resource model definition for a ARM proxy resource. It will have everything other than required location and tags */ @@ -892,6 +894,8 @@ export interface SqlContainerResource { uniqueKeyPolicy?: UniqueKeyPolicy; /** The conflict resolution policy for the container. */ conflictResolutionPolicy?: ConflictResolutionPolicy; + /** The client encryption policy for the container. */ + clientEncryptionPolicy?: ClientEncryptionPolicy; /** Analytical TTL. */ analyticalStorageTtl?: number; } @@ -986,6 +990,55 @@ export interface ConflictResolutionPolicy { conflictResolutionProcedure?: string; } +/** Cosmos DB client encryption policy. */ +export interface ClientEncryptionPolicy { + /** Paths of the item that need encryption along with path-specific settings. */ + includedPaths: ClientEncryptionIncludedPath[]; + /** Version of the client encryption policy definition. Please note, user passed value is ignored. Default policy version is 1. */ + policyFormatVersion?: number; +} + +/** . */ +export interface ClientEncryptionIncludedPath { + /** Path that needs to be encrypted. */ + path: string; + /** The identifier of the Client Encryption Key to be used to encrypt the path. */ + clientEncryptionKeyId: string; + /** The type of encryption to be performed. Eg - Deterministic, Randomized. */ + encryptionType: string; + /** The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256. */ + encryptionAlgorithm: string; +} + +/** The properties of an Azure Cosmos DB merge operations */ +export interface MergeParameters { + /** Specifies whether the operation is a real merge operation or a simulation. */ + isDryRun?: boolean; +} + +/** List of physical partitions and their properties returned by a merge operation. */ +export interface PhysicalPartitionStorageInfoCollection { + /** + * List of physical partitions and their properties. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly physicalPartitionStorageInfoCollection?: PhysicalPartitionStorageInfo[]; +} + +/** The storage of a physical partition */ +export interface PhysicalPartitionStorageInfo { + /** + * The unique identifier of the partition. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The storage in KB for the physical partition. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly storageInKB?: number; +} + /** The List operation response, that contains the storedProcedures and their properties. */ export interface SqlStoredProcedureListResult { /** @@ -1777,6 +1830,8 @@ export interface RestorableDatabaseAccountGetResult { accountName?: string; /** The creation time of the restorable database account (ISO-8601 format). */ creationTime?: Date; + /** The least recent time at which the database account can be restored to (ISO-8601 format). */ + oldestRestorableTime?: Date; /** The time at which the restorable database account has been deleted (ISO-8601 format). */ deletionTime?: Date; /** @@ -2344,6 +2399,12 @@ export interface PeriodicModeProperties { backupStorageRedundancy?: BackupStorageRedundancy; } +/** Configuration values for periodic mode backup */ +export interface ContinuousModeProperties { + /** Enum to indicate type of Continuos backup mode */ + tier?: ContinuousTier; +} + /** Describes the service response property. */ export interface DataTransferServiceResource { /** Properties for DataTransferServiceResource. */ @@ -2402,6 +2463,8 @@ export type PeriodicModeBackupPolicy = BackupPolicy & { export type ContinuousModeBackupPolicy = BackupPolicy & { /** Polymorphic discriminator, which specifies the different types this object can be */ type: "Continuous"; + /** Configuration values for continuous mode backup */ + continuousModeProperties?: ContinuousModeProperties; }; /** An Azure Cosmos DB database account. */ @@ -3290,7 +3353,8 @@ export type PublicNetworkAccess = string; export enum KnownServerVersion { Three2 = "3.2", Three6 = "3.6", - Four0 = "4.0" + Four0 = "4.0", + Four2 = "4.2" } /** @@ -3300,7 +3364,8 @@ export enum KnownServerVersion { * ### Known values supported by the service * **3.2** \ * **3.6** \ - * **4.0** + * **4.0** \ + * **4.2** */ export type ServerVersion = string; @@ -3904,6 +3969,22 @@ export enum KnownServiceStatus { */ export type ServiceStatus = string; +/** Known values of {@link ContinuousTier} that the service accepts. */ +export enum KnownContinuousTier { + Continuous7Days = "Continuous7Days", + Continuous30Days = "Continuous30Days" +} + +/** + * Defines values for ContinuousTier. \ + * {@link KnownContinuousTier} can be used interchangeably with ContinuousTier, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Continuous7Days** \ + * **Continuous30Days** + */ +export type ContinuousTier = string; + /** Known values of {@link NodeStatus} that the service accepts. */ export enum KnownNodeStatus { Up = "Up", @@ -4401,6 +4482,18 @@ export interface SqlResourcesDeleteSqlContainerOptionalParams resumeFrom?: string; } +/** Optional parameters. */ +export interface SqlResourcesListSqlContainerPartitionMergeOptionalParams + 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 listSqlContainerPartitionMerge operation. */ +export type SqlResourcesListSqlContainerPartitionMergeResponse = PhysicalPartitionStorageInfoCollection; + /** Optional parameters. */ export interface SqlResourcesGetSqlContainerThroughputOptionalParams extends coreClient.OperationOptions {} @@ -4744,6 +4837,18 @@ export interface MongoDBResourcesDeleteMongoDBCollectionOptionalParams resumeFrom?: string; } +/** Optional parameters. */ +export interface MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams + 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 listMongoDBCollectionPartitionMerge operation. */ +export type MongoDBResourcesListMongoDBCollectionPartitionMergeResponse = PhysicalPartitionStorageInfoCollection; + /** Optional parameters. */ export interface MongoDBResourcesGetMongoDBCollectionThroughputOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/cosmosdb/arm-cosmosdb/src/models/mappers.ts b/sdk/cosmosdb/arm-cosmosdb/src/models/mappers.ts index 186f45b7340f..6a8d0710c86a 100644 --- a/sdk/cosmosdb/arm-cosmosdb/src/models/mappers.ts +++ b/sdk/cosmosdb/arm-cosmosdb/src/models/mappers.ts @@ -1973,6 +1973,12 @@ export const KeyWrapMetadata: coreClient.CompositeMapper = { type: { name: "String" } + }, + algorithm: { + serializedName: "algorithm", + type: { + name: "String" + } } } } @@ -2092,6 +2098,13 @@ export const SqlContainerResource: coreClient.CompositeMapper = { className: "ConflictResolutionPolicy" } }, + clientEncryptionPolicy: { + serializedName: "clientEncryptionPolicy", + type: { + name: "Composite", + className: "ClientEncryptionPolicy" + } + }, analyticalStorageTtl: { serializedName: "analyticalStorageTtl", type: { @@ -2408,6 +2421,132 @@ export const ConflictResolutionPolicy: coreClient.CompositeMapper = { } }; +export const ClientEncryptionPolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientEncryptionPolicy", + modelProperties: { + includedPaths: { + serializedName: "includedPaths", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ClientEncryptionIncludedPath" + } + } + } + }, + policyFormatVersion: { + defaultValue: 1, + serializedName: "policyFormatVersion", + type: { + name: "Number" + } + } + } + } +}; + +export const ClientEncryptionIncludedPath: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientEncryptionIncludedPath", + modelProperties: { + path: { + serializedName: "path", + required: true, + type: { + name: "String" + } + }, + clientEncryptionKeyId: { + serializedName: "clientEncryptionKeyId", + required: true, + type: { + name: "String" + } + }, + encryptionType: { + serializedName: "encryptionType", + required: true, + type: { + name: "String" + } + }, + encryptionAlgorithm: { + serializedName: "encryptionAlgorithm", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const MergeParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MergeParameters", + modelProperties: { + isDryRun: { + serializedName: "isDryRun", + type: { + name: "Boolean" + } + } + } + } +}; + +export const PhysicalPartitionStorageInfoCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PhysicalPartitionStorageInfoCollection", + modelProperties: { + physicalPartitionStorageInfoCollection: { + serializedName: "physicalPartitionStorageInfoCollection", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PhysicalPartitionStorageInfo" + } + } + } + } + } + } +}; + +export const PhysicalPartitionStorageInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PhysicalPartitionStorageInfo", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + storageInKB: { + serializedName: "storageInKB", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + export const SqlStoredProcedureListResult: coreClient.CompositeMapper = { type: { name: "Composite", @@ -4610,6 +4749,12 @@ export const RestorableDatabaseAccountGetResult: coreClient.CompositeMapper = { name: "DateTime" } }, + oldestRestorableTime: { + serializedName: "properties.oldestRestorableTime", + type: { + name: "DateTime" + } + }, deletionTime: { serializedName: "properties.deletionTime", type: { @@ -5682,6 +5827,21 @@ export const PeriodicModeProperties: coreClient.CompositeMapper = { } }; +export const ContinuousModeProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ContinuousModeProperties", + modelProperties: { + tier: { + serializedName: "tier", + type: { + name: "String" + } + } + } + } +}; + export const DataTransferServiceResource: coreClient.CompositeMapper = { type: { name: "Composite", @@ -5814,7 +5974,14 @@ export const ContinuousModeBackupPolicy: coreClient.CompositeMapper = { uberParent: "BackupPolicy", polymorphicDiscriminator: BackupPolicy.type.polymorphicDiscriminator, modelProperties: { - ...BackupPolicy.type.modelProperties + ...BackupPolicy.type.modelProperties, + continuousModeProperties: { + serializedName: "continuousModeProperties", + type: { + name: "Composite", + className: "ContinuousModeProperties" + } + } } } }; diff --git a/sdk/cosmosdb/arm-cosmosdb/src/models/parameters.ts b/sdk/cosmosdb/arm-cosmosdb/src/models/parameters.ts index ed70e2586d6c..9971175ed42a 100644 --- a/sdk/cosmosdb/arm-cosmosdb/src/models/parameters.ts +++ b/sdk/cosmosdb/arm-cosmosdb/src/models/parameters.ts @@ -22,6 +22,7 @@ import { ThroughputSettingsUpdateParameters as ThroughputSettingsUpdateParametersMapper, ClientEncryptionKeyCreateUpdateParameters as ClientEncryptionKeyCreateUpdateParametersMapper, SqlContainerCreateUpdateParameters as SqlContainerCreateUpdateParametersMapper, + MergeParameters as MergeParametersMapper, SqlStoredProcedureCreateUpdateParameters as SqlStoredProcedureCreateUpdateParametersMapper, SqlUserDefinedFunctionCreateUpdateParameters as SqlUserDefinedFunctionCreateUpdateParametersMapper, SqlTriggerCreateUpdateParameters as SqlTriggerCreateUpdateParametersMapper, @@ -119,7 +120,7 @@ export const accountName: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-11-15-preview", + defaultValue: "2022-02-15-preview", isConstant: true, serializedName: "api-version", type: { @@ -338,6 +339,11 @@ export const createUpdateSqlContainerParameters: OperationParameter = { mapper: SqlContainerCreateUpdateParametersMapper }; +export const mergeParameters: OperationParameter = { + parameterPath: "mergeParameters", + mapper: MergeParametersMapper +}; + export const storedProcedureName: OperationURLParameter = { parameterPath: "storedProcedureName", mapper: { diff --git a/sdk/cosmosdb/arm-cosmosdb/src/operations/mongoDBResources.ts b/sdk/cosmosdb/arm-cosmosdb/src/operations/mongoDBResources.ts index 4623ec4d9ede..4b69ca25ab28 100644 --- a/sdk/cosmosdb/arm-cosmosdb/src/operations/mongoDBResources.ts +++ b/sdk/cosmosdb/arm-cosmosdb/src/operations/mongoDBResources.ts @@ -46,6 +46,9 @@ import { MongoDBResourcesCreateUpdateMongoDBCollectionOptionalParams, MongoDBResourcesCreateUpdateMongoDBCollectionResponse, MongoDBResourcesDeleteMongoDBCollectionOptionalParams, + MergeParameters, + MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams, + MongoDBResourcesListMongoDBCollectionPartitionMergeResponse, MongoDBResourcesGetMongoDBCollectionThroughputOptionalParams, MongoDBResourcesGetMongoDBCollectionThroughputResponse, MongoDBResourcesUpdateMongoDBCollectionThroughputOptionalParams, @@ -1107,6 +1110,116 @@ export class MongoDBResourcesImpl implements MongoDBResources { return poller.pollUntilDone(); } + /** + * Merges the partitions of a MongoDB Collection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param mergeParameters The parameters for the merge operation. + * @param options The options parameters. + */ + async beginListMongoDBCollectionPartitionMerge( + resourceGroupName: string, + accountName: string, + databaseName: string, + collectionName: string, + mergeParameters: MergeParameters, + options?: MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams + ): Promise< + PollerLike< + PollOperationState< + MongoDBResourcesListMongoDBCollectionPartitionMergeResponse + >, + MongoDBResourcesListMongoDBCollectionPartitionMergeResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { + resourceGroupName, + accountName, + databaseName, + collectionName, + mergeParameters, + options + }, + listMongoDBCollectionPartitionMergeOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + } + + /** + * Merges the partitions of a MongoDB Collection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param mergeParameters The parameters for the merge operation. + * @param options The options parameters. + */ + async beginListMongoDBCollectionPartitionMergeAndWait( + resourceGroupName: string, + accountName: string, + databaseName: string, + collectionName: string, + mergeParameters: MergeParameters, + options?: MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams + ): Promise { + const poller = await this.beginListMongoDBCollectionPartitionMerge( + resourceGroupName, + accountName, + databaseName, + collectionName, + mergeParameters, + options + ); + return poller.pollUntilDone(); + } + /** * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account * with the provided name. @@ -2293,6 +2406,41 @@ const deleteMongoDBCollectionOperationSpec: coreClient.OperationSpec = { ], serializer }; +const listMongoDBCollectionPartitionMergeOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.PhysicalPartitionStorageInfoCollection + }, + 201: { + bodyMapper: Mappers.PhysicalPartitionStorageInfoCollection + }, + 202: { + bodyMapper: Mappers.PhysicalPartitionStorageInfoCollection + }, + 204: { + bodyMapper: Mappers.PhysicalPartitionStorageInfoCollection + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.mergeParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.collectionName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; const getMongoDBCollectionThroughputOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", diff --git a/sdk/cosmosdb/arm-cosmosdb/src/operations/sqlResources.ts b/sdk/cosmosdb/arm-cosmosdb/src/operations/sqlResources.ts index 4e05e682839e..b3445e443043 100644 --- a/sdk/cosmosdb/arm-cosmosdb/src/operations/sqlResources.ts +++ b/sdk/cosmosdb/arm-cosmosdb/src/operations/sqlResources.ts @@ -60,6 +60,9 @@ import { SqlResourcesCreateUpdateSqlContainerOptionalParams, SqlResourcesCreateUpdateSqlContainerResponse, SqlResourcesDeleteSqlContainerOptionalParams, + MergeParameters, + SqlResourcesListSqlContainerPartitionMergeOptionalParams, + SqlResourcesListSqlContainerPartitionMergeResponse, SqlResourcesGetSqlContainerThroughputOptionalParams, SqlResourcesGetSqlContainerThroughputResponse, SqlResourcesUpdateSqlContainerThroughputOptionalParams, @@ -1586,6 +1589,114 @@ export class SqlResourcesImpl implements SqlResources { return poller.pollUntilDone(); } + /** + * Merges the partitions of a SQL Container + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param mergeParameters The parameters for the merge operation. + * @param options The options parameters. + */ + async beginListSqlContainerPartitionMerge( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + mergeParameters: MergeParameters, + options?: SqlResourcesListSqlContainerPartitionMergeOptionalParams + ): Promise< + PollerLike< + PollOperationState, + SqlResourcesListSqlContainerPartitionMergeResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { + resourceGroupName, + accountName, + databaseName, + containerName, + mergeParameters, + options + }, + listSqlContainerPartitionMergeOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + } + + /** + * Merges the partitions of a SQL Container + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param mergeParameters The parameters for the merge operation. + * @param options The options parameters. + */ + async beginListSqlContainerPartitionMergeAndWait( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + mergeParameters: MergeParameters, + options?: SqlResourcesListSqlContainerPartitionMergeOptionalParams + ): Promise { + const poller = await this.beginListSqlContainerPartitionMerge( + resourceGroupName, + accountName, + databaseName, + containerName, + mergeParameters, + options + ); + return poller.pollUntilDone(); + } + /** * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -3635,6 +3746,41 @@ const deleteSqlContainerOperationSpec: coreClient.OperationSpec = { ], serializer }; +const listSqlContainerPartitionMergeOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.PhysicalPartitionStorageInfoCollection + }, + 201: { + bodyMapper: Mappers.PhysicalPartitionStorageInfoCollection + }, + 202: { + bodyMapper: Mappers.PhysicalPartitionStorageInfoCollection + }, + 204: { + bodyMapper: Mappers.PhysicalPartitionStorageInfoCollection + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.mergeParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.databaseName, + Parameters.containerName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; const getSqlContainerThroughputOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", diff --git a/sdk/cosmosdb/arm-cosmosdb/src/operationsInterfaces/mongoDBResources.ts b/sdk/cosmosdb/arm-cosmosdb/src/operationsInterfaces/mongoDBResources.ts index 818a969142b0..0fd12d5a9e86 100644 --- a/sdk/cosmosdb/arm-cosmosdb/src/operationsInterfaces/mongoDBResources.ts +++ b/sdk/cosmosdb/arm-cosmosdb/src/operationsInterfaces/mongoDBResources.ts @@ -38,6 +38,9 @@ import { MongoDBResourcesCreateUpdateMongoDBCollectionOptionalParams, MongoDBResourcesCreateUpdateMongoDBCollectionResponse, MongoDBResourcesDeleteMongoDBCollectionOptionalParams, + MergeParameters, + MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams, + MongoDBResourcesListMongoDBCollectionPartitionMergeResponse, MongoDBResourcesGetMongoDBCollectionThroughputOptionalParams, MongoDBResourcesGetMongoDBCollectionThroughputResponse, MongoDBResourcesUpdateMongoDBCollectionThroughputOptionalParams, @@ -394,6 +397,47 @@ export interface MongoDBResources { collectionName: string, options?: MongoDBResourcesDeleteMongoDBCollectionOptionalParams ): Promise; + /** + * Merges the partitions of a MongoDB Collection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param mergeParameters The parameters for the merge operation. + * @param options The options parameters. + */ + beginListMongoDBCollectionPartitionMerge( + resourceGroupName: string, + accountName: string, + databaseName: string, + collectionName: string, + mergeParameters: MergeParameters, + options?: MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams + ): Promise< + PollerLike< + PollOperationState< + MongoDBResourcesListMongoDBCollectionPartitionMergeResponse + >, + MongoDBResourcesListMongoDBCollectionPartitionMergeResponse + > + >; + /** + * Merges the partitions of a MongoDB Collection + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param mergeParameters The parameters for the merge operation. + * @param options The options parameters. + */ + beginListMongoDBCollectionPartitionMergeAndWait( + resourceGroupName: string, + accountName: string, + databaseName: string, + collectionName: string, + mergeParameters: MergeParameters, + options?: MongoDBResourcesListMongoDBCollectionPartitionMergeOptionalParams + ): Promise; /** * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account * with the provided name. diff --git a/sdk/cosmosdb/arm-cosmosdb/src/operationsInterfaces/sqlResources.ts b/sdk/cosmosdb/arm-cosmosdb/src/operationsInterfaces/sqlResources.ts index 2a33b0cd3c31..98af10a64820 100644 --- a/sdk/cosmosdb/arm-cosmosdb/src/operationsInterfaces/sqlResources.ts +++ b/sdk/cosmosdb/arm-cosmosdb/src/operationsInterfaces/sqlResources.ts @@ -51,6 +51,9 @@ import { SqlResourcesCreateUpdateSqlContainerOptionalParams, SqlResourcesCreateUpdateSqlContainerResponse, SqlResourcesDeleteSqlContainerOptionalParams, + MergeParameters, + SqlResourcesListSqlContainerPartitionMergeOptionalParams, + SqlResourcesListSqlContainerPartitionMergeResponse, SqlResourcesGetSqlContainerThroughputOptionalParams, SqlResourcesGetSqlContainerThroughputResponse, SqlResourcesUpdateSqlContainerThroughputOptionalParams, @@ -532,6 +535,45 @@ export interface SqlResources { containerName: string, options?: SqlResourcesDeleteSqlContainerOptionalParams ): Promise; + /** + * Merges the partitions of a SQL Container + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param mergeParameters The parameters for the merge operation. + * @param options The options parameters. + */ + beginListSqlContainerPartitionMerge( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + mergeParameters: MergeParameters, + options?: SqlResourcesListSqlContainerPartitionMergeOptionalParams + ): Promise< + PollerLike< + PollOperationState, + SqlResourcesListSqlContainerPartitionMergeResponse + > + >; + /** + * Merges the partitions of a SQL Container + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param mergeParameters The parameters for the merge operation. + * @param options The options parameters. + */ + beginListSqlContainerPartitionMergeAndWait( + resourceGroupName: string, + accountName: string, + databaseName: string, + containerName: string, + mergeParameters: MergeParameters, + options?: SqlResourcesListSqlContainerPartitionMergeOptionalParams + ): Promise; /** * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. * @param resourceGroupName The name of the resource group. The name is case insensitive. diff --git a/sdk/cosmosdb/arm-cosmosdb/test/sampleTest.ts b/sdk/cosmosdb/arm-cosmosdb/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/cosmosdb/arm-cosmosdb/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + 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" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/cosmosdb/ci.mgmt.yml b/sdk/cosmosdb/ci.mgmt.yml index aca191fac962..58f1a8e575a7 100644 --- a/sdk/cosmosdb/ci.mgmt.yml +++ b/sdk/cosmosdb/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -10,7 +10,7 @@ trigger: include: - sdk/cosmosdb/arm-cosmosdb/ - sdk/cosmosdb/ci.mgmt.yml - + - sdk/cosmosdb/arm-cosmosdb pr: branches: include: @@ -19,16 +19,16 @@ pr: - release/* - hotfix/* exclude: - - feature/v4 + - feature/v4 paths: include: - sdk/cosmosdb/arm-cosmosdb/ - sdk/cosmosdb/ci.mgmt.yml - + - sdk/cosmosdb/arm-cosmosdb extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: cosmosdb Artifacts: - name: azure-arm-cosmosdb - safeName: azurearmcosmosdb \ No newline at end of file + safeName: azurearmcosmosdb diff --git a/sdk/cosmosdb/ci.yml b/sdk/cosmosdb/ci.yml index dbd0136dbf8b..284dab86de3c 100644 --- a/sdk/cosmosdb/ci.yml +++ b/sdk/cosmosdb/ci.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -13,6 +13,7 @@ trigger: exclude: - sdk/cosmosdb/arm-cosmosdb/ - sdk/cosmosdb/ci.mgmt.yml + - sdk/cosmosdb/arm-cosmosdb pr: branches: include: @@ -27,12 +28,11 @@ pr: exclude: - sdk/cosmosdb/arm-cosmosdb/ - sdk/cosmosdb/ci.mgmt.yml + - sdk/cosmosdb/arm-cosmosdb extends: - template: /eng/pipelines/templates/stages/cosmos-sdk-client.yml #NOTE: Non-standard template. + template: /eng/pipelines/templates/stages/cosmos-sdk-client.yml parameters: ServiceDirectory: cosmosdb - # Disable unit tests because they are no-op. Integration tests from the - # cosmos-specific template handle this testing. RunUnitTests: false Artifacts: - name: azure-cosmos