@azure/arm-managedapplications 2.0.2-alpha.20221026.1 → 2.1.0-alpha.20221128.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 -11
- package/dist/index.js +164 -46
- 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/applicationClient.d.ts +2 -0
- package/dist-esm/src/applicationClient.d.ts.map +1 -1
- package/dist-esm/src/applicationClient.js +68 -26
- package/dist-esm/src/applicationClient.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 +19 -8
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +11 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/operations/applicationDefinitions.d.ts.map +1 -1
- package/dist-esm/src/operations/applicationDefinitions.js +19 -7
- package/dist-esm/src/operations/applicationDefinitions.js.map +1 -1
- package/dist-esm/src/operations/applications.d.ts.map +1 -1
- package/dist-esm/src/operations/applications.js +37 -14
- package/dist-esm/src/operations/applications.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-managedapplications.api.md +24 -32
- package/src/applicationClient.ts +81 -28
- package/src/index.ts +1 -0
- package/src/models/index.ts +19 -8
- package/src/operations/applicationDefinitions.ts +26 -9
- package/src/operations/applications.ts +46 -17
- package/src/pagingHelper.ts +39 -0
- package/tsconfig.json +0 -2
- package/types/arm-managedapplications.d.ts +30 -8
- package/types/tsdoc-metadata.json +1 -1
|
@@ -11,15 +11,15 @@ import { PollerLike } from '@azure/core-lro';
|
|
|
11
11
|
import { PollOperationState } from '@azure/core-lro';
|
|
12
12
|
|
|
13
13
|
// @public
|
|
14
|
-
export
|
|
15
|
-
|
|
14
|
+
export interface Application extends GenericResource {
|
|
15
|
+
applicationDefinitionId?: string;
|
|
16
16
|
kind: string;
|
|
17
17
|
managedResourceGroupId: string;
|
|
18
|
-
applicationDefinitionId?: string;
|
|
19
|
-
parameters?: Record<string, unknown>;
|
|
20
18
|
readonly outputs?: Record<string, unknown>;
|
|
19
|
+
parameters?: Record<string, unknown>;
|
|
20
|
+
plan?: Plan;
|
|
21
21
|
readonly provisioningState?: ProvisioningState;
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
23
|
|
|
24
24
|
// @public
|
|
25
25
|
export interface ApplicationArtifact {
|
|
@@ -55,17 +55,17 @@ export interface ApplicationClientOptionalParams extends coreClient.ServiceClien
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// @public
|
|
58
|
-
export
|
|
59
|
-
lockLevel: ApplicationLockLevel;
|
|
60
|
-
displayName?: string;
|
|
61
|
-
isEnabled?: string;
|
|
62
|
-
authorizations: ApplicationProviderAuthorization[];
|
|
58
|
+
export interface ApplicationDefinition extends GenericResource {
|
|
63
59
|
artifacts?: ApplicationArtifact[];
|
|
60
|
+
authorizations: ApplicationProviderAuthorization[];
|
|
61
|
+
createUiDefinition?: Record<string, unknown>;
|
|
64
62
|
description?: string;
|
|
65
|
-
|
|
63
|
+
displayName?: string;
|
|
64
|
+
isEnabled?: string;
|
|
65
|
+
lockLevel: ApplicationLockLevel;
|
|
66
66
|
mainTemplate?: Record<string, unknown>;
|
|
67
|
-
|
|
68
|
-
}
|
|
67
|
+
packageFileUri?: string;
|
|
68
|
+
}
|
|
69
69
|
|
|
70
70
|
// @public
|
|
71
71
|
export interface ApplicationDefinitionListResult {
|
|
@@ -156,15 +156,15 @@ export interface ApplicationListResult {
|
|
|
156
156
|
export type ApplicationLockLevel = "CanNotDelete" | "ReadOnly" | "None";
|
|
157
157
|
|
|
158
158
|
// @public
|
|
159
|
-
export
|
|
160
|
-
|
|
159
|
+
export interface ApplicationPatchable extends GenericResource {
|
|
160
|
+
applicationDefinitionId?: string;
|
|
161
161
|
kind?: string;
|
|
162
162
|
managedResourceGroupId?: string;
|
|
163
|
-
applicationDefinitionId?: string;
|
|
164
|
-
parameters?: Record<string, unknown>;
|
|
165
163
|
readonly outputs?: Record<string, unknown>;
|
|
164
|
+
parameters?: Record<string, unknown>;
|
|
165
|
+
plan?: PlanPatchable;
|
|
166
166
|
readonly provisioningState?: ProvisioningState;
|
|
167
|
-
}
|
|
167
|
+
}
|
|
168
168
|
|
|
169
169
|
// @public
|
|
170
170
|
export interface ApplicationProviderAuthorization {
|
|
@@ -286,11 +286,14 @@ export interface ErrorResponse {
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
// @public
|
|
289
|
-
export
|
|
289
|
+
export interface GenericResource extends Resource {
|
|
290
|
+
identity?: Identity;
|
|
290
291
|
managedBy?: string;
|
|
291
292
|
sku?: Sku;
|
|
292
|
-
|
|
293
|
-
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// @public
|
|
296
|
+
export function getContinuationToken(page: unknown): string | undefined;
|
|
294
297
|
|
|
295
298
|
// @public
|
|
296
299
|
export interface Identity {
|
|
@@ -301,27 +304,16 @@ export interface Identity {
|
|
|
301
304
|
|
|
302
305
|
// @public
|
|
303
306
|
export enum KnownProvisioningState {
|
|
304
|
-
// (undocumented)
|
|
305
307
|
Accepted = "Accepted",
|
|
306
|
-
// (undocumented)
|
|
307
308
|
Canceled = "Canceled",
|
|
308
|
-
// (undocumented)
|
|
309
309
|
Created = "Created",
|
|
310
|
-
// (undocumented)
|
|
311
310
|
Creating = "Creating",
|
|
312
|
-
// (undocumented)
|
|
313
311
|
Deleted = "Deleted",
|
|
314
|
-
// (undocumented)
|
|
315
312
|
Deleting = "Deleting",
|
|
316
|
-
// (undocumented)
|
|
317
313
|
Failed = "Failed",
|
|
318
|
-
// (undocumented)
|
|
319
314
|
Ready = "Ready",
|
|
320
|
-
// (undocumented)
|
|
321
315
|
Running = "Running",
|
|
322
|
-
// (undocumented)
|
|
323
316
|
Succeeded = "Succeeded",
|
|
324
|
-
// (undocumented)
|
|
325
317
|
Updating = "Updating"
|
|
326
318
|
}
|
|
327
319
|
|
package/src/applicationClient.ts
CHANGED
|
@@ -8,8 +8,14 @@
|
|
|
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
|
-
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
17
|
+
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
|
|
18
|
+
import { setContinuationToken } from "./pagingHelper";
|
|
13
19
|
import { ApplicationsImpl, ApplicationDefinitionsImpl } from "./operations";
|
|
14
20
|
import { Applications, ApplicationDefinitions } from "./operationsInterfaces";
|
|
15
21
|
import * as Parameters from "./models/parameters";
|
|
@@ -56,47 +62,53 @@ export class ApplicationClient extends coreClient.ServiceClient {
|
|
|
56
62
|
credential: credentials
|
|
57
63
|
};
|
|
58
64
|
|
|
59
|
-
const packageDetails = `azsdk-js-arm-managedapplications/2.0
|
|
65
|
+
const packageDetails = `azsdk-js-arm-managedapplications/2.1.0`;
|
|
60
66
|
const userAgentPrefix =
|
|
61
67
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
62
68
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
63
69
|
: `${packageDetails}`;
|
|
64
70
|
|
|
65
|
-
if (!options.credentialScopes) {
|
|
66
|
-
options.credentialScopes = ["https://management.azure.com/.default"];
|
|
67
|
-
}
|
|
68
71
|
const optionsWithDefaults = {
|
|
69
72
|
...defaults,
|
|
70
73
|
...options,
|
|
71
74
|
userAgentOptions: {
|
|
72
75
|
userAgentPrefix
|
|
73
76
|
},
|
|
74
|
-
|
|
77
|
+
endpoint:
|
|
75
78
|
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
|
76
79
|
};
|
|
77
80
|
super(optionsWithDefaults);
|
|
78
81
|
|
|
82
|
+
let bearerTokenAuthenticationPolicyFound: boolean = false;
|
|
79
83
|
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
80
84
|
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
|
81
|
-
|
|
85
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
|
82
86
|
(pipelinePolicy) =>
|
|
83
87
|
pipelinePolicy.name ===
|
|
84
88
|
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
85
89
|
);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
}
|
|
91
|
+
if (
|
|
92
|
+
!options ||
|
|
93
|
+
!options.pipeline ||
|
|
94
|
+
options.pipeline.getOrderedPolicies().length == 0 ||
|
|
95
|
+
!bearerTokenAuthenticationPolicyFound
|
|
96
|
+
) {
|
|
97
|
+
this.pipeline.removePolicy({
|
|
98
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
99
|
+
});
|
|
100
|
+
this.pipeline.addPolicy(
|
|
101
|
+
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
102
|
+
credential: credentials,
|
|
103
|
+
scopes:
|
|
104
|
+
optionsWithDefaults.credentialScopes ??
|
|
105
|
+
`${optionsWithDefaults.endpoint}/.default`,
|
|
106
|
+
challengeCallbacks: {
|
|
107
|
+
authorizeRequestOnChallenge:
|
|
108
|
+
coreClient.authorizeRequestOnClaimChallenge
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
);
|
|
100
112
|
}
|
|
101
113
|
// Parameter assignments
|
|
102
114
|
this.subscriptionId = subscriptionId;
|
|
@@ -106,6 +118,35 @@ export class ApplicationClient extends coreClient.ServiceClient {
|
|
|
106
118
|
this.apiVersion = options.apiVersion || "2018-06-01";
|
|
107
119
|
this.applications = new ApplicationsImpl(this);
|
|
108
120
|
this.applicationDefinitions = new ApplicationDefinitionsImpl(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);
|
|
109
150
|
}
|
|
110
151
|
|
|
111
152
|
/**
|
|
@@ -123,22 +164,34 @@ export class ApplicationClient extends coreClient.ServiceClient {
|
|
|
123
164
|
[Symbol.asyncIterator]() {
|
|
124
165
|
return this;
|
|
125
166
|
},
|
|
126
|
-
byPage: () => {
|
|
127
|
-
|
|
167
|
+
byPage: (settings?: PageSettings) => {
|
|
168
|
+
if (settings?.maxPageSize) {
|
|
169
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
170
|
+
}
|
|
171
|
+
return this.listOperationsPagingPage(options, settings);
|
|
128
172
|
}
|
|
129
173
|
};
|
|
130
174
|
}
|
|
131
175
|
|
|
132
176
|
private async *listOperationsPagingPage(
|
|
133
|
-
options?: ListOperationsOptionalParams
|
|
177
|
+
options?: ListOperationsOptionalParams,
|
|
178
|
+
settings?: PageSettings
|
|
134
179
|
): AsyncIterableIterator<Operation[]> {
|
|
135
|
-
let result
|
|
136
|
-
|
|
137
|
-
|
|
180
|
+
let result: ListOperationsResponse;
|
|
181
|
+
let continuationToken = settings?.continuationToken;
|
|
182
|
+
if (!continuationToken) {
|
|
183
|
+
result = await this._listOperations(options);
|
|
184
|
+
let page = result.value || [];
|
|
185
|
+
continuationToken = result.nextLink;
|
|
186
|
+
setContinuationToken(page, continuationToken);
|
|
187
|
+
yield page;
|
|
188
|
+
}
|
|
138
189
|
while (continuationToken) {
|
|
139
190
|
result = await this._listOperationsNext(continuationToken, options);
|
|
140
191
|
continuationToken = result.nextLink;
|
|
141
|
-
|
|
192
|
+
let page = result.value || [];
|
|
193
|
+
setContinuationToken(page, continuationToken);
|
|
194
|
+
yield page;
|
|
142
195
|
}
|
|
143
196
|
}
|
|
144
197
|
|
package/src/index.ts
CHANGED
package/src/models/index.ts
CHANGED
|
@@ -162,17 +162,17 @@ export interface ApplicationListResult {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/** Resource information. */
|
|
165
|
-
export
|
|
165
|
+
export interface GenericResource extends Resource {
|
|
166
166
|
/** ID of the resource that manages this resource. */
|
|
167
167
|
managedBy?: string;
|
|
168
168
|
/** The SKU of the resource. */
|
|
169
169
|
sku?: Sku;
|
|
170
170
|
/** The identity of the resource. */
|
|
171
171
|
identity?: Identity;
|
|
172
|
-
}
|
|
172
|
+
}
|
|
173
173
|
|
|
174
174
|
/** Information about managed application. */
|
|
175
|
-
export
|
|
175
|
+
export interface Application extends GenericResource {
|
|
176
176
|
/** The plan information. */
|
|
177
177
|
plan?: Plan;
|
|
178
178
|
/** The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. */
|
|
@@ -193,10 +193,10 @@ export type Application = GenericResource & {
|
|
|
193
193
|
* NOTE: This property will not be serialized. It can only be populated by the server.
|
|
194
194
|
*/
|
|
195
195
|
readonly provisioningState?: ProvisioningState;
|
|
196
|
-
}
|
|
196
|
+
}
|
|
197
197
|
|
|
198
198
|
/** Information about managed application. */
|
|
199
|
-
export
|
|
199
|
+
export interface ApplicationPatchable extends GenericResource {
|
|
200
200
|
/** The plan information. */
|
|
201
201
|
plan?: PlanPatchable;
|
|
202
202
|
/** The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. */
|
|
@@ -217,10 +217,10 @@ export type ApplicationPatchable = GenericResource & {
|
|
|
217
217
|
* NOTE: This property will not be serialized. It can only be populated by the server.
|
|
218
218
|
*/
|
|
219
219
|
readonly provisioningState?: ProvisioningState;
|
|
220
|
-
}
|
|
220
|
+
}
|
|
221
221
|
|
|
222
222
|
/** Information about managed application definition. */
|
|
223
|
-
export
|
|
223
|
+
export interface ApplicationDefinition extends GenericResource {
|
|
224
224
|
/** The managed application lock level. */
|
|
225
225
|
lockLevel: ApplicationLockLevel;
|
|
226
226
|
/** The managed application definition display name. */
|
|
@@ -239,20 +239,31 @@ export type ApplicationDefinition = GenericResource & {
|
|
|
239
239
|
mainTemplate?: Record<string, unknown>;
|
|
240
240
|
/** The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. */
|
|
241
241
|
createUiDefinition?: Record<string, unknown>;
|
|
242
|
-
}
|
|
242
|
+
}
|
|
243
243
|
|
|
244
244
|
/** Known values of {@link ProvisioningState} that the service accepts. */
|
|
245
245
|
export enum KnownProvisioningState {
|
|
246
|
+
/** Accepted */
|
|
246
247
|
Accepted = "Accepted",
|
|
248
|
+
/** Running */
|
|
247
249
|
Running = "Running",
|
|
250
|
+
/** Ready */
|
|
248
251
|
Ready = "Ready",
|
|
252
|
+
/** Creating */
|
|
249
253
|
Creating = "Creating",
|
|
254
|
+
/** Created */
|
|
250
255
|
Created = "Created",
|
|
256
|
+
/** Deleting */
|
|
251
257
|
Deleting = "Deleting",
|
|
258
|
+
/** Deleted */
|
|
252
259
|
Deleted = "Deleted",
|
|
260
|
+
/** Canceled */
|
|
253
261
|
Canceled = "Canceled",
|
|
262
|
+
/** Failed */
|
|
254
263
|
Failed = "Failed",
|
|
264
|
+
/** Succeeded */
|
|
255
265
|
Succeeded = "Succeeded",
|
|
266
|
+
/** Updating */
|
|
256
267
|
Updating = "Updating"
|
|
257
268
|
}
|
|
258
269
|
|
|
@@ -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 { ApplicationDefinitions } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -18,12 +19,12 @@ import {
|
|
|
18
19
|
ApplicationDefinition,
|
|
19
20
|
ApplicationDefinitionsListByResourceGroupNextOptionalParams,
|
|
20
21
|
ApplicationDefinitionsListByResourceGroupOptionalParams,
|
|
22
|
+
ApplicationDefinitionsListByResourceGroupResponse,
|
|
21
23
|
ApplicationDefinitionsGetOptionalParams,
|
|
22
24
|
ApplicationDefinitionsGetResponse,
|
|
23
25
|
ApplicationDefinitionsDeleteOptionalParams,
|
|
24
26
|
ApplicationDefinitionsCreateOrUpdateOptionalParams,
|
|
25
27
|
ApplicationDefinitionsCreateOrUpdateResponse,
|
|
26
|
-
ApplicationDefinitionsListByResourceGroupResponse,
|
|
27
28
|
ApplicationDefinitionsGetByIdOptionalParams,
|
|
28
29
|
ApplicationDefinitionsGetByIdResponse,
|
|
29
30
|
ApplicationDefinitionsDeleteByIdOptionalParams,
|
|
@@ -62,19 +63,33 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions {
|
|
|
62
63
|
[Symbol.asyncIterator]() {
|
|
63
64
|
return this;
|
|
64
65
|
},
|
|
65
|
-
byPage: () => {
|
|
66
|
-
|
|
66
|
+
byPage: (settings?: PageSettings) => {
|
|
67
|
+
if (settings?.maxPageSize) {
|
|
68
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
69
|
+
}
|
|
70
|
+
return this.listByResourceGroupPagingPage(
|
|
71
|
+
resourceGroupName,
|
|
72
|
+
options,
|
|
73
|
+
settings
|
|
74
|
+
);
|
|
67
75
|
}
|
|
68
76
|
};
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
private async *listByResourceGroupPagingPage(
|
|
72
80
|
resourceGroupName: string,
|
|
73
|
-
options?: ApplicationDefinitionsListByResourceGroupOptionalParams
|
|
81
|
+
options?: ApplicationDefinitionsListByResourceGroupOptionalParams,
|
|
82
|
+
settings?: PageSettings
|
|
74
83
|
): AsyncIterableIterator<ApplicationDefinition[]> {
|
|
75
|
-
let result
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
let result: ApplicationDefinitionsListByResourceGroupResponse;
|
|
85
|
+
let continuationToken = settings?.continuationToken;
|
|
86
|
+
if (!continuationToken) {
|
|
87
|
+
result = await this._listByResourceGroup(resourceGroupName, options);
|
|
88
|
+
let page = result.value || [];
|
|
89
|
+
continuationToken = result.nextLink;
|
|
90
|
+
setContinuationToken(page, continuationToken);
|
|
91
|
+
yield page;
|
|
92
|
+
}
|
|
78
93
|
while (continuationToken) {
|
|
79
94
|
result = await this._listByResourceGroupNext(
|
|
80
95
|
resourceGroupName,
|
|
@@ -82,7 +97,9 @@ export class ApplicationDefinitionsImpl implements ApplicationDefinitions {
|
|
|
82
97
|
options
|
|
83
98
|
);
|
|
84
99
|
continuationToken = result.nextLink;
|
|
85
|
-
|
|
100
|
+
let page = result.value || [];
|
|
101
|
+
setContinuationToken(page, continuationToken);
|
|
102
|
+
yield page;
|
|
86
103
|
}
|
|
87
104
|
}
|
|
88
105
|
|
|
@@ -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 { Applications } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -18,8 +19,10 @@ import {
|
|
|
18
19
|
Application,
|
|
19
20
|
ApplicationsListByResourceGroupNextOptionalParams,
|
|
20
21
|
ApplicationsListByResourceGroupOptionalParams,
|
|
22
|
+
ApplicationsListByResourceGroupResponse,
|
|
21
23
|
ApplicationsListBySubscriptionNextOptionalParams,
|
|
22
24
|
ApplicationsListBySubscriptionOptionalParams,
|
|
25
|
+
ApplicationsListBySubscriptionResponse,
|
|
23
26
|
ApplicationsGetOptionalParams,
|
|
24
27
|
ApplicationsGetResponse,
|
|
25
28
|
ApplicationsDeleteOptionalParams,
|
|
@@ -27,8 +30,6 @@ import {
|
|
|
27
30
|
ApplicationsCreateOrUpdateResponse,
|
|
28
31
|
ApplicationsUpdateOptionalParams,
|
|
29
32
|
ApplicationsUpdateResponse,
|
|
30
|
-
ApplicationsListByResourceGroupResponse,
|
|
31
|
-
ApplicationsListBySubscriptionResponse,
|
|
32
33
|
ApplicationsGetByIdOptionalParams,
|
|
33
34
|
ApplicationsGetByIdResponse,
|
|
34
35
|
ApplicationsDeleteByIdOptionalParams,
|
|
@@ -70,19 +71,33 @@ export class ApplicationsImpl implements Applications {
|
|
|
70
71
|
[Symbol.asyncIterator]() {
|
|
71
72
|
return this;
|
|
72
73
|
},
|
|
73
|
-
byPage: () => {
|
|
74
|
-
|
|
74
|
+
byPage: (settings?: PageSettings) => {
|
|
75
|
+
if (settings?.maxPageSize) {
|
|
76
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
77
|
+
}
|
|
78
|
+
return this.listByResourceGroupPagingPage(
|
|
79
|
+
resourceGroupName,
|
|
80
|
+
options,
|
|
81
|
+
settings
|
|
82
|
+
);
|
|
75
83
|
}
|
|
76
84
|
};
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
private async *listByResourceGroupPagingPage(
|
|
80
88
|
resourceGroupName: string,
|
|
81
|
-
options?: ApplicationsListByResourceGroupOptionalParams
|
|
89
|
+
options?: ApplicationsListByResourceGroupOptionalParams,
|
|
90
|
+
settings?: PageSettings
|
|
82
91
|
): AsyncIterableIterator<Application[]> {
|
|
83
|
-
let result
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
let result: ApplicationsListByResourceGroupResponse;
|
|
93
|
+
let continuationToken = settings?.continuationToken;
|
|
94
|
+
if (!continuationToken) {
|
|
95
|
+
result = await this._listByResourceGroup(resourceGroupName, options);
|
|
96
|
+
let page = result.value || [];
|
|
97
|
+
continuationToken = result.nextLink;
|
|
98
|
+
setContinuationToken(page, continuationToken);
|
|
99
|
+
yield page;
|
|
100
|
+
}
|
|
86
101
|
while (continuationToken) {
|
|
87
102
|
result = await this._listByResourceGroupNext(
|
|
88
103
|
resourceGroupName,
|
|
@@ -90,7 +105,9 @@ export class ApplicationsImpl implements Applications {
|
|
|
90
105
|
options
|
|
91
106
|
);
|
|
92
107
|
continuationToken = result.nextLink;
|
|
93
|
-
|
|
108
|
+
let page = result.value || [];
|
|
109
|
+
setContinuationToken(page, continuationToken);
|
|
110
|
+
yield page;
|
|
94
111
|
}
|
|
95
112
|
}
|
|
96
113
|
|
|
@@ -121,22 +138,34 @@ export class ApplicationsImpl implements Applications {
|
|
|
121
138
|
[Symbol.asyncIterator]() {
|
|
122
139
|
return this;
|
|
123
140
|
},
|
|
124
|
-
byPage: () => {
|
|
125
|
-
|
|
141
|
+
byPage: (settings?: PageSettings) => {
|
|
142
|
+
if (settings?.maxPageSize) {
|
|
143
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
144
|
+
}
|
|
145
|
+
return this.listBySubscriptionPagingPage(options, settings);
|
|
126
146
|
}
|
|
127
147
|
};
|
|
128
148
|
}
|
|
129
149
|
|
|
130
150
|
private async *listBySubscriptionPagingPage(
|
|
131
|
-
options?: ApplicationsListBySubscriptionOptionalParams
|
|
151
|
+
options?: ApplicationsListBySubscriptionOptionalParams,
|
|
152
|
+
settings?: PageSettings
|
|
132
153
|
): AsyncIterableIterator<Application[]> {
|
|
133
|
-
let result
|
|
134
|
-
|
|
135
|
-
|
|
154
|
+
let result: ApplicationsListBySubscriptionResponse;
|
|
155
|
+
let continuationToken = settings?.continuationToken;
|
|
156
|
+
if (!continuationToken) {
|
|
157
|
+
result = await this._listBySubscription(options);
|
|
158
|
+
let page = result.value || [];
|
|
159
|
+
continuationToken = result.nextLink;
|
|
160
|
+
setContinuationToken(page, continuationToken);
|
|
161
|
+
yield page;
|
|
162
|
+
}
|
|
136
163
|
while (continuationToken) {
|
|
137
164
|
result = await this._listBySubscriptionNext(continuationToken, options);
|
|
138
165
|
continuationToken = result.nextLink;
|
|
139
|
-
|
|
166
|
+
let page = result.value || [];
|
|
167
|
+
setContinuationToken(page, continuationToken);
|
|
168
|
+
yield page;
|
|
140
169
|
}
|
|
141
170
|
}
|
|
142
171
|
|
|
@@ -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
|
+
}
|