@azure/arm-commitmentplans 2.0.0-alpha.20221101.2 → 2.0.0-alpha.20221202.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.
- package/CHANGELOG.md +3 -13
- package/dist/index.js +176 -54
- 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/azureMLCommitmentPlansManagementClient.d.ts +2 -0
- package/dist-esm/src/azureMLCommitmentPlansManagementClient.d.ts.map +1 -1
- package/dist-esm/src/azureMLCommitmentPlansManagementClient.js +48 -17
- package/dist-esm/src/azureMLCommitmentPlansManagementClient.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 +11 -4
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +7 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/operations/commitmentAssociations.d.ts.map +1 -1
- package/dist-esm/src/operations/commitmentAssociations.js +19 -7
- package/dist-esm/src/operations/commitmentAssociations.js.map +1 -1
- package/dist-esm/src/operations/commitmentPlans.d.ts.map +1 -1
- package/dist-esm/src/operations/commitmentPlans.js +37 -14
- package/dist-esm/src/operations/commitmentPlans.js.map +1 -1
- package/dist-esm/src/operations/operations.d.ts.map +1 -1
- package/dist-esm/src/operations/operations.js +8 -4
- package/dist-esm/src/operations/operations.js.map +1 -1
- package/dist-esm/src/operations/skus.d.ts.map +1 -1
- package/dist-esm/src/operations/skus.js +8 -4
- package/dist-esm/src/operations/skus.js.map +1 -1
- package/dist-esm/src/operations/usageHistory.d.ts.map +1 -1
- package/dist-esm/src/operations/usageHistory.js +19 -7
- package/dist-esm/src/operations/usageHistory.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-commitmentplans.api.md +7 -11
- package/src/azureMLCommitmentPlansManagementClient.ts +59 -19
- package/src/index.ts +1 -0
- package/src/models/index.ts +11 -4
- package/src/operations/commitmentAssociations.ts +23 -13
- package/src/operations/commitmentPlans.ts +46 -17
- package/src/operations/operations.ts +10 -5
- package/src/operations/skus.ts +10 -5
- package/src/operations/usageHistory.ts +22 -12
- package/src/pagingHelper.ts +39 -0
- package/types/arm-commitmentplans.d.ts +22 -4
- 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
|
OperationsImpl,
|
|
@@ -63,41 +68,47 @@ export class AzureMLCommitmentPlansManagementClient extends coreClient.ServiceCl
|
|
|
63
68
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
64
69
|
: `${packageDetails}`;
|
|
65
70
|
|
|
66
|
-
if (!options.credentialScopes) {
|
|
67
|
-
options.credentialScopes = ["https://management.azure.com/.default"];
|
|
68
|
-
}
|
|
69
71
|
const optionsWithDefaults = {
|
|
70
72
|
...defaults,
|
|
71
73
|
...options,
|
|
72
74
|
userAgentOptions: {
|
|
73
75
|
userAgentPrefix
|
|
74
76
|
},
|
|
75
|
-
|
|
77
|
+
endpoint:
|
|
76
78
|
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
|
77
79
|
};
|
|
78
80
|
super(optionsWithDefaults);
|
|
79
81
|
|
|
82
|
+
let bearerTokenAuthenticationPolicyFound: boolean = false;
|
|
80
83
|
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
81
84
|
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
|
|
82
|
-
|
|
85
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
|
|
83
86
|
(pipelinePolicy) =>
|
|
84
87
|
pipelinePolicy.name ===
|
|
85
88
|
coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
86
89
|
);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
);
|
|
101
112
|
}
|
|
102
113
|
// Parameter assignments
|
|
103
114
|
this.subscriptionId = subscriptionId;
|
|
@@ -110,6 +121,35 @@ export class AzureMLCommitmentPlansManagementClient extends coreClient.ServiceCl
|
|
|
110
121
|
this.commitmentAssociations = new CommitmentAssociationsImpl(this);
|
|
111
122
|
this.commitmentPlans = new CommitmentPlansImpl(this);
|
|
112
123
|
this.usageHistory = new UsageHistoryImpl(this);
|
|
124
|
+
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
128
|
+
private addCustomApiVersionPolicy(apiVersion?: string) {
|
|
129
|
+
if (!apiVersion) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const apiVersionPolicy = {
|
|
133
|
+
name: "CustomApiVersionPolicy",
|
|
134
|
+
async sendRequest(
|
|
135
|
+
request: PipelineRequest,
|
|
136
|
+
next: SendRequest
|
|
137
|
+
): Promise<PipelineResponse> {
|
|
138
|
+
const param = request.url.split("?");
|
|
139
|
+
if (param.length > 1) {
|
|
140
|
+
const newParams = param[1].split("&").map((item) => {
|
|
141
|
+
if (item.indexOf("api-version") > -1) {
|
|
142
|
+
return "api-version=" + apiVersion;
|
|
143
|
+
} else {
|
|
144
|
+
return item;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
request.url = param[0] + "?" + newParams.join("&");
|
|
148
|
+
}
|
|
149
|
+
return next(request);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
|
113
153
|
}
|
|
114
154
|
|
|
115
155
|
operations: Operations;
|
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 { AzureMLCommitmentPlansManagementClient } from "./azureMLCommitmentPlansManagementClient";
|
|
12
13
|
export * from "./operationsInterfaces";
|
package/src/models/index.ts
CHANGED
|
@@ -365,15 +365,15 @@ export interface PlanUsageHistory {
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
/** Represents the association between a commitment plan and some other resource, such as a Machine Learning web service. */
|
|
368
|
-
export
|
|
368
|
+
export interface CommitmentAssociation extends Resource {
|
|
369
369
|
/** An entity tag used to enforce optimistic concurrency. */
|
|
370
370
|
etag?: string;
|
|
371
371
|
/** The properties of the commitment association resource. */
|
|
372
372
|
properties?: CommitmentAssociationProperties;
|
|
373
|
-
}
|
|
373
|
+
}
|
|
374
374
|
|
|
375
375
|
/** An Azure ML commitment plan resource. */
|
|
376
|
-
export
|
|
376
|
+
export interface CommitmentPlan extends Resource {
|
|
377
377
|
/** An entity tag used to enforce optimistic concurrency. */
|
|
378
378
|
etag?: string;
|
|
379
379
|
/**
|
|
@@ -383,12 +383,15 @@ export type CommitmentPlan = Resource & {
|
|
|
383
383
|
readonly properties?: CommitmentPlanProperties;
|
|
384
384
|
/** The commitment plan SKU. */
|
|
385
385
|
sku?: ResourceSku;
|
|
386
|
-
}
|
|
386
|
+
}
|
|
387
387
|
|
|
388
388
|
/** Known values of {@link SkuCapacityScaleType} that the service accepts. */
|
|
389
389
|
export enum KnownSkuCapacityScaleType {
|
|
390
|
+
/** Automatic */
|
|
390
391
|
Automatic = "Automatic",
|
|
392
|
+
/** Manual */
|
|
391
393
|
Manual = "Manual",
|
|
394
|
+
/** None */
|
|
392
395
|
None = "None"
|
|
393
396
|
}
|
|
394
397
|
|
|
@@ -405,7 +408,9 @@ export type SkuCapacityScaleType = string;
|
|
|
405
408
|
|
|
406
409
|
/** Known values of {@link ResourceSkuRestrictionsType} that the service accepts. */
|
|
407
410
|
export enum KnownResourceSkuRestrictionsType {
|
|
411
|
+
/** Location */
|
|
408
412
|
Location = "location",
|
|
413
|
+
/** Zone */
|
|
409
414
|
Zone = "zone"
|
|
410
415
|
}
|
|
411
416
|
|
|
@@ -421,7 +426,9 @@ export type ResourceSkuRestrictionsType = string;
|
|
|
421
426
|
|
|
422
427
|
/** Known values of {@link ResourceSkuRestrictionsReasonCode} that the service accepts. */
|
|
423
428
|
export enum KnownResourceSkuRestrictionsReasonCode {
|
|
429
|
+
/** QuotaId */
|
|
424
430
|
QuotaId = "QuotaId",
|
|
431
|
+
/** NotAvailableForSubscription */
|
|
425
432
|
NotAvailableForSubscription = "NotAvailableForSubscription"
|
|
426
433
|
}
|
|
427
434
|
|
|
@@ -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 { CommitmentAssociations } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -16,9 +17,9 @@ import {
|
|
|
16
17
|
CommitmentAssociation,
|
|
17
18
|
CommitmentAssociationsListNextOptionalParams,
|
|
18
19
|
CommitmentAssociationsListOptionalParams,
|
|
20
|
+
CommitmentAssociationsListResponse,
|
|
19
21
|
CommitmentAssociationsGetOptionalParams,
|
|
20
22
|
CommitmentAssociationsGetResponse,
|
|
21
|
-
CommitmentAssociationsListResponse,
|
|
22
23
|
MoveCommitmentAssociationRequest,
|
|
23
24
|
CommitmentAssociationsMoveOptionalParams,
|
|
24
25
|
CommitmentAssociationsMoveResponse,
|
|
@@ -61,11 +62,15 @@ export class CommitmentAssociationsImpl implements CommitmentAssociations {
|
|
|
61
62
|
[Symbol.asyncIterator]() {
|
|
62
63
|
return this;
|
|
63
64
|
},
|
|
64
|
-
byPage: () => {
|
|
65
|
+
byPage: (settings?: PageSettings) => {
|
|
66
|
+
if (settings?.maxPageSize) {
|
|
67
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
68
|
+
}
|
|
65
69
|
return this.listPagingPage(
|
|
66
70
|
resourceGroupName,
|
|
67
71
|
commitmentPlanName,
|
|
68
|
-
options
|
|
72
|
+
options,
|
|
73
|
+
settings
|
|
69
74
|
);
|
|
70
75
|
}
|
|
71
76
|
};
|
|
@@ -74,15 +79,18 @@ export class CommitmentAssociationsImpl implements CommitmentAssociations {
|
|
|
74
79
|
private async *listPagingPage(
|
|
75
80
|
resourceGroupName: string,
|
|
76
81
|
commitmentPlanName: string,
|
|
77
|
-
options?: CommitmentAssociationsListOptionalParams
|
|
82
|
+
options?: CommitmentAssociationsListOptionalParams,
|
|
83
|
+
settings?: PageSettings
|
|
78
84
|
): AsyncIterableIterator<CommitmentAssociation[]> {
|
|
79
|
-
let result
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
options
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
let result: CommitmentAssociationsListResponse;
|
|
86
|
+
let continuationToken = settings?.continuationToken;
|
|
87
|
+
if (!continuationToken) {
|
|
88
|
+
result = await this._list(resourceGroupName, commitmentPlanName, options);
|
|
89
|
+
let page = result.value || [];
|
|
90
|
+
continuationToken = result.nextLink;
|
|
91
|
+
setContinuationToken(page, continuationToken);
|
|
92
|
+
yield page;
|
|
93
|
+
}
|
|
86
94
|
while (continuationToken) {
|
|
87
95
|
result = await this._listNext(
|
|
88
96
|
resourceGroupName,
|
|
@@ -91,7 +99,9 @@ export class CommitmentAssociationsImpl implements CommitmentAssociations {
|
|
|
91
99
|
options
|
|
92
100
|
);
|
|
93
101
|
continuationToken = result.nextLink;
|
|
94
|
-
|
|
102
|
+
let page = result.value || [];
|
|
103
|
+
setContinuationToken(page, continuationToken);
|
|
104
|
+
yield page;
|
|
95
105
|
}
|
|
96
106
|
}
|
|
97
107
|
|
|
@@ -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 { CommitmentPlans } 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
|
CommitmentPlan,
|
|
17
18
|
CommitmentPlansListNextOptionalParams,
|
|
18
19
|
CommitmentPlansListOptionalParams,
|
|
20
|
+
CommitmentPlansListResponse,
|
|
19
21
|
CommitmentPlansListInResourceGroupNextOptionalParams,
|
|
20
22
|
CommitmentPlansListInResourceGroupOptionalParams,
|
|
23
|
+
CommitmentPlansListInResourceGroupResponse,
|
|
21
24
|
CommitmentPlansGetOptionalParams,
|
|
22
25
|
CommitmentPlansGetResponse,
|
|
23
26
|
CommitmentPlansCreateOrUpdateOptionalParams,
|
|
@@ -26,8 +29,6 @@ import {
|
|
|
26
29
|
CommitmentPlanPatchPayload,
|
|
27
30
|
CommitmentPlansPatchOptionalParams,
|
|
28
31
|
CommitmentPlansPatchResponse,
|
|
29
|
-
CommitmentPlansListResponse,
|
|
30
|
-
CommitmentPlansListInResourceGroupResponse,
|
|
31
32
|
CommitmentPlansListNextResponse,
|
|
32
33
|
CommitmentPlansListInResourceGroupNextResponse
|
|
33
34
|
} from "../models";
|
|
@@ -60,22 +61,34 @@ export class CommitmentPlansImpl implements CommitmentPlans {
|
|
|
60
61
|
[Symbol.asyncIterator]() {
|
|
61
62
|
return this;
|
|
62
63
|
},
|
|
63
|
-
byPage: () => {
|
|
64
|
-
|
|
64
|
+
byPage: (settings?: PageSettings) => {
|
|
65
|
+
if (settings?.maxPageSize) {
|
|
66
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
67
|
+
}
|
|
68
|
+
return this.listPagingPage(options, settings);
|
|
65
69
|
}
|
|
66
70
|
};
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
private async *listPagingPage(
|
|
70
|
-
options?: CommitmentPlansListOptionalParams
|
|
74
|
+
options?: CommitmentPlansListOptionalParams,
|
|
75
|
+
settings?: PageSettings
|
|
71
76
|
): AsyncIterableIterator<CommitmentPlan[]> {
|
|
72
|
-
let result
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
let result: CommitmentPlansListResponse;
|
|
78
|
+
let continuationToken = settings?.continuationToken;
|
|
79
|
+
if (!continuationToken) {
|
|
80
|
+
result = await this._list(options);
|
|
81
|
+
let page = result.value || [];
|
|
82
|
+
continuationToken = result.nextLink;
|
|
83
|
+
setContinuationToken(page, continuationToken);
|
|
84
|
+
yield page;
|
|
85
|
+
}
|
|
75
86
|
while (continuationToken) {
|
|
76
87
|
result = await this._listNext(continuationToken, options);
|
|
77
88
|
continuationToken = result.nextLink;
|
|
78
|
-
|
|
89
|
+
let page = result.value || [];
|
|
90
|
+
setContinuationToken(page, continuationToken);
|
|
91
|
+
yield page;
|
|
79
92
|
}
|
|
80
93
|
}
|
|
81
94
|
|
|
@@ -104,19 +117,33 @@ export class CommitmentPlansImpl implements CommitmentPlans {
|
|
|
104
117
|
[Symbol.asyncIterator]() {
|
|
105
118
|
return this;
|
|
106
119
|
},
|
|
107
|
-
byPage: () => {
|
|
108
|
-
|
|
120
|
+
byPage: (settings?: PageSettings) => {
|
|
121
|
+
if (settings?.maxPageSize) {
|
|
122
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
123
|
+
}
|
|
124
|
+
return this.listInResourceGroupPagingPage(
|
|
125
|
+
resourceGroupName,
|
|
126
|
+
options,
|
|
127
|
+
settings
|
|
128
|
+
);
|
|
109
129
|
}
|
|
110
130
|
};
|
|
111
131
|
}
|
|
112
132
|
|
|
113
133
|
private async *listInResourceGroupPagingPage(
|
|
114
134
|
resourceGroupName: string,
|
|
115
|
-
options?: CommitmentPlansListInResourceGroupOptionalParams
|
|
135
|
+
options?: CommitmentPlansListInResourceGroupOptionalParams,
|
|
136
|
+
settings?: PageSettings
|
|
116
137
|
): AsyncIterableIterator<CommitmentPlan[]> {
|
|
117
|
-
let result
|
|
118
|
-
|
|
119
|
-
|
|
138
|
+
let result: CommitmentPlansListInResourceGroupResponse;
|
|
139
|
+
let continuationToken = settings?.continuationToken;
|
|
140
|
+
if (!continuationToken) {
|
|
141
|
+
result = await this._listInResourceGroup(resourceGroupName, options);
|
|
142
|
+
let page = result.value || [];
|
|
143
|
+
continuationToken = result.nextLink;
|
|
144
|
+
setContinuationToken(page, continuationToken);
|
|
145
|
+
yield page;
|
|
146
|
+
}
|
|
120
147
|
while (continuationToken) {
|
|
121
148
|
result = await this._listInResourceGroupNext(
|
|
122
149
|
resourceGroupName,
|
|
@@ -124,7 +151,9 @@ export class CommitmentPlansImpl implements CommitmentPlans {
|
|
|
124
151
|
options
|
|
125
152
|
);
|
|
126
153
|
continuationToken = result.nextLink;
|
|
127
|
-
|
|
154
|
+
let page = result.value || [];
|
|
155
|
+
setContinuationToken(page, continuationToken);
|
|
156
|
+
yield page;
|
|
128
157
|
}
|
|
129
158
|
}
|
|
130
159
|
|
|
@@ -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
|
-
|
|
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<OperationEntity[]> {
|
|
58
|
-
let result
|
|
62
|
+
let result: OperationsListResponse;
|
|
63
|
+
result = await this._list(options);
|
|
59
64
|
yield result.value || [];
|
|
60
65
|
}
|
|
61
66
|
|
package/src/operations/skus.ts
CHANGED
|
@@ -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 { Skus } 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 SkusImpl implements Skus {
|
|
|
46
46
|
[Symbol.asyncIterator]() {
|
|
47
47
|
return this;
|
|
48
48
|
},
|
|
49
|
-
byPage: () => {
|
|
50
|
-
|
|
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?: SkusListOptionalParams
|
|
59
|
+
options?: SkusListOptionalParams,
|
|
60
|
+
_settings?: PageSettings
|
|
57
61
|
): AsyncIterableIterator<CatalogSku[]> {
|
|
58
|
-
let result
|
|
62
|
+
let result: SkusListResponse;
|
|
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 { UsageHistory } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -56,11 +57,15 @@ export class UsageHistoryImpl implements UsageHistory {
|
|
|
56
57
|
[Symbol.asyncIterator]() {
|
|
57
58
|
return this;
|
|
58
59
|
},
|
|
59
|
-
byPage: () => {
|
|
60
|
+
byPage: (settings?: PageSettings) => {
|
|
61
|
+
if (settings?.maxPageSize) {
|
|
62
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
63
|
+
}
|
|
60
64
|
return this.listPagingPage(
|
|
61
65
|
resourceGroupName,
|
|
62
66
|
commitmentPlanName,
|
|
63
|
-
options
|
|
67
|
+
options,
|
|
68
|
+
settings
|
|
64
69
|
);
|
|
65
70
|
}
|
|
66
71
|
};
|
|
@@ -69,15 +74,18 @@ export class UsageHistoryImpl implements UsageHistory {
|
|
|
69
74
|
private async *listPagingPage(
|
|
70
75
|
resourceGroupName: string,
|
|
71
76
|
commitmentPlanName: string,
|
|
72
|
-
options?: UsageHistoryListOptionalParams
|
|
77
|
+
options?: UsageHistoryListOptionalParams,
|
|
78
|
+
settings?: PageSettings
|
|
73
79
|
): AsyncIterableIterator<PlanUsageHistory[]> {
|
|
74
|
-
let result
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
options
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
let result: UsageHistoryListResponse;
|
|
81
|
+
let continuationToken = settings?.continuationToken;
|
|
82
|
+
if (!continuationToken) {
|
|
83
|
+
result = await this._list(resourceGroupName, commitmentPlanName, options);
|
|
84
|
+
let page = result.value || [];
|
|
85
|
+
continuationToken = result.nextLink;
|
|
86
|
+
setContinuationToken(page, continuationToken);
|
|
87
|
+
yield page;
|
|
88
|
+
}
|
|
81
89
|
while (continuationToken) {
|
|
82
90
|
result = await this._listNext(
|
|
83
91
|
resourceGroupName,
|
|
@@ -86,7 +94,9 @@ export class UsageHistoryImpl implements UsageHistory {
|
|
|
86
94
|
options
|
|
87
95
|
);
|
|
88
96
|
continuationToken = result.nextLink;
|
|
89
|
-
|
|
97
|
+
let page = result.value || [];
|
|
98
|
+
setContinuationToken(page, continuationToken);
|
|
99
|
+
yield page;
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
102
|
|
|
@@ -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
|
+
}
|
|
@@ -13,6 +13,8 @@ export declare class AzureMLCommitmentPlansManagementClient extends coreClient.S
|
|
|
13
13
|
* @param options The parameter options
|
|
14
14
|
*/
|
|
15
15
|
constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AzureMLCommitmentPlansManagementClientOptionalParams);
|
|
16
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
17
|
+
private addCustomApiVersionPolicy;
|
|
16
18
|
operations: Operations;
|
|
17
19
|
skus: Skus;
|
|
18
20
|
commitmentAssociations: CommitmentAssociations;
|
|
@@ -75,12 +77,12 @@ export declare interface CatalogSku {
|
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
/** Represents the association between a commitment plan and some other resource, such as a Machine Learning web service. */
|
|
78
|
-
export declare
|
|
80
|
+
export declare interface CommitmentAssociation extends Resource {
|
|
79
81
|
/** An entity tag used to enforce optimistic concurrency. */
|
|
80
82
|
etag?: string;
|
|
81
83
|
/** The properties of the commitment association resource. */
|
|
82
84
|
properties?: CommitmentAssociationProperties;
|
|
83
|
-
}
|
|
85
|
+
}
|
|
84
86
|
|
|
85
87
|
/** A page of commitment association resources. */
|
|
86
88
|
export declare interface CommitmentAssociationListResult {
|
|
@@ -170,7 +172,7 @@ export declare interface CommitmentAssociationsMoveOptionalParams extends coreCl
|
|
|
170
172
|
export declare type CommitmentAssociationsMoveResponse = CommitmentAssociation;
|
|
171
173
|
|
|
172
174
|
/** An Azure ML commitment plan resource. */
|
|
173
|
-
export declare
|
|
175
|
+
export declare interface CommitmentPlan extends Resource {
|
|
174
176
|
/** An entity tag used to enforce optimistic concurrency. */
|
|
175
177
|
etag?: string;
|
|
176
178
|
/**
|
|
@@ -180,7 +182,7 @@ export declare type CommitmentPlan = Resource & {
|
|
|
180
182
|
readonly properties?: CommitmentPlanProperties;
|
|
181
183
|
/** The commitment plan SKU. */
|
|
182
184
|
sku?: ResourceSku;
|
|
183
|
-
}
|
|
185
|
+
}
|
|
184
186
|
|
|
185
187
|
/** A page of commitment plan resources. */
|
|
186
188
|
export declare interface CommitmentPlanListResult {
|
|
@@ -363,22 +365,38 @@ export declare type CommitmentPlansPatchResponse = CommitmentPlan;
|
|
|
363
365
|
export declare interface CommitmentPlansRemoveOptionalParams extends coreClient.OperationOptions {
|
|
364
366
|
}
|
|
365
367
|
|
|
368
|
+
/**
|
|
369
|
+
* Given a result page from a pageable operation, returns a
|
|
370
|
+
* continuation token that can be used to begin paging from
|
|
371
|
+
* that point later.
|
|
372
|
+
* @param page A result object from calling .byPage() on a paged operation.
|
|
373
|
+
* @returns The continuation token that can be passed into byPage().
|
|
374
|
+
*/
|
|
375
|
+
export declare function getContinuationToken(page: unknown): string | undefined;
|
|
376
|
+
|
|
366
377
|
/** Known values of {@link ResourceSkuRestrictionsReasonCode} that the service accepts. */
|
|
367
378
|
export declare enum KnownResourceSkuRestrictionsReasonCode {
|
|
379
|
+
/** QuotaId */
|
|
368
380
|
QuotaId = "QuotaId",
|
|
381
|
+
/** NotAvailableForSubscription */
|
|
369
382
|
NotAvailableForSubscription = "NotAvailableForSubscription"
|
|
370
383
|
}
|
|
371
384
|
|
|
372
385
|
/** Known values of {@link ResourceSkuRestrictionsType} that the service accepts. */
|
|
373
386
|
export declare enum KnownResourceSkuRestrictionsType {
|
|
387
|
+
/** Location */
|
|
374
388
|
Location = "location",
|
|
389
|
+
/** Zone */
|
|
375
390
|
Zone = "zone"
|
|
376
391
|
}
|
|
377
392
|
|
|
378
393
|
/** Known values of {@link SkuCapacityScaleType} that the service accepts. */
|
|
379
394
|
export declare enum KnownSkuCapacityScaleType {
|
|
395
|
+
/** Automatic */
|
|
380
396
|
Automatic = "Automatic",
|
|
397
|
+
/** Manual */
|
|
381
398
|
Manual = "Manual",
|
|
399
|
+
/** None */
|
|
382
400
|
None = "None"
|
|
383
401
|
}
|
|
384
402
|
|