@azure/arm-timeseriesinsights 2.1.0-beta.1 → 2.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -11
- package/README.md +1 -1
- package/dist/index.js +186 -59
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist-esm/samples-dev/accessPoliciesCreateOrUpdateSample.js +10 -3
- package/dist-esm/samples-dev/accessPoliciesCreateOrUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/accessPoliciesDeleteSample.js +10 -3
- package/dist-esm/samples-dev/accessPoliciesDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/accessPoliciesGetSample.js +10 -3
- package/dist-esm/samples-dev/accessPoliciesGetSample.js.map +1 -1
- package/dist-esm/samples-dev/accessPoliciesListByEnvironmentSample.js +10 -3
- package/dist-esm/samples-dev/accessPoliciesListByEnvironmentSample.js.map +1 -1
- package/dist-esm/samples-dev/accessPoliciesUpdateSample.js +10 -3
- package/dist-esm/samples-dev/accessPoliciesUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/environmentsCreateOrUpdateSample.js +10 -3
- package/dist-esm/samples-dev/environmentsCreateOrUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/environmentsDeleteSample.js +10 -3
- package/dist-esm/samples-dev/environmentsDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/environmentsGetSample.js +10 -3
- package/dist-esm/samples-dev/environmentsGetSample.js.map +1 -1
- package/dist-esm/samples-dev/environmentsListByResourceGroupSample.js +10 -3
- package/dist-esm/samples-dev/environmentsListByResourceGroupSample.js.map +1 -1
- package/dist-esm/samples-dev/environmentsListBySubscriptionSample.js +9 -2
- package/dist-esm/samples-dev/environmentsListBySubscriptionSample.js.map +1 -1
- package/dist-esm/samples-dev/environmentsUpdateSample.js +10 -3
- package/dist-esm/samples-dev/environmentsUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/eventSourcesCreateOrUpdateSample.js +13 -6
- package/dist-esm/samples-dev/eventSourcesCreateOrUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/eventSourcesDeleteSample.js +10 -3
- package/dist-esm/samples-dev/eventSourcesDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/eventSourcesGetSample.js +10 -3
- package/dist-esm/samples-dev/eventSourcesGetSample.js.map +1 -1
- package/dist-esm/samples-dev/eventSourcesListByEnvironmentSample.js +10 -3
- package/dist-esm/samples-dev/eventSourcesListByEnvironmentSample.js.map +1 -1
- package/dist-esm/samples-dev/eventSourcesUpdateSample.js +10 -3
- package/dist-esm/samples-dev/eventSourcesUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/operationsListSample.js +10 -2
- package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
- package/dist-esm/samples-dev/privateEndpointConnectionsCreateOrUpdateSample.js +10 -3
- package/dist-esm/samples-dev/privateEndpointConnectionsCreateOrUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/privateEndpointConnectionsDeleteSample.js +10 -3
- package/dist-esm/samples-dev/privateEndpointConnectionsDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/privateEndpointConnectionsGetSample.js +10 -3
- package/dist-esm/samples-dev/privateEndpointConnectionsGetSample.js.map +1 -1
- package/dist-esm/samples-dev/privateEndpointConnectionsListByEnvironmentSample.js +10 -3
- package/dist-esm/samples-dev/privateEndpointConnectionsListByEnvironmentSample.js.map +1 -1
- package/dist-esm/samples-dev/privateLinkResourcesListSupportedSample.js +10 -3
- package/dist-esm/samples-dev/privateLinkResourcesListSupportedSample.js.map +1 -1
- package/dist-esm/samples-dev/referenceDataSetsCreateOrUpdateSample.js +10 -3
- package/dist-esm/samples-dev/referenceDataSetsCreateOrUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/referenceDataSetsDeleteSample.js +10 -3
- package/dist-esm/samples-dev/referenceDataSetsDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/referenceDataSetsGetSample.js +10 -3
- package/dist-esm/samples-dev/referenceDataSetsGetSample.js.map +1 -1
- package/dist-esm/samples-dev/referenceDataSetsListByEnvironmentSample.js +10 -3
- package/dist-esm/samples-dev/referenceDataSetsListByEnvironmentSample.js.map +1 -1
- package/dist-esm/samples-dev/referenceDataSetsUpdateSample.js +10 -3
- package/dist-esm/samples-dev/referenceDataSetsUpdateSample.js.map +1 -1
- package/dist-esm/src/index.d.ts +1 -0
- package/dist-esm/src/index.d.ts.map +1 -1
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models/index.d.ts +138 -68
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +50 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/models/mappers.d.ts +10 -10
- package/dist-esm/src/models/mappers.js +28 -28
- package/dist-esm/src/models/mappers.js.map +1 -1
- package/dist-esm/src/operations/operations.d.ts.map +1 -1
- package/dist-esm/src/operations/operations.js +19 -8
- package/dist-esm/src/operations/operations.js.map +1 -1
- package/dist-esm/src/operations/privateLinkResources.d.ts.map +1 -1
- package/dist-esm/src/operations/privateLinkResources.js +8 -4
- package/dist-esm/src/operations/privateLinkResources.js.map +1 -1
- package/dist-esm/src/pagingHelper.d.ts +13 -0
- package/dist-esm/src/pagingHelper.d.ts.map +1 -0
- package/dist-esm/src/pagingHelper.js +32 -0
- package/dist-esm/src/pagingHelper.js.map +1 -0
- package/dist-esm/src/timeSeriesInsightsClient.d.ts +2 -0
- package/dist-esm/src/timeSeriesInsightsClient.d.ts.map +1 -1
- package/dist-esm/src/timeSeriesInsightsClient.js +49 -18
- package/dist-esm/src/timeSeriesInsightsClient.js.map +1 -1
- package/dist-esm/test/sampleTest.js +11 -13
- package/dist-esm/test/sampleTest.js.map +1 -1
- package/package.json +15 -10
- package/review/arm-timeseriesinsights.api.md +143 -178
- package/src/index.ts +1 -0
- package/src/models/index.ts +159 -70
- package/src/models/mappers.ts +28 -28
- package/src/operations/operations.ts +21 -9
- package/src/operations/privateLinkResources.ts +11 -5
- package/src/pagingHelper.ts +39 -0
- package/src/timeSeriesInsightsClient.ts +60 -20
- package/types/arm-timeseriesinsights.d.ts +149 -68
- package/types/tsdoc-metadata.json +1 -1
package/src/models/mappers.ts
CHANGED
@@ -1532,9 +1532,9 @@ export const Gen1EnvironmentCreateOrUpdateParameters: coreClient.CompositeMapper
|
|
1532
1532
|
type: {
|
1533
1533
|
name: "Composite",
|
1534
1534
|
className: "Gen1EnvironmentCreateOrUpdateParameters",
|
1535
|
-
uberParent: "
|
1535
|
+
uberParent: "EnvironmentCreateOrUpdateParameters",
|
1536
1536
|
polymorphicDiscriminator:
|
1537
|
-
|
1537
|
+
EnvironmentCreateOrUpdateParameters.type.polymorphicDiscriminator,
|
1538
1538
|
modelProperties: {
|
1539
1539
|
...EnvironmentCreateOrUpdateParameters.type.modelProperties,
|
1540
1540
|
dataRetentionTime: {
|
@@ -1571,9 +1571,9 @@ export const Gen2EnvironmentCreateOrUpdateParameters: coreClient.CompositeMapper
|
|
1571
1571
|
type: {
|
1572
1572
|
name: "Composite",
|
1573
1573
|
className: "Gen2EnvironmentCreateOrUpdateParameters",
|
1574
|
-
uberParent: "
|
1574
|
+
uberParent: "EnvironmentCreateOrUpdateParameters",
|
1575
1575
|
polymorphicDiscriminator:
|
1576
|
-
|
1576
|
+
EnvironmentCreateOrUpdateParameters.type.polymorphicDiscriminator,
|
1577
1577
|
modelProperties: {
|
1578
1578
|
...EnvironmentCreateOrUpdateParameters.type.modelProperties,
|
1579
1579
|
timeSeriesIdProperties: {
|
@@ -1631,9 +1631,9 @@ export const EventHubEventSourceCreateOrUpdateParameters: coreClient.CompositeMa
|
|
1631
1631
|
type: {
|
1632
1632
|
name: "Composite",
|
1633
1633
|
className: "EventHubEventSourceCreateOrUpdateParameters",
|
1634
|
-
uberParent: "
|
1634
|
+
uberParent: "EventSourceCreateOrUpdateParameters",
|
1635
1635
|
polymorphicDiscriminator:
|
1636
|
-
|
1636
|
+
EventSourceCreateOrUpdateParameters.type.polymorphicDiscriminator,
|
1637
1637
|
modelProperties: {
|
1638
1638
|
...EventSourceCreateOrUpdateParameters.type.modelProperties,
|
1639
1639
|
provisioningState: {
|
@@ -1726,9 +1726,9 @@ export const IoTHubEventSourceCreateOrUpdateParameters: coreClient.CompositeMapp
|
|
1726
1726
|
type: {
|
1727
1727
|
name: "Composite",
|
1728
1728
|
className: "IoTHubEventSourceCreateOrUpdateParameters",
|
1729
|
-
uberParent: "
|
1729
|
+
uberParent: "EventSourceCreateOrUpdateParameters",
|
1730
1730
|
polymorphicDiscriminator:
|
1731
|
-
|
1731
|
+
EventSourceCreateOrUpdateParameters.type.polymorphicDiscriminator,
|
1732
1732
|
modelProperties: {
|
1733
1733
|
...EventSourceCreateOrUpdateParameters.type.modelProperties,
|
1734
1734
|
provisioningState: {
|
@@ -1814,7 +1814,7 @@ export const EnvironmentResource: coreClient.CompositeMapper = {
|
|
1814
1814
|
type: {
|
1815
1815
|
name: "Composite",
|
1816
1816
|
className: "EnvironmentResource",
|
1817
|
-
uberParent: "
|
1817
|
+
uberParent: "TrackedResource",
|
1818
1818
|
polymorphicDiscriminator: {
|
1819
1819
|
serializedName: "kind",
|
1820
1820
|
clientName: "kind"
|
@@ -1844,7 +1844,7 @@ export const EventSourceResource: coreClient.CompositeMapper = {
|
|
1844
1844
|
type: {
|
1845
1845
|
name: "Composite",
|
1846
1846
|
className: "EventSourceResource",
|
1847
|
-
uberParent: "
|
1847
|
+
uberParent: "TrackedResource",
|
1848
1848
|
polymorphicDiscriminator: {
|
1849
1849
|
serializedName: "kind",
|
1850
1850
|
clientName: "kind"
|
@@ -1982,8 +1982,8 @@ export const Gen1EnvironmentResource: coreClient.CompositeMapper = {
|
|
1982
1982
|
type: {
|
1983
1983
|
name: "Composite",
|
1984
1984
|
className: "Gen1EnvironmentResource",
|
1985
|
-
uberParent: "
|
1986
|
-
polymorphicDiscriminator:
|
1985
|
+
uberParent: "EnvironmentResource",
|
1986
|
+
polymorphicDiscriminator: EnvironmentResource.type.polymorphicDiscriminator,
|
1987
1987
|
modelProperties: {
|
1988
1988
|
...EnvironmentResource.type.modelProperties,
|
1989
1989
|
dataRetentionTime: {
|
@@ -2055,8 +2055,8 @@ export const Gen2EnvironmentResource: coreClient.CompositeMapper = {
|
|
2055
2055
|
type: {
|
2056
2056
|
name: "Composite",
|
2057
2057
|
className: "Gen2EnvironmentResource",
|
2058
|
-
uberParent: "
|
2059
|
-
polymorphicDiscriminator:
|
2058
|
+
uberParent: "EnvironmentResource",
|
2059
|
+
polymorphicDiscriminator: EnvironmentResource.type.polymorphicDiscriminator,
|
2060
2060
|
modelProperties: {
|
2061
2061
|
...EnvironmentResource.type.modelProperties,
|
2062
2062
|
provisioningState: {
|
@@ -2149,8 +2149,8 @@ export const EventHubEventSourceResource: coreClient.CompositeMapper = {
|
|
2149
2149
|
type: {
|
2150
2150
|
name: "Composite",
|
2151
2151
|
className: "EventHubEventSourceResource",
|
2152
|
-
uberParent: "
|
2153
|
-
polymorphicDiscriminator:
|
2152
|
+
uberParent: "EventSourceResource",
|
2153
|
+
polymorphicDiscriminator: EventSourceResource.type.polymorphicDiscriminator,
|
2154
2154
|
modelProperties: {
|
2155
2155
|
...EventSourceResource.type.modelProperties,
|
2156
2156
|
provisioningState: {
|
@@ -2236,8 +2236,8 @@ export const IoTHubEventSourceResource: coreClient.CompositeMapper = {
|
|
2236
2236
|
type: {
|
2237
2237
|
name: "Composite",
|
2238
2238
|
className: "IoTHubEventSourceResource",
|
2239
|
-
uberParent: "
|
2240
|
-
polymorphicDiscriminator:
|
2239
|
+
uberParent: "EventSourceResource",
|
2240
|
+
polymorphicDiscriminator: EventSourceResource.type.polymorphicDiscriminator,
|
2241
2241
|
modelProperties: {
|
2242
2242
|
...EventSourceResource.type.modelProperties,
|
2243
2243
|
provisioningState: {
|
@@ -2443,14 +2443,14 @@ export let discriminators = {
|
|
2443
2443
|
"EnvironmentUpdateParameters.Gen2": Gen2EnvironmentUpdateParameters,
|
2444
2444
|
"EventSourceUpdateParameters.Microsoft.EventHub": EventHubEventSourceUpdateParameters,
|
2445
2445
|
"EventSourceUpdateParameters.Microsoft.IoTHub": IoTHubEventSourceUpdateParameters,
|
2446
|
-
"
|
2447
|
-
"
|
2448
|
-
"
|
2449
|
-
"
|
2450
|
-
"
|
2451
|
-
"
|
2452
|
-
"
|
2453
|
-
"
|
2454
|
-
"
|
2455
|
-
"
|
2446
|
+
"EnvironmentCreateOrUpdateParameters.Gen1": Gen1EnvironmentCreateOrUpdateParameters,
|
2447
|
+
"EnvironmentCreateOrUpdateParameters.Gen2": Gen2EnvironmentCreateOrUpdateParameters,
|
2448
|
+
"EventSourceCreateOrUpdateParameters.Microsoft.EventHub": EventHubEventSourceCreateOrUpdateParameters,
|
2449
|
+
"EventSourceCreateOrUpdateParameters.Microsoft.IoTHub": IoTHubEventSourceCreateOrUpdateParameters,
|
2450
|
+
"TrackedResource.EnvironmentResource": EnvironmentResource,
|
2451
|
+
"TrackedResource.EventSourceResource": EventSourceResource,
|
2452
|
+
"EnvironmentResource.Gen1": Gen1EnvironmentResource,
|
2453
|
+
"EnvironmentResource.Gen2": Gen2EnvironmentResource,
|
2454
|
+
"EventSourceResource.Microsoft.EventHub": EventHubEventSourceResource,
|
2455
|
+
"EventSourceResource.Microsoft.IoTHub": IoTHubEventSourceResource
|
2456
2456
|
};
|
@@ -6,7 +6,8 @@
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
7
7
|
*/
|
8
8
|
|
9
|
-
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
9
|
+
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
|
10
|
+
import { setContinuationToken } from "../pagingHelper";
|
10
11
|
import { Operations } from "../operationsInterfaces";
|
11
12
|
import * as coreClient from "@azure/core-client";
|
12
13
|
import * as Mappers from "../models/mappers";
|
@@ -48,22 +49,34 @@ export class OperationsImpl implements Operations {
|
|
48
49
|
[Symbol.asyncIterator]() {
|
49
50
|
return this;
|
50
51
|
},
|
51
|
-
byPage: () => {
|
52
|
-
|
52
|
+
byPage: (settings?: PageSettings) => {
|
53
|
+
if (settings?.maxPageSize) {
|
54
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
55
|
+
}
|
56
|
+
return this.listPagingPage(options, settings);
|
53
57
|
}
|
54
58
|
};
|
55
59
|
}
|
56
60
|
|
57
61
|
private async *listPagingPage(
|
58
|
-
options?: OperationsListOptionalParams
|
62
|
+
options?: OperationsListOptionalParams,
|
63
|
+
settings?: PageSettings
|
59
64
|
): AsyncIterableIterator<Operation[]> {
|
60
|
-
let result
|
61
|
-
|
62
|
-
|
65
|
+
let result: OperationsListResponse;
|
66
|
+
let continuationToken = settings?.continuationToken;
|
67
|
+
if (!continuationToken) {
|
68
|
+
result = await this._list(options);
|
69
|
+
let page = result.value || [];
|
70
|
+
continuationToken = result.nextLink;
|
71
|
+
setContinuationToken(page, continuationToken);
|
72
|
+
yield page;
|
73
|
+
}
|
63
74
|
while (continuationToken) {
|
64
75
|
result = await this._listNext(continuationToken, options);
|
65
76
|
continuationToken = result.nextLink;
|
66
|
-
|
77
|
+
let page = result.value || [];
|
78
|
+
setContinuationToken(page, continuationToken);
|
79
|
+
yield page;
|
67
80
|
}
|
68
81
|
}
|
69
82
|
|
@@ -130,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
|
|
130
143
|
bodyMapper: Mappers.CloudError
|
131
144
|
}
|
132
145
|
},
|
133
|
-
queryParameters: [Parameters.apiVersion],
|
134
146
|
urlParameters: [Parameters.$host, Parameters.nextLink],
|
135
147
|
headerParameters: [Parameters.accept],
|
136
148
|
serializer
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
7
7
|
*/
|
8
8
|
|
9
|
-
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
9
|
+
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
|
10
10
|
import { PrivateLinkResources } from "../operationsInterfaces";
|
11
11
|
import * as coreClient from "@azure/core-client";
|
12
12
|
import * as Mappers from "../models/mappers";
|
@@ -55,11 +55,15 @@ export class PrivateLinkResourcesImpl implements PrivateLinkResources {
|
|
55
55
|
[Symbol.asyncIterator]() {
|
56
56
|
return this;
|
57
57
|
},
|
58
|
-
byPage: () => {
|
58
|
+
byPage: (settings?: PageSettings) => {
|
59
|
+
if (settings?.maxPageSize) {
|
60
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
61
|
+
}
|
59
62
|
return this.listSupportedPagingPage(
|
60
63
|
resourceGroupName,
|
61
64
|
environmentName,
|
62
|
-
options
|
65
|
+
options,
|
66
|
+
settings
|
63
67
|
);
|
64
68
|
}
|
65
69
|
};
|
@@ -68,9 +72,11 @@ export class PrivateLinkResourcesImpl implements PrivateLinkResources {
|
|
68
72
|
private async *listSupportedPagingPage(
|
69
73
|
resourceGroupName: string,
|
70
74
|
environmentName: string,
|
71
|
-
options?: PrivateLinkResourcesListSupportedOptionalParams
|
75
|
+
options?: PrivateLinkResourcesListSupportedOptionalParams,
|
76
|
+
_settings?: PageSettings
|
72
77
|
): AsyncIterableIterator<PrivateLinkResource[]> {
|
73
|
-
let result
|
78
|
+
let result: PrivateLinkResourcesListSupportedResponse;
|
79
|
+
result = await this._listSupported(
|
74
80
|
resourceGroupName,
|
75
81
|
environmentName,
|
76
82
|
options
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
3
|
+
* Licensed under the MIT License.
|
4
|
+
*
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
7
|
+
*/
|
8
|
+
|
9
|
+
export interface PageInfo {
|
10
|
+
continuationToken?: string;
|
11
|
+
}
|
12
|
+
|
13
|
+
const pageMap = new WeakMap<object, PageInfo>();
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Given the last `.value` produced by the `byPage` iterator,
|
17
|
+
* returns a continuation token that can be used to begin paging from
|
18
|
+
* that point later.
|
19
|
+
* @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
|
20
|
+
* @returns The continuation token that can be passed into byPage() during future calls.
|
21
|
+
*/
|
22
|
+
export function getContinuationToken(page: unknown): string | undefined {
|
23
|
+
if (typeof page !== "object" || page === null) {
|
24
|
+
return undefined;
|
25
|
+
}
|
26
|
+
return pageMap.get(page)?.continuationToken;
|
27
|
+
}
|
28
|
+
|
29
|
+
export function setContinuationToken(
|
30
|
+
page: unknown,
|
31
|
+
continuationToken: string | undefined
|
32
|
+
): void {
|
33
|
+
if (typeof page !== "object" || page === null || !continuationToken) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
const pageInfo = pageMap.get(page) ?? {};
|
37
|
+
pageInfo.continuationToken = continuationToken;
|
38
|
+
pageMap.set(page, pageInfo);
|
39
|
+
}
|
@@ -8,6 +8,11 @@
|
|
8
8
|
|
9
9
|
import * as coreClient from "@azure/core-client";
|
10
10
|
import * as coreRestPipeline from "@azure/core-rest-pipeline";
|
11
|
+
import {
|
12
|
+
PipelineRequest,
|
13
|
+
PipelineResponse,
|
14
|
+
SendRequest
|
15
|
+
} from "@azure/core-rest-pipeline";
|
11
16
|
import * as coreAuth from "@azure/core-auth";
|
12
17
|
import {
|
13
18
|
OperationsImpl,
|
@@ -61,47 +66,53 @@ export class TimeSeriesInsightsClient extends coreClient.ServiceClient {
|
|
61
66
|
credential: credentials
|
62
67
|
};
|
63
68
|
|
64
|
-
const packageDetails = `azsdk-js-arm-timeseriesinsights/2.1.0-beta.
|
69
|
+
const packageDetails = `azsdk-js-arm-timeseriesinsights/2.1.0-beta.2`;
|
65
70
|
const userAgentPrefix =
|
66
71
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
67
72
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
68
73
|
: `${packageDetails}`;
|
69
74
|
|
70
|
-
if (!options.credentialScopes) {
|
71
|
-
options.credentialScopes = ["https://management.azure.com/.default"];
|
72
|
-
}
|
73
75
|
const optionsWithDefaults = {
|
74
76
|
...defaults,
|
75
77
|
...options,
|
76
78
|
userAgentOptions: {
|
77
79
|
userAgentPrefix
|
78
80
|
},
|
79
|
-
|
81
|
+
endpoint:
|
80
82
|
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
81
83
|
};
|
82
84
|
super(optionsWithDefaults);
|
83
85
|
|
86
|
+
let bearerTokenAuthenticationPolicyFound: boolean = false;
|
84
87
|
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
85
88
|
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
86
|
-
|
89
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
87
90
|
(pipelinePolicy) =>
|
88
91
|
pipelinePolicy.name ===
|
89
92
|
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
90
93
|
);
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
94
|
+
}
|
95
|
+
if (
|
96
|
+
!options ||
|
97
|
+
!options.pipeline ||
|
98
|
+
options.pipeline.getOrderedPolicies().length == 0 ||
|
99
|
+
!bearerTokenAuthenticationPolicyFound
|
100
|
+
) {
|
101
|
+
this.pipeline.removePolicy({
|
102
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
103
|
+
});
|
104
|
+
this.pipeline.addPolicy(
|
105
|
+
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
106
|
+
credential: credentials,
|
107
|
+
scopes:
|
108
|
+
optionsWithDefaults.credentialScopes ??
|
109
|
+
`${optionsWithDefaults.endpoint}/.default`,
|
110
|
+
challengeCallbacks: {
|
111
|
+
authorizeRequestOnChallenge:
|
112
|
+
coreClient.authorizeRequestOnClaimChallenge
|
113
|
+
}
|
114
|
+
})
|
115
|
+
);
|
105
116
|
}
|
106
117
|
// Parameter assignments
|
107
118
|
this.subscriptionId = subscriptionId;
|
@@ -116,6 +127,35 @@ export class TimeSeriesInsightsClient extends coreClient.ServiceClient {
|
|
116
127
|
this.accessPolicies = new AccessPoliciesImpl(this);
|
117
128
|
this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this);
|
118
129
|
this.privateLinkResources = new PrivateLinkResourcesImpl(this);
|
130
|
+
this.addCustomApiVersionPolicy(options.apiVersion);
|
131
|
+
}
|
132
|
+
|
133
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
134
|
+
private addCustomApiVersionPolicy(apiVersion?: string) {
|
135
|
+
if (!apiVersion) {
|
136
|
+
return;
|
137
|
+
}
|
138
|
+
const apiVersionPolicy = {
|
139
|
+
name: "CustomApiVersionPolicy",
|
140
|
+
async sendRequest(
|
141
|
+
request: PipelineRequest,
|
142
|
+
next: SendRequest
|
143
|
+
): Promise<PipelineResponse> {
|
144
|
+
const param = request.url.split("?");
|
145
|
+
if (param.length > 1) {
|
146
|
+
const newParams = param[1].split("&").map((item) => {
|
147
|
+
if (item.indexOf("api-version") > -1) {
|
148
|
+
return "api-version=" + apiVersion;
|
149
|
+
} else {
|
150
|
+
return item;
|
151
|
+
}
|
152
|
+
});
|
153
|
+
request.url = param[0] + "?" + newParams.join("&");
|
154
|
+
}
|
155
|
+
return next(request);
|
156
|
+
}
|
157
|
+
};
|
158
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
119
159
|
}
|
120
160
|
|
121
161
|
operations: Operations;
|