@azure/arm-batch 7.1.1 → 7.2.0-alpha.20220720.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/index.js +302 -16
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist-esm/samples-dev/applicationCreateSample.js +1 -1
  7. package/dist-esm/samples-dev/applicationDeleteSample.js +1 -1
  8. package/dist-esm/samples-dev/applicationGetSample.js +1 -1
  9. package/dist-esm/samples-dev/applicationListSample.js +1 -1
  10. package/dist-esm/samples-dev/applicationPackageActivateSample.js +1 -1
  11. package/dist-esm/samples-dev/applicationPackageCreateSample.js +1 -1
  12. package/dist-esm/samples-dev/applicationPackageDeleteSample.js +1 -1
  13. package/dist-esm/samples-dev/applicationPackageGetSample.js +1 -1
  14. package/dist-esm/samples-dev/applicationPackageListSample.js +1 -1
  15. package/dist-esm/samples-dev/applicationUpdateSample.js +1 -1
  16. package/dist-esm/samples-dev/batchAccountCreateSample.js +5 -5
  17. package/dist-esm/samples-dev/batchAccountDeleteSample.js +1 -1
  18. package/dist-esm/samples-dev/batchAccountGetDetectorSample.js +1 -1
  19. package/dist-esm/samples-dev/batchAccountGetKeysSample.js +1 -1
  20. package/dist-esm/samples-dev/batchAccountGetSample.js +2 -2
  21. package/dist-esm/samples-dev/batchAccountListByResourceGroupSample.js +1 -1
  22. package/dist-esm/samples-dev/batchAccountListDetectorsSample.js +1 -1
  23. package/dist-esm/samples-dev/batchAccountListOutboundNetworkDependenciesEndpointsSample.js +3 -3
  24. package/dist-esm/samples-dev/batchAccountListSample.js +1 -1
  25. package/dist-esm/samples-dev/batchAccountRegenerateKeySample.js +1 -1
  26. package/dist-esm/samples-dev/batchAccountSynchronizeAutoStorageKeysSample.js +1 -1
  27. package/dist-esm/samples-dev/batchAccountUpdateSample.js +1 -1
  28. package/dist-esm/samples-dev/certificateCancelDeletionSample.js +1 -1
  29. package/dist-esm/samples-dev/certificateCreateSample.js +3 -3
  30. package/dist-esm/samples-dev/certificateDeleteSample.js +1 -1
  31. package/dist-esm/samples-dev/certificateGetSample.js +2 -2
  32. package/dist-esm/samples-dev/certificateListByBatchAccountSample.js +2 -2
  33. package/dist-esm/samples-dev/certificateUpdateSample.js +1 -1
  34. package/dist-esm/samples-dev/locationCheckNameAvailabilitySample.js +2 -2
  35. package/dist-esm/samples-dev/locationGetQuotasSample.js +1 -1
  36. package/dist-esm/samples-dev/locationListSupportedCloudServiceSkusSample.js +1 -1
  37. package/dist-esm/samples-dev/locationListSupportedVirtualMachineSkusSample.js +1 -1
  38. package/dist-esm/samples-dev/operationsListSample.js +1 -1
  39. package/dist-esm/samples-dev/poolCreateSample.js +9 -9
  40. package/dist-esm/samples-dev/poolDeleteSample.js +1 -1
  41. package/dist-esm/samples-dev/poolDisableAutoScaleSample.js +1 -1
  42. package/dist-esm/samples-dev/poolGetSample.js +2 -2
  43. package/dist-esm/samples-dev/poolListByBatchAccountSample.js +2 -2
  44. package/dist-esm/samples-dev/poolStopResizeSample.js +1 -1
  45. package/dist-esm/samples-dev/poolUpdateSample.js +4 -4
  46. package/dist-esm/samples-dev/privateEndpointConnectionDeleteSample.d.ts +2 -0
  47. package/dist-esm/samples-dev/privateEndpointConnectionDeleteSample.d.ts.map +1 -0
  48. package/dist-esm/samples-dev/privateEndpointConnectionDeleteSample.js +32 -0
  49. package/dist-esm/samples-dev/privateEndpointConnectionDeleteSample.js.map +1 -0
  50. package/dist-esm/samples-dev/privateEndpointConnectionGetSample.js +1 -1
  51. package/dist-esm/samples-dev/privateEndpointConnectionListByBatchAccountSample.js +1 -1
  52. package/dist-esm/samples-dev/privateEndpointConnectionUpdateSample.js +1 -1
  53. package/dist-esm/samples-dev/privateLinkResourceGetSample.js +2 -2
  54. package/dist-esm/samples-dev/privateLinkResourceGetSample.js.map +1 -1
  55. package/dist-esm/samples-dev/privateLinkResourceListByBatchAccountSample.js +1 -1
  56. package/dist-esm/src/batchManagementClient.d.ts +2 -0
  57. package/dist-esm/src/batchManagementClient.d.ts.map +1 -1
  58. package/dist-esm/src/batchManagementClient.js +48 -2
  59. package/dist-esm/src/batchManagementClient.js.map +1 -1
  60. package/dist-esm/src/models/index.d.ts +92 -35
  61. package/dist-esm/src/models/index.d.ts.map +1 -1
  62. package/dist-esm/src/models/mappers.d.ts +4 -0
  63. package/dist-esm/src/models/mappers.d.ts.map +1 -1
  64. package/dist-esm/src/models/mappers.js +146 -2
  65. package/dist-esm/src/models/mappers.js.map +1 -1
  66. package/dist-esm/src/models/parameters.js +1 -1
  67. package/dist-esm/src/operations/batchAccountOperations.d.ts +2 -2
  68. package/dist-esm/src/operations/batchAccountOperations.js +2 -2
  69. package/dist-esm/src/operations/privateEndpointConnectionOperations.d.ts +19 -1
  70. package/dist-esm/src/operations/privateEndpointConnectionOperations.d.ts.map +1 -1
  71. package/dist-esm/src/operations/privateEndpointConnectionOperations.js +92 -0
  72. package/dist-esm/src/operations/privateEndpointConnectionOperations.js.map +1 -1
  73. package/dist-esm/src/operationsInterfaces/batchAccountOperations.d.ts +1 -1
  74. package/dist-esm/src/operationsInterfaces/privateEndpointConnectionOperations.d.ts +19 -1
  75. package/dist-esm/src/operationsInterfaces/privateEndpointConnectionOperations.d.ts.map +1 -1
  76. package/dist-esm/test/batch_examples.d.ts.map +1 -1
  77. package/dist-esm/test/batch_examples.js +20 -22
  78. package/dist-esm/test/batch_examples.js.map +1 -1
  79. package/package.json +11 -8
  80. package/review/arm-batch.api.md +113 -69
  81. package/src/batchManagementClient.ts +60 -2
  82. package/src/models/index.ts +104 -36
  83. package/src/models/mappers.ts +153 -2
  84. package/src/models/parameters.ts +1 -1
  85. package/src/operations/batchAccountOperations.ts +2 -2
  86. package/src/operations/privateEndpointConnectionOperations.ts +134 -0
  87. package/src/operationsInterfaces/batchAccountOperations.ts +1 -1
  88. package/src/operationsInterfaces/privateEndpointConnectionOperations.ts +36 -1
  89. package/types/arm-batch.d.ts +120 -36
  90. package/types/tsdoc-metadata.json +1 -1
@@ -22,11 +22,11 @@ export interface ActivateApplicationPackageParameters {
22
22
  export type AllocationState = "Steady" | "Resizing" | "Stopping";
23
23
 
24
24
  // @public
25
- export type Application = ProxyResource & {
26
- displayName?: string;
25
+ export interface Application extends ProxyResource {
27
26
  allowUpdates?: boolean;
28
27
  defaultVersion?: string;
29
- };
28
+ displayName?: string;
29
+ }
30
30
 
31
31
  // @public
32
32
  export interface ApplicationCreateOptionalParams extends coreClient.OperationOptions {
@@ -73,13 +73,13 @@ export interface ApplicationOperations {
73
73
  }
74
74
 
75
75
  // @public
76
- export type ApplicationPackage = ProxyResource & {
77
- readonly state?: PackageState;
76
+ export interface ApplicationPackage extends ProxyResource {
78
77
  readonly format?: string;
78
+ readonly lastActivationTime?: Date;
79
+ readonly state?: PackageState;
79
80
  readonly storageUrl?: string;
80
81
  readonly storageUrlExpiry?: Date;
81
- readonly lastActivationTime?: Date;
82
- };
82
+ }
83
83
 
84
84
  // @public
85
85
  export interface ApplicationPackageActivateOptionalParams extends coreClient.OperationOptions {
@@ -179,9 +179,9 @@ export interface AutoStorageBaseProperties {
179
179
  }
180
180
 
181
181
  // @public
182
- export type AutoStorageProperties = AutoStorageBaseProperties & {
182
+ export interface AutoStorageProperties extends AutoStorageBaseProperties {
183
183
  lastKeySync: Date;
184
- };
184
+ }
185
185
 
186
186
  // @public
187
187
  export type AutoUserScope = "Task" | "Pool";
@@ -213,24 +213,26 @@ export interface AzureFileShareConfiguration {
213
213
  }
214
214
 
215
215
  // @public
216
- export type BatchAccount = Resource & {
217
- identity?: BatchAccountIdentity;
216
+ export interface BatchAccount extends Resource {
218
217
  readonly accountEndpoint?: string;
219
- readonly provisioningState?: ProvisioningState;
220
- readonly poolAllocationMode?: PoolAllocationMode;
221
- readonly keyVaultReference?: KeyVaultReference;
222
- readonly publicNetworkAccess?: PublicNetworkAccessType;
223
- readonly privateEndpointConnections?: PrivateEndpointConnection[];
218
+ readonly activeJobAndJobScheduleQuota?: number;
219
+ readonly allowedAuthenticationModes?: AuthenticationMode[];
224
220
  readonly autoStorage?: AutoStorageProperties;
225
- readonly encryption?: EncryptionProperties;
226
221
  readonly dedicatedCoreQuota?: number;
227
- readonly lowPriorityCoreQuota?: number;
228
222
  readonly dedicatedCoreQuotaPerVMFamily?: VirtualMachineFamilyCoreQuota[];
229
223
  readonly dedicatedCoreQuotaPerVMFamilyEnforced?: boolean;
224
+ readonly encryption?: EncryptionProperties;
225
+ identity?: BatchAccountIdentity;
226
+ readonly keyVaultReference?: KeyVaultReference;
227
+ readonly lowPriorityCoreQuota?: number;
228
+ networkProfile?: NetworkProfile;
229
+ readonly nodeManagementEndpoint?: string;
230
+ readonly poolAllocationMode?: PoolAllocationMode;
230
231
  readonly poolQuota?: number;
231
- readonly activeJobAndJobScheduleQuota?: number;
232
- readonly allowedAuthenticationModes?: AuthenticationMode[];
233
- };
232
+ readonly privateEndpointConnections?: PrivateEndpointConnection[];
233
+ readonly provisioningState?: ProvisioningState;
234
+ publicNetworkAccess?: PublicNetworkAccessType;
235
+ }
234
236
 
235
237
  // @public
236
238
  export interface BatchAccountCreateHeaders {
@@ -252,6 +254,7 @@ export interface BatchAccountCreateParameters {
252
254
  identity?: BatchAccountIdentity;
253
255
  keyVaultReference?: KeyVaultReference;
254
256
  location: string;
257
+ networkProfile?: NetworkProfile;
255
258
  poolAllocationMode?: PoolAllocationMode;
256
259
  publicNetworkAccess?: PublicNetworkAccessType;
257
260
  tags?: {
@@ -418,6 +421,8 @@ export interface BatchAccountUpdateParameters {
418
421
  autoStorage?: AutoStorageBaseProperties;
419
422
  encryption?: EncryptionProperties;
420
423
  identity?: BatchAccountIdentity;
424
+ networkProfile?: NetworkProfile;
425
+ publicNetworkAccess?: PublicNetworkAccessType;
421
426
  tags?: {
422
427
  [propertyName: string]: string;
423
428
  };
@@ -479,17 +484,17 @@ export interface BatchPoolIdentity {
479
484
  export type CachingType = "None" | "ReadOnly" | "ReadWrite";
480
485
 
481
486
  // @public
482
- export type Certificate = ProxyResource & {
483
- thumbprintAlgorithm?: string;
484
- thumbprint?: string;
487
+ export interface Certificate extends ProxyResource {
488
+ readonly deleteCertificateError?: DeleteCertificateError;
485
489
  format?: CertificateFormat;
486
- readonly provisioningState?: CertificateProvisioningState;
487
- readonly provisioningStateTransitionTime?: Date;
488
490
  readonly previousProvisioningState?: CertificateProvisioningState;
489
491
  readonly previousProvisioningStateTransitionTime?: Date;
492
+ readonly provisioningState?: CertificateProvisioningState;
493
+ readonly provisioningStateTransitionTime?: Date;
490
494
  readonly publicData?: string;
491
- readonly deleteCertificateError?: DeleteCertificateError;
492
- };
495
+ thumbprint?: string;
496
+ thumbprintAlgorithm?: string;
497
+ }
493
498
 
494
499
  // @public
495
500
  export interface CertificateBaseProperties {
@@ -522,19 +527,19 @@ export interface CertificateCreateOptionalParams extends coreClient.OperationOpt
522
527
  }
523
528
 
524
529
  // @public
525
- export type CertificateCreateOrUpdateParameters = ProxyResource & {
526
- thumbprintAlgorithm?: string;
527
- thumbprint?: string;
528
- format?: CertificateFormat;
530
+ export interface CertificateCreateOrUpdateParameters extends ProxyResource {
529
531
  data?: string;
532
+ format?: CertificateFormat;
530
533
  password?: string;
531
- };
534
+ thumbprint?: string;
535
+ thumbprintAlgorithm?: string;
536
+ }
532
537
 
533
538
  // @public
534
- export type CertificateCreateOrUpdateProperties = CertificateBaseProperties & {
539
+ export interface CertificateCreateOrUpdateProperties extends CertificateBaseProperties {
535
540
  data: string;
536
541
  password?: string;
537
- };
542
+ }
538
543
 
539
544
  // @public
540
545
  export type CertificateCreateResponse = CertificateCreateHeaders & Certificate;
@@ -598,14 +603,14 @@ export interface CertificateOperations {
598
603
  }
599
604
 
600
605
  // @public
601
- export type CertificateProperties = CertificateBaseProperties & {
602
- readonly provisioningState?: CertificateProvisioningState;
603
- readonly provisioningStateTransitionTime?: Date;
606
+ export interface CertificateProperties extends CertificateBaseProperties {
607
+ readonly deleteCertificateError?: DeleteCertificateError;
604
608
  readonly previousProvisioningState?: CertificateProvisioningState;
605
609
  readonly previousProvisioningStateTransitionTime?: Date;
610
+ readonly provisioningState?: CertificateProvisioningState;
611
+ readonly provisioningStateTransitionTime?: Date;
606
612
  readonly publicData?: string;
607
- readonly deleteCertificateError?: DeleteCertificateError;
608
- };
613
+ }
609
614
 
610
615
  // @public
611
616
  export type CertificateProvisioningState = "Succeeded" | "Deleting" | "Failed";
@@ -736,9 +741,9 @@ export interface DetectorListResult {
736
741
  }
737
742
 
738
743
  // @public
739
- export type DetectorResponse = ProxyResource & {
744
+ export interface DetectorResponse extends ProxyResource {
740
745
  value?: string;
741
- };
746
+ }
742
747
 
743
748
  // @public
744
749
  export interface DiffDiskSettings {
@@ -765,6 +770,15 @@ export interface EncryptionProperties {
765
770
  keyVaultProperties?: KeyVaultProperties;
766
771
  }
767
772
 
773
+ // @public
774
+ export type EndpointAccessDefaultAction = "Allow" | "Deny";
775
+
776
+ // @public
777
+ export interface EndpointAccessProfile {
778
+ defaultAction: EndpointAccessDefaultAction;
779
+ ipRules?: IPRule[];
780
+ }
781
+
768
782
  // @public
769
783
  export interface EndpointDependency {
770
784
  readonly description?: string;
@@ -819,6 +833,12 @@ export type InterNodeCommunicationState = "Enabled" | "Disabled";
819
833
  // @public
820
834
  export type IPAddressProvisioningType = "BatchManaged" | "UserManaged" | "NoPublicIPAddresses";
821
835
 
836
+ // @public
837
+ export interface IPRule {
838
+ action: "Allow";
839
+ value: string;
840
+ }
841
+
822
842
  // @public
823
843
  export type KeySource = "Microsoft.Batch" | "Microsoft.KeyVault";
824
844
 
@@ -963,6 +983,12 @@ export interface NetworkConfiguration {
963
983
  subnetId?: string;
964
984
  }
965
985
 
986
+ // @public
987
+ export interface NetworkProfile {
988
+ accountAccess?: EndpointAccessProfile;
989
+ nodeManagementAccess?: EndpointAccessProfile;
990
+ }
991
+
966
992
  // @public
967
993
  export interface NetworkSecurityGroupRule {
968
994
  access: NetworkSecurityGroupRuleAccess;
@@ -1052,34 +1078,34 @@ export interface OutboundEnvironmentEndpointCollection {
1052
1078
  export type PackageState = "Pending" | "Active";
1053
1079
 
1054
1080
  // @public
1055
- export type Pool = ProxyResource & {
1056
- identity?: BatchPoolIdentity;
1057
- displayName?: string;
1058
- readonly lastModified?: Date;
1059
- readonly creationTime?: Date;
1060
- readonly provisioningState?: PoolProvisioningState;
1061
- readonly provisioningStateTransitionTime?: Date;
1081
+ export interface Pool extends ProxyResource {
1062
1082
  readonly allocationState?: AllocationState;
1063
1083
  readonly allocationStateTransitionTime?: Date;
1064
- vmSize?: string;
1065
- deploymentConfiguration?: DeploymentConfiguration;
1084
+ applicationLicenses?: string[];
1085
+ applicationPackages?: ApplicationPackageReference[];
1086
+ readonly autoScaleRun?: AutoScaleRun;
1087
+ certificates?: CertificateReference[];
1088
+ readonly creationTime?: Date;
1066
1089
  readonly currentDedicatedNodes?: number;
1067
1090
  readonly currentLowPriorityNodes?: number;
1068
- scaleSettings?: ScaleSettings;
1069
- readonly autoScaleRun?: AutoScaleRun;
1091
+ deploymentConfiguration?: DeploymentConfiguration;
1092
+ displayName?: string;
1093
+ identity?: BatchPoolIdentity;
1070
1094
  interNodeCommunication?: InterNodeCommunicationState;
1095
+ readonly lastModified?: Date;
1096
+ metadata?: MetadataItem[];
1097
+ mountConfiguration?: MountConfiguration[];
1071
1098
  networkConfiguration?: NetworkConfiguration;
1072
- taskSlotsPerNode?: number;
1099
+ readonly provisioningState?: PoolProvisioningState;
1100
+ readonly provisioningStateTransitionTime?: Date;
1101
+ readonly resizeOperationStatus?: ResizeOperationStatus;
1102
+ scaleSettings?: ScaleSettings;
1103
+ startTask?: StartTask;
1073
1104
  taskSchedulingPolicy?: TaskSchedulingPolicy;
1105
+ taskSlotsPerNode?: number;
1074
1106
  userAccounts?: UserAccount[];
1075
- metadata?: MetadataItem[];
1076
- startTask?: StartTask;
1077
- certificates?: CertificateReference[];
1078
- applicationPackages?: ApplicationPackageReference[];
1079
- applicationLicenses?: string[];
1080
- readonly resizeOperationStatus?: ResizeOperationStatus;
1081
- mountConfiguration?: MountConfiguration[];
1082
- };
1107
+ vmSize?: string;
1108
+ }
1083
1109
 
1084
1110
  // @public
1085
1111
  export type PoolAllocationMode = "BatchService" | "UserSubscription";
@@ -1208,11 +1234,27 @@ export interface PrivateEndpoint {
1208
1234
  }
1209
1235
 
1210
1236
  // @public
1211
- export type PrivateEndpointConnection = ProxyResource & {
1212
- readonly provisioningState?: PrivateEndpointConnectionProvisioningState;
1213
- privateEndpoint?: PrivateEndpoint;
1237
+ export interface PrivateEndpointConnection extends ProxyResource {
1238
+ readonly groupIds?: string[];
1239
+ readonly privateEndpoint?: PrivateEndpoint;
1214
1240
  privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState;
1215
- };
1241
+ readonly provisioningState?: PrivateEndpointConnectionProvisioningState;
1242
+ }
1243
+
1244
+ // @public
1245
+ export interface PrivateEndpointConnectionDeleteHeaders {
1246
+ location?: string;
1247
+ retryAfter?: number;
1248
+ }
1249
+
1250
+ // @public
1251
+ export interface PrivateEndpointConnectionDeleteOptionalParams extends coreClient.OperationOptions {
1252
+ resumeFrom?: string;
1253
+ updateIntervalInMs?: number;
1254
+ }
1255
+
1256
+ // @public
1257
+ export type PrivateEndpointConnectionDeleteResponse = PrivateEndpointConnectionDeleteHeaders;
1216
1258
 
1217
1259
  // @public
1218
1260
  export interface PrivateEndpointConnectionGetOptionalParams extends coreClient.OperationOptions {
@@ -1239,6 +1281,8 @@ export type PrivateEndpointConnectionListByBatchAccountResponse = ListPrivateEnd
1239
1281
 
1240
1282
  // @public
1241
1283
  export interface PrivateEndpointConnectionOperations {
1284
+ beginDelete(resourceGroupName: string, accountName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionDeleteOptionalParams): Promise<PollerLike<PollOperationState<PrivateEndpointConnectionDeleteResponse>, PrivateEndpointConnectionDeleteResponse>>;
1285
+ beginDeleteAndWait(resourceGroupName: string, accountName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionDeleteOptionalParams): Promise<PrivateEndpointConnectionDeleteResponse>;
1242
1286
  beginUpdate(resourceGroupName: string, accountName: string, privateEndpointConnectionName: string, parameters: PrivateEndpointConnection, options?: PrivateEndpointConnectionUpdateOptionalParams): Promise<PollerLike<PollOperationState<PrivateEndpointConnectionUpdateResponse>, PrivateEndpointConnectionUpdateResponse>>;
1243
1287
  beginUpdateAndWait(resourceGroupName: string, accountName: string, privateEndpointConnectionName: string, parameters: PrivateEndpointConnection, options?: PrivateEndpointConnectionUpdateOptionalParams): Promise<PrivateEndpointConnectionUpdateResponse>;
1244
1288
  get(resourceGroupName: string, accountName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionGetOptionalParams): Promise<PrivateEndpointConnectionGetResponse>;
@@ -1246,7 +1290,7 @@ export interface PrivateEndpointConnectionOperations {
1246
1290
  }
1247
1291
 
1248
1292
  // @public
1249
- export type PrivateEndpointConnectionProvisioningState = "Succeeded" | "Updating" | "Failed";
1293
+ export type PrivateEndpointConnectionProvisioningState = "Creating" | "Updating" | "Deleting" | "Succeeded" | "Failed" | "Cancelled";
1250
1294
 
1251
1295
  // @public
1252
1296
  export interface PrivateEndpointConnectionUpdateHeaders {
@@ -1265,11 +1309,11 @@ export interface PrivateEndpointConnectionUpdateOptionalParams extends coreClien
1265
1309
  export type PrivateEndpointConnectionUpdateResponse = PrivateEndpointConnection;
1266
1310
 
1267
1311
  // @public
1268
- export type PrivateLinkResource = ProxyResource & {
1312
+ export interface PrivateLinkResource extends ProxyResource {
1269
1313
  readonly groupId?: string;
1270
1314
  readonly requiredMembers?: string[];
1271
1315
  readonly requiredZoneNames?: string[];
1272
- };
1316
+ }
1273
1317
 
1274
1318
  // @public
1275
1319
  export interface PrivateLinkResourceGetOptionalParams extends coreClient.OperationOptions {
@@ -7,6 +7,12 @@
7
7
  */
8
8
 
9
9
  import * as coreClient from "@azure/core-client";
10
+ import * as coreRestPipeline from "@azure/core-rest-pipeline";
11
+ import {
12
+ PipelineRequest,
13
+ PipelineResponse,
14
+ SendRequest
15
+ } from "@azure/core-rest-pipeline";
10
16
  import * as coreAuth from "@azure/core-auth";
11
17
  import {
12
18
  BatchAccountOperationsImpl,
@@ -65,7 +71,7 @@ export class BatchManagementClient extends coreClient.ServiceClient {
65
71
  credential: credentials
66
72
  };
67
73
 
68
- const packageDetails = `azsdk-js-arm-batch/7.1.1`;
74
+ const packageDetails = `azsdk-js-arm-batch/7.2.0`;
69
75
  const userAgentPrefix =
70
76
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
71
77
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
@@ -84,12 +90,35 @@ export class BatchManagementClient extends coreClient.ServiceClient {
84
90
  options.endpoint ?? options.baseUri ?? "https://management.azure.com"
85
91
  };
86
92
  super(optionsWithDefaults);
93
+
94
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
95
+ const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
96
+ const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
97
+ (pipelinePolicy) =>
98
+ pipelinePolicy.name ===
99
+ coreRestPipeline.bearerTokenAuthenticationPolicyName
100
+ );
101
+ if (!bearerTokenAuthenticationPolicyFound) {
102
+ this.pipeline.removePolicy({
103
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
104
+ });
105
+ this.pipeline.addPolicy(
106
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
107
+ scopes: `${optionsWithDefaults.baseUri}/.default`,
108
+ challengeCallbacks: {
109
+ authorizeRequestOnChallenge:
110
+ coreClient.authorizeRequestOnClaimChallenge
111
+ }
112
+ })
113
+ );
114
+ }
115
+ }
87
116
  // Parameter assignments
88
117
  this.subscriptionId = subscriptionId;
89
118
 
90
119
  // Assigning values to Constant parameters
91
120
  this.$host = options.$host || "https://management.azure.com";
92
- this.apiVersion = options.apiVersion || "2022-01-01";
121
+ this.apiVersion = options.apiVersion || "2022-06-01";
93
122
  this.batchAccountOperations = new BatchAccountOperationsImpl(this);
94
123
  this.applicationPackageOperations = new ApplicationPackageOperationsImpl(
95
124
  this
@@ -105,6 +134,35 @@ export class BatchManagementClient extends coreClient.ServiceClient {
105
134
  this
106
135
  );
107
136
  this.poolOperations = new PoolOperationsImpl(this);
137
+ this.addCustomApiVersionPolicy(options.apiVersion);
138
+ }
139
+
140
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
141
+ private addCustomApiVersionPolicy(apiVersion?: string) {
142
+ if (!apiVersion) {
143
+ return;
144
+ }
145
+ const apiVersionPolicy = {
146
+ name: "CustomApiVersionPolicy",
147
+ async sendRequest(
148
+ request: PipelineRequest,
149
+ next: SendRequest
150
+ ): Promise<PipelineResponse> {
151
+ const param = request.url.split("?");
152
+ if (param.length > 1) {
153
+ const newParams = param[1].split("&").map((item) => {
154
+ if (item.indexOf("api-version") > -1) {
155
+ return "api-version=" + apiVersion;
156
+ } else {
157
+ return item;
158
+ }
159
+ });
160
+ request.url = param[0] + "?" + newParams.join("&");
161
+ }
162
+ return next(request);
163
+ }
164
+ };
165
+ this.pipeline.addPolicy(apiVersionPolicy);
108
166
  }
109
167
 
110
168
  batchAccountOperations: BatchAccountOperations;