@azure/arm-datamigration 3.0.0-beta.2 → 3.0.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +1 -1
  3. package/dist/index.js +630 -110
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist-esm/samples-dev/databaseMigrationsSqlMiCreateOrUpdateSample.js +2 -2
  8. package/dist-esm/samples-dev/databaseMigrationsSqlMiCreateOrUpdateSample.js.map +1 -1
  9. package/dist-esm/samples-dev/databaseMigrationsSqlVMCreateOrUpdateSample.js +2 -2
  10. package/dist-esm/samples-dev/databaseMigrationsSqlVMCreateOrUpdateSample.js.map +1 -1
  11. package/dist-esm/src/dataMigrationManagementClient.d.ts +2 -0
  12. package/dist-esm/src/dataMigrationManagementClient.d.ts.map +1 -1
  13. package/dist-esm/src/dataMigrationManagementClient.js +49 -18
  14. package/dist-esm/src/dataMigrationManagementClient.js.map +1 -1
  15. package/dist-esm/src/index.d.ts +1 -0
  16. package/dist-esm/src/index.d.ts.map +1 -1
  17. package/dist-esm/src/index.js +1 -0
  18. package/dist-esm/src/index.js.map +1 -1
  19. package/dist-esm/src/models/index.d.ts +556 -240
  20. package/dist-esm/src/models/index.d.ts.map +1 -1
  21. package/dist-esm/src/models/index.js +314 -0
  22. package/dist-esm/src/models/index.js.map +1 -1
  23. package/dist-esm/src/operations/files.d.ts.map +1 -1
  24. package/dist-esm/src/operations/files.js +19 -7
  25. package/dist-esm/src/operations/files.js.map +1 -1
  26. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  27. package/dist-esm/src/operations/operations.js +19 -7
  28. package/dist-esm/src/operations/operations.js.map +1 -1
  29. package/dist-esm/src/operations/projects.d.ts.map +1 -1
  30. package/dist-esm/src/operations/projects.js +19 -7
  31. package/dist-esm/src/operations/projects.js.map +1 -1
  32. package/dist-esm/src/operations/resourceSkus.d.ts.map +1 -1
  33. package/dist-esm/src/operations/resourceSkus.js +19 -7
  34. package/dist-esm/src/operations/resourceSkus.js.map +1 -1
  35. package/dist-esm/src/operations/serviceTasks.d.ts.map +1 -1
  36. package/dist-esm/src/operations/serviceTasks.js +19 -7
  37. package/dist-esm/src/operations/serviceTasks.js.map +1 -1
  38. package/dist-esm/src/operations/services.d.ts.map +1 -1
  39. package/dist-esm/src/operations/services.js +55 -21
  40. package/dist-esm/src/operations/services.js.map +1 -1
  41. package/dist-esm/src/operations/sqlMigrationServices.d.ts.map +1 -1
  42. package/dist-esm/src/operations/sqlMigrationServices.js +55 -21
  43. package/dist-esm/src/operations/sqlMigrationServices.js.map +1 -1
  44. package/dist-esm/src/operations/tasks.d.ts.map +1 -1
  45. package/dist-esm/src/operations/tasks.js +19 -7
  46. package/dist-esm/src/operations/tasks.js.map +1 -1
  47. package/dist-esm/src/operations/usages.d.ts.map +1 -1
  48. package/dist-esm/src/operations/usages.js +19 -7
  49. package/dist-esm/src/operations/usages.js.map +1 -1
  50. package/dist-esm/src/pagingHelper.d.ts +13 -0
  51. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  52. package/dist-esm/src/pagingHelper.js +32 -0
  53. package/dist-esm/src/pagingHelper.js.map +1 -0
  54. package/dist-esm/test/sampleTest.js +11 -13
  55. package/dist-esm/test/sampleTest.js.map +1 -1
  56. package/package.json +14 -10
  57. package/review/arm-datamigration.api.md +564 -872
  58. package/src/dataMigrationManagementClient.ts +60 -20
  59. package/src/index.ts +1 -0
  60. package/src/models/index.ts +646 -246
  61. package/src/operations/files.ts +22 -8
  62. package/src/operations/operations.ts +21 -8
  63. package/src/operations/projects.ts +21 -8
  64. package/src/operations/resourceSkus.ts +21 -8
  65. package/src/operations/serviceTasks.ts +21 -8
  66. package/src/operations/services.ts +67 -25
  67. package/src/operations/sqlMigrationServices.ts +71 -29
  68. package/src/operations/tasks.ts +22 -8
  69. package/src/operations/usages.ts +21 -8
  70. package/src/pagingHelper.ts +39 -0
  71. package/types/arm-datamigration.d.ts +567 -240
  72. package/types/tsdoc-metadata.json +1 -1
@@ -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
  DatabaseMigrationsSqlMiImpl,
@@ -69,47 +74,53 @@ export class DataMigrationManagementClient extends coreClient.ServiceClient {
69
74
  credential: credentials
70
75
  };
71
76
 
72
- const packageDetails = `azsdk-js-arm-datamigration/3.0.0-beta.2`;
77
+ const packageDetails = `azsdk-js-arm-datamigration/3.0.0-beta.3`;
73
78
  const userAgentPrefix =
74
79
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
75
80
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
76
81
  : `${packageDetails}`;
77
82
 
78
- if (!options.credentialScopes) {
79
- options.credentialScopes = ["https://management.azure.com/.default"];
80
- }
81
83
  const optionsWithDefaults = {
82
84
  ...defaults,
83
85
  ...options,
84
86
  userAgentOptions: {
85
87
  userAgentPrefix
86
88
  },
87
- baseUri:
89
+ endpoint:
88
90
  options.endpoint ?? options.baseUri ?? "https://management.azure.com"
89
91
  };
90
92
  super(optionsWithDefaults);
91
93
 
94
+ let bearerTokenAuthenticationPolicyFound: boolean = false;
92
95
  if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
93
96
  const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
94
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
97
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
95
98
  (pipelinePolicy) =>
96
99
  pipelinePolicy.name ===
97
100
  coreRestPipeline.bearerTokenAuthenticationPolicyName
98
101
  );
99
- if (!bearerTokenAuthenticationPolicyFound) {
100
- this.pipeline.removePolicy({
101
- name: coreRestPipeline.bearerTokenAuthenticationPolicyName
102
- });
103
- this.pipeline.addPolicy(
104
- coreRestPipeline.bearerTokenAuthenticationPolicy({
105
- scopes: `${optionsWithDefaults.baseUri}/.default`,
106
- challengeCallbacks: {
107
- authorizeRequestOnChallenge:
108
- coreClient.authorizeRequestOnClaimChallenge
109
- }
110
- })
111
- );
112
- }
102
+ }
103
+ if (
104
+ !options ||
105
+ !options.pipeline ||
106
+ options.pipeline.getOrderedPolicies().length == 0 ||
107
+ !bearerTokenAuthenticationPolicyFound
108
+ ) {
109
+ this.pipeline.removePolicy({
110
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
111
+ });
112
+ this.pipeline.addPolicy(
113
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
114
+ credential: credentials,
115
+ scopes:
116
+ optionsWithDefaults.credentialScopes ??
117
+ `${optionsWithDefaults.endpoint}/.default`,
118
+ challengeCallbacks: {
119
+ authorizeRequestOnChallenge:
120
+ coreClient.authorizeRequestOnClaimChallenge
121
+ }
122
+ })
123
+ );
113
124
  }
114
125
  // Parameter assignments
115
126
  this.subscriptionId = subscriptionId;
@@ -128,6 +139,35 @@ export class DataMigrationManagementClient extends coreClient.ServiceClient {
128
139
  this.projects = new ProjectsImpl(this);
129
140
  this.usages = new UsagesImpl(this);
130
141
  this.files = new FilesImpl(this);
142
+ this.addCustomApiVersionPolicy(options.apiVersion);
143
+ }
144
+
145
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
146
+ private addCustomApiVersionPolicy(apiVersion?: string) {
147
+ if (!apiVersion) {
148
+ return;
149
+ }
150
+ const apiVersionPolicy = {
151
+ name: "CustomApiVersionPolicy",
152
+ async sendRequest(
153
+ request: PipelineRequest,
154
+ next: SendRequest
155
+ ): Promise<PipelineResponse> {
156
+ const param = request.url.split("?");
157
+ if (param.length > 1) {
158
+ const newParams = param[1].split("&").map((item) => {
159
+ if (item.indexOf("api-version") > -1) {
160
+ return "api-version=" + apiVersion;
161
+ } else {
162
+ return item;
163
+ }
164
+ });
165
+ request.url = param[0] + "?" + newParams.join("&");
166
+ }
167
+ return next(request);
168
+ }
169
+ };
170
+ this.pipeline.addPolicy(apiVersionPolicy);
131
171
  }
132
172
 
133
173
  databaseMigrationsSqlMi: DatabaseMigrationsSqlMi;
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  /// <reference lib="esnext.asynciterable" />
10
+ export { getContinuationToken } from "./pagingHelper";
10
11
  export * from "./models";
11
12
  export { DataMigrationManagementClient } from "./dataMigrationManagementClient";
12
13
  export * from "./operationsInterfaces";