@azure/arm-azurestackhci 3.0.3-alpha.20221026.1 → 3.1.0-alpha.20221117.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 +10 -10
- package/dist/index.js +233 -47
- 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/azureStackHCIClient.d.ts +2 -0
- package/dist-esm/src/azureStackHCIClient.d.ts.map +1 -1
- package/dist-esm/src/azureStackHCIClient.js +49 -18
- package/dist-esm/src/azureStackHCIClient.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 +89 -9
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +79 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/operations/arcSettings.d.ts.map +1 -1
- package/dist-esm/src/operations/arcSettings.js +19 -7
- package/dist-esm/src/operations/arcSettings.js.map +1 -1
- package/dist-esm/src/operations/clusters.d.ts.map +1 -1
- package/dist-esm/src/operations/clusters.js +37 -14
- package/dist-esm/src/operations/clusters.js.map +1 -1
- package/dist-esm/src/operations/extensions.d.ts.map +1 -1
- package/dist-esm/src/operations/extensions.js +19 -7
- package/dist-esm/src/operations/extensions.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/test/sampleTest.js +11 -13
- package/dist-esm/test/sampleTest.js.map +1 -1
- package/package.json +12 -8
- package/review/arm-azurestackhci.api.md +46 -121
- package/src/azureStackHCIClient.ts +60 -20
- package/src/index.ts +1 -0
- package/src/models/index.ts +88 -9
- package/src/operations/arcSettings.ts +26 -12
- package/src/operations/clusters.ts +45 -16
- package/src/operations/extensions.ts +27 -13
- package/src/pagingHelper.ts +39 -0
- package/types/arm-azurestackhci.d.ts +100 -9
- package/types/tsdoc-metadata.json +1 -1
|
@@ -31,23 +31,23 @@ export interface ArcIdentityResponse {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// @public
|
|
34
|
-
export
|
|
35
|
-
readonly
|
|
36
|
-
arcInstanceResourceGroup?: string;
|
|
34
|
+
export interface ArcSetting extends ProxyResource {
|
|
35
|
+
readonly aggregateState?: ArcSettingAggregateState;
|
|
37
36
|
arcApplicationClientId?: string;
|
|
37
|
+
arcApplicationObjectId?: string;
|
|
38
38
|
arcApplicationTenantId?: string;
|
|
39
|
+
arcInstanceResourceGroup?: string;
|
|
39
40
|
arcServicePrincipalObjectId?: string;
|
|
40
|
-
arcApplicationObjectId?: string;
|
|
41
|
-
readonly aggregateState?: ArcSettingAggregateState;
|
|
42
|
-
readonly perNodeDetails?: PerNodeState[];
|
|
43
41
|
connectivityProperties?: Record<string, unknown>;
|
|
42
|
+
createdAt?: Date;
|
|
44
43
|
createdBy?: string;
|
|
45
44
|
createdByType?: CreatedByType;
|
|
46
|
-
|
|
45
|
+
lastModifiedAt?: Date;
|
|
47
46
|
lastModifiedBy?: string;
|
|
48
47
|
lastModifiedByType?: CreatedByType;
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
readonly perNodeDetails?: PerNodeState[];
|
|
49
|
+
readonly provisioningState?: ProvisioningState;
|
|
50
|
+
}
|
|
51
51
|
|
|
52
52
|
// @public
|
|
53
53
|
export type ArcSettingAggregateState = string;
|
|
@@ -163,30 +163,30 @@ export interface AzureStackHCIClientOptionalParams extends coreClient.ServiceCli
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
// @public
|
|
166
|
-
export
|
|
167
|
-
readonly provisioningState?: ProvisioningState;
|
|
168
|
-
readonly status?: Status;
|
|
169
|
-
readonly cloudId?: string;
|
|
170
|
-
cloudManagementEndpoint?: string;
|
|
171
|
-
aadClientId?: string;
|
|
172
|
-
aadTenantId?: string;
|
|
166
|
+
export interface Cluster extends TrackedResource {
|
|
173
167
|
aadApplicationObjectId?: string;
|
|
168
|
+
aadClientId?: string;
|
|
174
169
|
aadServicePrincipalObjectId?: string;
|
|
175
|
-
|
|
176
|
-
readonly reportedProperties?: ClusterReportedProperties;
|
|
177
|
-
readonly trialDaysRemaining?: number;
|
|
170
|
+
aadTenantId?: string;
|
|
178
171
|
readonly billingModel?: string;
|
|
179
|
-
readonly
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
readonly serviceEndpoint?: string;
|
|
172
|
+
readonly cloudId?: string;
|
|
173
|
+
cloudManagementEndpoint?: string;
|
|
174
|
+
createdAt?: Date;
|
|
183
175
|
createdBy?: string;
|
|
184
176
|
createdByType?: CreatedByType;
|
|
185
|
-
|
|
177
|
+
desiredProperties?: ClusterDesiredProperties;
|
|
178
|
+
readonly lastBillingTimestamp?: Date;
|
|
179
|
+
lastModifiedAt?: Date;
|
|
186
180
|
lastModifiedBy?: string;
|
|
187
181
|
lastModifiedByType?: CreatedByType;
|
|
188
|
-
|
|
189
|
-
|
|
182
|
+
readonly lastSyncTimestamp?: Date;
|
|
183
|
+
readonly provisioningState?: ProvisioningState;
|
|
184
|
+
readonly registrationTimestamp?: Date;
|
|
185
|
+
readonly reportedProperties?: ClusterReportedProperties;
|
|
186
|
+
readonly serviceEndpoint?: string;
|
|
187
|
+
readonly status?: Status;
|
|
188
|
+
readonly trialDaysRemaining?: number;
|
|
189
|
+
}
|
|
190
190
|
|
|
191
191
|
// @public
|
|
192
192
|
export interface ClusterDesiredProperties {
|
|
@@ -360,24 +360,24 @@ export interface ErrorResponse {
|
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
// @public
|
|
363
|
-
export
|
|
364
|
-
readonly provisioningState?: ProvisioningState;
|
|
363
|
+
export interface Extension extends ProxyResource {
|
|
365
364
|
readonly aggregateState?: ExtensionAggregateState;
|
|
366
|
-
readonly perNodeExtensionDetails?: PerNodeExtensionState[];
|
|
367
|
-
forceUpdateTag?: string;
|
|
368
|
-
publisher?: string;
|
|
369
|
-
typePropertiesExtensionParametersType?: string;
|
|
370
|
-
typeHandlerVersion?: string;
|
|
371
365
|
autoUpgradeMinorVersion?: boolean;
|
|
372
|
-
|
|
373
|
-
protectedSettings?: Record<string, unknown>;
|
|
366
|
+
createdAt?: Date;
|
|
374
367
|
createdBy?: string;
|
|
375
368
|
createdByType?: CreatedByType;
|
|
376
|
-
|
|
369
|
+
forceUpdateTag?: string;
|
|
370
|
+
lastModifiedAt?: Date;
|
|
377
371
|
lastModifiedBy?: string;
|
|
378
372
|
lastModifiedByType?: CreatedByType;
|
|
379
|
-
|
|
380
|
-
|
|
373
|
+
readonly perNodeExtensionDetails?: PerNodeExtensionState[];
|
|
374
|
+
protectedSettings?: Record<string, unknown>;
|
|
375
|
+
readonly provisioningState?: ProvisioningState;
|
|
376
|
+
publisher?: string;
|
|
377
|
+
settings?: Record<string, unknown>;
|
|
378
|
+
typeHandlerVersion?: string;
|
|
379
|
+
typePropertiesExtensionParametersType?: string;
|
|
380
|
+
}
|
|
381
381
|
|
|
382
382
|
// @public
|
|
383
383
|
export type ExtensionAggregateState = string;
|
|
@@ -445,212 +445,136 @@ export interface ExtensionsUpdateOptionalParams extends coreClient.OperationOpti
|
|
|
445
445
|
// @public
|
|
446
446
|
export type ExtensionsUpdateResponse = Extension;
|
|
447
447
|
|
|
448
|
+
// @public
|
|
449
|
+
export function getContinuationToken(page: unknown): string | undefined;
|
|
450
|
+
|
|
448
451
|
// @public
|
|
449
452
|
export type ImdsAttestation = string;
|
|
450
453
|
|
|
451
454
|
// @public
|
|
452
455
|
export enum KnownActionType {
|
|
453
|
-
// (undocumented)
|
|
454
456
|
Internal = "Internal"
|
|
455
457
|
}
|
|
456
458
|
|
|
457
459
|
// @public
|
|
458
460
|
export enum KnownArcSettingAggregateState {
|
|
459
|
-
// (undocumented)
|
|
460
461
|
Canceled = "Canceled",
|
|
461
|
-
// (undocumented)
|
|
462
462
|
Connected = "Connected",
|
|
463
|
-
// (undocumented)
|
|
464
463
|
Creating = "Creating",
|
|
465
|
-
// (undocumented)
|
|
466
464
|
Deleted = "Deleted",
|
|
467
|
-
// (undocumented)
|
|
468
465
|
Deleting = "Deleting",
|
|
469
|
-
// (undocumented)
|
|
470
466
|
Disconnected = "Disconnected",
|
|
471
|
-
// (undocumented)
|
|
472
467
|
Error = "Error",
|
|
473
|
-
// (undocumented)
|
|
474
468
|
Failed = "Failed",
|
|
475
|
-
// (undocumented)
|
|
476
469
|
InProgress = "InProgress",
|
|
477
|
-
// (undocumented)
|
|
478
470
|
Moving = "Moving",
|
|
479
|
-
// (undocumented)
|
|
480
471
|
NotSpecified = "NotSpecified",
|
|
481
|
-
// (undocumented)
|
|
482
472
|
PartiallyConnected = "PartiallyConnected",
|
|
483
|
-
// (undocumented)
|
|
484
473
|
PartiallySucceeded = "PartiallySucceeded",
|
|
485
|
-
// (undocumented)
|
|
486
474
|
Succeeded = "Succeeded",
|
|
487
|
-
// (undocumented)
|
|
488
475
|
Updating = "Updating"
|
|
489
476
|
}
|
|
490
477
|
|
|
491
478
|
// @public
|
|
492
479
|
export enum KnownCreatedByType {
|
|
493
|
-
// (undocumented)
|
|
494
480
|
Application = "Application",
|
|
495
|
-
// (undocumented)
|
|
496
481
|
Key = "Key",
|
|
497
|
-
// (undocumented)
|
|
498
482
|
ManagedIdentity = "ManagedIdentity",
|
|
499
|
-
// (undocumented)
|
|
500
483
|
User = "User"
|
|
501
484
|
}
|
|
502
485
|
|
|
503
486
|
// @public
|
|
504
487
|
export enum KnownDiagnosticLevel {
|
|
505
|
-
// (undocumented)
|
|
506
488
|
Basic = "Basic",
|
|
507
|
-
// (undocumented)
|
|
508
489
|
Enhanced = "Enhanced",
|
|
509
|
-
// (undocumented)
|
|
510
490
|
Off = "Off"
|
|
511
491
|
}
|
|
512
492
|
|
|
513
493
|
// @public
|
|
514
494
|
export enum KnownExtensionAggregateState {
|
|
515
|
-
// (undocumented)
|
|
516
495
|
Canceled = "Canceled",
|
|
517
|
-
// (undocumented)
|
|
518
496
|
Connected = "Connected",
|
|
519
|
-
// (undocumented)
|
|
520
497
|
Creating = "Creating",
|
|
521
|
-
// (undocumented)
|
|
522
498
|
Deleted = "Deleted",
|
|
523
|
-
// (undocumented)
|
|
524
499
|
Deleting = "Deleting",
|
|
525
|
-
// (undocumented)
|
|
526
500
|
Disconnected = "Disconnected",
|
|
527
|
-
// (undocumented)
|
|
528
501
|
Error = "Error",
|
|
529
|
-
// (undocumented)
|
|
530
502
|
Failed = "Failed",
|
|
531
|
-
// (undocumented)
|
|
532
503
|
InProgress = "InProgress",
|
|
533
|
-
// (undocumented)
|
|
534
504
|
Moving = "Moving",
|
|
535
|
-
// (undocumented)
|
|
536
505
|
NotSpecified = "NotSpecified",
|
|
537
|
-
// (undocumented)
|
|
538
506
|
PartiallyConnected = "PartiallyConnected",
|
|
539
|
-
// (undocumented)
|
|
540
507
|
PartiallySucceeded = "PartiallySucceeded",
|
|
541
|
-
// (undocumented)
|
|
542
508
|
Succeeded = "Succeeded",
|
|
543
|
-
// (undocumented)
|
|
544
509
|
Updating = "Updating"
|
|
545
510
|
}
|
|
546
511
|
|
|
547
512
|
// @public
|
|
548
513
|
export enum KnownImdsAttestation {
|
|
549
|
-
// (undocumented)
|
|
550
514
|
Disabled = "Disabled",
|
|
551
|
-
// (undocumented)
|
|
552
515
|
Enabled = "Enabled"
|
|
553
516
|
}
|
|
554
517
|
|
|
555
518
|
// @public
|
|
556
519
|
export enum KnownNodeArcState {
|
|
557
|
-
// (undocumented)
|
|
558
520
|
Canceled = "Canceled",
|
|
559
|
-
// (undocumented)
|
|
560
521
|
Connected = "Connected",
|
|
561
|
-
// (undocumented)
|
|
562
522
|
Creating = "Creating",
|
|
563
|
-
// (undocumented)
|
|
564
523
|
Deleted = "Deleted",
|
|
565
|
-
// (undocumented)
|
|
566
524
|
Deleting = "Deleting",
|
|
567
|
-
// (undocumented)
|
|
568
525
|
Disconnected = "Disconnected",
|
|
569
|
-
// (undocumented)
|
|
570
526
|
Error = "Error",
|
|
571
|
-
// (undocumented)
|
|
572
527
|
Failed = "Failed",
|
|
573
|
-
// (undocumented)
|
|
574
528
|
Moving = "Moving",
|
|
575
|
-
// (undocumented)
|
|
576
529
|
NotSpecified = "NotSpecified",
|
|
577
|
-
// (undocumented)
|
|
578
530
|
Succeeded = "Succeeded",
|
|
579
|
-
// (undocumented)
|
|
580
531
|
Updating = "Updating"
|
|
581
532
|
}
|
|
582
533
|
|
|
583
534
|
// @public
|
|
584
535
|
export enum KnownNodeExtensionState {
|
|
585
|
-
// (undocumented)
|
|
586
536
|
Canceled = "Canceled",
|
|
587
|
-
// (undocumented)
|
|
588
537
|
Connected = "Connected",
|
|
589
|
-
// (undocumented)
|
|
590
538
|
Creating = "Creating",
|
|
591
|
-
// (undocumented)
|
|
592
539
|
Deleted = "Deleted",
|
|
593
|
-
// (undocumented)
|
|
594
540
|
Deleting = "Deleting",
|
|
595
|
-
// (undocumented)
|
|
596
541
|
Disconnected = "Disconnected",
|
|
597
|
-
// (undocumented)
|
|
598
542
|
Error = "Error",
|
|
599
|
-
// (undocumented)
|
|
600
543
|
Failed = "Failed",
|
|
601
|
-
// (undocumented)
|
|
602
544
|
Moving = "Moving",
|
|
603
|
-
// (undocumented)
|
|
604
545
|
NotSpecified = "NotSpecified",
|
|
605
|
-
// (undocumented)
|
|
606
546
|
Succeeded = "Succeeded",
|
|
607
|
-
// (undocumented)
|
|
608
547
|
Updating = "Updating"
|
|
609
548
|
}
|
|
610
549
|
|
|
611
550
|
// @public
|
|
612
551
|
export enum KnownOrigin {
|
|
613
|
-
// (undocumented)
|
|
614
552
|
System = "system",
|
|
615
|
-
// (undocumented)
|
|
616
553
|
User = "user",
|
|
617
|
-
// (undocumented)
|
|
618
554
|
UserSystem = "user,system"
|
|
619
555
|
}
|
|
620
556
|
|
|
621
557
|
// @public
|
|
622
558
|
export enum KnownProvisioningState {
|
|
623
|
-
// (undocumented)
|
|
624
559
|
Accepted = "Accepted",
|
|
625
|
-
// (undocumented)
|
|
626
560
|
Canceled = "Canceled",
|
|
627
|
-
// (undocumented)
|
|
628
561
|
Failed = "Failed",
|
|
629
|
-
// (undocumented)
|
|
630
562
|
Provisioning = "Provisioning",
|
|
631
|
-
// (undocumented)
|
|
632
563
|
Succeeded = "Succeeded"
|
|
633
564
|
}
|
|
634
565
|
|
|
635
566
|
// @public
|
|
636
567
|
export enum KnownStatus {
|
|
637
|
-
// (undocumented)
|
|
638
568
|
ConnectedRecently = "ConnectedRecently",
|
|
639
|
-
// (undocumented)
|
|
640
569
|
Disconnected = "Disconnected",
|
|
641
|
-
// (undocumented)
|
|
642
570
|
Error = "Error",
|
|
643
|
-
// (undocumented)
|
|
644
571
|
NotConnectedRecently = "NotConnectedRecently",
|
|
645
|
-
// (undocumented)
|
|
646
572
|
NotYetRegistered = "NotYetRegistered"
|
|
647
573
|
}
|
|
648
574
|
|
|
649
575
|
// @public
|
|
650
576
|
export enum KnownWindowsServerSubscription {
|
|
651
|
-
// (undocumented)
|
|
652
577
|
Disabled = "Disabled",
|
|
653
|
-
// (undocumented)
|
|
654
578
|
Enabled = "Enabled"
|
|
655
579
|
}
|
|
656
580
|
|
|
@@ -728,7 +652,8 @@ export interface PerNodeState {
|
|
|
728
652
|
export type ProvisioningState = string;
|
|
729
653
|
|
|
730
654
|
// @public
|
|
731
|
-
export
|
|
655
|
+
export interface ProxyResource extends Resource {
|
|
656
|
+
}
|
|
732
657
|
|
|
733
658
|
// @public (undocumented)
|
|
734
659
|
export interface RawCertificateData {
|
|
@@ -747,12 +672,12 @@ export interface Resource {
|
|
|
747
672
|
export type Status = string;
|
|
748
673
|
|
|
749
674
|
// @public
|
|
750
|
-
export
|
|
675
|
+
export interface TrackedResource extends Resource {
|
|
676
|
+
location: string;
|
|
751
677
|
tags?: {
|
|
752
678
|
[propertyName: string]: string;
|
|
753
679
|
};
|
|
754
|
-
|
|
755
|
-
};
|
|
680
|
+
}
|
|
756
681
|
|
|
757
682
|
// @public (undocumented)
|
|
758
683
|
export interface UploadCertificateRequest {
|
|
@@ -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
|
ArcSettingsImpl,
|
|
@@ -55,47 +60,53 @@ export class AzureStackHCIClient extends coreClient.ServiceClient {
|
|
|
55
60
|
credential: credentials
|
|
56
61
|
};
|
|
57
62
|
|
|
58
|
-
const packageDetails = `azsdk-js-arm-azurestackhci/3.0
|
|
63
|
+
const packageDetails = `azsdk-js-arm-azurestackhci/3.1.0`;
|
|
59
64
|
const userAgentPrefix =
|
|
60
65
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
61
66
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
62
67
|
: `${packageDetails}`;
|
|
63
68
|
|
|
64
|
-
if (!options.credentialScopes) {
|
|
65
|
-
options.credentialScopes = ["https://management.azure.com/.default"];
|
|
66
|
-
}
|
|
67
69
|
const optionsWithDefaults = {
|
|
68
70
|
...defaults,
|
|
69
71
|
...options,
|
|
70
72
|
userAgentOptions: {
|
|
71
73
|
userAgentPrefix
|
|
72
74
|
},
|
|
73
|
-
|
|
75
|
+
endpoint:
|
|
74
76
|
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
|
75
77
|
};
|
|
76
78
|
super(optionsWithDefaults);
|
|
77
79
|
|
|
80
|
+
let bearerTokenAuthenticationPolicyFound: boolean = false;
|
|
78
81
|
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
79
82
|
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
|
80
|
-
|
|
83
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
|
81
84
|
(pipelinePolicy) =>
|
|
82
85
|
pipelinePolicy.name ===
|
|
83
86
|
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
84
87
|
);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
}
|
|
89
|
+
if (
|
|
90
|
+
!options ||
|
|
91
|
+
!options.pipeline ||
|
|
92
|
+
options.pipeline.getOrderedPolicies().length == 0 ||
|
|
93
|
+
!bearerTokenAuthenticationPolicyFound
|
|
94
|
+
) {
|
|
95
|
+
this.pipeline.removePolicy({
|
|
96
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
97
|
+
});
|
|
98
|
+
this.pipeline.addPolicy(
|
|
99
|
+
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
100
|
+
credential: credentials,
|
|
101
|
+
scopes:
|
|
102
|
+
optionsWithDefaults.credentialScopes ??
|
|
103
|
+
`${optionsWithDefaults.endpoint}/.default`,
|
|
104
|
+
challengeCallbacks: {
|
|
105
|
+
authorizeRequestOnChallenge:
|
|
106
|
+
coreClient.authorizeRequestOnClaimChallenge
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
);
|
|
99
110
|
}
|
|
100
111
|
// Parameter assignments
|
|
101
112
|
this.subscriptionId = subscriptionId;
|
|
@@ -107,6 +118,35 @@ export class AzureStackHCIClient extends coreClient.ServiceClient {
|
|
|
107
118
|
this.clusters = new ClustersImpl(this);
|
|
108
119
|
this.extensions = new ExtensionsImpl(this);
|
|
109
120
|
this.operations = new OperationsImpl(this);
|
|
121
|
+
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
125
|
+
private addCustomApiVersionPolicy(apiVersion?: string) {
|
|
126
|
+
if (!apiVersion) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const apiVersionPolicy = {
|
|
130
|
+
name: "CustomApiVersionPolicy",
|
|
131
|
+
async sendRequest(
|
|
132
|
+
request: PipelineRequest,
|
|
133
|
+
next: SendRequest
|
|
134
|
+
): Promise<PipelineResponse> {
|
|
135
|
+
const param = request.url.split("?");
|
|
136
|
+
if (param.length > 1) {
|
|
137
|
+
const newParams = param[1].split("&").map((item) => {
|
|
138
|
+
if (item.indexOf("api-version") > -1) {
|
|
139
|
+
return "api-version=" + apiVersion;
|
|
140
|
+
} else {
|
|
141
|
+
return item;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
request.url = param[0] + "?" + newParams.join("&");
|
|
145
|
+
}
|
|
146
|
+
return next(request);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
|
110
150
|
}
|
|
111
151
|
|
|
112
152
|
arcSettings: ArcSettings;
|
package/src/index.ts
CHANGED