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

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 (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
@@ -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 { Tasks } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -73,12 +74,16 @@ export class TasksImpl implements Tasks {
73
74
  [Symbol.asyncIterator]() {
74
75
  return this;
75
76
  },
76
- byPage: () => {
77
+ byPage: (settings?: PageSettings) => {
78
+ if (settings?.maxPageSize) {
79
+ throw new Error("maxPageSize is not supported by this operation.");
80
+ }
77
81
  return this.listPagingPage(
78
82
  groupName,
79
83
  serviceName,
80
84
  projectName,
81
- options
85
+ options,
86
+ settings
82
87
  );
83
88
  }
84
89
  };
@@ -88,11 +93,18 @@ export class TasksImpl implements Tasks {
88
93
  groupName: string,
89
94
  serviceName: string,
90
95
  projectName: string,
91
- options?: TasksListOptionalParams
96
+ options?: TasksListOptionalParams,
97
+ settings?: PageSettings
92
98
  ): AsyncIterableIterator<ProjectTask[]> {
93
- let result = await this._list(groupName, serviceName, projectName, options);
94
- yield result.value || [];
95
- let continuationToken = result.nextLink;
99
+ let result: TasksListResponse;
100
+ let continuationToken = settings?.continuationToken;
101
+ if (!continuationToken) {
102
+ result = await this._list(groupName, serviceName, projectName, options);
103
+ let page = result.value || [];
104
+ continuationToken = result.nextLink;
105
+ setContinuationToken(page, continuationToken);
106
+ yield page;
107
+ }
96
108
  while (continuationToken) {
97
109
  result = await this._listNext(
98
110
  groupName,
@@ -102,7 +114,9 @@ export class TasksImpl implements Tasks {
102
114
  options
103
115
  );
104
116
  continuationToken = result.nextLink;
105
- yield result.value || [];
117
+ let page = result.value || [];
118
+ setContinuationToken(page, continuationToken);
119
+ yield page;
106
120
  }
107
121
  }
108
122
 
@@ -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 { Usages } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -51,23 +52,35 @@ export class UsagesImpl implements Usages {
51
52
  [Symbol.asyncIterator]() {
52
53
  return this;
53
54
  },
54
- byPage: () => {
55
- return this.listPagingPage(location, options);
55
+ byPage: (settings?: PageSettings) => {
56
+ if (settings?.maxPageSize) {
57
+ throw new Error("maxPageSize is not supported by this operation.");
58
+ }
59
+ return this.listPagingPage(location, options, settings);
56
60
  }
57
61
  };
58
62
  }
59
63
 
60
64
  private async *listPagingPage(
61
65
  location: string,
62
- options?: UsagesListOptionalParams
66
+ options?: UsagesListOptionalParams,
67
+ settings?: PageSettings
63
68
  ): AsyncIterableIterator<Quota[]> {
64
- let result = await this._list(location, options);
65
- yield result.value || [];
66
- let continuationToken = result.nextLink;
69
+ let result: UsagesListResponse;
70
+ let continuationToken = settings?.continuationToken;
71
+ if (!continuationToken) {
72
+ result = await this._list(location, options);
73
+ let page = result.value || [];
74
+ continuationToken = result.nextLink;
75
+ setContinuationToken(page, continuationToken);
76
+ yield page;
77
+ }
67
78
  while (continuationToken) {
68
79
  result = await this._listNext(location, continuationToken, options);
69
80
  continuationToken = result.nextLink;
70
- yield result.value || [];
81
+ let page = result.value || [];
82
+ setContinuationToken(page, continuationToken);
83
+ yield page;
71
84
  }
72
85
  }
73
86
 
@@ -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 a result page from a pageable operation, returns a
17
+ * continuation token that can be used to begin paging from
18
+ * that point later.
19
+ * @param page A result object from calling .byPage() on a paged operation.
20
+ * @returns The continuation token that can be passed into byPage().
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
+ }