Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR @azure/arm-cosmosdb] fix cosmosdb examples #3435

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions sdk/cosmosdb/arm-cosmosdb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# Release History

## 16.0.0-beta.6 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

## 16.0.0-beta.5 (2023-01-03)

## 15.3.0-beta.1 (2023-01-06)

**Features**

Expand Down Expand Up @@ -93,6 +83,7 @@
- Added Interface ClientEncryptionPolicy
- Added Interface ContinuousModeProperties
- Added Interface CosmosCassandraDataTransferDataSourceSink
- Added Interface CosmosMongoDataTransferDataSourceSink
- Added Interface CosmosSqlDataTransferDataSourceSink
- Added Interface CreateJobRequest
- Added Interface DataTransferDataSourceSink
Expand Down
8 changes: 4 additions & 4 deletions sdk/cosmosdb/arm-cosmosdb/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "35388d90dfe0dfb8ef0f43cecaf9dc960fbc917e",
"readme": "specification\\cosmos-db\\resource-manager\\readme.md",
"autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\cosmos-db\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.5.20221215.1 --generate-sample=true",
"commit": "db1186ad066d08f5a972ab7777cf05234a6f7dfc",
"readme": "specification/cosmos-db/resource-manager/readme.md",
"autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --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-rc.5",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.5.4",
"use": "@autorest/typescript@6.0.0-rc.5.20221215.1"
"use": "@autorest/typescript@6.0.0-rc.5"
}
17 changes: 4 additions & 13 deletions sdk/cosmosdb/arm-cosmosdb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for CosmosDBManagementClient.",
"version": "16.0.0-beta.6",
"version": "15.3.0-beta.1",
"engines": {
"node": ">=14.0.0"
},
Expand Down Expand Up @@ -39,7 +39,6 @@
"typescript": "~4.8.0",
"uglify-js": "^3.4.9",
"rimraf": "^3.0.0",
"dotenv": "^8.2.0",
"@azure/identity": "^2.0.1",
"@azure-tools/test-recorder": "^2.0.0",
"@azure-tools/test-credential": "^1.0.0",
Expand All @@ -50,6 +49,7 @@
"@types/node": "^14.0.0",
"@azure/dev-tool": "^1.0.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosdb/arm-cosmosdb",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
Expand Down Expand Up @@ -110,14 +110,5 @@
}
]
},
"autoPublish": true,
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosdb/arm-cosmosdb",
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-cosmosdb?view=azure-node-preview"
}
}
"autoPublish": true
}
14 changes: 12 additions & 2 deletions sdk/cosmosdb/arm-cosmosdb/review/arm-cosmosdb.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,15 @@ export interface CosmosDBManagementClientOptionalParams extends coreClient.Servi
endpoint?: string;
}

// @public
export interface CosmosMongoDataTransferDataSourceSink extends DataTransferDataSourceSink {
// (undocumented)
collectionName: string;
component: "CosmosDBMongo";
// (undocumented)
databaseName: string;
}

// @public
export interface CosmosSqlDataTransferDataSourceSink extends DataTransferDataSourceSink {
component: "CosmosDBSql";
Expand Down Expand Up @@ -1476,11 +1485,11 @@ export type DataTransferComponent = string;

// @public
export interface DataTransferDataSourceSink {
component: "CosmosDBCassandra" | "CosmosDBSql" | "AzureBlobStorage";
component: "CosmosDBCassandra" | "CosmosDBMongo" | "CosmosDBSql" | "AzureBlobStorage";
}

// @public (undocumented)
export type DataTransferDataSourceSinkUnion = DataTransferDataSourceSink | CosmosCassandraDataTransferDataSourceSink | CosmosSqlDataTransferDataSourceSink | AzureBlobDataTransferDataSourceSink;
export type DataTransferDataSourceSinkUnion = DataTransferDataSourceSink | CosmosCassandraDataTransferDataSourceSink | CosmosMongoDataTransferDataSourceSink | CosmosSqlDataTransferDataSourceSink | AzureBlobDataTransferDataSourceSink;

// @public
export interface DataTransferJobFeedResults {
Expand Down Expand Up @@ -2113,6 +2122,7 @@ export enum KnownDatabaseAccountKind {
export enum KnownDataTransferComponent {
AzureBlobStorage = "AzureBlobStorage",
CosmosDBCassandra = "CosmosDBCassandra",
CosmosDBMongo = "CosmosDBMongo",
CosmosDBSql = "CosmosDBSql"
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/arm-cosmosdb/src/cosmosDBManagementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class CosmosDBManagementClient extends coreClient.ServiceClient {
credential: credentials
};

const packageDetails = `azsdk-js-arm-cosmosdb/16.0.0-beta.6`;
const packageDetails = `azsdk-js-arm-cosmosdb/15.3.0-beta.1`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
Expand Down
19 changes: 18 additions & 1 deletion sdk/cosmosdb/arm-cosmosdb/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type BackupPolicyUnion =
export type DataTransferDataSourceSinkUnion =
| DataTransferDataSourceSink
| CosmosCassandraDataTransferDataSourceSink
| CosmosMongoDataTransferDataSourceSink
| CosmosSqlDataTransferDataSourceSink
| AzureBlobDataTransferDataSourceSink;
export type ServiceResourcePropertiesUnion =
Expand Down Expand Up @@ -1454,7 +1455,11 @@ export interface DataTransferJobProperties {
/** Base class for all DataTransfer source/sink */
export interface DataTransferDataSourceSink {
/** Polymorphic discriminator, which specifies the different types this object can be */
component: "CosmosDBCassandra" | "CosmosDBSql" | "AzureBlobStorage";
component:
| "CosmosDBCassandra"
| "CosmosDBMongo"
| "CosmosDBSql"
| "AzureBlobStorage";
}

/** The List operation response, that contains the Data Transfer jobs and their properties. */
Expand Down Expand Up @@ -3470,6 +3475,15 @@ export interface CosmosCassandraDataTransferDataSourceSink
tableName: string;
}

/** A CosmosDB Cassandra API data source/sink */
export interface CosmosMongoDataTransferDataSourceSink
extends DataTransferDataSourceSink {
/** Polymorphic discriminator, which specifies the different types this object can be */
component: "CosmosDBMongo";
databaseName: string;
collectionName: string;
}

/** A CosmosDB Cassandra API data source/sink */
export interface CosmosSqlDataTransferDataSourceSink
extends DataTransferDataSourceSink {
Expand Down Expand Up @@ -4112,6 +4126,8 @@ export type BackupStorageRedundancy = string;
export enum KnownDataTransferComponent {
/** CosmosDBCassandra */
CosmosDBCassandra = "CosmosDBCassandra",
/** CosmosDBMongo */
CosmosDBMongo = "CosmosDBMongo",
/** CosmosDBSql */
CosmosDBSql = "CosmosDBSql",
/** AzureBlobStorage */
Expand All @@ -4124,6 +4140,7 @@ export enum KnownDataTransferComponent {
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **CosmosDBCassandra** \
* **CosmosDBMongo** \
* **CosmosDBSql** \
* **AzureBlobStorage**
*/
Expand Down
29 changes: 29 additions & 0 deletions sdk/cosmosdb/arm-cosmosdb/src/models/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8699,6 +8699,34 @@ export const CosmosCassandraDataTransferDataSourceSink: coreClient.CompositeMapp
}
};

export const CosmosMongoDataTransferDataSourceSink: coreClient.CompositeMapper = {
serializedName: "CosmosDBMongo",
type: {
name: "Composite",
className: "CosmosMongoDataTransferDataSourceSink",
uberParent: "DataTransferDataSourceSink",
polymorphicDiscriminator:
DataTransferDataSourceSink.type.polymorphicDiscriminator,
modelProperties: {
...DataTransferDataSourceSink.type.modelProperties,
databaseName: {
serializedName: "databaseName",
required: true,
type: {
name: "String"
}
},
collectionName: {
serializedName: "collectionName",
required: true,
type: {
name: "String"
}
}
}
}
};

export const CosmosSqlDataTransferDataSourceSink: coreClient.CompositeMapper = {
serializedName: "CosmosDBSql",
type: {
Expand Down Expand Up @@ -8992,6 +9020,7 @@ export let discriminators = {
"BackupPolicy.Periodic": PeriodicModeBackupPolicy,
"BackupPolicy.Continuous": ContinuousModeBackupPolicy,
"DataTransferDataSourceSink.CosmosDBCassandra": CosmosCassandraDataTransferDataSourceSink,
"DataTransferDataSourceSink.CosmosDBMongo": CosmosMongoDataTransferDataSourceSink,
"DataTransferDataSourceSink.CosmosDBSql": CosmosSqlDataTransferDataSourceSink,
"DataTransferDataSourceSink.AzureBlobStorage": AzureBlobDataTransferDataSourceSink,
"ServiceResourceProperties.DataTransfer": DataTransferServiceResourceProperties,
Expand Down
43 changes: 43 additions & 0 deletions sdk/cosmosdb/arm-cosmosdb/test/sampleTest.ts
Original file line number Diff line number Diff line change
@@ -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.
*/

import {
Recorder,
RecorderStartOptions,
env
} from "@azure-tools/test-recorder";
import { assert } from "chai";
import { Context } from "mocha";

const replaceableVariables: Record<string, string> = {
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 recorderOptions: RecorderStartOptions = {
envSetupForPlayback: replaceableVariables
};

describe("My test", () => {
let recorder: Recorder;

beforeEach(async function(this: Context) {
recorder = new Recorder(this.currentTest);
await recorder.start(recorderOptions);
});

afterEach(async function() {
await recorder.stop();
});

it("sample test", async function() {
console.log("Hi, I'm a test!");
});
});
10 changes: 2 additions & 8 deletions sdk/cosmosdb/arm-cosmosdb/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@
],
"declaration": true,
"outDir": "./dist-esm",
"importHelpers": true,
"paths": {
"@azure/arm-cosmosdb": [
"./src/index"
]
}
"importHelpers": true
},
"include": [
"./src/**/*.ts",
"./test/**/*.ts",
"samples-dev/**/*.ts"
"./test/**/*.ts"
],
"exclude": [
"node_modules"
Expand Down