@azure/arm-workspaces 1.0.2-alpha.20221128.2 → 1.1.0

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 (37) hide show
  1. package/CHANGELOG.md +6 -10
  2. package/dist/index.js +126 -37
  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/src/index.d.ts +1 -0
  7. package/dist-esm/src/index.d.ts.map +1 -1
  8. package/dist-esm/src/index.js +1 -0
  9. package/dist-esm/src/index.js.map +1 -1
  10. package/dist-esm/src/machineLearningWorkspacesManagementClient.d.ts +2 -0
  11. package/dist-esm/src/machineLearningWorkspacesManagementClient.d.ts.map +1 -1
  12. package/dist-esm/src/machineLearningWorkspacesManagementClient.js +49 -18
  13. package/dist-esm/src/machineLearningWorkspacesManagementClient.js.map +1 -1
  14. package/dist-esm/src/models/index.d.ts +2 -2
  15. package/dist-esm/src/models/index.d.ts.map +1 -1
  16. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  17. package/dist-esm/src/operations/operations.js +8 -4
  18. package/dist-esm/src/operations/operations.js.map +1 -1
  19. package/dist-esm/src/operations/workspaces.d.ts.map +1 -1
  20. package/dist-esm/src/operations/workspaces.js +37 -14
  21. package/dist-esm/src/operations/workspaces.js.map +1 -1
  22. package/dist-esm/src/pagingHelper.d.ts +13 -0
  23. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  24. package/dist-esm/src/pagingHelper.js +32 -0
  25. package/dist-esm/src/pagingHelper.js.map +1 -0
  26. package/dist-esm/test/sampleTest.js +11 -13
  27. package/dist-esm/test/sampleTest.js.map +1 -1
  28. package/package.json +13 -9
  29. package/review/arm-workspaces.api.md +11 -8
  30. package/src/index.ts +1 -0
  31. package/src/machineLearningWorkspacesManagementClient.ts +60 -20
  32. package/src/models/index.ts +3 -2
  33. package/src/operations/operations.ts +10 -5
  34. package/src/operations/workspaces.ts +46 -17
  35. package/src/pagingHelper.ts +39 -0
  36. package/tsconfig.json +5 -1
  37. package/types/arm-workspaces.d.ts +13 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagingHelper.js","sourceRoot":"","sources":["../../src/pagingHelper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,OAAO,GAAG,IAAI,OAAO,EAAoB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAa;;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE;QAC7C,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,0CAAE,iBAAiB,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAa,EACb,iBAAqC;;IAErC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,iBAAiB,EAAE;QACnE,OAAO;KACR;IACD,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;IACzC,QAAQ,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
@@ -6,24 +6,22 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
  import { __awaiter } from "tslib";
9
- import { record } from "@azure-tools/test-recorder";
10
- const recorderEnvSetup = {
11
- replaceableVariables: {
12
- AZURE_CLIENT_ID: "azure_client_id",
13
- AZURE_CLIENT_SECRET: "azure_client_secret",
14
- AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
15
- SUBSCRIPTION_ID: "azure_subscription_id"
16
- },
17
- customizationsOnRecordings: [
18
- (recording) => recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`)
19
- ],
20
- queryParametersToSkip: []
9
+ import { Recorder } from "@azure-tools/test-recorder";
10
+ const replaceableVariables = {
11
+ AZURE_CLIENT_ID: "azure_client_id",
12
+ AZURE_CLIENT_SECRET: "azure_client_secret",
13
+ AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
14
+ SUBSCRIPTION_ID: "azure_subscription_id"
15
+ };
16
+ const recorderOptions = {
17
+ envSetupForPlayback: replaceableVariables
21
18
  };
22
19
  describe("My test", () => {
23
20
  let recorder;
24
21
  beforeEach(function () {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
- recorder = record(this, recorderEnvSetup);
23
+ recorder = new Recorder(this.currentTest);
24
+ yield recorder.start(recorderOptions);
27
25
  });
28
26
  });
29
27
  afterEach(function () {
@@ -1 +1 @@
1
- {"version":3,"file":"sampleTest.js","sourceRoot":"","sources":["../../test/sampleTest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,OAAO,EAEL,MAAM,EAGP,MAAM,4BAA4B,CAAC;AAGpC,MAAM,gBAAgB,GAA6B;IACjD,oBAAoB,EAAE;QACpB,eAAe,EAAE,iBAAiB;QAClC,mBAAmB,EAAE,qBAAqB;QAC1C,eAAe,EAAE,sCAAsC;QACvD,eAAe,EAAE,uBAAuB;KACzC;IACD,0BAA0B,EAAE;QAC1B,CAAC,SAAc,EAAO,EAAE,CACtB,SAAS,CAAC,OAAO,CACf,yBAAyB,EACzB,+BAA+B,CAChC;KACJ;IACD,qBAAqB,EAAE,EAAE;CAC1B,CAAC;AAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,IAAI,QAAkB,CAAC;IAEvB,UAAU,CAAC;;YACT,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAC5C,CAAC;KAAA,CAAC,CAAC;IAEH,SAAS,CAAC;;YACR,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;KAAA,CAAC,CAAC;IAEH,EAAE,CAAC,aAAa,EAAE;;YAChB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;KAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"sampleTest.js","sourceRoot":"","sources":["../../test/sampleTest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,OAAO,EACL,QAAQ,EAGT,MAAM,4BAA4B,CAAC;AAIpC,MAAM,oBAAoB,GAA2B;IACnD,eAAe,EAAE,iBAAiB;IAClC,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,sCAAsC;IACvD,eAAe,EAAE,uBAAuB;CACzC,CAAC;AAEF,MAAM,eAAe,GAAyB;IAC5C,mBAAmB,EAAE,oBAAoB;CAC1C,CAAC;AAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,IAAI,QAAkB,CAAC;IAEvB,UAAU,CAAC;;YACT,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACxC,CAAC;KAAA,CAAC,CAAC;IAEH,SAAS,CAAC;;YACR,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;KAAA,CAAC,CAAC;IAEH,EAAE,CAAC,aAAa,EAAE;;YAChB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;KAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -3,13 +3,13 @@
3
3
  "sdk-type": "mgmt",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "A generated SDK for MachineLearningWorkspacesManagementClient.",
6
- "version": "1.0.2-alpha.20221128.2",
6
+ "version": "1.1.0",
7
7
  "engines": {
8
8
  "node": ">=14.0.0"
9
9
  },
10
10
  "dependencies": {
11
11
  "@azure/core-paging": "^1.2.0",
12
- "@azure/core-client": "^1.5.0",
12
+ "@azure/core-client": "^1.6.1",
13
13
  "@azure/core-auth": "^1.3.0",
14
14
  "@azure/core-rest-pipeline": "^1.8.0",
15
15
  "tslib": "^2.2.0"
@@ -34,13 +34,18 @@
34
34
  "mkdirp": "^1.0.4",
35
35
  "rollup": "^2.66.1",
36
36
  "rollup-plugin-sourcemaps": "^0.6.3",
37
- "typescript": "~4.2.0",
37
+ "typescript": "~4.8.0",
38
38
  "uglify-js": "^3.4.9",
39
39
  "rimraf": "^3.0.0",
40
40
  "@azure/identity": "^2.0.1",
41
- "@azure-tools/test-recorder": "^1.0.0",
41
+ "@azure-tools/test-recorder": "^2.0.0",
42
+ "@azure-tools/test-credential": "^1.0.0",
42
43
  "mocha": "^7.1.1",
43
- "cross-env": "^7.0.2"
44
+ "@types/chai": "^4.2.8",
45
+ "chai": "^4.2.0",
46
+ "cross-env": "^7.0.2",
47
+ "@types/node": "^14.0.0",
48
+ "@azure/dev-tool": "^1.0.0"
44
49
  },
45
50
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/machinelearning/arm-workspaces",
46
51
  "repository": {
@@ -91,9 +96,8 @@
91
96
  "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
92
97
  "unit-test:browser": "echo skipped",
93
98
  "integration-test": "npm run integration-test:node && npm run integration-test:browser",
94
- "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
95
- "integration-test:browser": "echo skipped",
96
- "docs": "echo skipped"
99
+ "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
100
+ "integration-test:browser": "echo skipped"
97
101
  },
98
102
  "sideEffects": false,
99
103
  "//metadata": {
@@ -113,4 +117,4 @@
113
117
  "disableDocsMs": true,
114
118
  "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-workspaces?view=azure-node-preview"
115
119
  }
116
- }
120
+ }
@@ -14,6 +14,9 @@ export interface ErrorResponse {
14
14
  message: string;
15
15
  }
16
16
 
17
+ // @public
18
+ export function getContinuationToken(page: unknown): string | undefined;
19
+
17
20
  // @public (undocumented)
18
21
  export class MachineLearningWorkspacesManagementClient extends coreClient.ServiceClient {
19
22
  // (undocumented)
@@ -86,16 +89,16 @@ export interface Sku {
86
89
  }
87
90
 
88
91
  // @public
89
- export type Workspace = Resource & {
90
- userStorageAccountId?: string;
91
- ownerEmail?: string;
92
- readonly workspaceType?: WorkspaceType;
93
- readonly workspaceState?: WorkspaceState;
94
- readonly workspaceId?: string;
92
+ export interface Workspace extends Resource {
95
93
  readonly creationTime?: string;
96
- readonly studioEndpoint?: string;
97
94
  keyVaultIdentifierId?: string;
98
- };
95
+ ownerEmail?: string;
96
+ readonly studioEndpoint?: string;
97
+ userStorageAccountId?: string;
98
+ readonly workspaceId?: string;
99
+ readonly workspaceState?: WorkspaceState;
100
+ readonly workspaceType?: WorkspaceType;
101
+ }
99
102
 
100
103
  // @public
101
104
  export interface WorkspaceKeysResponse {
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 { MachineLearningWorkspacesManagementClient } from "./machineLearningWorkspacesManagementClient";
12
13
  export * from "./operationsInterfaces";
@@ -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 { OperationsImpl, WorkspacesImpl } from "./operations";
13
18
  import { Operations, Workspaces } from "./operationsInterfaces";
@@ -45,47 +50,53 @@ export class MachineLearningWorkspacesManagementClient extends coreClient.Servic
45
50
  credential: credentials
46
51
  };
47
52
 
48
- const packageDetails = `azsdk-js-arm-workspaces/1.0.2`;
53
+ const packageDetails = `azsdk-js-arm-workspaces/1.1.0`;
49
54
  const userAgentPrefix =
50
55
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
51
56
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
52
57
  : `${packageDetails}`;
53
58
 
54
- if (!options.credentialScopes) {
55
- options.credentialScopes = ["https://management.azure.com/.default"];
56
- }
57
59
  const optionsWithDefaults = {
58
60
  ...defaults,
59
61
  ...options,
60
62
  userAgentOptions: {
61
63
  userAgentPrefix
62
64
  },
63
- baseUri:
65
+ endpoint:
64
66
  options.endpoint ?? options.baseUri ?? "https://management.azure.com"
65
67
  };
66
68
  super(optionsWithDefaults);
67
69
 
70
+ let bearerTokenAuthenticationPolicyFound: boolean = false;
68
71
  if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
69
72
  const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
70
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
73
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
71
74
  (pipelinePolicy) =>
72
75
  pipelinePolicy.name ===
73
76
  coreRestPipeline.bearerTokenAuthenticationPolicyName
74
77
  );
75
- if (!bearerTokenAuthenticationPolicyFound) {
76
- this.pipeline.removePolicy({
77
- name: coreRestPipeline.bearerTokenAuthenticationPolicyName
78
- });
79
- this.pipeline.addPolicy(
80
- coreRestPipeline.bearerTokenAuthenticationPolicy({
81
- scopes: `${optionsWithDefaults.baseUri}/.default`,
82
- challengeCallbacks: {
83
- authorizeRequestOnChallenge:
84
- coreClient.authorizeRequestOnClaimChallenge
85
- }
86
- })
87
- );
88
- }
78
+ }
79
+ if (
80
+ !options ||
81
+ !options.pipeline ||
82
+ options.pipeline.getOrderedPolicies().length == 0 ||
83
+ !bearerTokenAuthenticationPolicyFound
84
+ ) {
85
+ this.pipeline.removePolicy({
86
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
87
+ });
88
+ this.pipeline.addPolicy(
89
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
90
+ credential: credentials,
91
+ scopes:
92
+ optionsWithDefaults.credentialScopes ??
93
+ `${optionsWithDefaults.endpoint}/.default`,
94
+ challengeCallbacks: {
95
+ authorizeRequestOnChallenge:
96
+ coreClient.authorizeRequestOnClaimChallenge
97
+ }
98
+ })
99
+ );
89
100
  }
90
101
  // Parameter assignments
91
102
  this.subscriptionId = subscriptionId;
@@ -95,6 +106,35 @@ export class MachineLearningWorkspacesManagementClient extends coreClient.Servic
95
106
  this.apiVersion = options.apiVersion || "2019-10-01";
96
107
  this.operations = new OperationsImpl(this);
97
108
  this.workspaces = new WorkspacesImpl(this);
109
+ this.addCustomApiVersionPolicy(options.apiVersion);
110
+ }
111
+
112
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
113
+ private addCustomApiVersionPolicy(apiVersion?: string) {
114
+ if (!apiVersion) {
115
+ return;
116
+ }
117
+ const apiVersionPolicy = {
118
+ name: "CustomApiVersionPolicy",
119
+ async sendRequest(
120
+ request: PipelineRequest,
121
+ next: SendRequest
122
+ ): Promise<PipelineResponse> {
123
+ const param = request.url.split("?");
124
+ if (param.length > 1) {
125
+ const newParams = param[1].split("&").map((item) => {
126
+ if (item.indexOf("api-version") > -1) {
127
+ return "api-version=" + apiVersion;
128
+ } else {
129
+ return item;
130
+ }
131
+ });
132
+ request.url = param[0] + "?" + newParams.join("&");
133
+ }
134
+ return next(request);
135
+ }
136
+ };
137
+ this.pipeline.addPolicy(apiVersionPolicy);
98
138
  }
99
139
 
100
140
  operations: Operations;
@@ -104,7 +104,7 @@ export interface WorkspaceListResult {
104
104
  }
105
105
 
106
106
  /** An object that represents a machine learning workspace. */
107
- export type Workspace = Resource & {
107
+ export interface Workspace extends Resource {
108
108
  /** The fully qualified arm id of the storage account associated with this workspace. */
109
109
  userStorageAccountId?: string;
110
110
  /** The email id of the owner for this workspace. */
@@ -136,7 +136,8 @@ export type Workspace = Resource & {
136
136
  readonly studioEndpoint?: string;
137
137
  /** The key vault identifier used for encrypted workspaces. */
138
138
  keyVaultIdentifierId?: string;
139
- };
139
+ }
140
+
140
141
  /** Defines values for WorkspaceType. */
141
142
  export type WorkspaceType =
142
143
  | "Production"
@@ -6,7 +6,7 @@
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
10
  import { Operations } from "../operationsInterfaces";
11
11
  import * as coreClient from "@azure/core-client";
12
12
  import * as Mappers from "../models/mappers";
@@ -46,16 +46,21 @@ export class OperationsImpl implements Operations {
46
46
  [Symbol.asyncIterator]() {
47
47
  return this;
48
48
  },
49
- byPage: () => {
50
- return this.listPagingPage(options);
49
+ byPage: (settings?: PageSettings) => {
50
+ if (settings?.maxPageSize) {
51
+ throw new Error("maxPageSize is not supported by this operation.");
52
+ }
53
+ return this.listPagingPage(options, settings);
51
54
  }
52
55
  };
53
56
  }
54
57
 
55
58
  private async *listPagingPage(
56
- options?: OperationsListOptionalParams
59
+ options?: OperationsListOptionalParams,
60
+ _settings?: PageSettings
57
61
  ): AsyncIterableIterator<Operation[]> {
58
- let result = await this._list(options);
62
+ let result: OperationsListResponse;
63
+ result = await this._list(options);
59
64
  yield result.value || [];
60
65
  }
61
66
 
@@ -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 { Workspaces } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -16,8 +17,10 @@ import {
16
17
  Workspace,
17
18
  WorkspacesListByResourceGroupNextOptionalParams,
18
19
  WorkspacesListByResourceGroupOptionalParams,
20
+ WorkspacesListByResourceGroupResponse,
19
21
  WorkspacesListNextOptionalParams,
20
22
  WorkspacesListOptionalParams,
23
+ WorkspacesListResponse,
21
24
  WorkspacesGetOptionalParams,
22
25
  WorkspacesGetResponse,
23
26
  WorkspacesCreateOrUpdateOptionalParams,
@@ -29,8 +32,6 @@ import {
29
32
  WorkspacesResyncStorageKeysOptionalParams,
30
33
  WorkspacesListWorkspaceKeysOptionalParams,
31
34
  WorkspacesListWorkspaceKeysResponse,
32
- WorkspacesListByResourceGroupResponse,
33
- WorkspacesListResponse,
34
35
  WorkspacesListByResourceGroupNextResponse,
35
36
  WorkspacesListNextResponse
36
37
  } from "../models";
@@ -66,19 +67,33 @@ export class WorkspacesImpl implements Workspaces {
66
67
  [Symbol.asyncIterator]() {
67
68
  return this;
68
69
  },
69
- byPage: () => {
70
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
70
+ byPage: (settings?: PageSettings) => {
71
+ if (settings?.maxPageSize) {
72
+ throw new Error("maxPageSize is not supported by this operation.");
73
+ }
74
+ return this.listByResourceGroupPagingPage(
75
+ resourceGroupName,
76
+ options,
77
+ settings
78
+ );
71
79
  }
72
80
  };
73
81
  }
74
82
 
75
83
  private async *listByResourceGroupPagingPage(
76
84
  resourceGroupName: string,
77
- options?: WorkspacesListByResourceGroupOptionalParams
85
+ options?: WorkspacesListByResourceGroupOptionalParams,
86
+ settings?: PageSettings
78
87
  ): AsyncIterableIterator<Workspace[]> {
79
- let result = await this._listByResourceGroup(resourceGroupName, options);
80
- yield result.value || [];
81
- let continuationToken = result.nextLink;
88
+ let result: WorkspacesListByResourceGroupResponse;
89
+ let continuationToken = settings?.continuationToken;
90
+ if (!continuationToken) {
91
+ result = await this._listByResourceGroup(resourceGroupName, options);
92
+ let page = result.value || [];
93
+ continuationToken = result.nextLink;
94
+ setContinuationToken(page, continuationToken);
95
+ yield page;
96
+ }
82
97
  while (continuationToken) {
83
98
  result = await this._listByResourceGroupNext(
84
99
  resourceGroupName,
@@ -86,7 +101,9 @@ export class WorkspacesImpl implements Workspaces {
86
101
  options
87
102
  );
88
103
  continuationToken = result.nextLink;
89
- yield result.value || [];
104
+ let page = result.value || [];
105
+ setContinuationToken(page, continuationToken);
106
+ yield page;
90
107
  }
91
108
  }
92
109
 
@@ -117,22 +134,34 @@ export class WorkspacesImpl implements Workspaces {
117
134
  [Symbol.asyncIterator]() {
118
135
  return this;
119
136
  },
120
- byPage: () => {
121
- return this.listPagingPage(options);
137
+ byPage: (settings?: PageSettings) => {
138
+ if (settings?.maxPageSize) {
139
+ throw new Error("maxPageSize is not supported by this operation.");
140
+ }
141
+ return this.listPagingPage(options, settings);
122
142
  }
123
143
  };
124
144
  }
125
145
 
126
146
  private async *listPagingPage(
127
- options?: WorkspacesListOptionalParams
147
+ options?: WorkspacesListOptionalParams,
148
+ settings?: PageSettings
128
149
  ): AsyncIterableIterator<Workspace[]> {
129
- let result = await this._list(options);
130
- yield result.value || [];
131
- let continuationToken = result.nextLink;
150
+ let result: WorkspacesListResponse;
151
+ let continuationToken = settings?.continuationToken;
152
+ if (!continuationToken) {
153
+ result = await this._list(options);
154
+ let page = result.value || [];
155
+ continuationToken = result.nextLink;
156
+ setContinuationToken(page, continuationToken);
157
+ yield page;
158
+ }
132
159
  while (continuationToken) {
133
160
  result = await this._listNext(continuationToken, options);
134
161
  continuationToken = result.nextLink;
135
- yield result.value || [];
162
+ let page = result.value || [];
163
+ setContinuationToken(page, continuationToken);
164
+ yield page;
136
165
  }
137
166
  }
138
167
 
@@ -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
+ }
package/tsconfig.json CHANGED
@@ -25,9 +25,13 @@
25
25
  "include": [
26
26
  "./src/**/*.ts",
27
27
  "./test/**/*.ts",
28
+ "samples-dev/**/*.ts",
29
+ "./test/**/*.ts",
30
+ "samples-dev/**/*.ts",
31
+ "./test/**/*.ts",
28
32
  "samples-dev/**/*.ts"
29
33
  ],
30
34
  "exclude": [
31
35
  "node_modules"
32
36
  ]
33
- }
37
+ }
@@ -10,6 +10,15 @@ export declare interface ErrorResponse {
10
10
  message: string;
11
11
  }
12
12
 
13
+ /**
14
+ * Given a result page from a pageable operation, returns a
15
+ * continuation token that can be used to begin paging from
16
+ * that point later.
17
+ * @param page A result object from calling .byPage() on a paged operation.
18
+ * @returns The continuation token that can be passed into byPage().
19
+ */
20
+ export declare function getContinuationToken(page: unknown): string | undefined;
21
+
13
22
  export declare class MachineLearningWorkspacesManagementClient extends coreClient.ServiceClient {
14
23
  $host: string;
15
24
  apiVersion: string;
@@ -21,6 +30,8 @@ export declare class MachineLearningWorkspacesManagementClient extends coreClien
21
30
  * @param options The parameter options
22
31
  */
23
32
  constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MachineLearningWorkspacesManagementClientOptionalParams);
33
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
34
+ private addCustomApiVersionPolicy;
24
35
  operations: Operations;
25
36
  workspaces: Workspaces;
26
37
  }
@@ -113,7 +124,7 @@ export declare interface Sku {
113
124
  }
114
125
 
115
126
  /** An object that represents a machine learning workspace. */
116
- export declare type Workspace = Resource & {
127
+ export declare interface Workspace extends Resource {
117
128
  /** The fully qualified arm id of the storage account associated with this workspace. */
118
129
  userStorageAccountId?: string;
119
130
  /** The email id of the owner for this workspace. */
@@ -145,7 +156,7 @@ export declare type Workspace = Resource & {
145
156
  readonly studioEndpoint?: string;
146
157
  /** The key vault identifier used for encrypted workspaces. */
147
158
  keyVaultIdentifierId?: string;
148
- };
159
+ }
149
160
 
150
161
  /** Workspace authorization keys for a workspace. */
151
162
  export declare interface WorkspaceKeysResponse {