@azure/arm-sqlvirtualmachine 5.0.0-beta.4 → 5.0.0-beta.6
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 +2 -2
- package/dist/index.js +276 -94
- 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/src/models/index.d.ts +146 -34
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +81 -11
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/models/mappers.d.ts +1 -0
- package/dist-esm/src/models/mappers.d.ts.map +1 -1
- package/dist-esm/src/models/mappers.js +79 -1
- package/dist-esm/src/models/mappers.js.map +1 -1
- package/dist-esm/src/models/parameters.js +1 -1
- package/dist-esm/src/operations/sqlVirtualMachines.d.ts +17 -17
- package/dist-esm/src/operations/sqlVirtualMachines.d.ts.map +1 -1
- package/dist-esm/src/operations/sqlVirtualMachines.js +66 -66
- package/dist-esm/src/operations/sqlVirtualMachines.js.map +1 -1
- package/dist-esm/src/operationsInterfaces/sqlVirtualMachines.d.ts +17 -17
- package/dist-esm/src/operationsInterfaces/sqlVirtualMachines.d.ts.map +1 -1
- package/dist-esm/src/sqlVirtualMachineManagementClient.d.ts +2 -0
- package/dist-esm/src/sqlVirtualMachineManagementClient.d.ts.map +1 -1
- package/dist-esm/src/sqlVirtualMachineManagementClient.js +48 -14
- package/dist-esm/src/sqlVirtualMachineManagementClient.js.map +1 -1
- package/dist-esm/test/sampleTest.js +11 -13
- package/dist-esm/test/sampleTest.js.map +1 -1
- package/package.json +12 -9
- package/review/arm-sqlvirtualmachine.api.md +83 -103
- package/src/models/index.ts +159 -35
- package/src/models/mappers.ts +84 -1
- package/src/models/parameters.ts +1 -1
- package/src/operations/sqlVirtualMachines.ts +99 -99
- package/src/operationsInterfaces/sqlVirtualMachines.ts +26 -26
- package/src/sqlVirtualMachineManagementClient.ts +58 -17
- package/types/arm-sqlvirtualmachine.d.ts +184 -64
- package/types/tsdoc-metadata.json +1 -1
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
SqlVirtualMachinesListByResourceGroupOptionalParams,
|
|
25
25
|
SqlVirtualMachinesListBySqlVmGroupResponse,
|
|
26
26
|
SqlVirtualMachinesListResponse,
|
|
27
|
+
SqlVirtualMachinesStartAssessmentOptionalParams,
|
|
27
28
|
SqlVirtualMachinesRedeployOptionalParams,
|
|
28
29
|
SqlVirtualMachinesGetOptionalParams,
|
|
29
30
|
SqlVirtualMachinesGetResponse,
|
|
@@ -34,7 +35,6 @@ import {
|
|
|
34
35
|
SqlVirtualMachinesUpdateOptionalParams,
|
|
35
36
|
SqlVirtualMachinesUpdateResponse,
|
|
36
37
|
SqlVirtualMachinesListByResourceGroupResponse,
|
|
37
|
-
SqlVirtualMachinesStartAssessmentOptionalParams,
|
|
38
38
|
SqlVirtualMachinesListBySqlVmGroupNextResponse,
|
|
39
39
|
SqlVirtualMachinesListNextResponse,
|
|
40
40
|
SqlVirtualMachinesListByResourceGroupNextResponse
|
|
@@ -249,6 +249,90 @@ export class SqlVirtualMachinesImpl implements SqlVirtualMachines {
|
|
|
249
249
|
return this.client.sendOperationRequest({ options }, listOperationSpec);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Starts Assessment on SQL virtual machine.
|
|
254
|
+
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
255
|
+
* value from the Azure Resource Manager API or the portal.
|
|
256
|
+
* @param sqlVirtualMachineName Name of the SQL virtual machine.
|
|
257
|
+
* @param options The options parameters.
|
|
258
|
+
*/
|
|
259
|
+
async beginStartAssessment(
|
|
260
|
+
resourceGroupName: string,
|
|
261
|
+
sqlVirtualMachineName: string,
|
|
262
|
+
options?: SqlVirtualMachinesStartAssessmentOptionalParams
|
|
263
|
+
): Promise<PollerLike<PollOperationState<void>, void>> {
|
|
264
|
+
const directSendOperation = async (
|
|
265
|
+
args: coreClient.OperationArguments,
|
|
266
|
+
spec: coreClient.OperationSpec
|
|
267
|
+
): Promise<void> => {
|
|
268
|
+
return this.client.sendOperationRequest(args, spec);
|
|
269
|
+
};
|
|
270
|
+
const sendOperation = async (
|
|
271
|
+
args: coreClient.OperationArguments,
|
|
272
|
+
spec: coreClient.OperationSpec
|
|
273
|
+
) => {
|
|
274
|
+
let currentRawResponse:
|
|
275
|
+
| coreClient.FullOperationResponse
|
|
276
|
+
| undefined = undefined;
|
|
277
|
+
const providedCallback = args.options?.onResponse;
|
|
278
|
+
const callback: coreClient.RawResponseCallback = (
|
|
279
|
+
rawResponse: coreClient.FullOperationResponse,
|
|
280
|
+
flatResponse: unknown
|
|
281
|
+
) => {
|
|
282
|
+
currentRawResponse = rawResponse;
|
|
283
|
+
providedCallback?.(rawResponse, flatResponse);
|
|
284
|
+
};
|
|
285
|
+
const updatedArgs = {
|
|
286
|
+
...args,
|
|
287
|
+
options: {
|
|
288
|
+
...args.options,
|
|
289
|
+
onResponse: callback
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
const flatResponse = await directSendOperation(updatedArgs, spec);
|
|
293
|
+
return {
|
|
294
|
+
flatResponse,
|
|
295
|
+
rawResponse: {
|
|
296
|
+
statusCode: currentRawResponse!.status,
|
|
297
|
+
body: currentRawResponse!.parsedBody,
|
|
298
|
+
headers: currentRawResponse!.headers.toJSON()
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const lro = new LroImpl(
|
|
304
|
+
sendOperation,
|
|
305
|
+
{ resourceGroupName, sqlVirtualMachineName, options },
|
|
306
|
+
startAssessmentOperationSpec
|
|
307
|
+
);
|
|
308
|
+
const poller = new LroEngine(lro, {
|
|
309
|
+
resumeFrom: options?.resumeFrom,
|
|
310
|
+
intervalInMs: options?.updateIntervalInMs
|
|
311
|
+
});
|
|
312
|
+
await poller.poll();
|
|
313
|
+
return poller;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Starts Assessment on SQL virtual machine.
|
|
318
|
+
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
319
|
+
* value from the Azure Resource Manager API or the portal.
|
|
320
|
+
* @param sqlVirtualMachineName Name of the SQL virtual machine.
|
|
321
|
+
* @param options The options parameters.
|
|
322
|
+
*/
|
|
323
|
+
async beginStartAssessmentAndWait(
|
|
324
|
+
resourceGroupName: string,
|
|
325
|
+
sqlVirtualMachineName: string,
|
|
326
|
+
options?: SqlVirtualMachinesStartAssessmentOptionalParams
|
|
327
|
+
): Promise<void> {
|
|
328
|
+
const poller = await this.beginStartAssessment(
|
|
329
|
+
resourceGroupName,
|
|
330
|
+
sqlVirtualMachineName,
|
|
331
|
+
options
|
|
332
|
+
);
|
|
333
|
+
return poller.pollUntilDone();
|
|
334
|
+
}
|
|
335
|
+
|
|
252
336
|
/**
|
|
253
337
|
* Uninstalls and reinstalls the SQL Iaas Extension.
|
|
254
338
|
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
@@ -639,90 +723,6 @@ export class SqlVirtualMachinesImpl implements SqlVirtualMachines {
|
|
|
639
723
|
);
|
|
640
724
|
}
|
|
641
725
|
|
|
642
|
-
/**
|
|
643
|
-
* Starts Assessment on SQL virtual machine.
|
|
644
|
-
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
645
|
-
* value from the Azure Resource Manager API or the portal.
|
|
646
|
-
* @param sqlVirtualMachineName Name of the SQL virtual machine.
|
|
647
|
-
* @param options The options parameters.
|
|
648
|
-
*/
|
|
649
|
-
async beginStartAssessment(
|
|
650
|
-
resourceGroupName: string,
|
|
651
|
-
sqlVirtualMachineName: string,
|
|
652
|
-
options?: SqlVirtualMachinesStartAssessmentOptionalParams
|
|
653
|
-
): Promise<PollerLike<PollOperationState<void>, void>> {
|
|
654
|
-
const directSendOperation = async (
|
|
655
|
-
args: coreClient.OperationArguments,
|
|
656
|
-
spec: coreClient.OperationSpec
|
|
657
|
-
): Promise<void> => {
|
|
658
|
-
return this.client.sendOperationRequest(args, spec);
|
|
659
|
-
};
|
|
660
|
-
const sendOperation = async (
|
|
661
|
-
args: coreClient.OperationArguments,
|
|
662
|
-
spec: coreClient.OperationSpec
|
|
663
|
-
) => {
|
|
664
|
-
let currentRawResponse:
|
|
665
|
-
| coreClient.FullOperationResponse
|
|
666
|
-
| undefined = undefined;
|
|
667
|
-
const providedCallback = args.options?.onResponse;
|
|
668
|
-
const callback: coreClient.RawResponseCallback = (
|
|
669
|
-
rawResponse: coreClient.FullOperationResponse,
|
|
670
|
-
flatResponse: unknown
|
|
671
|
-
) => {
|
|
672
|
-
currentRawResponse = rawResponse;
|
|
673
|
-
providedCallback?.(rawResponse, flatResponse);
|
|
674
|
-
};
|
|
675
|
-
const updatedArgs = {
|
|
676
|
-
...args,
|
|
677
|
-
options: {
|
|
678
|
-
...args.options,
|
|
679
|
-
onResponse: callback
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
const flatResponse = await directSendOperation(updatedArgs, spec);
|
|
683
|
-
return {
|
|
684
|
-
flatResponse,
|
|
685
|
-
rawResponse: {
|
|
686
|
-
statusCode: currentRawResponse!.status,
|
|
687
|
-
body: currentRawResponse!.parsedBody,
|
|
688
|
-
headers: currentRawResponse!.headers.toJSON()
|
|
689
|
-
}
|
|
690
|
-
};
|
|
691
|
-
};
|
|
692
|
-
|
|
693
|
-
const lro = new LroImpl(
|
|
694
|
-
sendOperation,
|
|
695
|
-
{ resourceGroupName, sqlVirtualMachineName, options },
|
|
696
|
-
startAssessmentOperationSpec
|
|
697
|
-
);
|
|
698
|
-
const poller = new LroEngine(lro, {
|
|
699
|
-
resumeFrom: options?.resumeFrom,
|
|
700
|
-
intervalInMs: options?.updateIntervalInMs
|
|
701
|
-
});
|
|
702
|
-
await poller.poll();
|
|
703
|
-
return poller;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* Starts Assessment on SQL virtual machine.
|
|
708
|
-
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
709
|
-
* value from the Azure Resource Manager API or the portal.
|
|
710
|
-
* @param sqlVirtualMachineName Name of the SQL virtual machine.
|
|
711
|
-
* @param options The options parameters.
|
|
712
|
-
*/
|
|
713
|
-
async beginStartAssessmentAndWait(
|
|
714
|
-
resourceGroupName: string,
|
|
715
|
-
sqlVirtualMachineName: string,
|
|
716
|
-
options?: SqlVirtualMachinesStartAssessmentOptionalParams
|
|
717
|
-
): Promise<void> {
|
|
718
|
-
const poller = await this.beginStartAssessment(
|
|
719
|
-
resourceGroupName,
|
|
720
|
-
sqlVirtualMachineName,
|
|
721
|
-
options
|
|
722
|
-
);
|
|
723
|
-
return poller.pollUntilDone();
|
|
724
|
-
}
|
|
725
|
-
|
|
726
726
|
/**
|
|
727
727
|
* ListBySqlVmGroupNext
|
|
728
728
|
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
@@ -814,6 +814,20 @@ const listOperationSpec: coreClient.OperationSpec = {
|
|
|
814
814
|
headerParameters: [Parameters.accept],
|
|
815
815
|
serializer
|
|
816
816
|
};
|
|
817
|
+
const startAssessmentOperationSpec: coreClient.OperationSpec = {
|
|
818
|
+
path:
|
|
819
|
+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment",
|
|
820
|
+
httpMethod: "POST",
|
|
821
|
+
responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
|
|
822
|
+
queryParameters: [Parameters.apiVersion],
|
|
823
|
+
urlParameters: [
|
|
824
|
+
Parameters.$host,
|
|
825
|
+
Parameters.resourceGroupName,
|
|
826
|
+
Parameters.subscriptionId,
|
|
827
|
+
Parameters.sqlVirtualMachineName
|
|
828
|
+
],
|
|
829
|
+
serializer
|
|
830
|
+
};
|
|
817
831
|
const redeployOperationSpec: coreClient.OperationSpec = {
|
|
818
832
|
path:
|
|
819
833
|
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy",
|
|
@@ -943,20 +957,6 @@ const listByResourceGroupOperationSpec: coreClient.OperationSpec = {
|
|
|
943
957
|
headerParameters: [Parameters.accept],
|
|
944
958
|
serializer
|
|
945
959
|
};
|
|
946
|
-
const startAssessmentOperationSpec: coreClient.OperationSpec = {
|
|
947
|
-
path:
|
|
948
|
-
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment",
|
|
949
|
-
httpMethod: "POST",
|
|
950
|
-
responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} },
|
|
951
|
-
queryParameters: [Parameters.apiVersion],
|
|
952
|
-
urlParameters: [
|
|
953
|
-
Parameters.$host,
|
|
954
|
-
Parameters.resourceGroupName,
|
|
955
|
-
Parameters.subscriptionId,
|
|
956
|
-
Parameters.sqlVirtualMachineName
|
|
957
|
-
],
|
|
958
|
-
serializer
|
|
959
|
-
};
|
|
960
960
|
const listBySqlVmGroupNextOperationSpec: coreClient.OperationSpec = {
|
|
961
961
|
path: "{nextLink}",
|
|
962
962
|
httpMethod: "GET",
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
SqlVirtualMachinesListBySqlVmGroupOptionalParams,
|
|
14
14
|
SqlVirtualMachinesListOptionalParams,
|
|
15
15
|
SqlVirtualMachinesListByResourceGroupOptionalParams,
|
|
16
|
+
SqlVirtualMachinesStartAssessmentOptionalParams,
|
|
16
17
|
SqlVirtualMachinesRedeployOptionalParams,
|
|
17
18
|
SqlVirtualMachinesGetOptionalParams,
|
|
18
19
|
SqlVirtualMachinesGetResponse,
|
|
@@ -21,8 +22,7 @@ import {
|
|
|
21
22
|
SqlVirtualMachinesDeleteOptionalParams,
|
|
22
23
|
SqlVirtualMachineUpdate,
|
|
23
24
|
SqlVirtualMachinesUpdateOptionalParams,
|
|
24
|
-
SqlVirtualMachinesUpdateResponse
|
|
25
|
-
SqlVirtualMachinesStartAssessmentOptionalParams
|
|
25
|
+
SqlVirtualMachinesUpdateResponse
|
|
26
26
|
} from "../models";
|
|
27
27
|
|
|
28
28
|
/// <reference lib="esnext.asynciterable" />
|
|
@@ -57,6 +57,30 @@ export interface SqlVirtualMachines {
|
|
|
57
57
|
resourceGroupName: string,
|
|
58
58
|
options?: SqlVirtualMachinesListByResourceGroupOptionalParams
|
|
59
59
|
): PagedAsyncIterableIterator<SqlVirtualMachine>;
|
|
60
|
+
/**
|
|
61
|
+
* Starts Assessment on SQL virtual machine.
|
|
62
|
+
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
63
|
+
* value from the Azure Resource Manager API or the portal.
|
|
64
|
+
* @param sqlVirtualMachineName Name of the SQL virtual machine.
|
|
65
|
+
* @param options The options parameters.
|
|
66
|
+
*/
|
|
67
|
+
beginStartAssessment(
|
|
68
|
+
resourceGroupName: string,
|
|
69
|
+
sqlVirtualMachineName: string,
|
|
70
|
+
options?: SqlVirtualMachinesStartAssessmentOptionalParams
|
|
71
|
+
): Promise<PollerLike<PollOperationState<void>, void>>;
|
|
72
|
+
/**
|
|
73
|
+
* Starts Assessment on SQL virtual machine.
|
|
74
|
+
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
75
|
+
* value from the Azure Resource Manager API or the portal.
|
|
76
|
+
* @param sqlVirtualMachineName Name of the SQL virtual machine.
|
|
77
|
+
* @param options The options parameters.
|
|
78
|
+
*/
|
|
79
|
+
beginStartAssessmentAndWait(
|
|
80
|
+
resourceGroupName: string,
|
|
81
|
+
sqlVirtualMachineName: string,
|
|
82
|
+
options?: SqlVirtualMachinesStartAssessmentOptionalParams
|
|
83
|
+
): Promise<void>;
|
|
60
84
|
/**
|
|
61
85
|
* Uninstalls and reinstalls the SQL Iaas Extension.
|
|
62
86
|
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
@@ -183,28 +207,4 @@ export interface SqlVirtualMachines {
|
|
|
183
207
|
parameters: SqlVirtualMachineUpdate,
|
|
184
208
|
options?: SqlVirtualMachinesUpdateOptionalParams
|
|
185
209
|
): Promise<SqlVirtualMachinesUpdateResponse>;
|
|
186
|
-
/**
|
|
187
|
-
* Starts Assessment on SQL virtual machine.
|
|
188
|
-
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
189
|
-
* value from the Azure Resource Manager API or the portal.
|
|
190
|
-
* @param sqlVirtualMachineName Name of the SQL virtual machine.
|
|
191
|
-
* @param options The options parameters.
|
|
192
|
-
*/
|
|
193
|
-
beginStartAssessment(
|
|
194
|
-
resourceGroupName: string,
|
|
195
|
-
sqlVirtualMachineName: string,
|
|
196
|
-
options?: SqlVirtualMachinesStartAssessmentOptionalParams
|
|
197
|
-
): Promise<PollerLike<PollOperationState<void>, void>>;
|
|
198
|
-
/**
|
|
199
|
-
* Starts Assessment on SQL virtual machine.
|
|
200
|
-
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this
|
|
201
|
-
* value from the Azure Resource Manager API or the portal.
|
|
202
|
-
* @param sqlVirtualMachineName Name of the SQL virtual machine.
|
|
203
|
-
* @param options The options parameters.
|
|
204
|
-
*/
|
|
205
|
-
beginStartAssessmentAndWait(
|
|
206
|
-
resourceGroupName: string,
|
|
207
|
-
sqlVirtualMachineName: string,
|
|
208
|
-
options?: SqlVirtualMachinesStartAssessmentOptionalParams
|
|
209
|
-
): Promise<void>;
|
|
210
210
|
}
|
|
@@ -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
|
AvailabilityGroupListenersImpl,
|
|
@@ -55,7 +60,7 @@ export class SqlVirtualMachineManagementClient extends coreClient.ServiceClient
|
|
|
55
60
|
credential: credentials
|
|
56
61
|
};
|
|
57
62
|
|
|
58
|
-
const packageDetails = `azsdk-js-arm-sqlvirtualmachine/5.0.0-beta.
|
|
63
|
+
const packageDetails = `azsdk-js-arm-sqlvirtualmachine/5.0.0-beta.6`;
|
|
59
64
|
const userAgentPrefix =
|
|
60
65
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
61
66
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
@@ -75,38 +80,74 @@ export class SqlVirtualMachineManagementClient extends coreClient.ServiceClient
|
|
|
75
80
|
};
|
|
76
81
|
super(optionsWithDefaults);
|
|
77
82
|
|
|
83
|
+
let bearerTokenAuthenticationPolicyFound: boolean = false;
|
|
78
84
|
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
79
85
|
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
|
80
|
-
|
|
86
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
|
81
87
|
(pipelinePolicy) =>
|
|
82
88
|
pipelinePolicy.name ===
|
|
83
89
|
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
84
90
|
);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
}
|
|
92
|
+
if (
|
|
93
|
+
!options ||
|
|
94
|
+
!options.pipeline ||
|
|
95
|
+
options.pipeline.getOrderedPolicies().length == 0 ||
|
|
96
|
+
!bearerTokenAuthenticationPolicyFound
|
|
97
|
+
) {
|
|
98
|
+
this.pipeline.removePolicy({
|
|
99
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
100
|
+
});
|
|
101
|
+
this.pipeline.addPolicy(
|
|
102
|
+
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
103
|
+
credential: credentials,
|
|
104
|
+
scopes: `${optionsWithDefaults.credentialScopes}`,
|
|
105
|
+
challengeCallbacks: {
|
|
106
|
+
authorizeRequestOnChallenge:
|
|
107
|
+
coreClient.authorizeRequestOnClaimChallenge
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
);
|
|
99
111
|
}
|
|
100
112
|
// Parameter assignments
|
|
101
113
|
this.subscriptionId = subscriptionId;
|
|
102
114
|
|
|
103
115
|
// Assigning values to Constant parameters
|
|
104
116
|
this.$host = options.$host || "https://management.azure.com";
|
|
105
|
-
this.apiVersion = options.apiVersion || "
|
|
117
|
+
this.apiVersion = options.apiVersion || "2022-07-01-preview";
|
|
106
118
|
this.availabilityGroupListeners = new AvailabilityGroupListenersImpl(this);
|
|
107
119
|
this.operations = new OperationsImpl(this);
|
|
108
120
|
this.sqlVirtualMachineGroups = new SqlVirtualMachineGroupsImpl(this);
|
|
109
121
|
this.sqlVirtualMachines = new SqlVirtualMachinesImpl(this);
|
|
122
|
+
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
126
|
+
private addCustomApiVersionPolicy(apiVersion?: string) {
|
|
127
|
+
if (!apiVersion) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const apiVersionPolicy = {
|
|
131
|
+
name: "CustomApiVersionPolicy",
|
|
132
|
+
async sendRequest(
|
|
133
|
+
request: PipelineRequest,
|
|
134
|
+
next: SendRequest
|
|
135
|
+
): Promise<PipelineResponse> {
|
|
136
|
+
const param = request.url.split("?");
|
|
137
|
+
if (param.length > 1) {
|
|
138
|
+
const newParams = param[1].split("&").map((item) => {
|
|
139
|
+
if (item.indexOf("api-version") > -1) {
|
|
140
|
+
return "api-version=" + apiVersion;
|
|
141
|
+
} else {
|
|
142
|
+
return item;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
request.url = param[0] + "?" + newParams.join("&");
|
|
146
|
+
}
|
|
147
|
+
return next(request);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
|
110
151
|
}
|
|
111
152
|
|
|
112
153
|
availabilityGroupListeners: AvailabilityGroupListeners;
|