Address feedbacks: Improve readme, fix documentation (#12167)

This commit is contained in:
Zoltan Varga 2020-11-02 18:27:31 -08:00 коммит произвёл GitHub
Родитель e07f7d8d7f
Коммит df030f4a06
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
17 изменённых файлов: 717 добавлений и 1459 удалений

Просмотреть файл

@ -1,5 +1,12 @@
# Release History
## 1.0.0 (2020-10-30)
- The is the GA release containing the following changes:
- Expose ifMatch, ifNoneMatch optional parameters for upsertDigitalTwin and upsert Relationship APIs
- Rename etag parameter to ifMatch
- Fix some documentation
## 1.0.0-preview.2 (2020-10-23)
- This release is an update of the preview with the following changes

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "@azure/digital-twins-core",
"version": "1.0.0-preview.2",
"version": "1.0.0",
"description": "An isomorphic client library for Azure Digital Twins",
"sdk-type": "client",
"author": "Microsoft Corporation",
@ -72,13 +72,15 @@
"tslib": "^2.0.0"
},
"devDependencies": {
"@azure/identity": "^1.1.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/identity": "^1.1.0",
"@azure/test-utils-recorder": "^1.0.0",
"@microsoft/api-extractor": "7.7.11",
"@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",
"@rollup/plugin-replace": "^2.2.0",
"@types/chai": "^4.1.6",
"@types/mocha": "^7.0.2",
@ -108,8 +110,6 @@
"prettier": "^1.16.4",
"rimraf": "^3.0.0",
"rollup": "^1.16.3",
"@rollup/plugin-commonjs": "11.0.2",
"@rollup/plugin-node-resolve": "^8.0.0",
"rollup-plugin-shim": "^1.0.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-terser": "^5.1.1",

Просмотреть файл

@ -41,11 +41,25 @@ export interface DigitalTwinsAddHeaders {
etag?: string;
}
// @public
export interface DigitalTwinsAddOptionalParams extends coreHttp.OperationOptions {
ifNoneMatch?: string;
traceparent?: string;
tracestate?: string;
}
// @public
export interface DigitalTwinsAddRelationshipHeaders {
etag?: string;
}
// @public
export interface DigitalTwinsAddRelationshipOptionalParams extends coreHttp.OperationOptions {
ifNoneMatch?: string;
traceparent?: string;
tracestate?: string;
}
// @public
export type DigitalTwinsAddRelationshipResponse = DigitalTwinsAddRelationshipHeaders & {
body: any;
@ -69,30 +83,30 @@ export type DigitalTwinsAddResponse = DigitalTwinsAddHeaders & {
// @public
export class DigitalTwinsClient {
constructor(endpointUrl: string, credential: TokenCredential, options?: DigitalTwinsClientOptions);
createModels(models: any[], options?: OperationOptions): Promise<DigitalTwinModelsAddResponse>;
createModels(dtdlModels: any[], options?: OperationOptions): Promise<DigitalTwinModelsAddResponse>;
decomissionModel(modelId: string, options?: OperationOptions): Promise<RestResponse>;
deleteDigitalTwin(digitalTwinId: string, etag?: string, options?: OperationOptions): Promise<RestResponse>;
deleteDigitalTwin(digitalTwinId: string, options?: DigitalTwinsDeleteOptionalParams): Promise<RestResponse>;
deleteEventRoute(eventRouteId: string, options?: OperationOptions): Promise<RestResponse>;
deleteModel(modelId: string, options?: OperationOptions): Promise<RestResponse>;
deleteRelationship(digitalTwinId: string, relationshipId: string, etag?: string, options?: OperationOptions): Promise<RestResponse>;
deleteRelationship(digitalTwinId: string, relationshipId: string, options?: DigitalTwinsDeleteRelationshipOptionalParams): Promise<RestResponse>;
getComponent(digitalTwinId: string, componentName: string, options?: OperationOptions): Promise<DigitalTwinsGetComponentResponse>;
getDigitalTwin(digitalTwinId: string, options?: OperationOptions): Promise<DigitalTwinsGetByIdResponse>;
getEventRoute(eventRouteId: string, options?: OperationOptions): Promise<EventRoutesGetByIdResponse>;
getModel(modelId: string, includeModelDefinition?: boolean, options?: OperationOptions): Promise<DigitalTwinModelsGetByIdResponse>;
getRelationship(digitalTwinId: string, relationshipId: string, options?: OperationOptions): Promise<DigitalTwinsGetRelationshipByIdResponse>;
listEventRoutes(resultsPerPage?: number, options?: OperationOptions): PagedAsyncIterableIterator<EventRoute, EventRoutesListNextResponse>;
listIncomingRelationships(digitalTwinId: string, options?: OperationOptions): PagedAsyncIterableIterator<IncomingRelationship, DigitalTwinsListIncomingRelationshipsResponse>;
listModels(dependeciesFor?: string[], includeModelDefinition?: boolean, resultsPerPage?: number, options?: OperationOptions): PagedAsyncIterableIterator<DigitalTwinsModelData, DigitalTwinModelsListResponse>;
listEventRoutes(resultsPerPage?: number, options?: OperationOptions & PageSettings): PagedAsyncIterableIterator<EventRoute, EventRoutesListNextResponse>;
listIncomingRelationships(digitalTwinId: string, options?: OperationOptions & PageSettings): PagedAsyncIterableIterator<IncomingRelationship, DigitalTwinsListIncomingRelationshipsResponse>;
listModels(dependeciesFor?: string[], includeModelDefinition?: boolean, resultsPerPage?: number, options?: OperationOptions & PageSettings): PagedAsyncIterableIterator<DigitalTwinsModelData, DigitalTwinModelsListResponse>;
listRelationships(digitalTwinId: string, options?: OperationOptions & PageSettings): PagedAsyncIterableIterator<any, DigitalTwinsListRelationshipsResponse>;
publishComponentTelemetry(digitalTwinId: string, componentName: string, payload: string, messageId?: string, options?: OperationOptions): Promise<RestResponse>;
publishTelemetry(digitalTwinId: string, payload: any, messageId: string, options?: OperationOptions): Promise<RestResponse>;
queryTwins(query: string, resultsPerPage?: number, options?: OperationOptions): PagedAsyncIterableIterator<any, QueryQueryTwinsResponse>;
updateComponent(digitalTwinId: string, componentName: string, jsonPatch: any[], etag?: string, options?: OperationOptions): Promise<DigitalTwinsUpdateComponentResponse>;
updateDigitalTwin(digitalTwinId: string, jsonPatch: any, etag?: string, options?: OperationOptions): Promise<DigitalTwinsUpdateResponse>;
updateRelationship(digitalTwinId: string, relationshipId: string, jsonPatch: any[], etag?: string, options?: OperationOptions): Promise<DigitalTwinsUpdateRelationshipResponse>;
upsertDigitalTwin(digitalTwinId: string, digitalTwinJson: string, options?: OperationOptions): Promise<DigitalTwinsAddResponse>;
queryTwins(query: string, resultsPerPage?: number, options?: OperationOptions & PageSettings): PagedAsyncIterableIterator<any, QueryQueryTwinsResponse>;
updateComponent(digitalTwinId: string, componentName: string, jsonPatch: any[], options?: DigitalTwinsUpdateComponentOptionalParams): Promise<DigitalTwinsUpdateComponentResponse>;
updateDigitalTwin(digitalTwinId: string, jsonPatch: any, options?: DigitalTwinsUpdateOptionalParams): Promise<DigitalTwinsUpdateResponse>;
updateRelationship(digitalTwinId: string, relationshipId: string, jsonPatch: any[], options?: DigitalTwinsUpdateRelationshipOptionalParams): Promise<DigitalTwinsUpdateRelationshipResponse>;
upsertDigitalTwin(digitalTwinId: string, digitalTwinJson: string, options?: DigitalTwinsAddOptionalParams): Promise<DigitalTwinsAddResponse>;
upsertEventRoute(eventRouteId: string, endpointId: string, filter: string, options?: OperationOptions): Promise<RestResponse>;
upsertRelationship(digitalTwinId: string, relationshipId: string, relationship: any, options?: OperationOptions): Promise<DigitalTwinsAddRelationshipResponse>;
upsertRelationship(digitalTwinId: string, relationshipId: string, relationship: any, options?: DigitalTwinsAddRelationshipOptionalParams): Promise<DigitalTwinsAddRelationshipResponse>;
}
// @public (undocumented)
@ -100,6 +114,20 @@ export interface DigitalTwinsClientOptions extends PipelineOptions {
apiVersion?: string;
}
// @public
export interface DigitalTwinsDeleteOptionalParams extends coreHttp.OperationOptions {
ifMatch?: string;
traceparent?: string;
tracestate?: string;
}
// @public
export interface DigitalTwinsDeleteRelationshipOptionalParams extends coreHttp.OperationOptions {
ifMatch?: string;
traceparent?: string;
tracestate?: string;
}
// @public
export interface DigitalTwinsGetByIdHeaders {
etag?: string;
@ -180,6 +208,13 @@ export interface DigitalTwinsUpdateComponentHeaders {
etag?: string;
}
// @public
export interface DigitalTwinsUpdateComponentOptionalParams extends coreHttp.OperationOptions {
ifMatch?: string;
traceparent?: string;
tracestate?: string;
}
// @public
export type DigitalTwinsUpdateComponentResponse = DigitalTwinsUpdateComponentHeaders & {
_response: coreHttp.HttpResponse & {
@ -192,11 +227,25 @@ export interface DigitalTwinsUpdateHeaders {
etag?: string;
}
// @public
export interface DigitalTwinsUpdateOptionalParams extends coreHttp.OperationOptions {
ifMatch?: string;
traceparent?: string;
tracestate?: string;
}
// @public
export interface DigitalTwinsUpdateRelationshipHeaders {
etag?: string;
}
// @public
export interface DigitalTwinsUpdateRelationshipOptionalParams extends coreHttp.OperationOptions {
ifMatch?: string;
traceparent?: string;
tracestate?: string;
}
// @public
export type DigitalTwinsUpdateRelationshipResponse = DigitalTwinsUpdateRelationshipHeaders & {
_response: coreHttp.HttpResponse & {

Просмотреть файл

@ -59,6 +59,8 @@ It provides an opportunity to override default behavior including:
Let's create models using the code below. You need to pass in `any[]` containing list of json models.
Check out sample models [here](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/digitaltwins/digital-twins-core/samples/dtdl/models).
Note: The sample dtdls are using "ts" extension in the Typescript repository. If you want to use the dtdl samples with CLI tools please
change their extension to "json".
```JavaScript Snippet:dt_models_lifecycle.js
const newModels = [temporaryComponent, temporaryModel];
@ -131,6 +133,9 @@ console.log(`DigitalTwin: ${twin.body}`);
Query the Azure Digital Twins instance for digital twins using the [Azure Digital Twins Query Store lanaguage](https://review.docs.microsoft.com/azure/digital-twins/concepts-query-language). Query calls support paging. Here's an example of how to query for digital twins and how to iterate over the results.
Note that there may be a delay between before changes in your instance are reflected in queries.
For more details on query limitations, see ("https://docs.microsoft.com/en-us/azure/digital-twins/how-to-query-graph#query-limitations">Query)
```JavaScript Snippet:dt_digitaltwins_query
const query = "SELECT * FROM digitaltwins";
const queryResult = serviceClient.queryTwins(query);

Просмотреть файл

@ -1,14 +1,14 @@
{
"name": "azure-digital-twins-core-samples-js",
"private": true,
"version": "1.0.0-preview.2",
"version": "1.0.0",
"description": "Samples for the azure/digital-twins-core client library for Javascript",
"author": "Microsoft Corporation",
"license": "MIT",
"main": "dt_create_digitaltwins_service_client.js",
"dependencies": {
"@azure/digital-twins-core": "file:../..",
"@azure/core-http": "^1.1.6",
"@azure/digital-twins-core": "file:../..",
"@azure/identity": "^1.1.0"
}
}

Просмотреть файл

@ -7,7 +7,6 @@ import {
TokenCredential,
RestResponse,
OperationOptions,
RequestOptionsBase,
InternalPipelineOptions,
bearerTokenAuthenticationPolicy,
createPipelineFromOptions,
@ -17,14 +16,12 @@ import {
import { PageSettings, PagedAsyncIterableIterator } from "@azure/core-paging";
import { AzureDigitalTwinsAPI as GeneratedClient } from "./generated/azureDigitalTwinsAPI";
import {
DigitalTwinsGetByIdOptionalParams,
DigitalTwinsGetByIdResponse,
DigitalTwinsAddOptionalParams,
DigitalTwinsAddResponse,
DigitalTwinsUpdateOptionalParams,
DigitalTwinsUpdateResponse,
DigitalTwinsDeleteOptionalParams,
DigitalTwinsGetComponentOptionalParams,
DigitalTwinsGetComponentResponse,
DigitalTwinsUpdateComponentResponse,
DigitalTwinsUpdateComponentOptionalParams,
@ -35,13 +32,10 @@ import {
DigitalTwinsDeleteRelationshipOptionalParams,
DigitalTwinsSendTelemetryOptionalParams,
DigitalTwinsSendComponentTelemetryOptionalParams,
DigitalTwinsListRelationshipsOptionalParams,
DigitalTwinsListRelationshipsResponse,
IncomingRelationship,
DigitalTwinsListIncomingRelationshipsOptionalParams,
DigitalTwinsListIncomingRelationshipsResponse,
DigitalTwinsGetRelationshipByIdResponse,
DigitalTwinsGetRelationshipByIdOptionalParams,
DigitalTwinsModelData,
DigitalTwinModelsGetByIdResponse,
DigitalTwinModelsGetByIdOptionalParams,
@ -49,22 +43,17 @@ import {
DigitalTwinModelsAddOptionalParams,
DigitalTwinModelsListResponse,
DigitalTwinModelsListOptionalParams,
DigitalTwinModelsUpdateOptionalParams,
DigitalTwinModelsDeleteOptionalParams,
EventRoutesGetByIdOptionalParams,
EventRoutesGetByIdResponse,
EventRoute,
EventRoutesAddOptionalParams,
EventRoutesDeleteOptionalParams,
EventRoutesListNextResponse,
EventRoutesListOptionalParams,
QueryQueryTwinsOptionalParams,
QueryQueryTwinsResponse,
QuerySpecification
} from "./generated/models";
import { getTracer } from "@azure/core-tracing";
import { createSpan } from "./tracing";
import { CanonicalCode } from "@opentelemetry/api";
import { Span } from "@opentelemetry/api";
import { logger } from "./logger";
export const SDK_VERSION: string = "1.0.0-preview.1";
@ -153,13 +142,9 @@ export class DigitalTwinsClient {
digitalTwinId: string,
options: OperationOptions = {}
): Promise<DigitalTwinsGetByIdResponse> {
const digitalTwinsGetByIdOptionalParams: DigitalTwinsGetByIdOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-getDigitalTwin",
digitalTwinsGetByIdOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-getDigitalTwin", options);
try {
return this.client.digitalTwins.getById(digitalTwinId, digitalTwinsGetByIdOptionalParams);
return this.client.digitalTwins.getById(digitalTwinId, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -176,26 +161,18 @@ export class DigitalTwinsClient {
*
* @param digitalTwinId The Id of the digital twin to create or update.
* @param digitalTwinJson The application/json digital twin to create.
* @param enableUpdate If true then update of an existing digital twin is enabled.
* @param options The operation options
* @param options Extended operation options including
* ifNoneMatch: Only perform the operation if the entity does not already exist.
* @returns The created application/json digital twin and the http response.
*/
public upsertDigitalTwin(
digitalTwinId: string,
digitalTwinJson: string,
options: OperationOptions = {}
options: DigitalTwinsAddOptionalParams = {}
): Promise<DigitalTwinsAddResponse> {
const digitalTwinsAddOptionalParams: DigitalTwinsAddOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-upsertDigitalTwin",
digitalTwinsAddOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-upsertDigitalTwin", options);
try {
return this.client.digitalTwins.add(
digitalTwinId,
digitalTwinJson,
digitalTwinsAddOptionalParams
);
return this.client.digitalTwins.add(digitalTwinId, digitalTwinJson, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -214,34 +191,18 @@ export class DigitalTwinsClient {
* @param jsonPatch An update specification described by JSON Patch. Updates to property values
* and $model elements may happen in the same request. Operations are limited to add, replace and
* remove.
* @param etag Only perform the operation if the entity's etag matches one of the etags provided or * is
* provided
* @param options The operation options
* @param options Extended operation options including
* ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
* @returns The http response.
*/
public updateDigitalTwin(
digitalTwinId: string,
jsonPatch: any,
etag: string = "*",
options: OperationOptions = {}
options: DigitalTwinsUpdateOptionalParams = {}
): Promise<DigitalTwinsUpdateResponse> {
var digitalTwinsUpdateOptionalParams: DigitalTwinsUpdateOptionalParams = options;
digitalTwinsUpdateOptionalParams = {
digitalTwinsUpdateOptions: {
ifMatch: etag,
...options
}
};
const span = this.createSpan(
"DigitalTwinsClient-updateDigitalTwin",
digitalTwinsUpdateOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-updateDigitalTwin", options);
try {
return this.client.digitalTwins.update(
digitalTwinId,
jsonPatch,
digitalTwinsUpdateOptionalParams
);
return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -257,29 +218,17 @@ export class DigitalTwinsClient {
* Delete a digital twin
*
* @param digitalTwinId The Id of the digital twin to delete.
* @param etag Only perform the operation if the entity's etag matches one of the etags provided or * is
* provided
* @param options The operation options
* @param options Extended operation options including
* ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
* @returns The http response.
*/
public deleteDigitalTwin(
digitalTwinId: string,
etag: string = "*",
options: OperationOptions = {}
options: DigitalTwinsDeleteOptionalParams = {}
): Promise<RestResponse> {
var digitalTwinsDeleteOptionalParams: DigitalTwinsDeleteOptionalParams = options;
digitalTwinsDeleteOptionalParams = {
digitalTwinsDeleteOptions: {
ifMatch: etag,
...options
}
};
const span = this.createSpan(
"DigitalTwinsClient-deleteDigitalTwin",
digitalTwinsDeleteOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-deleteDigitalTwin", options);
try {
return this.client.digitalTwins.delete(digitalTwinId, digitalTwinsDeleteOptionalParams);
return this.client.digitalTwins.delete(digitalTwinId, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -304,17 +253,9 @@ export class DigitalTwinsClient {
componentName: string,
options: OperationOptions = {}
): Promise<DigitalTwinsGetComponentResponse> {
const digitalTwinsGetComponentOptionalParams: DigitalTwinsGetComponentOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-getComponent",
digitalTwinsGetComponentOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-getComponent", options);
try {
return this.client.digitalTwins.getComponent(
digitalTwinId,
componentName,
digitalTwinsGetComponentOptionalParams
);
return this.client.digitalTwins.getComponent(digitalTwinId, componentName, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -333,34 +274,23 @@ export class DigitalTwinsClient {
* @param componentName The component being updated.
* @param jsonPatch The application/json-patch+json operations to be performed on the specified digital twin's component.
* @param enableUpdate If true then update of an existing digital twin is enabled.
* @param options The operation options
* @param etag The etag of the component to update. Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
* @param options Extended operation options including
* ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
* @returns The http response.
*/
public updateComponent(
digitalTwinId: string,
componentName: string,
jsonPatch: any[],
etag: string = "*",
options: OperationOptions = {}
options: DigitalTwinsUpdateComponentOptionalParams = {}
): Promise<DigitalTwinsUpdateComponentResponse> {
var digitalTwinsUpdateComponentOptionalParams: DigitalTwinsUpdateComponentOptionalParams = options;
digitalTwinsUpdateComponentOptionalParams = {
digitalTwinsUpdateComponentOptions: {
ifMatch: etag,
...options
}
};
const span = this.createSpan(
"DigitalTwinsClient-updateComponent",
digitalTwinsUpdateComponentOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-updateComponent", options);
try {
return this.client.digitalTwins.updateComponent(
digitalTwinId,
componentName,
jsonPatch,
digitalTwinsUpdateComponentOptionalParams
updatedOptions
);
} catch (e) {
span.setStatus({
@ -386,16 +316,12 @@ export class DigitalTwinsClient {
relationshipId: string,
options: OperationOptions = {}
): Promise<DigitalTwinsGetRelationshipByIdResponse> {
const digitalTwinsGetRelationshipByIdOptionalParams: DigitalTwinsGetRelationshipByIdOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-getRelationship",
digitalTwinsGetRelationshipByIdOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-getRelationship", options);
try {
return this.client.digitalTwins.getRelationshipById(
digitalTwinId,
relationshipId,
digitalTwinsGetRelationshipByIdOptionalParams
updatedOptions
);
} catch (e) {
span.setStatus({
@ -414,25 +340,22 @@ export class DigitalTwinsClient {
* @param digitalTwinId The Id of the source digital twin.
* @param relationshipId The Id of the relationship to create.
* @param relationship: The application/json relationship to be created.
* @param options The operation options
* @param options Extended operation options including
* ifNoneMatch: Only perform the operation if the entity does not already exist.
*/
public upsertRelationship(
digitalTwinId: string,
relationshipId: string,
relationship: any,
options: OperationOptions = {}
options: DigitalTwinsAddRelationshipOptionalParams = {}
): Promise<DigitalTwinsAddRelationshipResponse> {
const digitalTwinsAddRelationshipOptionalParams: DigitalTwinsAddRelationshipOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-upsertRelationship",
digitalTwinsAddRelationshipOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-upsertRelationship", options);
try {
return this.client.digitalTwins.addRelationship(
digitalTwinId,
relationshipId,
relationship,
digitalTwinsAddRelationshipOptionalParams
updatedOptions
);
} catch (e) {
span.setStatus({
@ -451,34 +374,22 @@ export class DigitalTwinsClient {
* @param digitalTwinId The Id of the digital twin to delete.
* @param relationshipId The Id of the relationship to be updated.
* @param jsonPatch The application/json-patch+json operations to be performed on the specified digital twin's relationship.
* @param etag Only perform the operation if the entity's etag matches one of the etags provided or * is
* @param options The operation options
* provided
* @param options Extended operation options
* ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
public updateRelationship(
digitalTwinId: string,
relationshipId: string,
jsonPatch: any[],
etag: string = "*",
options: OperationOptions = {}
options: DigitalTwinsUpdateRelationshipOptionalParams = {}
): Promise<DigitalTwinsUpdateRelationshipResponse> {
var digitalTwinsUpdateRelationshipOptionalParams: DigitalTwinsUpdateRelationshipOptionalParams = options;
digitalTwinsUpdateRelationshipOptionalParams = {
digitalTwinsUpdateRelationshipOptions: {
ifMatch: etag,
...options
}
};
const span = this.createSpan(
"DigitalTwinsClient-updateRelationship",
digitalTwinsUpdateRelationshipOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-updateRelationship", options);
try {
return this.client.digitalTwins.updateRelationship(
digitalTwinId,
relationshipId,
jsonPatch,
digitalTwinsUpdateRelationshipOptionalParams
updatedOptions
);
} catch (e) {
span.setStatus({
@ -496,32 +407,21 @@ export class DigitalTwinsClient {
*
* @param digitalTwinId The Id of the source digital twin.
* @param relationshipId The Id of the relationship to delete.
* @param etag Only perform the operation if the entity's etag matches one of the etags provided or * is
* @param options The operation options
* ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is
* @returns The http response.
*/
public deleteRelationship(
digitalTwinId: string,
relationshipId: string,
etag: string = "*",
options: OperationOptions = {}
options: DigitalTwinsDeleteRelationshipOptionalParams = {}
): Promise<RestResponse> {
var digitalTwinsDeleteRelationshipOptionalParams: DigitalTwinsDeleteRelationshipOptionalParams = options;
digitalTwinsDeleteRelationshipOptionalParams = {
digitalTwinsDeleteRelationshipOptions: {
ifMatch: etag,
...options
}
};
const span = this.createSpan(
"DigitalTwinsClient-deleteRelationship",
digitalTwinsDeleteRelationshipOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-deleteRelationship", options);
try {
return this.client.digitalTwins.deleteRelationship(
digitalTwinId,
relationshipId,
digitalTwinsDeleteRelationshipOptionalParams
updatedOptions
);
} catch (e) {
span.setStatus({
@ -598,16 +498,9 @@ export class DigitalTwinsClient {
digitalTwinId: string,
options: OperationOptions & PageSettings = {}
): PagedAsyncIterableIterator<any, DigitalTwinsListRelationshipsResponse> {
const digitalTwinsListRelationshipsOptionalParams: DigitalTwinsListRelationshipsOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-listRelationships",
digitalTwinsListRelationshipsOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-listRelationships", options);
try {
const iter = this.listRelationshipsAll(
digitalTwinId,
digitalTwinsListRelationshipsOptionalParams
);
const iter = this.listRelationshipsAll(digitalTwinId, updatedOptions);
return {
next() {
@ -617,11 +510,7 @@ export class DigitalTwinsClient {
return this;
},
byPage: (settings: PageSettings = {}) =>
this.listRelationshipsPage(
digitalTwinId,
digitalTwinsListRelationshipsOptionalParams,
settings
)
this.listRelationshipsPage(digitalTwinId, updatedOptions, settings)
};
} catch (e) {
span.setStatus({
@ -694,21 +583,17 @@ export class DigitalTwinsClient {
*/
public listIncomingRelationships(
digitalTwinId: string,
options: OperationOptions = {}
options: OperationOptions & PageSettings = {}
): PagedAsyncIterableIterator<
IncomingRelationship,
DigitalTwinsListIncomingRelationshipsResponse
> {
const digitalTwinsListIncomingRelationshipsOptionalParams: DigitalTwinsListIncomingRelationshipsOptionalParams = options;
const span = this.createSpan(
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-listIncomingRelationships",
digitalTwinsListIncomingRelationshipsOptionalParams
options
);
try {
const iter = this.listIncomingRelationshipsAll(
digitalTwinId,
digitalTwinsListIncomingRelationshipsOptionalParams
);
const iter = this.listIncomingRelationshipsAll(digitalTwinId, updatedOptions);
return {
next() {
@ -718,11 +603,7 @@ export class DigitalTwinsClient {
return this;
},
byPage: (settings: PageSettings = {}) =>
this.listIncomingRelationshipsPage(
digitalTwinId,
digitalTwinsListIncomingRelationshipsOptionalParams,
settings
)
this.listIncomingRelationshipsPage(digitalTwinId, updatedOptions, settings)
};
} catch (e) {
span.setStatus({
@ -755,7 +636,7 @@ export class DigitalTwinsClient {
if (!messageId) {
messageId = generateUuid();
}
const span = this.createSpan(
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-publishTelemetry",
digitalTwinsSendTelemetryOptionalParams
);
@ -764,7 +645,7 @@ export class DigitalTwinsClient {
digitalTwinId,
payload,
messageId,
digitalTwinsSendTelemetryOptionalParams
updatedOptions
);
} catch (e) {
span.setStatus({
@ -801,7 +682,7 @@ export class DigitalTwinsClient {
if (!messageId) {
messageId = generateUuid();
}
const span = this.createSpan(
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-publishComponentTelemetry",
digitalTwinsSendComponentTelemetryOptionalParams
);
@ -811,7 +692,7 @@ export class DigitalTwinsClient {
componentName,
payload,
messageId,
digitalTwinsSendComponentTelemetryOptionalParams
updatedOptions
);
} catch (e) {
span.setStatus({
@ -828,23 +709,23 @@ export class DigitalTwinsClient {
* Get a model, including the model metadata and the model definition.
*
* @param modelId The Id of the model.
* @param includeModelDefinition When true the model definition will be returned as part of the result. Default value: false.
* @param options The operation options
* @param options Extended operation options including
* includeModelDefinition: When true the model definition will be returned as part of the result. Default value: false.
* @returns The application/json model and the http response.
*/
public getModel(
modelId: string,
includeModelDefinition?: boolean,
includeModelDefinition: boolean = false,
options: OperationOptions = {}
): Promise<DigitalTwinModelsGetByIdResponse> {
const digitalTwinModelsGetByIdOptionalParams: DigitalTwinModelsGetByIdOptionalParams = options;
digitalTwinModelsGetByIdOptionalParams.includeModelDefinition = includeModelDefinition;
const span = this.createSpan(
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-getModel",
digitalTwinModelsGetByIdOptionalParams
);
try {
return this.client.digitalTwinModels.getById(modelId, digitalTwinModelsGetByIdOptionalParams);
return this.client.digitalTwinModels.getById(modelId, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -870,12 +751,9 @@ export class DigitalTwinsClient {
continuationState: PageSettings
): AsyncIterableIterator<DigitalTwinModelsListResponse> {
if (continuationState.continuationToken == null) {
const optionsComplete: DigitalTwinModelsListOptionalParams = {
digitalTwinModelsListOptions: {
maxItemsPerPage: continuationState.maxPageSize
},
...options
};
const optionsComplete: DigitalTwinModelsListOptionalParams = options;
optionsComplete.maxItemsPerPage = continuationState.maxPageSize;
const listResponse = await this.client.digitalTwinModels.list(optionsComplete);
continuationState.continuationToken = listResponse.nextLink;
yield listResponse;
@ -922,23 +800,20 @@ export class DigitalTwinsClient {
dependeciesFor?: string[],
includeModelDefinition: boolean = false,
resultsPerPage?: number,
options: OperationOptions = {}
options: OperationOptions & PageSettings = {}
): PagedAsyncIterableIterator<DigitalTwinsModelData, DigitalTwinModelsListResponse> {
var digitalTwinModelsListOptionalParams: DigitalTwinModelsListOptionalParams = options;
digitalTwinModelsListOptionalParams = {
digitalTwinModelsListOptions: {
maxItemsPerPage: resultsPerPage
},
maxItemsPerPage: resultsPerPage,
dependenciesFor: dependeciesFor,
includeModelDefinition: includeModelDefinition,
...options
includeModelDefinition: includeModelDefinition
};
const span = this.createSpan(
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-listModels",
digitalTwinModelsListOptionalParams
);
try {
const iter = this.getModelsAll(digitalTwinModelsListOptionalParams);
const iter = this.getModelsAll(updatedOptions);
return {
next() {
@ -969,17 +844,17 @@ export class DigitalTwinsClient {
* @returns The created application/json models and the http response.
*/
public createModels(
models: any[],
dtdlModels: any[],
options: OperationOptions = {}
): Promise<DigitalTwinModelsAddResponse> {
const digitalTwinModelsAddOptionalParams: DigitalTwinModelsAddOptionalParams = options;
digitalTwinModelsAddOptionalParams.models = models;
const span = this.createSpan(
digitalTwinModelsAddOptionalParams.models = dtdlModels;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-createModels",
digitalTwinModelsAddOptionalParams
);
try {
return this.client.digitalTwinModels.add(digitalTwinModelsAddOptionalParams);
return this.client.digitalTwinModels.add(updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -1005,17 +880,9 @@ export class DigitalTwinsClient {
public decomissionModel(modelId: string, options: OperationOptions = {}): Promise<RestResponse> {
const jsonPatch = [{ op: "replace", path: "/decommissioned", value: true }];
const digitalTwinModelsUpdateOptionalParams: DigitalTwinModelsUpdateOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-decomissionModel",
digitalTwinModelsUpdateOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-decomissionModel", options);
try {
return this.client.digitalTwinModels.update(
modelId,
jsonPatch,
digitalTwinModelsUpdateOptionalParams
);
return this.client.digitalTwinModels.update(modelId, jsonPatch, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -1031,19 +898,13 @@ export class DigitalTwinsClient {
* Delete a model.
*
* @param modelId The Id of the model to delete.
* @param etag Only perform the operation if the entity's etag matches one of the etags provided or * is
* provided
* @param options The operation options
* @returns The http response.
*/
public deleteModel(modelId: string, options: OperationOptions = {}): Promise<RestResponse> {
const digitalTwinModelsDeleteOptionalParams: DigitalTwinModelsDeleteOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-deleteModel",
digitalTwinModelsDeleteOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-deleteModel", options);
try {
return this.client.digitalTwinModels.delete(modelId, digitalTwinModelsDeleteOptionalParams);
return this.client.digitalTwinModels.delete(modelId, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -1066,13 +927,9 @@ export class DigitalTwinsClient {
eventRouteId: string,
options: OperationOptions = {}
): Promise<EventRoutesGetByIdResponse> {
const eventRoutesGetByIdOptionalParams: EventRoutesGetByIdOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-getEventRoute",
eventRoutesGetByIdOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-getEventRoute", options);
try {
return this.client.eventRoutes.getById(eventRouteId, eventRoutesGetByIdOptionalParams);
return this.client.eventRoutes.getById(eventRouteId, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -1098,12 +955,9 @@ export class DigitalTwinsClient {
continuationState: PageSettings
): AsyncIterableIterator<EventRoutesListNextResponse> {
if (continuationState.continuationToken == null) {
const optionsComplete: EventRoutesListOptionalParams = {
eventRoutesListOptions: {
maxItemsPerPage: continuationState.maxPageSize
},
...options
};
const optionsComplete: EventRoutesListOptionalParams = options;
optionsComplete.maxItemsPerPage = continuationState.maxPageSize;
const listResponse = await this.client.eventRoutes.list(optionsComplete);
continuationState.continuationToken = listResponse.nextLink;
yield listResponse;
@ -1146,22 +1000,19 @@ export class DigitalTwinsClient {
*/
public listEventRoutes(
resultsPerPage?: number,
options: OperationOptions = {}
options: OperationOptions & PageSettings = {}
): PagedAsyncIterableIterator<EventRoute, EventRoutesListNextResponse> {
var eventRoutesListOptionalParams: EventRoutesListOptionalParams = options;
eventRoutesListOptionalParams = {
eventRoutesListOptions: {
maxItemsPerPage: resultsPerPage
},
...options
maxItemsPerPage: resultsPerPage
};
const span = this.createSpan(
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-listEventRoutes",
eventRoutesListOptionalParams
);
try {
const iter = this.getEventRoutesAll(eventRoutesListOptionalParams);
const iter = this.getEventRoutesAll(updatedOptions);
return {
next() {
@ -1205,10 +1056,12 @@ export class DigitalTwinsClient {
filter: filter
};
eventRoutesAddOptionalParams.eventRoute = eventRoute;
const span = this.createSpan("DigitalTwinsClient-getEventRoute", eventRoutesAddOptionalParams);
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-upsertEventRoute",
eventRoutesAddOptionalParams
);
try {
return this.client.eventRoutes.add(eventRouteId, eventRoutesAddOptionalParams);
return this.client.eventRoutes.add(eventRouteId, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -1223,7 +1076,7 @@ export class DigitalTwinsClient {
/**
* Delete an event route.
*
* @param eventRouteId The Id of the model to delete.
* @param eventRouteId The Id of the eventRoute to delete.
* @param options The operation options
* @returns The http response.
*/
@ -1231,13 +1084,9 @@ export class DigitalTwinsClient {
eventRouteId: string,
options: OperationOptions = {}
): Promise<RestResponse> {
const eventRoutesDeleteOptionalParams: EventRoutesDeleteOptionalParams = options;
const span = this.createSpan(
"DigitalTwinsClient-getEventRoute",
eventRoutesDeleteOptionalParams
);
const { span, updatedOptions } = createSpan("DigitalTwinsClient-deleteEventRoute", options);
try {
return this.client.eventRoutes.delete(eventRouteId, eventRoutesDeleteOptionalParams);
return this.client.eventRoutes.delete(eventRouteId, updatedOptions);
} catch (e) {
span.setStatus({
code: CanonicalCode.UNKNOWN,
@ -1315,19 +1164,19 @@ export class DigitalTwinsClient {
public queryTwins(
query: string,
resultsPerPage?: number,
options: OperationOptions = {}
options: OperationOptions & PageSettings = {}
): PagedAsyncIterableIterator<any, QueryQueryTwinsResponse> {
var queryQueryTwinsOptionalParams: QueryQueryTwinsOptionalParams = options;
queryQueryTwinsOptionalParams = {
queryTwinsOptions: {
maxItemsPerPage: resultsPerPage
},
...options
maxItemsPerPage: resultsPerPage
};
const span = this.createSpan("DigitalTwinsClient-queryTwins", queryQueryTwinsOptionalParams);
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-queryTwins",
queryQueryTwinsOptionalParams
);
try {
const iter = this.queryTwinsAll(query, queryQueryTwinsOptionalParams);
const iter = this.queryTwinsAll(query, updatedOptions);
return {
next() {
@ -1349,21 +1198,4 @@ export class DigitalTwinsClient {
span.end();
}
}
/**
* @internal
* @ignore
* Creates a span using the tracer that was set by the user.
* @param {string} methodName The name of the method creating the span.
* @param {OperationOptions} [options] The options for the underlying HTTP request.
*/
private createSpan(methodName: string, requestOptions?: RequestOptionsBase): Span {
const tracer = getTracer();
const span = tracer.startSpan(
`DigitalTwinsClient ${methodName}`,
requestOptions && requestOptions.spanOptions
);
span.setAttribute("az.namespace", "Microsoft.DigitalTwinsCore");
return span;
}
}

Просмотреть файл

@ -9,7 +9,7 @@
import * as coreHttp from "@azure/core-http";
import { AzureDigitalTwinsAPIOptionalParams } from "./models";
const packageName = "@azure/digital-twins";
const packageName = "@azure/digital-twins-core";
const packageVersion = "1.0.0";
export class AzureDigitalTwinsAPIContext extends coreHttp.ServiceClient {

Просмотреть файл

@ -295,387 +295,23 @@ export interface DigitalTwinsUpdateComponentHeaders {
etag?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsAddOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsListOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsGetByIdOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsUpdateOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsDeleteOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface QueryTwinsOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
* Parameter group
*/
export interface DigitalTwinsGetByIdOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsAddOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsDeleteOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsUpdateOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsGetRelationshipByIdOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsAddRelationshipOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsDeleteRelationshipOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsUpdateRelationshipOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsListRelationshipsOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsListIncomingRelationshipsOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsSendTelemetryOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsSendComponentTelemetryOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsGetComponentOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsUpdateComponentOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
* Parameter group
*/
export interface EventRoutesListOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
* Parameter group
*/
export interface EventRoutesGetByIdOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface EventRoutesAddOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface EventRoutesDeleteOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Optional parameters.
*/
export interface DigitalTwinModelsAddOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinModelsAddOptions?: DigitalTwinModelsAddOptions;
/**
* An array of models to add.
*/
models?: any[];
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -704,9 +340,13 @@ export type DigitalTwinModelsAddResponse = DigitalTwinsModelData[] & {
export interface DigitalTwinModelsListOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinModelsListOptions?: DigitalTwinModelsListOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The set of the models which will have their dependencies retrieved. If omitted, all models are retrieved.
*/
@ -715,6 +355,10 @@ export interface DigitalTwinModelsListOptionalParams
* When true the model definition will be returned as part of the result.
*/
includeModelDefinition?: boolean;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
@ -743,9 +387,13 @@ export type DigitalTwinModelsListResponse = PagedDigitalTwinsModelDataCollection
export interface DigitalTwinModelsGetByIdOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinModelsGetByIdOptions?: DigitalTwinModelsGetByIdOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* When true the model definition will be returned as part of the result.
*/
@ -778,9 +426,13 @@ export type DigitalTwinModelsGetByIdResponse = DigitalTwinsModelData & {
export interface DigitalTwinModelsUpdateOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinModelsUpdateOptions?: DigitalTwinModelsUpdateOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -789,9 +441,13 @@ export interface DigitalTwinModelsUpdateOptionalParams
export interface DigitalTwinModelsDeleteOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinModelsDeleteOptions?: DigitalTwinModelsDeleteOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -800,9 +456,13 @@ export interface DigitalTwinModelsDeleteOptionalParams
export interface DigitalTwinModelsListNextOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinModelsListOptions?: DigitalTwinModelsListOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The set of the models which will have their dependencies retrieved. If omitted, all models are retrieved.
*/
@ -811,6 +471,10 @@ export interface DigitalTwinModelsListNextOptionalParams
* When true the model definition will be returned as part of the result.
*/
includeModelDefinition?: boolean;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
@ -839,9 +503,17 @@ export type DigitalTwinModelsListNextResponse = PagedDigitalTwinsModelDataCollec
export interface QueryQueryTwinsOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
queryTwinsOptions?: QueryTwinsOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
@ -875,9 +547,13 @@ export type QueryQueryTwinsResponse = QueryQueryTwinsHeaders &
export interface DigitalTwinsGetByIdOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsGetByIdOptions?: DigitalTwinsGetByIdOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -915,9 +591,17 @@ export type DigitalTwinsGetByIdResponse = DigitalTwinsGetByIdHeaders & {
export interface DigitalTwinsAddOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsAddOptions?: DigitalTwinsAddOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity does not already exist.
*/
ifNoneMatch?: string;
}
/**
@ -955,9 +639,17 @@ export type DigitalTwinsAddResponse = DigitalTwinsAddHeaders & {
export interface DigitalTwinsDeleteOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsDeleteOptions?: DigitalTwinsDeleteOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
@ -966,9 +658,17 @@ export interface DigitalTwinsDeleteOptionalParams
export interface DigitalTwinsUpdateOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsUpdateOptions?: DigitalTwinsUpdateOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
@ -992,9 +692,13 @@ export type DigitalTwinsUpdateResponse = DigitalTwinsUpdateHeaders & {
export interface DigitalTwinsGetRelationshipByIdOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsGetRelationshipByIdOptions?: DigitalTwinsGetRelationshipByIdOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -1032,9 +736,17 @@ export type DigitalTwinsGetRelationshipByIdResponse = DigitalTwinsGetRelationshi
export interface DigitalTwinsAddRelationshipOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsAddRelationshipOptions?: DigitalTwinsAddRelationshipOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity does not already exist.
*/
ifNoneMatch?: string;
}
/**
@ -1072,9 +784,17 @@ export type DigitalTwinsAddRelationshipResponse = DigitalTwinsAddRelationshipHea
export interface DigitalTwinsDeleteRelationshipOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsDeleteRelationshipOptions?: DigitalTwinsDeleteRelationshipOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
@ -1083,9 +803,17 @@ export interface DigitalTwinsDeleteRelationshipOptionalParams
export interface DigitalTwinsUpdateRelationshipOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsUpdateRelationshipOptions?: DigitalTwinsUpdateRelationshipOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
@ -1109,9 +837,13 @@ export type DigitalTwinsUpdateRelationshipResponse = DigitalTwinsUpdateRelations
export interface DigitalTwinsListRelationshipsOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsListRelationshipsOptions?: DigitalTwinsListRelationshipsOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The name of the relationship.
*/
@ -1144,9 +876,13 @@ export type DigitalTwinsListRelationshipsResponse = RelationshipCollection & {
export interface DigitalTwinsListIncomingRelationshipsOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsListIncomingRelationshipsOptions?: DigitalTwinsListIncomingRelationshipsOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -1175,9 +911,13 @@ export type DigitalTwinsListIncomingRelationshipsResponse = IncomingRelationship
export interface DigitalTwinsSendTelemetryOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsSendTelemetryOptions?: DigitalTwinsSendTelemetryOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* An RFC 3339 timestamp that identifies the time the telemetry was measured.
*/
@ -1190,9 +930,13 @@ export interface DigitalTwinsSendTelemetryOptionalParams
export interface DigitalTwinsSendComponentTelemetryOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsSendComponentTelemetryOptions?: DigitalTwinsSendComponentTelemetryOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* An RFC 3339 timestamp that identifies the time the telemetry was measured.
*/
@ -1205,9 +949,13 @@ export interface DigitalTwinsSendComponentTelemetryOptionalParams
export interface DigitalTwinsGetComponentOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsGetComponentOptions?: DigitalTwinsGetComponentOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -1245,9 +993,17 @@ export type DigitalTwinsGetComponentResponse = DigitalTwinsGetComponentHeaders &
export interface DigitalTwinsUpdateComponentOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsUpdateComponentOptions?: DigitalTwinsUpdateComponentOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
@ -1271,9 +1027,13 @@ export type DigitalTwinsUpdateComponentResponse = DigitalTwinsUpdateComponentHea
export interface DigitalTwinsListRelationshipsNextOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsListRelationshipsOptions?: DigitalTwinsListRelationshipsOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The name of the relationship.
*/
@ -1306,9 +1066,13 @@ export type DigitalTwinsListRelationshipsNextResponse = RelationshipCollection &
export interface DigitalTwinsListIncomingRelationshipsNextOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
digitalTwinsListIncomingRelationshipsOptions?: DigitalTwinsListIncomingRelationshipsOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -1337,9 +1101,17 @@ export type DigitalTwinsListIncomingRelationshipsNextResponse = IncomingRelation
export interface EventRoutesListOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
eventRoutesListOptions?: EventRoutesListOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
@ -1368,9 +1140,13 @@ export type EventRoutesListResponse = EventRouteCollection & {
export interface EventRoutesGetByIdOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
eventRoutesGetByIdOptions?: EventRoutesGetByIdOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -1399,9 +1175,13 @@ export type EventRoutesGetByIdResponse = EventRoute & {
export interface EventRoutesAddOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
eventRoutesAddOptions?: EventRoutesAddOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The event route data
*/
@ -1414,9 +1194,13 @@ export interface EventRoutesAddOptionalParams
export interface EventRoutesDeleteOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
eventRoutesDeleteOptions?: EventRoutesDeleteOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -1425,9 +1209,17 @@ export interface EventRoutesDeleteOptionalParams
export interface EventRoutesListNextOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
* Identifies the request in a distributed tracing system.
*/
eventRoutesListOptions?: EventRoutesListOptions;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**

Просмотреть файл

@ -57,7 +57,7 @@ export const $host: OperationURLParameter = {
};
export const traceparent: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsAddOptions", "traceparent"],
parameterPath: ["options", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
@ -67,7 +67,7 @@ export const traceparent: OperationParameter = {
};
export const tracestate: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsAddOptions", "tracestate"],
parameterPath: ["options", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
@ -88,26 +88,6 @@ export const apiVersion: OperationQueryParameter = {
}
};
export const traceparent1: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsListOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate1: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsListOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const dependenciesFor: OperationQueryParameter = {
parameterPath: ["options", "dependenciesFor"],
mapper: {
@ -131,7 +111,7 @@ export const includeModelDefinition: OperationQueryParameter = {
};
export const maxItemsPerPage: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsListOptions", "maxItemsPerPage"],
parameterPath: ["options", "maxItemsPerPage"],
mapper: {
serializedName: "max-items-per-page",
type: {
@ -140,26 +120,6 @@ export const maxItemsPerPage: OperationParameter = {
}
};
export const traceparent2: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsGetByIdOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate2: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsGetByIdOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const id: OperationURLParameter = {
parameterPath: "id",
mapper: {
@ -195,46 +155,6 @@ export const updateModel: OperationParameter = {
}
};
export const traceparent3: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsUpdateOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate3: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsUpdateOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const traceparent4: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsDeleteOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate4: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsDeleteOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const nextLink: OperationURLParameter = {
parameterPath: "nextLink",
mapper: {
@ -252,56 +172,6 @@ export const querySpecification: OperationParameter = {
mapper: QuerySpecificationMapper
};
export const traceparent5: OperationParameter = {
parameterPath: ["options", "queryTwinsOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate5: OperationParameter = {
parameterPath: ["options", "queryTwinsOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const maxItemsPerPage1: OperationParameter = {
parameterPath: ["options", "queryTwinsOptions", "maxItemsPerPage"],
mapper: {
serializedName: "max-items-per-page",
type: {
name: "Number"
}
}
};
export const traceparent6: OperationParameter = {
parameterPath: ["options", "digitalTwinsGetByIdOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate6: OperationParameter = {
parameterPath: ["options", "digitalTwinsGetByIdOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const twin: OperationParameter = {
parameterPath: "twin",
mapper: {
@ -313,31 +183,9 @@ export const twin: OperationParameter = {
}
};
export const traceparent7: OperationParameter = {
parameterPath: ["options", "digitalTwinsAddOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate7: OperationParameter = {
parameterPath: ["options", "digitalTwinsAddOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifNoneMatch: OperationParameter = {
parameterPath: ["options", "ifNoneMatch"],
mapper: {
defaultValue: "*",
isConstant: true,
serializedName: "If-None-Match",
type: {
name: "String"
@ -345,28 +193,8 @@ export const ifNoneMatch: OperationParameter = {
}
};
export const traceparent8: OperationParameter = {
parameterPath: ["options", "digitalTwinsDeleteOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate8: OperationParameter = {
parameterPath: ["options", "digitalTwinsDeleteOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch: OperationParameter = {
parameterPath: ["options", "digitalTwinsDeleteOptions", "ifMatch"],
parameterPath: ["options", "ifMatch"],
mapper: {
serializedName: "If-Match",
type: {
@ -387,64 +215,6 @@ export const patchDocument: OperationParameter = {
}
};
export const traceparent9: OperationParameter = {
parameterPath: ["options", "digitalTwinsUpdateOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate9: OperationParameter = {
parameterPath: ["options", "digitalTwinsUpdateOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch1: OperationParameter = {
parameterPath: ["options", "digitalTwinsUpdateOptions", "ifMatch"],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const traceparent10: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsGetRelationshipByIdOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate10: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsGetRelationshipByIdOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const relationshipId: OperationURLParameter = {
parameterPath: "relationshipId",
mapper: {
@ -467,146 +237,6 @@ export const relationship: OperationParameter = {
}
};
export const traceparent11: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsAddRelationshipOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate11: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsAddRelationshipOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const traceparent12: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsDeleteRelationshipOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate12: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsDeleteRelationshipOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch2: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsDeleteRelationshipOptions",
"ifMatch"
],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const traceparent13: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateRelationshipOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate13: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateRelationshipOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch3: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateRelationshipOptions",
"ifMatch"
],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const traceparent14: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsListRelationshipsOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate14: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsListRelationshipsOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const relationshipName: OperationQueryParameter = {
parameterPath: ["options", "relationshipName"],
mapper: {
@ -617,34 +247,6 @@ export const relationshipName: OperationQueryParameter = {
}
};
export const traceparent15: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsListIncomingRelationshipsOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate15: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsListIncomingRelationshipsOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const telemetry: OperationParameter = {
parameterPath: "telemetry",
mapper: {
@ -656,26 +258,6 @@ export const telemetry: OperationParameter = {
}
};
export const traceparent16: OperationParameter = {
parameterPath: ["options", "digitalTwinsSendTelemetryOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate16: OperationParameter = {
parameterPath: ["options", "digitalTwinsSendTelemetryOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const messageId: OperationParameter = {
parameterPath: "messageId",
mapper: {
@ -697,34 +279,6 @@ export const telemetrySourceTime: OperationParameter = {
}
};
export const traceparent17: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsSendComponentTelemetryOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate17: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsSendComponentTelemetryOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const componentPath: OperationURLParameter = {
parameterPath: "componentPath",
mapper: {
@ -736,155 +290,7 @@ export const componentPath: OperationURLParameter = {
}
};
export const traceparent18: OperationParameter = {
parameterPath: ["options", "digitalTwinsGetComponentOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate18: OperationParameter = {
parameterPath: ["options", "digitalTwinsGetComponentOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const traceparent19: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateComponentOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate19: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateComponentOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch4: OperationParameter = {
parameterPath: ["options", "digitalTwinsUpdateComponentOptions", "ifMatch"],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const traceparent20: OperationParameter = {
parameterPath: ["options", "eventRoutesListOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate20: OperationParameter = {
parameterPath: ["options", "eventRoutesListOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const maxItemsPerPage2: OperationParameter = {
parameterPath: ["options", "eventRoutesListOptions", "maxItemsPerPage"],
mapper: {
serializedName: "max-items-per-page",
type: {
name: "Number"
}
}
};
export const traceparent21: OperationParameter = {
parameterPath: ["options", "eventRoutesGetByIdOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate21: OperationParameter = {
parameterPath: ["options", "eventRoutesGetByIdOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const eventRoute: OperationParameter = {
parameterPath: ["options", "eventRoute"],
mapper: EventRouteMapper
};
export const traceparent22: OperationParameter = {
parameterPath: ["options", "eventRoutesAddOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate22: OperationParameter = {
parameterPath: ["options", "eventRoutesAddOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const traceparent23: OperationParameter = {
parameterPath: ["options", "eventRoutesDeleteOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate23: OperationParameter = {
parameterPath: ["options", "eventRoutesDeleteOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};

Просмотреть файл

@ -237,8 +237,8 @@ const listOperationSpec: coreHttp.OperationSpec = {
],
urlParameters: [Parameters.$host],
headerParameters: [
Parameters.traceparent1,
Parameters.tracestate1,
Parameters.traceparent,
Parameters.tracestate,
Parameters.maxItemsPerPage
],
serializer
@ -256,7 +256,7 @@ const getByIdOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion, Parameters.includeModelDefinition],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent2, Parameters.tracestate2],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const updateOperationSpec: coreHttp.OperationSpec = {
@ -272,9 +272,9 @@ const updateOperationSpec: coreHttp.OperationSpec = {
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [
Parameters.contentType1,
Parameters.traceparent3,
Parameters.tracestate3
Parameters.traceparent,
Parameters.tracestate,
Parameters.contentType1
],
mediaType: "json",
serializer
@ -290,7 +290,7 @@ const deleteOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent4, Parameters.tracestate4],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const listNextOperationSpec: coreHttp.OperationSpec = {
@ -311,8 +311,8 @@ const listNextOperationSpec: coreHttp.OperationSpec = {
],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [
Parameters.traceparent1,
Parameters.tracestate1,
Parameters.traceparent,
Parameters.tracestate,
Parameters.maxItemsPerPage
],
serializer

Просмотреть файл

@ -526,7 +526,7 @@ const getByIdOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent6, Parameters.tracestate6],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const addOperationSpec: coreHttp.OperationSpec = {
@ -547,8 +547,8 @@ const addOperationSpec: coreHttp.OperationSpec = {
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [
Parameters.contentType,
Parameters.traceparent7,
Parameters.tracestate7,
Parameters.traceparent,
Parameters.tracestate,
Parameters.ifNoneMatch
],
mediaType: "json",
@ -566,8 +566,8 @@ const deleteOperationSpec: coreHttp.OperationSpec = {
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [
Parameters.traceparent8,
Parameters.tracestate8,
Parameters.traceparent,
Parameters.tracestate,
Parameters.ifMatch
],
serializer
@ -588,10 +588,10 @@ const updateOperationSpec: coreHttp.OperationSpec = {
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [
Parameters.traceparent,
Parameters.tracestate,
Parameters.contentType1,
Parameters.traceparent9,
Parameters.tracestate9,
Parameters.ifMatch1
Parameters.ifMatch
],
mediaType: "json",
serializer
@ -610,7 +610,7 @@ const getRelationshipByIdOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.relationshipId],
headerParameters: [Parameters.traceparent10, Parameters.tracestate10],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const addRelationshipOperationSpec: coreHttp.OperationSpec = {
@ -630,9 +630,9 @@ const addRelationshipOperationSpec: coreHttp.OperationSpec = {
urlParameters: [Parameters.$host, Parameters.id, Parameters.relationshipId],
headerParameters: [
Parameters.contentType,
Parameters.ifNoneMatch,
Parameters.traceparent11,
Parameters.tracestate11
Parameters.traceparent,
Parameters.tracestate,
Parameters.ifNoneMatch
],
mediaType: "json",
serializer
@ -649,9 +649,9 @@ const deleteRelationshipOperationSpec: coreHttp.OperationSpec = {
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.relationshipId],
headerParameters: [
Parameters.traceparent12,
Parameters.tracestate12,
Parameters.ifMatch2
Parameters.traceparent,
Parameters.tracestate,
Parameters.ifMatch
],
serializer
};
@ -670,10 +670,10 @@ const updateRelationshipOperationSpec: coreHttp.OperationSpec = {
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.relationshipId],
headerParameters: [
Parameters.traceparent,
Parameters.tracestate,
Parameters.contentType1,
Parameters.traceparent13,
Parameters.tracestate13,
Parameters.ifMatch3
Parameters.ifMatch
],
mediaType: "json",
serializer
@ -691,7 +691,7 @@ const listRelationshipsOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion, Parameters.relationshipName],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent14, Parameters.tracestate14],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const listIncomingRelationshipsOperationSpec: coreHttp.OperationSpec = {
@ -707,7 +707,7 @@ const listIncomingRelationshipsOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent15, Parameters.tracestate15],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const sendTelemetryOperationSpec: coreHttp.OperationSpec = {
@ -724,8 +724,8 @@ const sendTelemetryOperationSpec: coreHttp.OperationSpec = {
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [
Parameters.contentType,
Parameters.traceparent16,
Parameters.tracestate16,
Parameters.traceparent,
Parameters.tracestate,
Parameters.messageId,
Parameters.telemetrySourceTime
],
@ -746,10 +746,10 @@ const sendComponentTelemetryOperationSpec: coreHttp.OperationSpec = {
urlParameters: [Parameters.$host, Parameters.id, Parameters.componentPath],
headerParameters: [
Parameters.contentType,
Parameters.traceparent,
Parameters.tracestate,
Parameters.messageId,
Parameters.telemetrySourceTime,
Parameters.traceparent17,
Parameters.tracestate17
Parameters.telemetrySourceTime
],
mediaType: "json",
serializer
@ -768,7 +768,7 @@ const getComponentOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.componentPath],
headerParameters: [Parameters.traceparent18, Parameters.tracestate18],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const updateComponentOperationSpec: coreHttp.OperationSpec = {
@ -787,10 +787,10 @@ const updateComponentOperationSpec: coreHttp.OperationSpec = {
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.componentPath],
headerParameters: [
Parameters.traceparent,
Parameters.tracestate,
Parameters.contentType1,
Parameters.traceparent19,
Parameters.tracestate19,
Parameters.ifMatch4
Parameters.ifMatch
],
mediaType: "json",
serializer
@ -808,7 +808,7 @@ const listRelationshipsNextOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion, Parameters.relationshipName],
urlParameters: [Parameters.$host, Parameters.id, Parameters.nextLink],
headerParameters: [Parameters.traceparent14, Parameters.tracestate14],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const listIncomingRelationshipsNextOperationSpec: coreHttp.OperationSpec = {
@ -824,6 +824,6 @@ const listIncomingRelationshipsNextOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.nextLink],
headerParameters: [Parameters.traceparent15, Parameters.tracestate15],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};

Просмотреть файл

@ -158,9 +158,9 @@ const listOperationSpec: coreHttp.OperationSpec = {
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [
Parameters.traceparent20,
Parameters.tracestate20,
Parameters.maxItemsPerPage2
Parameters.traceparent,
Parameters.tracestate,
Parameters.maxItemsPerPage
],
serializer
};
@ -177,7 +177,7 @@ const getByIdOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent21, Parameters.tracestate21],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const addOperationSpec: coreHttp.OperationSpec = {
@ -194,8 +194,8 @@ const addOperationSpec: coreHttp.OperationSpec = {
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [
Parameters.contentType,
Parameters.traceparent22,
Parameters.tracestate22
Parameters.traceparent,
Parameters.tracestate
],
mediaType: "json",
serializer
@ -211,7 +211,7 @@ const deleteOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent23, Parameters.tracestate23],
headerParameters: [Parameters.traceparent, Parameters.tracestate],
serializer
};
const listNextOperationSpec: coreHttp.OperationSpec = {
@ -228,9 +228,9 @@ const listNextOperationSpec: coreHttp.OperationSpec = {
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [
Parameters.traceparent20,
Parameters.tracestate20,
Parameters.maxItemsPerPage2
Parameters.traceparent,
Parameters.tracestate,
Parameters.maxItemsPerPage
],
serializer
};

Просмотреть файл

@ -76,9 +76,9 @@ const queryTwinsOperationSpec: coreHttp.OperationSpec = {
urlParameters: [Parameters.$host],
headerParameters: [
Parameters.contentType,
Parameters.traceparent5,
Parameters.tracestate5,
Parameters.maxItemsPerPage1
Parameters.traceparent,
Parameters.tracestate,
Parameters.maxItemsPerPage
],
mediaType: "json",
serializer

Просмотреть файл

@ -4,15 +4,21 @@
export { DigitalTwinsClient, DigitalTwinsClientOptions } from "./digitalTwinsClient";
export {
DigitalTwinsAddOptionalParams,
DigitalTwinsAddHeaders,
DigitalTwinsAddResponse,
DigitalTwinsGetByIdResponse,
DigitalTwinsUpdateOptionalParams,
DigitalTwinsUpdateHeaders,
DigitalTwinsDeleteOptionalParams,
DigitalTwinsGetByIdHeaders,
DigitalTwinsAddRelationshipOptionalParams,
DigitalTwinsAddRelationshipHeaders,
DigitalTwinsAddRelationshipResponse,
DigitalTwinsUpdateRelationshipOptionalParams,
DigitalTwinsUpdateRelationshipResponse,
DigitalTwinsUpdateRelationshipHeaders,
DigitalTwinsDeleteRelationshipOptionalParams,
DigitalTwinsListRelationshipsResponse,
RelationshipCollection,
DigitalTwinsListIncomingRelationshipsResponse,
@ -20,6 +26,7 @@ export {
IncomingRelationshipCollection,
DigitalTwinsGetRelationshipByIdHeaders,
DigitalTwinsGetRelationshipByIdResponse,
DigitalTwinsUpdateComponentOptionalParams,
DigitalTwinsUpdateComponentHeaders,
DigitalTwinsGetComponentHeaders,
DigitalTwinsUpdateComponentResponse,

Просмотреть файл

@ -0,0 +1,57 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { getTracer } from "@azure/core-tracing";
import { Span, SpanOptions, SpanKind } from "@opentelemetry/api";
import { OperationOptions } from "@azure/core-http";
type OperationTracingOptions = OperationOptions["tracingOptions"];
/**
* Creates a span using the global tracer.
* @ignore
* @param name The name of the operation being performed.
* @param tracingOptions The options for the underlying http request.
*/
export function createSpan<T extends OperationOptions>(
operationName: string,
operationOptions: T
): { span: Span; updatedOptions: T } {
const tracer = getTracer();
const tracingOptions = operationOptions.tracingOptions || {};
const spanOptions: SpanOptions = {
...tracingOptions.spanOptions,
kind: SpanKind.INTERNAL
};
const span = tracer.startSpan(`DigitalTwinsClient.${operationName}`, spanOptions);
span.setAttribute("az.namespace", "Microsoft.DigitalTwins");
let newSpanOptions = tracingOptions.spanOptions || {};
if (span.isRecording()) {
newSpanOptions = {
...tracingOptions.spanOptions,
parent: span.context(),
attributes: {
...spanOptions.attributes,
"az.namespace": "Microsoft.DigitalTwins"
}
};
}
const newTracingOptions: OperationTracingOptions = {
...tracingOptions,
spanOptions: newSpanOptions
};
const newOperationOptions: T = {
...operationOptions,
tracingOptions: newTracingOptions
};
return {
span,
updatedOptions: newOperationOptions
};
}

Просмотреть файл

@ -43,3 +43,21 @@ directive:
$["x-ms-client-name"] = "timestamp";
}
```
### Expose If-None_Match header
```yaml
directive:
- from: swagger-document
where: $..[?(@.name=='If-None-Match')]
transform: delete $.enum;
```
### Remove grouping
```yaml
directive:
- from: swagger-document
where: $.parameters[*]
transform: delete $["x-ms-parameter-grouping"];
```

Просмотреть файл

@ -21,9 +21,18 @@ import {
DigitalTwinModelsGetByIdOptionalParams,
DigitalTwinModelsAddOptionalParams,
EventRoute,
EventRoutesAddOptionalParams
EventRoutesAddOptionalParams,
EventRoutesDeleteOptionalParams,
EventRoutesGetByIdOptionalParams,
DigitalTwinModelsDeleteOptionalParams,
DigitalTwinModelsUpdateOptionalParams,
DigitalTwinsGetRelationshipByIdOptionalParams,
DigitalTwinsGetComponentOptionalParams,
DigitalTwinsAddOptionalParams,
DigitalTwinsGetByIdOptionalParams
} from "../../src/generated/models";
import { DigitalTwinsClient } from "../../src/index";
import { createSpan } from "../../src/tracing";
describe("DigitalTwinsClient", () => {
let operationOptions: OperationOptions;
@ -42,7 +51,7 @@ describe("DigitalTwinsClient", () => {
let testEventRouteId: string;
let testEndpointName: string;
let testFilter: string;
let testEtag: string;
let testIfMatch: string;
let testDefaultOperationalResponse: HttpOperationResponse;
let testDefaultResponse: HttpResponse;
let testBody: any;
@ -66,7 +75,7 @@ describe("DigitalTwinsClient", () => {
})
};
testFilter = "*.*";
testEtag = "test_etag";
testIfMatch = "test_ifmatch";
testEndpointName = "test_endpoint_name";
testDefaultOperationalResponse = {
status: 200,
@ -91,7 +100,7 @@ describe("DigitalTwinsClient", () => {
testEventRouteId = "test_event_route_id";
testBody = "test_body";
testHeaders = {
etag: testEtag
etag: testIfMatch
};
testError = new Error("Promise Rejected");
decommissionPatch = [{ op: "replace", path: "/decommissioned", value: true }];
@ -103,16 +112,30 @@ describe("DigitalTwinsClient", () => {
it("getDigitalTwin calls the getById method with twinId on the generated client if there is no option defined", function() {
const stub = sinon.stub(testClient["client"].digitalTwins, "getById");
const digitalTwinsGetByIdOptionalParams: DigitalTwinsGetByIdOptionalParams = {};
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-getDigitalTwin",
digitalTwinsGetByIdOptionalParams
);
testClient.getDigitalTwin(testTwinId);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, {}));
assert.isTrue(stub.calledWith(testTwinId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("getDigitalTwin calls the getById method with twinId and converted options on the generated client", function() {
const stub = sinon.stub(testClient["client"].digitalTwins, "getById");
const digitalTwinsGetByIdOptionalParams: DigitalTwinsGetByIdOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-getDigitalTwin",
digitalTwinsGetByIdOptionalParams
);
testClient.getDigitalTwin(testTwinId, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, operationOptions));
assert.isTrue(stub.calledWith(testTwinId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("getDigitalTwin returns a promise of the generated code return value", async () => {
@ -131,16 +154,16 @@ describe("DigitalTwinsClient", () => {
it("upsertDigitalTwin calls the add method with twinId and twinJson on the generated client if there is no option defined", function() {
const stub = sinon.stub(testClient["client"].digitalTwins, "add");
const digitalTwinsAddOptionalParams: DigitalTwinsAddOptionalParams = {};
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-upsertDigitalTwin",
digitalTwinsAddOptionalParams
);
testClient.upsertDigitalTwin(testTwinId, testJsonString);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testJsonString, {}));
});
it("upsertDigitalTwin calls the add method with twinId, twinJson and options", function() {
const stub = sinon.stub(testClient["client"].digitalTwins, "add");
testClient.upsertDigitalTwin(testTwinId, testJsonString, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testJsonString, operationOptions));
assert.isTrue(stub.calledWith(testTwinId, testJsonString, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("upsertDigitalTwin returns a promise of the generated code return value", async () => {
@ -158,17 +181,17 @@ describe("DigitalTwinsClient", () => {
});
it("updateDigitalTwin calls the update method with twinId, jsonPatch and converted options on the generated client", function() {
var expectedOptions: DigitalTwinsUpdateOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsUpdateOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const digitalTwinsUpdateOptionalParams: DigitalTwinsUpdateOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-updateDigitalTwin",
digitalTwinsUpdateOptionalParams
);
const stub = sinon.stub(testClient["client"].digitalTwins, "update");
testClient.updateDigitalTwin(testTwinId, testJsonPatch, testEtag, operationOptions);
testClient.updateDigitalTwin(testTwinId, testJsonPatch, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testJsonPatch, expectedOptions));
assert.isTrue(stub.calledWith(testTwinId, testJsonPatch, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("updateDigitalTwin returns a promise of the generated code return value", async () => {
@ -186,18 +209,17 @@ describe("DigitalTwinsClient", () => {
});
it("deleteDigitalTwin calls the deleteMethod method with twinId and converted options on the generated client", function() {
var expectedOptions: DigitalTwinsDeleteOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsDeleteOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const digitalTwinsDeleteOptionalParams: DigitalTwinsDeleteOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-deleteDigitalTwin",
digitalTwinsDeleteOptionalParams
);
const stub = sinon.stub(testClient["client"].digitalTwins, "delete");
testClient.deleteDigitalTwin(testTwinId, testEtag, operationOptions);
testClient.deleteDigitalTwin(testTwinId, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, expectedOptions));
assert.isTrue(stub.calledWith(testTwinId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("deleteDigitalTwin returns a promise of the generated code return value", async () => {
@ -218,9 +240,16 @@ describe("DigitalTwinsClient", () => {
it("getComponent calls the getComponent method with twinId, componentPath and converted options on the generated client", function() {
const stub = sinon.stub(testClient["client"].digitalTwins, "getComponent");
const digitalTwinsGetComponentOptionalParams: DigitalTwinsGetComponentOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-getComponent",
digitalTwinsGetComponentOptionalParams
);
testClient.getComponent(testTwinId, testComponentPath, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testComponentPath, operationOptions));
assert.isTrue(stub.calledWith(testTwinId, testComponentPath, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("getComponent returns a promise of the generated code return value", async () => {
@ -238,24 +267,17 @@ describe("DigitalTwinsClient", () => {
});
it("updateComponent calls the updateComponent method with twinId, componentPath, jsonPatch and converted options on the generated client", function() {
var expectedOptions: DigitalTwinsUpdateComponentOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsUpdateComponentOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const stub = sinon.stub(testClient["client"].digitalTwins, "updateComponent");
testClient.updateComponent(
testTwinId,
testComponentPath,
testJsonPatch,
testEtag,
operationOptions
const digitalTwinsUpdateComponentOptionalParams: DigitalTwinsUpdateComponentOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-updateComponent",
digitalTwinsUpdateComponentOptionalParams
);
const stub = sinon.stub(testClient["client"].digitalTwins, "updateComponent");
testClient.updateComponent(testTwinId, testComponentPath, testJsonPatch, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testComponentPath, testJsonPatch, expectedOptions));
assert.isTrue(stub.calledWith(testTwinId, testComponentPath, testJsonPatch, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("updateComponent returns a promise of the generated code return value", async () => {
@ -276,16 +298,30 @@ describe("DigitalTwinsClient", () => {
it("getRelationship calls the getRelationshipById method with twinId and relationshipId on the generated client if there is no option defined", function() {
const stub = sinon.stub(testClient["client"].digitalTwins, "getRelationshipById");
const digitalTwinsGetRelationshipByIdOptionalParams: DigitalTwinsGetRelationshipByIdOptionalParams = {};
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-getRelationship",
digitalTwinsGetRelationshipByIdOptionalParams
);
testClient.getRelationship(testTwinId, testRelationshipId);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, {}));
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("getRelationship calls the getRelationshipById method with twinId, relationshipId and options on the generated client", function() {
const stub = sinon.stub(testClient["client"].digitalTwins, "getRelationshipById");
const digitalTwinsGetRelationshipByIdOptionalParams: DigitalTwinsGetRelationshipByIdOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-getRelationship",
digitalTwinsGetRelationshipByIdOptionalParams
);
testClient.getRelationship(testTwinId, testRelationshipId, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, operationOptions));
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("getRelationship returns a promise of the generated code return value", async () => {
@ -303,11 +339,17 @@ describe("DigitalTwinsClient", () => {
});
it("upsertRelationship calls the addRelationship method with twinId, relationshipId, relationshipJson and converted options on the generated client", function() {
var expectedOptions: DigitalTwinsAddRelationshipOptionalParams = operationOptions;
const stub = sinon.stub(testClient["client"].digitalTwins, "addRelationship");
const digitalTwinsAddRelationshipOptionalParams: DigitalTwinsAddRelationshipOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-upsertRelationship",
digitalTwinsAddRelationshipOptionalParams
);
testClient.upsertRelationship(testTwinId, testRelationshipId, testJsonString, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, testJsonString, expectedOptions));
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, testJsonString, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("upsertRelationship returns a promise of the generated code return value", async () => {
@ -331,24 +373,17 @@ describe("DigitalTwinsClient", () => {
});
it("updateRelationship calls the updateRelationship method with twinId, jsonPatch and converted options on the generated client", function() {
var expectedOptions: DigitalTwinsUpdateRelationshipOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsUpdateRelationshipOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const stub = sinon.stub(testClient["client"].digitalTwins, "updateRelationship");
testClient.updateRelationship(
testTwinId,
testRelationshipId,
testJsonPatch,
testEtag,
operationOptions
const digitalTwinsUpdateRelationshipOptionalParams: DigitalTwinsUpdateRelationshipOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-updateRelationship",
digitalTwinsUpdateRelationshipOptionalParams
);
const stub = sinon.stub(testClient["client"].digitalTwins, "updateRelationship");
testClient.updateRelationship(testTwinId, testRelationshipId, testJsonPatch, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, testJsonPatch, expectedOptions));
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, testJsonPatch, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("updateRelationship returns a promise of the generated code return value", async () => {
@ -372,18 +407,17 @@ describe("DigitalTwinsClient", () => {
});
it("deleteRelationship calls the deleteRelationship method with twinId, relationshipId and converted options on the generated client", function() {
var expectedOptions: DigitalTwinsDeleteRelationshipOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsDeleteRelationshipOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const digitalTwinsDeleteRelationshipOptionalParams: DigitalTwinsDeleteRelationshipOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-deleteRelationship",
digitalTwinsDeleteRelationshipOptionalParams
);
const stub = sinon.stub(testClient["client"].digitalTwins, "deleteRelationship");
testClient.deleteRelationship(testTwinId, testRelationshipId, testEtag, operationOptions);
testClient.deleteRelationship(testTwinId, testRelationshipId, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, expectedOptions));
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("deleteRelationship returns a promise of the generated code return value", async () => {
@ -443,13 +477,23 @@ describe("DigitalTwinsClient", () => {
it("getModel calls the getById method with twinId and converted options on the generated client", function() {
const includeModelDefinition: boolean = true;
const expectedOptions: DigitalTwinModelsGetByIdOptionalParams = operationOptions;
expectedOptions.includeModelDefinition = includeModelDefinition;
const digitalTwinModelsGetByIdOptionalParams: DigitalTwinModelsGetByIdOptionalParams = operationOptions;
digitalTwinModelsGetByIdOptionalParams.includeModelDefinition = includeModelDefinition;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-getModel",
digitalTwinModelsGetByIdOptionalParams
);
const stub = sinon.stub(testClient["client"].digitalTwinModels, "getById");
testClient.getModel(testModelId, includeModelDefinition, operationOptions);
testClient.getModel(
testModelId,
includeModelDefinition,
digitalTwinModelsGetByIdOptionalParams
);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testModelId, expectedOptions));
assert.isTrue(stub.calledWith(testModelId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("getModel rejects the promise if the generated code rejects it", async () => {
@ -461,11 +505,17 @@ describe("DigitalTwinsClient", () => {
it("createModels calls the add method with converted options on the generated client", function() {
const stub = sinon.stub(testClient["client"].digitalTwinModels, "add");
const expectedOptions: DigitalTwinModelsAddOptionalParams = {};
expectedOptions.models = testModels;
testClient.createModels(testModels);
const digitalTwinModelsAddOptionalParams: DigitalTwinModelsAddOptionalParams = operationOptions;
digitalTwinModelsAddOptionalParams.models = testModels;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-createModels",
digitalTwinModelsAddOptionalParams
);
testClient.createModels(testModels, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(expectedOptions));
assert.isTrue(stub.calledWith(updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("createModels rejects the promise if the generated code rejects it", async () => {
@ -477,9 +527,16 @@ describe("DigitalTwinsClient", () => {
it("decomissionModel calls the update method with modelId, patchJson and options on the generated client", function() {
const stub = sinon.stub(testClient["client"].digitalTwinModels, "update");
const digitalTwinModelsUpdateOptionalParams: DigitalTwinModelsUpdateOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-decomissionModel",
digitalTwinModelsUpdateOptionalParams
);
testClient.decomissionModel(testModelId, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testModelId, decommissionPatch, operationOptions));
assert.isTrue(stub.calledWith(testModelId, decommissionPatch, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("decomissionModel returns a promise of the generated code return value", async () => {
@ -500,9 +557,16 @@ describe("DigitalTwinsClient", () => {
it("deleteModel calls the deleteMethod method with modelId and options on the generated client", function() {
const stub = sinon.stub(testClient["client"].digitalTwinModels, "delete");
testClient.deleteModel(testModelId, operationOptions);
const digitalTwinModelsDeleteOptionalParams: DigitalTwinModelsDeleteOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-deleteModel",
digitalTwinModelsDeleteOptionalParams
);
testClient.deleteModel(testModelId, updatedOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testModelId, operationOptions));
assert.isTrue(stub.calledWith(testModelId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("deleteModel returns a promise of the generated code return value", async () => {
@ -530,9 +594,17 @@ describe("DigitalTwinsClient", () => {
it("getEventRoute calls the getById method with twinId and converted options on the generated client", function() {
const stub = sinon.stub(testClient["client"].eventRoutes, "getById");
testClient.getEventRoute(testEventRouteId, operationOptions);
const eventRoutesGetByIdOptionalParams: EventRoutesGetByIdOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-getEventRoute",
eventRoutesGetByIdOptionalParams
);
testClient.getEventRoute(testEventRouteId, updatedOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testEventRouteId, operationOptions));
assert.isTrue(stub.calledWith(testEventRouteId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("getEventRoute rejects the promise if the generated code rejects it", async () => {
@ -550,17 +622,23 @@ describe("DigitalTwinsClient", () => {
});
it("upsertEventRoute calls the add method with eventRouteId and converted options on the generated client", function() {
const expectedOptions: EventRoutesAddOptionalParams = operationOptions;
const eventRoutesAddOptionalParams: EventRoutesAddOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-upsertEventRoute",
eventRoutesAddOptionalParams
);
const eventRoute: EventRoute = {
endpointName: testEndpointName,
filter: testFilter
};
expectedOptions.eventRoute = eventRoute;
updatedOptions.eventRoute = eventRoute;
const stub = sinon.stub(testClient["client"].eventRoutes, "add");
testClient.upsertEventRoute(testEventRouteId, testEndpointName, testFilter, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testEventRouteId, expectedOptions));
assert.isTrue(stub.calledWith(testEventRouteId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("upsertEventRoute returns a promise of the generated code return value", async () => {
@ -585,9 +663,16 @@ describe("DigitalTwinsClient", () => {
it("deleteEventRoute calls the deleteMethod method with eventRouteId and options on the generated client", function() {
const stub = sinon.stub(testClient["client"].eventRoutes, "delete");
const eventRoutesDeleteOptionalParams: EventRoutesDeleteOptionalParams = operationOptions;
const { span, updatedOptions } = createSpan(
"DigitalTwinsClient-deleteEventRoute",
eventRoutesDeleteOptionalParams
);
testClient.deleteEventRoute(testEventRouteId, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testEventRouteId, operationOptions));
assert.isTrue(stub.calledWith(testEventRouteId, updatedOptions));
assert.isNotNull(updatedOptions);
assert.isNotNull(span);
});
it("deleteEventRoute returns a promise of the generated code return value", async () => {